1 #ifndef __JSUPERNOVA_JSUPERNOVA__
2 #define __JSUPERNOVA_JSUPERNOVA__
29 namespace JSUPERNOVA {
33 using namespace KM3NETDAQ;
60 for (JModuleSet::const_iterator p = in.begin(); p != in.end(); ++p) {
80 : time(t), multiplicity(m), moduleID(dom)
96 return (time < rhs.
time);
125 hit != event.
end<hit_type>();
128 moduleSet.insert(hit->getModuleID());
140 return timeRange.getLength();
148 return timeRange(in.
getTime()) &&
149 (moduleSet.find(in.
getModule()) != moduleSet.end());
159 :
public vector<JCoincidenceSN> {
174 : TMax_ns(window), min_M(threshold)
190 while (++q != in.end() && q->getT() - p->getT() <= TMax_ns ) {}
225 for (JDAQTimeslice::const_iterator frame = timeslice->begin(); frame != timeslice->end(); ++frame) {
227 int moduleID = frame->getModuleID();
229 JSuperFrame2D_t& buffer = JSuperFrame2D_t::demultiplex(*frame, moduleRouter.
getModule(moduleID));
233 JSuperFrame1D_t& data = JSuperFrame1D_t::multiplex(buffer); data.pop_back();
235 (*this)(data, moduleID);
239 sort(this->begin(), this->end());
285 return any_of(this->begin(), this->end(),
JMatchVeto(in));
303 JClusterSN::const_iterator p = this->begin();
305 for (JClusterSN::const_iterator q = p + 1; q != this->end(); q++) {
306 if (q->getMultiplicity() > p->getMultiplicity()) {
323 for (JClusterSN::const_iterator p = this->begin(); p != this->end(); p++) {
324 out.insert(p->getModule());
340 virtual bool operator() (
const JClusterSN& in)
const = 0;
369 bool out = (*this)(in.
getPeak());
415 double TMaxCluster_ns = 1000.0;
430 TMaxCluster_ns(TMax_ns)
452 cluster.push_back(*p);
456 while(q != in.end() && (q->getTime() <= (p->getTime() + TMaxCluster_ns))) {
457 cluster.push_back(*q);
463 this->push_back(cluster);
480 for (JTriggerSN::const_iterator p = this->begin(); p != this->end(); p++) {
485 triggeredModules.insert((*p)[0].
getModule());
491 return triggeredModules;
503 for (JTriggerSN::const_iterator p = this->begin(); p != this->end(); p++) {
505 out.insert(p->getPeak().getModule());
515 for (JTriggerSN::const_iterator p = this->begin(); p != this->end(); p++) {
517 out->Fill( p->getPeak().getMultiplicity() );
525 for (JTriggerSN::const_iterator p = this->begin(); p != this->end(); p++) {
527 out.push_back( p->getPeak().getMultiplicity() );
585 os <<
"=== SUPERNOVA TRIGGER STATISTICS ==" << endl;
586 os <<
"=> livetime [s] = " <<
livetime << endl;
587 os <<
"Level" <<
'\t' <<
"Rate (error)" << endl;
590 for (
unsigned i = 0; i < this->size(); i++) {
592 double count = (*this)[i];
594 double error = 100 * (sqrt(count) /
count);
598 os << scientific << setprecision(2) << rate <<
"Hz ";
599 os << fixed << setprecision(0) <<
"(" << setw(2) << error <<
"%)";
622 for (
unsigned i = 0; i < this->size(); i++) {
624 double count = (*this)[i];
626 double error = (sqrt(count) /
count);
631 os << setprecision(2);
int getModuleIndex(const JLocation &location, const int numberOfFloors)
Get ordinal of a module according to increasing number of string and floor.
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...
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.
int getFloor() const
Get floor number.
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.
then check_input_file $DETECTOR $INPUT_FILE for OPTION in A B C D E F
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
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
int getMultiplicity() const
JTriggerSN(double TMax_ns)
Default constructor.
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
JCoincidenceSN getPeak() const
Finds coincidence with maximum multiplicity.
const_iterator< T > end() const
Get end of data.
void setVeto(JVetoSet &vt)
join consecutive hits according match criterion
Reduced data structure for L0 hit.
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.
Logical location of module.
const JLocation & getLocation() const
Get location.
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.
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.
then usage $script[distance] fi case set_variable R
bool operator<(const JTriggerSN &rhs) const
< operator
Direct access to module in detector data structure.
Auxiliary class to build the supernova trigger dataset.
do set_variable SIGMA_NS set_variable OUTLIERS set_variable OUTPUT_FILE matrix[${ALPHA_DEG}\deg\] root $JPP JMatrixNZ a $DETECTOR f $INPUT_FILE o $OUTPUT_FILE S
int getString() const
Get string number.
JModuleSet getModules(const JSNFilter &F)
Get triggered modules according to given filter.
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.
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.
void setLiveTime(const double lt)
JDataSN(double window, int threshold=4)
Default constructor Configures the trigger with a time window and the pretrigger threshold.
set< int > getModuleIndices(const JModuleSet &in, const JModuleRouter &router, int numberOfFloors=18)
Get module indices from a set of modules.
const JPMT & getPMT(const JDAQKeyHit &hit) const
Get PMT parameters.
JSNFilterM(JRange< int > R, int m=0)
source $JPP_DIR setenv csh $JPP_DIR eval JShellParser o a A
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.