23 std::vector<ElectronMCTruth>
result;
37 std::vector<SimTrack> electronTracks;
40 fill(theSimTracks, theSimVertices);
45 std::vector<SimTrack>::iterator iFirstSimTk = theSimTracks.begin();
46 if ( !(*iFirstSimTk).noVertex() ) {
47 iPV = (*iFirstSimTk).vertIndex();
49 int vtxId = (*iFirstSimTk).vertIndex();
50 primVtx = theSimVertices[vtxId];
83 for (std::vector<SimTrack>::iterator iSimTk = theSimTracks.begin(); iSimTk != theSimTracks.end(); ++iSimTk){
84 if ( (*iSimTk).noVertex() )
continue;
90 if ( (*iSimTk).vertIndex() == iPV ) {
92 if (
std::abs((*iSimTk).type() ) == 11) {
94 electronTracks.push_back( *iSimTk );
124 std::vector<CLHEP::Hep3Vector> bremPos;
125 std::vector<CLHEP::HepLorentzVector> pBrem;
126 std::vector<float> xBrem;
129 for (std::vector<SimTrack>::iterator iEleTk = electronTracks.begin(); iEleTk != electronTracks.end(); ++iEleTk){
135 unsigned int eleId = (*iEleTk).
trackId();
136 float remainingEnergy =trLast.
momentum().e();
140 (*iEleTk).momentum().y(),
141 (*iEleTk).momentum().z(),
142 (*iEleTk).momentum().e());
144 int eleVtxIndex= (*iEleTk).vertIndex();
151 for (std::vector<SimTrack>::iterator iSimTk = theSimTracks.begin(); iSimTk != theSimTracks.end(); ++iSimTk){
153 if ( (*iSimTk).noVertex() )
continue;
154 if ( (*iSimTk).vertIndex() == iPV )
continue;
158 int vertexId1 = (*iSimTk).vertIndex();
159 SimVertex vertex1 = theSimVertices[vertexId1];
166 if( ( vertexId1 == vertexId2 ) && ( (*iSimTk).type() == (*iEleTk).type() ) && trLast.
type() == 22 ) {
175 float eLoss = remainingEnergy - ( (*iSimTk).momentum() + trLast.
momentum()).
e();
182 std::map<unsigned, unsigned >::iterator association =
geantToIndex_.find( motherGeantId );
184 motherId = association->second;
188 if ( theSimTracks[motherId].trackId() == eleId ) {
191 eleId= (*iSimTk).trackId();
192 remainingEnergy = (*iSimTk).momentum().e();
193 motherMomentum = (*iSimTk).momentum();
196 pBrem.push_back( CLHEP::HepLorentzVector(trLast.
momentum().px(),trLast.
momentum().py(),
198 bremPos.push_back( CLHEP::HepLorentzVector(vertex1.
position().x(),vertex1.
position().y(),
200 xBrem.push_back(eLoss);
217 CLHEP::HepLorentzVector tmpEleMom(primEleMom.px(),primEleMom.py(),
218 primEleMom.pz(),primEleMom.e() ) ;
219 CLHEP::HepLorentzVector tmpVtxPos(primVtxPos.x(),primVtxPos.y(),primVtxPos.z(),primVtxPos.t());
220 result.push_back (
ElectronMCTruth( tmpEleMom, eleVtxIndex, bremPos, pBrem, xBrem, tmpVtxPos,(*iEleTk) ) ) ;
233 std::vector<SimVertex>& simVertices ) {
236 unsigned nVtx = simVertices.size();
237 unsigned nTks = simTracks.size();
240 if ( nVtx == 0 )
return;
244 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(std::vector< SimTrack > &theSimTracks, std::vector< SimVertex > &theSimVertices)
virtual ~ElectronMCTruthFinder()
const math::XYZTLorentzVectorD & position() const
std::vector< ElectronMCTruth > find(std::vector< SimTrack > simTracks, std::vector< SimVertex > simVertices)
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
particle info...
perl if(1 lt scalar(@::datatypes))