44                                {
   47 
   48  string      inputFile;
   50  string      summaryFile;
   51  int         windowSize;
   52  double      fractionThreshold;
   55 
   56  try { 
   57 
   58    JParser<> zap(
"Auxiliary program to build supernova background from JKexing2D output");
 
   59    
   60    zap[
'f'] = 
make_field(inputFile,   
"input file (JKexing2D).");
 
   62    zap[
'w'] = 
make_field(windowSize,  
"size of the sliding window to test") = 5;
 
   64    zap[
'F'] = 
make_field(fractionThreshold, 
"minimum fraction of active channels to compute distribution") = 0.99;
 
   66 
   67    zap(argc, argv);
   68  }
   69  catch(const exception &error) {
   70    FATAL(error.what() << endl);
 
   71  }
   72 
   73  typedef JManager<int,    TH1D>  JManager_i1D_t;
   74  typedef JManager<string, TH1D>  JManager_s1D_t;
   75  typedef JManager<string, TH2D>  JManager2D_t;
   76 
   77  
   78  
   79  TFile in(inputFile.c_str(), "exist");
   80 
   81  TParameter<int>* runNumber;
   82 
   83  in.GetObject("RUNNR", runNumber);
   84 
   85  JManager2D_t   MT =   JManager2D_t::Read(in, 
mul_p   , 
'%');
 
   86  JManager_s1D_t ST = JManager_s1D_t::Read(in, 
status_p, 
'%');
 
   87 
   88  in.Close();
   89 
   90  
   91  
   92  const int    factoryLimit_peak = 250;
   93  const int    factoryLimit_runs = 10000;
   94 
   95  
   96 
   98 
  100  
  101  for (vector<string>::const_iterator f = filters.begin(); f != filters.end(); ++f) {
  102    string title = "MD_" + (*f) + "_%";
  103    mmap[*f] = JManager_i1D_t(new TH1D(title.c_str(), NULL, factoryLimit_peak, 0, factoryLimit_peak)); 
  104  }
  105 
  106  const int    nx   = 1 + NUMBER_OF_PMTS; 
  107  const double xmin = -0.5;
 
  108  const double xmax = nx - 0.5;
 
  109 
  110  
  111 
  112  JManager_s1D_t TD(
new TH1D(Form(
"SNT_[%d,%d]_", multiplicity.
first, multiplicity.
second) + TString(
"%"), NULL, factoryLimit_peak, -0.5, -0.5 + factoryLimit_peak));
 
  113 
  115 
  116  
  117  JManager2D_t  BL(new TH2D("BL_%", NULL, 100, epsilon, 1 + epsilon, factoryLimit_peak, -0.5, -0.5 + factoryLimit_peak));
  118  JManager2D_t  MUL_EFF(new TH2D("MUL_EFF_%", NULL, 100, epsilon, 1 + epsilon, nx, xmin, xmax));
  119 
  120  
  121  JManager_s1D_t H(new TH1D("H_%", NULL, factoryLimit_runs, 0, factoryLimit_runs));
  122 
  123  
  124 
  125  TH1D* LT = new TH1D("LIVETIME_ACF", NULL, 100, epsilon, 1 + epsilon);
  126 
  127  
  128 
  130 
  131  const int       nb        = activeChannelFraction->GetN();
  132  const Double_t* arr_acf_y = activeChannelFraction->GetY();
  133 
  135 
  136  LT->FillN(nb, arr_acf_y, NULL);
  137 
  138  for (int M = 0; M <= NUMBER_OF_PMTS; M++) {
  139 
  141 
  142    
  143 
  144    for (vector<string>::const_iterator f = filters.begin(); f != filters.end(); ++f) {
  145 
  146      
  147 
  149 
  151 
  152      delete px;
  153 
  154      
  155      
  156 
  159 
  160      
  161 
  162      transform(vec_acf_y.begin(),
  163                vec_acf_y.end(),
  164                threshold.begin(),
  165                back_inserter(select),
  166                greater_equal<double> {});
  167      
  168      mmap[*f][M]->FillN(nb, count_vs_frame[*f]->GetY(), &select[0]);
  169 
  170      
  171 
  173 
  174      MUL_EFF[*f]->FillN(nb,
  175                         arr_acf_y, 
  176                         &nb_M[0],
  177                         count_vs_frame[*f]->GetY());
  178 
  179    }
  180  }
  181 
  182  int RUNNR = runNumber->GetVal();
  183 
  184  for (vector<string>::const_iterator f = filters.begin(); f != filters.end(); ++f) {
  185 
  186    
  187 
  189 
  191 
  192    delete px;
  193 
  194    TD[*f]->FillN(events_per_frame->GetN(), events_per_frame->GetY(), NULL);
  195 
  196    
  197    
  198 
  199    vector<double> vec(events_per_frame->GetY(), events_per_frame->GetY() + nb);
 
  201 
  203 
  204    TD[(*f) + "_nTS"]->FillN(events_per_frame_sliding.size(),
  205                             &events_per_frame_sliding[0],
  206                             NULL);
  207    
  208    
  209    
  210    BL[*f]->FillN(nb,
  211                  arr_acf_y,
  212                  events_per_frame->GetY(),
  213                  NULL, 1);
  214 
  215    
  216 
  218 
  219    int peak = px->GetMaximum();
  220 
  221    delete px;
  222 
  223    H["PK_" + (*f)]->Fill(RUNNR, peak);
  224 
  225  }
  226 
  227  
  228 
  229  double BI = (ST["PMT"]->GetSumOfWeights() / ST["PMT"]->GetEntries());
  230 
  231  H["BIOLUM"]->Fill(RUNNR, BI);
  232 
  233  
  234 
  236 
  237  TD.Write(out);
  238  
  239  TDirectory* bm = out.mkdir("BIOLUM");
  240  TDirectory* hs = out.mkdir("HISTORY");  
  241 
  242  H.Write(*hs);
  243  BL.Write(*bm);
  244  
  245  MUL_EFF.Write(*bm);
  246 
  247  for (vector<string>::const_iterator f = filters.begin(); f != filters.end(); ++f) {
  248    string dir_name = "MUL_" + (*f); 
  249    TDirectory* dir = out.mkdir(dir_name.c_str());
  250    mmap[*f].Write(*dir);
  251  }
  252 
  253  LT->Write();
  254 
  255  out.Close();
  256 
  257}
static const char * status_p
 
static const char * mul_p
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
Utility class to parse command line options.
 
bool select(const Trk &trk, const Evt &evt)
Event selection.
 
std::vector< T > convolve(const std::vector< T > &input, const std::vector< T > &kernel)
Convolute data with given kernel.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
TGraph * histogramToGraph(const TH1 &h1)
Helper method to convert a 1D histogram to a graph.
 
TH1 * projectHistogram(const TH2 &h2, const Double_t xmin, const Double_t xmax, const char projection)
Helper method for ROOT histogram projections.