1#ifndef __JSUPERNOVA_JSUPERNOVA__
2#define __JSUPERNOVA_JSUPERNOVA__
68 this->multiplicity = 0;
69 this->mean_dir_ctheta = -2;
70 this->mean_dir_norm = -1;
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) {
122 this->deltaT /= (this->multiplicity-1);
140 return (time < rhs.
time);
203 :
public vector<JCoincidenceSN> {
232 for (vector<JHitR0>::const_iterator p = in.begin(); p != in.end(); ) {
234 vector<JHitR0>::const_iterator q = p;
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());
426 bool out = (*this)(in.
getPeak());
505 for (vector<JCoincidenceSN>::const_iterator p = in.begin(); p != in.end(); ) {
509 cluster.push_back(*p);
511 vector<JCoincidenceSN>::const_iterator q = p + 1;
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);
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 ...
int getMultiplicity() const
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:
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