61{
62
65
67 JLimit_t& numberOfEvents = inputFile.getLimit();
69 string detectorFile;
70 double TMax_ns;
71 double TVeto_ns;
72 JToTRange_t totRange_ns;
76 int preTriggerThreshold;
77
78
79
80 try {
81
82 JParser<> zap(
"Example application to study supernova detection background");
83
92 zap[
'P'] =
make_field(preTriggerThreshold) = 4;
94
95 zap(argc, argv);
96 }
97 catch(const exception &error) {
98 FATAL(error.what() << endl);
99 }
100
101 cout.tie(&cerr);
102
104
105 try {
107 }
110 }
111
112 TTree *tr = new TTree("singledom", "SN coincidence info");
114 int frame_number;
116
117
118
119
120
121
123
125
127
128 pts->configure(inputFile);
129
130
131
132
133 int fEnd = pts->rbegin()->getFrameIndex();
134 int fStart = pts->begin( )->getFrameIndex();
135
136
137
138 if (fEnd > inputFile.getUpperLimit()) {
139 fEnd = fStart + inputFile.getUpperLimit();
140 }
141
142 int fLength = 1 + fEnd - fStart;
143
144 NOTICE(
"begin | end | length = " << fStart <<
" | " << fEnd <<
" | " << fLength << endl);
145
146
147
149
151
152
153
154
155
156
157 int runNumber = 0;
158
159 TH1D* h_vtr = new TH1D("VetoTimeRange","VetoTimeRange", 10000, 0, 10000);
160
162
164
165 for (; evIn.hasNext(); ) {
166
167 STATUS(
"event: " << setw(10) << evIn.getCounter() <<
'\r');
DEBUG(endl);
168
170
171 if (!runNumber) { runNumber = event->getRunNumber(); }
172
173 JVeto vp(*event, hitRouter);
174
175 triggeredEvents[event->getFrameIndex()].push_back(vp);
176
177 h_vtr->Fill(vp.getLength());
178
179 }
180
181 STATUS(triggeredEvents.size() <<
" JDAQEvents loaded in veto buffer." << endl);
182
183
184
185
186
188
189 TFile *out =
new TFile(
outputFile.c_str(),
"RECREATE");
190 tr->SetDirectory(out);
191
192 for ( ; pts->hasNext() && counter != inputFile.getLimit(); ++counter) {
193
194 STATUS(
"timeslice: " << setw(10) << counter <<
'\r');
DEBUG(endl);
195
197
199
200 if (counter == 0) {
202 }
203
205
206 if (triggeredEvents.count(frame_number)) {
207 veto = triggeredEvents.at(frame_number);
208 }
209
210
211
212 JDataSN preTrigger(TMax_ns, preTriggerThreshold);
213
214 preTrigger(timeslice, moduleRouter, totSelector_ns);
215
217
219
220
221
222
223
225
226
228
229
231
234
236 SNdata = p.getPeak();
237 SNdata.vetoIndex = trgA1(p) ? (trgAV(p) ? 0 : 2) : (trgAV(p) ? 1 : 3);
238 SNdata.timeslice_time = event_time;
239 tr->Fill();
240 }
241 }
242
243
244
245
246
247 tr->Write();
248 out->Close();
249}
int initialize_root_tree(JCoincidenceSN &obs, int *frame_number, TTree *tr)
Initialize the output ROOT file with CCSN candidate information.
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Simple wrapper around JModuleRouter class for direct addressing of PMT data in detector data structur...
Router for direct addressing of module data in detector data structure.
Utility class to parse command line options.
Auxiliary class to store reduced information of a coincidence on an optical module This class allows ...
Auxiliary class to build the supernova trigger dataset.
SN filter based on veto window.
SN filter based on multiplicity selection optional suppression of multi-module coincidences WARNING: ...
Auxiliary class to apply the supernova trigger to SN data.
Auxiliary class to manage a set of vetoes.
Auxiliary class to define a veto time window on a set of optical modules.
Auxiliary interface for direct access of elements in ROOT TChain.
Template definition for direct access of elements in ROOT TChain.
JDAQUTCExtended getTimesliceStart() const
Get start of timeslice.
int getFrameIndex() const
Get frame index.
JTriggerCounter_t next()
Increment trigger counter.
Data structure for UTC time.
double getTimeNanoSecond() const
Get time (limited to 16 ns cycles).
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
std::set< JROOTClassSelector > getROOTClassSelection(const bool option=false)
Get ROOT class selection.
Long64_t counter_type
Type definition for counter.
Type definition of range.
Auxiliary class for a type holder.
Auxiliary class to select ROOT class based on class name.
Auxiliary class to select JTreeScanner based on ROOT class name.
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.
Auxiliary class to select DAQ hits based on time-over-treshold value.