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);
321 const char* phyOptVar = std::getenv(
"GENIE_PHYOPT_VARIANT");
322 if ( phyOptVar !=
nullptr && std::strlen(phyOptVar) > 0 ) {
324 genConfigCopy.emplace(
"genie_phyopt_variant",phyOptVar);
334 genie::GHepParticle * hitnucl = record->HitNucleon();
335 TLorentzVector pdummy(0, 0, 0, 0);
337 const TLorentzVector v4_null;
338 genie::GHepParticle* probe = record->Probe();
339 genie::GHepParticle* finallepton = record->FinalStatePrimaryLepton();
340 const TLorentzVector & k1 = ( probe ? *(probe->P4()) : v4_null );
341 const TLorentzVector & k2 = ( finallepton ? *(finallepton->P4()) : v4_null );
346 double M = genie::constants::kNucleonMass;
347 TLorentzVector q = k1-k2;
348 double Q2 = -1 * q.M2();
349 double v = (hitnucl) ? q.Energy() : -1;
350 double x = (hitnucl) ? 0.5*Q2/(M*v) : -1;
351 double y = (hitnucl) ? v/k1.Energy() : -1;
352 double W2 = (hitnucl) ? M*M + 2*M*v - Q2 : -1;
353 double W = (hitnucl) ? std::sqrt(W2) : -1;
360 TLorentzVector q = k1-k2;
362 double Q2 = -1 * q.M2();
363 double v = q.Energy();
364 double y = v/k1.Energy();
368 #if __GENIE_RELEASE_CODE__ >= GRELCODE(3,2,0) 369 if ( hitnucl || procInfo.IsCoherentProduction() ) {
371 if ( hitnucl || procInfo.IsCoherent() ) {
373 const double M = genie::constants::kNucleonMass;
379 W2 = M*M + 2*M*v - Q2;
387 initState.Tgt().Pdg(),
388 initState.Tgt().HitNucPdg(),
389 initState.Tgt().HitQrkPdg(),
402 genie::Interaction *inter = record->Summary();
403 const genie::ProcessInfo &procInfo = inter->ProcInfo();
404 truth.
fGint = (int)procInfo.InteractionTypeId();
405 truth.
fGscatter = (int)procInfo.ScatteringTypeId();
408 truth.
fweight = record->Weight();
410 truth.
fXsec = record->XSec();
415 TLorentzVector *erVtx = record->Vertex();
416 vtx.SetXYZT(erVtx->X(), erVtx->Y(), erVtx->Z(), erVtx->T() );
421 const genie::XclsTag &exclTag = inter->ExclTag();
422 truth.
fIsCharm = exclTag.IsCharmEvent();
426 truth.
fResNum = (int)exclTag.Resonance();
435 #ifndef FILL_XCLS_OURSELVES 438 truth.
fNumPi0 = exclTag.NPi0();
441 #if __GENIE_RELEASE_CODE__ >= GRELCODE(3,2,0) 450 for (
int idx = 0; idx < record->GetEntries(); idx++)
453 const genie::GHepParticle * particle = record->Particle(idx);
454 if (particle->Status() != genie::kIStHadronInTheNucleus)
457 int pdg = particle->Pdg();
459 case genie::kPdgPi0: truth.
fNumPi0++;
break;
460 case genie::kPdgPiP: truth.
fNumPiPlus++;
break;
462 case genie::kPdgNeutron: truth.
fNumNeutron++;
break;
463 case genie::kPdgProton: truth.
fNumProton++;
break;
465 case genie::kPdgRho0: truth.
fNumRho0++;
break;
493 #if __GENIE_RELEASE_CODE__ >= GRELCODE(3,2,0) 499 const genie::Kinematics &kine = inter->Kine();
502 truth.
fgQ2 = kine.Q2(
true);
503 truth.
fgq2 = kine.q2(
true);
504 truth.
fgW = kine.W(
true);
505 if ( kine.KVSet(genie::kKVSelt) ) {
508 truth.
fgT = kine.t(
true);
510 truth.
fgX = kine.x(
true);
511 truth.
fgY = kine.y(
true);
512 if ( kine.KVSet(genie::kKVW) ) {
515 truth.
fgWrun = kine.W(
false);
528 const genie::InitialState &initState = inter->InitState();
530 truth.
fProbeP4 = *initState.GetProbeP4();
531 truth.
fTgtP4 = *initState.GetTgtP4();
534 const genie::Target &tgt = initState.Tgt();
538 truth.
ftgtZ = tgt.Z();
539 truth.
ftgtA = tgt.A();
549 bool useFirstTrajPosition)
551 genie::EventRecord* newEvent =
new genie::EventRecord;
553 newEvent->SetWeight(gtruth.
fweight);
555 newEvent->SetXSec(gtruth.
fXsec);
557 genie::KinePhaseSpace_t space = (genie::KinePhaseSpace_t)gtruth.
fGPhaseSpace;
559 newEvent->SetDiffXSec(gtruth.
fDiffXsec,space);
561 TLorentzVector vtx = gtruth.
fVertex;
562 newEvent->SetVertex(vtx);
567 for (
int i = 0; i < mctruth.
NParticles(); i++) {
571 genie::GHepStatus_t gmst = (genie::GHepStatus_t)mcpart.
StatusCode();
572 int gmmo = mcpart.
Mother();
612 double gmpx = mcpart.
Px(0);
613 double gmpy = mcpart.
Py(0);
614 double gmpz = mcpart.
Pz(0);
615 double gme = mcpart.
E(0);
617 double gmvx = mcpart.
Gvx();
618 double gmvy = mcpart.
Gvy();
619 double gmvz = mcpart.
Gvz();
620 double gmvt = mcpart.
Gvt();
624 genie::GHepParticle gpart(gmid, gmst, gmmo, -1, gmfd, gmld,
625 gmpx, gmpy, gmpz, gme, gmvx, gmvy, gmvz, gmvt);
626 gpart.SetRescatterCode(gmri);
628 if (polz.x() !=0 || polz.y() !=0 || polz.z() !=0) {
629 gpart.SetPolarization(polz);
631 newEvent->AddParticle(gpart);
634 genie::ProcessInfo proc_info;
635 genie::ScatteringType_t gscty = (genie::ScatteringType_t)gtruth.
fGscatter;
636 genie::InteractionType_t ginty = (genie::InteractionType_t)gtruth.
fGint;
638 proc_info.Set(gscty,ginty);
643 genie::Resonance_t gres = (genie::Resonance_t)gtruth.
fResNum;
644 gxt.SetResonance(gres);
648 #if __GENIE_RELEASE_CODE__ >= GRELCODE(3,2,0) 670 genie::Kinematics gkin;
673 const double flagVal = -99999;
674 if ( gtruth.
fgX != flagVal) gkin.Setx(gtruth.
fgX,
true);
675 if ( gtruth.
fgY != flagVal) gkin.Sety(gtruth.
fgY,
true);
676 if ( gtruth.
fgT != flagVal) gkin.Sett(gtruth.
fgT,
true);
677 if ( gtruth.
fgW != flagVal) gkin.SetW(gtruth.
fgW,
true);
678 if ( gtruth.
fgQ2 != flagVal) gkin.SetQ2(gtruth.
fgQ2,
true);
679 if ( gtruth.
fgq2 != flagVal) gkin.Setq2(gtruth.
fgq2,
true);
680 if ( gtruth.
fgWrun != flagVal) gkin.SetW(gtruth.
fgWrun,
false);
686 gkin.SetFSLeptonP4(lep.
Px(), lep.
Py(), lep.
Pz(), lep.
E());
695 int tgtZ = gtruth.
ftgtZ;
696 int tgtA = gtruth.
ftgtA;
703 if ( tgtZ == 0 || tgtA == 0 ) { tgtZ = tgtA = 1; }
704 if ( probe_pdgc == 0 || probe_pdgc == -1 ) { probe_pdgc = 22; }
708 int target_pdgc = genie::pdg::IonPdgCode(tgtA,tgtZ);
717 int targetNucleon = nu.
HitNuc();
725 genie::InitialState ginitstate(target_pdgc,probe_pdgc);
728 genie::Target* tgtptr = ginitstate.TgtPtr();
729 tgtptr->SetHitNucPdg(targetNucleon);
731 tgtptr->SetHitQrkPdg(struckQuark);
734 if (newEvent->HitNucleonPosition() >= 0) {
735 genie::GHepParticle * hitnucleon = newEvent->HitNucleon();
736 std::unique_ptr<TLorentzVector> p4hitnucleon(hitnucleon->GetP4());
737 tgtptr->SetHitNucP4(*p4hitnucleon);
739 if ( targetNucleon != 0 ) {
741 <<
"evgb::RetrieveGHEP() no hit nucleon position " 742 <<
" but targetNucleon is " << targetNucleon
743 <<
" at " << __FILE__ <<
":" << __LINE__
744 << std::endl << std::flush;
746 TLorentzVector dummy(0.,0.,0.,0.);
747 tgtptr->SetHitNucP4(dummy);
750 if (newEvent->TargetNucleusPosition() >= 0) {
751 genie::GHepParticle *
target = newEvent->TargetNucleus();
752 std::unique_ptr<TLorentzVector> p4target(target->GetP4());
753 ginitstate.SetTgtP4(*p4target);
757 TParticlePDG* ptmp = genie::PDGLibrary::Instance()->Find(gtruth.
ftgtPDG);
758 if ( ptmp ) Erest = ptmp->Mass();
761 <<
"evgb::RetrieveGHEP() no target nucleus position " 762 <<
" but gtruth.ftgtPDG is " << gtruth.
ftgtPDG 763 <<
" at " << __FILE__ <<
":" << __LINE__
764 << std::endl << std::flush;
766 TLorentzVector dummy(0.,0.,0.,Erest);
767 ginitstate.SetTgtP4(dummy);
770 genie::GHepParticle * probe = newEvent->Probe();
772 std::unique_ptr<TLorentzVector> p4probe(probe->GetP4());
773 ginitstate.SetProbeP4(*p4probe);
777 <<
"evgb::RetrieveGHEP() no probe " 778 <<
" at " << __FILE__ <<
":" << __LINE__
779 << std::endl << std::flush;
780 TLorentzVector dummy(0.,0.,0.,0.);
781 ginitstate.SetProbeP4(dummy);
784 genie::Interaction * p_gint =
new genie::Interaction(ginitstate,proc_info);
786 p_gint->SetProcInfo(proc_info);
787 p_gint->SetKine(gkin);
788 p_gint->SetExclTag(gxt);
789 newEvent->AttachSummary(p_gint);
810 const art::Handle<std::vector<simb::MCTruth>>& mcTruthHandle,
811 const art::Handle<std::vector<simb::GTruth>>& gTruthHandle){
813 std::vector<std::unique_ptr<genie::EventRecord>> gheps;
815 size_t NEventUnits = mcTruthHandle->size();
816 if (mcTruthHandle->size() != gTruthHandle->size()) {
817 NEventUnits = std::min(mcTruthHandle->size(), gTruthHandle->size());
819 for (
size_t eu_it = 0; eu_it < NEventUnits; ++eu_it) {
821 gTruthHandle->at(eu_it)));
830 std::string mcTruthLabel,
831 std::string gTruthLabel){
844 genie::flux::GFluxBlender* gblender =
845 dynamic_cast<genie::flux::GFluxBlender *
>(fdriver);
848 fdriver = gblender->GetFluxGenerator();
851 genie::flux::GNuMIFlux* gnumi =
852 dynamic_cast<genie::flux::GNuMIFlux *
>(fdriver);
857 genie::flux::GSimpleNtpFlux* gsimple =
858 dynamic_cast<genie::flux::GSimpleNtpFlux *
>(fdriver);
863 genie::flux::GDk2NuFlux* gdk2nu =
864 dynamic_cast<genie::flux::GDk2NuFlux *
>(fdriver);
869 static bool first =
true;
872 std::string dname =
typeid(*fdriver).name();
875 <<
" " << __FILE__ <<
":" << __LINE__ <<
"\n" 876 <<
" no FillMCFlux() for this flux driver: " 878 <<
" (typeid.name, use \"c++filt -t\" to demangle)" 893 const genie::flux::GNuMIFluxPassThroughInfo& numiflux =
894 gnumi->PassThroughInfo();
895 const genie::flux::GNuMIFluxPassThroughInfo* nflux = &numiflux;
896 double dk2gen = gnumi->GetDecayDist();
909 if (nflux->pcodes != 1 && nflux->units != 0) {
911 <<
"either wrong particle codes or units " 912 <<
"from flux object - beware!!";
918 flux.
frun = nflux->run;
919 flux.
fevtno = nflux->evtno;
920 flux.
fndxdz = nflux->ndxdz;
921 flux.
fndydz = nflux->ndydz;
922 flux.
fnpz = nflux->npz;
932 flux.
fnorig = nflux->norig;
934 flux.
fntype = nflux->ntype;
935 flux.
fvx = nflux->vx;
936 flux.
fvy = nflux->vy;
937 flux.
fvz = nflux->vz;
938 flux.
fpdpx = nflux->pdpx;
939 flux.
fpdpy = nflux->pdpy;
940 flux.
fpdpz = nflux->pdpz;
943 flux.
fpppz = nflux->pppz;
946 flux.
fptype = nflux->ptype;
947 flux.
fppvx = nflux->ppvx;
948 flux.
fppvy = nflux->ppvy;
949 flux.
fppvz = nflux->ppvz;
954 flux.
fnecm = nflux->necm;
959 flux.
ftvx = nflux->tvx;
960 flux.
ftvy = nflux->tvy;
961 flux.
ftvz = nflux->tvz;
962 flux.
ftpx = nflux->tpx;
963 flux.
ftpy = nflux->tpy;
964 flux.
ftpz = nflux->tpz;
966 flux.
ftgen = nflux->tgen;
968 flux.
ftgppx = nflux->tgppx;
969 flux.
ftgppy = nflux->tgppy;
970 flux.
ftgppz = nflux->tgppz;
974 flux.
fbeamx = nflux->beamx;
975 flux.
fbeamy = nflux->beamy;
976 flux.
fbeamz = nflux->beamz;
990 const genie::flux::GSimpleNtpEntry* nflux_entry =
991 gsimple->GetCurrentEntry();
992 const genie::flux::GSimpleNtpNuMI* nflux_numi =
993 gsimple->GetCurrentNuMI();
994 const genie::flux::GSimpleNtpAux* nflux_aux =
995 gsimple->GetCurrentAux();
996 const genie::flux::GSimpleNtpMeta* nflux_meta =
997 gsimple->GetCurrentMeta();
1001 const genie::flux::GSimpleNtpNuMI* nflux_numi,
1002 const genie::flux::GSimpleNtpAux* nflux_aux,
1003 const genie::flux::GSimpleNtpMeta* nflux_meta,
1013 flux.
fntype = nflux_entry->pdg;
1014 flux.
fnimpwt = nflux_entry->wgt;
1015 flux.
fdk2gen = nflux_entry->dist;
1019 flux.
frun = nflux_numi->run;
1020 flux.
fevtno = nflux_numi->evtno;
1021 flux.
ftpx = nflux_numi->tpx;
1022 flux.
ftpy = nflux_numi->tpy;
1023 flux.
ftpz = nflux_numi->tpz;
1024 flux.
ftptype = nflux_numi->tptype;
1025 flux.
fvx = nflux_numi->vx;
1026 flux.
fvy = nflux_numi->vy;
1027 flux.
fvz = nflux_numi->vz;
1029 flux.
fndecay = nflux_numi->ndecay;
1032 flux.
fpdpx = nflux_numi->pdpx;
1033 flux.
fpdpy = nflux_numi->pdpy;
1034 flux.
fpdpz = nflux_numi->pdpz;
1036 double apppz = nflux_numi->pppz;
1037 if ( TMath::Abs(nflux_numi->pppz) < 1.0e-30 ) apppz = 1.0e-30;
1038 flux.
fppdxdz = nflux_numi->pppx / apppz;
1039 flux.
fppdydz = nflux_numi->pppy / apppz;
1040 flux.
fpppz = nflux_numi->pppz;
1042 flux.
fptype = nflux_numi->ptype;
1049 if ( nflux_aux && nflux_meta ) {
1052 const std::vector<std::string>& auxdblname = nflux_meta->auxdblname;
1053 const std::vector<std::string>& auxintname = nflux_meta->auxintname;
1054 const std::vector<int>& auxint = nflux_aux->auxint;
1055 const std::vector<double>& auxdbl = nflux_aux->auxdbl;
1057 for (
size_t id=0;
id<auxdblname.size(); ++id) {
1058 if (
"muparpx" == auxdblname[
id]) flux.
fmuparpx = auxdbl[id];
1059 if (
"muparpy" == auxdblname[
id]) flux.
fmuparpy = auxdbl[id];
1060 if (
"muparpz" == auxdblname[
id]) flux.
fmuparpz = auxdbl[id];
1061 if (
"mupare" == auxdblname[
id]) flux.
fmupare = auxdbl[id];
1062 if (
"necm" == auxdblname[
id]) flux.
fnecm = auxdbl[id];
1063 if (
"nimpwt" == auxdblname[
id]) flux.
fnimpwt = auxdbl[id];
1064 if (
"fgXYWgt" == auxdblname[
id]) {
1068 for (
size_t ii=0; ii<auxintname.size(); ++ii) {
1069 if (
"tgen" == auxintname[ii]) flux.
ftgen = auxint[ii];
1070 if (
"tgptype" == auxintname[ii]) flux.
ftgptype = auxint[ii];
1077 static bool first =
true;
1081 << __FILE__ <<
":" << __LINE__
1082 <<
" one time dump of GSimple objects\n";
1085 <<
"evgb::FillMCFlux() GSimpleNtpMeta:\n" 1086 << *nflux_meta <<
"\n";
1089 <<
"evgb::FillMCFlux() no GSimpleNtpMeta:\n";
1094 <<
"simb::MCFlux:\n" 1096 <<
"GSimpleNtpFlux:\n";
1097 if ( nflux_entry)
mf::LogDebug(
"GENIE2ART") << *nflux_entry <<
"\n";
1098 else mf::LogDebug(
"GENIE2ART") <<
"no GSimpleNtpEntry\n";
1099 if ( nflux_numi )
mf::LogDebug(
"GENIE2ART") << *nflux_numi <<
"\n";
1100 else mf::LogDebug(
"GENIE2ART") <<
"no GSimpleNtpNuMI\n";
1101 if ( nflux_aux )
mf::LogDebug(
"GENIE2ART") << *nflux_aux <<
"\n";
1102 else mf::LogDebug(
"GENIE2ART") <<
"no GSimpleNtpAux\n";
1162 const bsim::Dk2Nu& dk2nu = gdk2nu->GetDk2Nu();
1163 const bsim::NuChoice& nuchoice = gdk2nu->GetNuChoice();
1166 flux.
fdk2gen = gdk2nu->GetDecayDist();
1169 const bsim::NuChoice* nuchoice,
1176 flux.
frun = dk2nu->job;
1177 flux.
fevtno = dk2nu->potnum;
1182 flux.
fnorig = dk2nu->decay.norig;
1183 flux.
fndecay = dk2nu->decay.ndecay;
1184 flux.
fntype = dk2nu->decay.ntype;
1186 flux.
fptype = dk2nu->decay.ptype;
1188 flux.
fvx = dk2nu->decay.vx;
1189 flux.
fvy = dk2nu->decay.vy;
1190 flux.
fvz = dk2nu->decay.vz;
1191 flux.
fpdpx = dk2nu->decay.pdpx;
1192 flux.
fpdpy = dk2nu->decay.pdpy;
1193 flux.
fpdpz = dk2nu->decay.pdpz;
1195 flux.
fppdxdz = dk2nu->decay.ppdxdz;
1196 flux.
fppdydz = dk2nu->decay.ppdydz;
1197 flux.
fpppz = dk2nu->decay.pppz;
1200 flux.
fmuparpx = dk2nu->decay.muparpx;
1201 flux.
fmuparpy = dk2nu->decay.muparpy;
1202 flux.
fmuparpz = dk2nu->decay.muparpz;
1203 flux.
fmupare = dk2nu->decay.mupare;
1205 flux.
fnecm = dk2nu->decay.necm;
1206 flux.
fnimpwt = dk2nu->decay.nimpwt;
1211 flux.
fppvx = dk2nu->ppvx;
1212 flux.
fppvy = dk2nu->ppvy;
1213 flux.
fppvz = dk2nu->ppvz;
1216 flux.
ftvx = dk2nu->tgtexit.tvx;
1217 flux.
ftvy = dk2nu->tgtexit.tvy;
1218 flux.
ftvz = dk2nu->tgtexit.tvz;
1219 flux.
ftpx = dk2nu->tgtexit.tpx;
1220 flux.
ftpy = dk2nu->tgtexit.tpy;
1221 flux.
ftpz = dk2nu->tgtexit.tpz;
1222 flux.
ftptype = dk2nu->tgtexit.tptype;
1223 flux.
ftgen = dk2nu->tgtexit.tgen;
1230 flux.
fntype = nuchoice->pdgNu;
1231 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