20 m_h_n_vert =
new TH1D(
"h_n_vert",
"n_vert", 100,200, 1500);
24 m_h_n_part =
new TH1D(
"h_n_part",
"n_part", 100,1000, 10000);
32 m_h_n_part_prim =
new TH1D(
"h_n_part_prim",
"n_part prim", 100,200, 1500);
36 m_h_n_vert_sec =
new TH1D(
"h_n_vert_sec",
"n_vert sec", 100,0, 1000);
40 m_h_n_part_sec =
new TH1D(
"h_n_part_sec",
"n_part sec", 100,0, 5000);
44 m_h_vtx_x =
new TH1D(
"h_vtx_x",
"vtx_x", 100,-1300, 1300);
48 m_h_vtx_y =
new TH1D(
"h_vtx_y",
"vtx_y", 100,-1200, 1200);
52 m_h_vtx_z =
new TH1D(
"h_vtx_z",
"vtx_z", 100,-5000, 5000);
56 m_h_vtx_r =
new TH1D(
"h_vtx_r",
"vtx_r", 100,0, 1160);
60 m_h_vtx_prim_xy =
new TH2D(
"h_vtx_prim_xy",
"vtx_prim_xy", 100,-100, 100, 100,-100, 100);
64 m_h_vtx_prim_zr =
new TH2D(
"h_vtx_prim_zr",
"vtx_prim_zr", 100,-1500, 1500, 100,0, 150);
68 m_h_vtx_sec_xy =
new TH2D(
"h_vtx_sec_xy",
"vtx_sec_xy", 100,-1200, 1200, 100,-1200, 1200);
72 m_h_vtx_sec_zr =
new TH2D(
"h_vtx_sec_zr",
"vtx_sec_zr", 100,-6000, 6000, 100,0, 1160);
80 m_h_truth_px =
new TH1D(
"h_truth_px",
"truth_px", 100,0, 4000);
84 m_h_truth_py =
new TH1D(
"h_truth_py",
"truth_py", 100,0, 4000);
88 m_h_truth_pz =
new TH1D(
"h_truth_pz",
"truth_pz", 100,0, 4000);
92 m_h_truth_pt =
new TH1D(
"h_truth_pt",
"truth_pt", 100,0, 4000);
96 m_h_truth_eta =
new TH1D(
"h_truth_eta",
"truth_eta", 50,-10, 10);
100 m_h_truth_phi =
new TH1D(
"h_truth_phi",
"truth_phi", 25,-3.1416, 3.1416);
104 m_h_barcode =
new TH1D(
"h_truth_barcode",
"truth_barcode", 100,0, 300000);
112 m_h_part_pdgid =
new TH1D(
"h_part_pdgid",
"part pdgid", 100,-5000, 5000);
120 m_h_part_eta =
new TH1D(
"h_part_eta",
"part eta", 100,-10, 10);
124 m_h_part_phi =
new TH1D(
"h_part_phi",
"part phi", 100,-3.2, 3.2);
128 m_h_part_p =
new TH1D(
"h_part_p",
"part p", 100,0, 5000);
133 m_tree =
new TTree(
"Truth",
"Truth");
152 return StatusCode::SUCCESS;
174 const EventContext& ctx{Gaudi::Hive::currentContext()};
180 if (currentGenEventIter != mcCollection->
end()) {
184 const auto &barcodes = (*currentGenEventIter)->attribute<HepMC::GenEventBarcodes> (
"barcodes");
185 std::map<int,int> id_to_barcode_map;
186 if (barcodes) id_to_barcode_map = barcodes->id_to_barcode_map();
187 for (
const auto& vtx: (*currentGenEventIter)->vertices()) {
188 int bcode = id_to_barcode_map[vtx->id()];
190 for (HepMC::GenEvent::vertex_const_iterator vtxit=(*currentGenEventIter)->vertices_begin(); vtxit!=(*currentGenEventIter)->vertices_end(); ++vtxit) {
194 double x = vtx->position().x();
195 double y = vtx->position().y();
196 double z = vtx->position().z();
197 double r = std::sqrt(
x*
x+
y*
y);
228 for (
auto currentGenParticle: *(*currentGenEventIter)) {
229 const HepMC::FourVector mom = currentGenParticle->momentum();
231 int currentGenParticlebarcode = id_to_barcode_map[currentGenParticle->id()];
249 m_barcode->push_back(currentGenParticlebarcode);
250 m_status->push_back(currentGenParticle->status());
252 int pdg = currentGenParticle->pdg_id();
257 m_h_part_p->Fill(std::sqrt(mom.x()*mom.x()+mom.y()*mom.y()+mom.z()*mom.z()));
286 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
const ServiceHandle< ITHistSvc > & histSvc() const
The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a...
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
std::vector< float > * m_vtx_z
std::vector< float > * m_truth_pt
virtual StatusCode initialize() override final
std::vector< float > * m_truth_py
std::vector< float > * m_pdgid
std::vector< float > * m_vtx_y
Gaudi::Property< std::string > m_path
TH1 * m_h_n_vert
Some variables.
virtual StatusCode execute() override final
std::vector< float > * m_vtx_x
SG::ReadHandleKey< McEventCollection > m_readKey
std::vector< float > * m_vtx_barcode
std::vector< float > * m_truth_pz
Gaudi::Property< std::string > m_ntupleFileName
std::vector< float > * m_truth_eta
std::vector< float > * m_barcode
std::vector< float > * m_truth_phi
std::vector< float > * m_status
std::vector< float > * m_vtx_r
std::vector< float > * m_truth_px
bool is_simulation_vertex(const T &v)
Method to establish if the vertex was created during simulation (TODO migrate to be based on status).
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
int generations(const T &p)
Method to return how many interactions a particle has undergone during simulation (TODO migrate to be...
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.