CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
SimTrackManager Class Reference

#include <SimG4Core/Application/interface/SimTrackManager.h>

Classes

class  StrictWeakOrdering
 

Public Types

typedef std::pair< int,
math::XYZVectorD
MapVertexPosition
 this map contains association between vertex number and position More...
 
typedef std::vector< std::pair
< int, math::XYZVectorD > > 
MapVertexPositionVector
 
typedef std::map< int,
MapVertexPositionVector
MotherParticleToVertexMap
 
typedef MotherParticleToVertexMap VertexMap
 

Public Member Functions

void addTkCaloStateInfo (uint32_t t, const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &p)
 
void addTrack (TrackWithHistory *iTrack, bool inHistory, bool withAncestor)
 
void cleanTkCaloStateInfoMap ()
 
void cleanTracksWithHistory ()
 
void deleteTracks ()
 
int giveMotherNeeded (int i) const
 
void reset ()
 
void setCollapsePrimaryVertices (bool iSet)
 
void setLHCTransportLink (const edm::LHCTransportLinkContainer *thisLHCTlink)
 
 SimTrackManager (bool iCollapsePrimaryVertices=false)
 
void storeTracks (G4SimEvent *simEvent)
 
const TrackContainertrackContainer () const
 
bool trackExists (unsigned int i) const
 
virtual ~SimTrackManager ()
 

Private Member Functions

void cleanVertexMap ()
 
void fillMotherList ()
 
int getOrCreateVertex (TrackWithHistory *, int, G4SimEvent *simEvent)
 
int idSavedTrack (int) const
 
const SimTrackManageroperator= (const SimTrackManager &)
 
void reallyStoreTracks (G4SimEvent *simEvent)
 
void resetGenID ()
 
void saveTrackAndItsBranch (TrackWithHistory *)
 this saves a track and all its parents looping over the non ordered vector More...
 
 SimTrackManager (const SimTrackManager &)
 

Private Attributes

std::vector< std::pair< int,
int > > 
ancestorList
 
std::vector< std::pair< int,
int > > 
idsave
 
unsigned int lastHist
 
unsigned int lastTrack
 
bool m_collapsePrimaryVertices
 
int m_nVertices
 
bool m_SaveSimTracks
 
TrackContainerm_trksForThisEvent
 
MotherParticleToVertexMap m_vertexMap
 
std::map< uint32_t, std::pair
< math::XYZVectorD,
math::XYZTLorentzVectorD > > 
mapTkCaloStateInfo
 
const
edm::LHCTransportLinkContainer
theLHCTlink
 

Detailed Description

Description: Holds tracking information used by the sensitive detectors

Usage: <usage>

Definition at line 34 of file SimTrackManager.h.

Member Typedef Documentation

this map contains association between vertex number and position

Definition at line 46 of file SimTrackManager.h.

typedef std::vector<std::pair<int,math::XYZVectorD> > SimTrackManager::MapVertexPositionVector

Definition at line 47 of file SimTrackManager.h.

Definition at line 48 of file SimTrackManager.h.

Definition at line 49 of file SimTrackManager.h.

Constructor & Destructor Documentation

SimTrackManager::SimTrackManager ( bool  iCollapsePrimaryVertices = false)

Definition at line 38 of file SimTrackManager.cc.

38  :
40  m_collapsePrimaryVertices(iCollapsePrimaryVertices),
41  lastTrack(0),lastHist(0),theLHCTlink(0){}
bool m_collapsePrimaryVertices
unsigned int lastHist
TrackContainer * m_trksForThisEvent
unsigned int lastTrack
const edm::LHCTransportLinkContainer * theLHCTlink
SimTrackManager::~SimTrackManager ( )
virtual

Definition at line 44 of file SimTrackManager.cc.

References deleteTracks(), and m_trksForThisEvent.

45 {
46  if ( m_trksForThisEvent != 0 ) deleteTracks() ;
47 }
TrackContainer * m_trksForThisEvent
SimTrackManager::SimTrackManager ( const SimTrackManager )
private

Member Function Documentation

void SimTrackManager::addTkCaloStateInfo ( uint32_t  t,
const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &  p 
)
inline

Definition at line 79 of file SimTrackManager.h.

References mapTkCaloStateInfo.

Referenced by EventAction::addTkCaloStateInfo().

81  {
82  std::map<uint32_t,std::pair<math::XYZVectorD,math::XYZTLorentzVectorD> >::const_iterator it =
83  mapTkCaloStateInfo.find(t);
84 
85  if (it == mapTkCaloStateInfo.end()) {
86  mapTkCaloStateInfo.insert(std::pair<uint32_t,std::pair<math::XYZVectorD,math::XYZTLorentzVectorD> >(t,p));
87  }
88  }
std::map< uint32_t, std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > > mapTkCaloStateInfo
void SimTrackManager::addTrack ( TrackWithHistory iTrack,
bool  inHistory,
bool  withAncestor 
)
inline

Definition at line 69 of file SimTrackManager.h.

References ancestorList, idsave, m_trksForThisEvent, TrackWithHistory::parentID(), and TrackWithHistory::trackID().

Referenced by EventAction::addTrack().

69  {
70  std::pair<int, int> thePair(iTrack->trackID(),iTrack->parentID());
71  idsave.push_back(thePair);
72  if (inHistory) { m_trksForThisEvent->push_back(iTrack); }
73  if (withAncestor) {
74  std::pair<int,int> thisPair(iTrack->trackID(),0);
75  ancestorList.push_back(thisPair);
76  }
77  }
TrackContainer * m_trksForThisEvent
std::vector< std::pair< int, int > > idsave
unsigned int trackID() const
int parentID() const
std::vector< std::pair< int, int > > ancestorList
void SimTrackManager::cleanTkCaloStateInfoMap ( )

Definition at line 208 of file SimTrackManager.cc.

References mapTkCaloStateInfo, and swap().

Referenced by EventAction::EndOfEventAction(), and reset().

209 {
210  mapTkCaloStateInfo.clear();
211  std::map<uint32_t,std::pair<math::XYZVectorD,math::XYZTLorentzVectorD > >().swap(mapTkCaloStateInfo);
212 }
void swap(ora::Record &rh, ora::Record &lh)
Definition: Record.h:70
std::map< uint32_t, std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > > mapTkCaloStateInfo
void SimTrackManager::cleanTracksWithHistory ( )

Definition at line 305 of file SimTrackManager.cc.

References fillMotherList(), idsave, lastTrack, LogDebug, m_trksForThisEvent, pileupDistInMC::num, TrackWithHistory::saved(), saveTrackAndItsBranch(), edm::second(), lumiQTWidget::t, and TrackWithHistory::trackID().

Referenced by EventAction::prepareForNewPrimary(), and storeTracks().

305  {
306 
307  using namespace std;
308 
309  if ((*m_trksForThisEvent).size() == 0 && idsave.size() == 0) { return; }
310 
311 #ifdef DebugLog
312  LogDebug("SimTrackManager")
313  << "SimTrackManager::cleanTracksWithHistory has "
314  << idsave.size()
315  << " mother-daughter relationships stored with lastTrack = " << lastTrack;
316 #endif
317 
318  if ( lastTrack > 0 && lastTrack >= (*m_trksForThisEvent).size() ) {
319  lastTrack = 0;
320  edm::LogError("SimTrackManager")
321  << " SimTrackManager::cleanTracksWithHistory track index corrupted";
322  }
323 
324  stable_sort(m_trksForThisEvent->begin()+lastTrack,m_trksForThisEvent->end(),trkIDLess());
325 
326  stable_sort(idsave.begin(),idsave.end());
327 
328 #ifdef DebugLog
329  LogDebug("SimTrackManager")
330  << " SimTrackManager::cleanTracksWithHistory knows " << m_trksForThisEvent->size()
331  << " tracks with history before branching";
332  for (unsigned int it =0; it <(*m_trksForThisEvent).size(); it++) {
333  LogDebug("SimTrackManager")
334  << " 1 - Track in position " << it << " G4 track number "
335  << (*m_trksForThisEvent)[it]->trackID()
336  << " mother " << (*m_trksForThisEvent)[it]->parentID()
337  << " status " << (*m_trksForThisEvent)[it]->saved();
338  }
339 #endif
340 
341  for (unsigned int it = lastTrack; it < m_trksForThisEvent->size(); it++)
342  {
343  TrackWithHistory * t = (*m_trksForThisEvent)[it];
344  if (t->saved()) { saveTrackAndItsBranch(t); }
345  }
346  unsigned int num = lastTrack;
347  for (unsigned int it = lastTrack; it < m_trksForThisEvent->size(); it++)
348  {
349  TrackWithHistory * t = (*m_trksForThisEvent)[it];
350  int g4ID = t->trackID();
351  if (t->saved() == true)
352  {
353  if (it>num) (*m_trksForThisEvent)[num] = t;
354  num++;
355  for (unsigned int itr=0; itr<idsave.size(); itr++) {
356  if ((idsave[itr]).first == g4ID) {
357  (idsave[itr]).second = g4ID;
358  break;
359  }
360  }
361  }
362  else
363  {
364  delete t;
365  }
366  }
367 
368  (*m_trksForThisEvent).resize(num);
369 
370 #ifdef DebugLog
371  LogDebug("SimTrackManager")
372  << " AFTER CLEANING, I GET " << (*m_trksForThisEvent).size()
373  << " tracks to be saved persistently";
374  for (unsigned int it = 0; it < (*m_trksForThisEvent).size(); it++) {
375  LogDebug("SimTrackManager")
376  << " Track in position " << it
377  << " G4 track number " << (*m_trksForThisEvent)[it]->trackID()
378  << " mother " << (*m_trksForThisEvent)[it]->parentID()
379  << " Status " << (*m_trksForThisEvent)[it]->saved();
380  }
381 #endif
382 
383  fillMotherList();
384 
385  lastTrack = (*m_trksForThisEvent).size();
386 
387 }
#define LogDebug(id)
bool saved() const
TrackContainer * m_trksForThisEvent
U second(std::pair< T, U > const &p)
std::vector< std::pair< int, int > > idsave
unsigned int trackID() const
void saveTrackAndItsBranch(TrackWithHistory *)
this saves a track and all its parents looping over the non ordered vector
unsigned int lastTrack
void SimTrackManager::cleanVertexMap ( )
private

Definition at line 201 of file SimTrackManager.cc.

References m_nVertices, and m_vertexMap.

Referenced by reset().

202 {
203  m_vertexMap.clear();
205  m_nVertices=0;
206 }
MotherParticleToVertexMap m_vertexMap
std::map< int, MapVertexPositionVector > MotherParticleToVertexMap
void SimTrackManager::deleteTracks ( )

Definition at line 71 of file SimTrackManager.cc.

References i, and m_trksForThisEvent.

Referenced by EventAction::EndOfEventAction(), and ~SimTrackManager().

72 {
73  for (unsigned int i = 0; i < m_trksForThisEvent->size(); i++) {
74  delete (*m_trksForThisEvent)[i];
75  }
76  delete m_trksForThisEvent;
78 }
int i
Definition: DBlmapReader.cc:9
TrackContainer * m_trksForThisEvent
void SimTrackManager::fillMotherList ( )
private

Definition at line 269 of file SimTrackManager.cc.

References ancestorList, first, idsave, idSavedTrack(), lastHist, LogDebug, and n.

Referenced by cleanTracksWithHistory().

270 {
271  if ( ancestorList.size() > 0 && lastHist > ancestorList.size() ) {
272  lastHist = ancestorList.size();
273  edm::LogError("SimTrackManager")
274  << " SimTrackManager::fillMotherList track index corrupted";
275  }
276  /*
277  std::cout << "### SimTrackManager::fillMotherList: "
278  << idsave.size() << " saved; ancestor: " << lastHist
279  << " " << ancestorList.size() << std::endl;
280  for (unsigned int i = 0; i< idsave.size(); ++i) {
281  std::cout << " ISV: Track ID = " << (idsave[i]).first
282  << " Mother ID = " << (idsave[i]).second << std::endl;
283  }
284  */
285  for (unsigned int n = lastHist; n < ancestorList.size(); n++) {
286 
287  int theMotherId = idSavedTrack((ancestorList[n]).first);
288  ancestorList[n].second = theMotherId;
289  /*
290  std::cout << " ANC: Track ID = " << (ancestorList[n]).first
291  << " Mother ID = " << (ancestorList[n]).second << std::endl;
292  */
293 #ifdef DebugLog
294  LogDebug("SimTrackManager") << "Track ID = " << (ancestorList[n]).first
295  << " Mother ID = " << (ancestorList[n]).second;
296 #endif
297  }
298 
299  lastHist = ancestorList.size();
300 
301  idsave.clear();
302 
303 }
#define LogDebug(id)
unsigned int lastHist
std::vector< std::pair< int, int > > idsave
int idSavedTrack(int) const
bool first
Definition: L1TdeRCT.cc:79
std::vector< std::pair< int, int > > ancestorList
int SimTrackManager::getOrCreateVertex ( TrackWithHistory trkH,
int  iParentID,
G4SimEvent simEvent 
)
private

Definition at line 164 of file SimTrackManager.cc.

References G4SimEvent::add(), CastorDataFrameFilter_impl::check(), TrackWithHistory::creatorProcess(), first, TrackWithHistory::globalTime(), gen::k, m_nVertices, m_vertexMap, dbtoconf::parent, mathSSE::sqrt(), and TrackWithHistory::vertexPosition().

Referenced by reallyStoreTracks().

166 {
167  int parent = iParentID;
168  int check = -1;
169 
170  for( std::vector<TrackWithHistory*>::const_iterator it = (*m_trksForThisEvent).begin();
171  it!= (*m_trksForThisEvent).end();it++)
172  {
173  if ((*it)->trackID() == uint32_t(parent)) {
174  check = 0;
175  break;
176  }
177  }
178 
179  if(check==-1) { parent = -1; }
180 
181  VertexMap::const_iterator iterator = m_vertexMap.find(parent);
182  if (iterator != m_vertexMap.end()) {
183 
184  // loop over saved vertices
185  for(unsigned int k=0; k<m_vertexMap[parent].size(); k++){
186  if(sqrt((trkH->vertexPosition()-(((m_vertexMap[parent])[k]).second)).Mag2())<0.001)
187  { return (((m_vertexMap[parent])[k]).first); }
188  }
189  }
190 
191  unsigned int ptype = 0;
192  const G4VProcess* pr = trkH->creatorProcess();
193  if(pr) { ptype = pr->GetProcessSubType(); }
194  simEvent->add(new G4SimVertex(trkH->vertexPosition(),trkH->globalTime(),parent,ptype));
196  m_nVertices++;
197  return (m_nVertices-1);
198 
199 }
list parent
Definition: dbtoconf.py:74
void add(G4SimTrack *t)
Definition: G4SimEvent.h:35
T sqrt(T t)
Definition: SSEVec.h:48
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
std::pair< int, math::XYZVectorD > MapVertexPosition
this map contains association between vertex number and position
MotherParticleToVertexMap m_vertexMap
bool first
Definition: L1TdeRCT.cc:79
int k[5][pyjets_maxn]
const G4VProcess * creatorProcess() const
double globalTime() const
const math::XYZVectorD & vertexPosition() const
int SimTrackManager::giveMotherNeeded ( int  i) const
inline

Definition at line 92 of file SimTrackManager.h.

References i, idsave, and edm::second().

Referenced by CaloSD::saveHit().

92  {
93  int theResult = 0;
94  for (unsigned int itr=0; itr<idsave.size(); itr++) {
95  if ((idsave[itr]).first == i) { theResult = (idsave[itr]).second; break; }
96  }
97  return theResult ;
98  }
int i
Definition: DBlmapReader.cc:9
U second(std::pair< T, U > const &p)
std::vector< std::pair< int, int > > idsave
int SimTrackManager::idSavedTrack ( int  id) const
private

Definition at line 214 of file SimTrackManager.cc.

References ancestorList, first, idsave, j, n, notFound, and edm::second().

Referenced by fillMotherList().

215 {
216  int idMother = id;
217  if(id > 0) {
218  unsigned int n = idsave.size();
219  if(0 < n) {
220  int jmax = n - 1;
221  int j, id1;
222 
223  // first loop forward
224  bool notFound = true;
225  for(j=0; j<=jmax; ++j) {
226  if((idsave[j]).first == idMother) {
227  id1 = (idsave[j]).second;
228  if(0 == id1 || id1 == idMother) { return id1; }
229  jmax = j - 1;
230  idMother = id1;
231  notFound = false;
232  break;
233  }
234  }
235  if(notFound) { return 0; }
236 
237  // recursive loop
238  do {
239 
240  notFound = true;
241  // search ID scan backward
242  for(j=jmax; j>=0; --j) {
243  if((idsave[j]).first == idMother) {
244  id1 = (idsave[j]).second;
245  if(0 == id1 || id1 == idMother) { return id1; }
246  jmax = j - 1;
247  idMother = id1;
248  notFound = false;
249  break;
250  }
251  }
252  if(notFound) {
253  // ID not in the list of saved track - look into ancestors
254  jmax = ancestorList.size()-1;
255  for(j=jmax; j>=0; --j) {
256  if((ancestorList[j]).first == idMother) {
257  idMother = (ancestorList[j]).second;
258  return idMother;
259  }
260  }
261  return 0;
262  }
263  } while (!notFound);
264  }
265  }
266  return idMother;
267 }
U second(std::pair< T, U > const &p)
std::vector< std::pair< int, int > > idsave
int j
Definition: DBlmapReader.cc:9
bool first
Definition: L1TdeRCT.cc:79
static const GlobalPoint notFound(0, 0, 0)
std::vector< std::pair< int, int > > ancestorList
const SimTrackManager& SimTrackManager::operator= ( const SimTrackManager )
private
void SimTrackManager::reallyStoreTracks ( G4SimEvent simEvent)
private

Definition at line 124 of file SimTrackManager.cc.

References G4SimEvent::add(), TrackWithHistory::genParticleID(), getOrCreateVertex(), LogDebug, m_trksForThisEvent, mapTkCaloStateInfo, TrackWithHistory::momentum(), TrackWithHistory::parentID(), TrackWithHistory::particleID(), TrackWithHistory::totalEnergy(), and TrackWithHistory::trackID().

Referenced by storeTracks().

125 {
126  // loop over the (now ordered) vector and really save the tracks
127 #ifdef DebugLog
128  LogDebug("SimTrackManager")
129  << "Inside the reallyStoreTracks method object to be stored = "
130  << m_trksForThisEvent->size();
131 #endif
132 
133  for (unsigned int it = 0; it < m_trksForThisEvent->size(); it++)
134  {
135  TrackWithHistory * trkH = (*m_trksForThisEvent)[it];
136  // at this stage there is one vertex per track,
137  // so the vertex id of track N is also N
138  int ivertex = -1;
139  int ig;
140 
141  math::XYZVectorD pm(0.,0.,0.);
142  unsigned int iParentID = trkH->parentID();
143  for(unsigned int iit = 0; iit < m_trksForThisEvent->size(); iit++)
144  {
145  if((*m_trksForThisEvent)[iit]->trackID()==iParentID){
146  pm = (*m_trksForThisEvent)[iit]->momentum();
147  break;
148  }
149  }
150  ig = trkH->genParticleID();
151  ivertex = getOrCreateVertex(trkH,iParentID,simEvent);
152  std::map<uint32_t,std::pair<math::XYZVectorD,math::XYZTLorentzVectorD> >::const_iterator cit =
153  mapTkCaloStateInfo.find(trkH->trackID());
154  std::pair<math::XYZVectorD,math::XYZTLorentzVectorD> tcinfo;
155  if (cit != mapTkCaloStateInfo.end()){
156  tcinfo = cit->second;
157  }
158  simEvent->add(new G4SimTrack(trkH->trackID(),trkH->particleID(),
159  trkH->momentum(),trkH->totalEnergy(),
160  ivertex,ig,pm,tcinfo.first,tcinfo.second));
161  }
162 }
#define LogDebug(id)
int getOrCreateVertex(TrackWithHistory *, int, G4SimEvent *simEvent)
double totalEnergy() const
std::map< uint32_t, std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > > mapTkCaloStateInfo
TrackContainer * m_trksForThisEvent
void add(G4SimTrack *t)
Definition: G4SimEvent.h:35
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
unsigned int trackID() const
int particleID() const
int parentID() const
const math::XYZVectorD & momentum() const
int genParticleID() const
void SimTrackManager::reset ( void  )

Definition at line 52 of file SimTrackManager.cc.

References ancestorList, cleanTkCaloStateInfoMap(), cleanVertexMap(), i, idsave, lastHist, lastTrack, m_trksForThisEvent, and swap().

Referenced by EventAction::BeginOfEventAction().

53 {
55  else
56  {
57  for (unsigned int i = 0; i < m_trksForThisEvent->size(); i++) {
58  delete (*m_trksForThisEvent)[i];
59  }
60  delete m_trksForThisEvent;
62  }
65  std::vector<std::pair <int, int> >().swap(idsave);
66  ancestorList.clear();
67  lastTrack=0;
68  lastHist=0;
69 }
void swap(ora::Record &rh, ora::Record &lh)
Definition: Record.h:70
int i
Definition: DBlmapReader.cc:9
void cleanTkCaloStateInfoMap()
unsigned int lastHist
TrackContainer * m_trksForThisEvent
std::vector< TrackWithHistory * > TrackContainer
Definition: TrackContainer.h:8
std::vector< std::pair< int, int > > idsave
unsigned int lastTrack
std::vector< std::pair< int, int > > ancestorList
void SimTrackManager::resetGenID ( )
private

Definition at line 389 of file SimTrackManager.cc.

References TrackWithHistory::genParticleID(), m_trksForThisEvent, TrackWithHistory::setGenParticleID(), and theLHCTlink.

Referenced by storeTracks().

390 {
391  if ( theLHCTlink == 0 ) return;
392 
393  for (unsigned int it = 0; it < m_trksForThisEvent->size(); it++)
394  {
395  TrackWithHistory * trkH = (*m_trksForThisEvent)[it];
396  int genParticleID_ = trkH->genParticleID();
397  if ( genParticleID_ == -1 ) { continue; }
398  else {
399  for ( unsigned int itrlink = 0; itrlink < (*theLHCTlink).size(); itrlink++ ) {
400  if ( (*theLHCTlink)[itrlink].afterHector() == genParticleID_ ) {
401  trkH->setGenParticleID( (*theLHCTlink)[itrlink].beforeHector() );
402  continue;
403  }
404  }
405  }
406  }
407 
408  theLHCTlink = 0;
409 
410 }
void setGenParticleID(int i)
TrackContainer * m_trksForThisEvent
const edm::LHCTransportLinkContainer * theLHCTlink
int genParticleID() const
void SimTrackManager::saveTrackAndItsBranch ( TrackWithHistory trkWHist)
private

this saves a track and all its parents looping over the non ordered vector

Definition at line 81 of file SimTrackManager.cc.

References m_trksForThisEvent, and dbtoconf::parent.

Referenced by cleanTracksWithHistory().

82 {
83  using namespace std;
84  TrackWithHistory * trkH = trkWHist;
85  if (trkH == 0)
86  {
87  edm::LogError("SimTrackManager")
88  << " SimTrackManager::saveTrackAndItsBranch got 0 pointer ";
89  abort();
90  }
91  trkH->save();
92  unsigned int parent = trkH->parentID();
93 
94  TrackContainer::const_iterator tk_itr =
95  std::lower_bound((*m_trksForThisEvent).begin(),(*m_trksForThisEvent).end(),
97 
98  TrackWithHistory * tempTk = *tk_itr;
99 
100  if (tk_itr!=m_trksForThisEvent->end() && (*tk_itr)->trackID()==parent) {
101  saveTrackAndItsBranch(tempTk);
102  }
103 }
list parent
Definition: dbtoconf.py:74
TrackContainer * m_trksForThisEvent
void saveTrackAndItsBranch(TrackWithHistory *)
this saves a track and all its parents looping over the non ordered vector
void SimTrackManager::setCollapsePrimaryVertices ( bool  iSet)
inline

Definition at line 89 of file SimTrackManager.h.

References m_collapsePrimaryVertices.

Referenced by EventAction::EventAction().

89  {
91  }
bool m_collapsePrimaryVertices
void SimTrackManager::setLHCTransportLink ( const edm::LHCTransportLinkContainer thisLHCTlink)
inline

Definition at line 108 of file SimTrackManager.h.

References theLHCTlink.

108  {
109  theLHCTlink = thisLHCTlink;
110  }
const edm::LHCTransportLinkContainer * theLHCTlink
void SimTrackManager::storeTracks ( G4SimEvent simEvent)

Definition at line 105 of file SimTrackManager.cc.

References ancestorList, cleanTracksWithHistory(), idsave, m_trksForThisEvent, reallyStoreTracks(), resetGenID(), and swap().

Referenced by EventAction::EndOfEventAction().

106 {
108 
109  // fill the map with the final mother-daughter relationship
110  idsave.swap(ancestorList);
111  stable_sort(idsave.begin(),idsave.end());
112 
113  std::vector<std::pair<int,int> >().swap(ancestorList);
114 
115  // to get a backward compatible order
116  stable_sort(m_trksForThisEvent->begin(),m_trksForThisEvent->end(),trkIDLess());
117 
118  // to reset the GenParticle ID of a SimTrack to its pre-LHCTransport value
119  resetGenID();
120 
121  reallyStoreTracks(simEvent);
122 }
void swap(ora::Record &rh, ora::Record &lh)
Definition: Record.h:70
TrackContainer * m_trksForThisEvent
std::vector< std::pair< int, int > > idsave
void cleanTracksWithHistory()
void reallyStoreTracks(G4SimEvent *simEvent)
std::vector< std::pair< int, int > > ancestorList
const TrackContainer* SimTrackManager::trackContainer ( ) const
inline

Definition at line 55 of file SimTrackManager.h.

References m_trksForThisEvent.

Referenced by EventAction::trackContainer(), and CaloSD::update().

55  {
56  return m_trksForThisEvent;
57  }
TrackContainer * m_trksForThisEvent
bool SimTrackManager::trackExists ( unsigned int  i) const
inline

Definition at line 99 of file SimTrackManager.h.

References i, and m_trksForThisEvent.

Referenced by CaloSD::saveHit().

99  {
100  bool flag = false;
101  for (unsigned int itr=0; itr<(*m_trksForThisEvent).size(); ++itr) {
102  if ((*m_trksForThisEvent)[itr]->trackID() == i) {
103  flag = true; break;
104  }
105  }
106  return flag;
107  }
int i
Definition: DBlmapReader.cc:9
TrackContainer * m_trksForThisEvent

Member Data Documentation

std::vector<std::pair<int, int> > SimTrackManager::ancestorList
private

Definition at line 136 of file SimTrackManager.h.

Referenced by addTrack(), fillMotherList(), idSavedTrack(), reset(), and storeTracks().

std::vector< std::pair<int, int> > SimTrackManager::idsave
private
unsigned int SimTrackManager::lastHist
private

Definition at line 139 of file SimTrackManager.h.

Referenced by fillMotherList(), and reset().

unsigned int SimTrackManager::lastTrack
private

Definition at line 138 of file SimTrackManager.h.

Referenced by cleanTracksWithHistory(), and reset().

bool SimTrackManager::m_collapsePrimaryVertices
private

Definition at line 132 of file SimTrackManager.h.

Referenced by setCollapsePrimaryVertices().

int SimTrackManager::m_nVertices
private

Definition at line 131 of file SimTrackManager.h.

Referenced by cleanVertexMap(), and getOrCreateVertex().

bool SimTrackManager::m_SaveSimTracks
private

Definition at line 129 of file SimTrackManager.h.

TrackContainer* SimTrackManager::m_trksForThisEvent
private
MotherParticleToVertexMap SimTrackManager::m_vertexMap
private

Definition at line 130 of file SimTrackManager.h.

Referenced by cleanVertexMap(), and getOrCreateVertex().

std::map<uint32_t,std::pair<math::XYZVectorD,math::XYZTLorentzVectorD > > SimTrackManager::mapTkCaloStateInfo
private
const edm::LHCTransportLinkContainer* SimTrackManager::theLHCTlink
private

Definition at line 141 of file SimTrackManager.h.

Referenced by resetGenID(), and setLHCTransportLink().