11 #include "TParameter.h" 
   51 using namespace KM3NETDAQ;
 
   52 using namespace JSUPERNOVA;
 
   53 using namespace JROOT;
 
   60 int main(
int argc, 
char **argv)
 
   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);
 
  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,
 
  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);
 
  350       MT[
"TA1"]->Fill(fIndex, *p);
 
  356       MT[
"TAV"]->Fill(fIndex, *p);
 
  365   if (outputFile != 
"") {
 
  367     TFile out(outputFile.c_str(), 
"RECREATE");
 
double getLength()
Get length of veto time range. 
 
Utility class to parse command line options. 
 
JDAQUTCExtended getTimesliceStart() const 
Get start of timeslice. 
 
ROOT TTree parameter settings. 
 
Basic data structure for L0 hit. 
 
const JModule & getModule(const JObjectID &id) const 
Get module parameters. 
 
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. 
 
Long64_t counter_type
Type definition for counter. 
 
Dynamic ROOT object management. 
 
Auxiliary class for a type holder. 
 
Basic data structure for time and time over threshold information of hit. 
 
Template definition for direct access of elements in ROOT TChain. 
 
Data structure for detector geometry and calibration. 
 
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 to manage set of compatible ROOT objects (e.g. 
 
Auxiliary class for defining the range of iterations of objects. 
 
I/O formatting auxiliaries. 
 
void setVeto(JVetoSet &vt)
 
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. 
 
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: ...
 
General purpose messaging. 
 
Auxiliary class to select JTreeScanner based on ROOT class name. 
 
Scanning of objects from multiple files according a format that follows from the extension of each fi...
 
JRange< Double_t > JRange_t
 
Auxiliary class to build the supernova trigger dataset. 
 
Utility class to parse command line options. 
 
2-dimensional frame with time calibrated data from one optical module. 
 
Auxiliary class to select DAQ hits based on time-over-treshold value. 
 
static const int NUMBER_OF_PMTS
Total number of PMTs in module. 
 
source $JPP_DIR setenv csh $JPP_DIR eval JShellParser o a A
 
vector< double > getMultiplicities(const JSNFilter &F)
 
#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. 
 
int main(int argc, char *argv[])