1 #ifndef __JSUPERNOVA_JSUPERNOVA__
2 #define __JSUPERNOVA_JSUPERNOVA__
37 namespace JSUPERNOVA {
41 using namespace KM3NETDAQ;
61 double mean_dir_ctheta = -2;
62 double mean_dir_norm = -1;
64 double total_ToT = -1;
68 this->multiplicity = 0;
69 this->mean_dir_ctheta = -2;
70 this->mean_dir_norm = -1;
88 JCoincidenceSN(
double t,
int m,
int dom,
int vetoIndex=-1,
double ctheta=-2,
double rnorm=-1,
double deltaT=-1,
double total_ToT=-1,
double timeslice_time=-1)
89 : time(t), timeslice_time(timeslice_time), moduleID(dom), vetoIndex(vetoIndex), multiplicity(m), mean_dir_ctheta(ctheta), mean_dir_norm(rnorm), deltaT(deltaT), total_ToT(total_ToT)
99 if (hits.size() == 0)
return 1;
101 double first_hit_time = 0;
103 this->multiplicity = 0;
106 for(
auto &hit: hits){
107 this->multiplicity++;
108 this->total_ToT += hit.getToT();
110 this->deltaT += hit.getT() - first_hit_time;
112 else first_hit_time = hit.getT();
113 int channel_id = hit.getPMT();
116 mean_pmt_dir += pmt.getDirection();
119 if (this->multiplicity >= 2) {
120 this->mean_dir_norm = mean_pmt_dir.
getLength()/this->multiplicity;
121 this->mean_dir_ctheta = mean_pmt_dir.
getZ()/this->multiplicity;
122 this->deltaT /= (this->multiplicity-1);
140 return (time < rhs.
time);
169 hit != event.
end<hit_type>();
172 moduleSet.insert(hit->getModuleID());
184 return timeRange.getLength();
192 return timeRange(in.
getTime()) &&
193 (moduleSet.find(in.
getModule()) != moduleSet.end());
203 :
public vector<JCoincidenceSN> {
219 : TMax_ns(window), min_M(threshold)
236 while (++q != in.end() && q->getT() - p->getT() <= TMax_ns ) {}
242 if (det.size() > 0) {
244 coincidence_hits.assign(p,q);
245 coincidence(coincidence_hits, det);
247 this->push_back(coincidence);
279 for (JDAQTimeslice::const_iterator frame = timeslice->begin(); frame != timeslice->end(); ++frame) {
281 int moduleID = frame->getModuleID();
283 JSuperFrame2D_t& buffer = JSuperFrame2D_t::demultiplex(*frame,
289 JSuperFrame1D_t&
data = JSuperFrame1D_t::multiplex(buffer);
291 if (det.size() < 0)(*
this)(
data, moduleID);
292 else (*
this)(
data, moduleID, det);
296 sort(this->begin(), this->end());
342 return any_of(this->begin(), this->end(),
JMatchVeto(in));
360 JClusterSN::const_iterator p = this->begin();
362 for (JClusterSN::const_iterator q = p + 1; q != this->end(); q++) {
363 if (q->getMultiplicity() > p->getMultiplicity()) {
380 for (JClusterSN::const_iterator p = this->begin(); p != this->end(); p++) {
381 out.insert(p->getModule());
397 virtual bool operator() (
const JClusterSN& in)
const = 0;
426 bool out = (*this)(in.
getPeak());
472 double TMaxCluster_ns = 1000.0;
487 TMaxCluster_ns(TMax_ns)
509 cluster.push_back(*p);
513 while(q != in.end() && (q->getTime() <= (p->getTime() + TMaxCluster_ns))) {
514 cluster.push_back(*q);
520 this->push_back(cluster);
537 for (JTriggerSN::const_iterator p = this->begin(); p != this->end(); p++) {
542 triggeredModules.insert((*p)[0].
getModule());
548 return triggeredModules;
560 for (JTriggerSN::const_iterator p = this->begin(); p != this->end(); p++) {
562 out.insert(p->getPeak().getModule());
572 for (JTriggerSN::const_iterator p = this->begin(); p != this->end(); p++) {
574 out->Fill( p->getPeak().getMultiplicity() );
582 for (JTriggerSN::const_iterator p = this->begin(); p != this->end(); p++) {
584 out.push_back( p->getPeak().getMultiplicity() );
642 os <<
"=== SUPERNOVA TRIGGER STATISTICS ==" << endl;
643 os <<
"=> livetime [s] = " <<
livetime << endl;
644 os <<
"Level" <<
'\t' <<
"Rate (error)" << endl;
647 for (
unsigned i = 0;
i < this->size();
i++) {
649 double count = (*this)[
i];
651 double error = 100 * (sqrt(count) /
count);
655 os << scientific << setprecision(2) << rate <<
"Hz ";
656 os << fixed << setprecision(0) <<
"(" << setw(2) << error <<
"%)";
679 for (
unsigned i = 0;
i < this->size();
i++) {
681 double count = (*this)[
i];
683 double error = (sqrt(count) /
count);
688 os << setprecision(2);
double getLength()
Get length of veto time range.
JTriggerSNStats(const int nModules)
default constructor
Interface for SN filter operator.
Auxiliary class to store reduced information of a coincidence on an optical module This class allows ...
bool operator>(const JTriggerSN &rhs) const
operatorused by (reverse) std:priority_queue, in absence of this operator the container will behave u...
Auxiliaries for pre-processing of hits.
Direct access to PMT data in detector data structure for DAQ hits.
JDAQUTCExtended getTimesliceStart() const
Get start of timeslice.
JModuleSet getModules() const
Basic data structure for L0 hit.
const JModule & getModule(const JObjectID &id) const
Get module parameters.
JModuleSet getModules(JRange< int > A=JRange< int >(6, 10))
Get triggered modules after track veto.
JMatchVeto(const JCoincidenceSN &in)
Default constructor.
Auxiliary class to define a veto time window on a set of optical modules.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
const JDirection3D & getDirection() const
Get direction.
SN filter based on veto window.
Router for direct addressing of module data in detector data structure.
then set_variable singlesRate set_variable doublesRate set_variable numberOfSlices echo Generating random background echo Singles rate
bool operator<(const JCoincidenceSN &rhs) const
then usage $script< input file >[option] nPossible options count
int getMultiplicity() const
JTriggerSN(double TMax_ns)
Default constructor.
const JPMT & getPMT(const JPMTAddress &address) const
Get PMT parameters.
double getTime(const Hit &hit)
Get true time of hit.
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
Data structure for UTC time.
Data structure for detector geometry and calibration.
Default class to select DAQ hits.
Simple wrapper around JModuleRouter class for direct addressing of PMT data in detector data structur...
int getFrameIndex() const
Get frame index.
1-dimensional frame with time calibrated data from one optical module.
string toSummaryFile()
put statistics into printable form outputs trigger level - rate - error
JCoincidenceSN getPeak() const
Finds coincidence with maximum multiplicity.
const_iterator< T > end() const
Get end of data.
join consecutive hits according match criterion
Reduced data structure for L0 hit.
Data structure for vector in three dimensions.
void fill(TH1D *out, const JSNFilter &F)
Fill histogram with multiplicity spectrum resulting from given filter.
const_iterator< T > begin() const
Get begin of data.
string toString()
put statistics into printable form outputs trigger level - rate - error
SN trigger statistics, the information is stored in the form of a count as a function of the trigger ...
JVeto(const JDAQEvent &event, const JDAQHitRouter &hitRouter)
Default constructor.
vector< double > multiplicities_t
Auxiliary class to apply the supernova trigger to SN data.
SN filter based on multiplicity selection optional suppression of multi-module coincidences WARNING: ...
Match operator for consecutive hits.
double getLength() const
Get length.
bool operator<(const JTriggerSN &rhs) const
< operator
Direct access to module in detector data structure.
then JCookie sh JDataQuality D $DETECTOR_ID R
Auxiliary class to build the supernova trigger dataset.
JModuleSet getModules(const JSNFilter &F)
Get triggered modules according to given filter.
Normalisation of MUPAGE events.
Address of PMT in detector data structure.
Auxiliary class to define a range between two values.
then fatal The output file must have the wildcard in the e g root fi eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
JSNFilterMV(JRange< int > &R, JVetoSet &S)
Auxiliary class to manage a cluster of coincidences.
JCoincidenceSN(double t, int m, int dom, int vetoIndex=-1, double ctheta=-2, double rnorm=-1, double deltaT=-1, double total_ToT=-1, double timeslice_time=-1)
Constructor:
Auxiliary class-operator to match a JVeto with a JCoincidenceSN object Provides an operator to test i...
2-dimensional frame with time calibrated data from one optical module.
Auxiliary class to select DAQ hits.
void setLiveTime(const double lt)
JDataSN(double window, int threshold=4)
Default constructor Configures the trigger with a time window and the pretrigger threshold.
const JPMT & getPMT(const JDAQKeyHit &hit) const
Get PMT parameters.
source $JPP_DIR setenv csh $JPP_DIR &dev null eval JShellParser o a A
JSNFilterM(JRange< int > R, int m=0)
double getZ() const
Get z position.
bool operator()(const vector< JHitR0 > &hits, const JDetector &det)
Compute single-DOM observables |R|, cos(theta), total ToT, and Delta(t) and set the corresponding cla...
const JModule & getModule(const JDetector &detector, const JModuleLocation &location)
find module with a given string and floor number
vector< double > getMultiplicities(const JSNFilter &F)
Auxiliary class to manage a set of vetoes.