11 #include "TParameter.h" 
   53 using namespace KM3NETDAQ;
 
   54 using namespace JSUPERNOVA;
 
   55 using namespace JROOT;
 
   62 int main(
int argc, 
char **argv)
 
   69   JLimit_t&              numberOfEvents = inputFile.getLimit();
 
   74   JToTRange_t            totRange_ns;
 
   79   int                    preTriggerThreshold;
 
   85     JParser<> zap(
"Example application to study supernova detection background");
 
   88     zap[
'o'] = 
make_field(outputFile)          = 
"kexing2D.root";
 
   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);
 
  109     load(detectorFile, detector);
 
  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));
 
  170   JManager1D_t ST(
new TH1D(
status_p, NULL, nx, xmin, xmax));
 
  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);
 
  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,
 
  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);
 
  338     JRange_t 
A = JRange_t(4,31);
 
  349       MT[
"TA1"]->Fill(fIndex, *p);
 
  355       MT[
"TAV"]->Fill(fIndex, *p);
 
  364   if (outputFile != 
"") {
 
  366     TFile out(outputFile.c_str(), 
"RECREATE");
 
double getLength()
Get length of veto time range. 
 
Utility class to parse command line options. 
 
int main(int argc, char *argv[])
 
JDAQUTCExtended getTimesliceStart() const 
Get start of timeslice. 
 
ROOT TTree parameter settings of various packages. 
 
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. 
 
Auxiliary interface for direct access of elements in ROOT TChain. 
 
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. 
 
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. 
 
Type definition of range. 
 
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
 
I/O formatting auxiliaries. 
 
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: ...
 
bool putObject(TDirectory &dir, const TObject &object)
Write object to ROOT directory. 
 
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...
 
Auxiliary class to build the supernova trigger dataset. 
 
void load(const std::string &file_name, JDetector &detector)
Load detector from input file. 
 
Utility class to parse command line options. 
 
then JHobbit a $DETECTOR f
 
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 &dev null eval JShellParser o a A
 
vector< double > getMultiplicities(const JSNFilter &F)
 
#define DEBUG(A)
Message macros. 
 
Auxiliary class to manage a set of vetoes.