20 #include "TLorentzVector.h" 25 #include "Conventions/GVersion.h" 26 #include "Conventions/Units.h" 27 #include "EVGCore/EventRecord.h" 28 #include "GHEP/GHepUtils.h" 29 #include "PDG/PDGCodes.h" 30 #include "PDG/PDGLibrary.h" 31 #include "GENIE/Utils/RunOpt.h" 33 #include "Interaction/InitialState.h" 34 #include "Interaction/Interaction.h" 35 #include "Interaction/Kinematics.h" 36 #include "Interaction/KPhaseSpace.h" 37 #include "Interaction/ProcessInfo.h" 38 #include "Interaction/XclsTag.h" 39 #include "GHEP/GHepParticle.h" 40 #include "PDG/PDGCodeList.h" 41 #include "Conventions/Constants.h" 43 #include "EVGDrivers/GFluxI.h" 44 #include "FluxDrivers/GFluxBlender.h" 45 #include "FluxDrivers/GNuMIFlux.h" 46 #include "FluxDrivers/GSimpleNtpFlux.h" 49 #include "GENIE/Framework/Conventions/GVersion.h" 50 #include "GENIE/Framework/Conventions/Units.h" 51 #include "GENIE/Framework/Conventions/Constants.h" 52 #include "GENIE/Framework/Utils/PrintUtils.h" 53 #include "GENIE/Framework/ParticleData/PDGCodes.h" 54 #include "GENIE/Framework/ParticleData/PDGCodeList.h" 55 #include "GENIE/Framework/ParticleData/PDGLibrary.h" 56 #include "GENIE/Framework/GHEP/GHepUtils.h" 57 #include "GENIE/Framework/GHEP/GHepParticle.h" 58 #include "GENIE/Framework/Utils/RunOpt.h" 59 #include "GENIE/Framework/Utils/XSecSplineList.h" 61 #include "GENIE/Framework/Interaction/InitialState.h" 62 #include "GENIE/Framework/Interaction/Interaction.h" 63 #include "GENIE/Framework/Interaction/Kinematics.h" 64 #include "GENIE/Framework/Interaction/KPhaseSpace.h" 65 #include "GENIE/Framework/Interaction/ProcessInfo.h" 66 #include "GENIE/Framework/Interaction/XclsTag.h" 68 #include "GENIE/Framework/EventGen/EventRecord.h" 69 #include "GENIE/Framework/EventGen/GFluxI.h" 70 #include "GENIE/Tools/Flux/GFluxBlender.h" 71 #include "GENIE/Tools/Flux/GNuMIFlux.h" 72 #include "GENIE/Tools/Flux/GSimpleNtpFlux.h" 90 #include "dk2nu/tree/dk2nu.h" 91 #include "dk2nu/tree/NuChoice.h" 92 #include "dk2nu/tree/dkmeta.h" 93 #include "dk2nu/genie/GDk2NuFlux.h" 96 #include "cetlib_except/exception.h" 104 if ( s.find(
'$') != 0 )
return s;
107 std::string sEnvVar = s;
108 char rmchars[] =
"$(){} ";
109 for (
unsigned int i = 0; i < strlen(rmchars); ++i) {
113 sEnvVar.erase( std::remove(sEnvVar.begin(), sEnvVar.end(),
114 rmchars[i]), sEnvVar.end() );
116 const char* charEnvValue = std::getenv(sEnvVar.c_str());
117 if ( ! charEnvValue ) {
121 <<
" can't resolve " << s <<
" via getenv(\"" << sEnvVar <<
"\")";
124 return std::string(charEnvValue);
129 const std::string& tunename)
135 mf::LogInfo(
"GENIE2ART") <<
"GENIE_PRE_R3 ignore setting tune name: \"" 139 genie::RunOpt* grunopt = genie::RunOpt::Instance();
143 if ( expEvtGenListName !=
"" ) {
144 grunopt->SetEventGeneratorList(expEvtGenListName);
148 if ( expTuneName != tunename ) {
149 mf::LogInfo(
"GENIE2ART") <<
"TuneName started as '" << tunename <<
"' " 150 <<
" converted to " << expTuneName;
155 std::string current_tune = genie::XSecSplineList::Instance()->CurrentTune();
156 if ( current_tune.empty() ) {
158 mf::LogInfo(
"GENIE2ART") <<
"Configuring GENIE tune \"" 159 << expTuneName <<
'\"';
160 grunopt->SetTuneName( expTuneName );
161 grunopt->BuildTune();
166 if ( expTuneName != current_tune) {
167 throw cet::exception(
"TuneNameMismatch") <<
"Requested GENIE tune \"" 168 << expTuneName <<
"\" does not match previously built tune \"" 169 << current_tune <<
'\"';
185 const std::string & genieVersion,
186 const std::string & genieTune,
187 bool addGenieVtxTime,
188 const std::unordered_map<std::string, std::string> genConfig)
190 TLorentzVector vtxOffset(0,0,0,spillTime);
191 FillMCTruth(record,vtxOffset,truth,genieVersion,genieTune,addGenieVtxTime, genConfig);
195 TLorentzVector &vtxOffset,
197 const std::string & genieVersion,
198 const std::string & genieTune,
199 bool addGenieVtxTime,
200 const std::unordered_map<std::string, std::string> genConfig)
205 TLorentzVector *
vertex = record->Vertex();
209 const genie::Interaction *inter = record->Summary();
212 const genie::InitialState &initState = inter->InitState();
213 const genie::ProcessInfo &procInfo = inter->ProcInfo();
220 TIter partitr(record);
221 genie::GHepParticle *
part = 0;
231 std::string primary(
"primary");
242 while( (part = dynamic_cast<genie::GHepParticle *>(partitr.Next())) ){
250 double vtx[4] = {part->
Vx(), part->Vy(), part->Vz(), part->Vt()};
255 tpart.SetRescatter(part->RescatterCode());
264 vtx[0] = 100.*( part->Vx()*1.e-15 + vertex->X()) + vtxOffset.X();
265 vtx[1] = 100.*( part->Vy()*1.e-15 + vertex->Y()) + vtxOffset.Y();
266 vtx[2] = 100.*( part->Vz()*1.e-15 + vertex->Z()) + vtxOffset.Z();
267 const double yocto2ns = 1.0e-15;
268 vtx[3] = yocto2ns*part->Vt() + vtxOffset.T();
270 if (addGenieVtxTime) vtx[3] += vertex->T() * 1.0e9;
272 TLorentzVector pos(vtx[0], vtx[1], vtx[2], vtx[3]);
273 TLorentzVector mom(part->Px(), part->Py(), part->Pz(), part->E());
274 tpart.AddTrajectoryPoint(pos,mom);
275 if (part->PolzIsSet()) {
277 part->GetPolarization(polz);
278 tpart.SetPolarization(polz);
287 if (procInfo.IsWeakNC()) CCNC =
simb::kNC;
292 if (procInfo.IsQuasiElastic() ) mode =
simb::kQE;
293 else if (procInfo.IsDeepInelastic() ) mode =
simb::kDIS;
294 else if (procInfo.IsResonant() ) mode =
simb::kRes;
295 #if __GENIE_RELEASE_CODE__ >= GRELCODE(3,2,0) 296 else if (procInfo.IsCoherentProduction() ) mode =
simb::kCoh;
299 else if (procInfo.IsCoherent() ) mode =
simb::kCoh;
309 else if (procInfo.IsMEC() ) mode =
simb::kMEC;
311 else if (procInfo.IsEM() ) mode =
simb::kEM;
318 std::unordered_map<std::string, std::string> genConfigCopy(genConfig);
319 genConfigCopy.emplace(
"tune", genieTune);
327 genie::GHepParticle * hitnucl = record->HitNucleon();
328 TLorentzVector pdummy(0, 0, 0, 0);
330 const TLorentzVector v4_null;
331 genie::GHepParticle* probe = record->Probe();
332 genie::GHepParticle* finallepton = record->FinalStatePrimaryLepton();
333 const TLorentzVector & k1 = ( probe ? *(probe->P4()) : v4_null );
334 const TLorentzVector & k2 = ( finallepton ? *(finallepton->P4()) : v4_null );
339 double M = genie::constants::kNucleonMass;
340 TLorentzVector q = k1-k2;
341 double Q2 = -1 * q.M2();
342 double v = (hitnucl) ? q.Energy() : -1;
343 double x = (hitnucl) ? 0.5*Q2/(M*v) : -1;
344 double y = (hitnucl) ? v/k1.Energy() : -1;
345 double W2 = (hitnucl) ? M*M + 2*M*v - Q2 : -1;
346 double W = (hitnucl) ? std::sqrt(W2) : -1;
353 TLorentzVector q = k1-k2;
355 double Q2 = -1 * q.M2();
356 double v = q.Energy();
357 double y = v/k1.Energy();
361 #if __GENIE_RELEASE_CODE__ >= GRELCODE(3,2,0) 362 if ( hitnucl || procInfo.IsCoherentProduction() ) {
364 if ( hitnucl || procInfo.IsCoherent() ) {
366 const double M = genie::constants::kNucleonMass;
372 W2 = M*M + 2*M*v - Q2;
380 initState.Tgt().Pdg(),
381 initState.Tgt().HitNucPdg(),
382 initState.Tgt().HitQrkPdg(),
395 genie::Interaction *inter = record->Summary();
396 const genie::ProcessInfo &procInfo = inter->ProcInfo();
397 truth.
fGint = (int)procInfo.InteractionTypeId();
398 truth.
fGscatter = (int)procInfo.ScatteringTypeId();
401 truth.
fweight = record->Weight();
403 truth.
fXsec = record->XSec();
408 TLorentzVector *erVtx = record->Vertex();
409 vtx.SetXYZT(erVtx->X(), erVtx->Y(), erVtx->Z(), erVtx->T() );
414 const genie::XclsTag &exclTag = inter->ExclTag();
415 truth.
fIsCharm = exclTag.IsCharmEvent();
419 truth.
fResNum = (int)exclTag.Resonance();
428 #ifndef FILL_XCLS_OURSELVES 431 truth.
fNumPi0 = exclTag.NPi0();
434 #if __GENIE_RELEASE_CODE__ >= GRELCODE(3,2,0) 443 for (
int idx = 0; idx < record->GetEntries(); idx++)
446 const genie::GHepParticle * particle = record->Particle(idx);
447 if (particle->Status() != genie::kIStHadronInTheNucleus)
450 int pdg = particle->Pdg();
452 case genie::kPdgPi0: truth.
fNumPi0++;
break;
453 case genie::kPdgPiP: truth.
fNumPiPlus++;
break;
455 case genie::kPdgNeutron: truth.
fNumNeutron++;
break;
456 case genie::kPdgProton: truth.
fNumProton++;
break;
458 case genie::kPdgRho0: truth.
fNumRho0++;
break;
486 #if __GENIE_RELEASE_CODE__ >= GRELCODE(3,2,0) 492 const genie::Kinematics &kine = inter->Kine();
495 truth.
fgQ2 = kine.Q2(
true);
496 truth.
fgq2 = kine.q2(
true);
497 truth.
fgW = kine.W(
true);
498 if ( kine.KVSet(genie::kKVSelt) ) {
501 truth.
fgT = kine.t(
true);
503 truth.
fgX = kine.x(
true);
504 truth.
fgY = kine.y(
true);
505 if ( kine.KVSet(genie::kKVW) ) {
508 truth.
fgWrun = kine.W(
false);
521 const genie::InitialState &initState = inter->InitState();
523 truth.
fProbeP4 = *initState.GetProbeP4();
524 truth.
fTgtP4 = *initState.GetTgtP4();
527 const genie::Target &tgt = initState.Tgt();
531 truth.
ftgtZ = tgt.Z();
532 truth.
ftgtA = tgt.A();
542 bool useFirstTrajPosition)
544 genie::EventRecord* newEvent =
new genie::EventRecord;
546 newEvent->SetWeight(gtruth.
fweight);
548 newEvent->SetXSec(gtruth.
fXsec);
550 genie::KinePhaseSpace_t space = (genie::KinePhaseSpace_t)gtruth.
fGPhaseSpace;
552 newEvent->SetDiffXSec(gtruth.
fDiffXsec,space);
554 TLorentzVector vtx = gtruth.
fVertex;
555 newEvent->SetVertex(vtx);
560 for (
int i = 0; i < mctruth.
NParticles(); i++) {
564 genie::GHepStatus_t gmst = (genie::GHepStatus_t)mcpart.
StatusCode();
565 int gmmo = mcpart.
Mother();
605 double gmpx = mcpart.
Px(0);
606 double gmpy = mcpart.
Py(0);
607 double gmpz = mcpart.
Pz(0);
608 double gme = mcpart.
E(0);
610 double gmvx = mcpart.
Gvx();
611 double gmvy = mcpart.
Gvy();
612 double gmvz = mcpart.
Gvz();
613 double gmvt = mcpart.
Gvt();
617 genie::GHepParticle gpart(gmid, gmst, gmmo, -1, gmfd, gmld,
618 gmpx, gmpy, gmpz, gme, gmvx, gmvy, gmvz, gmvt);
619 gpart.SetRescatterCode(gmri);
621 if (polz.x() !=0 || polz.y() !=0 || polz.z() !=0) {
622 gpart.SetPolarization(polz);
624 newEvent->AddParticle(gpart);
627 genie::ProcessInfo proc_info;
628 genie::ScatteringType_t gscty = (genie::ScatteringType_t)gtruth.
fGscatter;
629 genie::InteractionType_t ginty = (genie::InteractionType_t)gtruth.
fGint;
631 proc_info.Set(gscty,ginty);
636 genie::Resonance_t gres = (genie::Resonance_t)gtruth.
fResNum;
637 gxt.SetResonance(gres);
641 #if __GENIE_RELEASE_CODE__ >= GRELCODE(3,2,0) 663 genie::Kinematics gkin;
666 const double flagVal = -99999;
667 if ( gtruth.
fgX != flagVal) gkin.Setx(gtruth.
fgX,
true);
668 if ( gtruth.
fgY != flagVal) gkin.Sety(gtruth.
fgY,
true);
669 if ( gtruth.
fgT != flagVal) gkin.Sett(gtruth.
fgT,
true);
670 if ( gtruth.
fgW != flagVal) gkin.SetW(gtruth.
fgW,
true);
671 if ( gtruth.
fgQ2 != flagVal) gkin.SetQ2(gtruth.
fgQ2,
true);
672 if ( gtruth.
fgq2 != flagVal) gkin.Setq2(gtruth.
fgq2,
true);
673 if ( gtruth.
fgWrun != flagVal) gkin.SetW(gtruth.
fgWrun,
false);
679 gkin.SetFSLeptonP4(lep.
Px(), lep.
Py(), lep.
Pz(), lep.
E());
688 int tgtZ = gtruth.
ftgtZ;
689 int tgtA = gtruth.
ftgtA;
696 if ( tgtZ == 0 || tgtA == 0 ) { tgtZ = tgtA = 1; }
697 if ( probe_pdgc == 0 || probe_pdgc == -1 ) { probe_pdgc = 22; }
701 int target_pdgc = genie::pdg::IonPdgCode(tgtA,tgtZ);
710 int targetNucleon = nu.
HitNuc();
718 genie::InitialState ginitstate(target_pdgc,probe_pdgc);
721 genie::Target* tgtptr = ginitstate.TgtPtr();
722 tgtptr->SetHitNucPdg(targetNucleon);
724 tgtptr->SetHitQrkPdg(struckQuark);
727 if (newEvent->HitNucleonPosition() >= 0) {
728 genie::GHepParticle * hitnucleon = newEvent->HitNucleon();
729 std::unique_ptr<TLorentzVector> p4hitnucleon(hitnucleon->GetP4());
730 tgtptr->SetHitNucP4(*p4hitnucleon);
732 if ( targetNucleon != 0 ) {
734 <<
"evgb::RetrieveGHEP() no hit nucleon position " 735 <<
" but targetNucleon is " << targetNucleon
736 <<
" at " << __FILE__ <<
":" << __LINE__
737 << std::endl << std::flush;
739 TLorentzVector dummy(0.,0.,0.,0.);
740 tgtptr->SetHitNucP4(dummy);
743 if (newEvent->TargetNucleusPosition() >= 0) {
744 genie::GHepParticle *
target = newEvent->TargetNucleus();
745 std::unique_ptr<TLorentzVector> p4target(target->GetP4());
746 ginitstate.SetTgtP4(*p4target);
750 TParticlePDG* ptmp = genie::PDGLibrary::Instance()->Find(gtruth.
ftgtPDG);
751 if ( ptmp ) Erest = ptmp->Mass();
754 <<
"evgb::RetrieveGHEP() no target nucleus position " 755 <<
" but gtruth.ftgtPDG is " << gtruth.
ftgtPDG 756 <<
" at " << __FILE__ <<
":" << __LINE__
757 << std::endl << std::flush;
759 TLorentzVector dummy(0.,0.,0.,Erest);
760 ginitstate.SetTgtP4(dummy);
763 genie::GHepParticle * probe = newEvent->Probe();
765 std::unique_ptr<TLorentzVector> p4probe(probe->GetP4());
766 ginitstate.SetProbeP4(*p4probe);
770 <<
"evgb::RetrieveGHEP() no probe " 771 <<
" at " << __FILE__ <<
":" << __LINE__
772 << std::endl << std::flush;
773 TLorentzVector dummy(0.,0.,0.,0.);
774 ginitstate.SetProbeP4(dummy);
777 genie::Interaction * p_gint =
new genie::Interaction(ginitstate,proc_info);
779 p_gint->SetProcInfo(proc_info);
780 p_gint->SetKine(gkin);
781 p_gint->SetExclTag(gxt);
782 newEvent->AttachSummary(p_gint);
803 const art::Handle<std::vector<simb::MCTruth>>& mcTruthHandle,
804 const art::Handle<std::vector<simb::GTruth>>& gTruthHandle){
806 std::vector<std::unique_ptr<genie::EventRecord>> gheps;
808 size_t NEventUnits = mcTruthHandle->size();
809 if (mcTruthHandle->size() != gTruthHandle->size()) {
810 NEventUnits = std::min(mcTruthHandle->size(), gTruthHandle->size());
812 for (
size_t eu_it = 0; eu_it < NEventUnits; ++eu_it) {
814 gTruthHandle->at(eu_it)));
823 std::string mcTruthLabel,
824 std::string gTruthLabel){
837 genie::flux::GFluxBlender* gblender =
838 dynamic_cast<genie::flux::GFluxBlender *
>(fdriver);
841 fdriver = gblender->GetFluxGenerator();
844 genie::flux::GNuMIFlux* gnumi =
845 dynamic_cast<genie::flux::GNuMIFlux *
>(fdriver);
850 genie::flux::GSimpleNtpFlux* gsimple =
851 dynamic_cast<genie::flux::GSimpleNtpFlux *
>(fdriver);
856 genie::flux::GDk2NuFlux* gdk2nu =
857 dynamic_cast<genie::flux::GDk2NuFlux *
>(fdriver);
862 static bool first =
true;
865 std::string dname =
typeid(*fdriver).name();
868 <<
" " << __FILE__ <<
":" << __LINE__ <<
"\n" 869 <<
" no FillMCFlux() for this flux driver: " 871 <<
" (typeid.name, use \"c++filt -t\" to demangle)" 886 const genie::flux::GNuMIFluxPassThroughInfo& numiflux =
887 gnumi->PassThroughInfo();
888 const genie::flux::GNuMIFluxPassThroughInfo* nflux = &numiflux;
889 double dk2gen = gnumi->GetDecayDist();
902 if (nflux->pcodes != 1 && nflux->units != 0) {
904 <<
"either wrong particle codes or units " 905 <<
"from flux object - beware!!";
911 flux.
frun = nflux->run;
912 flux.
fevtno = nflux->evtno;
913 flux.
fndxdz = nflux->ndxdz;
914 flux.
fndydz = nflux->ndydz;
915 flux.
fnpz = nflux->npz;
925 flux.
fnorig = nflux->norig;
927 flux.
fntype = nflux->ntype;
928 flux.
fvx = nflux->vx;
929 flux.
fvy = nflux->vy;
930 flux.
fvz = nflux->vz;
931 flux.
fpdpx = nflux->pdpx;
932 flux.
fpdpy = nflux->pdpy;
933 flux.
fpdpz = nflux->pdpz;
936 flux.
fpppz = nflux->pppz;
939 flux.
fptype = nflux->ptype;
940 flux.
fppvx = nflux->ppvx;
941 flux.
fppvy = nflux->ppvy;
942 flux.
fppvz = nflux->ppvz;
947 flux.
fnecm = nflux->necm;
952 flux.
ftvx = nflux->tvx;
953 flux.
ftvy = nflux->tvy;
954 flux.
ftvz = nflux->tvz;
955 flux.
ftpx = nflux->tpx;
956 flux.
ftpy = nflux->tpy;
957 flux.
ftpz = nflux->tpz;
959 flux.
ftgen = nflux->tgen;
961 flux.
ftgppx = nflux->tgppx;
962 flux.
ftgppy = nflux->tgppy;
963 flux.
ftgppz = nflux->tgppz;
967 flux.
fbeamx = nflux->beamx;
968 flux.
fbeamy = nflux->beamy;
969 flux.
fbeamz = nflux->beamz;
983 const genie::flux::GSimpleNtpEntry* nflux_entry =
984 gsimple->GetCurrentEntry();
985 const genie::flux::GSimpleNtpNuMI* nflux_numi =
986 gsimple->GetCurrentNuMI();
987 const genie::flux::GSimpleNtpAux* nflux_aux =
988 gsimple->GetCurrentAux();
989 const genie::flux::GSimpleNtpMeta* nflux_meta =
990 gsimple->GetCurrentMeta();
994 const genie::flux::GSimpleNtpNuMI* nflux_numi,
995 const genie::flux::GSimpleNtpAux* nflux_aux,
996 const genie::flux::GSimpleNtpMeta* nflux_meta,
1006 flux.
fntype = nflux_entry->pdg;
1007 flux.
fnimpwt = nflux_entry->wgt;
1008 flux.
fdk2gen = nflux_entry->dist;
1012 flux.
frun = nflux_numi->run;
1013 flux.
fevtno = nflux_numi->evtno;
1014 flux.
ftpx = nflux_numi->tpx;
1015 flux.
ftpy = nflux_numi->tpy;
1016 flux.
ftpz = nflux_numi->tpz;
1017 flux.
ftptype = nflux_numi->tptype;
1018 flux.
fvx = nflux_numi->vx;
1019 flux.
fvy = nflux_numi->vy;
1020 flux.
fvz = nflux_numi->vz;
1022 flux.
fndecay = nflux_numi->ndecay;
1025 flux.
fpdpx = nflux_numi->pdpx;
1026 flux.
fpdpy = nflux_numi->pdpy;
1027 flux.
fpdpz = nflux_numi->pdpz;
1029 double apppz = nflux_numi->pppz;
1030 if ( TMath::Abs(nflux_numi->pppz) < 1.0e-30 ) apppz = 1.0e-30;
1031 flux.
fppdxdz = nflux_numi->pppx / apppz;
1032 flux.
fppdydz = nflux_numi->pppy / apppz;
1033 flux.
fpppz = nflux_numi->pppz;
1035 flux.
fptype = nflux_numi->ptype;
1042 if ( nflux_aux && nflux_meta ) {
1045 const std::vector<std::string>& auxdblname = nflux_meta->auxdblname;
1046 const std::vector<std::string>& auxintname = nflux_meta->auxintname;
1047 const std::vector<int>& auxint = nflux_aux->auxint;
1048 const std::vector<double>& auxdbl = nflux_aux->auxdbl;
1050 for (
size_t id=0;
id<auxdblname.size(); ++id) {
1051 if (
"muparpx" == auxdblname[
id]) flux.
fmuparpx = auxdbl[id];
1052 if (
"muparpy" == auxdblname[
id]) flux.
fmuparpy = auxdbl[id];
1053 if (
"muparpz" == auxdblname[
id]) flux.
fmuparpz = auxdbl[id];
1054 if (
"mupare" == auxdblname[
id]) flux.
fmupare = auxdbl[id];
1055 if (
"necm" == auxdblname[
id]) flux.
fnecm = auxdbl[id];
1056 if (
"nimpwt" == auxdblname[
id]) flux.
fnimpwt = auxdbl[id];
1057 if (
"fgXYWgt" == auxdblname[
id]) {
1061 for (
size_t ii=0; ii<auxintname.size(); ++ii) {
1062 if (
"tgen" == auxintname[ii]) flux.
ftgen = auxint[ii];
1063 if (
"tgptype" == auxintname[ii]) flux.
ftgptype = auxint[ii];
1070 static bool first =
true;
1074 << __FILE__ <<
":" << __LINE__
1075 <<
" one time dump of GSimple objects\n";
1078 <<
"evgb::FillMCFlux() GSimpleNtpMeta:\n" 1079 << *nflux_meta <<
"\n";
1082 <<
"evgb::FillMCFlux() no GSimpleNtpMeta:\n";
1087 <<
"simb::MCFlux:\n" 1089 <<
"GSimpleNtpFlux:\n";
1090 if ( nflux_entry)
mf::LogDebug(
"GENIE2ART") << *nflux_entry <<
"\n";
1091 else mf::LogDebug(
"GENIE2ART") <<
"no GSimpleNtpEntry\n";
1092 if ( nflux_numi )
mf::LogDebug(
"GENIE2ART") << *nflux_numi <<
"\n";
1093 else mf::LogDebug(
"GENIE2ART") <<
"no GSimpleNtpNuMI\n";
1094 if ( nflux_aux )
mf::LogDebug(
"GENIE2ART") << *nflux_aux <<
"\n";
1095 else mf::LogDebug(
"GENIE2ART") <<
"no GSimpleNtpAux\n";
1155 const bsim::Dk2Nu& dk2nu = gdk2nu->GetDk2Nu();
1156 const bsim::NuChoice& nuchoice = gdk2nu->GetNuChoice();
1159 flux.
fdk2gen = gdk2nu->GetDecayDist();
1162 const bsim::NuChoice* nuchoice,
1169 flux.
frun = dk2nu->job;
1170 flux.
fevtno = dk2nu->potnum;
1175 flux.
fnorig = dk2nu->decay.norig;
1176 flux.
fndecay = dk2nu->decay.ndecay;
1177 flux.
fntype = dk2nu->decay.ntype;
1179 flux.
fptype = dk2nu->decay.ptype;
1181 flux.
fvx = dk2nu->decay.vx;
1182 flux.
fvy = dk2nu->decay.vy;
1183 flux.
fvz = dk2nu->decay.vz;
1184 flux.
fpdpx = dk2nu->decay.pdpx;
1185 flux.
fpdpy = dk2nu->decay.pdpy;
1186 flux.
fpdpz = dk2nu->decay.pdpz;
1188 flux.
fppdxdz = dk2nu->decay.ppdxdz;
1189 flux.
fppdydz = dk2nu->decay.ppdydz;
1190 flux.
fpppz = dk2nu->decay.pppz;
1193 flux.
fmuparpx = dk2nu->decay.muparpx;
1194 flux.
fmuparpy = dk2nu->decay.muparpy;
1195 flux.
fmuparpz = dk2nu->decay.muparpz;
1196 flux.
fmupare = dk2nu->decay.mupare;
1198 flux.
fnecm = dk2nu->decay.necm;
1199 flux.
fnimpwt = dk2nu->decay.nimpwt;
1204 flux.
fppvx = dk2nu->ppvx;
1205 flux.
fppvy = dk2nu->ppvy;
1206 flux.
fppvz = dk2nu->ppvz;
1209 flux.
ftvx = dk2nu->tgtexit.tvx;
1210 flux.
ftvy = dk2nu->tgtexit.tvy;
1211 flux.
ftvz = dk2nu->tgtexit.tvz;
1212 flux.
ftpx = dk2nu->tgtexit.tpx;
1213 flux.
ftpy = dk2nu->tgtexit.tpy;
1214 flux.
ftpz = dk2nu->tgtexit.tpz;
1215 flux.
ftptype = dk2nu->tgtexit.tptype;
1216 flux.
ftgen = dk2nu->tgtexit.tgen;
1223 flux.
fntype = nuchoice->pdgNu;
1224 flux.
fnimpwt = nuchoice->impWgt;
double E(const int i=0) const
int fGint
interaction code
Unified ntuple flux format (replaces 2)
unsigned int NumberTrajectoryPoints() const
const TVector3 & Polarization() const
const simb::MCNeutrino & GetNeutrino() const
double Py(const int i=0) const
void FillMCTruth(const genie::EventRecord *grec, double spillTime, simb::MCTruth &mctruth, const std::string &genieVersion="unknown", const std::string &genieTune="unknown", bool addGenieVtxTime=false, const std::unordered_map< std::string, std::string > genConfig={})
Full flux simulation ntuple.
void SetOrigin(simb::Origin_t origin)
neutrino electron elastic scatter
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
genie::EventRecord * RetrieveGHEP(const simb::MCTruth &truth, const simb::GTruth >ruth, bool useFirstTrajPosition=true)
return genie::EventRecord pointer; callee takes possession
void FillMCFlux(genie::GFluxI *fdriver, simb::MCFlux &mcflux)
int fGPhaseSpace
phase space system of DiffXSec
simb::flux_code_ fFluxType
double Px(const int i=0) const
int fNumNeutron
number of neutrons after reaction, before FSI
int fNumRhoPlus
number of pi pluses after reaction, before FSI
double fXsec
cross section of interaction
Functions for transforming GENIE objects into ART objects (and back)
int fNumPiPlus
number of pi pluses after reaction, before FSI
offset to account for adding in Nuance codes to this enum
int fNumSingleGammas
number of gammas after reaction, before FSI
int fNumPiMinus
number of pi minuses after reaction, before FSI
void SetNeutrino(int CCNC, int mode, int interactionType, int target, int nucleon, int quark, double w, double x, double y, double qsqr)
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
double fdk2gen
distance from decay to ray origin
bool fIsStrange
strange production // added version 13
object containing MC flux information
int fResNum
resonance number
int fNumProton
number of protons after reaction, before FSI
double fprobability
interaction probability
const simb::MCParticle & Lepton() const
int fGscatter
neutrino scattering code
int fNumRhoMinus
number of pi minuses after reaction, before FSI
std::string ExpandEnvVar(const std::string &s)
int fNumPi0
number of pi0 after reaction, before FSI
bool fIsCharm
did the interaction produce a charmed hadron?
double fweight
event interaction weight (genie internal)
const simb::MCParticle & GetParticle(int i) const
void SetGeneratorInfo(simb::Generator_t generator, const std::string &genVersion, const std::unordered_map< std::string, std::string > &genConfig)
double Vx(const int i=0) const
void Add(simb::MCParticle const &part)
n.b.: this group is similar but not quite, entirely unlike GENIE ScatteringType convention ...
Handle< PROD > getHandle(SelectorBase const &) const
void SetEventGeneratorListAndTune(const std::string &evtlistname="", const std::string &tunename="${GENIE_XSEC_TUNE}")
int ftgtPDG
PDG of Target Nucleus, nucleon only if free.
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
int fNumRho0
number of pi0 after reaction, before FSI
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
TLorentzVector fFShadSystP4
generated final state hadronic system (LAB frame)
double Pz(const int i=0) const
cout<< "-> Edep in the target
void FillGTruth(const genie::EventRecord *grec, simb::GTruth >ruth)
Event generator information.
Event generator information.
double fgY
a common running variable to be recorded
double fDiffXsec
differential cross section of interaction
std::vector< std::unique_ptr< genie::EventRecord > > RetrieveGHEPs(const art::Handle< std::vector< simb::MCTruth >> &mcTruthHandle, const art::Handle< std::vector< simb::GTruth >> &gTruthHandle)
A simplified flux ntuple for quick running.
cet::coded_exception< error, detail::translate > exception