38 m_trksForThisEvent(0),m_nVertices(0),
39 m_collapsePrimaryVertices(iCollapsePrimaryVertices),
40 lastTrack(0),lastHist(0),theLHCTlink(0){}
75 std::vector<std::pair <int, int> >().
swap(
idsave);
95 edm::LogError(
"SimTrackManager") <<
" SimTrackManager::saveTrackAndItsBranch got 0 pointer ";
99 unsigned int parent = trkH->parentID();
100 bool parentExists=
false;
102 TrackContainer::const_iterator tk_itr = std::lower_bound((*m_trksForThisEvent).begin(),(*m_trksForThisEvent).end(),
140 LogDebug(
"SimTrackManager") <<
"Inside the reallyStoreTracks method object to be stored = "
152 unsigned int iParentID = trkH->
parentID();
156 pm = (*m_trksForThisEvent)[iit]->momentum();
162 std::map<uint32_t,std::pair<math::XYZVectorD,math::XYZTLorentzVectorD> >::const_iterator cit =
mapTkCaloStateInfo.find(trkH->
trackID());
163 std::pair<math::XYZVectorD,math::XYZTLorentzVectorD> tcinfo;
165 tcinfo = cit->second;
178 for( std::vector<TrackWithHistory*>::const_iterator it = (*m_trksForThisEvent).begin();
179 it!= (*m_trksForThisEvent).end();it++){
180 if ((*it)->trackID() == uint32_t(parent)){
186 if(check==-1) parent = -1;
188 VertexMap::const_iterator iterator =
m_vertexMap.find(parent);
220 for (
unsigned int itr=0; itr<
idsave.size(); itr++) {
if ((
idsave[itr]).first ==
i) {
id = (
idsave[itr]).
second;
break; } }
232 edm::LogError(
"SimTrackManager") <<
" SimTrackManager::fillMotherList track index corrupted";
254 if ((*m_trksForThisEvent).size() == 0 &&
idsave.size() == 0)
return;
257 LogDebug(
"SimTrackManager") <<
"SimTrackManager::cleanTracksWithHistory has " <<
idsave.size()
258 <<
" mother-daughter relationships stored with lastTrack = " <<
lastTrack;
263 edm::LogError(
"SimTrackManager") <<
" SimTrackManager::cleanTracksWithHistory track index corrupted";
272 <<
" tracks with history before branching";
273 for (
unsigned int it =0; it <(*m_trksForThisEvent).size(); it++)
274 LogDebug(
"SimTrackManager") <<
" 1 - Track in position " << it <<
" G4 track number "
275 << (*m_trksForThisEvent)[it]->trackID()
276 <<
" mother " << (*m_trksForThisEvent)[it]->parentID()
277 <<
" status " << (*m_trksForThisEvent)[it]->saved();
290 if (t->
saved() ==
true)
292 if (it>
num) (*m_trksForThisEvent)[
num] =
t;
294 for (
unsigned int itr=0; itr<
idsave.size(); itr++) {
295 if ((
idsave[itr]).first == g4ID) {
305 (*m_trksForThisEvent).resize(
num);
308 LogDebug(
"SimTrackManager") <<
" AFTER CLEANING, I GET " << (*m_trksForThisEvent).size()
309 <<
" tracks to be saved persistently";
310 for (
unsigned int it = 0; it < (*m_trksForThisEvent).size(); it++)
311 LogDebug(
"SimTrackManager") <<
" Track in position " << it
312 <<
" G4 track number " << (*m_trksForThisEvent)[it]->trackID()
313 <<
" mother " << (*m_trksForThisEvent)[it]->parentID()
314 <<
" Status " << (*m_trksForThisEvent)[it]->saved();
319 lastTrack = (*m_trksForThisEvent).size();
331 if ( genParticleID_ == -1 ) {
continue; }
333 for (
unsigned int itrlink = 0; itrlink < (*theLHCTlink).size(); itrlink++ ) {
334 if ( (*
theLHCTlink)[itrlink].afterHector() == genParticleID_ ) {
void swap(ora::Record &rh, ora::Record &lh)
int getOrCreateVertex(TrackWithHistory *, int, G4SimEvent *simEvent)
double totalEnergy() const
SimTrackManager(bool iCollapsePrimaryVertices=false)
void setGenParticleID(int i)
void cleanTkCaloStateInfoMap()
std::map< uint32_t, std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > > mapTkCaloStateInfo
virtual ~SimTrackManager()
TrackContainer * m_trksForThisEvent
U second(std::pair< T, U > const &p)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
std::vector< TrackWithHistory * > TrackContainer
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
std::vector< std::pair< int, int > > idsave
unsigned int trackID() const
void cleanTracksWithHistory()
std::pair< int, math::XYZVectorD > MapVertexPosition
this map contains association between vertex number and position
MotherParticleToVertexMap m_vertexMap
void storeTracks(G4SimEvent *simEvent)
int idSavedTrack(int) const
std::map< int, MapVertexPositionVector > MotherParticleToVertexMap
const math::XYZVectorD & momentum() const
void saveTrackAndItsBranch(TrackWithHistory *)
this saves a track and all its parents looping over the non ordered vector
double globalTime() const
const edm::LHCTransportLinkContainer * theLHCTlink
void reallyStoreTracks(G4SimEvent *simEvent)
std::vector< std::pair< int, int > > ancestorList
const math::XYZVectorD & vertexPosition() const
int genParticleID() const