23 std::vector<ElectronMCTruth>
result;
29 const int ELECTRON_FLAV=1;
30 const int PIZERO_FLAV=2;
31 const int PHOTON_FLAV=3;
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];
52 partType1 = (*iFirstSimTk).type();
68 if ( iFirstSimTk!= theSimTracks.end() ) {
70 if ( (*iFirstSimTk).vertIndex() == iPV) {
71 partType2 = (*iFirstSimTk).type();
83 for (std::vector<SimTrack>::iterator iSimTk = theSimTracks.begin(); iSimTk != theSimTracks.end(); ++iSimTk){
84 if ( (*iSimTk).noVertex() )
continue;
86 int vertexId = (*iSimTk).vertIndex();
87 SimVertex vertex = theSimVertices[vertexId];
90 if ( (*iSimTk).vertIndex() == iPV ) {
92 if (
std::abs((*iSimTk).type() ) == 11) {
94 electronTracks.push_back( *iSimTk );
103 }
else if(npv == 1) {
105 ievtype = SINGLE; ievflav = ELECTRON_FLAV;
106 }
else if(partType1 == 111) {
107 ievtype = SINGLE; ievflav = PIZERO_FLAV;
108 }
else if(partType1 == 22) {
109 ievtype = SINGLE; ievflav = PHOTON_FLAV;
111 }
else if(npv == 2) {
113 ievtype = DOUBLE; ievflav = ELECTRON_FLAV;
114 }
else if(partType1 == 111 && partType2 == 111) {
115 ievtype = DOUBLE; ievflav = PIZERO_FLAV;
116 }
else if(partType1 == 22 && partType2 == 22) {
117 ievtype = DOUBLE; ievflav = PHOTON_FLAV;
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];
161 SimVertex vertex2 = theSimVertices[vertexId2];
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) ) ) ;
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)
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
particle info...
perl if(1 lt scalar(@::datatypes))