193  JLimit_t&      numberOfEvents = inputFile.getLimit();
 
  201    JParser<> zap(
"Example program to verify Monte Carlo data.");
 
  212  catch(
const exception &error) {
 
  213    FATAL(error.what() << endl);
 
  223  if (detectorFile != 
"") {
 
  244  NOTICE(
"Apply detector offset " << offset << endl); 
 
  255  NOTICE(
"JDomino: Instrumented volume dimensions (x, y, r, zmin, zmax): " << inst_vol << endl);
 
  276  const int nx   = (int) ((xmax - xmin) / 0.1);
 
  278  const Double_t T[] = { -50.0, -20.0, -10.0, -5.0, -2.0, 0.0, +2.0, +5.0, +10.0, +15.0, +20.0, +30.0, +40.0, +50.0,
 
  279                         +75.0, +100.0, +150.0, +200.0, +250.0, +300.0, +400.0, +500.0, 1000.0 };  
 
  285  TH1D hits(
"hits", NULL,    100,     0.0,      8.0);                
 
  286  TH1D trks(
"trks", NULL,  10001, -5000.5,   5000.5);                
 
  287  TH1D job (
"job" , NULL,  10001, -5000.5,   5000.5);                
 
  289  TProfile hits_per_E_in (
"hits_per_E_in",  
"average number of hits per E_{#nu} inside  instrumented volume", nx, xmin, xmax);
 
  290  TProfile hits_per_E_out(
"hits_per_E_out", 
"average number of hits per E_{#nu} outside instrumented volume", nx, xmin, xmax);
 
  294  JManager_t npe_per_type(
new TH1D(
"npe[%]", NULL, 5000, 0.5, 5000.5), 
'%', ios::fmtflags(ios::showpos));
 
  296  TH1D       npe_per_pmt (
"pmt", NULL, 100001, -0.5, 100000.5);      
 
  303  TH2D  nuExD(
"nuExD", NULL, nx, xmin,  xmax, 100,  0.0, 1000.0);    
 
  304  TH2D* nuExD_tmp = (TH2D*) nuExD.Clone(
"nuExD.tmp");                
 
  306  TH2D  nuExc(
"nuExc", NULL, nx, xmin,  xmax, 100, -1.0,   +1.0);    
 
  307  TH2D* nuExc_tmp = (TH2D*) nuExc.Clone(
"nuExc.tmp");                
 
  309  TH2D  nuDxc(
"nuDxc", NULL, 50, 0.0, 1000.0, 100, -1.0,   +1.0);    
 
  310  TH2D* nuDxc_tmp = (TH2D*) nuDxc.Clone(
"nuDxc.tmp");                
 
  312  TH2D  nuDxU(
"nuDxU", NULL, 50, 0.0, 1000.0, 100, -1.0,   +1.0);    
 
  313  TH2D* nuDxU_tmp = (TH2D*) nuDxU.Clone(
"nuDxU.tmp");                
 
  315  TH2D  nuDxT(
"nuDxT", NULL, 50, 0.0, 1000.0, 
getSize(T) - 1, T);    
 
  316  TH2D* nuDxT_tmp = (TH2D*) nuDxT.Clone(
"nuDxT.tmp");                
 
  329  TH2D  muExR(
"muExR", NULL, nx, xmin,  xmax,  30,  0.0,  300.0);    
 
  330  TH2D* muExR_tmp = (TH2D*) muExR.Clone(
"muExR.tmp");                
 
  332  TH2D  muRxU(
"muRxU", NULL, 15, 0.0,  300.0, 100, -1.0,   +1.0);    
 
  333  TH2D* muRxU_tmp = (TH2D*) muRxU.Clone(
"muRxU.tmp");                
 
  335  TH2D  muRxT(
"muRxT", NULL, 15, 0.0,  300.0, 
getSize(T) - 1, T);    
 
  336  TH2D* muRxT_tmp = (TH2D*) muRxT.Clone(
"muRxT.tmp");                
 
  351    const Evt* 
event = inputFile.
next();
 
  355    for (vector<Hit>::const_iterator hit = event->mc_hits.begin(); hit != event->mc_hits.end(); ++hit) {
 
  359    hits.Fill(log10((Double_t) event->mc_hits.size()));
 
  361    for (vector<Trk>::const_iterator track = event->mc_trks.begin(); track != event->mc_trks.end(); ++track) {
 
  362      trks.Fill(track->type);
 
  381    for (vector<Hit>::const_iterator hit = event->mc_hits.begin(); hit != event->mc_hits.end(); ++hit) {
 
  383      const int    type = hit->type;
 
  384      const double t1   = 
getTime(*hit);
 
  385      const double npe  = 
getNPE (*hit);
 
  387      npe_pmt[hit->pmt_id].put(npe);
 
  389      npe_type[0]   .put(npe);
 
  390      npe_type[type].put(npe);    
 
  392      if (hit_types.empty() || hit_types.count(type) != 0) {
 
  394        vector<Trk>::const_iterator track = find_if(event->mc_trks.begin(),
 
  395                                                    event->mc_trks.end(),
 
  396                                                    make_predicate(&
Trk::id, hit->origin));
 
  398        if (track == event->mc_trks.end()) {
 
  399          ERROR(
"Hit " << *hit << 
" has no origin." << endl);
 
  403        if (count_if(event->mc_trks.begin(),
 
  404                     event->mc_trks.end(),
 
  405                     make_predicate(&
Trk::id, hit->origin)) > 1) {
 
  406          ERROR(
"Hit " << *hit << 
" has ambiguous origin." << endl);
 
  410        job.Fill((
double) track->type, npe);
 
  412        if (router.
hasPMT(hit->pmt_id)) {
 
  420            const double E   = muon.
getE();
 
  421            const double x   = log10(E);
 
  423            const double t0  = muon.
getT       (pmt);
 
  424            const double ct1 = muon.
getDot     (pmt);
 
  426            muExR.Fill(x, R,       getMuonWeight(E, npe));
 
  427            muRxU.Fill(R, ct1,     getMuonWeight(E, R, npe));
 
  428            muRxT.Fill(R, t1 - t0, getMuonWeight(E, R, npe));
 
  432            const double E   = neutrino.
getE();
 
  433            const double x   = log10(E);
 
  435            const double t0  = vertex.
getT(pmt);
 
  437            const double ct1 = vertex.
getDot(pmt);
 
  439            nuExD.Fill(x, D,       getNeutrinoWeight(E, npe));
 
  440            nuExc.Fill(x, ct0,     getNeutrinoWeight(E, npe));
 
  441            nuDxc.Fill(D, ct0,     getNeutrinoWeight(E, D, npe));
 
  442            nuDxU.Fill(D, ct1,     getNeutrinoWeight(E, D, npe));
 
  443            nuDxT.Fill(D, t1 - t0, getNeutrinoWeight(E, D, npe));
 
  454    for (map_type::const_iterator i = npe_pmt.begin(); i != npe_pmt.end(); ++i) {
 
  455      npe_per_pmt.Fill(i->second.getTotal());                     
 
  458    for (map_type::const_iterator i = npe_type.begin(); i != npe_type.end(); ++i) {
 
  459      npe_per_type[i->first]->Fill(i->second.getTotal());         
 
  467    for (vector<Trk>::const_iterator track = event->mc_trks.begin(); track != event->mc_trks.end(); ++track) {
 
  473        const double E   = muon.
getE();
 
  474        const double x   = log10(E);
 
  476        for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  480          muExR_tmp->Fill(x, R, module->size());
 
  482          if (R < muRxU.GetXaxis()->GetXmax()) {
 
  483            for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
 
  484              muRxU_tmp->Fill(R, muon.
getDot(*pmt));
 
  488          if (R < muRxT.GetXaxis()->GetXmax()) {
 
  489            for (Int_t iy = 1; iy <= muRxT_tmp->GetYaxis()->GetNbins(); ++iy) {
 
  490              muRxT_tmp->Fill(R, muRxT_tmp->GetYaxis()->GetBinCenter(iy), muRxT_tmp->GetYaxis()->GetBinWidth(iy));
 
  504      const double E   = neutrino.
getE();
 
  505      const double x   = log10(E);
 
  508        hits_per_E_in .Fill(x, NPE);
 
  510        hits_per_E_out.Fill(x, NPE);
 
  512      for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  515        const double ct0 = neutrino.
getDot(module->getPosition());
 
  517        nuExD_tmp->Fill(x, D,   module->size());
 
  518        nuExc_tmp->Fill(x, ct0, module->size());
 
  519        nuDxc_tmp->Fill(D, ct0, module->size());
 
  521        if (D < nuDxU.GetXaxis()->GetXmax()) {
 
  522          for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
 
  523            nuDxU_tmp->Fill(D, neutrino.
getDot(*pmt));
 
  527        if (D < nuDxT.GetXaxis()->GetXmax()) {
 
  528          for (Int_t iy = 1; iy <= nuDxT_tmp->GetYaxis()->GetNbins(); ++iy) {
 
  529            nuDxT_tmp->Fill(D, nuDxT_tmp->GetYaxis()->GetBinCenter(iy), nuDxT_tmp->GetYaxis()->GetBinWidth(iy));
 
  543  TH1D *job_sorted  = makeSortedH1(&job,  
"hits_by_pdg"); 
 
  544  TH1D *trks_sorted = makeSortedH1(&trks, 
"trks_sorted"); 
 
  548    const Double_t W = 1.0 / ((Double_t) inputFile.
getCounter());
 
  550    for (TH1D* p : { &hits, &npe_per_pmt, &job, &trks, job_sorted, trks_sorted }) {
 
  554    for (JManager_t::iterator i = npe_per_type.begin(); i != npe_per_type.end(); ++i) {
 
  558    nuExD.Divide(nuExD_tmp);
 
  559    nuExc.Divide(nuExc_tmp);
 
  560    nuDxc.Divide(nuDxc_tmp);
 
  561    nuDxU.Divide(nuDxU_tmp);
 
  562    nuDxT.Divide(nuDxT_tmp);
 
  564    muExR.Divide(muExR_tmp);
 
  565    muRxU.Divide(muRxU_tmp);
 
  566    muRxT.Divide(muRxT_tmp);
 
  576  out << hits << job << *job_sorted << trks << *trks_sorted << hits_per_E_in << hits_per_E_out << npe_per_type << npe_per_pmt;
 
  578  out << nuExD << nuExc << nuDxc << nuDxU << nuDxT;
 
  579  out << muExR << muRxU << muRxT;