1#ifndef __JSUPERNOVA_JSUPERNOVA__
2#define __JSUPERNOVA_JSUPERNOVA__
69 this->multiplicity = 0;
70 this->mean_dir_ctheta = -2;
71 this->mean_dir_norm = -1;
102 if (hits.size() == 0)
return 1;
104 double first_hit_time = 0;
106 this->multiplicity = 0;
109 for(
auto &hit: hits){
110 this->multiplicity++;
111 this->total_ToT += hit.getToT();
113 this->deltaT += hit.getT() - first_hit_time;
115 else first_hit_time = hit.getT();
116 int channel_id = hit.getPMT();
119 mean_pmt_dir += pmt.getDirection();
122 if (this->multiplicity >= 2) {
125 this->deltaT /= (this->multiplicity-1);
143 return (time < rhs.
time);
206 :
public vector<JCoincidenceSN> {
235 for (vector<JHitR0>::const_iterator p = in.begin(); p != in.end(); ) {
237 vector<JHitR0>::const_iterator q = p;
239 while (++q != in.end() && q->getT() - p->getT() <=
TMax_ns ) {}
245 if (det.size() > 0) {
247 coincidence_hits.assign(p,q);
248 coincidence(coincidence_hits, det);
250 this->push_back(coincidence);
282 for (JDAQTimeslice::const_iterator frame = timeslice->begin(); frame != timeslice->end(); ++frame) {
284 int moduleID = frame->getModuleID();
286 JSuperFrame2D_t& buffer = JSuperFrame2D_t::demultiplex(*frame,
292 JSuperFrame1D_t& data = JSuperFrame1D_t::multiplex(buffer);
294 if (det.size() < 0)(*this)(data, moduleID);
295 else (*
this)(data, moduleID, det);
299 sort(this->begin(), this->end());
345 return any_of(this->begin(), this->end(),
JMatchVeto(in));
363 JClusterSN::const_iterator p = this->begin();
365 for (JClusterSN::const_iterator q = p + 1; q != this->end(); q++) {
366 if (q->getMultiplicity() > p->getMultiplicity()) {
383 for (JClusterSN::const_iterator p = this->begin(); p != this->end(); p++) {
384 out.insert(p->getModule());
429 bool out = (*this)(in.
getPeak());
508 for (vector<JCoincidenceSN>::const_iterator p = in.begin(); p != in.end(); ) {
512 cluster.push_back(*p);
514 vector<JCoincidenceSN>::const_iterator q = p + 1;
516 while(q != in.end() && (q->getTime() <= (p->getTime() +
TMaxCluster_ns))) {
517 cluster.push_back(*q);
523 this->push_back(cluster);
540 for (JTriggerSN::const_iterator p = this->begin(); p != this->end(); p++) {
545 triggeredModules.insert((*p)[0].
getModule());
551 return triggeredModules;
563 for (JTriggerSN::const_iterator p = this->begin(); p != this->end(); p++) {
565 out.insert(p->getPeak().getModule());
575 for (JTriggerSN::const_iterator p = this->begin(); p != this->end(); p++) {
577 out->Fill( p->getPeak().getMultiplicity() );
585 for (JTriggerSN::const_iterator p = this->begin(); p != this->end(); p++) {
587 out.push_back( p->getPeak().getMultiplicity() );
645 os <<
"=== SUPERNOVA TRIGGER STATISTICS ==" << endl;
646 os <<
"=> livetime [s] = " <<
livetime << endl;
647 os <<
"Level" <<
'\t' <<
"Rate (error)" << endl;
650 for (
unsigned i = 0; i < this->size(); i++) {
652 double count = (*this)[i];
654 double error = 100 * (sqrt(count) / count);
658 os << scientific << setprecision(2) << rate <<
"Hz ";
659 os << fixed << setprecision(0) <<
"(" << setw(2) << error <<
"%)";
682 for (
unsigned i = 0; i < this->size(); i++) {
684 double count = (*this)[i];
686 double error = (sqrt(count) / count);
691 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