ATLAS Offline Software
Loading...
Searching...
No Matches
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{
138 std::map<SimBarCode,SimHitList>::iterator itHitList;
139
140 theclass->message("Entered addHitCollections " + QString(typeid(collT).name()));
141 VP1SGAccessHelper sgaccess(theclass->systemBase());
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() ) {
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}
std::vector< std::pair< double, SimHitHandleBase * > > SimHitList
int pdgCode() const
virtual double hitTime() const =0
SimBarCode simBarCode() const
const QString & name() const
static SimHitHandleBase * createHitHandle(const SimulationHit &h)
l
Printing final latex table to .tex output file.

◆ createHitHandle()

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.");
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:
190 std::map<SimBarCode,SimHitList>::iterator it, itE(hitLists.end());
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}
double charge(const T &p)
Definition AtlasPID.h:997
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
void addHitCollections(std::map< SimBarCode, SimHitList > &hitLists)
static bool verbose()
Definition VP1Msg.h:31
static double particleCharge(const int &pdgcode, bool &ok)

◆ possiblyUpdateGUI()

void TrackCollHandle_SimulationTracks::Imp::possiblyUpdateGUI ( )
inline

Definition at line 60 of file TrackCollHandle_SimulationTracks.cxx.

60 {
61 if (!((updateGUICounter++)%750)) {
62 theclass->systemBase()->updateGUI();
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
311 theclass->largeChangesBegin();
312 theclass->trackHandleIterationBegin();
313 TrackHandle_SimulationTrack* handle;
314 while ((handle=static_cast<TrackHandle_SimulationTrack*>(theclass->getNextTrackHandle()))) {
316 }
317 theclass->largeChangesEnd();
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: