ATLAS Offline Software
Loading...
Searching...
No Matches
MuonTrackStatisticsTool Class Reference

#include <MuonTrackStatisticsTool.h>

Inheritance diagram for MuonTrackStatisticsTool:
Collaboration diagram for MuonTrackStatisticsTool:

Classes

struct  TrackCounters
struct  TruthTrackCounters

Public Member Functions

 MuonTrackStatisticsTool (const std::string &, const std::string &, const IInterface *)
 ~MuonTrackStatisticsTool ()
StatusCode initialize ()
StatusCode finalize ()
StatusCode updateTrackCounters (const std::string &name, const TrackCollection *tracks)
StatusCode updateTrackCounters (TrackCounters &counters, const TrackCollection &tracks)
StatusCode updateTruthTrackCounters (const std::string &name, const DetailedTrackTruthCollection *truthMap)
StatusCode updateTruthTrackCounters (TruthTrackCounters &counters, const DetailedTrackTruthCollection &TruthMap)
void addTrackCounters (const std::string &trkLoc)
std::string printTrackCounters () const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

void storeTruthTracks (void)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ServiceHandle< Muon::IMuonEDMHelperSvcm_edmHelperSvc
bool m_doTruth
std::vector< MuonTrackStatisticsTool::TrackCounters * > m_allCounters
std::vector< MuonTrackStatisticsTool::TruthTrackCounters * > m_allTruthCounters
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 28 of file MuonTrackStatisticsTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MuonTrackStatisticsTool()

MuonTrackStatisticsTool::MuonTrackStatisticsTool ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 24 of file MuonTrackStatisticsTool.cxx.

24 :
25 AthAlgTool(t, n, p),
26 m_doTruth(false)
27
28{
29 declareInterface<MuonTrackStatisticsTool>(this);
30 declareProperty("doTruth", m_doTruth);
31}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ ~MuonTrackStatisticsTool()

MuonTrackStatisticsTool::~MuonTrackStatisticsTool ( )
inline

Definition at line 32 of file MuonTrackStatisticsTool.h.

32{};

Member Function Documentation

◆ addTrackCounters()

void MuonTrackStatisticsTool::addTrackCounters ( const std::string & trkLoc)

Definition at line 155 of file MuonTrackStatisticsTool.cxx.

155 {
156 TString temp_string(trkLoc);
157
158 if (temp_string.Contains("Truth") && m_doTruth) {
159 ATH_MSG_INFO("MuonTrackStatisticsTool calling addTrackCounters for truth: " << trkLoc);
160 TruthTrackCounters* counters;
161 counters = new TruthTrackCounters(trkLoc);
162 m_allTruthCounters.push_back(counters);
163 } else if (!temp_string.Contains("Truth")) {
164 ATH_MSG_INFO("MuonTrackStatisticsTool calling addTrackCounters for reco: " << trkLoc);
165 TrackCounters* counters;
166 counters = new TrackCounters(trkLoc);
167 m_allCounters.push_back(counters);
168 }
169 return;
170}
#define ATH_MSG_INFO(x)
std::vector< MuonTrackStatisticsTool::TrackCounters * > m_allCounters
std::vector< MuonTrackStatisticsTool::TruthTrackCounters * > m_allTruthCounters

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode MuonTrackStatisticsTool::finalize ( )

Definition at line 43 of file MuonTrackStatisticsTool.cxx.

43 {
44 if (m_doTruth) {
45 // empty for now, will impliment access of truth later
46 }
47 return StatusCode::SUCCESS;
48}

◆ initialize()

StatusCode MuonTrackStatisticsTool::initialize ( )

Definition at line 35 of file MuonTrackStatisticsTool.cxx.

35 {
36 ATH_CHECK(m_edmHelperSvc.retrieve());
37 return StatusCode::SUCCESS;
38}
#define ATH_CHECK
Evaluate an expression and check for errors.
ServiceHandle< Muon::IMuonEDMHelperSvc > m_edmHelperSvc

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & MuonTrackStatisticsTool::interfaceID ( )
inlinestatic

Definition at line 35 of file MuonTrackStatisticsTool.h.

static const InterfaceID IID_MuonTrackStatisticsTool("MuonTrackStatisticsTool", 1, 0)

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ printTrackCounters()

std::string MuonTrackStatisticsTool::printTrackCounters ( ) const

Definition at line 172 of file MuonTrackStatisticsTool.cxx.

172 {
173 std::ostringstream sout;
174
175 std::vector<MuonTrackStatisticsTool::TrackCounters*>::const_iterator counter_it = m_allCounters.begin();
176 std::vector<MuonTrackStatisticsTool::TrackCounters*>::const_iterator counter_itEnd = m_allCounters.end();
177 std::vector<MuonTrackStatisticsTool::TruthTrackCounters*>::const_iterator truthcounter_it_start = m_allTruthCounters.begin();
178 std::vector<MuonTrackStatisticsTool::TruthTrackCounters*>::const_iterator truthcounter_itEnd = m_allTruthCounters.end();
179 std::vector<MuonTrackStatisticsTool::TruthTrackCounters*>::const_iterator truthcounter_it = m_allTruthCounters.begin();
180
181 double trksPerEvent;
182 double hitsPerTrk;
183 double etaPerTrk;
184 double tetaPerTrk;
185 double phiPerTrk;
186 double scatPerTrk;
187 double holePerTrk;
188 double chi2PerTrk;
189
190 for (; counter_it != counter_itEnd; ++counter_it) {
191 if ((*counter_it)->nEvents != 0 && (*counter_it)->nTracks != 0) {
192 trksPerEvent = (double)(*counter_it)->nTracks / (*counter_it)->nEvents;
193 hitsPerTrk = (double)(*counter_it)->nHits / (*counter_it)->nTracks;
194 etaPerTrk = (double)(*counter_it)->nEtaHits / (*counter_it)->nTracks;
195 tetaPerTrk = (double)(*counter_it)->nEtaTrig / (*counter_it)->nTracks;
196 phiPerTrk = (double)(*counter_it)->nPhiHits / (*counter_it)->nTracks;
197 scatPerTrk = (double)(*counter_it)->nScatter / (*counter_it)->nTracks;
198 holePerTrk = (double)(*counter_it)->nHoles / (*counter_it)->nTracks;
199 chi2PerTrk = (*counter_it)->summedchi2 / (*counter_it)->nTracks;
200
201 } else {
202 trksPerEvent = 0.;
203 hitsPerTrk = 0.;
204 etaPerTrk = 0.;
205 tetaPerTrk = 0.;
206 phiPerTrk = 0.;
207 scatPerTrk = 0.;
208 holePerTrk = 0.;
209 chi2PerTrk = 0.;
210 }
211
212 int TruthTrackCounter = -1;
213 double trksPerTrtrk = -1;
214
215 if (m_doTruth) {
216 for (truthcounter_it = truthcounter_it_start; truthcounter_it != truthcounter_itEnd; ++truthcounter_it) {
217 TString TruthCollectionName = (*truthcounter_it)->trackLocation;
218 if (TruthCollectionName.Contains((*counter_it)->trackLocation)) {
219 TruthTrackCounter = (*truthcounter_it)->nTracks;
220 ATH_MSG_INFO("MuonTrackStatisticsTool - Found matching TruthCollection for: " << (*counter_it)->trackLocation);
221 }
222 }
223
224 if (TruthTrackCounter == 0 && (*counter_it)->nTracks == 0) {
225 trksPerTrtrk = 1;
226 } else if (TruthTrackCounter == 0 && (*counter_it)->nTracks != 0) {
227 trksPerTrtrk = -1;
228 } else {
229 trksPerTrtrk = (double)(*counter_it)->nTracks / (double)TruthTrackCounter;
230 }
231 }
232
233 if (trksPerTrtrk < 0 && m_doTruth) {
234 ATH_MSG_INFO("MuonTrackStatisticsTool - Could not find matching TruthCollection for: " << (*counter_it)->trackLocation);
235 sout.precision(4);
236 sout << std::endl;
237 sout << ">>>> MuonTrackStatisticsAlg Summary: Track Container = " << (*counter_it)->trackLocation << std::endl;
238 sout << "----------------------------------------------------------------------------------------------------------------------"
239 "-------------"
240 << std::endl;
241 sout << "|| Events || Tracks || Trk/Evt || Hit/Trk || Eta/Trk ||"
242 << " TrigEta/T || Phi/Trk || Scat/Tk || Hole/Tk || Ch2/dof/T || Trks/TruthT ||" << std::endl;
243
244 sout << "|| " << std::setw(7) << (*counter_it)->nEvents << " || " << std::setw(7) << (*counter_it)->nTracks << " || "
245 << std::setw(7) << trksPerEvent << " || " << std::setw(7) << hitsPerTrk << " || " << std::setw(7) << etaPerTrk << " || "
246 << std::setw(9) << tetaPerTrk << " || " << std::setw(7) << phiPerTrk << " || " << std::setw(7) << scatPerTrk << " || "
247 << std::setw(7) << holePerTrk << " || " << std::setw(9) << chi2PerTrk << " || " << std::setw(11) << "NOT DEFINED"
248 << " || " << std::endl;
249 sout << "----------------------------------------------------------------------------------------------------------------------"
250 "-------------"
251 << std::endl;
252 sout << std::endl << std::endl;
253 } else if (trksPerTrtrk < 0 && !m_doTruth) {
254 sout.precision(4);
255 sout << std::endl;
256 sout << ">>>> MuonTrackStatisticsAlg Summary: Track Container = " << (*counter_it)->trackLocation << std::endl;
257 sout << "--------------------------------------------------------------------------------------------------------------------"
258 << std::endl;
259 sout << "|| Events || Tracks || Trk/Evt || Hit/Trk || Eta/Trk ||"
260 << " TrigEta/T || Phi/Trk || Scat/Tk || Hole/Tk || Ch2/dof/T ||" << std::endl;
261
262 sout << "|| " << std::setw(7) << (*counter_it)->nEvents << " || " << std::setw(7) << (*counter_it)->nTracks << " || "
263 << std::setw(7) << trksPerEvent << " || " << std::setw(7) << hitsPerTrk << " || " << std::setw(7) << etaPerTrk << " || "
264 << std::setw(9) << tetaPerTrk << " || " << std::setw(7) << phiPerTrk << " || " << std::setw(7) << scatPerTrk << " || "
265 << std::setw(7) << holePerTrk << " || " << std::setw(9) << chi2PerTrk << " || " << std::endl;
266 sout << "--------------------------------------------------------------------------------------------------------------------"
267 << std::endl;
268 sout << std::endl << std::endl;
269 } else {
270 sout.precision(4);
271 sout << std::endl;
272 sout << ">>>> MuonTrackStatisticsAlg Summary: Track Container = " << (*counter_it)->trackLocation << std::endl;
273 sout << "----------------------------------------------------------------------------------------------------------------------"
274 "-------------"
275 << std::endl;
276 sout << "|| Events || Tracks || Trk/Evt || Hit/Trk || Eta/Trk ||"
277 << " TrigEta/T || Phi/Trk || Scat/Tk || Hole/Tk || Ch2/dof/T || Trks/TruthT ||" << std::endl;
278
279 sout << "|| " << std::setw(7) << (*counter_it)->nEvents << " || " << std::setw(7) << (*counter_it)->nTracks << " || "
280 << std::setw(7) << trksPerEvent << " || " << std::setw(7) << hitsPerTrk << " || " << std::setw(7) << etaPerTrk << " || "
281 << std::setw(9) << tetaPerTrk << " || " << std::setw(7) << phiPerTrk << " || " << std::setw(7) << scatPerTrk << " || "
282 << std::setw(7) << holePerTrk << " || " << std::setw(9) << chi2PerTrk << " || " << std::setw(11) << trksPerTrtrk << " || "
283 << std::endl;
284 sout << "----------------------------------------------------------------------------------------------------------------------"
285 "-------------"
286 << std::endl;
287 sout << std::endl << std::endl;
288 }
289 }
290
291 if (m_doTruth) {
292 for (truthcounter_it = truthcounter_it_start; truthcounter_it != truthcounter_itEnd; ++truthcounter_it) {
293 double TruthTrksPerEvent;
294 double PIXELhitsPerTrk;
295 double SCThitsPerTrk;
296 double TRThitsPerTrk;
297 double MDThitsPerTrk;
298 double RPChitsPerTrk;
299 double TGChitsPerTrk;
300 double CSChitsPerTrk;
301
302 sout << std::endl;
303 sout << ">>>> MuonTrackStatisticsAlg Summary: Track Container = " << (*truthcounter_it)->trackLocation << std::endl;
304 for (unsigned int i = 0; i < 3; i++) {
305 if ((*truthcounter_it)->nEvents != 0 && (*truthcounter_it)->nTracks != 0) {
306 TruthTrksPerEvent = (double)(*truthcounter_it)->nTracks / (*truthcounter_it)->nEvents;
307 PIXELhitsPerTrk = (double)(*truthcounter_it)->nPIXELhits[i] / (*truthcounter_it)->nTracks;
308 SCThitsPerTrk = (double)(*truthcounter_it)->nSCThits[i] / (*truthcounter_it)->nTracks;
309 TRThitsPerTrk = (double)(*truthcounter_it)->nTRThits[i] / (*truthcounter_it)->nTracks;
310 MDThitsPerTrk = (double)(*truthcounter_it)->nMDThits[i] / (*truthcounter_it)->nTracks;
311 RPChitsPerTrk = (double)(*truthcounter_it)->nRPChits[i] / (*truthcounter_it)->nTracks;
312 TGChitsPerTrk = (double)(*truthcounter_it)->nTGChits[i] / (*truthcounter_it)->nTracks;
313 CSChitsPerTrk = (double)(*truthcounter_it)->nCSChits[i] / (*truthcounter_it)->nTracks;
314
315 } else {
316 TruthTrksPerEvent = 0;
317 PIXELhitsPerTrk = 0;
318 SCThitsPerTrk = 0;
319 TRThitsPerTrk = 0;
320 MDThitsPerTrk = 0;
321 RPChitsPerTrk = 0;
322 TGChitsPerTrk = 0;
323 CSChitsPerTrk = 0;
324 }
325
326 sout.precision(4);
327 sout << "------------------------------------------------------------------------------------------------------------------"
328 "----------------------------"
329 << std::endl;
330 if (i == 0)
331 sout << "-------------------------------------------------------->>>> SubDetStat is COMMON "
332 "<<<<--------------------------------------------------------"
333 << std::endl;
334 else if (i == 1)
335 sout << "-------------------------------------------------------->>>> SubDetStat is ONTRUTH "
336 "<<<<-------------------------------------------------------"
337 << std::endl;
338 else if (i == 2)
339 sout << "-------------------------------------------------------->>>> SubDetStat is ONTRACK "
340 "<<<<-------------------------------------------------------"
341 << std::endl;
342 sout << "------------------------------------------------------------------------------------------------------------------"
343 "----------------------------"
344 << std::endl;
345 sout << "|| Events || Tracks || Trk/Evt || PIXELhits/Trk || SCThits/Trk ||"
346 << " TRThits/Trk || MDThits/Trk || RPChits/Trk || TGChits/Trk || CSChits/Trk ||" << std::endl;
347
348 sout << "|| " << std::setw(7) << (*truthcounter_it)->nEvents << " || " << std::setw(7) << (*truthcounter_it)->nTracks
349 << " || " << std::setw(7) << TruthTrksPerEvent << " || " << std::setw(13) << PIXELhitsPerTrk << " || " << std::setw(11)
350 << SCThitsPerTrk << " || " << std::setw(11) << TRThitsPerTrk << " || " << std::setw(11) << MDThitsPerTrk << " || "
351 << std::setw(11) << RPChitsPerTrk << " || " << std::setw(11) << TGChitsPerTrk << " || " << std::setw(11)
352 << CSChitsPerTrk << " || " << std::endl;
353 }
354
355 sout << "----------------------------------------------------------------------------------------------------------------------"
356 "------------------------"
357 << std::endl;
358 sout << std::endl << std::endl;
359 }
360 }
361 return sout.str();
362}
TruthCollectionName
Definition dumpTruth.py:33

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ storeTruthTracks()

void MuonTrackStatisticsTool::storeTruthTracks ( void )
private

Definition at line 364 of file MuonTrackStatisticsTool.cxx.

364{}

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateTrackCounters() [1/2]

StatusCode MuonTrackStatisticsTool::updateTrackCounters ( const std::string & name,
const TrackCollection * tracks )

Definition at line 117 of file MuonTrackStatisticsTool.cxx.

117 {
118 std::vector<MuonTrackStatisticsTool::TrackCounters*>::iterator counter_it = m_allCounters.begin();
119 std::vector<MuonTrackStatisticsTool::TrackCounters*>::iterator counter_itEnd = m_allCounters.end();
120 for (; counter_it != counter_itEnd; ++counter_it) {
121 if ((*counter_it)->trackLocation.compare(name) == 0) { return updateTrackCounters(**counter_it, *tracks); }
122 }
123 ATH_MSG_WARNING("Failed to match the collection " << name << " to any counter");
124 return StatusCode::SUCCESS;
125}
#define ATH_MSG_WARNING(x)
StatusCode updateTrackCounters(const std::string &name, const TrackCollection *tracks)

◆ updateTrackCounters() [2/2]

StatusCode MuonTrackStatisticsTool::updateTrackCounters ( TrackCounters & counters,
const TrackCollection & tracks )

Definition at line 127 of file MuonTrackStatisticsTool.cxx.

127 {
128 ATH_MSG_DEBUG("MuonTrackStatisticsTool calling updateTrackCounters: " << counters.trackLocation);
129 ++counters.nEvents;
130
131 if (tracks.empty()) return StatusCode::SUCCESS;
132 // update each set of trackcounters for each track
133 counters.nTracks += tracks.size();
134
136 TrackCollection::const_iterator it_end = tracks.end();
137 for (; it != it_end; ++it) {
138 const Trk::Track* track = *it;
139 if (!track->trackSummary() || !track->trackSummary()->muonTrackSummary()) continue;
140 const Trk::MuonTrackSummary& summary = *track->trackSummary()->muonTrackSummary();
141
142 double chi2dof = ((*it)->fitQuality()->chiSquared()) / ((*it)->fitQuality()->doubleNumberDoF());
143 counters.nHits += summary.netaHits() + summary.nphiHits();
144 counters.nEtaHits += summary.netaHits();
145 counters.nPhiHits += summary.nphiHits();
146 counters.nEtaTrig += 0;
147 counters.nScatter += summary.nscatterers();
148 counters.nPsudo += summary.npseudoMeasurements();
149 counters.nHoles += summary.nholes();
150 counters.summedchi2 += chi2dof;
151 }
152 return StatusCode::SUCCESS;
153}
#define ATH_MSG_DEBUG(x)
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
float chiSquared(const U &p)

◆ updateTruthTrackCounters() [1/2]

StatusCode MuonTrackStatisticsTool::updateTruthTrackCounters ( const std::string & name,
const DetailedTrackTruthCollection * truthMap )

Definition at line 50 of file MuonTrackStatisticsTool.cxx.

50 {
51 std::vector<MuonTrackStatisticsTool::TruthTrackCounters*>::iterator counterTruth_it = m_allTruthCounters.begin();
52 std::vector<MuonTrackStatisticsTool::TruthTrackCounters*>::iterator counterTruth_itEnd = m_allTruthCounters.end();
53 for (; counterTruth_it != counterTruth_itEnd; ++counterTruth_it) {
54 if ((*counterTruth_it)->trackLocation.compare(name) == 0) { return updateTruthTrackCounters(**counterTruth_it, *truthMap); }
55 }
56 ATH_MSG_WARNING("Failed to match the collection " << name << " to any counter");
57 return StatusCode::SUCCESS;
58}
StatusCode updateTruthTrackCounters(const std::string &name, const DetailedTrackTruthCollection *truthMap)

◆ updateTruthTrackCounters() [2/2]

StatusCode MuonTrackStatisticsTool::updateTruthTrackCounters ( TruthTrackCounters & counters,
const DetailedTrackTruthCollection & TruthMap )

Definition at line 60 of file MuonTrackStatisticsTool.cxx.

61 {
62 ATH_MSG_DEBUG("MuonTrackStatisticsTool calling updateTruthTrackCounters: " << counters.trackLocation);
63 ++counters.nEvents;
64 if (TruthMap.empty()) return StatusCode::SUCCESS;
65
66 // update each set of trackcounters for each track
67 DetailedTrackTruthCollection::const_iterator it_start = TruthMap.begin();
68 DetailedTrackTruthCollection::const_iterator it_end = TruthMap.end();
69 DetailedTrackTruthCollection::const_iterator it = it_start;
70 int myindex = 0;
71
72 for (it = it_start; it != it_end; ++it) {
73 counters.nPIXELhits[0] += (*it).second.statsCommon()[SubDetHitStatistics::Pixel];
74 counters.nSCThits[0] += (*it).second.statsCommon()[SubDetHitStatistics::SCT];
75 counters.nTRThits[0] += (*it).second.statsCommon()[SubDetHitStatistics::TRT];
76 counters.nMDThits[0] += (*it).second.statsCommon()[SubDetHitStatistics::MDT];
77 counters.nRPChits[0] += (*it).second.statsCommon()[SubDetHitStatistics::RPC];
78 counters.nTGChits[0] += (*it).second.statsCommon()[SubDetHitStatistics::TGC];
79 counters.nCSChits[0] += (*it).second.statsCommon()[SubDetHitStatistics::CSC];
80
81 counters.nPIXELhits[1] += (*it).second.statsTrack()[SubDetHitStatistics::Pixel];
82 counters.nSCThits[1] += (*it).second.statsTrack()[SubDetHitStatistics::SCT];
83 counters.nTRThits[1] += (*it).second.statsTrack()[SubDetHitStatistics::TRT];
84 counters.nMDThits[1] += (*it).second.statsTrack()[SubDetHitStatistics::MDT];
85 counters.nRPChits[1] += (*it).second.statsTrack()[SubDetHitStatistics::RPC];
86 counters.nTGChits[1] += (*it).second.statsTrack()[SubDetHitStatistics::TGC];
87 counters.nCSChits[1] += (*it).second.statsTrack()[SubDetHitStatistics::CSC];
88
89 counters.nPIXELhits[2] += (*it).second.statsTruth()[SubDetHitStatistics::Pixel];
90 counters.nSCThits[2] += (*it).second.statsTruth()[SubDetHitStatistics::SCT];
91 counters.nTRThits[2] += (*it).second.statsTruth()[SubDetHitStatistics::TRT];
92 counters.nMDThits[2] += (*it).second.statsTruth()[SubDetHitStatistics::MDT];
93 counters.nRPChits[2] += (*it).second.statsTruth()[SubDetHitStatistics::RPC];
94 counters.nTGChits[2] += (*it).second.statsTruth()[SubDetHitStatistics::TGC];
95 counters.nCSChits[2] += (*it).second.statsTruth()[SubDetHitStatistics::CSC];
96
97 ATH_MSG_DEBUG(myindex << ".) "
98 << "Index: " << (*it).first.index() << " " << (*it).second
99 << " (Pixel, SCT, TRT, MDT, RPC, TGC, CSC) ");
100 ATH_MSG_DEBUG(" GenParticle info:");
101 for (unsigned int i = 0; i < (*it).second.trajectory().size(); i++) {
102 ATH_MSG_DEBUG(" Particle " << i);
103 if (!(*it).second.trajectory().at(i).cptr()) {
104 ATH_MSG_DEBUG(" has a null pointer: " << (*it).second.trajectory().at(i).cptr());
105 } else {
106 ATH_MSG_DEBUG(" - pdg_id: " << (*it).second.trajectory().at(i).cptr()->pdg_id());
107 ATH_MSG_DEBUG(" - status: " << (*it).second.trajectory().at(i).cptr()->status());
108 counters.nTracks++;
109 }
110 }
111 myindex++;
112 }
113 return StatusCode::SUCCESS;
114 ;
115}

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_allCounters

std::vector<MuonTrackStatisticsTool::TrackCounters*> MuonTrackStatisticsTool::m_allCounters
private

Definition at line 113 of file MuonTrackStatisticsTool.h.

◆ m_allTruthCounters

std::vector<MuonTrackStatisticsTool::TruthTrackCounters*> MuonTrackStatisticsTool::m_allTruthCounters
private

Definition at line 114 of file MuonTrackStatisticsTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doTruth

bool MuonTrackStatisticsTool::m_doTruth
private

Definition at line 111 of file MuonTrackStatisticsTool.h.

◆ m_edmHelperSvc

ServiceHandle<Muon::IMuonEDMHelperSvc> MuonTrackStatisticsTool::m_edmHelperSvc
private
Initial value:
{this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
"Handle to the service providing the IMuonEDMHelperSvc interface"}

Definition at line 108 of file MuonTrackStatisticsTool.h.

108 {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
109 "Handle to the service providing the IMuonEDMHelperSvc interface"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: