128 #include "libxml/parser.h" 129 #include "libxml/xmlmemory.h" 136 #include <TObjString.h> 140 #include "Framework/Conventions/GBuild.h" 162 #ifdef __GENIE_FLUX_DRIVERS_ENABLED__ 170 using std::ostringstream;
177 using std::setiosflags;
180 using namespace genie;
196 int HAProbeFSI (
int,
int,
int,
double [],
int [],
int,
int,
int);
298 const double e_h = 1.3;
304 int brFSPrimLept = 0;
310 bool brFromSea =
false;
312 bool brIsQel =
false;
313 bool brIsRes =
false;
314 bool brIsDis =
false;
315 bool brIsCoh =
false;
316 bool brIsMec =
false;
317 bool brIsDfr =
false;
318 bool brIsImd =
false;
319 bool brIsSingleK =
false;
320 bool brIsImdAnh =
false;
321 bool brIsNuEL =
false;
325 bool brIsCharmPro =
false;
326 bool brIsAMNuGamma =
false;
328 int brCodeNuance = 0;
333 double brKineQ2s = 0;
411 TTree * s_tree =
new TTree(
"gst",
"GENIE Summary Event Tree");
415 s_tree->Branch(
"iev", &brIev,
"iev/I" );
416 s_tree->Branch(
"neu", &brNeutrino,
"neu/I" );
417 s_tree->Branch(
"fspl", &brFSPrimLept,
"fspl/I" );
418 s_tree->Branch(
"tgt", &brTarget,
"tgt/I" );
419 s_tree->Branch(
"Z", &brTargetZ,
"Z/I" );
420 s_tree->Branch(
"A", &brTargetA,
"A/I" );
421 s_tree->Branch(
"hitnuc", &brHitNuc,
"hitnuc/I" );
422 s_tree->Branch(
"hitqrk", &brHitQrk,
"hitqrk/I" );
423 s_tree->Branch(
"resid", &brResId,
"resid/I" );
424 s_tree->Branch(
"sea", &brFromSea,
"sea/O" );
425 s_tree->Branch(
"qel", &brIsQel,
"qel/O" );
426 s_tree->Branch(
"mec", &brIsMec,
"mec/O" );
427 s_tree->Branch(
"res", &brIsRes,
"res/O" );
428 s_tree->Branch(
"dis", &brIsDis,
"dis/O" );
429 s_tree->Branch(
"coh", &brIsCoh,
"coh/O" );
430 s_tree->Branch(
"dfr", &brIsDfr,
"dfr/O" );
431 s_tree->Branch(
"imd", &brIsImd,
"imd/O" );
432 s_tree->Branch(
"imdanh", &brIsImdAnh,
"imdanh/O" );
433 s_tree->Branch(
"singlek", &brIsSingleK,
"singlek/O" );
434 s_tree->Branch(
"nuel", &brIsNuEL,
"nuel/O" );
435 s_tree->Branch(
"em", &brIsEM,
"em/O" );
436 s_tree->Branch(
"cc", &brIsCC,
"cc/O" );
437 s_tree->Branch(
"nc", &brIsNC,
"nc/O" );
438 s_tree->Branch(
"charm", &brIsCharmPro,
"charm/O" );
439 s_tree->Branch(
"amnugamma", &brIsAMNuGamma,
"amnugamma/O" );
440 s_tree->Branch(
"neut_code", &brCodeNeut,
"neut_code/I" );
441 s_tree->Branch(
"nuance_code", &brCodeNuance,
"nuance_code/I" );
442 s_tree->Branch(
"wght", &brWeight,
"wght/D" );
443 s_tree->Branch(
"xs", &brKineXs,
"xs/D" );
444 s_tree->Branch(
"ys", &brKineYs,
"ys/D" );
445 s_tree->Branch(
"ts", &brKineTs,
"ts/D" );
446 s_tree->Branch(
"Q2s", &brKineQ2s,
"Q2s/D" );
447 s_tree->Branch(
"Ws", &brKineWs,
"Ws/D" );
448 s_tree->Branch(
"x", &brKineX,
"x/D" );
449 s_tree->Branch(
"y", &brKineY,
"y/D" );
450 s_tree->Branch(
"t", &brKineT,
"t/D" );
451 s_tree->Branch(
"Q2", &brKineQ2,
"Q2/D" );
452 s_tree->Branch(
"W", &brKineW,
"W/D" );
453 s_tree->Branch(
"EvRF", &brEvRF,
"EvRF/D" );
454 s_tree->Branch(
"Ev", &brEv,
"Ev/D" );
455 s_tree->Branch(
"pxv", &brPxv,
"pxv/D" );
456 s_tree->Branch(
"pyv", &brPyv,
"pyv/D" );
457 s_tree->Branch(
"pzv", &brPzv,
"pzv/D" );
458 s_tree->Branch(
"En", &brEn,
"En/D" );
459 s_tree->Branch(
"pxn", &brPxn,
"pxn/D" );
460 s_tree->Branch(
"pyn", &brPyn,
"pyn/D" );
461 s_tree->Branch(
"pzn", &brPzn,
"pzn/D" );
462 s_tree->Branch(
"El", &brEl,
"El/D" );
463 s_tree->Branch(
"pxl", &brPxl,
"pxl/D" );
464 s_tree->Branch(
"pyl", &brPyl,
"pyl/D" );
465 s_tree->Branch(
"pzl", &brPzl,
"pzl/D" );
466 s_tree->Branch(
"pl", &brPl,
"pl/D" );
467 s_tree->Branch(
"cthl", &brCosthl,
"cthl/D" );
468 s_tree->Branch(
"nfp", &brNfP,
"nfp/I" );
469 s_tree->Branch(
"nfn", &brNfN,
"nfn/I" );
470 s_tree->Branch(
"nfpip", &brNfPip,
"nfpip/I" );
471 s_tree->Branch(
"nfpim", &brNfPim,
"nfpim/I" );
472 s_tree->Branch(
"nfpi0", &brNfPi0,
"nfpi0/I" );
473 s_tree->Branch(
"nfkp", &brNfKp,
"nfkp/I" );
474 s_tree->Branch(
"nfkm", &brNfKm,
"nfkm/I" );
475 s_tree->Branch(
"nfk0", &brNfK0,
"nfk0/I" );
476 s_tree->Branch(
"nfem", &brNfEM,
"nfem/I" );
477 s_tree->Branch(
"nfother", &brNfOther,
"nfother/I" );
478 s_tree->Branch(
"nip", &brNiP,
"nip/I" );
479 s_tree->Branch(
"nin", &brNiN,
"nin/I" );
480 s_tree->Branch(
"nipip", &brNiPip,
"nipip/I" );
481 s_tree->Branch(
"nipim", &brNiPim,
"nipim/I" );
482 s_tree->Branch(
"nipi0", &brNiPi0,
"nipi0/I" );
483 s_tree->Branch(
"nikp", &brNiKp,
"nikp/I" );
484 s_tree->Branch(
"nikm", &brNiKm,
"nikm/I" );
485 s_tree->Branch(
"nik0", &brNiK0,
"nik0/I" );
486 s_tree->Branch(
"niem", &brNiEM,
"niem/I" );
487 s_tree->Branch(
"niother", &brNiOther,
"niother/I" );
488 s_tree->Branch(
"ni", &brNi,
"ni/I" );
489 s_tree->Branch(
"pdgi", brPdgi,
"pdgi[ni]/I" );
490 s_tree->Branch(
"resc", brResc,
"resc[ni]/I" );
491 s_tree->Branch(
"Ei", brEi,
"Ei[ni]/D" );
492 s_tree->Branch(
"pxi", brPxi,
"pxi[ni]/D" );
493 s_tree->Branch(
"pyi", brPyi,
"pyi[ni]/D" );
494 s_tree->Branch(
"pzi", brPzi,
"pzi[ni]/D" );
495 s_tree->Branch(
"nf", &brNf,
"nf/I" );
496 s_tree->Branch(
"pdgf", brPdgf,
"pdgf[nf]/I" );
497 s_tree->Branch(
"Ef", brEf,
"Ef[nf]/D" );
498 s_tree->Branch(
"pxf", brPxf,
"pxf[nf]/D" );
499 s_tree->Branch(
"pyf", brPyf,
"pyf[nf]/D" );
500 s_tree->Branch(
"pzf", brPzf,
"pzf[nf]/D" );
501 s_tree->Branch(
"pf", brPf,
"pf[nf]/D" );
502 s_tree->Branch(
"cthf", brCosthf,
"cthf[nf]/D" );
503 s_tree->Branch(
"vtxx", &brVtxX,
"vtxx/D" );
504 s_tree->Branch(
"vtxy", &brVtxY,
"vtxy/D" );
505 s_tree->Branch(
"vtxz", &brVtxZ,
"vtxz/D" );
506 s_tree->Branch(
"vtxt", &brVtxT,
"vtxt/D" );
507 s_tree->Branch(
"sumKEf", &brSumKEf,
"sumKEf/D" );
508 s_tree->Branch(
"calresp0", &brCalResp0,
"calresp0/D" );
509 s_tree->Branch(
"XSec", &brXSec,
"XSec/D" );
510 s_tree->Branch(
"DXSec", &brDXSec,
"DXSec/D" );
511 s_tree->Branch(
"KPS", &brKPS,
"KPS/i" );
517 er_tree = dynamic_cast <TTree *> ( fin.Get(
"gtree") );
520 LOG(
"gntpc",
pERROR) <<
"Null input GHEP event tree";
523 LOG(
"gntpc",
pINFO) <<
"Input tree header: " << *thdr;
527 er_tree->SetBranchAddress(
"gmcrec", &mcrec);
529 LOG(
"gntpc",
pERROR) <<
"Null MC record";
534 Long64_t nmax = (
gOptN<0) ?
535 er_tree->GetEntries() : TMath::Min( er_tree->GetEntries(),
gOptN );
537 LOG(
"gntpc",
pERROR) <<
"Number of events = 0";
541 LOG(
"gntpc",
pNOTICE) <<
"*** Analyzing: " << nmax <<
" events";
543 TLorentzVector pdummy(0,0,0,0);
546 for(Long64_t iev = 0; iev < nmax; iev++) {
547 er_tree->GetEntry(iev);
556 bool is_unphysical =
event.IsUnphysical();
558 LOG(
"gntpc",
pINFO) <<
"Skipping unphysical event";
565 for(
int j=0; j<
kNPmax; j++) {
609 TLorentzVector * vtx =
event.Vertex();
622 bool is_em = proc_info.
IsEM();
623 bool is_weakcc = proc_info.
IsWeakCC();
624 bool is_weaknc = proc_info.
IsWeakNC();
625 bool is_mec = proc_info.
IsMEC();
628 if (!hitnucl && neutrino) {
629 assert(is_coh || is_imd || is_imdanh || is_nuel | is_amnugamma || is_coh_el);
633 int qrk = (is_dis) ? tgt.
HitQrkPdg() : 0;
634 bool seaq = (is_dis) ? tgt.
HitSeaQrk() :
false;
648 double weight =
event.Weight();
654 bool get_selected =
true;
655 double xs = kine.
x (get_selected);
656 double ys = kine.
y (get_selected);
657 double ts = (is_coh || is_dfr) ? kine.
t (get_selected) : -1;
658 double Q2s = kine.
Q2(get_selected);
659 double Ws = kine.
W (get_selected);
662 <<
"[Select] Q2 = " << Q2s <<
", W = " << Ws
663 <<
", x = " << xs <<
", y = " << ys <<
", t = " << ts;
669 const TLorentzVector & k1 = (neutrino) ? *(neutrino->
P4()) : pdummy;
670 const TLorentzVector & k2 = (fsl) ? *(fsl->
P4()) : pdummy;
671 const TLorentzVector & p1 = (hitnucl) ? *(hitnucl->
P4()) : pdummy;
674 TLorentzVector q = k1-k2;
675 double Q2 = -1 * q.M2();
677 double v = (hitnucl) ? q.Energy() : -1;
681 x = (hitnucl) ? 0.5*Q2/(M*v) : -1;
682 y = (hitnucl) ? v/k1.Energy() : -1;
684 W2 = (hitnucl) ? M*M + 2*M*v - Q2 : -1;
685 W = (hitnucl) ? TMath::Sqrt(W2) : -1;
692 W2 = M*M + 2*M*v -
Q2;
697 double t = (is_coh || is_dfr) ? kine.
t (get_selected) : -1;
700 TLorentzVector k1_rf = k1;
702 k1_rf.Boost(-1.*p1.BoostVector());
714 <<
"[Calc] Q2 = " << Q2 <<
", W = " << W
715 <<
", x = " << x <<
", y = " << y <<
", t = " <<
t;
720 bool study_hadsyst = (is_qel || is_res || is_dis || is_coh || is_dfr || is_mec || is_singlek);
723 TObjArrayIter piter(&
event);
732 LOG(
"gntpc",
pDEBUG) <<
"Extracting final state hadronic system";
735 while( (p = (
GHepParticle *) piter.Next()) && study_hadsyst)
740 if(
event.Particle(ip)->FirstMother()==0)
continue;
749 if(
event.Particle(igmom)->Pdg() !=
kPdgPi0) { final_had_syst.push_back(ip); }
752 final_had_syst.push_back(ip);
759 int fd_pdgc =
event.Particle(ifd)->Pdg();
762 final_had_syst.push_back(ip);
768 if(
count(final_had_syst.begin(), final_had_syst.end(), -1) > 0) {
781 LOG(
"gntpc",
pDEBUG) <<
"Extracting primary hadronic system";
784 TObjArrayIter piter_prim(&
event);
793 hiter != final_had_syst.end(); ++hiter) {
795 prim_had_syst.push_back(*hiter);
821 int ist_comp = p->
Status();
828 prim_had_syst.push_back(ip);
835 int ist_comp = p->
Status();
841 prim_had_syst.push_back(ip);
848 int ist_comp = p->
Status();
855 prim_had_syst.push_back(ip);
862 int ist_comp = p->
Status();
869 prim_had_syst.push_back(ip);
887 if(
count(prim_had_syst.begin(), prim_had_syst.end(), -1) > 0) {
896 brNeutrino = (neutrino) ? neutrino->
Pdg() : 0;
897 brFSPrimLept = (fsl) ? fsl->
Pdg() : 0;
898 brTarget = target->
Pdg();
901 brHitNuc = (hitnucl) ? hitnucl->
Pdg() : 0;
911 brIsSingleK = is_singlek;
917 brIsCharmPro = charm;
918 brIsAMNuGamma= is_amnugamma;
930 brEvRF = k1_rf.Energy();
935 brEn = (hitnucl) ? p1.Energy() : 0;
936 brPxn = (hitnucl) ? p1.Px() : 0;
937 brPyn = (hitnucl) ? p1.Py() : 0;
938 brPzn = (hitnucl) ? p1.Pz() : 0;
944 brCosthl = TMath::Cos( k2.Vect().Angle(k1.Vect()) );
950 brKPS =
event.DiffXSecVars();
963 brNi = prim_had_syst.
size();
964 for(
int j=0; j<brNi; j++) {
965 p =
event.Particle(prim_had_syst[j]);
967 brPdgi[j] = p->
Pdg();
986 <<
"Counting in primary hadronic system: idx = " << prim_had_syst[j]
987 <<
" -> " << p->
Name();
992 <<
", N(n):" << brNiN
993 <<
", N(pi+):" << brNiPip
994 <<
", N(pi-):" << brNiPim
995 <<
", N(pi0):" << brNiPi0
996 <<
", N(K+,K-,K0):" << brNiKp+brNiKm+brNiK0
997 <<
", N(gamma,e-,e+):" << brNiEM
998 <<
", N(etc):" << brNiOther <<
"\n";
1012 brSumKEf = (fsl) ? fsl->
KinE() : 0;
1015 brNf = final_had_syst.
size();
1016 for(
int j=0; j<brNf; j++) {
1017 p =
event.Particle(final_had_syst[j]);
1022 double hKE = p->
KinE();
1023 double hpx = p->
Px();
1024 double hpy = p->
Py();
1025 double hpz = p->
Pz();
1026 double hp = TMath::Sqrt(hpx*hpx + hpy*hpy + hpz*hpz);
1027 double hm = p->
Mass();
1028 double hcth = TMath::Cos( p->
P4()->Vect().Angle(k1.Vect()) );
1040 if ( hpdg ==
kPdgProton ) { brNfP++; brCalResp0 += hKE; }
1041 else if ( hpdg ==
kPdgAntiProton ) { brNfP++; brCalResp0 += (hE + 2*hm);}
1042 else if ( hpdg ==
kPdgNeutron ) { brNfN++; brCalResp0 += hKE; }
1043 else if ( hpdg ==
kPdgAntiNeutron ) { brNfN++; brCalResp0 += (hE + 2*hm);}
1044 else if ( hpdg ==
kPdgPiP ) { brNfPip++; brCalResp0 += hKE; }
1045 else if ( hpdg ==
kPdgPiM ) { brNfPim++; brCalResp0 += hKE; }
1046 else if ( hpdg ==
kPdgPi0 ) { brNfPi0++; brCalResp0 += (e_h * hE); }
1047 else if ( hpdg ==
kPdgKP ) { brNfKp++; brCalResp0 += hKE; }
1048 else if ( hpdg ==
kPdgKM ) { brNfKm++; brCalResp0 += hKE; }
1049 else if ( hpdg ==
kPdgK0 ) { brNfK0++; brCalResp0 += hKE; }
1050 else if ( hpdg ==
kPdgAntiK0 ) { brNfK0++; brCalResp0 += hKE; }
1051 else if ( hpdg ==
kPdgGamma ) { brNfEM++; brCalResp0 += (e_h * hE); }
1052 else if ( hpdg ==
kPdgElectron ) { brNfEM++; brCalResp0 += (e_h * hE); }
1053 else if ( hpdg ==
kPdgPositron ) { brNfEM++; brCalResp0 += (e_h * hE); }
1054 else { brNfOther++; brCalResp0 += hKE; }
1057 <<
"Counting in f/s system from hadronic vtx: idx = " << final_had_syst[j]
1058 <<
" -> " << p->
Name();
1063 <<
", N(n):" << brNfN
1064 <<
", N(pi+):" << brNfPip
1065 <<
", N(pi-):" << brNfPim
1066 <<
", N(pi0):" << brNfPi0
1067 <<
", N(K+,K-,K0):" << brNfKp+brNfKm+brNfK0
1068 <<
", N(gamma,e-,e+):" << brNfEM
1069 <<
", N(etc):" << brNfOther <<
"\n";
1085 TFolder * genv = (TFolder*) fin.Get(
"genv");
1086 TFolder * gconfig = (TFolder*) fin.Get(
"gconfig");
1088 genv ->
Write(
"genv");
1089 gconfig ->
Write(
"gconfig");
1106 tree = dynamic_cast <TTree *> ( fin.Get(
"gtree") );
1109 LOG(
"gntpc",
pINFO) <<
"Input tree header: " << *thdr;
1113 tree->SetBranchAddress(
"gmcrec", &mcrec);
1119 output <<
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
1121 output <<
"<!-- generated by GENIE gntpc utility -->";
1122 output << endl <<
endl;
1123 output <<
"<genie_event_list version=\"1.00\">" <<
endl;
1126 Long64_t nmax = (
gOptN<0) ?
1127 tree->GetEntries() : TMath::Min(tree->GetEntries(),
gOptN);
1129 LOG(
"gntpc",
pERROR) <<
"Number of events = 0";
1132 LOG(
"gntpc",
pNOTICE) <<
"*** Analyzing: " << nmax <<
" events";
1135 for(Long64_t iev = 0; iev < nmax; iev++) {
1136 tree->GetEntry(iev);
1147 output << endl <<
endl;
1148 output <<
" <!-- GENIE GHEP event -->" <<
endl;
1149 output <<
" <ghep np=\"" <<
event.GetEntries()
1150 <<
"\" unphysical=\"" 1151 << (
event.IsUnphysical() ?
"true" :
"false") <<
"\">" << endl;
1152 output << setiosflags(ios::scientific);
1156 output <<
" <!-- event weight -->";
1157 output <<
" <wgt> " <<
event.Weight() <<
" </wgt>";
1160 output <<
" <!-- cross sections -->";
1161 output <<
" <xsec_evnt> " <<
event.XSec() <<
" </xsec_evnt>";
1162 output <<
" <xsec_kine> " <<
event.DiffXSec() <<
" </xsec_kine>";
1165 output <<
" <!-- event vertex -->";
1166 output <<
" <vx> " <<
event.Vertex()->X() <<
" </vx>";
1167 output <<
" <vy> " <<
event.Vertex()->Y() <<
" </vy>";
1168 output <<
" <vz> " <<
event.Vertex()->Z() <<
" </vz>";
1169 output <<
" <vt> " <<
event.Vertex()->T() <<
" </vt>";
1173 output <<
" <!-- particle list -->" <<
endl;
1176 TIter event_iter(&
event);
1177 while ( (p = dynamic_cast<GHepParticle *>(event_iter.Next())) ) {
1183 output <<
" <p idx=\"" << i <<
"\" type=\"" << type <<
"\">" <<
endl;
1185 output <<
" <pdg> " << p->
Pdg() <<
" </pdg>";
1186 output <<
" <ist> " << p->
Status() <<
" </ist>";
1189 output <<
" <mother> " 1195 output <<
" <daughter> " 1201 output <<
" <px> " <<
setfill(
' ') <<
setw(20) << p->
Px() <<
" </px>";
1202 output <<
" <py> " <<
setfill(
' ') <<
setw(20) << p->
Py() <<
" </py>";
1203 output <<
" <pz> " <<
setfill(
' ') <<
setw(20) << p->
Pz() <<
" </pz>";
1204 output <<
" <E> " <<
setfill(
' ') <<
setw(20) << p->
E() <<
" </E> ";
1207 output <<
" <x> " <<
setfill(
' ') <<
setw(20) << p->
Vx() <<
" </x> ";
1208 output <<
" <y> " <<
setfill(
' ') <<
setw(20) << p->
Vy() <<
" </y> ";
1209 output <<
" <z> " <<
setfill(
' ') <<
setw(20) << p->
Vz() <<
" </z> ";
1210 output <<
" <t> " <<
setfill(
' ') <<
setw(20) << p->
Vt() <<
" </t> ";
1222 output <<
" <rescatter> " << p->
RescatterCode() <<
" </rescatter>";
1226 output <<
" </p>" <<
endl;
1229 output <<
" </ghep>" <<
endl;
1235 output << endl <<
endl;
1236 output <<
"<genie_event_list version=\"1.00\">";
1241 LOG(
"gntpc",
pINFO) <<
"\nDone converting GENIE's GHEP ntuple";
1252 tree = dynamic_cast <TTree *> ( fin.Get(
"gtree") );
1255 LOG(
"gntpc",
pINFO) <<
"Input tree header: " << *thdr;
1259 tree->SetBranchAddress(
"gmcrec", &mcrec);
1262 Long64_t nmax = (
gOptN<0) ?
1263 tree->GetEntries() : TMath::Min(tree->GetEntries(),
gOptN);
1265 LOG(
"gntpc",
pERROR) <<
"Number of events = 0";
1268 LOG(
"gntpc",
pNOTICE) <<
"*** Analyzing: " << nmax <<
" events";
1276 for(Long64_t iev = 0; iev < nmax; iev++) {
1277 tree->GetEntry(iev);
1287 stripped_event -> AttachSummary (nullint);
1288 stripped_event -> SetWeight (
event.Weight());
1289 stripped_event -> SetVertex (*
event.Vertex());
1298 p->Pdg(), ist, -1,-1,-1,-1, *p->P4(), *p->X4());
1313 LOG(
"gntpc",
pINFO) <<
"\nDone converting GENIE's GHEP ntuple";
1324 tree = dynamic_cast <TTree *> ( fin.Get(
"gtree") );
1327 LOG(
"gntpc",
pINFO) <<
"Input tree header: " << *thdr;
1335 tree->SetBranchAddress(
"gmcrec", &mcrec);
1337 #ifdef __GENIE_FLUX_DRIVERS_ENABLED__ 1339 tree->SetBranchAddress(
"flux", &flux_info);
1342 <<
"\n Flux drivers are not enabled." 1343 <<
"\n No flux pass-through information will be written-out in the rootracker file" 1344 <<
"\n If this isn't what you are supposed to be doing then build GENIE by adding " 1345 <<
"--with-flux-drivers in the configuration step.";
1352 Long64_t nmax = (
gOptN<0) ?
1353 tree->GetEntries() : TMath::Min(tree->GetEntries(),
gOptN);
1355 LOG(
"gntpc",
pERROR) <<
"Number of events = 0";
1358 LOG(
"gntpc",
pNOTICE) <<
"*** Analyzing: " << nmax <<
" events";
1361 for(Long64_t iev = 0; iev < nmax; iev++) {
1362 tree->GetEntry(iev);
1371 TIter event_iter(&
event);
1388 LOG(
"gntpc",
pNOTICE) <<
"NEUT-like event type = " << evtype;
1395 LOG(
"gntpc",
pNOTICE) <<
"NUANCE-like event type = " << evtype;
1408 <<
event.Vertex()->X() <<
" " 1409 <<
event.Vertex()->Y() <<
" " 1410 <<
event.Vertex()->Z() <<
" " 1411 <<
event.Vertex()->T() <<
endl;
1423 while ( (p = dynamic_cast<GHepParticle *>(event_iter.Next())) )
1427 int ghep_pdgc = p->
Pdg();
1440 bool is_pi0_dec =
false;
1445 for(
int jd = ghep_fd; jd <= ghep_ld; jd++) {
1447 pi0dv.push_back(
event.Particle(jd)->Pdg());
1450 sort(pi0dv.begin(), pi0dv.end());
1457 int ghep_fmpdgc = (ghep_fm==-1) ? 0 :
event.Particle(ghep_fm)->Pdg();
1473 tracks.push_back(iparticle);
1480 for(
int iloop=0; iloop<=1; iloop++)
1485 p =
event.Particle(iparticle);
1487 int ghep_pdgc = p->
Pdg();
1493 if(iloop==0 && fs)
continue;
1494 if(iloop==1 && !fs)
continue;
1509 default: ist = -999;
break;
1515 int pdgc = ghep_pdgc;
1527 double R = rnd->
RndGen().Rndm();
1533 const TLorentzVector * p4 = p->
P4();
1540 double dcosx = (P>0) ? Px/P : -999;
1541 double dcosy = (P>0) ? Py/P : -999;
1542 double dcosz = (P>0) ? Pz/P : -999;
1558 <<
"Adding $track corrsponding to GHEP particle at position: " << iparticle
1559 <<
" (tracker status code: " << ist <<
")";
1561 output <<
"$ track " << pdgc <<
" " << E <<
" " 1562 << dcosx <<
" " << dcosy <<
" " << dcosz <<
" " 1635 <<
event.Weight() <<
" " 1636 <<
event.Probability()
1638 output <<
"$ info " <<
event.Vertex()->X() <<
" " 1639 <<
event.Vertex()->Y() <<
" " 1640 <<
event.Vertex()->Z() <<
" " 1641 <<
event.Vertex()->T()
1650 quark_id = 10 * quark_pdg + sorv;
1660 output <<
"$ info " <<
event.GetEntries() <<
endl;
1661 while ( (p = dynamic_cast<GHepParticle *>(event_iter.Next())) )
1669 << p->
X4()->X() <<
" " << p->
X4()->Y() <<
" " << p->
X4()->Z() <<
" " << p->
X4()->T() <<
" " 1670 << p->
P4()->Px() <<
" " << p->
P4()->Py() <<
" " << p->
P4()->Pz() <<
" " << p->
P4()->E() <<
" ";
1681 int rescat_code = -1;
1682 bool have_rescat_code =
false;
1684 if(gFileMinorVrs >= 5) {
1685 if(gFileRevisVrs >= 1) {
1686 have_rescat_code =
true;
1690 if(have_rescat_code) {
1766 LOG(
"gntpc",
pINFO) <<
"\nDone converting GENIE's GHEP ntuple";
1777 TBits* brEvtFlags = 0;
1778 TObjString* brEvtCode = 0;
1787 int brStdHepPdg [
kNPmax];
1788 int brStdHepStatus[
kNPmax];
1789 int brStdHepRescat[
kNPmax];
1790 double brStdHepX4 [
kNPmax][4];
1791 double brStdHepP4 [
kNPmax][4];
1792 double brStdHepPolz [
kNPmax][3];
1801 TObjString* brNuFileName = 0;
1806 int brNuParentDecMode;
1807 double brNuParentDecP4 [4];
1808 double brNuParentDecX4 [4];
1809 double brNuParentProP4 [4];
1810 double brNuParentProX4 [4];
1811 int brNuParentProNVtx;
1862 int brNumiFluxEvtno;
1863 double brNumiFluxNdxdz;
1864 double brNumiFluxNdydz;
1865 double brNumiFluxNpz;
1866 double brNumiFluxNenergy;
1867 double brNumiFluxNdxdznea;
1868 double brNumiFluxNdydznea;
1869 double brNumiFluxNenergyn;
1870 double brNumiFluxNwtnear;
1871 double brNumiFluxNdxdzfar;
1872 double brNumiFluxNdydzfar;
1873 double brNumiFluxNenergyf;
1874 double brNumiFluxNwtfar;
1875 int brNumiFluxNorig;
1876 int brNumiFluxNdecay;
1891 int brNumiFluxNtype;
1892 double brNumiFluxVx;
1893 double brNumiFluxVy;
1894 double brNumiFluxVz;
1895 double brNumiFluxPdpx;
1896 double brNumiFluxPdpy;
1897 double brNumiFluxPdpz;
1898 double brNumiFluxPpdxdz;
1899 double brNumiFluxPpdydz;
1900 double brNumiFluxPppz;
1901 double brNumiFluxPpenergy;
1902 int brNumiFluxPpmedium;
1903 int brNumiFluxPtype;
1904 double brNumiFluxPpvx;
1905 double brNumiFluxPpvy;
1906 double brNumiFluxPpvz;
1907 double brNumiFluxMuparpx;
1908 double brNumiFluxMuparpy;
1909 double brNumiFluxMuparpz;
1910 double brNumiFluxMupare;
1911 double brNumiFluxNecm;
1912 double brNumiFluxNimpwt;
1913 double brNumiFluxXpoint;
1914 double brNumiFluxYpoint;
1915 double brNumiFluxZpoint;
1916 double brNumiFluxTvx;
1917 double brNumiFluxTvy;
1918 double brNumiFluxTvz;
1919 double brNumiFluxTpx;
1920 double brNumiFluxTpy;
1921 double brNumiFluxTpz;
1922 double brNumiFluxTptype;
1923 double brNumiFluxTgen;
1927 double brNumiFluxTgptype;
1928 double brNumiFluxTgppx;
1930 double brNumiFluxTgppy;
1932 double brNumiFluxTgppz;
1934 double brNumiFluxTprivx;
1935 double brNumiFluxTprivy;
1936 double brNumiFluxTprivz;
1937 double brNumiFluxBeamx;
1938 double brNumiFluxBeamy;
1939 double brNumiFluxBeamz;
1940 double brNumiFluxBeampx;
1941 double brNumiFluxBeampy;
1942 double brNumiFluxBeampz;
1948 TTree * rootracker_tree =
new TTree(
"gRooTracker",
"GENIE event tree rootracker format");
1958 rootracker_tree->Branch(
"EvtFlags",
"TBits", &brEvtFlags, 32000, 1);
1959 rootracker_tree->Branch(
"EvtCode",
"TObjString", &brEvtCode, 32000, 1);
1960 rootracker_tree->Branch(
"EvtNum", &brEvtNum,
"EvtNum/I");
1961 rootracker_tree->Branch(
"EvtXSec", &brEvtXSec,
"EvtXSec/D");
1962 rootracker_tree->Branch(
"EvtDXSec", &brEvtDXSec,
"EvtDXSec/D");
1963 rootracker_tree->Branch(
"EvtWght", &brEvtWght,
"EvtWght/D");
1964 rootracker_tree->Branch(
"EvtProb", &brEvtProb,
"EvtProb/D");
1965 rootracker_tree->Branch(
"EvtVtx", brEvtVtx,
"EvtVtx[4]/D");
1966 rootracker_tree->Branch(
"StdHepN", &brStdHepN,
"StdHepN/I");
1967 rootracker_tree->Branch(
"StdHepPdg", brStdHepPdg,
"StdHepPdg[StdHepN]/I");
1968 rootracker_tree->Branch(
"StdHepStatus", brStdHepStatus,
"StdHepStatus[StdHepN]/I");
1969 rootracker_tree->Branch(
"StdHepRescat", brStdHepRescat,
"StdHepRescat[StdHepN]/I");
1970 rootracker_tree->Branch(
"StdHepX4", brStdHepX4,
"StdHepX4[StdHepN][4]/D");
1971 rootracker_tree->Branch(
"StdHepP4", brStdHepP4,
"StdHepP4[StdHepN][4]/D");
1972 rootracker_tree->Branch(
"StdHepPolz", brStdHepPolz,
"StdHepPolz[StdHepN][3]/D");
1973 rootracker_tree->Branch(
"StdHepFd", brStdHepFd,
"StdHepFd[StdHepN]/I");
1974 rootracker_tree->Branch(
"StdHepLd", brStdHepLd,
"StdHepLd[StdHepN]/I");
1975 rootracker_tree->Branch(
"StdHepFm", brStdHepFm,
"StdHepFm[StdHepN]/I");
1976 rootracker_tree->Branch(
"StdHepLm", brStdHepLm,
"StdHepLm[StdHepN]/I");
1979 rootracker_tree->Branch(
"EvtNum", &brEvtNum,
"EvtNum/I");
1980 rootracker_tree->Branch(
"EvtWght", &brEvtWght,
"EvtWght/D");
1981 rootracker_tree->Branch(
"EvtVtx", brEvtVtx,
"EvtVtx[4]/D");
1982 rootracker_tree->Branch(
"StdHepN", &brStdHepN,
"StdHepN/I");
1983 rootracker_tree->Branch(
"StdHepPdg", brStdHepPdg,
"StdHepPdg[StdHepN]/I");
1984 rootracker_tree->Branch(
"StdHepX4", brStdHepX4,
"StdHepX4[StdHepN][4]/D");
1985 rootracker_tree->Branch(
"StdHepP4", brStdHepP4,
"StdHepP4[StdHepN][4]/D");
1992 rootracker_tree->Branch(
"G2NeutEvtCode", &brNeutCode,
"G2NeutEvtCode/I");
1994 rootracker_tree->Branch(
"NuFileName",
"TObjString", &brNuFileName, 32000, 1);
1995 rootracker_tree->Branch(
"NuParentPdg", &brNuParentPdg,
"NuParentPdg/I");
1996 rootracker_tree->Branch(
"NuParentDecMode", &brNuParentDecMode,
"NuParentDecMode/I");
1997 rootracker_tree->Branch(
"NuParentDecP4", brNuParentDecP4,
"NuParentDecP4[4]/D");
1998 rootracker_tree->Branch(
"NuParentDecX4", brNuParentDecX4,
"NuParentDecX4[4]/D");
1999 rootracker_tree->Branch(
"NuParentProP4", brNuParentProP4,
"NuParentProP4[4]/D");
2000 rootracker_tree->Branch(
"NuParentProX4", brNuParentProX4,
"NuParentProX4[4]/D");
2001 rootracker_tree->Branch(
"NuParentProNVtx", &brNuParentProNVtx,
"NuParentProNVtx/I");
2003 rootracker_tree->Branch(
"NuFluxEntry", &brNuFluxEntry,
"NuFluxEntry/L");
2004 rootracker_tree->Branch(
"NuIdfd", &brNuIdfd,
"NuIdfd/I");
2005 rootracker_tree->Branch(
"NuCospibm", &brNuCospibm,
"NuCospibm/F");
2006 rootracker_tree->Branch(
"NuCospi0bm", &brNuCospi0bm,
"NuCospi0bm/F");
2007 rootracker_tree->Branch(
"NuGipart", &brNuGipart,
"NuGipart/I");
2008 rootracker_tree->Branch(
"NuGpos0", brNuGpos0,
"NuGpos0[3]/F");
2009 rootracker_tree->Branch(
"NuGvec0", brNuGvec0,
"NuGvec0[3]/F");
2010 rootracker_tree->Branch(
"NuGamom0", &brNuGamom0,
"NuGamom0/F");
2012 rootracker_tree->Branch(
"NuXnu", brNuXnu,
"NuXnu[2]/F");
2013 rootracker_tree->Branch(
"NuRnu", &brNuRnu,
"NuRnu/F");
2014 rootracker_tree->Branch(
"NuNg", &brNuNg,
"NuNg/I");
2015 rootracker_tree->Branch(
"NuGpid", brNuGpid,
"NuGpid[NuNg]/I");
2016 rootracker_tree->Branch(
"NuGmec", brNuGmec,
"NuGmec[NuNg]/I");
2017 rootracker_tree->Branch(
"NuGv", brNuGv,
"NuGv[NuNg][3]/F");
2018 rootracker_tree->Branch(
"NuGp", brNuGp,
"NuGp[NuNg][3]/F");
2019 rootracker_tree->Branch(
"NuGcosbm", brNuGcosbm,
"NuGcosbm[NuNg]/F");
2020 rootracker_tree->Branch(
"NuGmat", brNuGmat,
"NuGmat[NuNg]/I");
2021 rootracker_tree->Branch(
"NuGdistc", brNuGdistc,
"NuGdistc[NuNg]/F");
2022 rootracker_tree->Branch(
"NuGdistal", brNuGdistal,
"NuGdistal[NuNg]/F");
2023 rootracker_tree->Branch(
"NuGdistti", brNuGdistti,
"NuGdistti[NuNg]/F");
2024 rootracker_tree->Branch(
"NuGdistfe", brNuGdistfe,
"NuGdistfe[NuNg]/F");
2025 rootracker_tree->Branch(
"NuNorm", &brNuNorm,
"NuNorm/F");
2026 rootracker_tree->Branch(
"NuEnusk", &brNuEnusk,
"NuEnusk/F");
2027 rootracker_tree->Branch(
"NuNormsk", &brNuNormsk,
"NuNormsk/F");
2028 rootracker_tree->Branch(
"NuAnorm", &brNuAnorm,
"NuAnorm/F");
2029 rootracker_tree->Branch(
"NuVersion", &brNuVersion,
"NuVersion/F");
2030 rootracker_tree->Branch(
"NuNtrig", &brNuNtrig,
"NuNtrig/I");
2031 rootracker_tree->Branch(
"NuTuneid", &brNuTuneid,
"NuTuneid/I");
2032 rootracker_tree->Branch(
"NuPint", &brNuPint,
"NuPint/I");
2033 rootracker_tree->Branch(
"NuBpos", brNuBpos,
"NuBpos[2]/F");
2034 rootracker_tree->Branch(
"NuBtilt", brNuBtilt,
"NuBtilt[2]/F");
2035 rootracker_tree->Branch(
"NuBrms", brNuBrms,
"NuBrms[2]/F");
2036 rootracker_tree->Branch(
"NuEmit", brNuEmit,
"NuEmit[2]/F");
2037 rootracker_tree->Branch(
"NuAlpha", brNuAlpha,
"NuAlpha[2]/F");
2038 rootracker_tree->Branch(
"NuHcur", brNuHcur,
"NuHcur[3]/F");
2039 rootracker_tree->Branch(
"NuRand", &brNuRand,
"NuRand/I");
2047 rootracker_tree->Branch(
"NumiFluxRun", &brNumiFluxRun,
"NumiFluxRun/I");
2048 rootracker_tree->Branch(
"NumiFluxEvtno", &brNumiFluxEvtno,
"NumiFluxEvtno/I");
2049 rootracker_tree->Branch(
"NumiFluxNdxdz", &brNumiFluxNdxdz,
"NumiFluxNdxdz/D");
2050 rootracker_tree->Branch(
"NumiFluxNdydz", &brNumiFluxNdydz,
"NumiFluxNdydz/D");
2051 rootracker_tree->Branch(
"NumiFluxNpz", &brNumiFluxNpz,
"NumiFluxNpz/D");
2052 rootracker_tree->Branch(
"NumiFluxNenergy", &brNumiFluxNenergy,
"NumiFluxNenergy/D");
2053 rootracker_tree->Branch(
"NumiFluxNdxdznea", &brNumiFluxNdxdznea,
"NumiFluxNdxdznea/D");
2054 rootracker_tree->Branch(
"NumiFluxNdydznea", &brNumiFluxNdydznea,
"NumiFluxNdydznea/D");
2055 rootracker_tree->Branch(
"NumiFluxNenergyn", &brNumiFluxNenergyn,
"NumiFluxNenergyn/D");
2056 rootracker_tree->Branch(
"NumiFluxNwtnear", &brNumiFluxNwtnear,
"NumiFluxNwtnear/D");
2057 rootracker_tree->Branch(
"NumiFluxNdxdzfar", &brNumiFluxNdxdzfar,
"NumiFluxNdxdzfar/D");
2058 rootracker_tree->Branch(
"NumiFluxNdydzfar", &brNumiFluxNdydzfar,
"NumiFluxNdydzfar/D");
2059 rootracker_tree->Branch(
"NumiFluxNenergyf", &brNumiFluxNenergyf,
"NumiFluxNenergyf/D");
2060 rootracker_tree->Branch(
"NumiFluxNwtfar", &brNumiFluxNwtfar,
"NumiFluxNwtfar/D");
2061 rootracker_tree->Branch(
"NumiFluxNorig", &brNumiFluxNorig,
"NumiFluxNorig/I");
2062 rootracker_tree->Branch(
"NumiFluxNdecay", &brNumiFluxNdecay,
"NumiFluxNdecay/I");
2063 rootracker_tree->Branch(
"NumiFluxNtype", &brNumiFluxNtype,
"NumiFluxNtype/I");
2064 rootracker_tree->Branch(
"NumiFluxVx", &brNumiFluxVx,
"NumiFluxVx/D");
2065 rootracker_tree->Branch(
"NumiFluxVy", &brNumiFluxVy,
"NumiFluxVy/D");
2066 rootracker_tree->Branch(
"NumiFluxVz", &brNumiFluxVz,
"NumiFluxVz/D");
2067 rootracker_tree->Branch(
"NumiFluxPdpx", &brNumiFluxPdpx,
"NumiFluxPdpx/D");
2068 rootracker_tree->Branch(
"NumiFluxPdpy", &brNumiFluxPdpy,
"NumiFluxPdpy/D");
2069 rootracker_tree->Branch(
"NumiFluxPdpz", &brNumiFluxPdpz,
"NumiFluxPdpz/D");
2070 rootracker_tree->Branch(
"NumiFluxPpdxdz", &brNumiFluxPpdxdz,
"NumiFluxPpdxdz/D");
2071 rootracker_tree->Branch(
"NumiFluxPpdydz", &brNumiFluxPpdydz,
"NumiFluxPpdydz/D");
2072 rootracker_tree->Branch(
"NumiFluxPppz", &brNumiFluxPppz,
"NumiFluxPppz/D");
2073 rootracker_tree->Branch(
"NumiFluxPpenergy", &brNumiFluxPpenergy,
"NumiFluxPpenergy/D");
2074 rootracker_tree->Branch(
"NumiFluxPpmedium", &brNumiFluxPpmedium,
"NumiFluxPpmedium/I");
2075 rootracker_tree->Branch(
"NumiFluxPtype", &brNumiFluxPtype,
"NumiFluxPtype/I");
2076 rootracker_tree->Branch(
"NumiFluxPpvx", &brNumiFluxPpvx,
"NumiFluxPpvx/D");
2077 rootracker_tree->Branch(
"NumiFluxPpvy", &brNumiFluxPpvy,
"NumiFluxPpvy/D");
2078 rootracker_tree->Branch(
"NumiFluxPpvz", &brNumiFluxPpvz,
"NumiFluxPpvz/D");
2079 rootracker_tree->Branch(
"NumiFluxMuparpx", &brNumiFluxMuparpx,
"NumiFluxMuparpx/D");
2080 rootracker_tree->Branch(
"NumiFluxMuparpy", &brNumiFluxMuparpy,
"NumiFluxMuparpy/D");
2081 rootracker_tree->Branch(
"NumiFluxMuparpz", &brNumiFluxMuparpz,
"NumiFluxMuparpz/D");
2082 rootracker_tree->Branch(
"NumiFluxMupare", &brNumiFluxMupare,
"NumiFluxMupare/D");
2083 rootracker_tree->Branch(
"NumiFluxNecm", &brNumiFluxNecm,
"NumiFluxNecm/D");
2084 rootracker_tree->Branch(
"NumiFluxNimpwt", &brNumiFluxNimpwt,
"NumiFluxNimpwt/D");
2085 rootracker_tree->Branch(
"NumiFluxXpoint", &brNumiFluxXpoint,
"NumiFluxXpoint/D");
2086 rootracker_tree->Branch(
"NumiFluxYpoint", &brNumiFluxYpoint,
"NumiFluxYpoint/D");
2087 rootracker_tree->Branch(
"NumiFluxZpoint", &brNumiFluxZpoint,
"NumiFluxZpoint/D");
2088 rootracker_tree->Branch(
"NumiFluxTvx", &brNumiFluxTvx,
"NumiFluxTvx/D");
2089 rootracker_tree->Branch(
"NumiFluxTvy", &brNumiFluxTvy,
"NumiFluxTvy/D");
2090 rootracker_tree->Branch(
"NumiFluxTvz", &brNumiFluxTvz,
"NumiFluxTvz/D");
2091 rootracker_tree->Branch(
"NumiFluxTpx", &brNumiFluxTpx,
"NumiFluxTpx/D");
2092 rootracker_tree->Branch(
"NumiFluxTpy", &brNumiFluxTpy,
"NumiFluxTpy/D");
2093 rootracker_tree->Branch(
"NumiFluxTpz", &brNumiFluxTpz,
"NumiFluxTpz/D");
2094 rootracker_tree->Branch(
"NumiFluxTptype", &brNumiFluxTptype,
"NumiFluxTptype/I");
2095 rootracker_tree->Branch(
"NumiFluxTgen", &brNumiFluxTgen,
"NumiFluxTgen/I");
2096 rootracker_tree->Branch(
"NumiFluxTgptype", &brNumiFluxTgptype,
"NumiFluxTgptype/I");
2097 rootracker_tree->Branch(
"NumiFluxTgppx", &brNumiFluxTgppx,
"NumiFluxTgppx/D");
2098 rootracker_tree->Branch(
"NumiFluxTgppy", &brNumiFluxTgppy,
"NumiFluxTgppy/D");
2099 rootracker_tree->Branch(
"NumiFluxTgppz", &brNumiFluxTgppz,
"NumiFluxTgppz/D");
2100 rootracker_tree->Branch(
"NumiFluxTprivx", &brNumiFluxTprivx,
"NumiFluxTprivx/D");
2101 rootracker_tree->Branch(
"NumiFluxTprivy", &brNumiFluxTprivy,
"NumiFluxTprivy/D");
2102 rootracker_tree->Branch(
"NumiFluxTprivz", &brNumiFluxTprivz,
"NumiFluxTprivz/D");
2103 rootracker_tree->Branch(
"NumiFluxBeamx", &brNumiFluxBeamx,
"NumiFluxBeamx/D");
2104 rootracker_tree->Branch(
"NumiFluxBeamy", &brNumiFluxBeamy,
"NumiFluxBeamy/D");
2105 rootracker_tree->Branch(
"NumiFluxBeamz", &brNumiFluxBeamz,
"NumiFluxBeamz/D");
2106 rootracker_tree->Branch(
"NumiFluxBeampx", &brNumiFluxBeampx,
"NumiFluxBeampx/D");
2107 rootracker_tree->Branch(
"NumiFluxBeampy", &brNumiFluxBeampy,
"NumiFluxBeampy/D");
2108 rootracker_tree->Branch(
"NumiFluxBeampz", &brNumiFluxBeampz,
"NumiFluxBeampz/D");
2115 gtree = dynamic_cast <TTree *> ( fin.Get(
"gtree") );
2118 LOG(
"gntpc",
pINFO) <<
"Input tree header: " << *thdr;
2122 gtree->SetBranchAddress(
"gmcrec", &mcrec);
2133 LOG(
"gntpc",
pINFO) <<
"Found T2KMetaData!";
2138 <<
"Could not find T2KMetaData attached to the event tree!";
2142 #ifdef __GENIE_FLUX_DRIVERS_ENABLED__ 2145 gtree->SetBranchAddress(
"flux", &jnubeam_flux_info);
2149 gtree->SetBranchAddress(
"flux", &gnumi_flux_info);
2153 <<
"\n Flux drivers are not enabled." 2154 <<
"\n No flux pass-through information will be written-out in the rootracker file" 2155 <<
"\n If this isn't what you are supposed to be doing then build GENIE by adding " 2156 <<
"--with-flux-drivers in the configuration step.";
2160 Long64_t nmax = (
gOptN<0) ?
2161 gtree->GetEntries() : TMath::Min(gtree->GetEntries(),
gOptN);
2163 LOG(
"gntpc",
pERROR) <<
"Number of events = 0";
2166 LOG(
"gntpc",
pNOTICE) <<
"*** Analyzing: " << nmax <<
" events";
2169 for(Long64_t iev = 0; iev < nmax; iev++) {
2170 gtree->GetEntry(iev);
2179 #ifdef __GENIE_FLUX_DRIVERS_ENABLED__ 2181 if(jnubeam_flux_info) {
2182 LOG(
"gntpc",
pINFO) << *jnubeam_flux_info;
2184 LOG(
"gntpc",
pINFO) <<
"No JNUBEAM flux info associated with this event";
2192 if(brEvtFlags)
delete brEvtFlags;
2194 if(brEvtCode)
delete brEvtCode;
2201 for(
int k=0;
k<4;
k++) {
2205 for(
int i=0; i<
kNPmax; i++) {
2206 brStdHepPdg [i] = 0;
2207 brStdHepStatus[i] = -1;
2208 brStdHepRescat[i] = -1;
2209 for(
int k=0;
k<4;
k++) {
2210 brStdHepX4 [i][
k] = 0;
2211 brStdHepP4 [i][
k] = 0;
2213 for(
int k=0;
k<3;
k++) {
2214 brStdHepPolz [i][
k] = 0;
2222 brNuParentDecMode = 0;
2223 for(
int k=0;
k<4;
k++) {
2224 brNuParentDecP4 [
k] = 0;
2225 brNuParentDecX4 [
k] = 0;
2226 brNuParentProP4 [
k] = 0;
2227 brNuParentProX4 [
k] = 0;
2229 brNuParentProNVtx = 0;
2233 brNuCospibm = -999999.;
2234 brNuCospi0bm = -999999.;
2236 brNuGamom0 = -999999.;
2237 for(
int k=0;
k< 3;
k++){
2238 brNuGvec0[
k] = -999999.;
2239 brNuGpos0[
k] = -999999.;
2242 for(
int k=0;
k<2;
k++) {
2243 brNuXnu[
k] = brNuBpos[
k] = brNuBtilt[
k] = brNuBrms[
k] = brNuEmit[
k] = brNuAlpha[
k] = -999999.;
2245 for(
int k=0;
k<3;
k++) brNuHcur[
k] = -999999.;
2247 for(
int k=0;
k<3;
k++){
2248 brNuGv[np][
k] = -999999.;
2249 brNuGp[np][
k] = -999999.;
2251 brNuGpid[np] = -999999;
2252 brNuGmec[np] = -999999;
2253 brNuGmat[np] = -999999;
2254 brNuGcosbm[np] = -999999.;
2255 brNuGdistc[np] = -999999.;
2256 brNuGdistal[np] = -999999.;
2257 brNuGdistti[np] = -999999.;
2258 brNuGdistfe[np] = -999999.;
2262 brNuNorm = -999999.;
2263 brNuEnusk = -999999.;
2264 brNuNormsk = -999999.;
2265 brNuAnorm = -999999.;
2266 brNuVersion= -999999.;
2267 brNuNtrig = -999999;
2268 brNuTuneid = -999999;
2271 if(brNuFileName)
delete brNuFileName;
2278 brEvtFlags =
new TBits(*
event.EventFlags());
2279 brEvtCode =
new TObjString(
event.Summary()->AsString().c_str());
2280 brEvtNum = (
int) iev;
2283 brEvtWght =
event.Weight();
2284 brEvtProb =
event.Probability();
2285 brEvtVtx[0] =
event.Vertex()->X();
2286 brEvtVtx[1] =
event.Vertex()->Y();
2287 brEvtVtx[2] =
event.Vertex()->Z();
2288 brEvtVtx[3] =
event.Vertex()->T();
2292 TIter event_iter(&
event);
2293 while ( (p = dynamic_cast<GHepParticle *>(event_iter.Next())) ) {
2299 brStdHepPdg [iparticle] = p->
Pdg();
2300 brStdHepStatus[iparticle] = (
int) p->
Status();
2302 brStdHepX4 [iparticle][0] = p->
X4()->X();
2303 brStdHepX4 [iparticle][1] = p->
X4()->Y();
2304 brStdHepX4 [iparticle][2] = p->
X4()->Z();
2305 brStdHepX4 [iparticle][3] = p->
X4()->T();
2306 brStdHepP4 [iparticle][0] = p->
P4()->Px();
2307 brStdHepP4 [iparticle][1] = p->
P4()->Py();
2308 brStdHepP4 [iparticle][2] = p->
P4()->Pz();
2309 brStdHepP4 [iparticle][3] = p->
P4()->E();
2321 brStdHepN = iparticle;
2331 #ifdef __GENIE_FLUX_DRIVERS_ENABLED__ 2336 if(jnubeam_flux_info) {
2338 brNuParentDecMode = jnubeam_flux_info->
mode;
2340 brNuParentDecP4 [0] = jnubeam_flux_info->
ppi * jnubeam_flux_info->
npi[0];
2341 brNuParentDecP4 [1] = jnubeam_flux_info->
ppi * jnubeam_flux_info->
npi[1];
2342 brNuParentDecP4 [2] = jnubeam_flux_info->
ppi * jnubeam_flux_info->
npi[2];
2343 brNuParentDecP4 [3] = TMath::Sqrt(
2344 TMath::Power(pdglib->
Find(brNuParentPdg)->Mass(), 2.)
2345 + TMath::Power(jnubeam_flux_info->
ppi, 2.)
2347 brNuParentDecX4 [0] = jnubeam_flux_info->
xpi[0];
2348 brNuParentDecX4 [1] = jnubeam_flux_info->
xpi[1];
2349 brNuParentDecX4 [2] = jnubeam_flux_info->
xpi[2];
2350 brNuParentDecX4 [3] = 0;
2352 brNuParentProP4 [0] = jnubeam_flux_info->
ppi0 * jnubeam_flux_info->
npi0[0];
2353 brNuParentProP4 [1] = jnubeam_flux_info->
ppi0 * jnubeam_flux_info->
npi0[1];
2354 brNuParentProP4 [2] = jnubeam_flux_info->
ppi0 * jnubeam_flux_info->
npi0[2];
2355 brNuParentProP4 [3] = TMath::Sqrt(
2356 TMath::Power(pdglib->
Find(brNuParentPdg)->Mass(), 2.)
2357 + TMath::Power(jnubeam_flux_info->
ppi0, 2.)
2359 brNuParentProX4 [0] = jnubeam_flux_info->
xpi0[0];
2360 brNuParentProX4 [1] = jnubeam_flux_info->
xpi0[1];
2361 brNuParentProX4 [2] = jnubeam_flux_info->
xpi0[2];
2362 brNuParentProX4 [3] = 0;
2364 brNuParentProNVtx = jnubeam_flux_info->
nvtx0;
2367 brNuFluxEntry = jnubeam_flux_info->
fluxentry;
2368 brNuIdfd = jnubeam_flux_info->
idfd;
2369 brNuCospibm = jnubeam_flux_info->
cospibm;
2370 brNuCospi0bm = jnubeam_flux_info->
cospi0bm;
2371 brNuGipart = jnubeam_flux_info->
gipart;
2372 brNuGamom0 = jnubeam_flux_info->
gamom0;
2373 for(
int k=0;
k<3;
k++){
2374 brNuGpos0[
k] = (double) jnubeam_flux_info->
gpos0[
k];
2375 brNuGvec0[
k] = (
double) jnubeam_flux_info->
gvec0[
k];
2378 brNuXnu[0] = (double) jnubeam_flux_info->
xnu;
2379 brNuXnu[1] = (
double) jnubeam_flux_info->
ynu;
2380 brNuRnu = (double) jnubeam_flux_info->
rnu;
2381 for(
int k=0;
k<2;
k++){
2382 brNuBpos[
k] = (double) jnubeam_flux_info->
bpos[
k];
2383 brNuBtilt[
k] = (
double) jnubeam_flux_info->
btilt[
k];
2384 brNuBrms[
k] = (double) jnubeam_flux_info->
brms[
k];
2385 brNuEmit[
k] = (
double) jnubeam_flux_info->
emit[
k];
2386 brNuAlpha[
k] = (double) jnubeam_flux_info->
alpha[
k];
2388 for(
int k=0;
k<3;
k++) brNuHcur[
k] = jnubeam_flux_info->
hcur[
k];
2389 for(
int np = 0; np < flux::fNgmax; np++){
2390 brNuGv[np][0] = jnubeam_flux_info->
gvx[np];
2391 brNuGv[np][1] = jnubeam_flux_info->
gvy[np];
2392 brNuGv[np][2] = jnubeam_flux_info->
gvz[np];
2393 brNuGp[np][0] = jnubeam_flux_info->
gpx[np];
2394 brNuGp[np][1] = jnubeam_flux_info->
gpy[np];
2395 brNuGp[np][2] = jnubeam_flux_info->
gpz[np];
2396 brNuGpid[np] = jnubeam_flux_info->
gpid[np];
2397 brNuGmec[np] = jnubeam_flux_info->
gmec[np];
2398 brNuGcosbm[np] = jnubeam_flux_info->
gcosbm[np];
2399 brNuGmat[np] = jnubeam_flux_info->
gmat[np];
2400 brNuGdistc[np] = jnubeam_flux_info->
gdistc[np];
2401 brNuGdistal[np] = jnubeam_flux_info->
gdistal[np];
2402 brNuGdistti[np] = jnubeam_flux_info->
gdistti[np];
2403 brNuGdistfe[np] = jnubeam_flux_info->
gdistfe[np];
2405 brNuNg = jnubeam_flux_info->
ng;
2406 brNuNorm = jnubeam_flux_info->
norm;
2407 brNuEnusk = jnubeam_flux_info->
Enusk;
2408 brNuNormsk = jnubeam_flux_info->
normsk;
2409 brNuAnorm = jnubeam_flux_info->
anorm;
2410 brNuVersion= jnubeam_flux_info->
version;
2411 brNuNtrig = jnubeam_flux_info->
ntrig;
2412 brNuTuneid = jnubeam_flux_info->
tuneid;
2413 brNuPint = jnubeam_flux_info->
pint;
2414 brNuRand = jnubeam_flux_info->
rand;
2415 brNuFileName =
new TObjString(jnubeam_flux_info->
fluxfilename.c_str());
2424 #ifdef __GENIE_FLUX_DRIVERS_ENABLED__ 2426 if(gnumi_flux_info) {
2427 brNumiFluxRun = gnumi_flux_info->
run;
2428 brNumiFluxEvtno = gnumi_flux_info->
evtno;
2429 brNumiFluxNdxdz = gnumi_flux_info->
ndxdz;
2430 brNumiFluxNdydz = gnumi_flux_info->
ndydz;
2431 brNumiFluxNpz = gnumi_flux_info->
npz;
2432 brNumiFluxNenergy = gnumi_flux_info->
nenergy;
2433 brNumiFluxNdxdznea = gnumi_flux_info->
ndxdznea;
2434 brNumiFluxNdydznea = gnumi_flux_info->
ndydznea;
2435 brNumiFluxNenergyn = gnumi_flux_info->
nenergyn;
2436 brNumiFluxNwtnear = gnumi_flux_info->
nwtnear;
2437 brNumiFluxNdxdzfar = gnumi_flux_info->
ndxdzfar;
2438 brNumiFluxNdydzfar = gnumi_flux_info->
ndydzfar;
2439 brNumiFluxNenergyf = gnumi_flux_info->
nenergyf;
2440 brNumiFluxNwtfar = gnumi_flux_info->
nwtfar;
2441 brNumiFluxNorig = gnumi_flux_info->
norig;
2442 brNumiFluxNdecay = gnumi_flux_info->
ndecay;
2443 brNumiFluxNtype = gnumi_flux_info->
ntype;
2444 brNumiFluxVx = gnumi_flux_info->
vx;
2445 brNumiFluxVy = gnumi_flux_info->
vy;
2446 brNumiFluxVz = gnumi_flux_info->
vz;
2447 brNumiFluxPdpx = gnumi_flux_info->
pdpx;
2448 brNumiFluxPdpy = gnumi_flux_info->
pdpy;
2449 brNumiFluxPdpz = gnumi_flux_info->
pdpz;
2450 brNumiFluxPpdxdz = gnumi_flux_info->
ppdxdz;
2451 brNumiFluxPpdydz = gnumi_flux_info->
ppdydz;
2452 brNumiFluxPppz = gnumi_flux_info->
pppz;
2453 brNumiFluxPpenergy = gnumi_flux_info->
ppenergy;
2454 brNumiFluxPpmedium = gnumi_flux_info->
ppmedium;
2455 brNumiFluxPtype = gnumi_flux_info->
ptype;
2456 brNumiFluxPpvx = gnumi_flux_info->
ppvx;
2457 brNumiFluxPpvy = gnumi_flux_info->
ppvy;
2458 brNumiFluxPpvz = gnumi_flux_info->
ppvz;
2459 brNumiFluxMuparpx = gnumi_flux_info->
muparpx;
2460 brNumiFluxMuparpy = gnumi_flux_info->
muparpy;
2461 brNumiFluxMuparpz = gnumi_flux_info->
muparpz;
2462 brNumiFluxMupare = gnumi_flux_info->
mupare;
2463 brNumiFluxNecm = gnumi_flux_info->
necm;
2464 brNumiFluxNimpwt = gnumi_flux_info->
nimpwt;
2465 brNumiFluxXpoint = gnumi_flux_info->
xpoint;
2466 brNumiFluxYpoint = gnumi_flux_info->
ypoint;
2467 brNumiFluxZpoint = gnumi_flux_info->
zpoint;
2468 brNumiFluxTvx = gnumi_flux_info->
tvx;
2469 brNumiFluxTvy = gnumi_flux_info->
tvy;
2470 brNumiFluxTvz = gnumi_flux_info->
tvz;
2471 brNumiFluxTpx = gnumi_flux_info->
tpx;
2472 brNumiFluxTpy = gnumi_flux_info->
tpy;
2473 brNumiFluxTpz = gnumi_flux_info->
tpz;
2474 brNumiFluxTptype = gnumi_flux_info->
tptype;
2475 brNumiFluxTgen = gnumi_flux_info->
tgen;
2476 brNumiFluxTgptype = gnumi_flux_info->
tgptype;
2477 brNumiFluxTgppx = gnumi_flux_info->
tgppx;
2478 brNumiFluxTgppy = gnumi_flux_info->
tgppy;
2479 brNumiFluxTgppz = gnumi_flux_info->
tgppz;
2480 brNumiFluxTprivx = gnumi_flux_info->
tprivx;
2481 brNumiFluxTprivy = gnumi_flux_info->
tprivy;
2482 brNumiFluxTprivz = gnumi_flux_info->
tprivz;
2483 brNumiFluxBeamx = gnumi_flux_info->
beamx;
2484 brNumiFluxBeamy = gnumi_flux_info->
beamy;
2485 brNumiFluxBeamz = gnumi_flux_info->
beamz;
2486 brNumiFluxBeampx = gnumi_flux_info->
beampx;
2487 brNumiFluxBeampy = gnumi_flux_info->
beampy;
2488 brNumiFluxBeampz = gnumi_flux_info->
beampz;
2494 rootracker_tree->Fill();
2500 double pot = gtree->GetWeight();
2501 rootracker_tree->SetWeight(pot);
2505 TFolder * genv = (TFolder*) fin.Get(
"genv");
2506 TFolder * gconfig = (TFolder*) fin.Get(
"gconfig");
2508 genv ->
Write(
"genv");
2509 gconfig ->
Write(
"gconfig");
2517 LOG(
"gntpc",
pINFO) <<
"\nDone converting GENIE's GHEP ntuple";
2540 tree = dynamic_cast <TTree *> ( fin.Get(
"gtree") );
2543 LOG(
"gntpc",
pINFO) <<
"Input tree header: " << *thdr;
2547 tree->SetBranchAddress(
"gmcrec", &mcrec);
2554 TFile
fout(
"ghad.root",
"recreate");
2555 TTree * ghad =
new TTree(
"ghad",
"");
2556 ghad->Branch(
"i", &brIev,
"i/I" );
2557 ghad->Branch(
"W", &brW,
"W/D" );
2558 ghad->Branch(
"n", &brN,
"n/I" );
2559 ghad->Branch(
"pdg", brPdg,
"pdg[n]/I" );
2560 ghad->Branch(
"E", brE,
"E[n]/D" );
2561 ghad->Branch(
"px", brPx,
"px[n]/D" );
2562 ghad->Branch(
"py", brPy,
"py[n]/D" );
2563 ghad->Branch(
"pz", brPz,
"pz[n]/D" );
2567 Long64_t nmax = (
gOptN<0) ?
2568 tree->GetEntries() : TMath::Min(tree->GetEntries(),
gOptN);
2570 LOG(
"gntpc",
pERROR) <<
"Number of events = 0";
2573 LOG(
"gntpc",
pNOTICE) <<
"*** Analyzing: " << nmax <<
" events";
2576 for(Long64_t iev = 0; iev < nmax; iev++) {
2577 tree->GetEntry(iev);
2606 bool pass = is_cc && (is_dis || is_res);
2612 int ccnc = is_cc ? 1 : 0;
2616 if (init_state.
IsNuP ()) im = 1;
2617 else if (init_state.
IsNuN ()) im = 2;
2618 else if (init_state.
IsNuBarP ()) im = 3;
2619 else if (init_state.
IsNuBarN ()) im = 4;
2631 int nupdg = neutrino->
Pdg();
2632 int fslpdg = fsl->
Pdg();
2633 int A = target->
A();
2634 int Z = target->
Z();
2636 const TLorentzVector & k1 = *(neutrino->
P4());
2637 const TLorentzVector & k2 = *(fsl->
P4());
2643 GHepParticle * hadsyst =
event.FinalStateHadronicSystem();
2645 ph = *(hadsyst->
P4());
2649 ph = *(hadres->
P4());
2653 bool get_selected =
true;
2654 double x = kine.
x (get_selected);
2655 double y = kine.
y (get_selected);
2656 double W = kine.
W (get_selected);
2660 TIter event_iter(&
event);
2663 while ( (p = dynamic_cast<GHepParticle *>(event_iter.Next())) ) {
2667 if (pdg ==
kPdgString ) { hadmod=11; ihadmom=i; }
2668 if (pdg ==
kPdgCluster ) { hadmod=12; ihadmom=i; }
2669 if (pdg ==
kPdgIndep ) { hadmod=13; ihadmom=i; }
2674 << nupdg <<
"\t" << ccnc <<
"\t" << im <<
"\t" 2675 << A <<
"\t" << Z <<
endl;
2676 output << inttyp <<
"\t" << x <<
"\t" << y <<
"\t" << W <<
"\t" 2679 << k1.Px() <<
"\t" << k1.Py() <<
"\t" << k1.Pz() <<
"\t" 2680 << k1.Energy() <<
"\t" << k1.M() <<
endl;
2682 << k2.Px() <<
"\t" << k2.Py() <<
"\t" << k2.Pz() <<
"\t" 2683 << k2.Energy() <<
"\t" << k2.M() <<
endl;
2685 << ph.Px() <<
"\t" << ph.Py() <<
"\t" << ph.Pz() <<
"\t" 2686 << ph.Energy() <<
"\t" << ph.M() <<
endl;
2692 while ( (p = dynamic_cast<GHepParticle *>(event_iter.Next())) ) {
2694 if(i<ihadmom)
continue;
2704 int mom_pdg = mom->
Pdg();
2706 if(!skip) { hadv.push_back(i); }
2722 for( ; hiter != hadv.end(); ++hiter) {
2725 int pdg = particle->
Pdg();
2726 double px = particle->
P4()->Px();
2727 double py = particle->
P4()->Py();
2728 double pz = particle->
P4()->Pz();
2729 double E = particle->
P4()->Energy();
2730 double m = particle->
P4()->M();
2732 << px <<
"\t" << py <<
"\t" << pz <<
"\t" 2733 << E <<
"\t" << m <<
endl;
2757 ghad->Write(
"ghad");
2762 LOG(
"gntpc",
pINFO) <<
"\nDone converting GENIE's GHEP ntuple";
2805 TTree * tEvtTree =
new TTree(
"ginuke",
"GENIE INuke Summary Tree");
2810 tEvtTree->Branch(
"iev", &brIEv,
"iev/I" );
2811 tEvtTree->Branch(
"probe", &brProbe,
"probe/I" );
2812 tEvtTree->Branch(
"tgt" , &brTarget,
"tgt/I" );
2813 tEvtTree->Branch(
"ke", &brKE,
"ke/D" );
2814 tEvtTree->Branch(
"e", &brE,
"e/D" );
2815 tEvtTree->Branch(
"p", &brP,
"p/D" );
2816 tEvtTree->Branch(
"A", &brTgtA,
"A/I" );
2817 tEvtTree->Branch(
"Z", &brTgtZ,
"Z/I" );
2818 tEvtTree->Branch(
"vtxx", &brVtxX,
"vtxx/D" );
2819 tEvtTree->Branch(
"vtxy", &brVtxY,
"vtxy/D" );
2820 tEvtTree->Branch(
"vtxz", &brVtxZ,
"vtxz/D" );
2821 tEvtTree->Branch(
"probe_fsi", &brProbeFSI,
"probe_fsi/I" );
2822 tEvtTree->Branch(
"dist", &brDist,
"dist/D" );
2823 tEvtTree->Branch(
"nh", &brNh,
"nh/I" );
2824 tEvtTree->Branch(
"pdgh", brPdgh,
"pdgh[nh]/I" );
2825 tEvtTree->Branch(
"Eh", brEh,
"Eh[nh]/D" );
2826 tEvtTree->Branch(
"ph", brPh,
"ph[nh]/D" );
2827 tEvtTree->Branch(
"pxh", brPxh,
"pxh[nh]/D" );
2828 tEvtTree->Branch(
"pyh", brPyh,
"pyh[nh]/D" );
2829 tEvtTree->Branch(
"pzh", brPzh,
"pzh[nh]/D" );
2830 tEvtTree->Branch(
"cth", brCosth,
"cth[nh]/D" );
2831 tEvtTree->Branch(
"mh", brMh,
"mh[nh]/D" );
2832 tEvtTree->Branch(
"np", &brNp,
"np/I" );
2833 tEvtTree->Branch(
"nn", &brNn,
"nn/I" );
2834 tEvtTree->Branch(
"npip", &brNpip,
"npip/I" );
2835 tEvtTree->Branch(
"npim", &brNpim,
"npim/I" );
2836 tEvtTree->Branch(
"npi0", &brNpi0,
"npi0/I" );
2840 TTree * er_tree = 0;
2842 er_tree = dynamic_cast <TTree *> ( fin.Get(
"gtree") );
2845 LOG(
"gntpc",
pERROR) <<
"Null input tree";
2848 LOG(
"gntpc",
pINFO) <<
"Input tree header: " << *thdr;
2852 er_tree->SetBranchAddress(
"gmcrec", &mcrec);
2854 LOG(
"gntpc",
pERROR) <<
"Null MC record";
2859 Long64_t nmax = (
gOptN<0) ?
2860 er_tree->GetEntries() : TMath::Min( er_tree->GetEntries(),
gOptN );
2862 LOG(
"gntpc",
pERROR) <<
"Number of events = 0";
2865 LOG(
"gntpc",
pNOTICE) <<
"*** Analyzing: " << nmax <<
" events";
2867 for(Long64_t iev = 0; iev < nmax; iev++) {
2869 er_tree->GetEntry(iev);
2880 for(
int j=0; j<
kNPmax; j++) {
2895 assert(probe && target);
2897 brProbe = probe -> Pdg();
2898 brTarget = target -> Pdg();
2899 brKE = probe -> KinE();
2901 brP = probe -> P4()->Vect().Mag();
2904 brVtxX = probe -> Vx();
2905 brVtxY = probe -> Vy();
2906 brVtxZ = probe -> Vz();
2907 brProbeFSI = probe -> RescatterCode();
2909 assert(rescattered_hadron);
2914 double x = rescattered_hadron->
Vx();
2915 double y = rescattered_hadron->
Vy();
2916 double z = rescattered_hadron->
Vz();
2917 double d2 = TMath::Power(brVtxX-x,2) +
2918 TMath::Power(brVtxY-y,2) +
2919 TMath::Power(brVtxZ-z,2);
2920 brDist = TMath::Sqrt(d2);
2931 TIter event_iter(&
event);
2932 while ( (p = dynamic_cast<GHepParticle *>(event_iter.Next())) ) {
2936 brPdgh[i] = p->
Pdg();
2938 brPxh [i] = p->
Px();
2939 brPyh [i] = p->
Py();
2940 brPzh [i] = p->
Pz();
2942 TMath::Sqrt(brPxh[i]*brPxh[i]+brPyh[i]*brPyh[i]
2943 +brPzh[i]*brPzh[i]);
2944 brCosth[i] = brPzh[i]/brPh[i];
2945 brMh [i] = p->
Mass();
2958 int tempProbeFSI = brProbeFSI;
2959 brProbeFSI =
HAProbeFSI(tempProbeFSI, brProbe, brNh, brEh, brPdgh, brNpip, brNpim, brNpi0);
2975 LOG(
"gntpc",
pINFO) <<
"\nDone converting GENIE's GHEP ntuple";
2991 LOG(
"gntpc",
pINFO) <<
"Reading input filename";
2995 <<
"Unspecified input filename - Exiting";
3005 <<
"The input ROOT file [" 3013 LOG(
"gntpc",
pINFO) <<
"Reading output file format";
3030 LOG(
"gntpc",
pFATAL) <<
"Unknown output file format (" << fmt <<
")";
3036 LOG(
"gntpc",
pFATAL) <<
"Unspecified output file format";
3043 LOG(
"gntpc",
pINFO) <<
"Reading output filename";
3047 <<
"Unspecified output filename - Using default";
3053 LOG(
"gntpc",
pINFO) <<
"Reading number of events to analyze";
3057 <<
"Unspecified number of events to analyze - Use all";
3063 LOG(
"gntpc",
pINFO) <<
"Reading format version number";
3069 <<
"Unspecified version number - Use latest";
3080 LOG(
"gntpc",
pINFO) <<
"Reading random number seed";
3083 LOG(
"gntpc",
pINFO) <<
"Unspecified random number seed - Using default";
3091 LOG(
"gntpc",
pNOTICE) <<
"Number of events to be converted = " <<
gOptN;
3115 unsigned int L = inpname.length();
3119 if(inpname.substr(L-4, L).find(
"root") != string::npos) {
3120 inpname.erase(L-4, L);
3124 size_t pos = inpname.find(
"ghep.");
3125 if(pos != string::npos) {
3126 inpname.erase(pos, pos+4);
3130 name << inpname << ext;
3132 return gSystem->BaseName(name.str().c_str());
3154 string basedir =
string( gSystem->Getenv(
"GENIE") );
3155 string thisfile = basedir +
string(
"/src/Apps/gNtpConv.cxx");
3156 string cmd =
"less " + thisfile;
3158 gSystem->Exec(cmd.c_str());
3162 int HAProbeFSI(
int probe_fsi,
int probe_pdg,
int numh,
double E_had[],
int pdg_had[],
int numpip,
int numpim,
int numpi0)
3167 for(
int i=0; i<numh; i++)
3168 { energy += E_had[i]; }
3172 if (probe_fsi==3 && numh==1)
3174 else if (energy==E_had[0] && numh==1)
3176 else if (
pdg::IsPion(probe_pdg) && numpip+numpi0+numpim==0)
3178 else if ( (
pdg::IsNucleon(probe_pdg) && numpip+numpi0+numpim==0 && numh>2 )
3179 || (probe_pdg==
kPdgGamma && energy!=E_had[0] && numpip+numpi0+numpim==0))
3181 else if ( numpip+numpi0+numpim > (
pdg::IsPion(probe_pdg) ? 1 : 0) )
3185 for(
int i = 0; i < numh; i++)
3187 if ( (
pdg::IsPion(probe_pdg) && ( probe_pdg==pdg_had[i] ))
3199 for (
int iter = 0; iter < numh; iter++)
3201 if (probe_pdg==211 && pdg_had[iter]==-211) { index=8; undef=
false; }
3202 else if (probe_pdg==-211 && pdg_had[iter]==211) { index=8; undef=
false; }
3205 if (undef) { index=0; }
bool IsResonant(void) const
void RandGen(long int seed)
static void SetPrintLevel(int print_level)
int main(int argc, char **argv)
int NeutReactionCode(const GHepRecord *evrec)
double W(bool selected=false) const
int RescatterCode(void) const
int GenieMajorVrsNum(string tag)
bool IsParticle(int pdgc)
not ion or pseudo-particle
bool HitSeaQrk(void) const
bool IsWeakCC(void) const
bool IsNuBarN(void) const
is anti-neutrino + neutron?
NtpMCRecHeader hdr
record header
string ArgAsString(char opt)
THE MAIN GENIE PROJECT NAMESPACE
double E(void) const
Get energy.
void AddDarkMatter(double mass, double med_ratio)
static const double kNucleonMass
double Q2(const Interaction *const i)
static RandomGen * Instance()
Access instance.
void CustomizeFilename(string filename)
const TLorentzVector * P4(void) const
int FirstDaughter(void) const
MINOS-style ntuple record. Each such ntuple record holds a generated EventRecord object. Ntuples of this type are intended for feeding GENIE events into other applications (for example the GEANT4 based MC generation framework of an experiment) if no direct interface exists.
double PolzPolarAngle(void) const
int HitQrkPdg(void) const
bool IsInverseMuDecay(void) const
void ReadFromCommandLine(int argc, char **argv)
bool IsQuasiElastic(void) const
bool IsNuN(void) const
is neutrino + neutron?
int NuanceReactionCode(const GHepRecord *evrec)
bool gOptCopyJobMeta
copy MC job metadata (gconfig, genv TFolders)
int IonPdgCodeToA(int pdgc)
Generated/set kinematical variables for an event.
static constexpr double fs
double x(bool selected=false) const
std::pair< float, std::string > P
bool IsDiffractive(void) const
bool IsCoherentProduction(void) const
double Mass(void) const
Mass that corresponds to the PDG code.
bool IsIMDAnnihilation(void) const
static constexpr double MeV
A singleton holding random number generator classes. All random number generation in GENIE should tak...
string gOptInpFileName
input file name
double Pz(void) const
Get Pz.
string AsString(void) const
GHepStatus_t Status(void) const
Q_EXPORT QTSManip setprecision(int p)
double Energy(void) const
Get energy.
Contains minimal information for tagging exclusive processes.
void ConvertToGINuke(void)
double Px(void) const
Get Px.
double y(bool selected=false) const
int LastMother(void) const
bool IsCharmEvent(void) const
double Vt(void) const
Get production time.
bool CheckRootFilename(string filename)
bool IsSingleKaon(void) const
int FirstMother(void) const
enum EGNtpcFmt GNtpcFmt_t
string Name(void) const
Name that corresponds to the PDG code.
string DefaultOutputFile(void)
int GenieMinorVrsNum(string tag)
Summary information for an interaction.
int GeantToPdg(int geant_code)
int LastDaughter(void) const
bool IsWeakNC(void) const
bool IsNuP(void) const
is neutrino + proton?
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
bool IsCoherentElastic(void) const
void ConvertToGRooTracker(void)
bool IsNuElectronElastic(void) const
static constexpr double cm2
A class encapsulating an enumeration of interaction types (EM, Weak-CC, Weak-NC) and scattering types...
bool IsAMNuGamma(void) const
Long64_t gOptN
number of events to process
const Kinematics & Kine(void) const
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
void Save(void)
get the even tree
void AddEventRecord(int ievent, const EventRecord *ev_rec)
save the event tree
Resonance_t Resonance(void) const
int HAProbeFSI(int, int, int, double[], int[], int, int, int)
GNtpcFmt_t gOptOutFileFormat
output file format id
bool PolzIsSet(void) const
Q_EXPORT QTSManip setw(int w)
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
bool IsDeepInelastic(void) const
void Initialize(void)
add event
double KinE(bool mass_from_pdg=false) const
Get kinetic energy.
static PDGLibrary * Instance(void)
static RunOpt * Instance(void)
int GenieRevisVrsNum(string tag)
int gOptVersion
output file format version
A utility class to facilitate creating the GENIE MC Ntuple from the output GENIE GHEP event records...
Singleton class to load & serve a TDatabasePDG.
bool HitQrkIsSet(void) const
double Vz(void) const
Get production z.
const TLorentzVector * X4(void) const
const int kPdgAntiNeutron
void ConvertToGHepMock(void)
bool IsPseudoParticle(int pdgc)
const XclsTag & ExclTag(void) const
void ConvertToGTracker(void)
bool IsNuBarP(void) const
is anti-neutrino + proton?
TRandom3 & RndGen(void) const
rnd number generator for generic usage
virtual void AddParticle(const GHepParticle &p)
const InitialState & InitState(void) const
int LatestFormatVersionNumber(void)
const ProcessInfo & ProcInfo(void) const
double t(bool selected=false) const
int IonPdgCodeToZ(int pdgc)
long int gOptRanSeed
random number seed
void MesgThresholds(string inpfile)
TParticlePDG * Find(int pdgc, bool must_exist=true)
double Vy(void) const
Get production y.
Command line argument parser.
double Q2(bool selected=false) const
const Target & Tgt(void) const
double PolzAzimuthAngle(void) const
void Clear(Option_t *opt="")
static constexpr double ys
enum EGNtpcFmt GNtpcFmt_t
const int kPdgHadronicSyst
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
Q_EXPORT QTSManip setfill(int f)
STDHEP-like event record entry that can fit a particle or a nucleus.
bool OptionExists(char opt)
was option set?
QTextStream & endl(QTextStream &s)
Event finding and building.
enum genie::EGHepStatus GHepStatus_t
void GetCommandLineArgs(int argc, char **argv)
double Vx(void) const
Get production x.
Initial State information.
double Py(void) const
Get Py.
string gOptOutFileName
output file name