34 using namespace KM3NETDAQ;
35 using namespace JSUPERNOVA;
36 using namespace JROOT;
51 tr->Branch(
"dom_id", &obs.
moduleID,
"dom_id/I");
52 tr->Branch(
"vetoIndex", &obs.
vetoIndex,
"vetoIndex/I");
53 tr->Branch(
"event_time", &obs.
time,
"event_time/D");
54 tr->Branch(
"timeslice_time_s", &obs.
timeslice_time,
"timeslice_time_s/D");
55 tr->Branch(
"frame_number", frame_number,
"frame_number/I");
56 tr->Branch(
"multiplicity", &(obs.
multiplicity),
"multiplicity/I");
60 int main(
int argc,
char **argv)
67 JLimit_t& numberOfEvents = inputFile.getLimit();
72 JToTRange_t totRange_ns;
76 int preTriggerThreshold;
82 JParser<> zap(
"Example application to study supernova detection background");
85 zap[
'o'] =
make_field(outputFile) =
"kaboom.root";
86 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
90 zap[
'C'] =
make_field(selector) = getROOTClassSelection<JDAQTimesliceTypes_t>();
92 zap[
'P'] =
make_field(preTriggerThreshold) = 4;
97 catch(
const exception &error) {
98 FATAL(error.what() << endl);
106 load(detectorFile, detector);
112 TTree *tr =
new TTree(
"singledom",
"SN coincidence info");
128 pts->configure(inputFile);
133 int fEnd = pts->rbegin()->getFrameIndex();
134 int fStart = pts->begin( )->getFrameIndex();
138 if (fEnd > inputFile.getUpperLimit()) {
139 fEnd = fStart + inputFile.getUpperLimit();
142 int fLength = 1 + fEnd - fStart;
144 NOTICE(
"begin | end | length = " << fStart <<
" | " << fEnd <<
" | " << fLength << endl);
159 TH1D* h_vtr =
new TH1D(
"VetoTimeRange",
"VetoTimeRange", 10000, 0, 10000);
165 for (; evIn.hasNext(); ) {
167 STATUS(
"event: " << setw(10) << evIn.getCounter() <<
'\r');
DEBUG(endl);
171 if (!runNumber) { runNumber =
event->getRunNumber(); }
173 JVeto vp(*event, hitRouter);
175 triggeredEvents[
event->getFrameIndex()].push_back(vp);
181 STATUS(triggeredEvents.size() <<
" JDAQEvents loaded in veto buffer." << endl);
189 TFile *out =
new TFile(outputFile.c_str(),
"RECREATE");
190 tr->SetDirectory(out);
192 for ( ; pts->hasNext() && counter != inputFile.getLimit(); ++counter) {
194 STATUS(
"timeslice: " << setw(10) << counter <<
'\r');
DEBUG(endl);
206 if (triggeredEvents.count(frame_number)) {
207 veto = triggeredEvents.at(frame_number);
212 JDataSN preTrigger(TMax_ns, preTriggerThreshold);
214 preTrigger(timeslice, moduleRouter, totSelector_ns);
235 for(
auto &p: trigger){
236 SNdata = p.getPeak();
237 SNdata.
vetoIndex = trgA1(p) ? (trgAV(p) ? 0 : 2) : (trgAV(p) ? 1 : 3);
double getLength()
Get length of veto time range.
Auxiliary class to store reduced information of a coincidence on an optical module This class allows ...
Utility class to parse command line options.
int main(int argc, char *argv[])
JDAQUTCExtended getTimesliceStart() const
Get start of timeslice.
ROOT TTree parameter settings of various packages.
int initialize_root_tree(JCoincidenceSN &obs, int *frame_number, TTree *tr)
Initialize the output ROOT file with CCSN candidate information.
Auxiliary class to define a veto time window on a set of optical modules.
Auxiliary class to select ROOT class based on class name.
SN filter based on veto window.
Router for direct addressing of module data in detector data structure.
Auxiliary interface for direct access of elements in ROOT TChain.
Long64_t counter_type
Type definition for counter.
Auxiliary class for a type holder.
Data structure for UTC time.
Template definition for direct access of elements in ROOT TChain.
Data structure for detector geometry and calibration.
Simple wrapper around JModuleRouter class for direct addressing of PMT data in detector data structur...
int getFrameIndex() const
Get frame index.
Auxiliary class for defining the range of iterations of objects.
Type definition of range.
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Auxiliary class to apply the supernova trigger to SN data.
SN filter based on multiplicity selection optional suppression of multi-module coincidences WARNING: ...
General purpose messaging.
Auxiliary class to select JTreeScanner based on ROOT class name.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Auxiliary class to build the supernova trigger dataset.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Utility class to parse command line options.
Auxiliary class to select DAQ hits based on time-over-treshold value.
do set_variable DETECTOR_TXT $WORKDIR detector
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
source $JPP_DIR setenv csh $JPP_DIR &dev null eval JShellParser o a A
double getTimeNanoSecond() const
Get time (limited to 16 ns cycles).
#define DEBUG(A)
Message macros.
Auxiliary class to manage a set of vetoes.