Skip to content
Snippets Groups Projects
Commit 72e4bd44 authored by Carl Gwilliam's avatar Carl Gwilliam
Browse files

Merge branch 'mcgen' into 'master'

Add Lottie's truth updates and also fix veto station naming

See merge request faser/calypso!328
parents f6ac3a9b 53fcd3e6
No related branches found
No related tags found
No related merge requests found
...@@ -161,8 +161,8 @@ StatusCode NtupleDumperAlg::initialize() ...@@ -161,8 +161,8 @@ StatusCode NtupleDumperAlg::initialize()
//WAVEFORMS //WAVEFORMS
addWaveBranches("VetoNu",2,4); addWaveBranches("VetoNu",2,4);
addWaveBranches("VetoSt1",2,6); addWaveBranches("VetoSt1",1,14);
addWaveBranches("VetoSt2",1,14); addWaveBranches("VetoSt2",2,6);
addWaveBranches("Timing",4,8); addWaveBranches("Timing",4,8);
addWaveBranches("Preshower",2,12); addWaveBranches("Preshower",2,12);
addWaveBranches("Calo",4,0); addWaveBranches("Calo",4,0);
...@@ -306,6 +306,24 @@ StatusCode NtupleDumperAlg::initialize() ...@@ -306,6 +306,24 @@ StatusCode NtupleDumperAlg::initialize()
m_tree->Branch("truthPdg", &m_truthPdg, "truthPdg/I"); m_tree->Branch("truthPdg", &m_truthPdg, "truthPdg/I");
m_tree->Branch("CrossSection", &m_crossSection, "crossSection/D"); m_tree->Branch("CrossSection", &m_crossSection, "crossSection/D");
// first 10 truth particles
m_tree->Branch("truth_P", &m_truth_P);
m_tree->Branch("truth_px", &m_truth_px);
m_tree->Branch("truth_py", &m_truth_py);
m_tree->Branch("truth_pz", &m_truth_pz);
m_tree->Branch("truth_m", &m_truth_m);
m_tree->Branch("truth_pdg", &m_truth_pdg);
m_tree->Branch("truth_prod_x", &m_truth_prod_x);
m_tree->Branch("truth_prod_y", &m_truth_prod_y);
m_tree->Branch("truth_prod_z", &m_truth_prod_z);
m_tree->Branch("truth_dec_x", &m_truth_dec_x);
m_tree->Branch("truth_dec_y", &m_truth_dec_y);
m_tree->Branch("truth_dec_z", &m_truth_dec_z);
// for mother + daughter particle truth infomation // for mother + daughter particle truth infomation
m_tree->Branch("truthM_P", &m_truthM_P); m_tree->Branch("truthM_P", &m_truthM_P);
...@@ -548,30 +566,64 @@ StatusCode NtupleDumperAlg::execute(const EventContext &ctx) const ...@@ -548,30 +566,64 @@ StatusCode NtupleDumperAlg::execute(const EventContext &ctx) const
SG::ReadHandle<xAOD::TruthParticleContainer> truthParticleContainer { m_truthParticleContainer, ctx }; SG::ReadHandle<xAOD::TruthParticleContainer> truthParticleContainer { m_truthParticleContainer, ctx };
if (truthParticleContainer.isValid() && truthParticleContainer->size() > 0) if (truthParticleContainer.isValid() && truthParticleContainer->size() > 0)
{ {
for (auto particle : *truthParticleContainer)
{
if ( particle->barcode() == 1 || particle->barcode() == 2 || particle->barcode() == 3 )
{
if ( particle->pdgId() == 32) // mother particle (A')
{
m_truthM_P.push_back(particle->p4().P()); int ipart(0);
m_truthM_px.push_back(particle->p4().X()); for (auto particle : *truthParticleContainer)
m_truthM_py.push_back(particle->p4().Y()); {
m_truthM_pz.push_back(particle->p4().Z());
// loop over first 10 truth particles (for non A' samples)
if ( particle->hasProdVtx()) {
m_truthM_x.push_back(particle->prodVtx()->x()); if (ipart++ < 10) {
m_truthM_y.push_back(particle->prodVtx()->y());
m_truthM_z.push_back(particle->prodVtx()->z()); m_truth_P.push_back(particle->p4().P());
} else { m_truth_px.push_back(particle->p4().X());
m_truth_py.push_back(particle->p4().Y());
m_truth_pz.push_back(particle->p4().Z());
m_truth_m.push_back(particle->m());
m_truth_pdg.push_back(particle->pdgId());
if ( particle->hasProdVtx()) {
m_truth_prod_x.push_back(particle->prodVtx()->x());
m_truth_prod_y.push_back(particle->prodVtx()->y());
m_truth_prod_z.push_back(particle->prodVtx()->z());
} else {
m_truth_prod_x.push_back(NaN);
m_truth_prod_y.push_back(NaN);
m_truth_prod_z.push_back(NaN);
}
if ( particle->hasDecayVtx()) {
m_truth_dec_x.push_back(particle->decayVtx()->x());
m_truth_dec_y.push_back(particle->decayVtx()->y());
m_truth_dec_z.push_back(particle->decayVtx()->z());
} else {
m_truth_dec_x.push_back(NaN);
m_truth_dec_y.push_back(NaN);
m_truth_dec_z.push_back(NaN);
}
}
if ( particle->barcode() == 1 || particle->barcode() == 2 || particle->barcode() == 3 ) {
if ( particle->pdgId() == 32) { // mother particle (A')
m_truthM_P.push_back(particle->p4().P());
m_truthM_px.push_back(particle->p4().X());
m_truthM_py.push_back(particle->p4().Y());
m_truthM_pz.push_back(particle->p4().Z());
if ( particle->hasDecayVtx()) { // decay vertex for A' particle
m_truthM_x.push_back(particle->decayVtx()->x());
m_truthM_y.push_back(particle->decayVtx()->y());
m_truthM_z.push_back(particle->decayVtx()->z());
} else {
m_truthM_x.push_back(NaN); m_truthM_x.push_back(NaN);
m_truthM_y.push_back(NaN); m_truthM_y.push_back(NaN);
m_truthM_z.push_back(NaN); m_truthM_z.push_back(NaN);
} }
}
}
if ( particle->pdgId() == 11) // daughter particle (positron) if ( particle->pdgId() == 11) // daughter particle (positron)
{ {
m_truthd0_P.push_back(particle->p4().P()); m_truthd0_P.push_back(particle->p4().P());
...@@ -606,9 +658,9 @@ StatusCode NtupleDumperAlg::execute(const EventContext &ctx) const ...@@ -606,9 +658,9 @@ StatusCode NtupleDumperAlg::execute(const EventContext &ctx) const
m_truthd1_z.push_back(NaN); m_truthd1_z.push_back(NaN);
} }
} }
} }
} }
} }
} }
// load in calibrated calo container // load in calibrated calo container
...@@ -1239,7 +1291,20 @@ NtupleDumperAlg::clearTree() const ...@@ -1239,7 +1291,20 @@ NtupleDumperAlg::clearTree() const
m_truthBarcode = 0; m_truthBarcode = 0;
m_truthPdg = 0; m_truthPdg = 0;
m_truthM_P.clear(); m_truth_P.clear();
m_truth_px.clear();
m_truth_py.clear();
m_truth_pz.clear();
m_truth_m.clear();
m_truth_pdg.clear();
m_truth_prod_x.clear();
m_truth_prod_y.clear();
m_truth_prod_z.clear();
m_truth_dec_x.clear();
m_truth_dec_y.clear();
m_truth_dec_z.clear();
m_truthM_P.clear();
m_truthM_px.clear(); m_truthM_px.clear();
m_truthM_py.clear(); m_truthM_py.clear();
m_truthM_pz.clear(); m_truthM_pz.clear();
......
...@@ -280,7 +280,7 @@ private: ...@@ -280,7 +280,7 @@ private:
mutable std::vector<double> m_truthM_py; mutable std::vector<double> m_truthM_py;
mutable std::vector<double> m_truthM_pz; mutable std::vector<double> m_truthM_pz;
mutable std::vector<double> m_truthM_x; mutable std::vector<double> m_truthM_x; // decay vertex of A'
mutable std::vector<double> m_truthM_y; mutable std::vector<double> m_truthM_y;
mutable std::vector<double> m_truthM_z; mutable std::vector<double> m_truthM_z;
...@@ -290,7 +290,7 @@ private: ...@@ -290,7 +290,7 @@ private:
mutable std::vector<double> m_truthd0_py; mutable std::vector<double> m_truthd0_py;
mutable std::vector<double> m_truthd0_pz; mutable std::vector<double> m_truthd0_pz;
mutable std::vector<double> m_truthd0_x; mutable std::vector<double> m_truthd0_x; // production vertex for daughter particles
mutable std::vector<double> m_truthd0_y; mutable std::vector<double> m_truthd0_y;
mutable std::vector<double> m_truthd0_z; mutable std::vector<double> m_truthd0_z;
...@@ -304,6 +304,27 @@ private: ...@@ -304,6 +304,27 @@ private:
mutable std::vector<double> m_truthd1_y; mutable std::vector<double> m_truthd1_y;
mutable std::vector<double> m_truthd1_z; mutable std::vector<double> m_truthd1_z;
// first 10 truth particles
mutable std::vector<double> m_truth_P;
mutable std::vector<double> m_truth_px;
mutable std::vector<double> m_truth_py;
mutable std::vector<double> m_truth_pz;
mutable std::vector<double> m_truth_m;
mutable std::vector<double> m_truth_dec_x; // components of decay vertex (mm)
mutable std::vector<double> m_truth_dec_y;
mutable std::vector<double> m_truth_dec_z;
mutable std::vector<double> m_truth_prod_x; // components of production vertex (mm)
mutable std::vector<double> m_truth_prod_y;
mutable std::vector<double> m_truth_prod_z;
mutable std::vector<int> m_truth_pdg; // pdg of first 10 truth particles
mutable double m_truthLeptonMomentum; mutable double m_truthLeptonMomentum;
mutable int m_truthBarcode; mutable int m_truthBarcode;
mutable int m_truthPdg; mutable int m_truthPdg;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment