13 #include "evt/Head.hh" 
   46   template<
class JHit_t>
 
   47     inline int getCount(JDAQEvent::const_iterator<JHit_t> __begin, 
 
   48         JDAQEvent::const_iterator<JHit_t> __end)
 
   57       for (JDAQEvent::const_iterator<JHit_t> i = __begin; i != __end; ++i) {
 
   58         buffer.insert(JType_t(*i));
 
   71 int main(
int argc, 
char **argv)
 
   77   typedef JTriggeredFileScanner<JEvt>                       JTriggeredFileScanner_t;
 
   78   typedef JTriggeredFileScanner_t::multi_pointer_type       multi_pointer_type;
 
   80   JTriggeredFileScanner_t inputFile;
 
   83   size_t                  numberOfPrefits;
 
   84   JQualitySorter          quality_sorter;
 
   85   JAtmosphericMuon        atmosphere;
 
   94     JParser<> zap(
"Example program to histogram fit results.");
 
   98     zap[
'n'] = 
make_field(numberOfEvents)      = JLimit::max();
 
  104     zap[
'a'] = 
make_field(atmosphere)          = JAtmosphericMuon(90.0, 90.0);
 
  105     zap[
'O'] = 
make_field(option)              = 
"E", 
"N", 
"LINE", 
"LOGE";
 
  110   catch(
const exception& error) {
 
  111     FATAL(error.what() << endl);
 
  119   catch(
const JException& error) {
 
  123   const JVolume volume(head, option != 
"LINE");
 
  124   const JPosition3D center   = get<JPosition3D>(head);
 
  125   JCylinder3D       cylinder = get<JCylinder3D>(head);
 
  127   cylinder.add(center);
 
  129   NOTICE(
"Reposition can [m]: " << cylinder << endl);
 
  131   const double EMIN_GEV = 10;  
 
  137   TH1D job(
"job", NULL, 100, 0.5, 100.5);
 
  139   TH1D hn(
"hn",  NULL,  250,   -0.5, 249.5);    
 
  140   TH1D hq(
"hq",  NULL,  300,    0.0, 600.0);    
 
  141   TH1D hi(
"hi",  NULL,  101,   -0.5, 100.5);    
 
  142   TH1D hv(
"hv",  NULL,  200,   -6.0,   0.0);    
 
  143   TH1D h1(
"h1",  NULL,  200,   -2.0,  +2.0);    
 
  144   TH1D hc(
"hc",  NULL,  200,   -1.0,  +1.0);    
 
  145   TH1D hu(
"hu",  NULL,  400, -1.0e3, 1.0e3);    
 
  147   TH1D hx(
"hx",  NULL,  70,   -3.0,  +2.3);     
 
  148   TH1D hd(
"hd",  NULL,  100,    0.0,  10.0);    
 
  149   TH1D hz(
"hz",  NULL,  100, -200.0, 200.0);    
 
  150   TH1D ht(
"ht",  NULL,  100, -100.0, 100.0);    
 
  152   TH1D e0(
"e0",  NULL,  100, volume.getXmin(), volume.getXmax());     
 
  153   TH1D e1(
"e1",  NULL,  100, volume.getXmin(), volume.getXmax());     
 
  154   TH1D e2(
"e2",  NULL,  100, volume.getXmin(), volume.getXmax());     
 
  155   TH1D er(
"er",  NULL,  100, -5.0, +5.0);                             
 
  157       40, volume.getXmin(), volume.getXmax(),
 
  158       40, volume.getXmin(), volume.getXmax());  
 
  160   TH2D muon_angle_Emu(
"muon_angle_Emu", NULL, 30, E_nu_min, E_nu_max, 100, 0,90);         
 
  161   TH2D muon_angle_Enu(
"muon_angle_Enu", NULL, 30, E_nu_min, E_nu_max, 100, 0,90);         
 
  162   TH2D neutrino_angle_Enu(
"neutrino_angle_Enu", NULL, 30, E_nu_min, E_nu_max, 100, 0,90); 
 
  163   TH2D MC_angle_Enu(
"MC_angle_Enu", NULL, 30, E_nu_min, E_nu_max, 100, 0,90);             
 
  165   const Int_t ny   = 28800;
 
  166   const Double_t ymin =   0.0;         
 
  167   const Double_t ymax =   180.0;       
 
  171   if (option.find(
'E') != string::npos) {
 
  173     for (
double x = volume.getXmin(); x <= volume.getXmax(); x += (volume.getXmax() - volume.getXmin()) / 20) {
 
  181     for ( ; x <=  15.5; x +=  1.0) { X.push_back(x); }
 
  182     for ( ; x <=  25.5; x +=  2.0) { X.push_back(x); }
 
  183     for ( ; x <=  50.5; x +=  5.0) { X.push_back(x); }
 
  184     for ( ; x <= 100.5; x += 10.0) { X.push_back(x); }
 
  185     for ( ; x <= 250.5; x += 20.0) { X.push_back(x); }
 
  188   TH2D     h2(
"h2", NULL, X.size() - 1, X.data(), ny,    ymin,    ymax);
 
  189   TProfile he(
"he", NULL, X.size() - 1, X.data());
 
  191   TH2D   ha(
"ha", NULL, 100, 0.0, 0.5e6, 100, -100.0, +900.0);
 
  192   TH2D   hb(
"hb", NULL, 100, 0.0, 0.5e6, 100, -100.0, +900.0);
 
  194   JQuantile Q(
"Angle", 
true);
 
  195   JQuantile O(
"Omega", 
true);
 
  198   while (inputFile.hasNext()) {
 
  200     STATUS(
"event: " << setw(10) << inputFile.getCounter() << 
'\r'); 
DEBUG(endl);
 
  202     multi_pointer_type ps = inputFile.next();
 
  208     const JTimeConverter converter(*event, *tev);
 
  224         if (track->E > Emax) {
 
  231     if (muon == event->mc_trks.end()) {
 
  242     if (option.find(
'E') != string::npos)
 
  243       x = volume.getX(event->mc_trks[0].E);
 
  254       JEvt::iterator __end = partition(evt->begin(), evt->end(), JHistory::is_event(application));
 
  256       if (evt->begin() == __end) {
 
  262       if (numberOfPrefits > 0) {
 
  264         JEvt::iterator __q = __end;
 
  266         advance(__end = evt->begin(), min(numberOfPrefits, (
size_t) 
distance(evt->begin(), __q)));
 
  268         partial_sort(evt->begin(), __end, __q, quality_sorter);
 
  272         sort(evt->begin(), __end, quality_sorter);
 
  277       JEvt::iterator best  = pointing(evt->begin(), __end);
 
  278       const Double_t beta  = pointing.getAngle(*best);
 
  279       const double   Efit  = best->getE();
 
  280       const double   Eraw  = best->getW(
JENERGY_ENERGY, numeric_limits<double>::min());
 
  281       const double   mip   = best->getW(
JSTART_NPE_MIP, numeric_limits<double>::max());
 
  285       bool ok = (Efit >= Emin_GeV  &&
 
  294         hn.Fill((Double_t) best->getNDF());
 
  295         hq.Fill(best->getQ());
 
  296         hi.Fill((Double_t) 
distance(evt->begin(), best));
 
  297         hc.Fill(best->getDZ());
 
  300             (!
has_neutrino(*event) && best->getDZ()        >= atmosphere.dot2)) { 
 
  301           hu.Fill(atmosphere(evt->begin(), __end));
 
  304         hx.Fill(max(log10(beta), hx.GetXaxis()->GetXmin()));
 
  313         tb.sub(converter.putTime());
 
  315         static_cast<JTrack3D&>(ta).move(ta.getIntersection(tb), 
getSpeedOfLight()); 
 
  316         static_cast<JTrack3D&>(tb).move(tb.getIntersection(ta), 
getSpeedOfLight());
 
  318         hd.Fill((tb.getPosition() - ta.getPosition()).getLength());
 
  328           if (cylinder.is_inside(vertex)) {
 
  334             ha.Fill(best->getX()*best->getX() + best->getY()*best->getY(), best->getZ());   
 
  335             hz.Fill(tc.getIntersection(vertex));
 
  339         if (best->getE() >= EMIN_GEV) {
 
  340           hb.Fill(best->getX()*best->getX() + best->getY()*best->getY(), best->getZ());  
 
  342         ht.Fill(tb.getT() - ta.getT());
 
  344         e0.Fill(volume.getX(Emu,  
true));
 
  345         e1.Fill(volume.getX(Eraw, 
true));
 
  346         e2.Fill(volume.getX(Efit, 
true));
 
  347         er.Fill(volume.getX(Efit) - volume.getX(Emu));
 
  348         ee.Fill(volume.getX(Emu), volume.getX(Efit));
 
  351         const double Enu = neutrino.E;  
 
  365           const double npe   = best->getW(
JVETO_NPE);               
 
  367           const double pv    = TMath::PoissonI(count, npe);         
 
  369           hv.Fill(max(log10(pv), hv.GetXaxis()->GetXmin()));
 
  378   NOTICE(
"Number of events input           " << setw(8) << right << job.GetBinContent(1) << endl);
 
  379   NOTICE(
"Number of events with muon       " << setw(8) << right << job.GetBinContent(3) << endl);
 
  380   NOTICE(
"Number of events with fit        " << setw(8) << right << job.GetBinContent(4) << endl);
 
  381   NOTICE(
"Number of events selected        " << setw(8) << right << job.GetBinContent(5) << endl);
 
  382   NOTICE(
"Number of events with neutrino   " << setw(8) << right << job.GetBinContent(6) << endl);
 
  383   NOTICE(
"Number of events contained       " << setw(8) << right << job.GetBinContent(7) << endl);
 
  385   if (Q.getCount() != 0) {
 
  386     NOTICE(
"Median space angle [deg] " << 
FIXED   (6,3) << Q.getQuantile(0.5) << endl);