7 #include "HepPDT/ParticleData.hh"
8 #include "HepPDT/ParticleDataTable.hh"
9 #include "GaudiKernel/SystemOfUnits.h"
30 declareProperty(
"StoreGateKey",
m_McEvtCollName =
"TruthEvent",
"Name of the McEventCollection");
32 declareProperty(
"UnstableMinRhoCut",
m_MinRhoCut = 40*
Gaudi::Units::mm,
"Minium radius of the end-vertex for unstable particle to get accepted");
41 return StatusCode::SUCCESS;
57 return StatusCode::SUCCESS;
61 return StatusCode::SUCCESS;
67 for ( ; McEvtCollItr != McEvtColl->
end(); ++McEvtCollItr)
68 NParticles += (*McEvtCollItr)->particles_size();
75 DataVect phi; phi.reserve(NParticles);
76 DataVect eta; eta.reserve(NParticles);
77 DataVect rhoVertex; rhoVertex.reserve(NParticles);
78 DataVect phiVertex; phiVertex.reserve(NParticles);
79 DataVect zVertex; zVertex.reserve(NParticles);
82 DataVect rhoEndVertex; rhoEndVertex.reserve(NParticles);
83 DataVect phiEndVertex; phiEndVertex.reserve(NParticles);
84 DataVect zEndVertex; zEndVertex.reserve(NParticles);
88 for ( McEvtCollItr = McEvtColl->
begin(); McEvtCollItr != McEvtColl->
end(); ++McEvtCollItr){
92 const auto &
barcodes = (*McEvtCollItr)->attribute<HepMC::GenEventBarcodes> (
"barcodes");
93 std::map<int,int> id_to_barcode_map;
96 for (
const auto&
particle: *(*McEvtCollItr) ) {
108 float thePhi =
particle->momentum().phi();
109 phi.emplace_back( (thePhi<0) ? thePhi+=2*
M_PI : thePhi );
110 eta.emplace_back(
particle->momentum().pseudoRapidity() );
113 id.emplace_back( id_to_barcode_map.at(
particle->id() ));
119 const auto& vertexprod =
particle->production_vertex();
121 const auto&
pos=vertexprod->position();
123 float vtxPhi =
pos.phi();
124 phiVertex.emplace_back( (vtxPhi<0)? vtxPhi+=2*
M_PI : vtxPhi );
127 rhoVertex.emplace_back( 0. );
128 phiVertex.emplace_back( 0. );
129 zVertex.emplace_back( 0. );
132 const auto& vertexend =
particle->end_vertex();
134 const auto&
pos=vertexend->position();
136 float vtxPhi =
pos.phi();
137 phiEndVertex.emplace_back( (vtxPhi<0)? vtxPhi+=2*
M_PI : vtxPhi );
140 rhoEndVertex.emplace_back( 0. );
141 phiEndVertex.emplace_back( 0. );
142 zEndVertex.emplace_back( 0. );
149 myDataMap[
"pt"] = std::move(
pt);
150 myDataMap[
"phi"] = std::move(phi);
151 myDataMap[
"eta"] = std::move(eta);
152 myDataMap[
"code"] = std::move(
code);
153 myDataMap[
"id"] = std::move(
id);
154 myDataMap[
"rhoVertex"] = std::move(rhoVertex);
155 myDataMap[
"phiVertex"] = std::move(phiVertex);
156 myDataMap[
"zVertex"] = std::move(zVertex);
157 myDataMap[
"rhoEndVertex"] = std::move(rhoEndVertex);
158 myDataMap[
"phiEndVertex"] = std::move(phiEndVertex);
159 myDataMap[
"zEndVertex"] = std::move(zEndVertex);