54 JLimit_t& numberOfEvents = inputFile.getLimit();
61 int preTriggerThreshold;
69 JParser<> zap(
"Example program test supernova triggers.");
72 zap[
'o'] =
make_field(outputFile) =
"kexing.root";
73 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
77 zap[
'C'] =
make_field(selector) = getROOTClassSelection<JDAQTimesliceTypes_t>();
80 zap[
't'] =
make_field(preTriggerThreshold) = 4;
84 catch(
const exception &error) {
85 FATAL(error.what() << endl);
93 load(detectorFile, detector);
107 pts->configure(inputFile);
119 TH1D* h_vtr =
new TH1D(
"VetoTimeRange",
"VetoTimeRange", 10000, 0, 10000);
125 for (; evIn.hasNext(); ) {
127 STATUS(
"event: " << setw(10) << evIn.getCounter() <<
'\r');
DEBUG(endl);
131 JVeto vp(*event, hitRouter);
133 triggeredEvents[
event->getFrameIndex()].push_back(vp);
135 h_vtr->Fill(vp.getLength());
139 STATUS(triggeredEvents.size() <<
" JDAQEvents loaded in veto buffer." << endl);
154 JManager_t SNT(
new TH1D(
"SNT_F%", NULL, 100, 0.0, 100));
156 JManager_t MUL(
new TH1D(
"MUL_F%", NULL, 1 + 31, -0.5, 31 + 1 - 0.5));
158 const int nStages = 5;
165 for ( ; pts->hasNext() && counter != inputFile.getLimit(); ++counter) {
167 STATUS(
"timeslice: " << setw(10) << counter <<
'\r');
DEBUG(endl);
173 JDataSN preTrigger(TMax_ns, preTriggerThreshold);
175 preTrigger(timeslice, moduleRouter);
185 if (triggeredEvents.count(fIndex)) {
186 veto = triggeredEvents.at(fIndex);
189 trigger.setVeto(veto);
201 int rawCount = count_if(preTrigger.begin(), preTrigger.end(), trgF0);
203 int trgCountF0 = count_if(trigger.begin(), trigger.end(), trgF0);
204 int trgCountF1 = count_if(trigger.begin(), trigger.end(), trgF1);
205 int trgCountFV = count_if(trigger.begin(), trigger.end(), trgFV);
206 int domCountF1 = trigger.getModules(trgF1).size();
208 trgHistory[0].push_back(rawCount);
209 trgHistory[1].push_back(trgCountF0);
210 trgHistory[2].push_back(trgCountF1);
211 trgHistory[3].push_back(trgCountFV);
212 trgHistory[4].push_back(domCountF1);
214 trigger.fill(MUL[1], trgF0);
215 trigger.fill(MUL[2], trgF1);
216 trigger.fill(MUL[3], trgFV);
217 trigger.fill(MUL[4], trgAV);
225 for (
int i = 0; i < nStages; i++) {
226 for (
unsigned j = 0;
j < trgHistory[i].size();
j++) {
227 SNT[i]->Fill(trgHistory[i][
j]);
231 SNT[0]->SetTitle(
"M[6,10] count before clustering");
232 SNT[1]->SetTitle(
"M[6,10] count after clustering");
233 SNT[2]->SetTitle(
"M[6,10] count after track self-veto");
234 SNT[3]->SetTitle(
"M[6,10] count after track trigger-veto");
235 SNT[4]->SetTitle(
"M[6,10] count after track self-veto, unique modules");
238 if (outputFile !=
"") {
240 TFile out(outputFile.c_str(),
"RECREATE");
Utility class to parse command line options.
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.
Long64_t counter_type
Type definition for counter.
Auxiliary class for a type holder.
Template definition for direct access of elements in ROOT TChain.
Auxiliary interface for direct access of elements in ROOT TChain.
Simple wrapper around JModuleRouter class for direct addressing of PMT data in detector data structur...
int getFrameIndex() const
Get frame index.
Auxiliary class to manage set of compatible ROOT objects (e.g.
Auxiliary class for defining the range of iterations of objects.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Auxiliary class to apply the supernova trigger to SN data.
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
SN filter based on multiplicity selection optional suppression of multi-module coincidences WARNING: ...
Auxiliary class to select JTreeScanner based on ROOT class name.
JRange< Double_t > JRange_t
Auxiliary class to build the supernova trigger dataset.
source $JPP_DIR setenv csh $JPP_DIR eval JShellParser o a A
JTriggerCounter_t next()
Increment trigger counter.
#define DEBUG(A)
Message macros.
Auxiliary class to manage a set of vetoes.
bool putObject(TDirectory *dir, const T &object)
Write object to ROOT directory.