1 #ifndef __JSUPERNOVA_JSUPERNOVA__
2 #define __JSUPERNOVA_JSUPERNOVA__
23 namespace JSUPERNOVA {
27 using namespace KM3NETDAQ;
43 : time(t), multiplicity(m), moduleID(dom)
59 return (time < rhs.
time);
88 hit != event.
end<JHit_t>();
91 moduleSet.insert(hit->getModuleID());
103 return timeRange.getLength();
111 return timeRange(in.
getTime()) &&
112 (moduleSet.find(in.
getModule()) != moduleSet.end());
122 :
public vector<JCoincidenceSN> {
137 : TMax_ns(window), multiplicityThreshold(threshold)
153 while (++q != in.end() && q->getT() - p->getT() <= TMax_ns ) {}
155 int M = distance(p, q);
157 if (M >= multiplicityThreshold)
185 for (JDAQTimeslice::const_iterator frame = timeslice->begin(); frame != timeslice->end(); ++frame) {
187 int moduleID = frame->getModuleID();
189 JSuperFrame2D_t& buffer = JSuperFrame2D_t::demultiplex(*frame, moduleRouter.
getModule(moduleID));
193 JSuperFrame1D_t& data = JSuperFrame1D_t::multiplex(buffer); data.pop_back();
195 (*this)(data, moduleID);
199 sort(this->begin(), this->end());
245 return any_of(this->begin(), this->end(),
JMatchVeto(in));
264 for (JClusterSN::const_iterator p = this->begin(); p != this->end(); p++) {
265 out.insert(p->getModule());
281 for (JClusterSN::const_iterator p = this->begin(); p != this->end(); p++) {
282 if (p->getMultiplicity() >= multiplicityThreshold) {
283 out.insert(p->getModule());
301 virtual bool operator() (
const JClusterSN& in) = 0;
323 bool out = any_of(in.begin(), in.end(), *
this);
344 numberOfModules(n), multiplicityThreshold(m)
353 return (modules.size() <= 1);
376 return any_of(in.begin(), in.end(), *
this);
389 double TMaxCluster_ms = 1000.0;
405 TMaxCluster_ms(TMax_ms)
427 cluster.push_back(*p);
431 while(q != in.end() && (q->getTime() <= (p->getTime() + TMaxCluster_ms))) {
432 cluster.push_back(*q);
438 this->push_back(cluster);
454 const int nBenchmarks = 3;
458 bench[0] = count_if(this->begin(), this->end(),
JSNFilterM(A, 0));
459 bench[1] = count_if(this->begin(), this->end(),
JSNFilterM(A, 1));
460 bench[2] = count_if(this->begin(), this->end(),
JSNFilterMV(A, veto));
478 for (JTriggerSN::const_iterator p = this->begin(); p != this->end(); p++) {
481 triggeredModules.insert((*p)[0].
getModule());
486 return triggeredModules;
509 for (JTriggerSN::const_iterator p = this->begin(); p != this->end(); p++) {
514 for (JClusterSN::const_iterator q = p->begin(); q != p->end(); q++) {
554 : DETID(d), activeModules(am), RUNNR(r), frame(f), trigger(tr), time(tm)
558 out << summary.
DETID <<
" ";
560 out << summary.
RUNNR <<
" ";
561 out << summary.
frame <<
" ";
562 out << summary.
time <<
" ";
611 os <<
"=== SUPERNOVA TRIGGER STATISTICS ==" << endl;
612 os <<
"=> livetime [s] = " <<
livetime << endl;
613 os <<
"Level" <<
'\t' <<
"Rate (error)" << endl;
616 for (
unsigned i = 0; i < this->size(); i++) {
618 double count = (*this)[i];
620 double error = 100 * (sqrt(count) / count);
624 os << scientific << setprecision(2) << rate <<
"Hz ";
625 os << fixed << setprecision(0) <<
"(" << setw(2) << error <<
"%)";
648 for (
unsigned i = 0; i < this->size(); i++) {
650 double count = (*this)[i];
652 double error = (sqrt(count) / count);
657 os << setprecision(2);
Auxiliary class to set-up Hit.
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.
bool operator>(const JTriggerSN &rhs) const
operatorused by (reverse) std:priority_queue, in absence of this operator the container will behave u...
SN trigger summary information.
Direct access to PMT data in detector data structure for DAQ hits.
const JDAQUTCExtended & getTimesliceStart() const
Get start of timeslice.
JSummarySN(int d, int am, int r, int f, JDAQUTCExtended tm, int tr)
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.
SN filter based on veto window.
Router for direct addressing of module data in detector data structure.
bool operator<(const JCoincidenceSN &rhs) const
JModuleSet getModules(int multiplicityThreshold) const
Structure to store the ToT mean and standard deviation of the hits produced by a nanobeacon in a sour...
friend std::istream & operator>>(std::istream &in, JSummarySN &summary)
int getMultiplicity() const
JSuperFrame2D< hit_type > JSuperFrame2D_t
double getTime(const Hit &hit)
Get true time of hit.
Data structure for UTC time.
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
const_iterator< T > end() const
Get end of data.
void setVeto(JVetoSet &vt)
void fill(TH1D *out, const JSNFilter &F)
Get modules according to a filter criterion JModuleSet getModules(const JSNFilter& F) { JModuleSet ou...
const_iterator< T > begin() const
Get begin of data.
int multiplicityThreshold
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 ...
JCoincidenceSN(double t, int m, int dom)
JVeto(const JDAQEvent &event, const JDAQHitRouter &hitRouter)
Default constructor.
Auxiliary class to apply the supernova trigger to SN data.
SN filter based on multiplicity selection optional suppression of multi-module coincidences.
vector< int > benchmark(JRange< int > A=JRange< int >(6, 10))
Benchmark different trigger steps.
bool operator<(const JTriggerSN &rhs) const
< operator
Direct access to module in detector data structure.
Select clusters without correlated coincidences.
Auxiliary class to build the supernova trigger dataset.
Normalisation of MUPAGE events.
Auxiliary class to define a range between two values.
JSNFilterMV(JRange< int > &R, JVetoSet &S)
Auxiliary class to manage a cluster of coincidences.
std::vector< frame_type >::iterator iterator
Auxiliary class to check whether two consecutive hits should be joined.
Auxiliary class-operator to match a JVeto with a JCoincidenceSN object Provides an operator to test i...
int multiplicityThreshold
2-dimensional frame with time calibrated data from one optical module.
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.
friend std::ostream & operator<<(std::ostream &out, const JSummarySN &summary)
JTriggerSN(JRange< int > tRange, double TMax_ms)
Default constructor.
JSNFilterM(JRange< int > R, int m=0)
JSNFilterNM(const int n, const int m)
const JModule & getModule(const JDetector &detector, const JModuleLocation &location)
find module with a given string and floor number
JSuperFrame1D< hit_type > JSuperFrame1D_t
Auxiliary class to manage a set of vetoes.