diff --git a/PhysicsAnalysis/NtupleDumper/src/NtupleDumperAlg.cxx b/PhysicsAnalysis/NtupleDumper/src/NtupleDumperAlg.cxx index 6550279abc6bee821ada0fe81fa629bcab7fb58b..c751d105649810a1b0db80f7b5fadc8d8bf624d6 100644 --- a/PhysicsAnalysis/NtupleDumper/src/NtupleDumperAlg.cxx +++ b/PhysicsAnalysis/NtupleDumper/src/NtupleDumperAlg.cxx @@ -471,6 +471,33 @@ StatusCode NtupleDumperAlg::initialize() 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); + m_tree->Branch("truth_isFiducial", &m_truth_isFiducial); + + + m_tree->Branch("truth_st0_x", &m_truth_st_x[0]); + m_tree->Branch("truth_st0_y", &m_truth_st_y[0]); + m_tree->Branch("truth_st0_z", &m_truth_st_z[0]); + m_tree->Branch("truth_st1_x", &m_truth_st_x[1]); + m_tree->Branch("truth_st1_y", &m_truth_st_y[1]); + m_tree->Branch("truth_st1_z", &m_truth_st_z[1]); + m_tree->Branch("truth_st2_x", &m_truth_st_x[2]); + m_tree->Branch("truth_st2_y", &m_truth_st_y[2]); + m_tree->Branch("truth_st2_z", &m_truth_st_z[2]); + m_tree->Branch("truth_st3_x", &m_truth_st_x[3]); + m_tree->Branch("truth_st3_y", &m_truth_st_y[3]); + m_tree->Branch("truth_st3_z", &m_truth_st_z[3]); + m_tree->Branch("truth_st0_px", &m_truth_st_px[0]); + m_tree->Branch("truth_st0_py", &m_truth_st_py[0]); + m_tree->Branch("truth_st0_pz", &m_truth_st_pz[0]); + m_tree->Branch("truth_st1_px", &m_truth_st_px[1]); + m_tree->Branch("truth_st1_py", &m_truth_st_py[1]); + m_tree->Branch("truth_st1_pz", &m_truth_st_pz[1]); + m_tree->Branch("truth_st2_px", &m_truth_st_px[2]); + m_tree->Branch("truth_st2_py", &m_truth_st_py[2]); + m_tree->Branch("truth_st2_pz", &m_truth_st_pz[2]); + m_tree->Branch("truth_st3_px", &m_truth_st_px[3]); + m_tree->Branch("truth_st3_py", &m_truth_st_py[3]); + m_tree->Branch("truth_st3_pz", &m_truth_st_pz[3]); // for mother + daughter particle truth infomation @@ -489,6 +516,7 @@ StatusCode NtupleDumperAlg::initialize() m_tree->Branch("truthd0_x", &m_truthd0_x); m_tree->Branch("truthd0_y", &m_truthd0_y); m_tree->Branch("truthd0_z", &m_truthd0_z); + m_tree->Branch("truthd0_isFiducial", &m_truthd0_isFiducial); m_tree->Branch("truthd1_P", &m_truthd1_P); m_tree->Branch("truthd1_px", &m_truthd1_px); @@ -497,6 +525,7 @@ StatusCode NtupleDumperAlg::initialize() m_tree->Branch("truthd1_x", &m_truthd1_x); m_tree->Branch("truthd1_y", &m_truthd1_y); m_tree->Branch("truthd1_z", &m_truthd1_z); + m_tree->Branch("truthd1_isFiducial", &m_truthd1_isFiducial); m_tree->Branch("vertex_x", &m_vertex_x, "vertex_x/D"); m_tree->Branch("vertex_y", &m_vertex_y, "vertex_y/D"); @@ -836,6 +865,21 @@ StatusCode NtupleDumperAlg::execute(const EventContext &ctx) const m_truth_pz.push_back(particle->p4().Z()); m_truth_m.push_back(particle->m()); m_truth_pdg.push_back(particle->pdgId()); + m_truth_isFiducial.push_back(m_fiducialParticleTool->isFiducial(particle->barcode())); + + auto positions = m_fiducialParticleTool->getTruthPositions(particle->barcode()); // Add truth position information at each station + for (int station = 0; station < 4; ++station) { + m_truth_st_x[station].push_back(positions[station].x()); + m_truth_st_y[station].push_back(positions[station].y()); + m_truth_st_z[station].push_back(positions[station].z()); + } + + auto momenta = m_fiducialParticleTool->getTruthMomenta(particle->barcode()); // Add truth momentum information at each station + for (int station = 0; station < 4; ++station) { + m_truth_st_px[station].push_back(momenta[station].x()); + m_truth_st_py[station].push_back(momenta[station].y()); + m_truth_st_pz[station].push_back(momenta[station].z()); + } if ( particle->hasProdVtx()) { m_truth_prod_x.push_back(particle->prodVtx()->x()); @@ -865,6 +909,7 @@ StatusCode NtupleDumperAlg::execute(const EventContext &ctx) const 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()); @@ -882,6 +927,7 @@ StatusCode NtupleDumperAlg::execute(const EventContext &ctx) const m_truthd0_px.push_back(particle->p4().X()); m_truthd0_py.push_back(particle->p4().Y()); m_truthd0_pz.push_back(particle->p4().Z()); + m_truthd0_isFiducial.push_back(m_fiducialParticleTool->isFiducial(particle->barcode())); if ( particle->hasProdVtx()) { m_truthd0_x.push_back(particle->prodVtx()->x()); @@ -903,6 +949,7 @@ StatusCode NtupleDumperAlg::execute(const EventContext &ctx) const m_truthd1_px.push_back(particle->p4().X()); m_truthd1_py.push_back(particle->p4().Y()); m_truthd1_pz.push_back(particle->p4().Z()); + m_truthd1_isFiducial.push_back(m_fiducialParticleTool->isFiducial(particle->barcode())); if ( particle->hasProdVtx()) { m_truthd1_x.push_back(particle->prodVtx()->x()); @@ -1675,6 +1722,18 @@ NtupleDumperAlg::clearTree() const m_truth_dec_x.clear(); m_truth_dec_y.clear(); m_truth_dec_z.clear(); + m_truth_isFiducial.clear(); + + for (int station = 0; station < 4; ++station) { + m_truth_st_x[station].clear(); + m_truth_st_y[station].clear(); + m_truth_st_z[station].clear(); + } + for (int station = 0; station < 4; ++station) { + m_truth_st_px[station].clear(); + m_truth_st_py[station].clear(); + m_truth_st_pz[station].clear(); + } m_truthM_P.clear(); m_truthM_px.clear(); @@ -1691,6 +1750,7 @@ NtupleDumperAlg::clearTree() const m_truthd0_x.clear(); m_truthd0_y.clear(); m_truthd0_z.clear(); + m_truthd0_isFiducial.clear(); m_truthd1_P.clear(); m_truthd1_px.clear(); @@ -1699,6 +1759,7 @@ NtupleDumperAlg::clearTree() const m_truthd1_x.clear(); m_truthd1_y.clear(); m_truthd1_z.clear(); + m_truthd1_isFiducial.clear(); m_vertex_x = NaN; m_vertex_y = NaN; diff --git a/PhysicsAnalysis/NtupleDumper/src/NtupleDumperAlg.h b/PhysicsAnalysis/NtupleDumper/src/NtupleDumperAlg.h index 456f0f82280bd5efa8ffd9226902d3a4eb062248..36729773eec08aa8674dfebb43bec17953731c92 100644 --- a/PhysicsAnalysis/NtupleDumper/src/NtupleDumperAlg.h +++ b/PhysicsAnalysis/NtupleDumper/src/NtupleDumperAlg.h @@ -345,6 +345,7 @@ private: mutable std::vector<double> m_truthM_z; mutable std::vector<double> m_truthd0_P; + mutable std::vector<bool> m_truthd0_isFiducial; //Boolean for if electron is fiducial mutable std::vector<double> m_truthd0_px; mutable std::vector<double> m_truthd0_py; @@ -355,6 +356,7 @@ private: mutable std::vector<double> m_truthd0_z; mutable std::vector<double> m_truthd1_P; + mutable std::vector<bool> m_truthd1_isFiducial; // Boolean for if positron is fiducial mutable std::vector<double> m_truthd1_px; mutable std::vector<double> m_truthd1_py; @@ -381,6 +383,14 @@ private: mutable std::vector<double> m_truth_prod_z; mutable std::vector<int> m_truth_pdg; // pdg of first 10 truth particles + mutable std::vector<bool> m_truth_isFiducial; // Boolean for if first 10 truth particles are fiducial + + mutable std::array<std::vector<double>, 4> m_truth_st_x; // vector of the x components of the simulated hits of the truth particle for each station + mutable std::array<std::vector<double>, 4> m_truth_st_y; // vector of the y components of the simulated hits of the truth particle for each station + mutable std::array<std::vector<double>, 4> m_truth_st_z; // vector of the z components of the simulated hits of the truth particle for each station + mutable std::array<std::vector<double>, 4> m_truth_st_px; // x components of the true momentum at each station + mutable std::array<std::vector<double>, 4> m_truth_st_py; // y components of the true momentum at each station + mutable std::array<std::vector<double>, 4> m_truth_st_pz; // z components of the true momentum at each station mutable double m_truthLeptonMomentum; mutable int m_truthBarcode;