Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/target interface #269

Draft
wants to merge 29 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions src/Apps/gSplineXml2Root.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -630,8 +630,8 @@ void SaveGraphsToRootFile(void)
<< " interaction type has not recongnised: spline not added " ;
continue; }

if(tgt.HitNucIsSet()) {
int hitnuc = tgt.HitNucPdg();
if(tgt.HitPartIsSet() && tgt.HitPartPdg() != kPdgElectron) {
int hitnuc = tgt.HitPartPdg();
if ( pdg::IsProton (hitnuc) ) { title << "_p"; }
else if ( pdg::IsNeutron(hitnuc) ) { title << "_n"; }
else if ( pdg::Is2NucleonCluster(hitnuc) )
Expand Down Expand Up @@ -752,22 +752,22 @@ void SaveGraphsToRootFile(void)

const Spline * spl = evg_driver.XSecSpline(interaction);

if (proc.IsResonant() && proc.IsWeakCC() && pdg::IsProton(tgt.HitNucPdg())) {
if (proc.IsResonant() && proc.IsWeakCC() && pdg::IsProton(tgt.HitPartPdg())) {
for(int i=0; i<kNSplineP; i++) {
xsresccp[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
}
}
if (proc.IsResonant() && proc.IsWeakCC() && pdg::IsNeutron(tgt.HitNucPdg())) {
if (proc.IsResonant() && proc.IsWeakCC() && pdg::IsNeutron(tgt.HitPartPdg())) {
for(int i=0; i<kNSplineP; i++) {
xsresccn[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
}
}
if (proc.IsResonant() && proc.IsWeakNC() && pdg::IsProton(tgt.HitNucPdg())) {
if (proc.IsResonant() && proc.IsWeakNC() && pdg::IsProton(tgt.HitPartPdg())) {
for(int i=0; i<kNSplineP; i++) {
xsresncp[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
}
}
if (proc.IsResonant() && proc.IsWeakNC() && pdg::IsNeutron(tgt.HitNucPdg())) {
if (proc.IsResonant() && proc.IsWeakNC() && pdg::IsNeutron(tgt.HitPartPdg())) {
for(int i=0; i<kNSplineP; i++) {
xsresncn[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
}
Expand Down Expand Up @@ -820,25 +820,25 @@ void SaveGraphsToRootFile(void)

if(xcls.IsCharmEvent()) continue;

if (proc.IsDeepInelastic() && proc.IsWeakCC() && pdg::IsProton(tgt.HitNucPdg())) {
if (proc.IsDeepInelastic() && proc.IsWeakCC() && pdg::IsProton(tgt.HitPartPdg())) {
for(int i=0; i<kNSplineP; i++) {
xsdiscc[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
xsdisccp[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
}
}
if (proc.IsDeepInelastic() && proc.IsWeakCC() && pdg::IsNeutron(tgt.HitNucPdg())) {
if (proc.IsDeepInelastic() && proc.IsWeakCC() && pdg::IsNeutron(tgt.HitPartPdg())) {
for(int i=0; i<kNSplineP; i++) {
xsdiscc[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
xsdisccn[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
}
}
if (proc.IsDeepInelastic() && proc.IsWeakNC() && pdg::IsProton(tgt.HitNucPdg())) {
if (proc.IsDeepInelastic() && proc.IsWeakNC() && pdg::IsProton(tgt.HitPartPdg())) {
for(int i=0; i<kNSplineP; i++) {
xsdisnc[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
xsdisncp[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
}
}
if (proc.IsDeepInelastic() && proc.IsWeakNC() && pdg::IsNeutron(tgt.HitNucPdg())) {
if (proc.IsDeepInelastic() && proc.IsWeakNC() && pdg::IsNeutron(tgt.HitPartPdg())) {
for(int i=0; i<kNSplineP; i++) {
xsdisnc[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
xsdisncn[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
Expand Down Expand Up @@ -893,25 +893,25 @@ void SaveGraphsToRootFile(void)

if(!xcls.IsCharmEvent()) continue;

if (proc.IsDeepInelastic() && proc.IsWeakCC() && pdg::IsProton(tgt.HitNucPdg())) {
if (proc.IsDeepInelastic() && proc.IsWeakCC() && pdg::IsProton(tgt.HitPartPdg())) {
for(int i=0; i<kNSplineP; i++) {
xsdiscc[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
xsdisccp[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
}
}
if (proc.IsDeepInelastic() && proc.IsWeakCC() && pdg::IsNeutron(tgt.HitNucPdg())) {
if (proc.IsDeepInelastic() && proc.IsWeakCC() && pdg::IsNeutron(tgt.HitPartPdg())) {
for(int i=0; i<kNSplineP; i++) {
xsdiscc[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
xsdisccn[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
}
}
if (proc.IsDeepInelastic() && proc.IsWeakNC() && pdg::IsProton(tgt.HitNucPdg())) {
if (proc.IsDeepInelastic() && proc.IsWeakNC() && pdg::IsProton(tgt.HitPartPdg())) {
for(int i=0; i<kNSplineP; i++) {
xsdisnc[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
xsdisncp[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
}
}
if (proc.IsDeepInelastic() && proc.IsWeakNC() && pdg::IsNeutron(tgt.HitNucPdg())) {
if (proc.IsDeepInelastic() && proc.IsWeakNC() && pdg::IsNeutron(tgt.HitPartPdg())) {
for(int i=0; i<kNSplineP; i++) {
xsdisnc[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
xsdisncn[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
Expand Down Expand Up @@ -1110,8 +1110,8 @@ void SaveGraphsToRootFile(void)

bool iscc = proc.IsWeakCC();
bool isnc = proc.IsWeakNC();
bool offp = pdg::IsProton (tgt.HitNucPdg());
bool offn = pdg::IsNeutron(tgt.HitNucPdg());
bool offp = pdg::IsProton (tgt.HitPartPdg());
bool offn = pdg::IsNeutron(tgt.HitPartPdg());

if (iscc && offp) {
for(int i=0; i<kNSplineP; i++) {
Expand Down Expand Up @@ -1226,12 +1226,12 @@ void SaveGraphsToRootFile(void)

const Spline * spl = evg_driver.XSecSpline(interaction);

if (proc.IsResonant() && proc.IsEM() && pdg::IsProton(tgt.HitNucPdg())) {
if (proc.IsResonant() && proc.IsEM() && pdg::IsProton(tgt.HitPartPdg())) {
for(int i=0; i<kNSplineP; i++) {
xsresemp[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
}
}
if (proc.IsResonant() && proc.IsEM() && pdg::IsNeutron(tgt.HitNucPdg())) {
if (proc.IsResonant() && proc.IsEM() && pdg::IsNeutron(tgt.HitPartPdg())) {
for(int i=0; i<kNSplineP; i++) {
xsresemn[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
}
Expand Down Expand Up @@ -1268,12 +1268,12 @@ void SaveGraphsToRootFile(void)

if(xcls.IsCharmEvent()) continue;

if (proc.IsDeepInelastic() && proc.IsEM() && pdg::IsProton(tgt.HitNucPdg())) {
if (proc.IsDeepInelastic() && proc.IsEM() && pdg::IsProton(tgt.HitPartPdg())) {
for(int i=0; i<kNSplineP; i++) {
xsdisemp[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
}
}
if (proc.IsDeepInelastic() && proc.IsEM() && pdg::IsNeutron(tgt.HitNucPdg())) {
if (proc.IsDeepInelastic() && proc.IsEM() && pdg::IsNeutron(tgt.HitPartPdg())) {
for(int i=0; i<kNSplineP; i++) {
xsdisemn[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
}
Expand Down Expand Up @@ -1307,12 +1307,12 @@ void SaveGraphsToRootFile(void)

if(!xcls.IsCharmEvent()) continue;

if (proc.IsDeepInelastic() && proc.IsEM() && pdg::IsProton(tgt.HitNucPdg())) {
if (proc.IsDeepInelastic() && proc.IsEM() && pdg::IsProton(tgt.HitPartPdg())) {
for(int i=0; i<kNSplineP; i++) {
xsdisemp[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
}
}
if (proc.IsDeepInelastic() && proc.IsEM() && pdg::IsNeutron(tgt.HitNucPdg())) {
if (proc.IsDeepInelastic() && proc.IsEM() && pdg::IsNeutron(tgt.HitPartPdg())) {
for(int i=0; i<kNSplineP; i++) {
xsdisemn[i] += (spl->Evaluate(e[i]) * (1E+38/units::cm2));
}
Expand Down Expand Up @@ -1347,8 +1347,8 @@ void SaveGraphsToRootFile(void)
const Spline * spl = evg_driver.XSecSpline(interaction);

bool isem = proc.IsEM();
bool offp = pdg::IsProton (tgt.HitNucPdg());
bool offn = pdg::IsNeutron(tgt.HitNucPdg());
bool offp = pdg::IsProton (tgt.HitPartPdg());
bool offn = pdg::IsNeutron(tgt.HitPartPdg());

if (isem && offp) {
for(int i=0; i<kNSplineP; i++) {
Expand Down
4 changes: 2 additions & 2 deletions src/Framework/GHEP/GHepUtils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ int genie::utils::ghep::NeutReactionCode(const GHepRecord * event)
bool is_imd = proc.IsInverseMuDecay();
bool is_ask = proc.IsSingleKaon();
bool is_diff = proc.IsDiffractive();
bool is_p = tgt.HitNucIsSet() ? tgt.HitNucPdg()==kPdgProton : false;
bool is_n = tgt.HitNucIsSet() ? tgt.HitNucPdg()==kPdgNeutron : false;
bool is_p = pdg::IsProton(tgt.HitPartPdg());
bool is_n = pdg::IsNeutron(tgt.HitPartPdg());
bool is_nu = pdg::IsNeutrino (init.ProbePdg());
bool is_nubar = pdg::IsAntiNeutrino(init.ProbePdg());
bool W_gt_2 = kine.KVSet(kKVW) ? (kine.W() > 2.0) : false;
Expand Down
36 changes: 18 additions & 18 deletions src/Framework/Interaction/InitialState.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void InitialState::SetTgtP4(const TLorentzVector & P4)
bool InitialState::IsNuP(void) const
{
int prob = fProbePdg;
int nucl = fTgt->HitNucPdg();
int nucl = fTgt->HitPartPdg();
bool isvp = pdg::IsNeutrino(prob) && pdg::IsProton(nucl);

return isvp;
Expand All @@ -208,7 +208,7 @@ bool InitialState::IsNuP(void) const
bool InitialState::IsNuN(void) const
{
int prob = fProbePdg;
int nucl = fTgt->HitNucPdg();
int nucl = fTgt->HitPartPdg();
bool isvn = pdg::IsNeutrino(prob) && pdg::IsNeutron(nucl);

return isvn;
Expand All @@ -217,7 +217,7 @@ bool InitialState::IsNuN(void) const
bool InitialState::IsNuBarP(void) const
{
int prob = fProbePdg;
int nucl = fTgt->HitNucPdg();
int nucl = fTgt->HitPartPdg();
bool isvbp = pdg::IsAntiNeutrino(prob) && pdg::IsProton(nucl);

return isvbp;
Expand All @@ -226,7 +226,7 @@ bool InitialState::IsNuBarP(void) const
bool InitialState::IsNuBarN(void) const
{
int prob = fProbePdg;
int nucl = fTgt->HitNucPdg();
int nucl = fTgt->HitPartPdg();
bool isvbn = pdg::IsAntiNeutrino(prob) && pdg::IsNeutron(nucl);

return isvbn;
Expand All @@ -236,7 +236,7 @@ bool InitialState::IsDMP(void) const
{
// Check if DM - proton interaction
int prob = fProbePdg;
int nucl = fTgt->HitNucPdg();
int nucl = fTgt->HitPartPdg();
bool isdp = pdg::IsDarkMatter(prob) && pdg::IsProton(nucl);

return isdp;
Expand All @@ -246,7 +246,7 @@ bool InitialState::IsDMN(void) const
{
// Check if DM - neutron interaction
int prob = fProbePdg;
int nucl = fTgt->HitNucPdg();
int nucl = fTgt->HitPartPdg();
bool isdn = pdg::IsDarkMatter(prob) && pdg::IsNeutron(nucl);

return isdn;
Expand All @@ -256,7 +256,7 @@ bool InitialState::IsDMBP(void) const
{
// Check if DM - proton interaction
int prob = fProbePdg;
int nucl = fTgt->HitNucPdg();
int nucl = fTgt->HitPartPdg();
bool isdp = pdg::IsAntiDarkMatter(prob) && pdg::IsProton(nucl);

return isdp;
Expand All @@ -266,7 +266,7 @@ bool InitialState::IsDMBN(void) const
{
// Check if DM - neutron interaction
int prob = fProbePdg;
int nucl = fTgt->HitNucPdg();
int nucl = fTgt->HitPartPdg();
bool isdn = pdg::IsAntiDarkMatter(prob) && pdg::IsNeutron(nucl);

return isdn;
Expand Down Expand Up @@ -294,8 +294,8 @@ TLorentzVector * InitialState::GetTgtP4(RefFrame_t ref_frame) const
{
// make sure that 'struck nucleon' properties were set in
// the nuclear target object
assert(fTgt->HitNucIsSet());
TLorentzVector * pnuc4 = fTgt->HitNucP4Ptr();
assert(pdg::IsNucleon(fTgt->HitPartPdg()));
TLorentzVector * pnuc4 = fTgt->HitPartP4Ptr();

// compute velocity vector (px/E, py/E, pz/E)
double bx = pnuc4->Px() / pnuc4->Energy();
Expand Down Expand Up @@ -346,9 +346,9 @@ TLorentzVector * InitialState::GetProbeP4(RefFrame_t ref_frame) const
// make sure that 'struck nucleon' properties were set in
// the nuclear target object

assert( fTgt->HitNucP4Ptr() != 0 );
assert( pdg::IsNucleon(fTgt->HitPartPdg()) );

TLorentzVector * pnuc4 = fTgt->HitNucP4Ptr();
TLorentzVector * pnuc4 = fTgt->HitPartP4Ptr();

// compute velocity vector (px/E, py/E, pz/E)

Expand Down Expand Up @@ -394,7 +394,7 @@ double InitialState::ProbeE(RefFrame_t ref_frame) const
double InitialState::CMEnergy() const
{
TLorentzVector * k4 = this->GetProbeP4(kRfLab);
TLorentzVector * p4 = fTgt->HitNucP4Ptr();
TLorentzVector * p4 = fTgt->HitPartP4Ptr();

*k4 += *p4; // now k4 represents centre-of-mass 4-momentum
double s = k4->Dot(*k4); // dot-product with itself
Expand Down Expand Up @@ -443,8 +443,8 @@ void InitialState::Print(ostream & stream) const
}
stream << endl;

stream << " |--> hit nucleon : ";
int nuc_pdgc = fTgt->HitNucPdg();
stream << " |--> hit particle : ";
int nuc_pdgc = fTgt->HitPartPdg();

if ( pdg::IsNeutronOrProton(nuc_pdgc) ) {
TParticlePDG * p = PDGLibrary::Instance()->Find(nuc_pdgc);
Expand Down Expand Up @@ -481,11 +481,11 @@ void InitialState::Print(ostream & stream) const
<< ")"
<< endl;

if ( pdg::IsNeutronOrProton(nuc_pdgc) ) {
if ( pdg::IsParticle(nuc_pdgc) ) {

TLorentzVector * nuc_p4 = fTgt->HitNucP4Ptr();
TLorentzVector * nuc_p4 = fTgt->HitPartP4Ptr();

stream << " |--> nucleon 4P : "
stream << " |--> hit particle : "
<< "(E = " << setw(12) << setprecision(6) << nuc_p4->E()
<< ", Px = " << setw(12) << setprecision(6) << nuc_p4->Px()
<< ", Py = " << setw(12) << setprecision(6) << nuc_p4->Py()
Expand Down
Loading