10 const std::vector<SimVertex>& theSimVertices) {
13 std::vector<ElectronMCTruth>
result;
29 fill(theSimTracks, theSimVertices);
34 std::vector<SimTrack>::const_iterator iFirstSimTk = theSimTracks.begin();
35 if (!(*iFirstSimTk).noVertex()) {
36 iPV = (*iFirstSimTk).vertIndex();
38 int vtxId = (*iFirstSimTk).vertIndex();
39 primVtx = theSimVertices[vtxId];
68 for (std::vector<SimTrack>::const_iterator iSimTk = theSimTracks.begin(); iSimTk != theSimTracks.end(); ++iSimTk) {
69 if ((*iSimTk).noVertex())
76 if ((*iSimTk).vertIndex() == iPV) {
77 if (
std::abs((*iSimTk).type()) == 11) {
85 std::vector<CLHEP::Hep3Vector> bremPos;
86 std::vector<CLHEP::HepLorentzVector> pBrem;
87 std::vector<float> xBrem;
93 unsigned int eleId = (*iEleTk).
trackId();
94 float remainingEnergy = trLast.
momentum().e();
98 (*iEleTk).momentum().x(), (*iEleTk).momentum().y(), (*iEleTk).momentum().z(), (*iEleTk).momentum().e());
100 int eleVtxIndex = (*iEleTk).vertIndex();
106 for (std::vector<SimTrack>::const_iterator iSimTk = theSimTracks.begin(); iSimTk != theSimTracks.end(); ++iSimTk) {
107 if ((*iSimTk).noVertex())
109 if ((*iSimTk).vertIndex() == iPV)
114 int vertexId1 = (*iSimTk).vertIndex();
115 const SimVertex& vertex1 = theSimVertices[vertexId1];
121 if ((vertexId1 == vertexId2) && ((*iSimTk).type() == (*iEleTk).type()) && trLast.
type() == 22) {
130 float eLoss = remainingEnergy - ((*iSimTk).momentum() + trLast.
momentum()).
e();
141 if (theSimTracks[
motherId].trackId() == eleId) {
143 eleId = (*iSimTk).trackId();
144 remainingEnergy = (*iSimTk).momentum().e();
145 motherMomentum = (*iSimTk).momentum();
147 pBrem.push_back(CLHEP::HepLorentzVector(
149 bremPos.push_back(CLHEP::HepLorentzVector(
151 xBrem.push_back(
eLoss);
163 CLHEP::HepLorentzVector tmpEleMom(primEleMom.px(), primEleMom.py(), primEleMom.pz(), primEleMom.e());
164 CLHEP::HepLorentzVector tmpVtxPos(primVtxPos.x(), primVtxPos.y(), primVtxPos.z(), primVtxPos.t());
165 result.push_back(
ElectronMCTruth(tmpEleMom, eleVtxIndex, bremPos, pBrem, xBrem, tmpVtxPos, (*iEleTk)));
184 for (
unsigned it = 0;
it < nTks; ++
it) {
std::map< unsigned, unsigned > geantToIndex_
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
const math::XYZTLorentzVectorD & position() const
void fill(const std::vector< SimTrack > &theSimTracks, const std::vector< SimVertex > &theSimVertices)
virtual ~ElectronMCTruthFinder()
const math::XYZTLorentzVectorD & momentum() const
std::tuple< layerClusterToCaloParticle, caloParticleToLayerCluster > association
int type() const
particle type (HEP PDT convension)
int vertIndex() const
index of the vertex in the Event container (-1 if no vertex)
Abs< T >::type abs(const T &t)
std::vector< ElectronMCTruth > find(const std::vector< SimTrack > &simTracks, const std::vector< SimVertex > &simVertices)
unsigned int trackId() const
if(threadIdxLocalY==0 &&threadIdxLocalX==0)