69 JLimit_t& numberOfEvents = inputFile.getLimit();
74 JToTRange_t totRange_ns;
79 int preTriggerThreshold;
85 JParser<> zap(
"Example application to study supernova detection background");
89 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
94 zap[
'C'] =
make_field(selector) = getROOTClassSelection<JDAQTimesliceTypes_t>();
96 zap[
'P'] =
make_field(preTriggerThreshold) = 4;
101 catch(
const exception &error) {
102 FATAL(error.what() << endl);
127 pts->configure(inputFile);
132 int fEnd = pts->rbegin()->getFrameIndex();
133 int fStart = pts->begin( )->getFrameIndex();
137 if (fEnd > inputFile.getUpperLimit()) {
138 fEnd = fStart + inputFile.getUpperLimit();
141 int fLength = 1 + fEnd - fStart;
143 NOTICE(
"begin | end | length = " << fStart <<
" | " << fEnd <<
" | " << fLength << endl);
147 FATAL(
"FATAL: inconsistent TTree indexing" << endl);
158 const int nx = fLength;
159 const double xmin = fStart;
160 const double xmax = fEnd + 1;
163 const double ymin = -0.5;
164 const double ymax = ymin + ny;
169 JManager2D_t MT(
new TH2D(
mul_p , NULL, nx,
xmin,
xmax, ny, ymin, ymax));
178 TH1D* h_vtr =
new TH1D(
"VetoTimeRange",
"VetoTimeRange", 10000, 0, 10000);
184 for (; evIn.hasNext(); ) {
186 STATUS(
"event: " << setw(10) << evIn.getCounter() <<
'\r');
DEBUG(endl);
190 if (!runNumber) { runNumber =
event->getRunNumber(); }
192 JVeto vp(*event, hitRouter);
194 triggeredEvents[
event->getFrameIndex()].push_back(vp);
196 h_vtr->Fill(vp.getLength());
200 STATUS(triggeredEvents.size() <<
" JDAQEvents loaded in veto buffer." << endl);
202 TParameter<int> RUNNR(
"RUNNR", runNumber);
211 for ( ; pts->hasNext() && counter != inputFile.getLimit(); ++counter) {
213 STATUS(
"timeslice: " << setw(10) << counter <<
'\r');
DEBUG(endl);
225 if (triggeredEvents.count(fIndex)) {
226 veto = triggeredEvents.at(fIndex);
239 double fractionActivePMTs = 0;
241 int nDOMs = timeslice->size();
243 for (JDAQTimeslice::const_iterator frame = timeslice->begin(); frame != timeslice->end(); ++frame) {
245 int moduleID = frame->getModuleID();
247 fractionActivePMTs += ((double) frame->countActiveChannels());
249 JSuperFrame2D_t& buffer = JSuperFrame2D_t::demultiplex(*frame,
250 moduleRouter.getModule(moduleID));
253 buffer.preprocess(JPreprocessor::join_t, match);
255 JSuperFrame1D_t&
data = JSuperFrame1D_t::multiplex(buffer);
261 TH1D* h2dt =
new TH1D(
"H2DT",
"H2DT", 100, -TMax_ns, +TMax_ns);
267 while (++q !=
data.end() && q->getT() - p->getT() <= TMax_ns) {}
273 MT[
"RAW"]->Fill(fIndex, m);
277 if (selector !=
"JDAQTimesliceSN" && timeDifferences && m > 1) {
281 double dt = JCombinatorics::getSign(__p->getPMT(), __q->getPMT()) * (__q->getT() - __p->getT());
282 h2dt->Fill(dt, 1.0/W);
293 if (h2dt->GetEntries() > 0) {
295 TF1 f(
"f",
"[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2]))/(TMath::Sqrt(2*TMath::Pi())*[2]) + [3]");
297 f.SetParameter(0, h2dt->GetMaximum());
298 f.SetParameter(1, h2dt->GetMean());
299 f.SetParameter(2, h2dt->GetRMS() * 0.25);
300 f.SetParameter(3, h2dt->GetMinimum());
302 h2dt->Fit(&f,
"Q",
"same");
304 double nb = h2dt->GetNbinsX();
305 double bg_v = f.GetParameter(3) * nb;
306 double sg = h2dt->GetSumOfWeights() - bg_v;
310 MT[
"FIT"]->Fill(fIndex, 2, sg);
322 ST[
"PMT"]->Fill(fIndex, fractionActivePMTs);
326 JDataSN preTrigger(TMax_ns, preTriggerThreshold);
328 preTrigger(timeslice, moduleRouter, totSelector_ns);
349 MT[
"TA1"]->Fill(fIndex, *p);
355 MT[
"TAV"]->Fill(fIndex, *p);
static const char * status_p
static const char * mul_p
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
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 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.
Reduced data structure for L0 hit.
1-dimensional frame with time calibrated data from one optical module.
2-dimensional frame with time calibrated data from one optical module.
JDAQUTCExtended getTimesliceStart() const
Get start of timeslice.
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.
long long int factorial(const long long int n)
Determine factorial.
bool putObject(TDirectory &dir, const TObject &object)
Write object to ROOT directory.
Long64_t counter_type
Type definition for counter.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
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.
Auxiliary class to select DAQ hits based on time-over-treshold value.