51{
52
54
56 JLimit_t& numberOfEvents = inputFile.getLimit();
58 string detectorFile;
59 double TMax_ns;
60 double TVeto_ns;
64 int preTriggerThreshold;
66
67
68
69
70 try {
71
72 JParser<> zap(
"Example program test supernova triggers.");
73
83 zap[
't'] =
make_field(preTriggerThreshold) = 4;
85
86 zap(argc, argv);
87 }
88 catch(const exception &error) {
89 FATAL(error.what() << endl);
90 }
91
92
94
95 try {
97 }
100 }
101
102
103
105
107
109
110 pts->configure(inputFile);
111
112
113
115
117
118
119
120
121
122 TH1D* h_vtr = new TH1D("VetoTimeRange","VetoTimeRange", 10000, 0, 10000);
123
125
127
128 for (; evIn.hasNext(); ) {
129
130 STATUS(
"event: " << setw(10) << evIn.getCounter() <<
'\r');
DEBUG(endl);
131
133
134 JVeto vp(*event, hitRouter);
135
136 triggeredEvents[event->getFrameIndex()].push_back(vp);
137
138 h_vtr->Fill(vp.getLength());
139
140 }
141
142 STATUS(triggeredEvents.size() <<
" JDAQEvents loaded in veto buffer." << endl);
143
144
145
146
147
148
149
150
151
152
153
154
156
157 JManager_t SNT(new TH1D("SNT_F%", NULL, 100, 0.0, 100));
158
159 JManager_t MUL(new TH1D("MUL_F%", NULL, 1 + 31, -0.5, 31 + 1 - 0.5));
160
161 const int nStages = 5;
163
164
165
167
168 for ( ; pts->hasNext() && counter != inputFile.getLimit(); ++counter) {
169
170 STATUS(
"timeslice: " << setw(10) << counter <<
'\r');
DEBUG(endl);
171
173
175
176 JDataSN preTrigger(TMax_ns, preTriggerThreshold);
177
178 preTrigger(timeslice, moduleRouter, totSelector_ns);
179
181
183
184
185
187
188 if (triggeredEvents.count(fIndex)) {
189 veto = triggeredEvents.at(fIndex);
190 }
191
192
193
194
195
198
200
203
204 int rawCount = count_if(preTrigger.begin(), preTrigger.end(), trgF0);
205
209 int domCountF1 =
trigger.getModules(trgF1).size();
210
211 trgHistory[0].push_back(rawCount);
212 trgHistory[1].push_back(trgCountF0);
213 trgHistory[2].push_back(trgCountF1);
214 trgHistory[3].push_back(trgCountFV);
215 trgHistory[4].push_back(domCountF1);
216
221
222 }
223
224
225
226
227
228 for (int i = 0; i < nStages; i++) {
229 for (
unsigned j = 0;
j < trgHistory[i].size();
j++) {
230 SNT[i]->Fill(trgHistory[i][
j]);
231 }
232 }
233
234 SNT[0]->SetTitle("M[6,10] count before clustering");
235 SNT[1]->SetTitle("M[6,10] count after clustering");
236 SNT[2]->SetTitle("M[6,10] count after track self-veto");
237 SNT[3]->SetTitle("M[6,10] count after track trigger-veto");
238 SNT[4]->SetTitle("M[6,10] count after track self-veto, unique modules");
239
240
242
244
245 h_vtr->Write();
246 SNT.Write(out);
247 MUL.Write(out);
248
250
251 out.Close();
252 }
253}
#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 manage set of compatible ROOT objects (e.g. histograms) using unique keys.
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.
int getFrameIndex() const
Get frame index.
JTriggerCounter_t next()
Increment trigger counter.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
bool putObject(TDirectory &dir, const TObject &object)
Write object to ROOT directory.
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.