10 const std::vector<SimVertex>& theSimVertices) {
13 std::vector<ElectronMCTruth>
result;
26 std::vector<SimTrack> electronTracks;
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];
69 for (std::vector<SimTrack>::const_iterator iSimTk = theSimTracks.begin(); iSimTk != theSimTracks.end(); ++iSimTk) {
70 if ((*iSimTk).noVertex())
77 if ((*iSimTk).vertIndex() == iPV) {
79 if (
std::abs((*iSimTk).type()) == 11) {
81 electronTracks.push_back(*iSimTk);
108 std::vector<CLHEP::Hep3Vector> bremPos;
109 std::vector<CLHEP::HepLorentzVector> pBrem;
110 std::vector<float> xBrem;
112 for (std::vector<SimTrack>::iterator iEleTk = electronTracks.begin(); iEleTk != electronTracks.end(); ++iEleTk) {
116 unsigned int eleId = (*iEleTk).
trackId();
117 float remainingEnergy = trLast.
momentum().e();
121 (*iEleTk).momentum().x(), (*iEleTk).momentum().y(), (*iEleTk).momentum().z(), (*iEleTk).momentum().e());
123 int eleVtxIndex = (*iEleTk).vertIndex();
129 for (std::vector<SimTrack>::const_iterator iSimTk = theSimTracks.begin(); iSimTk != theSimTracks.end(); ++iSimTk) {
130 if ((*iSimTk).noVertex())
132 if ((*iSimTk).vertIndex() == iPV)
137 int vertexId1 = (*iSimTk).vertIndex();
138 SimVertex vertex1 = theSimVertices[vertexId1];
144 if ((vertexId1 == vertexId2) && ((*iSimTk).type() == (*iEleTk).type()) && trLast.
type() == 22) {
153 float eLoss = remainingEnergy - ((*iSimTk).momentum() + trLast.
momentum()).
e();
160 motherId = association->second;
164 if (theSimTracks[motherId].trackId() == eleId) {
166 eleId = (*iSimTk).trackId();
167 remainingEnergy = (*iSimTk).momentum().e();
168 motherMomentum = (*iSimTk).momentum();
170 pBrem.push_back(CLHEP::HepLorentzVector(
172 bremPos.push_back(CLHEP::HepLorentzVector(
174 xBrem.push_back(eLoss);
186 CLHEP::HepLorentzVector tmpEleMom(primEleMom.px(), primEleMom.py(), primEleMom.pz(), primEleMom.e());
187 CLHEP::HepLorentzVector tmpVtxPos(primVtxPos.x(), primVtxPos.y(), primVtxPos.z(), primVtxPos.t());
188 result.push_back(
ElectronMCTruth(tmpEleMom, eleVtxIndex, bremPos, pBrem, xBrem, tmpVtxPos, (*iEleTk)));
198 unsigned nVtx = simVertices.size();
199 unsigned nTks = simTracks.size();
207 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.
void fill(const std::vector< SimTrack > &theSimTracks, const std::vector< SimVertex > &theSimVertices)
virtual ~ElectronMCTruthFinder()
std::tuple< layerClusterToCaloParticle, caloParticleToLayerCluster > association
if(conf_.getParameter< bool >("UseStripCablingDB"))
Abs< T >::type abs(const T &t)
const math::XYZTLorentzVectorD & position() const
int vertIndex() const
index of the vertex in the Event container (-1 if no vertex)
unsigned int trackId() const
int type() const
particle type (HEP PDT convension)
const math::XYZTLorentzVectorD & momentum() const
std::vector< ElectronMCTruth > find(const std::vector< SimTrack > &simTracks, const std::vector< SimVertex > &simVertices)