67 JLimit_t& numberOfEvents = inputFile.getLimit();
72 JToTRange_t totRange_ns;
77 int preTriggerThreshold;
83 JParser<> zap(
"Example application to study supernova detection background");
86 zap[
'o'] =
make_field(outputFile) =
"kexing2D.root";
87 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
92 zap[
'C'] =
make_field(selector) = getROOTClassSelection<JDAQTimesliceTypes_t>();
94 zap[
'P'] =
make_field(preTriggerThreshold) = 4;
99 catch(
const exception &error) {
100 FATAL(error.what() << endl);
108 load(detectorFile, detector);
126 pts->configure(inputFile);
131 int fEnd = pts->rbegin()->getFrameIndex();
132 int fStart = pts->begin( )->getFrameIndex();
136 if (fEnd > inputFile.getUpperLimit()) {
137 fEnd = fStart + inputFile.getUpperLimit();
140 int fLength = 1 + fEnd - fStart;
142 NOTICE(
"begin | end | length = " << fStart <<
" | " << fEnd <<
" | " << fLength << endl);
146 FATAL(
"FATAL: inconsistent TTree indexing" << endl);
157 const int nx = fLength;
158 const double xmin = fStart;
159 const double xmax = fEnd + 1;
162 const double ymin = -0.5;
163 const double ymax = ymin + ny;
168 JManager2D_t MT(
new TH2D(
mul_p , NULL, nx, xmin, xmax, ny, ymin, ymax));
169 JManager1D_t ST(
new TH1D(
status_p, NULL, nx, xmin, xmax));
177 TH1D* h_vtr =
new TH1D(
"VetoTimeRange",
"VetoTimeRange", 10000, 0, 10000);
183 for (; evIn.hasNext(); ) {
185 STATUS(
"event: " << setw(10) << evIn.getCounter() <<
'\r');
DEBUG(endl);
189 if (!runNumber) { runNumber =
event->getRunNumber(); }
191 JVeto vp(*event, hitRouter);
193 triggeredEvents[
event->getFrameIndex()].push_back(vp);
195 h_vtr->Fill(vp.getLength());
199 STATUS(triggeredEvents.size() <<
" JDAQEvents loaded in veto buffer." << endl);
201 TParameter<int> RUNNR(
"RUNNR", runNumber);
210 for ( ; pts->hasNext() && counter != inputFile.getLimit(); ++counter) {
212 STATUS(
"timeslice: " << setw(10) << counter <<
'\r');
DEBUG(endl);
224 if (triggeredEvents.count(fIndex)) {
225 veto = triggeredEvents.at(fIndex);
238 double fractionActivePMTs = 0;
240 int nDOMs = timeslice->size();
242 for (JDAQTimeslice::const_iterator frame = timeslice->begin(); frame != timeslice->end(); ++frame) {
244 int moduleID = frame->getModuleID();
246 fractionActivePMTs += ((double) frame->countActiveChannels());
248 JSuperFrame2D_t& buffer = JSuperFrame2D_t::demultiplex(*frame,
249 moduleRouter.getModule(moduleID));
252 buffer.preprocess(JPreprocessor::join_t, match);
254 JSuperFrame1D_t& data = JSuperFrame1D_t::multiplex(buffer); data.pop_back();
260 TH1D* h2dt =
new TH1D(
"H2DT",
"H2DT", 100, -TMax_ns, +TMax_ns);
266 while (++q != data.end() && q->getT() - p->getT() <= TMax_ns) {}
272 MT[
"RAW"]->Fill(fIndex, m);
276 if (selector !=
"JDAQTimesliceSN" && timeDifferences && m > 1) {
280 double dt = JCombinatorics::getSign(__p->getPMT(), __q->getPMT()) * (__q->getT() - __p->getT());
281 h2dt->Fill(dt, 1.0/W);
292 if (h2dt->GetEntries() > 0) {
294 TF1
f(
"f",
"[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2]))/(TMath::Sqrt(2*TMath::Pi())*[2]) + [3]");
296 f.SetParameter(0, h2dt->GetMaximum());
297 f.SetParameter(1, h2dt->GetMean());
298 f.SetParameter(2, h2dt->GetRMS() * 0.25);
299 f.SetParameter(3, h2dt->GetMinimum());
301 h2dt->Fit(&
f,
"Q",
"same");
303 double nb = h2dt->GetNbinsX();
304 double bg_v =
f.GetParameter(3) * nb;
305 double sg = h2dt->GetSumOfWeights() - bg_v;
309 MT[
"FIT"]->Fill(fIndex, 2, sg);
321 ST[
"PMT"]->Fill(fIndex, fractionActivePMTs);
325 JDataSN preTrigger(TMax_ns, preTriggerThreshold);
327 preTrigger(timeslice, moduleRouter, totSelector_ns);
337 JRange_t
A = JRange_t(4,31);
348 MT[
"TA1"]->Fill(fIndex, *p);
354 MT[
"TAV"]->Fill(fIndex, *p);
363 if (outputFile !=
"") {
365 TFile out(outputFile.c_str(),
"RECREATE");
Utility class to parse command line options.
JDAQUTCExtended getTimesliceStart() const
Get start of timeslice.
Auxiliary class to define a veto time window on a set of optical modules.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
static const char * mul_p
static const char * status_p
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.
bool putObject(TDirectory *dir, const TObject &object)
Write object to ROOT directory.
Long64_t counter_type
Type definition for counter.
Auxiliary class for a type holder.
Template definition for direct access of elements in ROOT TChain.
long long int factorial(const long long int n)
Determine factorial.
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.
1-dimensional frame with time calibrated data from one optical module.
Auxiliary class for defining the range of iterations of objects.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
Reduced data structure for L0 hit.
#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: ...
Auxiliary class to select JTreeScanner based on ROOT class name.
Auxiliary class to build the supernova trigger dataset.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
2-dimensional frame with time calibrated data from one optical module.
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 eval JShellParser o a A
JTriggerCounter_t next()
Increment trigger counter.
Auxiliary class to manage a set of vetoes.