11 #include "libxml/parser.h" 12 #include "libxml/xmlmemory.h" 19 #include <TObjString.h> 21 #include "GENIE/Framework/ParticleData/BaryonResonance.h" 22 #include "GENIE/Framework/ParticleData/BaryonResUtils.h" 23 #include "GENIE/Framework/Conventions/GBuild.h" 24 #include "GENIE/Framework/Conventions/Constants.h" 25 #include "GENIE/Framework/Conventions/Units.h" 26 #include "GENIE/Framework/EventGen/EventRecord.h" 27 #include "GENIE/Framework/GHEP/GHepStatus.h" 28 #include "GENIE/Framework/GHEP/GHepParticle.h" 29 #include "GENIE/Framework/GHEP/GHepUtils.h" 30 #include "GENIE/Framework/Ntuple/NtpMCFormat.h" 31 #include "GENIE/Framework/Ntuple/NtpMCTreeHeader.h" 32 #include "GENIE/Framework/Ntuple/NtpMCEventRecord.h" 33 #include "GENIE/Framework/Ntuple/NtpWriter.h" 34 #include "GENIE/Framework/Numerical/RandomGen.h" 35 #include "GENIE/Framework/Messenger/Messenger.h" 36 #include "GENIE/Framework/ParticleData/PDGCodes.h" 37 #include "GENIE/Framework/ParticleData/PDGUtils.h" 38 #include "GENIE/Framework/ParticleData/PDGLibrary.h" 39 #include "GENIE/Framework/Utils/AppInit.h" 40 #include "GENIE/Framework/Utils/RunOpt.h" 41 #include "GENIE/Framework/Utils/CmdLnArgParser.h" 42 #include "GENIE/Framework/Utils/SystemUtils.h" 43 #include "GENIE/Framework/Utils/T2KEvGenMetaData.h" 45 #ifdef __GENIE_FLUX_DRIVERS_ENABLED__ 46 #include "GENIE/Tools/Flux/GJPARCNuFlux.h" 47 #include "GENIE/Tools/Flux/GNuMIFlux.h" 53 using std::ostringstream;
60 using std::setiosflags;
63 using namespace genie;
79 int HAProbeFSI (
int,
int,
int,
double [],
int [],
int,
int,
int);
180 const double e_h = 1.3;
186 int brFSPrimLept = 0;
192 bool brFromSea =
false;
194 bool brIsQel =
false;
195 bool brIsRes =
false;
196 bool brIsDis =
false;
197 bool brIsCoh =
false;
198 bool brIsMec =
false;
199 bool brIsDfr =
false;
200 bool brIsImd =
false;
201 bool brIsSingleK =
false;
202 bool brIsImdAnh =
false;
203 bool brIsNuEL =
false;
207 bool brIsCharmPro =
false;
209 int brCodeNuance = 0;
214 double brKineQ2s = 0;
288 TTree * s_tree =
new TTree(
"gst",
"GENIE Summary Event Tree");
292 s_tree->Branch(
"iev", &brIev,
"iev/I" );
293 s_tree->Branch(
"neu", &brNeutrino,
"neu/I" );
294 s_tree->Branch(
"fspl", &brFSPrimLept,
"fspl/I" );
295 s_tree->Branch(
"tgt", &brTarget,
"tgt/I" );
296 s_tree->Branch(
"Z", &brTargetZ,
"Z/I" );
297 s_tree->Branch(
"A", &brTargetA,
"A/I" );
298 s_tree->Branch(
"hitnuc", &brHitNuc,
"hitnuc/I" );
299 s_tree->Branch(
"hitqrk", &brHitQrk,
"hitqrk/I" );
300 s_tree->Branch(
"resid", &brResId,
"resid/I" );
301 s_tree->Branch(
"sea", &brFromSea,
"sea/O" );
302 s_tree->Branch(
"qel", &brIsQel,
"qel/O" );
303 s_tree->Branch(
"mec", &brIsMec,
"mec/O" );
304 s_tree->Branch(
"res", &brIsRes,
"res/O" );
305 s_tree->Branch(
"dis", &brIsDis,
"dis/O" );
306 s_tree->Branch(
"coh", &brIsCoh,
"coh/O" );
307 s_tree->Branch(
"dfr", &brIsDfr,
"dfr/O" );
308 s_tree->Branch(
"imd", &brIsImd,
"imd/O" );
309 s_tree->Branch(
"imdanh", &brIsImdAnh,
"imdanh/O" );
310 s_tree->Branch(
"singlek", &brIsSingleK,
"singlek/O" );
311 s_tree->Branch(
"nuel", &brIsNuEL,
"nuel/O" );
312 s_tree->Branch(
"em", &brIsEM,
"em/O" );
313 s_tree->Branch(
"cc", &brIsCC,
"cc/O" );
314 s_tree->Branch(
"nc", &brIsNC,
"nc/O" );
315 s_tree->Branch(
"charm", &brIsCharmPro,
"charm/O" );
316 s_tree->Branch(
"neut_code", &brCodeNeut,
"neut_code/I" );
317 s_tree->Branch(
"nuance_code", &brCodeNuance,
"nuance_code/I" );
318 s_tree->Branch(
"wght", &brWeight,
"wght/D" );
319 s_tree->Branch(
"xs", &brKineXs,
"xs/D" );
320 s_tree->Branch(
"ys", &brKineYs,
"ys/D" );
321 s_tree->Branch(
"ts", &brKineTs,
"ts/D" );
322 s_tree->Branch(
"Q2s", &brKineQ2s,
"Q2s/D" );
323 s_tree->Branch(
"Ws", &brKineWs,
"Ws/D" );
324 s_tree->Branch(
"x", &brKineX,
"x/D" );
325 s_tree->Branch(
"y", &brKineY,
"y/D" );
326 s_tree->Branch(
"t", &brKineT,
"t/D" );
327 s_tree->Branch(
"Q2", &brKineQ2,
"Q2/D" );
328 s_tree->Branch(
"W", &brKineW,
"W/D" );
329 s_tree->Branch(
"EvRF", &brEvRF,
"EvRF/D" );
330 s_tree->Branch(
"Ev", &brEv,
"Ev/D" );
331 s_tree->Branch(
"pxv", &brPxv,
"pxv/D" );
332 s_tree->Branch(
"pyv", &brPyv,
"pyv/D" );
333 s_tree->Branch(
"pzv", &brPzv,
"pzv/D" );
334 s_tree->Branch(
"En", &brEn,
"En/D" );
335 s_tree->Branch(
"pxn", &brPxn,
"pxn/D" );
336 s_tree->Branch(
"pyn", &brPyn,
"pyn/D" );
337 s_tree->Branch(
"pzn", &brPzn,
"pzn/D" );
338 s_tree->Branch(
"El", &brEl,
"El/D" );
339 s_tree->Branch(
"pxl", &brPxl,
"pxl/D" );
340 s_tree->Branch(
"pyl", &brPyl,
"pyl/D" );
341 s_tree->Branch(
"pzl", &brPzl,
"pzl/D" );
342 s_tree->Branch(
"pl", &brPl,
"pl/D" );
343 s_tree->Branch(
"cthl", &brCosthl,
"cthl/D" );
344 s_tree->Branch(
"nfp", &brNfP,
"nfp/I" );
345 s_tree->Branch(
"nfn", &brNfN,
"nfn/I" );
346 s_tree->Branch(
"nfpip", &brNfPip,
"nfpip/I" );
347 s_tree->Branch(
"nfpim", &brNfPim,
"nfpim/I" );
348 s_tree->Branch(
"nfpi0", &brNfPi0,
"nfpi0/I" );
349 s_tree->Branch(
"nfkp", &brNfKp,
"nfkp/I" );
350 s_tree->Branch(
"nfkm", &brNfKm,
"nfkm/I" );
351 s_tree->Branch(
"nfk0", &brNfK0,
"nfk0/I" );
352 s_tree->Branch(
"nfem", &brNfEM,
"nfem/I" );
353 s_tree->Branch(
"nfother", &brNfOther,
"nfother/I" );
354 s_tree->Branch(
"nip", &brNiP,
"nip/I" );
355 s_tree->Branch(
"nin", &brNiN,
"nin/I" );
356 s_tree->Branch(
"nipip", &brNiPip,
"nipip/I" );
357 s_tree->Branch(
"nipim", &brNiPim,
"nipim/I" );
358 s_tree->Branch(
"nipi0", &brNiPi0,
"nipi0/I" );
359 s_tree->Branch(
"nikp", &brNiKp,
"nikp/I" );
360 s_tree->Branch(
"nikm", &brNiKm,
"nikm/I" );
361 s_tree->Branch(
"nik0", &brNiK0,
"nik0/I" );
362 s_tree->Branch(
"niem", &brNiEM,
"niem/I" );
363 s_tree->Branch(
"niother", &brNiOther,
"niother/I" );
364 s_tree->Branch(
"ni", &brNi,
"ni/I" );
365 s_tree->Branch(
"pdgi", brPdgi,
"pdgi[ni]/I " );
366 s_tree->Branch(
"resc", brResc,
"resc[ni]/I " );
367 s_tree->Branch(
"Ei", brEi,
"Ei[ni]/D" );
368 s_tree->Branch(
"pxi", brPxi,
"pxi[ni]/D" );
369 s_tree->Branch(
"pyi", brPyi,
"pyi[ni]/D" );
370 s_tree->Branch(
"pzi", brPzi,
"pzi[ni]/D" );
371 s_tree->Branch(
"nf", &brNf,
"nf/I" );
372 s_tree->Branch(
"pdgf", brPdgf,
"pdgf[nf]/I " );
373 s_tree->Branch(
"Ef", brEf,
"Ef[nf]/D" );
374 s_tree->Branch(
"pxf", brPxf,
"pxf[nf]/D" );
375 s_tree->Branch(
"pyf", brPyf,
"pyf[nf]/D" );
376 s_tree->Branch(
"pzf", brPzf,
"pzf[nf]/D" );
377 s_tree->Branch(
"pf", brPf,
"pf[nf]/D" );
378 s_tree->Branch(
"cthf", brCosthf,
"cthf[nf]/D" );
379 s_tree->Branch(
"vtxx", &brVtxX,
"vtxx/D" );
380 s_tree->Branch(
"vtxy", &brVtxY,
"vtxy/D" );
381 s_tree->Branch(
"vtxz", &brVtxZ,
"vtxz/D" );
382 s_tree->Branch(
"vtxt", &brVtxT,
"vtxt/D" );
383 s_tree->Branch(
"sumKEf", &brSumKEf,
"sumKEf/D" );
384 s_tree->Branch(
"calresp0", &brCalResp0,
"calresp0/D" );
390 er_tree = dynamic_cast <TTree *> ( fin.Get(
"gtree") );
393 LOG(
"gntpc",
pERROR) <<
"Null input GHEP event tree";
396 LOG(
"gntpc",
pINFO) <<
"Input tree header: " << *thdr;
400 er_tree->SetBranchAddress(
"gmcrec", &mcrec);
402 LOG(
"gntpc",
pERROR) <<
"Null MC record";
407 Long64_t nmax = (
gOptN<0) ?
408 er_tree->GetEntries() : TMath::Min( er_tree->GetEntries(),
gOptN );
410 LOG(
"gntpc",
pERROR) <<
"Number of events = 0";
414 LOG(
"gntpc",
pNOTICE) <<
"*** Analyzing: " << nmax <<
" events";
416 TLorentzVector pdummy(0,0,0,0);
419 for(Long64_t iev = 0; iev < nmax; iev++) {
420 er_tree->GetEntry(iev);
429 bool is_unphysical =
event.IsUnphysical();
431 LOG(
"gntpc",
pINFO) <<
"Skipping unphysical event";
438 for(
int j=0; j<
kNPmax; j++) {
460 if(
nullptr == target){
461 LOG(
"gntpc",
pINFO) <<
"Skipping no target";
487 TLorentzVector * vtx =
event.Vertex();
493 bool is_coh = proc_info.IsCoherent();
505 bool is_em = proc_info.
IsEM();
506 bool is_weakcc = proc_info.
IsWeakCC();
507 bool is_weaknc = proc_info.
IsWeakNC();
508 bool is_mec = proc_info.
IsMEC();
510 if (!hitnucl && neutrino) {
515 int qrk = (is_dis) ? tgt.
HitQrkPdg() : 0;
516 bool seaq = (is_dis) ? tgt.
HitSeaQrk() :
false;
530 double weight =
event.Weight();
536 bool get_selected =
true;
537 double xs = kine.
x (get_selected);
538 double ys = kine.
y (get_selected);
539 double ts = (is_coh || is_dfr) ? kine.
t (get_selected) : -1;
540 double Q2s = kine.
Q2(get_selected);
541 double Ws = kine.
W (get_selected);
544 <<
"[Select] Q2 = " << Q2s <<
", W = " << Ws
545 <<
", x = " << xs <<
", y = " << ys <<
", t = " << ts;
551 const TLorentzVector & k1 = (neutrino) ? *(neutrino->
P4()) : pdummy;
552 const TLorentzVector & k2 = (fsl) ? *(fsl->
P4()) : pdummy;
553 const TLorentzVector & p1 = (hitnucl) ? *(hitnucl->
P4()) : pdummy;
556 TLorentzVector q = k1-k2;
557 double Q2 = -1 * q.M2();
559 double v = (hitnucl) ? q.Energy() : -1;
563 x = (hitnucl) ? 0.5*Q2/(M*v) : -1;
564 y = (hitnucl) ? v/k1.Energy() : -1;
566 W2 = (hitnucl) ? M*M + 2*M*v - Q2 : -1;
567 W = (hitnucl) ? TMath::Sqrt(W2) : -1;
574 W2 = M*M + 2*M*v -
Q2;
579 double t = (is_coh || is_dfr) ? kine.
t (get_selected) : -1;
582 TLorentzVector k1_rf = k1;
584 k1_rf.Boost(-1.*p1.BoostVector());
596 <<
"[Calc] Q2 = " << Q2 <<
", W = " << W
597 <<
", x = " << x <<
", y = " << y <<
", t = " <<
t;
602 bool study_hadsyst = (is_qel || is_res || is_dis || is_coh || is_dfr || is_mec || is_singlek);
605 TObjArrayIter piter(&
event);
614 LOG(
"gntpc",
pDEBUG) <<
"Extracting final state hadronic system";
617 while( (p = (
GHepParticle *) piter.Next()) && study_hadsyst)
622 if(
event.Particle(ip)->FirstMother()==0)
continue;
631 if(
event.Particle(igmom)->Pdg() !=
kPdgPi0) { final_had_syst.push_back(ip); }
634 final_had_syst.push_back(ip);
640 int fd_pdgc =
event.Particle(ifd)->Pdg();
643 final_had_syst.push_back(ip);
648 if(
count(final_had_syst.begin(), final_had_syst.end(), -1) > 0) {
661 LOG(
"gntpc",
pDEBUG) <<
"Extracting primary hadronic system";
664 TObjArrayIter piter_prim(&
event);
671 for( ; hiter != final_had_syst.end(); ++hiter) {
672 prim_had_syst.push_back(*hiter);
682 int ist_comp = p->
Status();
689 prim_had_syst.push_back(ip);
696 int ist_comp = p->
Status();
702 prim_had_syst.push_back(ip);
709 int ist_comp = p->
Status();
716 prim_had_syst.push_back(ip);
723 int ist_comp = p->
Status();
730 prim_had_syst.push_back(ip);
754 if(
count(prim_had_syst.begin(), prim_had_syst.end(), -1) > 0) {
763 brNeutrino = (neutrino) ? neutrino->
Pdg() : 0;
764 brFSPrimLept = (fsl) ? fsl->
Pdg() : 0;
765 brTarget = target->
Pdg();
768 brHitNuc = (hitnucl) ? hitnucl->
Pdg() : 0;
778 brIsSingleK = is_singlek;
784 brIsCharmPro = charm;
796 brEvRF = k1_rf.Energy();
801 brEn = (hitnucl) ? p1.Energy() : 0;
802 brPxn = (hitnucl) ? p1.Px() : 0;
803 brPyn = (hitnucl) ? p1.Py() : 0;
804 brPzn = (hitnucl) ? p1.Pz() : 0;
810 brCosthl = TMath::Cos( k2.Vect().Angle(k1.Vect()) );
823 brNi = prim_had_syst.
size();
824 for(
int j=0; j<brNi; j++) {
825 p =
event.Particle(prim_had_syst[j]);
827 brPdgi[j] = p->
Pdg();
846 <<
"Counting in primary hadronic system: idx = " << prim_had_syst[j]
847 <<
" -> " << p->
Name();
852 <<
", N(n):" << brNiN
853 <<
", N(pi+):" << brNiPip
854 <<
", N(pi-):" << brNiPim
855 <<
", N(pi0):" << brNiPi0
856 <<
", N(K+,K-,K0):" << brNiKp+brNiKm+brNiK0
857 <<
", N(gamma,e-,e+):" << brNiEM
858 <<
", N(etc):" << brNiOther <<
"\n";
872 brSumKEf = (fsl) ? fsl->
KinE() : 0;
875 brNf = final_had_syst.
size();
876 for(
int j=0; j<brNf; j++) {
877 p =
event.Particle(final_had_syst[j]);
882 double hKE = p->
KinE();
883 double hpx = p->
Px();
884 double hpy = p->
Py();
885 double hpz = p->
Pz();
886 double hp = TMath::Sqrt(hpx*hpx + hpy*hpy + hpz*hpz);
887 double hm = p->
Mass();
888 double hcth = TMath::Cos( p->
P4()->Vect().Angle(k1.Vect()) );
900 if ( hpdg ==
kPdgProton ) { brNfP++; brCalResp0 += hKE; }
901 else if ( hpdg ==
kPdgAntiProton ) { brNfP++; brCalResp0 += (hE + 2*hm);}
902 else if ( hpdg ==
kPdgNeutron ) { brNfN++; brCalResp0 += hKE; }
903 else if ( hpdg ==
kPdgAntiNeutron ) { brNfN++; brCalResp0 += (hE + 2*hm);}
904 else if ( hpdg ==
kPdgPiP ) { brNfPip++; brCalResp0 += hKE; }
905 else if ( hpdg ==
kPdgPiM ) { brNfPim++; brCalResp0 += hKE; }
906 else if ( hpdg ==
kPdgPi0 ) { brNfPi0++; brCalResp0 += (e_h * hE); }
907 else if ( hpdg ==
kPdgKP ) { brNfKp++; brCalResp0 += hKE; }
908 else if ( hpdg ==
kPdgKM ) { brNfKm++; brCalResp0 += hKE; }
909 else if ( hpdg ==
kPdgK0 ) { brNfK0++; brCalResp0 += hKE; }
910 else if ( hpdg ==
kPdgAntiK0 ) { brNfK0++; brCalResp0 += hKE; }
911 else if ( hpdg ==
kPdgGamma ) { brNfEM++; brCalResp0 += (e_h * hE); }
912 else if ( hpdg ==
kPdgElectron ) { brNfEM++; brCalResp0 += (e_h * hE); }
913 else if ( hpdg ==
kPdgPositron ) { brNfEM++; brCalResp0 += (e_h * hE); }
914 else { brNfOther++; brCalResp0 += hKE; }
917 <<
"Counting in f/s system from hadronic vtx: idx = " << final_had_syst[j]
918 <<
" -> " << p->
Name();
923 <<
", N(n):" << brNfN
924 <<
", N(pi+):" << brNfPip
925 <<
", N(pi-):" << brNfPim
926 <<
", N(pi0):" << brNfPi0
927 <<
", N(K+,K-,K0):" << brNfKp+brNfKm+brNfK0
928 <<
", N(gamma,e-,e+):" << brNfEM
929 <<
", N(etc):" << brNfOther <<
"\n";
945 TFolder * genv = (TFolder*) fin.Get(
"genv");
946 TFolder * gconfig = (TFolder*) fin.Get(
"gconfig");
948 genv ->
Write(
"genv");
949 gconfig ->
Write(
"gconfig");
966 tree = dynamic_cast <TTree *> ( fin.Get(
"gtree") );
969 LOG(
"gntpc",
pINFO) <<
"Input tree header: " << *thdr;
973 tree->SetBranchAddress(
"gmcrec", &mcrec);
979 output <<
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
981 output <<
"<!-- generated by GENIE gntpc utility -->";
982 output << endl <<
endl;
983 output <<
"<genie_event_list version=\"1.00\">" <<
endl;
986 Long64_t nmax = (
gOptN<0) ?
987 tree->GetEntries() : TMath::Min(tree->GetEntries(),
gOptN);
989 LOG(
"gntpc",
pERROR) <<
"Number of events = 0";
992 LOG(
"gntpc",
pNOTICE) <<
"*** Analyzing: " << nmax <<
" events";
995 for(Long64_t iev = 0; iev < nmax; iev++) {
1007 output << endl <<
endl;
1008 output <<
" <!-- GENIE GHEP event -->" <<
endl;
1009 output <<
" <ghep np=\"" <<
event.GetEntries()
1010 <<
"\" unphysical=\"" 1011 << (
event.IsUnphysical() ?
"true" :
"false") <<
"\">" << endl;
1012 output << setiosflags(ios::scientific);
1016 output <<
" <!-- event weight -->";
1017 output <<
" <wgt> " <<
event.Weight() <<
" </wgt>";
1020 output <<
" <!-- cross sections -->";
1021 output <<
" <xsec_evnt> " <<
event.XSec() <<
" </xsec_evnt>";
1022 output <<
" <xsec_kine> " <<
event.DiffXSec() <<
" </xsec_kine>";
1025 output <<
" <!-- event vertex -->";
1026 output <<
" <vx> " <<
event.Vertex()->X() <<
" </vx>";
1027 output <<
" <vy> " <<
event.Vertex()->Y() <<
" </vy>";
1028 output <<
" <vz> " <<
event.Vertex()->Z() <<
" </vz>";
1029 output <<
" <vt> " <<
event.Vertex()->T() <<
" </vt>";
1033 output <<
" <!-- particle list -->" <<
endl;
1036 TIter event_iter(&
event);
1037 while ( (p = dynamic_cast<GHepParticle *>(event_iter.Next())) ) {
1043 output <<
" <p idx=\"" << i <<
"\" type=\"" << type <<
"\">" <<
endl;
1045 output <<
" <pdg> " << p->
Pdg() <<
" </pdg>";
1046 output <<
" <ist> " << p->
Status() <<
" </ist>";
1049 output <<
" <mother> " 1055 output <<
" <daughter> " 1061 output <<
" <px> " <<
setfill(
' ') <<
setw(20) << p->
Px() <<
" </px>";
1062 output <<
" <py> " <<
setfill(
' ') <<
setw(20) << p->
Py() <<
" </py>";
1063 output <<
" <pz> " <<
setfill(
' ') <<
setw(20) << p->
Pz() <<
" </pz>";
1064 output <<
" <E> " <<
setfill(
' ') <<
setw(20) << p->
E() <<
" </E> ";
1067 output <<
" <x> " <<
setfill(
' ') <<
setw(20) << p->
Vx() <<
" </x> ";
1068 output <<
" <y> " <<
setfill(
' ') <<
setw(20) << p->
Vy() <<
" </y> ";
1069 output <<
" <z> " <<
setfill(
' ') <<
setw(20) << p->
Vz() <<
" </z> ";
1070 output <<
" <t> " <<
setfill(
' ') <<
setw(20) << p->
Vt() <<
" </t> ";
1082 output <<
" <rescatter> " << p->
RescatterCode() <<
" </rescatter>";
1086 output <<
" </p>" <<
endl;
1089 output <<
" </ghep>" <<
endl;
1095 output << endl <<
endl;
1096 output <<
"<genie_event_list version=\"1.00\">";
1101 LOG(
"gntpc",
pINFO) <<
"\nDone converting GENIE's GHEP ntuple";
1112 tree = dynamic_cast <TTree *> ( fin.Get(
"gtree") );
1115 LOG(
"gntpc",
pINFO) <<
"Input tree header: " << *thdr;
1119 tree->SetBranchAddress(
"gmcrec", &mcrec);
1122 Long64_t nmax = (
gOptN<0) ?
1123 tree->GetEntries() : TMath::Min(tree->GetEntries(),
gOptN);
1125 LOG(
"gntpc",
pERROR) <<
"Number of events = 0";
1128 LOG(
"gntpc",
pNOTICE) <<
"*** Analyzing: " << nmax <<
" events";
1136 for(Long64_t iev = 0; iev < nmax; iev++) {
1137 tree->GetEntry(iev);
1147 stripped_event -> AttachSummary (nullint);
1148 stripped_event -> SetWeight (
event.Weight());
1149 stripped_event -> SetVertex (*
event.Vertex());
1154 if(
nullptr == p)
continue;
1158 p->Pdg(), ist, -1,-1,-1,-1, *p->P4(), *p->X4());
1173 LOG(
"gntpc",
pINFO) <<
"\nDone converting GENIE's GHEP ntuple";
1184 tree = dynamic_cast <TTree *> ( fin.Get(
"gtree") );
1187 LOG(
"gntpc",
pINFO) <<
"Input tree header: " << *thdr;
1195 tree->SetBranchAddress(
"gmcrec", &mcrec);
1197 #ifdef __GENIE_FLUX_DRIVERS_ENABLED__ 1199 tree->SetBranchAddress(
"flux", &flux_info);
1202 <<
"\n Flux drivers are not enabled." 1203 <<
"\n No flux pass-through information will be written-out in the rootracker file" 1204 <<
"\n If this isn't what you are supposed to be doing then build GENIE by adding " 1205 <<
"--with-flux-drivers in the configuration step.";
1212 Long64_t nmax = (
gOptN<0) ?
1213 tree->GetEntries() : TMath::Min(tree->GetEntries(),
gOptN);
1215 LOG(
"gntpc",
pERROR) <<
"Number of events = 0";
1218 LOG(
"gntpc",
pNOTICE) <<
"*** Analyzing: " << nmax <<
" events";
1221 for(Long64_t iev = 0; iev < nmax; iev++) {
1222 tree->GetEntry(iev);
1231 TIter event_iter(&
event);
1248 LOG(
"gntpc",
pNOTICE) <<
"NEUT-like event type = " << evtype;
1255 LOG(
"gntpc",
pNOTICE) <<
"NUANCE-like event type = " << evtype;
1268 <<
event.Vertex()->X() <<
" " 1269 <<
event.Vertex()->Y() <<
" " 1270 <<
event.Vertex()->Z() <<
" " 1271 <<
event.Vertex()->T() <<
endl;
1283 while ( (p = dynamic_cast<GHepParticle *>(event_iter.Next())) )
1287 int ghep_pdgc = p->
Pdg();
1300 bool is_pi0_dec =
false;
1305 for(
int jd = ghep_fd; jd <= ghep_ld; jd++) {
1307 pi0dv.push_back(
event.Particle(jd)->Pdg());
1310 sort(pi0dv.begin(), pi0dv.end());
1317 int ghep_fmpdgc = (ghep_fm==-1) ? 0 :
event.Particle(ghep_fm)->Pdg();
1333 tracks.push_back(iparticle);
1340 for(
int iloop=0; iloop<=1; iloop++)
1345 p =
event.Particle(iparticle);
1347 int ghep_pdgc = p->
Pdg();
1353 if(iloop==0 && fs)
continue;
1354 if(iloop==1 && !fs)
continue;
1369 default: ist = -999;
break;
1375 int pdgc = ghep_pdgc;
1387 double R = rnd->
RndGen().Rndm();
1393 TLorentzVector * p4 = p->
P4();
1400 double dcosx = (P>0) ? Px/P : -999;
1401 double dcosy = (P>0) ? Py/P : -999;
1402 double dcosz = (P>0) ? Pz/P : -999;
1418 <<
"Adding $track corrsponding to GHEP particle at position: " << iparticle
1419 <<
" (tracker status code: " << ist <<
")";
1421 output <<
"$ track " << pdgc <<
" " << E <<
" " 1422 << dcosx <<
" " << dcosy <<
" " << dcosz <<
" " 1495 <<
event.Weight() <<
" " 1496 <<
event.Probability()
1498 output <<
"$ info " <<
event.Vertex()->X() <<
" " 1499 <<
event.Vertex()->Y() <<
" " 1500 <<
event.Vertex()->Z() <<
" " 1501 <<
event.Vertex()->T()
1510 quark_id = 10 * quark_pdg + sorv;
1520 output <<
"$ info " <<
event.GetEntries() <<
endl;
1521 while ( (p = dynamic_cast<GHepParticle *>(event_iter.Next())) )
1529 << p->
X4()->X() <<
" " << p->
X4()->Y() <<
" " << p->
X4()->Z() <<
" " << p->
X4()->T() <<
" " 1530 << p->
P4()->Px() <<
" " << p->
P4()->Py() <<
" " << p->
P4()->Pz() <<
" " << p->
P4()->E() <<
" ";
1541 int rescat_code = -1;
1542 bool have_rescat_code =
false;
1544 if(gFileMinorVrs >= 5) {
1545 if(gFileRevisVrs >= 1) {
1546 have_rescat_code =
true;
1550 if(have_rescat_code) {
1626 LOG(
"gntpc",
pINFO) <<
"\nDone converting GENIE's GHEP ntuple";
1637 TBits* brEvtFlags = 0;
1638 TObjString* brEvtCode = 0;
1647 int brStdHepPdg [
kNPmax];
1648 int brStdHepStatus[
kNPmax];
1649 int brStdHepRescat[
kNPmax];
1650 double brStdHepX4 [
kNPmax][4];
1651 double brStdHepP4 [
kNPmax][4];
1652 double brStdHepPolz [
kNPmax][3];
1661 TObjString* brNuFileName = 0;
1666 int brNuParentDecMode;
1667 double brNuParentDecP4 [4];
1668 double brNuParentDecX4 [4];
1669 double brNuParentProP4 [4];
1670 double brNuParentProX4 [4];
1671 int brNuParentProNVtx;
1722 int brNumiFluxEvtno;
1723 double brNumiFluxNdxdz;
1724 double brNumiFluxNdydz;
1725 double brNumiFluxNpz;
1726 double brNumiFluxNenergy;
1727 double brNumiFluxNdxdznea;
1728 double brNumiFluxNdydznea;
1729 double brNumiFluxNenergyn;
1730 double brNumiFluxNwtnear;
1731 double brNumiFluxNdxdzfar;
1732 double brNumiFluxNdydzfar;
1733 double brNumiFluxNenergyf;
1734 double brNumiFluxNwtfar;
1735 int brNumiFluxNorig;
1736 int brNumiFluxNdecay;
1751 int brNumiFluxNtype;
1752 double brNumiFluxVx;
1753 double brNumiFluxVy;
1754 double brNumiFluxVz;
1755 double brNumiFluxPdpx;
1756 double brNumiFluxPdpy;
1757 double brNumiFluxPdpz;
1758 double brNumiFluxPpdxdz;
1759 double brNumiFluxPpdydz;
1760 double brNumiFluxPppz;
1761 double brNumiFluxPpenergy;
1762 int brNumiFluxPpmedium;
1763 int brNumiFluxPtype;
1764 double brNumiFluxPpvx;
1765 double brNumiFluxPpvy;
1766 double brNumiFluxPpvz;
1767 double brNumiFluxMuparpx;
1768 double brNumiFluxMuparpy;
1769 double brNumiFluxMuparpz;
1770 double brNumiFluxMupare;
1771 double brNumiFluxNecm;
1772 double brNumiFluxNimpwt;
1773 double brNumiFluxXpoint;
1774 double brNumiFluxYpoint;
1775 double brNumiFluxZpoint;
1776 double brNumiFluxTvx;
1777 double brNumiFluxTvy;
1778 double brNumiFluxTvz;
1779 double brNumiFluxTpx;
1780 double brNumiFluxTpy;
1781 double brNumiFluxTpz;
1782 double brNumiFluxTptype;
1783 double brNumiFluxTgen;
1787 double brNumiFluxTgptype;
1788 double brNumiFluxTgppx;
1790 double brNumiFluxTgppy;
1792 double brNumiFluxTgppz;
1794 double brNumiFluxTprivx;
1795 double brNumiFluxTprivy;
1796 double brNumiFluxTprivz;
1797 double brNumiFluxBeamx;
1798 double brNumiFluxBeamy;
1799 double brNumiFluxBeamz;
1800 double brNumiFluxBeampx;
1801 double brNumiFluxBeampy;
1802 double brNumiFluxBeampz;
1808 TTree * rootracker_tree =
new TTree(
"gRooTracker",
"GENIE event tree rootracker format");
1818 rootracker_tree->Branch(
"EvtFlags",
"TBits", &brEvtFlags, 32000, 1);
1819 rootracker_tree->Branch(
"EvtCode",
"TObjString", &brEvtCode, 32000, 1);
1820 rootracker_tree->Branch(
"EvtNum", &brEvtNum,
"EvtNum/I");
1821 rootracker_tree->Branch(
"EvtXSec", &brEvtXSec,
"EvtXSec/D");
1822 rootracker_tree->Branch(
"EvtDXSec", &brEvtDXSec,
"EvtDXSec/D");
1823 rootracker_tree->Branch(
"EvtWght", &brEvtWght,
"EvtWght/D");
1824 rootracker_tree->Branch(
"EvtProb", &brEvtProb,
"EvtProb/D");
1825 rootracker_tree->Branch(
"EvtVtx", brEvtVtx,
"EvtVtx[4]/D");
1826 rootracker_tree->Branch(
"StdHepN", &brStdHepN,
"StdHepN/I");
1827 rootracker_tree->Branch(
"StdHepPdg", brStdHepPdg,
"StdHepPdg[StdHepN]/I");
1828 rootracker_tree->Branch(
"StdHepStatus", brStdHepStatus,
"StdHepStatus[StdHepN]/I");
1829 rootracker_tree->Branch(
"StdHepRescat", brStdHepRescat,
"StdHepRescat[StdHepN]/I");
1830 rootracker_tree->Branch(
"StdHepX4", brStdHepX4,
"StdHepX4[StdHepN][4]/D");
1831 rootracker_tree->Branch(
"StdHepP4", brStdHepP4,
"StdHepP4[StdHepN][4]/D");
1832 rootracker_tree->Branch(
"StdHepPolz", brStdHepPolz,
"StdHepPolz[StdHepN][3]/D");
1833 rootracker_tree->Branch(
"StdHepFd", brStdHepFd,
"StdHepFd[StdHepN]/I");
1834 rootracker_tree->Branch(
"StdHepLd", brStdHepLd,
"StdHepLd[StdHepN]/I");
1835 rootracker_tree->Branch(
"StdHepFm", brStdHepFm,
"StdHepFm[StdHepN]/I");
1836 rootracker_tree->Branch(
"StdHepLm", brStdHepLm,
"StdHepLm[StdHepN]/I");
1839 rootracker_tree->Branch(
"EvtNum", &brEvtNum,
"EvtNum/I");
1840 rootracker_tree->Branch(
"EvtWght", &brEvtWght,
"EvtWght/D");
1841 rootracker_tree->Branch(
"EvtVtx", brEvtVtx,
"EvtVtx[4]/D");
1842 rootracker_tree->Branch(
"StdHepN", &brStdHepN,
"StdHepN/I");
1843 rootracker_tree->Branch(
"StdHepPdg", brStdHepPdg,
"StdHepPdg[StdHepN]/I");
1844 rootracker_tree->Branch(
"StdHepX4", brStdHepX4,
"StdHepX4[StdHepN][4]/D");
1845 rootracker_tree->Branch(
"StdHepP4", brStdHepP4,
"StdHepP4[StdHepN][4]/D");
1852 rootracker_tree->Branch(
"G2NeutEvtCode", &brNeutCode,
"G2NeutEvtCode/I");
1854 rootracker_tree->Branch(
"NuFileName",
"TObjString", &brNuFileName, 32000, 1);
1855 rootracker_tree->Branch(
"NuParentPdg", &brNuParentPdg,
"NuParentPdg/I");
1856 rootracker_tree->Branch(
"NuParentDecMode", &brNuParentDecMode,
"NuParentDecMode/I");
1857 rootracker_tree->Branch(
"NuParentDecP4", brNuParentDecP4,
"NuParentDecP4[4]/D");
1858 rootracker_tree->Branch(
"NuParentDecX4", brNuParentDecX4,
"NuParentDecX4[4]/D");
1859 rootracker_tree->Branch(
"NuParentProP4", brNuParentProP4,
"NuParentProP4[4]/D");
1860 rootracker_tree->Branch(
"NuParentProX4", brNuParentProX4,
"NuParentProX4[4]/D");
1861 rootracker_tree->Branch(
"NuParentProNVtx", &brNuParentProNVtx,
"NuParentProNVtx/I");
1863 rootracker_tree->Branch(
"NuFluxEntry", &brNuFluxEntry,
"NuFluxEntry/L");
1864 rootracker_tree->Branch(
"NuIdfd", &brNuIdfd,
"NuIdfd/I");
1865 rootracker_tree->Branch(
"NuCospibm", &brNuCospibm,
"NuCospibm/F");
1866 rootracker_tree->Branch(
"NuCospi0bm", &brNuCospi0bm,
"NuCospi0bm/F");
1867 rootracker_tree->Branch(
"NuGipart", &brNuGipart,
"NuGipart/I");
1868 rootracker_tree->Branch(
"NuGpos0", brNuGpos0,
"NuGpos0[3]/F");
1869 rootracker_tree->Branch(
"NuGvec0", brNuGvec0,
"NuGvec0[3]/F");
1870 rootracker_tree->Branch(
"NuGamom0", &brNuGamom0,
"NuGamom0/F");
1872 rootracker_tree->Branch(
"NuXnu", brNuXnu,
"NuXnu[2]/F");
1873 rootracker_tree->Branch(
"NuRnu", &brNuRnu,
"NuRnu/F");
1874 rootracker_tree->Branch(
"NuNg", &brNuNg,
"NuNg/I");
1875 rootracker_tree->Branch(
"NuGpid", brNuGpid,
"NuGpid[NuNg]/I");
1876 rootracker_tree->Branch(
"NuGmec", brNuGmec,
"NuGmec[NuNg]/I");
1877 rootracker_tree->Branch(
"NuGv", brNuGv,
"NuGv[NuNg][3]/F");
1878 rootracker_tree->Branch(
"NuGp", brNuGp,
"NuGp[NuNg][3]/F");
1879 rootracker_tree->Branch(
"NuGcosbm", brNuGcosbm,
"NuGcosbm[NuNg]/F");
1880 rootracker_tree->Branch(
"NuGmat", brNuGmat,
"NuGmat[NuNg]/I");
1881 rootracker_tree->Branch(
"NuGdistc", brNuGdistc,
"NuGdistc[NuNg]/F");
1882 rootracker_tree->Branch(
"NuGdistal", brNuGdistal,
"NuGdistal[NuNg]/F");
1883 rootracker_tree->Branch(
"NuGdistti", brNuGdistti,
"NuGdistti[NuNg]/F");
1884 rootracker_tree->Branch(
"NuGdistfe", brNuGdistfe,
"NuGdistfe[NuNg]/F");
1885 rootracker_tree->Branch(
"NuNorm", &brNuNorm,
"NuNorm/F");
1886 rootracker_tree->Branch(
"NuEnusk", &brNuEnusk,
"NuEnusk/F");
1887 rootracker_tree->Branch(
"NuNormsk", &brNuNormsk,
"NuNormsk/F");
1888 rootracker_tree->Branch(
"NuAnorm", &brNuAnorm,
"NuAnorm/F");
1889 rootracker_tree->Branch(
"NuVersion", &brNuVersion,
"NuVersion/F");
1890 rootracker_tree->Branch(
"NuNtrig", &brNuNtrig,
"NuNtrig/I");
1891 rootracker_tree->Branch(
"NuTuneid", &brNuTuneid,
"NuTuneid/I");
1892 rootracker_tree->Branch(
"NuPint", &brNuPint,
"NuPint/I");
1893 rootracker_tree->Branch(
"NuBpos", brNuBpos,
"NuBpos[2]/F");
1894 rootracker_tree->Branch(
"NuBtilt", brNuBtilt,
"NuBtilt[2]/F");
1895 rootracker_tree->Branch(
"NuBrms", brNuBrms,
"NuBrms[2]/F");
1896 rootracker_tree->Branch(
"NuEmit", brNuEmit,
"NuEmit[2]/F");
1897 rootracker_tree->Branch(
"NuAlpha", brNuAlpha,
"NuAlpha[2]/F");
1898 rootracker_tree->Branch(
"NuHcur", brNuHcur,
"NuHcur[3]/F");
1899 rootracker_tree->Branch(
"NuRand", &brNuRand,
"NuRand/I");
1907 rootracker_tree->Branch(
"NumiFluxRun", &brNumiFluxRun,
"NumiFluxRun/I");
1908 rootracker_tree->Branch(
"NumiFluxEvtno", &brNumiFluxEvtno,
"NumiFluxEvtno/I");
1909 rootracker_tree->Branch(
"NumiFluxNdxdz", &brNumiFluxNdxdz,
"NumiFluxNdxdz/D");
1910 rootracker_tree->Branch(
"NumiFluxNdydz", &brNumiFluxNdydz,
"NumiFluxNdydz/D");
1911 rootracker_tree->Branch(
"NumiFluxNpz", &brNumiFluxNpz,
"NumiFluxNpz/D");
1912 rootracker_tree->Branch(
"NumiFluxNenergy", &brNumiFluxNenergy,
"NumiFluxNenergy/D");
1913 rootracker_tree->Branch(
"NumiFluxNdxdznea", &brNumiFluxNdxdznea,
"NumiFluxNdxdznea/D");
1914 rootracker_tree->Branch(
"NumiFluxNdydznea", &brNumiFluxNdydznea,
"NumiFluxNdydznea/D");
1915 rootracker_tree->Branch(
"NumiFluxNenergyn", &brNumiFluxNenergyn,
"NumiFluxNenergyn/D");
1916 rootracker_tree->Branch(
"NumiFluxNwtnear", &brNumiFluxNwtnear,
"NumiFluxNwtnear/D");
1917 rootracker_tree->Branch(
"NumiFluxNdxdzfar", &brNumiFluxNdxdzfar,
"NumiFluxNdxdzfar/D");
1918 rootracker_tree->Branch(
"NumiFluxNdydzfar", &brNumiFluxNdydzfar,
"NumiFluxNdydzfar/D");
1919 rootracker_tree->Branch(
"NumiFluxNenergyf", &brNumiFluxNenergyf,
"NumiFluxNenergyf/D");
1920 rootracker_tree->Branch(
"NumiFluxNwtfar", &brNumiFluxNwtfar,
"NumiFluxNwtfar/D");
1921 rootracker_tree->Branch(
"NumiFluxNorig", &brNumiFluxNorig,
"NumiFluxNorig/I");
1922 rootracker_tree->Branch(
"NumiFluxNdecay", &brNumiFluxNdecay,
"NumiFluxNdecay/I");
1923 rootracker_tree->Branch(
"NumiFluxNtype", &brNumiFluxNtype,
"NumiFluxNtype/I");
1924 rootracker_tree->Branch(
"NumiFluxVx", &brNumiFluxVx,
"NumiFluxVx/D");
1925 rootracker_tree->Branch(
"NumiFluxVy", &brNumiFluxVy,
"NumiFluxVy/D");
1926 rootracker_tree->Branch(
"NumiFluxVz", &brNumiFluxVz,
"NumiFluxVz/D");
1927 rootracker_tree->Branch(
"NumiFluxPdpx", &brNumiFluxPdpx,
"NumiFluxPdpx/D");
1928 rootracker_tree->Branch(
"NumiFluxPdpy", &brNumiFluxPdpy,
"NumiFluxPdpy/D");
1929 rootracker_tree->Branch(
"NumiFluxPdpz", &brNumiFluxPdpz,
"NumiFluxPdpz/D");
1930 rootracker_tree->Branch(
"NumiFluxPpdxdz", &brNumiFluxPpdxdz,
"NumiFluxPpdxdz/D");
1931 rootracker_tree->Branch(
"NumiFluxPpdydz", &brNumiFluxPpdydz,
"NumiFluxPpdydz/D");
1932 rootracker_tree->Branch(
"NumiFluxPppz", &brNumiFluxPppz,
"NumiFluxPppz/D");
1933 rootracker_tree->Branch(
"NumiFluxPpenergy", &brNumiFluxPpenergy,
"NumiFluxPpenergy/D");
1934 rootracker_tree->Branch(
"NumiFluxPpmedium", &brNumiFluxPpmedium,
"NumiFluxPpmedium/I");
1935 rootracker_tree->Branch(
"NumiFluxPtype", &brNumiFluxPtype,
"NumiFluxPtype/I");
1936 rootracker_tree->Branch(
"NumiFluxPpvx", &brNumiFluxPpvx,
"NumiFluxPpvx/D");
1937 rootracker_tree->Branch(
"NumiFluxPpvy", &brNumiFluxPpvy,
"NumiFluxPpvy/D");
1938 rootracker_tree->Branch(
"NumiFluxPpvz", &brNumiFluxPpvz,
"NumiFluxPpvz/D");
1939 rootracker_tree->Branch(
"NumiFluxMuparpx", &brNumiFluxMuparpx,
"NumiFluxMuparpx/D");
1940 rootracker_tree->Branch(
"NumiFluxMuparpy", &brNumiFluxMuparpy,
"NumiFluxMuparpy/D");
1941 rootracker_tree->Branch(
"NumiFluxMuparpz", &brNumiFluxMuparpz,
"NumiFluxMuparpz/D");
1942 rootracker_tree->Branch(
"NumiFluxMupare", &brNumiFluxMupare,
"NumiFluxMupare/D");
1943 rootracker_tree->Branch(
"NumiFluxNecm", &brNumiFluxNecm,
"NumiFluxNecm/D");
1944 rootracker_tree->Branch(
"NumiFluxNimpwt", &brNumiFluxNimpwt,
"NumiFluxNimpwt/D");
1945 rootracker_tree->Branch(
"NumiFluxXpoint", &brNumiFluxXpoint,
"NumiFluxXpoint/D");
1946 rootracker_tree->Branch(
"NumiFluxYpoint", &brNumiFluxYpoint,
"NumiFluxYpoint/D");
1947 rootracker_tree->Branch(
"NumiFluxZpoint", &brNumiFluxZpoint,
"NumiFluxZpoint/D");
1948 rootracker_tree->Branch(
"NumiFluxTvx", &brNumiFluxTvx,
"NumiFluxTvx/D");
1949 rootracker_tree->Branch(
"NumiFluxTvy", &brNumiFluxTvy,
"NumiFluxTvy/D");
1950 rootracker_tree->Branch(
"NumiFluxTvz", &brNumiFluxTvz,
"NumiFluxTvz/D");
1951 rootracker_tree->Branch(
"NumiFluxTpx", &brNumiFluxTpx,
"NumiFluxTpx/D");
1952 rootracker_tree->Branch(
"NumiFluxTpy", &brNumiFluxTpy,
"NumiFluxTpy/D");
1953 rootracker_tree->Branch(
"NumiFluxTpz", &brNumiFluxTpz,
"NumiFluxTpz/D");
1954 rootracker_tree->Branch(
"NumiFluxTptype", &brNumiFluxTptype,
"NumiFluxTptype/I");
1955 rootracker_tree->Branch(
"NumiFluxTgen", &brNumiFluxTgen,
"NumiFluxTgen/I");
1956 rootracker_tree->Branch(
"NumiFluxTgptype", &brNumiFluxTgptype,
"NumiFluxTgptype/I");
1957 rootracker_tree->Branch(
"NumiFluxTgppx", &brNumiFluxTgppx,
"NumiFluxTgppx/D");
1958 rootracker_tree->Branch(
"NumiFluxTgppy", &brNumiFluxTgppy,
"NumiFluxTgppy/D");
1959 rootracker_tree->Branch(
"NumiFluxTgppz", &brNumiFluxTgppz,
"NumiFluxTgppz/D");
1960 rootracker_tree->Branch(
"NumiFluxTprivx", &brNumiFluxTprivx,
"NumiFluxTprivx/D");
1961 rootracker_tree->Branch(
"NumiFluxTprivy", &brNumiFluxTprivy,
"NumiFluxTprivy/D");
1962 rootracker_tree->Branch(
"NumiFluxTprivz", &brNumiFluxTprivz,
"NumiFluxTprivz/D");
1963 rootracker_tree->Branch(
"NumiFluxBeamx", &brNumiFluxBeamx,
"NumiFluxBeamx/D");
1964 rootracker_tree->Branch(
"NumiFluxBeamy", &brNumiFluxBeamy,
"NumiFluxBeamy/D");
1965 rootracker_tree->Branch(
"NumiFluxBeamz", &brNumiFluxBeamz,
"NumiFluxBeamz/D");
1966 rootracker_tree->Branch(
"NumiFluxBeampx", &brNumiFluxBeampx,
"NumiFluxBeampx/D");
1967 rootracker_tree->Branch(
"NumiFluxBeampy", &brNumiFluxBeampy,
"NumiFluxBeampy/D");
1968 rootracker_tree->Branch(
"NumiFluxBeampz", &brNumiFluxBeampz,
"NumiFluxBeampz/D");
1975 gtree = dynamic_cast <TTree *> ( fin.Get(
"gtree") );
1978 LOG(
"gntpc",
pINFO) <<
"Input tree header: " << *thdr;
1982 gtree->SetBranchAddress(
"gmcrec", &mcrec);
1993 LOG(
"gntpc",
pINFO) <<
"Found T2KMetaData!";
1998 <<
"Could not find T2KMetaData attached to the event tree!";
2002 #ifdef __GENIE_FLUX_DRIVERS_ENABLED__ 2005 gtree->SetBranchAddress(
"flux", &jnubeam_flux_info);
2009 gtree->SetBranchAddress(
"flux", &gnumi_flux_info);
2013 <<
"\n Flux drivers are not enabled." 2014 <<
"\n No flux pass-through information will be written-out in the rootracker file" 2015 <<
"\n If this isn't what you are supposed to be doing then build GENIE by adding " 2016 <<
"--with-flux-drivers in the configuration step.";
2020 Long64_t nmax = (
gOptN<0) ?
2021 gtree->GetEntries() : TMath::Min(gtree->GetEntries(),
gOptN);
2023 LOG(
"gntpc",
pERROR) <<
"Number of events = 0";
2026 LOG(
"gntpc",
pNOTICE) <<
"*** Analyzing: " << nmax <<
" events";
2029 for(Long64_t iev = 0; iev < nmax; iev++) {
2030 gtree->GetEntry(iev);
2039 #ifdef __GENIE_FLUX_DRIVERS_ENABLED__ 2041 if(jnubeam_flux_info) {
2042 LOG(
"gntpc",
pINFO) << *jnubeam_flux_info;
2044 LOG(
"gntpc",
pINFO) <<
"No JNUBEAM flux info associated with this event";
2052 if(brEvtFlags)
delete brEvtFlags;
2054 if(brEvtCode)
delete brEvtCode;
2061 for(
int k=0;
k<4;
k++) {
2065 for(
int i=0; i<
kNPmax; i++) {
2066 brStdHepPdg [i] = 0;
2067 brStdHepStatus[i] = -1;
2068 brStdHepRescat[i] = -1;
2069 for(
int k=0;
k<4;
k++) {
2070 brStdHepX4 [i][
k] = 0;
2071 brStdHepP4 [i][
k] = 0;
2073 for(
int k=0;
k<3;
k++) {
2074 brStdHepPolz [i][
k] = 0;
2082 brNuParentDecMode = 0;
2083 for(
int k=0;
k<4;
k++) {
2084 brNuParentDecP4 [
k] = 0;
2085 brNuParentDecX4 [
k] = 0;
2086 brNuParentProP4 [
k] = 0;
2087 brNuParentProX4 [
k] = 0;
2089 brNuParentProNVtx = 0;
2093 brNuCospibm = -999999.;
2094 brNuCospi0bm = -999999.;
2096 brNuGamom0 = -999999.;
2097 for(
int k=0;
k< 3;
k++){
2098 brNuGvec0[
k] = -999999.;
2099 brNuGpos0[
k] = -999999.;
2102 for(
int k=0;
k<2;
k++) {
2103 brNuXnu[
k] = brNuBpos[
k] = brNuBtilt[
k] = brNuBrms[
k] = brNuEmit[
k] = brNuAlpha[
k] = -999999.;
2105 for(
int k=0;
k<3;
k++) brNuHcur[
k] = -999999.;
2107 for(
int k=0;
k<3;
k++){
2108 brNuGv[np][
k] = -999999.;
2109 brNuGp[np][
k] = -999999.;
2111 brNuGpid[np] = -999999;
2112 brNuGmec[np] = -999999;
2113 brNuGmat[np] = -999999;
2114 brNuGcosbm[np] = -999999.;
2115 brNuGdistc[np] = -999999.;
2116 brNuGdistal[np] = -999999.;
2117 brNuGdistti[np] = -999999.;
2118 brNuGdistfe[np] = -999999.;
2122 brNuNorm = -999999.;
2123 brNuEnusk = -999999.;
2124 brNuNormsk = -999999.;
2125 brNuAnorm = -999999.;
2126 brNuVersion= -999999.;
2127 brNuNtrig = -999999;
2128 brNuTuneid = -999999;
2131 if(brNuFileName)
delete brNuFileName;
2138 brEvtFlags =
new TBits(*
event.EventFlags());
2139 brEvtCode =
new TObjString(
event.Summary()->AsString().c_str());
2140 brEvtNum = (
int) iev;
2143 brEvtWght =
event.Weight();
2144 brEvtProb =
event.Probability();
2145 brEvtVtx[0] =
event.Vertex()->X();
2146 brEvtVtx[1] =
event.Vertex()->Y();
2147 brEvtVtx[2] =
event.Vertex()->Z();
2148 brEvtVtx[3] =
event.Vertex()->T();
2152 TIter event_iter(&
event);
2153 while ( (p = dynamic_cast<GHepParticle *>(event_iter.Next())) ) {
2157 if (iparticle == kNPmax){
2159 <<
"Event "<<brEvtNum
2160 <<
" has greater than kNPmax = "<< kNPmax
2161 <<
" number of particle entries in StdHep.";
2164 <<
"I will truncate the event to avoid" 2165 <<
" a static array overrun.";
2170 <<
"Dead in the H20!\n" 2171 <<
"Rerun with option -t to truncate these large events.\n" 2172 <<
"Or recompile to make static constant kNPmax larger.";
2181 brStdHepPdg [iparticle] = p->
Pdg();
2182 brStdHepStatus[iparticle] = (
int) p->
Status();
2184 brStdHepX4 [iparticle][0] = p->
X4()->X();
2185 brStdHepX4 [iparticle][1] = p->
X4()->Y();
2186 brStdHepX4 [iparticle][2] = p->
X4()->Z();
2187 brStdHepX4 [iparticle][3] = p->
X4()->T();
2188 brStdHepP4 [iparticle][0] = p->
P4()->Px();
2189 brStdHepP4 [iparticle][1] = p->
P4()->Py();
2190 brStdHepP4 [iparticle][2] = p->
P4()->Pz();
2191 brStdHepP4 [iparticle][3] = p->
P4()->E();
2205 brStdHepN = iparticle;
2215 #ifdef __GENIE_FLUX_DRIVERS_ENABLED__ 2220 if(jnubeam_flux_info) {
2222 brNuParentDecMode = jnubeam_flux_info->
mode;
2224 brNuParentDecP4 [0] = jnubeam_flux_info->
ppi * jnubeam_flux_info->
npi[0];
2225 brNuParentDecP4 [1] = jnubeam_flux_info->
ppi * jnubeam_flux_info->
npi[1];
2226 brNuParentDecP4 [2] = jnubeam_flux_info->
ppi * jnubeam_flux_info->
npi[2];
2227 brNuParentDecP4 [3] = TMath::Sqrt(
2228 TMath::Power(pdglib->
Find(brNuParentPdg)->Mass(), 2.)
2229 + TMath::Power(jnubeam_flux_info->
ppi, 2.)
2231 brNuParentDecX4 [0] = jnubeam_flux_info->
xpi[0];
2232 brNuParentDecX4 [1] = jnubeam_flux_info->
xpi[1];
2233 brNuParentDecX4 [2] = jnubeam_flux_info->
xpi[2];
2234 brNuParentDecX4 [3] = 0;
2236 brNuParentProP4 [0] = jnubeam_flux_info->
ppi0 * jnubeam_flux_info->
npi0[0];
2237 brNuParentProP4 [1] = jnubeam_flux_info->
ppi0 * jnubeam_flux_info->
npi0[1];
2238 brNuParentProP4 [2] = jnubeam_flux_info->
ppi0 * jnubeam_flux_info->
npi0[2];
2239 brNuParentProP4 [3] = TMath::Sqrt(
2240 TMath::Power(pdglib->
Find(brNuParentPdg)->Mass(), 2.)
2241 + TMath::Power(jnubeam_flux_info->
ppi0, 2.)
2243 brNuParentProX4 [0] = jnubeam_flux_info->
xpi0[0];
2244 brNuParentProX4 [1] = jnubeam_flux_info->
xpi0[1];
2245 brNuParentProX4 [2] = jnubeam_flux_info->
xpi0[2];
2246 brNuParentProX4 [3] = 0;
2248 brNuParentProNVtx = jnubeam_flux_info->
nvtx0;
2251 brNuFluxEntry = jnubeam_flux_info->
fluxentry;
2252 brNuIdfd = jnubeam_flux_info->
idfd;
2253 brNuCospibm = jnubeam_flux_info->
cospibm;
2254 brNuCospi0bm = jnubeam_flux_info->
cospi0bm;
2255 brNuGipart = jnubeam_flux_info->
gipart;
2256 brNuGamom0 = jnubeam_flux_info->
gamom0;
2257 for(
int k=0;
k<3;
k++){
2258 brNuGpos0[
k] = (double) jnubeam_flux_info->
gpos0[
k];
2259 brNuGvec0[
k] = (
double) jnubeam_flux_info->
gvec0[
k];
2262 brNuXnu[0] = (double) jnubeam_flux_info->
xnu;
2263 brNuXnu[1] = (
double) jnubeam_flux_info->
ynu;
2264 brNuRnu = (double) jnubeam_flux_info->
rnu;
2265 for(
int k=0;
k<2;
k++){
2266 brNuBpos[
k] = (double) jnubeam_flux_info->
bpos[
k];
2267 brNuBtilt[
k] = (
double) jnubeam_flux_info->
btilt[
k];
2268 brNuBrms[
k] = (double) jnubeam_flux_info->
brms[
k];
2269 brNuEmit[
k] = (
double) jnubeam_flux_info->
emit[
k];
2270 brNuAlpha[
k] = (double) jnubeam_flux_info->
alpha[
k];
2272 for(
int k=0;
k<3;
k++) brNuHcur[
k] = jnubeam_flux_info->
hcur[
k];
2273 for(
int np = 0; np < flux::fNgmax; np++){
2274 brNuGv[np][0] = jnubeam_flux_info->
gvx[np];
2275 brNuGv[np][1] = jnubeam_flux_info->
gvy[np];
2276 brNuGv[np][2] = jnubeam_flux_info->
gvz[np];
2277 brNuGp[np][0] = jnubeam_flux_info->
gpx[np];
2278 brNuGp[np][1] = jnubeam_flux_info->
gpy[np];
2279 brNuGp[np][2] = jnubeam_flux_info->
gpz[np];
2280 brNuGpid[np] = jnubeam_flux_info->
gpid[np];
2281 brNuGmec[np] = jnubeam_flux_info->
gmec[np];
2282 brNuGcosbm[np] = jnubeam_flux_info->
gcosbm[np];
2283 brNuGmat[np] = jnubeam_flux_info->
gmat[np];
2284 brNuGdistc[np] = jnubeam_flux_info->
gdistc[np];
2285 brNuGdistal[np] = jnubeam_flux_info->
gdistal[np];
2286 brNuGdistti[np] = jnubeam_flux_info->
gdistti[np];
2287 brNuGdistfe[np] = jnubeam_flux_info->
gdistfe[np];
2289 brNuNg = jnubeam_flux_info->
ng;
2290 brNuNorm = jnubeam_flux_info->
norm;
2291 brNuEnusk = jnubeam_flux_info->
Enusk;
2292 brNuNormsk = jnubeam_flux_info->
normsk;
2293 brNuAnorm = jnubeam_flux_info->
anorm;
2294 brNuVersion= jnubeam_flux_info->
version;
2295 brNuNtrig = jnubeam_flux_info->
ntrig;
2296 brNuTuneid = jnubeam_flux_info->
tuneid;
2297 brNuPint = jnubeam_flux_info->
pint;
2298 brNuRand = jnubeam_flux_info->
rand;
2299 brNuFileName =
new TObjString(jnubeam_flux_info->
fluxfilename.c_str());
2308 #ifdef __GENIE_FLUX_DRIVERS_ENABLED__ 2310 if(gnumi_flux_info) {
2311 brNumiFluxRun = gnumi_flux_info->
run;
2312 brNumiFluxEvtno = gnumi_flux_info->
evtno;
2313 brNumiFluxNdxdz = gnumi_flux_info->
ndxdz;
2314 brNumiFluxNdydz = gnumi_flux_info->
ndydz;
2315 brNumiFluxNpz = gnumi_flux_info->
npz;
2316 brNumiFluxNenergy = gnumi_flux_info->
nenergy;
2317 brNumiFluxNdxdznea = gnumi_flux_info->
ndxdznea;
2318 brNumiFluxNdydznea = gnumi_flux_info->
ndydznea;
2319 brNumiFluxNenergyn = gnumi_flux_info->
nenergyn;
2320 brNumiFluxNwtnear = gnumi_flux_info->
nwtnear;
2321 brNumiFluxNdxdzfar = gnumi_flux_info->
ndxdzfar;
2322 brNumiFluxNdydzfar = gnumi_flux_info->
ndydzfar;
2323 brNumiFluxNenergyf = gnumi_flux_info->
nenergyf;
2324 brNumiFluxNwtfar = gnumi_flux_info->
nwtfar;
2325 brNumiFluxNorig = gnumi_flux_info->
norig;
2326 brNumiFluxNdecay = gnumi_flux_info->
ndecay;
2327 brNumiFluxNtype = gnumi_flux_info->
ntype;
2328 brNumiFluxVx = gnumi_flux_info->
vx;
2329 brNumiFluxVy = gnumi_flux_info->
vy;
2330 brNumiFluxVz = gnumi_flux_info->
vz;
2331 brNumiFluxPdpx = gnumi_flux_info->
pdpx;
2332 brNumiFluxPdpy = gnumi_flux_info->
pdpy;
2333 brNumiFluxPdpz = gnumi_flux_info->
pdpz;
2334 brNumiFluxPpdxdz = gnumi_flux_info->
ppdxdz;
2335 brNumiFluxPpdydz = gnumi_flux_info->
ppdydz;
2336 brNumiFluxPppz = gnumi_flux_info->
pppz;
2337 brNumiFluxPpenergy = gnumi_flux_info->
ppenergy;
2338 brNumiFluxPpmedium = gnumi_flux_info->
ppmedium;
2339 brNumiFluxPtype = gnumi_flux_info->
ptype;
2340 brNumiFluxPpvx = gnumi_flux_info->
ppvx;
2341 brNumiFluxPpvy = gnumi_flux_info->
ppvy;
2342 brNumiFluxPpvz = gnumi_flux_info->
ppvz;
2343 brNumiFluxMuparpx = gnumi_flux_info->
muparpx;
2344 brNumiFluxMuparpy = gnumi_flux_info->
muparpy;
2345 brNumiFluxMuparpz = gnumi_flux_info->
muparpz;
2346 brNumiFluxMupare = gnumi_flux_info->
mupare;
2347 brNumiFluxNecm = gnumi_flux_info->
necm;
2348 brNumiFluxNimpwt = gnumi_flux_info->
nimpwt;
2349 brNumiFluxXpoint = gnumi_flux_info->
xpoint;
2350 brNumiFluxYpoint = gnumi_flux_info->
ypoint;
2351 brNumiFluxZpoint = gnumi_flux_info->
zpoint;
2352 brNumiFluxTvx = gnumi_flux_info->
tvx;
2353 brNumiFluxTvy = gnumi_flux_info->
tvy;
2354 brNumiFluxTvz = gnumi_flux_info->
tvz;
2355 brNumiFluxTpx = gnumi_flux_info->
tpx;
2356 brNumiFluxTpy = gnumi_flux_info->
tpy;
2357 brNumiFluxTpz = gnumi_flux_info->
tpz;
2358 brNumiFluxTptype = gnumi_flux_info->
tptype;
2359 brNumiFluxTgen = gnumi_flux_info->
tgen;
2360 brNumiFluxTgptype = gnumi_flux_info->
tgptype;
2361 brNumiFluxTgppx = gnumi_flux_info->
tgppx;
2362 brNumiFluxTgppy = gnumi_flux_info->
tgppy;
2363 brNumiFluxTgppz = gnumi_flux_info->
tgppz;
2364 brNumiFluxTprivx = gnumi_flux_info->
tprivx;
2365 brNumiFluxTprivy = gnumi_flux_info->
tprivy;
2366 brNumiFluxTprivz = gnumi_flux_info->
tprivz;
2367 brNumiFluxBeamx = gnumi_flux_info->
beamx;
2368 brNumiFluxBeamy = gnumi_flux_info->
beamy;
2369 brNumiFluxBeamz = gnumi_flux_info->
beamz;
2370 brNumiFluxBeampx = gnumi_flux_info->
beampx;
2371 brNumiFluxBeampy = gnumi_flux_info->
beampy;
2372 brNumiFluxBeampz = gnumi_flux_info->
beampz;
2378 rootracker_tree->Fill();
2384 double pot = gtree->GetWeight();
2385 rootracker_tree->SetWeight(pot);
2389 TFolder * genv = (TFolder*) fin.Get(
"genv");
2390 TFolder * gconfig = (TFolder*) fin.Get(
"gconfig");
2392 genv ->
Write(
"genv");
2393 gconfig ->
Write(
"gconfig");
2401 LOG(
"gntpc",
pINFO) <<
"\nDone converting GENIE's GHEP ntuple";
2424 tree = dynamic_cast <TTree *> ( fin.Get(
"gtree") );
2427 LOG(
"gntpc",
pINFO) <<
"Input tree header: " << *thdr;
2431 tree->SetBranchAddress(
"gmcrec", &mcrec);
2438 TFile
fout(
"ghad.root",
"recreate");
2439 TTree * ghad =
new TTree(
"ghad",
"");
2440 ghad->Branch(
"i", &brIev,
"i/I " );
2441 ghad->Branch(
"W", &brW,
"W/D " );
2442 ghad->Branch(
"n", &brN,
"n/I " );
2443 ghad->Branch(
"pdg", brPdg,
"pdg[n]/I " );
2444 ghad->Branch(
"E", brE,
"E[n]/D" );
2445 ghad->Branch(
"px", brPx,
"px[n]/D" );
2446 ghad->Branch(
"py", brPy,
"py[n]/D" );
2447 ghad->Branch(
"pz", brPz,
"pz[n]/D" );
2451 Long64_t nmax = (
gOptN<0) ?
2452 tree->GetEntries() : TMath::Min(tree->GetEntries(),
gOptN);
2454 LOG(
"gntpc",
pERROR) <<
"Number of events = 0";
2457 LOG(
"gntpc",
pNOTICE) <<
"*** Analyzing: " << nmax <<
" events";
2460 for(Long64_t iev = 0; iev < nmax; iev++) {
2461 tree->GetEntry(iev);
2490 bool pass = is_cc && (is_dis || is_res);
2496 int ccnc = is_cc ? 1 : 0;
2500 if (init_state.
IsNuP ()) im = 1;
2501 else if (init_state.
IsNuN ()) im = 2;
2502 else if (init_state.
IsNuBarP ()) im = 3;
2503 else if (init_state.
IsNuBarN ()) im = 4;
2515 int nupdg = neutrino->
Pdg();
2516 int fslpdg = fsl->
Pdg();
2517 int A = target->
A();
2518 int Z = target->
Z();
2520 const TLorentzVector & k1 = *(neutrino->
P4());
2521 const TLorentzVector & k2 = *(fsl->
P4());
2527 GHepParticle * hadsyst =
event.FinalStateHadronicSystem();
2529 ph = *(hadsyst->
P4());
2533 ph = *(hadres->
P4());
2537 bool get_selected =
true;
2538 double x = kine.
x (get_selected);
2539 double y = kine.
y (get_selected);
2540 double W = kine.
W (get_selected);
2544 TIter event_iter(&
event);
2547 while ( (p = dynamic_cast<GHepParticle *>(event_iter.Next())) ) {
2551 if (pdg ==
kPdgString ) { hadmod=11; ihadmom=i; }
2552 if (pdg ==
kPdgCluster ) { hadmod=12; ihadmom=i; }
2553 if (pdg ==
kPdgIndep ) { hadmod=13; ihadmom=i; }
2558 << nupdg <<
"\t" << ccnc <<
"\t" << im <<
"\t" 2559 << A <<
"\t" << Z <<
endl;
2560 output << inttyp <<
"\t" << x <<
"\t" << y <<
"\t" << W <<
"\t" 2563 << k1.Px() <<
"\t" << k1.Py() <<
"\t" << k1.Pz() <<
"\t" 2564 << k1.Energy() <<
"\t" << k1.M() <<
endl;
2566 << k2.Px() <<
"\t" << k2.Py() <<
"\t" << k2.Pz() <<
"\t" 2567 << k2.Energy() <<
"\t" << k2.M() <<
endl;
2569 << ph.Px() <<
"\t" << ph.Py() <<
"\t" << ph.Pz() <<
"\t" 2570 << ph.Energy() <<
"\t" << ph.M() <<
endl;
2576 while ( (p = dynamic_cast<GHepParticle *>(event_iter.Next())) ) {
2578 if(i<ihadmom)
continue;
2588 int mom_pdg = mom->
Pdg();
2590 if(!skip) { hadv.push_back(i); }
2606 for( ; hiter != hadv.end(); ++hiter) {
2609 int pdg = particle->
Pdg();
2610 double px = particle->
P4()->Px();
2611 double py = particle->
P4()->Py();
2612 double pz = particle->
P4()->Pz();
2613 double E = particle->
P4()->Energy();
2614 double m = particle->
P4()->M();
2616 << px <<
"\t" << py <<
"\t" << pz <<
"\t" 2617 << E <<
"\t" << m <<
endl;
2641 ghad->Write(
"ghad");
2646 LOG(
"gntpc",
pINFO) <<
"\nDone converting GENIE's GHEP ntuple";
2689 TTree * tEvtTree =
new TTree(
"ginuke",
"GENIE INuke Summary Tree");
2694 tEvtTree->Branch(
"iev", &brIEv,
"iev/I" );
2695 tEvtTree->Branch(
"probe", &brProbe,
"probe/I" );
2696 tEvtTree->Branch(
"tgt" , &brTarget,
"tgt/I" );
2697 tEvtTree->Branch(
"ke", &brKE,
"ke/D" );
2698 tEvtTree->Branch(
"e", &brE,
"e/D" );
2699 tEvtTree->Branch(
"p", &brP,
"p/D" );
2700 tEvtTree->Branch(
"A", &brTgtA,
"A/I" );
2701 tEvtTree->Branch(
"Z", &brTgtZ,
"Z/I" );
2702 tEvtTree->Branch(
"vtxx", &brVtxX,
"vtxx/D" );
2703 tEvtTree->Branch(
"vtxy", &brVtxY,
"vtxy/D" );
2704 tEvtTree->Branch(
"vtxz", &brVtxZ,
"vtxz/D" );
2705 tEvtTree->Branch(
"probe_fsi", &brProbeFSI,
"probe_fsi/I" );
2706 tEvtTree->Branch(
"dist", &brDist,
"dist/D" );
2707 tEvtTree->Branch(
"nh", &brNh,
"nh/I" );
2708 tEvtTree->Branch(
"pdgh", brPdgh,
"pdgh[nh]/I " );
2709 tEvtTree->Branch(
"Eh", brEh,
"Eh[nh]/D" );
2710 tEvtTree->Branch(
"ph", brPh,
"ph[nh]/D" );
2711 tEvtTree->Branch(
"pxh", brPxh,
"pxh[nh]/D" );
2712 tEvtTree->Branch(
"pyh", brPyh,
"pyh[nh]/D" );
2713 tEvtTree->Branch(
"pzh", brPzh,
"pzh[nh]/D" );
2714 tEvtTree->Branch(
"cth", brCosth,
"cth[nh]/D" );
2715 tEvtTree->Branch(
"mh", brMh,
"mh[nh]/D" );
2716 tEvtTree->Branch(
"np", &brNp,
"np/I" );
2717 tEvtTree->Branch(
"nn", &brNn,
"nn/I" );
2718 tEvtTree->Branch(
"npip", &brNpip,
"npip/I" );
2719 tEvtTree->Branch(
"npim", &brNpim,
"npim/I" );
2720 tEvtTree->Branch(
"npi0", &brNpi0,
"npi0/I" );
2724 TTree * er_tree = 0;
2726 er_tree = dynamic_cast <TTree *> ( fin.Get(
"gtree") );
2729 LOG(
"gntpc",
pERROR) <<
"Null input tree";
2732 LOG(
"gntpc",
pINFO) <<
"Input tree header: " << *thdr;
2736 er_tree->SetBranchAddress(
"gmcrec", &mcrec);
2738 LOG(
"gntpc",
pERROR) <<
"Null MC record";
2743 Long64_t nmax = (
gOptN<0) ?
2744 er_tree->GetEntries() : TMath::Min( er_tree->GetEntries(),
gOptN );
2746 LOG(
"gntpc",
pERROR) <<
"Number of events = 0";
2749 LOG(
"gntpc",
pNOTICE) <<
"*** Analyzing: " << nmax <<
" events";
2751 for(Long64_t iev = 0; iev < nmax; iev++) {
2753 er_tree->GetEntry(iev);
2764 for(
int j=0; j<
kNPmax; j++) {
2779 assert(probe && target);
2781 brProbe = probe -> Pdg();
2782 brTarget = target -> Pdg();
2783 brKE = probe -> KinE();
2785 brP = probe -> P4()->Vect().Mag();
2788 brVtxX = probe -> Vx();
2789 brVtxY = probe -> Vy();
2790 brVtxZ = probe -> Vz();
2791 brProbeFSI = probe -> RescatterCode();
2793 assert(rescattered_hadron);
2798 double x = rescattered_hadron->
Vx();
2799 double y = rescattered_hadron->
Vy();
2800 double z = rescattered_hadron->
Vz();
2801 double d2 = TMath::Power(brVtxX-x,2) +
2802 TMath::Power(brVtxY-y,2) +
2803 TMath::Power(brVtxZ-z,2);
2804 brDist = TMath::Sqrt(d2);
2815 TIter event_iter(&
event);
2816 while ( (p = dynamic_cast<GHepParticle *>(event_iter.Next())) ) {
2820 brPdgh[i] = p->
Pdg();
2822 brPxh [i] = p->
Px();
2823 brPyh [i] = p->
Py();
2824 brPzh [i] = p->
Pz();
2826 TMath::Sqrt(brPxh[i]*brPxh[i]+brPyh[i]*brPyh[i]
2827 +brPzh[i]*brPzh[i]);
2828 brCosth[i] = brPzh[i]/brPh[i];
2829 brMh [i] = p->
Mass();
2842 int tempProbeFSI = brProbeFSI;
2843 brProbeFSI =
HAProbeFSI(tempProbeFSI, brProbe, brNh, brEh, brPdgh, brNpip, brNpim, brNpi0);
2859 LOG(
"gntpc",
pINFO) <<
"\nDone converting GENIE's GHEP ntuple";
2875 LOG(
"gntpc",
pINFO) <<
"Reading input filename";
2879 <<
"Unspecified input filename - Exiting";
2889 <<
"The input ROOT file [" 2897 LOG(
"gntpc",
pINFO) <<
"Reading output file format";
2914 LOG(
"gntpc",
pFATAL) <<
"Unknown output file format (" << fmt <<
")";
2920 LOG(
"gntpc",
pFATAL) <<
"Unspecified output file format";
2927 LOG(
"gntpc",
pINFO) <<
"Reading output filename";
2931 <<
"Unspecified output filename - Using default";
2937 LOG(
"gntpc",
pINFO) <<
"Reading number of events to analyze";
2941 <<
"Unspecified number of events to analyze - Use all";
2947 LOG(
"gntpc",
pINFO) <<
"Reading format version number";
2953 <<
"Unspecified version number - Use latest";
2964 LOG(
"gntpc",
pINFO) <<
"Reading random number seed";
2967 LOG(
"gntpc",
pINFO) <<
"Unspecified random number seed - Using default";
2978 LOG(
"gntpc",
pNOTICE) <<
"Number of events to be converted = " <<
gOptN;
3002 unsigned int L = inpname.length();
3006 if(inpname.substr(L-4, L).find(
"root") != string::npos) {
3007 inpname.erase(L-4, L);
3011 size_t pos = inpname.find(
"ghep.");
3012 if(pos != string::npos) {
3013 inpname.erase(pos, pos+4);
3017 name << inpname << ext;
3019 return gSystem->BaseName(name.str().c_str());
3044 <<
"\n\n"<<
"gntpc_dune\n" 3045 <<
"\nConverts a native GENIE (GHEP/ROOT) event tree file to a host of plain text, XML or bare-ROOT formats. This code is a lightly modified verison of GENIE gntpc but has specialized options and behavior for DUNE." 3048 <<
"\n gntpc_dune -i input_file [-o output_file] -f format [-n nev] [-v vrs] [-c] [-t]" 3049 <<
"\n [--seed random_number_seed]" 3050 <<
"\n [--message-thresholds xml_file]" 3051 <<
"\n [--event-record-print-level level]" 3054 <<
"\n [] denotes an optional argument" 3056 <<
"\n Number of events to convert" 3057 <<
"\n (optional, default: convert all events)" 3059 <<
"\n Output format version, if multiple versions are supported" 3060 <<
"\n (optional, default: use latest version of each format)" 3062 <<
"\n Copy MC job metadata (gconfig and genv TFolders)" 3063 <<
"\n from the input GHEP file." 3065 <<
"\n For RooTracker output, truncate events with more than kNPMax StdHep" 3066 <<
"\n entries. If this flag is set, the events are truncated but" 3067 <<
"\n still written to the output ntuple. If not set, an error is printed" 3068 <<
"\n and the run is ended." 3070 <<
"\n A string that specifies the output file format. " 3072 <<
"\n Generic formats:" 3075 <<
"\n The 'definite' GENIE summary tree format (gst)." 3077 <<
"\n GENIE XML event format" 3078 <<
"\n * `ghep_mock_data':" 3079 <<
"\n Output file has the same format as the input file (GHEP)but all" 3080 <<
"\n information other than final state particles is hidden" 3081 <<
"\n * `rootracker':" 3082 <<
"\n A bare-ROOT STDHEP-like GENIE event tree." 3083 <<
"\n * `rootracker_mock_data':" 3084 <<
"\n As the `rootracker' format but hiddes all information" 3085 <<
"\n except the final state particles." 3087 <<
"\n Experiment-specific formats:" 3088 <<
"\n * `numi_rootracker':" 3089 <<
"\n A variance of the `rootracker' format for the NuMI expts." 3090 <<
"\n Includes, in addition, NuMI flux pass-through info." 3091 <<
"\n\n Other formats: see the documentation for the original gntpc" 3094 <<
"\n Specifies the output filename." 3095 <<
"\n If not specified a the default filename is constructed from the input" 3096 <<
"\n base name and an extension depending on the file format." 3099 <<
"\n Random number seed." 3101 <<
"\n --message-thresholds" 3102 <<
"\n Allows users to customize the message stream thresholds." 3103 <<
"\n The thresholds are specified using an XML file." 3104 <<
"\n See $GENIE/config/Messenger.xml for the XML schema." 3106 <<
"\n --event-record-print-level" 3107 <<
"\n Allows users to set the level of information shown when the event" 3108 <<
"\n record is printed in the screen. See GHepRecord::Print()." 3112 <<
"\n shell% gntpc_dune -i myfile.ghep.root -f numi_rootracker" 3114 <<
"\n Converts all events in the GHEP file myfile.ghep.root into" 3115 <<
"\n the numi_rootracker format." 3116 <<
"\n The output file is named myfile.gtrac.root" 3118 <<
"\n Original gntpc author:" 3119 <<
"\n Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>" 3120 <<
"\n University of Liverpool & STFC Rutherford Appleton Lab" 3122 <<
"\n Created: September 23, 2005" 3124 <<
"\n Copyright (c) 2003-2016, GENIE Neutrino MC Generator Collaboration" 3125 <<
"\n For the full text of the license visit http://copyright.genie-mc.org" 3126 <<
"\n or see $GENIE/LICENSE";
3141 int HAProbeFSI(
int probe_fsi,
int probe_pdg,
int numh,
double E_had[],
int pdg_had[],
int numpip,
int numpim,
int numpi0)
3146 for(
int i=0; i<numh; i++)
3147 { energy += E_had[i]; }
3151 if (probe_fsi==3 && numh==1)
3153 else if (energy==E_had[0] && numh==1)
3155 else if (
pdg::IsPion(probe_pdg) && numpip+numpi0+numpim==0)
3157 else if ( (
pdg::IsNucleon(probe_pdg) && numpip+numpi0+numpim==0 && numh>2 )
3158 || (probe_pdg==
kPdgGamma && energy!=E_had[0] && numpip+numpi0+numpim==0))
3160 else if ( numpip+numpi0+numpim > (
pdg::IsPion(probe_pdg) ? 1 : 0) )
3164 for(
int i = 0; i < numh; i++)
3166 if ( (
pdg::IsPion(probe_pdg) && ( probe_pdg==pdg_had[i] ))
3178 for (
int iter = 0; iter < numh; iter++)
3180 if (probe_pdg==211 && pdg_had[iter]==-211) { index=8; undef=
false; }
3181 else if (probe_pdg==-211 && pdg_had[iter]==211) { index=8; undef=
false; }
3184 if (undef) { index=0; }
bool IsResonant(void) const
void RandGen(long int seed)
static void SetPrintLevel(int print_level)
int NeutReactionCode(const GHepRecord *evrec)
double W(bool selected=false) const
void ConvertToGINuke(void)
int RescatterCode(void) const
GNtpcFmt_t gOptOutFileFormat
output file format id
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.
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 gOptTruncateBigEvents
For rooTracker output, truncate events with more entries than kNPmax? Otherwise throw an error to avo...
bool IsQuasiElastic(void) const
void ConvertToGTracker(void)
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
void ConvertToGRooTracker(void)
bool IsDiffractive(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...
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.
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 IsSingleKaon(void) const
int FirstMother(void) const
string Name(void) const
Name that corresponds to the PDG code.
string DefaultOutputFile(void)
string gOptOutFileName
output file name
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 IsNuElectronElastic(void) const
static constexpr double cm2
A class encapsulating an enumeration of interaction types (EM, Weak-CC, Weak-NC) and scattering types...
const Kinematics & Kine(void) const
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
int main(int argc, char **argv)
int gOptVersion
output file format version
string gOptInpFileName
input file name
void Save(void)
get the even tree
void AddEventRecord(int ievent, const EventRecord *ev_rec)
save the event tree
Resonance_t Resonance(void) const
void GetCommandLineArgs(int argc, char **argv)
long int gOptRanSeed
random number seed
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)
A utility class to facilitate creating the GENIE MC Ntuple from the output GENIE GHEP event records...
int HAProbeFSI(int, int, int, double[], int[], int, int, int)
Singleton class to load & serve a TDatabasePDG.
bool HitQrkIsSet(void) const
double Vz(void) const
Get production z.
const TLorentzVector * X4(void) const
Long64_t gOptN
number of events to process
const int kPdgAntiNeutron
bool IsPseudoParticle(int pdgc)
const XclsTag & ExclTag(void) const
bool IsNuBarP(void) const
is anti-neutrino + proton?
int LatestFormatVersionNumber(void)
TRandom3 & RndGen(void) const
rnd number generator for generic usage
virtual void AddParticle(const GHepParticle &p)
const InitialState & InitState(void) const
const ProcessInfo & ProcInfo(void) const
double t(bool selected=false) const
int IonPdgCodeToZ(int pdgc)
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
void ConvertToGHepMock(void)
bool CheckRootFilename(string filename)
double PolzAzimuthAngle(void) const
void Clear(Option_t *opt="")
static constexpr double ys
enum EGNtpcFmt GNtpcFmt_t
const int kPdgHadronicSyst
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
double Vx(void) const
Get production x.
Initial State information.
double Py(void) const
Get Py.