55     JParser<> zap(
"Auxiliary program to fit multiplicity rates from JMonitorMultiplicity output.");
 
   57     zap[
'f'] = 
make_field(inputFile,         
"input file");
 
   59     zap[
'O'] = 
make_field(option,            
"fitting option")                                        = 
"Q";
 
   60     zap[
'B'] = 
make_field(fitBackground,     
"get signal by fit and subtraction from background from the integral");
 
   61     zap[
'L'] = 
make_field(nominalLiveTime,   
"use nominal live time from LiveTime histogram, instead of individual DOMs");
 
   67   catch(
const exception &error) {
 
   68     FATAL(error.what() << endl);
 
   71   TFile* 
in = TFile::Open(inputFile.c_str(), 
"exist");
 
   73   if (
in == NULL || !
in->IsOpen()) {
 
   74     FATAL(
"File: " << inputFile << 
" not opened." << endl);
 
   83   const double xmin = -0.5;
 
   84   const double xmax = nx - 0.5;
 
   86   typedef JManager<TString, TH1D> JManager_t;
 
   89   JManager_t HTF(
new TH1D(
"%F", 
"",  nx, 
xmin, 
xmax));
 
   91   JManager_t HTFE(
new TH1D(
"%FE", 
"", nx, 
xmin, 
xmax));
 
  101   if (hLiveTime == NULL) {
 
  102     FATAL(
"File " << inputFile << 
" does not contain livetime histogram." << endl);
 
  115   TDirectory *fdir = out.mkdir(
"FIT");
 
  116   TDirectory *pdir = out.mkdir(
"MUL"); 
 
  119   double nT = hLiveTime->GetBinContent(1);
 
  121   for (
int bin = 2; bin <= hLiveTime->GetNbinsX(); bin++) { 
 
  123     TString prefix = hLiveTime->GetXaxis()->GetBinLabel(bin);
 
  125     DEBUG(
"Processing data from " << prefix << endl);
 
  127     double T = nominalLiveTime ? nT : hLiveTime->GetBinContent(bin);
 
  129     TString h1D_label = prefix + TString(
"_P" );
 
  130     TString h2D_label = prefix + TString(
"_HT");
 
  134       TH2D* h1D = (TH2D*) 
in->Get(h1D_label);
 
  135       TH2D* h2D = (TH2D*) 
in->Get(h2D_label);
 
  146         DEBUG(h1D_label << 
" not found" << endl);
 
  151         TDirectory* cdir = fdir->mkdir(h2D_label); cdir->cd();     
 
  155           int Mbin = h2D->GetXaxis()->FindBin(M);
 
  157           TH1D* hI = h2D->ProjectionY(h2D_label + Form(
"_%d", M), Mbin, 
NUMBER_OF_PMTS);
 
  161           if (hI->GetEntries() > 0) {
 
  163             const double W = (hI->GetXaxis()->GetXmax() - hI->GetXaxis()->GetXmin()); 
 
  164             const double N = hI->GetNbinsX();
 
  165             const double V = W / 
N;
 
  166             const double minRMS = 0.1;
 
  168             double inclusiveCountVal = 0, inclusiveCountErr = 0;
 
  170             if (hI->GetRMS() > minRMS) {
 
  174               TF1 
f1(
"f1", 
"[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2]))/(TMath::Sqrt(2*TMath::Pi())*[2]) + [3]");
 
  176               f1.SetParameter(0, hI->GetMaximum());
 
  177               f1.SetParameter(1, hI->GetMean());
 
  178               f1.SetParameter(2, hI->GetRMS() * 0.25);
 
  179               f1.SetParameter(3, hI->GetMinimum());
 
  181               hI->Fit(&
f1, option.c_str(), 
"same");
 
  183               double sg_v = 
f1.GetParameter(0);
 
  184               double sg_e = 
f1.GetParError( 0);
 
  186               double bg_v = 
f1.GetParameter(3);
 
  187               double bg_e = 
f1.GetParError( 3);
 
  190               if (bg_v / bg_e <= 2.0) { bg_v = bg_e = 0; }
 
  191               if (sg_v / sg_e <= 2.0) { sg_v = sg_e = 0; }
 
  193               double integral = hI->GetSumOfWeights();
 
  197                 inclusiveCountVal = V * (integral - (bg_v * 
N));
 
  198                 inclusiveCountErr = V * bg_e * 
N;
 
  202                 inclusiveCountErr = sg_e;
 
  203                 inclusiveCountVal = sg_v;
 
  210               hI->Fit(&
f1, option.c_str(), 
"same");         
 
  214             if (inclusiveCountVal <= 0) { inclusiveCountVal = 0; }
 
  226             int bin = HTF[h2D_label]->FindBin(M);
 
  228             HTF[h2D_label]->SetBinContent(bin, inclusiveCountVal);
 
  230             double binError = sqrt(inclusiveCountVal + 
pow(inclusiveCountErr, 2));
 
  232             HTF[h2D_label]->SetBinError(bin, binError);
 
  238             double exclusiveCountVal = 0;
 
  241               exclusiveCountVal = inclusiveCountVal;
 
  243               int prevBin = HTF[h2D_label]->GetXaxis()->FindBin(M+1);
 
  244               exclusiveCountVal = inclusiveCountVal - HTF[h2D_label]->GetBinContent(prevBin); 
 
  247             HTFE[h2D_label]->SetBinContent(HTFE[h2D_label]->FindBin(M), exclusiveCountVal);
 
  255         DEBUG(h1D_label << 
" not found" << endl);
 
  260       HTFE[h2D_label]->Sumw2();
 
  262       HTF[h2D_label ]->Scale(1.0 / T);
 
  263       HTFE[h2D_label]->Scale(1.0 / T);
 
  268   fdir = out.mkdir(
"HTF" ); fdir->cd();
 
  272   fdir = out.mkdir(
"HTFE"); fdir->cd();
 
Utility class to parse command line options. 
 
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
 
const JPolynome f1(1.0, 2.0, 3.0)
Function. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
do set_variable OUTPUT_DIRECTORY $WORKDIR T
 
T pow(const T &x, const double y)
Power . 
 
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
 
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
 
static const int NUMBER_OF_PMTS
Total number of PMTs in module. 
 
#define DEBUG(A)
Message macros.