1#ifndef __JSUPERNOVA_JSUPERNOVA__
2#define __JSUPERNOVA_JSUPERNOVA__
69 this->multiplicity = 0;
70 this->mean_dir_ctheta = -2;
71 this->mean_dir_norm = -1;
101 if (hits.size() == 0)
return 1;
103 double first_hit_time = 0;
105 this->multiplicity = 0;
108 for(
auto &hit: hits){
109 this->multiplicity++;
110 this->total_ToT += hit.getToT();
112 this->deltaT += hit.getT() - first_hit_time;
114 else first_hit_time = hit.getT();
115 int channel_id = hit.getPMT();
118 mean_pmt_dir += pmt.getDirection();
121 if (this->multiplicity >= 2) {
124 this->deltaT /= (this->multiplicity-1);
142 return (time < rhs.
time);
205 :
public vector<JCoincidenceSN> {
234 for (vector<JHitR0>::const_iterator p = in.begin(); p != in.end(); ) {
236 vector<JHitR0>::const_iterator q = p;
238 while (++q != in.end() && q->getT() - p->getT() <=
TMax_ns ) {}
244 if (det.size() > 0) {
246 coincidence_hits.assign(p,q);
247 coincidence(coincidence_hits, det);
249 this->push_back(coincidence);
281 for (JDAQTimeslice::const_iterator frame = timeslice->begin(); frame != timeslice->end(); ++frame) {
283 int moduleID = frame->getModuleID();
285 JSuperFrame2D_t& buffer = JSuperFrame2D_t::demultiplex(*frame,
291 JSuperFrame1D_t& data = JSuperFrame1D_t::multiplex(buffer);
293 if (det.size() < 0)(*this)(data, moduleID);
294 else (*
this)(data, moduleID, det);
298 sort(this->begin(), this->end());
344 return any_of(this->begin(), this->end(),
JMatchVeto(in));
362 JClusterSN::const_iterator p = this->begin();
364 for (JClusterSN::const_iterator q = p + 1; q != this->end(); q++) {
365 if (q->getMultiplicity() > p->getMultiplicity()) {
382 for (JClusterSN::const_iterator p = this->begin(); p != this->end(); p++) {
383 out.insert(p->getModule());
428 bool out = (*this)(in.
getPeak());
507 for (vector<JCoincidenceSN>::const_iterator p = in.begin(); p != in.end(); ) {
511 cluster.push_back(*p);
513 vector<JCoincidenceSN>::const_iterator q = p + 1;
515 while(q != in.end() && (q->getTime() <= (p->getTime() +
TMaxCluster_ns))) {
516 cluster.push_back(*q);
522 this->push_back(cluster);
539 for (JTriggerSN::const_iterator p = this->begin(); p != this->end(); p++) {
544 triggeredModules.insert((*p)[0].
getModule());
550 return triggeredModules;
562 for (JTriggerSN::const_iterator p = this->begin(); p != this->end(); p++) {
564 out.insert(p->getPeak().getModule());
574 for (JTriggerSN::const_iterator p = this->begin(); p != this->end(); p++) {
576 out->Fill( p->getPeak().getMultiplicity() );
584 for (JTriggerSN::const_iterator p = this->begin(); p != this->end(); p++) {
586 out.push_back( p->getPeak().getMultiplicity() );
644 os <<
"=== SUPERNOVA TRIGGER STATISTICS ==" << endl;
645 os <<
"=> livetime [s] = " <<
livetime << endl;
646 os <<
"Level" <<
'\t' <<
"Rate (error)" << endl;
649 for (
unsigned i = 0; i < this->size(); i++) {
651 double count = (*this)[i];
653 double error = 100 * (sqrt(count) / count);
657 os << scientific << setprecision(2) << rate <<
"Hz ";
658 os << fixed << setprecision(0) <<
"(" << setw(2) << error <<
"%)";
681 for (
unsigned i = 0; i < this->size(); i++) {
683 double count = (*this)[i];
685 double error = (sqrt(count) / count);
690 os << setprecision(2);
Direct access to PMT data in detector data structure for DAQ hits.
Data structure for detector geometry and calibration.
Basic data structure for L0 hit.
Match operator for consecutive hits.
Direct access to module in detector data structure.
Auxiliaries for pre-processing of hits.
Auxiliary class to define a range between two values.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Simple wrapper around JModuleRouter class for direct addressing of PMT data in detector data structur...
const JPMT & getPMT(const JDAQKeyHit &hit) const
Get PMT parameters.
const JPMT & getPMT(const JPMTAddress &address) const
Get PMT parameters.
Router for direct addressing of module data in detector data structure.
const JModule & getModule(const JObjectID &id) const
Get module parameters.
Address of PMT in detector data structure.
const JDirection3D & getDirection() const
Get direction.
Data structure for vector in three dimensions.
double getLength() const
Get length.
double getZ() const
Get z position.
Auxiliary class to manage a cluster of coincidences.
JCoincidenceSN getPeak() const
Finds coincidence with maximum multiplicity.
JModuleSet getModules() const
Auxiliary class to store reduced information of a coincidence on an optical module This class allows ...
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, bool fake=false)
Constructor:
int getMultiplicity() const
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...
bool operator<(const JCoincidenceSN &rhs) const
Auxiliary class to build the supernova trigger dataset.
JDataSN(double window, int threshold=4)
Default constructor Configures the trigger with a time window and the pretrigger threshold.
void operator()(const vector< JHitR0 > &in, const int &moduleID, const JDetector &det=JDetector())
Builds coincidences from calibrated hit data and loads them in the internal vector.
Auxiliary class-operator to match a JVeto with a JCoincidenceSN object Provides an operator to test i...
bool operator()(const JVeto &in)
Operator.
JMatchVeto(const JCoincidenceSN &in)
Default constructor.
SN filter based on veto window.
JSNFilterMV(JRange< int > &R, JVetoSet &S)
bool operator()(const JCoincidenceSN &in) const
SN filter based on multiplicity selection optional suppression of multi-module coincidences WARNING: ...
JSNFilterM(JRange< int > R, int m=0)
bool operator()(const JCoincidenceSN &in) const
Interface for SN filter operator.
virtual bool operator()(const JCoincidenceSN &in) const =0
SN trigger statistics, the information is stored in the form of a count as a function of the trigger ...
string toString()
put statistics into printable form outputs trigger level - rate - error
void setLiveTime(const double lt)
JTriggerSNStats(const int nModules)
default constructor
string toSummaryFile()
put statistics into printable form outputs trigger level - rate - error
Auxiliary class to apply the supernova trigger to SN data.
void fill(TH1D *out, const JSNFilter &F)
Fill histogram with multiplicity spectrum resulting from given filter.
void operator()(const JDataSN &in)
Builds trigger by clustering pretrigger data.
JTriggerSN(double TMax_ns)
Default constructor.
JModuleSet getModules(const JSNFilter &F)
Get triggered modules according to given filter.
JModuleSet getModules(JRange< int > A=JRange< int >(6, 10))
Get triggered modules after track veto.
vector< double > getMultiplicities(const JSNFilter &F)
bool operator<(const JTriggerSN &rhs) const
< operator
bool operator>(const JTriggerSN &rhs) const
Auxiliary class to manage a set of vetoes.
bool operator()(const JCoincidenceSN &in) const
Applies the veto set to a coincidence.
Auxiliary class to define a veto time window on a set of optical modules.
double getLength()
Get length of veto time range.
bool operator()(const JCoincidenceSN &in) const
Determines if a coincidence is vetoed.
JVeto(const JDAQEvent &event, const JDAQHitRouter &hitRouter)
Default constructor.
Reduced data structure for L0 hit.
1-dimensional frame with time calibrated data from one optical module.
2-dimensional frame with time calibrated data from one optical module.
JDAQUTCExtended getTimesliceStart() const
Get start of timeslice.
int getFrameIndex() const
Get frame index.
const_iterator< T > end() const
Get end of data.
const_iterator< T > begin() const
Get begin of data.
Data structure for UTC time.
const JModule & getModule(const JType< JDetector_t > type, const int id, const JLocation &location=JLocation())
Get module according given detector type.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
vector< double > multiplicities_t
const char * getTime()
Get current local time conform ISO-8601 standard.
KM3NeT DAQ data structures and auxiliaries.
Normalisation of MUPAGE events.
Default class to select DAQ hits.
Auxiliary class to select DAQ hits.
@ join_t
join consecutive hits according match criterion