ATLAS Offline Software
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
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. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) 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 More...
 
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. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

void storeTruthTracks (void)
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

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) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
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 }

◆ ~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 }

◆ declareGaudiProperty() [1/4]

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

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

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

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

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

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

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

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

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

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

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ 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.

95 { return m_detStore; }

◆ evtStore() [1/2]

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.

85 { return m_evtStore; }

◆ evtStore() [2/2]

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

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ 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 }

◆ 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()

static const InterfaceID& MuonTrackStatisticsTool::interfaceID ( )
inlinestatic

Definition at line 35 of file MuonTrackStatisticsTool.h.

35 { return IID_MuonTrackStatisticsTool; }

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

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

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ 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 }

◆ 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();
383  PBASE::renounce (h);
384  }

◆ 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  {
365  handlesArray.renounce();
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 DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ 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  {
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 }

◆ 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 }

◆ updateTruthTrackCounters() [1/2]

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

Definition at line 50 of file MuonTrackStatisticsTool.cxx.

50  {
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 }

◆ 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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

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.

◆ 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:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
SubDetHitStatistics::SCT
@ SCT
Definition: SubDetHitStatistics.h:74
MuonTrackStatisticsTool::m_doTruth
bool m_doTruth
Definition: MuonTrackStatisticsTool.h:111
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
skel.it
it
Definition: skel.GENtoEVGEN.py:396
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SubDetHitStatistics::CSC
@ CSC
Definition: SubDetHitStatistics.h:74
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
MuonTrackStatisticsTool::m_allCounters
std::vector< MuonTrackStatisticsTool::TrackCounters * > m_allCounters
Definition: MuonTrackStatisticsTool.h:113
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
SubDetHitStatistics::MDT
@ MDT
Definition: SubDetHitStatistics.h:74
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Trk::MuonTrackSummary
Detailed track summary for the muon system Give access to hit counts per chamber.
Definition: MuonTrackSummary.h:26
MuonTrackStatisticsTool::m_edmHelperSvc
ServiceHandle< Muon::IMuonEDMHelperSvc > m_edmHelperSvc
Definition: MuonTrackStatisticsTool.h:108
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
SubDetHitStatistics::TGC
@ TGC
Definition: SubDetHitStatistics.h:74
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
MuonTrackStatisticsTool::updateTruthTrackCounters
StatusCode updateTruthTrackCounters(const std::string &name, const DetailedTrackTruthCollection *truthMap)
Definition: MuonTrackStatisticsTool.cxx:50
SubDetHitStatistics::RPC
@ RPC
Definition: SubDetHitStatistics.h:74
SubDetHitStatistics::TRT
@ TRT
Definition: SubDetHitStatistics.h:74
MuonTrackStatisticsTool::updateTrackCounters
StatusCode updateTrackCounters(const std::string &name, const TrackCollection *tracks)
Definition: MuonTrackStatisticsTool.cxx:117
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
MuonTrackStatisticsTool::m_allTruthCounters
std::vector< MuonTrackStatisticsTool::TruthTrackCounters * > m_allTruthCounters
Definition: MuonTrackStatisticsTool.h:114
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
SubDetHitStatistics::Pixel
@ Pixel
Definition: SubDetHitStatistics.h:74
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
fitman.k
k
Definition: fitman.py:528
dumpTruth.TruthCollectionName
TruthCollectionName
Definition: dumpTruth.py:33
SCT_Monitoring::summary
@ summary
Definition: SCT_MonitoringNumbers.h:65