Skip to content

Commit

Permalink
Added additional GENIE info to LoadReweightGenieEvent including FS PD…
Browse files Browse the repository at this point in the history
…Gs and momentum, energy and momentum transfer, bjorken x, elasticity y, and target nuclei (#281)

Co-authored-by: James Minock <[email protected]>
  • Loading branch information
jminock and James Minock authored Nov 11, 2024
1 parent 5730477 commit 339ad78
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 17 deletions.
78 changes: 61 additions & 17 deletions UserTools/LoadReweightGenieEvent/LoadReweightGenieEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,10 @@ bool LoadReweightGenieEvent::Execute(){
neutcode=thegenieinfo.neutinteractioncode; // currently disabled to prevent excessive verbosity

eventq2=thegenieinfo.Q2; //MeV
eventw2=thegenieinfo.W2; //MeV
eventbj_x = thegenieinfo.x;
eventelastic_y = thegenieinfo.y;
TrueTargetZ = thegenieinfo.targetnucleusZ;
eventEnu=thegenieinfo.probeenergy; //MeV
eventPnu=thegenieinfo.probethreemomentum; //MeV
neutrinopdg=thegenieinfo.probepdg;
Expand Down Expand Up @@ -706,6 +710,14 @@ bool LoadReweightGenieEvent::Execute(){
geniestore->Set("NuVtxInTank",isintank);
geniestore->Set("NuVtxInFidVol",isinfiducialvol);
geniestore->Set("EventQ2",eventq2);
geniestore->Set("EventW2",eventw2);
geniestore->Set("EventBjx",eventbj_x);
geniestore->Set("Eventy",eventelastic_y);
geniestore->Set("TargetZ",TrueTargetZ);
geniestore->Set("Eventq0",eventq0);
geniestore->Set("Eventq3",eventq3);
geniestore->Set("pdg_vector", pdgs);
geniestore->Set("Pmag_vector",Pmag);
geniestore->Set("NeutrinoEnergy",eventEnu);
geniestore->Set("NeutrinoMomentum",eventPnu);
geniestore->Set("NeutrinoPDG",neutrinopdg);
Expand Down Expand Up @@ -739,6 +751,8 @@ bool LoadReweightGenieEvent::Execute(){

Log("Tool LoadReweightGenieEvent: Clearing genieintx",v_debug,verbosity);
genieintx->Clear(); // REQUIRED TO PREVENT MEMORY LEAK
pdgs.clear();
Pmag.clear();

Log("Tool LoadReweightGenieEvent: done",v_debug,verbosity);
return true;
Expand Down Expand Up @@ -925,44 +939,66 @@ void LoadReweightGenieEvent::GetGenieEntryInfo(genie::EventRecord* gevtRec, geni
genie::GHepParticle * p = 0;

//Loop over event particles
/// Kolanoski, Hermann, and Norbert Wermes, Particle Detectors: Fundamentals and Applications
// (Oxford, 2020; online edn, Oxford Academic, 17 Sept. 2020),
/// https://doi.org/10.1093/oso/9780198858362.001.0001, accessed 15 Aug. 2024.
// Using the equation P_th = Mass[GeV/C] / sqrt(n^2-1), where "n" is the index for refraction
/// rounding to 2 SigFigs
double wclimit_pion = 0.16; //water Cherenkov momentum threshold GeV
double wclimit_proton = 1.1; //water Cherenkov momentum threshold GeV
double wclimit_kaon = .56; //water Cherenkov momentum threshold GeV **THe the charged and neutral kaons thresholds are the same to 2 sigfigs
while ((p = dynamic_cast<genie::GHepParticle *>(iter.Next()))) {

int pdgc = p->Pdg();
double pipx = p->Px();
double pipy = p->Py();
double pipz = p->Pz();
double P_mag = std::sqrt(pipx*pipx + pipy*pipy + pipz*pipz);
int status = p->Status();
double wclimit = 0.160; //water Cherenkov momentum threshold GeV

if (status != genie::kIStStableFinalState) continue;

if (pdgc == genie::kPdgNeutron) thegenieinfo.numfsneutrons++;
else if (pdgc == genie::kPdgProton) thegenieinfo.numfsprotons++;
else if (pdgc == genie::kPdgProton) {
thegenieinfo.numfsprotons++;
if (P_mag > wclimit_proton) {
pdgs.push_back(pdgc);
Pmag.push_back(P_mag);
}
}
else if (pdgc == genie::kPdgPiP) {
thegenieinfo.numfspiplus++;
double pipx = p->Px();
double pipy = p->Py();
double pipz = p->Pz();
if (std::sqrt(pipx*pipx + pipy*pipy + pipz*pipz) > wclimit) thegenieinfo.numfspipluscher++;
if (P_mag > wclimit_pion){
pdgs.push_back(pdgc);
Pmag.push_back(P_mag);
thegenieinfo.numfspipluscher++;
}
}
else if (pdgc == genie::kPdgPiM) {
thegenieinfo.numfspiminus++;
double pipx = p->Px();
double pipy = p->Py();
double pipz = p->Pz();
if (std::sqrt(pipx*pipx + pipy*pipy + pipz*pipz) > wclimit) thegenieinfo.numfspiminuscher++;
if (P_mag > wclimit_pion) {
pdgs.push_back(pdgc);
Pmag.push_back(P_mag);
thegenieinfo.numfspiminuscher++;
}
}
else if (pdgc == genie::kPdgPi0) thegenieinfo.numfspi0++;
else if (pdgc == genie::kPdgKP) {
thegenieinfo.numfskplus++;
double pipx = p->Px();
double pipy = p->Py();
double pipz = p->Pz();
if (std::sqrt(pipx*pipx + pipy*pipy + pipz*pipz) > wclimit) thegenieinfo.numfskpluscher++;
if (P_mag > wclimit_kaon) {
pdgs.push_back(pdgc);
Pmag.push_back(P_mag);
thegenieinfo.numfskpluscher++;
}
}
else if (pdgc == genie::kPdgKM) {
thegenieinfo.numfskminus++;
double pipx = p->Px();
double pipy = p->Py();
double pipz = p->Pz();
if (std::sqrt(pipx*pipx + pipy*pipy + pipz*pipz) > wclimit) thegenieinfo.numfskminuscher++;
if (P_mag > wclimit_kaon){
pdgs.push_back(pdgc);
Pmag.push_back(P_mag);
thegenieinfo.numfskminuscher++;
}
}
}

Expand All @@ -983,6 +1019,14 @@ void LoadReweightGenieEvent::GetGenieEntryInfo(genie::EventRecord* gevtRec, geni
// q=k1-k2, 4-p transfer
/*TLorentzVector*/ thegenieinfo.q = TLorentzVectorToFourVectorRW((*k1)-(*k2));
// /*Double_t*/ thegenieinfo.Q2 = genieint->Kine().Q2(); // not set in our GENIE files!
double q0 = (gevtRec->Probe()->P4()->E()*1000.) - (gevtRec->FinalStatePrimaryLepton()->P4()->E()*1000.);
double px1 = (gevtRec->FinalStatePrimaryLepton()->P4()->Px()*1000.) - (gevtRec->Probe()->P4()->Px()*1000.);
double py1 = (gevtRec->FinalStatePrimaryLepton()->P4()->Py()*1000.) - (gevtRec->Probe()->P4()->Py()*1000.);
double pz1 = (gevtRec->FinalStatePrimaryLepton()->P4()->Pz()*1000.) - (gevtRec->Probe()->P4()->Pz()*1000.);
double q3 = sqrt(px1*px1+py1*py1+pz1*pz1);
thegenieinfo.Q2 = q3*q3 - q0*q0; // MeV
eventq0 = q0;
eventq3 = q3;
// momemtum transfer
/*Double_t*/ thegenieinfo.Q2 = -1 * thegenieinfo.q.M2();
// E transfer to the nucleus
Expand Down
9 changes: 9 additions & 0 deletions UserTools/LoadReweightGenieEvent/LoadReweightGenieEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,15 @@ class LoadReweightGenieEvent: public Tool {
bool isintank=false;
bool isinfiducialvol=false;
double eventq2=-1;
double eventw2=-1;
int TrueTargetZ = -1;
double eventbj_x=-1;
double eventelastic_y=-1;
double eventq0=-1;
double eventq3=-1;
std::vector<int>pdgs;
std::vector<double>Pmag;

double eventEnu=-1;
Direction eventPnu;
int neutrinopdg=-1;
Expand Down

0 comments on commit 339ad78

Please sign in to comment.