ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
TrackCollHandle_SimulationTracks::Imp Class Reference
Collaboration diagram for TrackCollHandle_SimulationTracks::Imp:

Public Member Functions

bool loadHitLists (std::map< SimBarCode, SimHitList > &hitLists)
 
template<class collT >
void addHitCollections (std::map< SimBarCode, SimHitList > &hitLists)
 
void possiblyUpdateGUI ()
 
void updateVisibleAssociatedObjects () const
 

Static Public Member Functions

static SimHitHandleBasecreateHitHandle (const SimulationHit &h)
 

Public Attributes

TrackCollHandle_SimulationTrackstheclass = nullptr
 
int updateGUICounter = 0
 
std::map< SimBarCode::ExtBarCode, int > extBarCode2pdg
 
bool cut_fromIROnly = false
 
bool cut_excludeBarcodeZero = false
 
bool cut_excludeNeutrals = false
 
bool displayAscObjs = false
 

Static Public Attributes

static const int maxPdgCode = 1000000000
 

Detailed Description

Definition at line 48 of file TrackCollHandle_SimulationTracks.cxx.

Member Function Documentation

◆ addHitCollections()

template<class collT >
void TrackCollHandle_SimulationTracks::Imp::addHitCollections ( std::map< SimBarCode, SimHitList > &  hitLists)

Definition at line 136 of file TrackCollHandle_SimulationTracks.cxx.

137 {
139 
140  theclass->message("Entered addHitCollections " + QString(typeid(collT).name()));
142 
143  for (const QString& key : VP1SGContentsHelper(theclass->systemBase()).getKeys<collT>()) {
144  const collT * hitColl;
145  theclass->message("Try to retrieve "+QString(typeid(collT).name())+" collection with key = "+key);
146  if (!sgaccess.retrieve(hitColl, key)) {
147  theclass->message("Error: Could not retrieve "+QString(typeid(collT).name())+" collection with key = "+key);
148  continue;
149  }
150  theclass->messageVerbose("Retrieved hit collection of type "+QString(typeid(collT).name())+" with key = "+key);
151  typename collT::const_iterator it, itE(hitColl->end());
152  int itot(0), iadded(0);
153  for (it=hitColl->begin();it!=itE;++it) {
154  ++itot;
156  SimHitHandleBase * handle = createHitHandle(*it);
157  handle->cacheMomentum();
158  theclass->fixPDGCode(handle);
159  SimBarCode trackID = handle->simBarCode();
160  if (trackID.pdgCode()>maxPdgCode) {
161  continue;
162  }
163 
164  itHitList = hitLists.find(trackID);
165  if ( itHitList == hitLists.end() ) {
166  SimHitList l;
167  l.push_back(std::pair<double,SimHitHandleBase*>(handle->hitTime(),handle));
168  hitLists[trackID] = l;
169  } else {
170  itHitList->second.emplace_back(handle->hitTime(),handle);
171  }
172  ++iadded;
173  }
174  theclass->messageVerbose(" => used "+str(iadded)+" of "+str(itot)+" hits");
175  }
176 
177 }

◆ createHitHandle()

static SimHitHandleBase* TrackCollHandle_SimulationTracks::Imp::createHitHandle ( const SimulationHit h)
inlinestatic

Definition at line 57 of file TrackCollHandle_SimulationTracks.cxx.

57 { return new SimHitHandle_ForwardHit(&h); }

◆ loadHitLists()

bool TrackCollHandle_SimulationTracks::Imp::loadHitLists ( std::map< SimBarCode, SimHitList > &  hitLists)

Definition at line 180 of file TrackCollHandle_SimulationTracks.cxx.

181 {
182  //Fixme: Return false if we do not find at least one collection
183  theclass->messageVerbose( "Searching " + str( hitLists.size() ) + " lists of sim. hits.");
184  addHitCollections<SimulationHitCollection>(hitLists);
185 
186  if (VP1Msg::verbose())
187  theclass->messageVerbose( "Found " + str( hitLists.size() ) + " lists of sim. hits.");
188 
189  //Time to assign all simhits with known pdg code a charge:
191  for (it = hitLists.begin(); it!=itE; ++it) {
192  if (it->first.unknownPdgCode())
193  continue;
194  bool ok;
195  double charge = VP1ParticleData::particleCharge(it->first.pdgCode(),ok);
196  if (!ok)
197  continue;
198  SimHitList::iterator itHit(it->second.begin()), itHitE(it->second.end());
199  for (;itHit!=itHitE;++itHit)
200  itHit->second->setCharge(charge);
202  }
203 
204  //Sort hitLists:
205  for (it = hitLists.begin(); it!=itE; ++it) {
206  sort(it->second.begin(),it->second.end());
208  }
209  return true;
210 }

◆ possiblyUpdateGUI()

void TrackCollHandle_SimulationTracks::Imp::possiblyUpdateGUI ( )
inline

Definition at line 60 of file TrackCollHandle_SimulationTracks.cxx.

60  {
61  if (!((updateGUICounter++)%750)) {
63  }
64  }

◆ updateVisibleAssociatedObjects()

void TrackCollHandle_SimulationTracks::Imp::updateVisibleAssociatedObjects ( ) const

Definition at line 307 of file TrackCollHandle_SimulationTracks.cxx.

308 {
309 
310  theclass->message("updateVisibleAssociatedObjects");//fixme
314  while ((handle=static_cast<TrackHandle_SimulationTrack*>(theclass->getNextTrackHandle()))) {
316  }
318 }

Member Data Documentation

◆ cut_excludeBarcodeZero

bool TrackCollHandle_SimulationTracks::Imp::cut_excludeBarcodeZero = false

Definition at line 68 of file TrackCollHandle_SimulationTracks.cxx.

◆ cut_excludeNeutrals

bool TrackCollHandle_SimulationTracks::Imp::cut_excludeNeutrals = false

Definition at line 69 of file TrackCollHandle_SimulationTracks.cxx.

◆ cut_fromIROnly

bool TrackCollHandle_SimulationTracks::Imp::cut_fromIROnly = false

Definition at line 67 of file TrackCollHandle_SimulationTracks.cxx.

◆ displayAscObjs

bool TrackCollHandle_SimulationTracks::Imp::displayAscObjs = false

Definition at line 71 of file TrackCollHandle_SimulationTracks.cxx.

◆ extBarCode2pdg

std::map<SimBarCode::ExtBarCode,int> TrackCollHandle_SimulationTracks::Imp::extBarCode2pdg

Definition at line 66 of file TrackCollHandle_SimulationTracks.cxx.

◆ maxPdgCode

const int TrackCollHandle_SimulationTracks::Imp::maxPdgCode = 1000000000
static

Definition at line 74 of file TrackCollHandle_SimulationTracks.cxx.

◆ theclass

TrackCollHandle_SimulationTracks* TrackCollHandle_SimulationTracks::Imp::theclass = nullptr

Definition at line 51 of file TrackCollHandle_SimulationTracks.cxx.

◆ updateGUICounter

int TrackCollHandle_SimulationTracks::Imp::updateGUICounter = 0

Definition at line 59 of file TrackCollHandle_SimulationTracks.cxx.


The documentation for this class was generated from the following file:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
SimHitHandleBase::simBarCode
SimBarCode simBarCode() const
Definition: SimHitHandleBase.h:48
VP1HelperClassBase::messageVerbose
void messageVerbose(const QString &) const
Definition: VP1HelperClassBase.cxx:78
skel.it
it
Definition: skel.GENtoEVGEN.py:396
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
VP1StdCollection::largeChangesBegin
virtual void largeChangesBegin()
Definition: VP1StdCollection.cxx:228
SimHitList
std::vector< std::pair< double, SimHitHandleBase * > > SimHitList
Definition: SimHitHandleBase.h:76
SimBarCode::pdgCode
int pdgCode() const
VP1String::str
static QString str(const QString &s)
Definition: VP1String.h:49
std::sort
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:554
TrackHandle_SimulationTrack::setAscObjsVisible
void setAscObjsVisible(bool)
Definition: TrackHandle_SimulationTrack.cxx:207
TruthTest.itE
itE
Definition: TruthTest.py:25
TrackCollHandle_SimulationTracks::Imp::updateGUICounter
int updateGUICounter
Definition: TrackCollHandle_SimulationTracks.cxx:59
SimBarCode
Definition: SimBarCode.h:22
TrackCollHandle_SimulationTracks::Imp::possiblyUpdateGUI
void possiblyUpdateGUI()
Definition: TrackCollHandle_SimulationTracks.cxx:60
VP1SGContentsHelper::getKeys
QStringList getKeys() const
Definition: VP1SGContentsHelper.h:55
VP1ParticleData::particleCharge
static double particleCharge(const int &pdgcode, bool &ok)
Definition: VP1ParticleData.cxx:103
TrackCollHandle_SimulationTracks::Imp::createHitHandle
static SimHitHandleBase * createHitHandle(const SimulationHit &h)
Definition: TrackCollHandle_SimulationTracks.cxx:57
SimHitHandleBase::cacheMomentum
void cacheMomentum()
Definition: SimHitHandleBase.h:58
SimHitHandleBase::hitTime
virtual double hitTime() const =0
SimHitHandle_ForwardHit
Definition: SimHitHandle_ForwardHit.h:23
TrackCollHandle_SimulationTracks::Imp::maxPdgCode
static const int maxPdgCode
Definition: TrackCollHandle_SimulationTracks.cxx:74
TrackCollHandle_SimulationTracks::Imp::displayAscObjs
bool displayAscObjs
Definition: TrackCollHandle_SimulationTracks.cxx:71
VP1HelperClassBase::systemBase
IVP1System * systemBase() const
Definition: VP1HelperClassBase.h:50
charge
double charge(const T &p)
Definition: AtlasPID.h:756
TrackCollHandle_SimulationTracks::Imp::theclass
TrackCollHandle_SimulationTracks * theclass
Definition: TrackCollHandle_SimulationTracks.cxx:51
VP1SGContentsHelper
Definition: VP1SGContentsHelper.h:26
TrackCollHandleBase::trackHandleIterationBegin
void trackHandleIterationBegin()
Definition: TrackCollHandleBase.cxx:717
VP1StdCollection::largeChangesEnd
virtual void largeChangesEnd()
Definition: VP1StdCollection.cxx:239
TrackHandle_SimulationTrack
Definition: TrackHandle_SimulationTrack.h:26
h
IVP1System::updateGUI
void updateGUI()
Definition: IVP1System.cxx:262
SimHitHandleBase
Definition: SimHitHandleBase.h:32
TrackCollHandle_SimulationTracks::fixPDGCode
void fixPDGCode(SimHitHandleBase *) const
Definition: TrackCollHandle_SimulationTracks.cxx:244
VP1HelperClassBase::message
void message(const QString &) const
Definition: VP1HelperClassBase.cxx:49
VP1Msg::verbose
static bool verbose()
Definition: VP1Msg.h:31
VP1SGAccessHelper
Definition: VP1SGAccessHelper.h:25
TrackCollHandleBase::getNextTrackHandle
TrackHandleBase * getNextTrackHandle()
Definition: TrackCollHandleBase.cxx:724
TrackCollHandleBase::name
const QString & name() const
Definition: TrackCollHandleBase.cxx:310
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37