Skip to content
Snippets Groups Projects

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

Merged Carl Gwilliam requested to merge gwilliam/calypso:mcgen into master
2 files
+ 111
25
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -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();
Loading