ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Muon::MuonHitSummaryTool Class Reference

Helper tool to extract simple counts from a Trk::Track, Trk::TrackSummary or Trk::MuonTrackSummary. More...

#include <MuonHitSummaryTool.h>

Inheritance diagram for Muon::MuonHitSummaryTool:
Collaboration diagram for Muon::MuonHitSummaryTool:

Public Member Functions

 MuonHitSummaryTool (const std::string &, const std::string &, const IInterface *)
 
virtual ~MuonHitSummaryTool ()=default
 
StatusCode initialize ()
 
virtual CompactSummary summary (const Trk::Track &track) const
 Calculate compact summary. More...
 
virtual CompactSummary summary (const Trk::TrackSummary &summary) const
 Calculate compact summary. More...
 
virtual CompactSummary summary (const Trk::MuonTrackSummary &summary) const
 Calculate compact summary. More...
 
virtual CompactSummary summary (const Muon::MuonSegment &segment) const
 Calculate compact summary. More...
 
virtual CompactSummary summary (const std::vector< const Muon::MuonSegment * > &segments) const
 Calculate compact summary. More...
 
virtual CompactSummary summary (const std::vector< const Trk::MeasurementBase * > &measurements) const
 Calculate compact summary. More...
 
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 ()
 IAlgTool interface. More...
 

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 getMuonTrackSummary (Trk::MuonTrackSummary &muonSummary, const Trk::Track &track) const
 helper function to calculate MuonTrackSummary from track More...
 
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...
 

Static Private Member Functions

static void calculateSummaryCounts (CompactSummary &sum)
 

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc
 
ServiceHandle< IMuonEDMHelperSvcm_edmHelperSvc
 
PublicToolHandle< MuonEDMPrinterToolm_printer
 
ToolHandle< Trk::ITrackSummaryHelperToolm_summaryHelperTool
 
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

Helper tool to extract simple counts from a Trk::Track, Trk::TrackSummary or Trk::MuonTrackSummary.

Definition at line 24 of file MuonHitSummaryTool.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

◆ MuonHitSummaryTool()

Muon::MuonHitSummaryTool::MuonHitSummaryTool ( const std::string &  ty,
const std::string &  na,
const IInterface *  pa 
)

Definition at line 16 of file MuonHitSummaryTool.cxx.

16  : AthAlgTool(ty, na, pa) {
17  declareInterface<IMuonHitSummaryTool>(this);
18  }

◆ ~MuonHitSummaryTool()

virtual Muon::MuonHitSummaryTool::~MuonHitSummaryTool ( )
virtualdefault

Member Function Documentation

◆ calculateSummaryCounts()

void Muon::MuonHitSummaryTool::calculateSummaryCounts ( IMuonHitSummaryTool::CompactSummary sum)
staticprivate

Definition at line 139 of file MuonHitSummaryTool.cxx.

139  {
140  sum.nprecisionLayers = 0;
141  sum.nprecisionGoodLayers = 0;
142  sum.nprecisionHoleLayers = 0;
143  sum.nphiLayers = 0;
144  sum.ntrigEtaLayers = 0;
145  sum.nphiHoleLayers = 0;
146  sum.ntrigEtaHoleLayers = 0;
147 
148  std::map<MuonStationIndex::StIndex, Muon::IMuonHitSummaryTool::HitSummary>::const_iterator hsit = sum.stationLayers.begin();
149  std::map<MuonStationIndex::StIndex, Muon::IMuonHitSummaryTool::HitSummary>::const_iterator hsit_end = sum.stationLayers.end();
150  for (; hsit != hsit_end; ++hsit) {
151  const Muon::IMuonHitSummaryTool::HitSummary& hitSummary = hsit->second;
152  sum.ntrigEtaLayers += hitSummary.netaTriggerLayers;
153  sum.nphiHoleLayers += hitSummary.nphiHoleLayers;
154  sum.ntrigEtaHoleLayers += hitSummary.netaTriggerHoleLayers;
155  if (hitSummary.nprecisionHits > 2) {
156  ++sum.nprecisionLayers;
157  if (hitSummary.nprecisionGoodHits > 2) {
158  ++sum.nprecisionGoodLayers;
159  sum.isEndcap = hitSummary.isEndcap;
160  sum.isSmall = hitSummary.isSmall;
161  }
162  } else if (hitSummary.nprecisionHoles > 2)
163  ++sum.nprecisionHoleLayers;
164  }
165  sum.nphiLayers = sum.phiLayers.size();
166  }

◆ 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

◆ getMuonTrackSummary()

void Muon::MuonHitSummaryTool::getMuonTrackSummary ( Trk::MuonTrackSummary muonSummary,
const Trk::Track track 
) const
private

helper function to calculate MuonTrackSummary from track

Definition at line 28 of file MuonHitSummaryTool.cxx.

28  {
29  // check whether helper tool set
30  if (m_summaryHelperTool.empty()) return;
31 
32  Trk::TrackSummary tmpSummary;
33  m_summaryHelperTool->addDetailedTrackSummary(track, tmpSummary);
34  if (!tmpSummary.muonTrackSummary()) {
35  ATH_MSG_WARNING("Could not create MuonTrackSummary, please enable the creation in " << m_summaryHelperTool);
36  return;
37  }
38  muonSummary = *tmpSummary.muonTrackSummary();
39  }

◆ initialize()

StatusCode Muon::MuonHitSummaryTool::initialize ( )

Definition at line 20 of file MuonHitSummaryTool.cxx.

20  {
21  ATH_CHECK(m_idHelperSvc.retrieve());
22  if (!m_summaryHelperTool.empty()) ATH_CHECK(m_summaryHelperTool.retrieve());
23  if (!m_printer.empty()) ATH_CHECK(m_printer.retrieve());
24  ATH_CHECK(m_edmHelperSvc.retrieve());
25  return StatusCode::SUCCESS;
26  }

◆ 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 & Muon::IMuonHitSummaryTool::interfaceID ( )
inlinestaticinherited

IAlgTool interface.

Definition at line 142 of file IMuonHitSummaryTool.h.

142 { return IID_IMuonHitSummaryTool; }

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

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

◆ summary() [1/6]

IMuonHitSummaryTool::CompactSummary Muon::MuonHitSummaryTool::summary ( const Muon::MuonSegment segment) const
virtual

Calculate compact summary.

Parameters
segmentinput MuonSegment
Returns
CompactSummary

Implements Muon::IMuonHitSummaryTool.

Definition at line 168 of file MuonHitSummaryTool.cxx.

168  {
169  return summary(segment.containedMeasurements());
170  }

◆ summary() [2/6]

IMuonHitSummaryTool::CompactSummary Muon::MuonHitSummaryTool::summary ( const std::vector< const Muon::MuonSegment * > &  segments) const
virtual

Calculate compact summary.

Parameters
segmentsinput vector of MuonSegments
Returns
CompactSummary

Implements Muon::IMuonHitSummaryTool.

Definition at line 172 of file MuonHitSummaryTool.cxx.

172  {
173  std::vector<const Trk::MeasurementBase*> rioVec;
174  std::vector<const Muon::MuonSegment*>::const_iterator sit = segments.begin();
175  std::vector<const Muon::MuonSegment*>::const_iterator sit_end = segments.end();
176  for (; sit != sit_end; ++sit)
177  rioVec.insert(rioVec.end(), (*sit)->containedMeasurements().begin(), (*sit)->containedMeasurements().end());
178  return summary(rioVec);
179  }

◆ summary() [3/6]

IMuonHitSummaryTool::CompactSummary Muon::MuonHitSummaryTool::summary ( const std::vector< const Trk::MeasurementBase * > &  measurements) const
virtual

Calculate compact summary.

Parameters
measurementsinput vector of MeasurementBase
Returns
CompactSummary

Implements Muon::IMuonHitSummaryTool.

Definition at line 181 of file MuonHitSummaryTool.cxx.

181  {
182  CompactSummary sum;
183  std::map<int, int> sectorLayerCounts; // count hits per sector
184 
185  std::map<MuonStationIndex::StIndex, std::map<MuonStationIndex::PhiIndex, std::pair<int, int> > > countLayersPerStation;
186 
187  std::vector<const Trk::MeasurementBase*>::const_iterator it = rioVec.begin();
188  std::vector<const Trk::MeasurementBase*>::const_iterator it_end = rioVec.end();
189  for (; it != it_end; ++it) {
190  Identifier id = m_edmHelperSvc->getIdentifier(**it);
191  if (!id.is_valid() || !m_idHelperSvc->isMuon(id)) continue;
192 
193  bool isMdt = m_idHelperSvc->isMdt(id);
194  bool isCsc = m_idHelperSvc->isCsc(id);
195  bool measuresPhi = m_idHelperSvc->measuresPhi(id);
196 
197  // only account for sectors if chamber has eta hits
198  if (isMdt || (isCsc && !measuresPhi)) {
199  int sector = m_idHelperSvc->sector(id);
200  if (isMdt) ++sectorLayerCounts[sector];
201  if (isCsc) ++sectorLayerCounts[sector];
202  sum.sectors.insert(sector);
203  }
204 
205  // only account for phi layers if not an MDT and has phi hits
206  if (!isMdt && measuresPhi) {
208  sum.phiLayers.insert(index);
209  }
210 
211  MuonStationIndex::StIndex index = m_idHelperSvc->stationIndex(id);
212  HitSummary& hitSummary = sum.stationLayers[index];
213  if (isMdt || (isCsc && !measuresPhi)) ++hitSummary.nprecisionHits;
214 
215  if (!isMdt) {
216  MuonStationIndex::PhiIndex pindex = m_idHelperSvc->phiIndex(id);
217  std::pair<int, int> etaPhiCount = countLayersPerStation[index][pindex];
218  if (measuresPhi)
219  ++etaPhiCount.first;
220  else
221  ++etaPhiCount.second;
222  }
223  }
224 
225  int maxHits = -1;
226  int mainSec = -1;
227  std::map<int, int>::iterator secIt = sectorLayerCounts.begin();
228  std::map<int, int>::iterator secIt_end = sectorLayerCounts.end();
229  for (; secIt != secIt_end; ++secIt) {
230  if (secIt->second > maxHits) {
231  maxHits = secIt->second;
232  mainSec = secIt->first;
233  }
234  }
235  sum.mainSector = mainSec;
236 
237  std::map<MuonStationIndex::StIndex, std::map<MuonStationIndex::PhiIndex, std::pair<int, int> > >::iterator sit =
238  countLayersPerStation.begin();
239  std::map<MuonStationIndex::StIndex, std::map<MuonStationIndex::PhiIndex, std::pair<int, int> > >::iterator sit_end =
240  countLayersPerStation.end();
241  for (; sit != sit_end; ++sit) {
242  HitSummary& hitSummary = sum.stationLayers[sit->first];
243 
244  std::map<MuonStationIndex::PhiIndex, std::pair<int, int> >::iterator pit = sit->second.begin();
245  std::map<MuonStationIndex::PhiIndex, std::pair<int, int> >::iterator pit_end = sit->second.end();
246  for (; pit != pit_end; ++pit) {
247  if (pit->second.first != 0) ++hitSummary.nphiLayers;
248  if (pit->second.second != 0 && pit->first != MuonStationIndex::CSC) ++hitSummary.netaTriggerLayers;
249  if (pit->second.second != 0 && pit->second.first != 0) ++hitSummary.netaPhiLayers;
250  }
251  }
253  return sum;
254  }

◆ summary() [4/6]

IMuonHitSummaryTool::CompactSummary Muon::MuonHitSummaryTool::summary ( const Trk::MuonTrackSummary summary) const
virtual

Calculate compact summary.

Can fail if summary does not have a MuonTrackSummary.

Parameters
summaryMuonTrackSummary of input track
Returns
CompactSummary

Implements Muon::IMuonHitSummaryTool.

Definition at line 59 of file MuonHitSummaryTool.cxx.

59  {
60  CompactSummary sum;
61 
62  std::map<int, int> sectorLayerCounts; // count hits per sector
63 
64  // loop over chambers
65  std::vector<Trk::MuonTrackSummary::ChamberHitSummary>::const_iterator chit = s.chamberHitSummary().begin();
66  std::vector<Trk::MuonTrackSummary::ChamberHitSummary>::const_iterator chit_end = s.chamberHitSummary().end();
67  for (; chit != chit_end; ++chit) {
68  const Identifier& chId = chit->chamberId();
69  bool isMdt = m_idHelperSvc->isMdt(chId);
70  bool isCsc = m_idHelperSvc->isCsc(chId);
71  bool isMM = m_idHelperSvc->isMM(chId);
72  bool issTgc = m_idHelperSvc->issTgc(chId);
73  bool isEIPrec = isCsc || isMM || issTgc;
74 
75  // only account for sectors if chamber has eta hits
76  if ((isMdt && chit->nhits() > 0) || (isEIPrec && chit->netaHits() > 0)) {
77  int sector = m_idHelperSvc->sector(chId);
78  if (isMdt)
79  sectorLayerCounts[sector] += chit->nhits();
80  else
81  sectorLayerCounts[sector] += chit->netaHits();
82  sum.sectors.insert(sector);
83  }
84 
85  // only account for phi layers if not an MDT and has phi hits
86  if (!isMdt && chit->nphiHits() > 0) {
88  sum.phiLayers.insert(index);
89  }
90 
91  MuonStationIndex::StIndex index = m_idHelperSvc->stationIndex(chId);
92  HitSummary& hitSummary = sum.stationLayers[index];
93  hitSummary.isEndcap = m_idHelperSvc->isEndcap(chId);
94  hitSummary.isSmall = m_idHelperSvc->isSmallChamber(chId);
95  if (isMdt) {
96  hitSummary.nprecisionHits += chit->nhits();
97  hitSummary.nprecisionHoles += chit->nholes();
98  hitSummary.nprecisionOutliers += chit->noutliers();
99  hitSummary.nprecisionCloseHits += chit->ncloseHits();
100  hitSummary.nprecisionGoodHits += chit->ngoodHits();
101  hitSummary.noutBoundsHits += chit->noutBoundsHits();
102  } else {
103  if (isEIPrec) {
104  hitSummary.nprecisionHits += chit->netaHits();
105  hitSummary.nprecisionGoodHits += chit->netaHits();
106  hitSummary.nprecisionHoles += chit->etaProjection().nholes;
107  hitSummary.nprecisionOutliers += chit->etaProjection().noutliers;
108  hitSummary.nprecisionCloseHits += chit->etaProjection().ncloseHits;
109  } else {
110  if (chit->netaHits() > 0) ++hitSummary.netaTriggerLayers;
111  }
112  if (chit->nphiHits() > 0) ++hitSummary.nphiLayers;
113  if (chit->nphiHits() > 0 && chit->netaHits() > 0) ++hitSummary.netaPhiLayers;
114 
115  if (!isEIPrec && chit->etaProjection().nholes > 0 && chit->etaProjection().nhits == 0) ++hitSummary.netaTriggerHoleLayers;
116  if (chit->phiProjection().nholes > 0 && chit->phiProjection().nhits == 0) ++hitSummary.nphiHoleLayers;
117  }
118  }
119 
120  int maxHits = -1;
121  int mainSec = -1;
122  std::map<int, int>::iterator secIt = sectorLayerCounts.begin();
123  std::map<int, int>::iterator secIt_end = sectorLayerCounts.end();
124  for (; secIt != secIt_end; ++secIt) {
125  if (secIt->second > maxHits) {
126  maxHits = secIt->second;
127  mainSec = secIt->first;
128  }
129  }
130  sum.mainSector = mainSec;
131 
133 
134  if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG(sum.dump());
135 
136  return sum;
137  }

◆ summary() [5/6]

IMuonHitSummaryTool::CompactSummary Muon::MuonHitSummaryTool::summary ( const Trk::Track track) const
virtual

Calculate compact summary.

Parameters
trackinput track
Returns
CompactSummary

Implements Muon::IMuonHitSummaryTool.

Definition at line 41 of file MuonHitSummaryTool.cxx.

41  {
42  if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG(m_printer->print(track) << std::endl << m_printer->printStations(track));
43 
44  // check if the track already has a MuonTrackSummary, if so use it
45  if (track.trackSummary() && track.trackSummary()->muonTrackSummary()) return summary(*track.trackSummary()->muonTrackSummary());
46 
47  // calculate muon summary from track
48  Trk::MuonTrackSummary muonSummary;
49  getMuonTrackSummary(muonSummary, track);
50  return summary(muonSummary);
51  }

◆ summary() [6/6]

IMuonHitSummaryTool::CompactSummary Muon::MuonHitSummaryTool::summary ( const Trk::TrackSummary summary) const
virtual

Calculate compact summary.

Parameters
summaryTrackSummary of input track
Returns
CompactSummary

Implements Muon::IMuonHitSummaryTool.

Definition at line 53 of file MuonHitSummaryTool.cxx.

53  {
54  // check if the track summary has a MuonTrackSummary, if so use it
55  if (sum.muonTrackSummary()) return summary(*sum.muonTrackSummary());
56  return {};
57  }

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

◆ 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_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_edmHelperSvc

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

Definition at line 77 of file MuonHitSummaryTool.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_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> Muon::MuonHitSummaryTool::m_idHelperSvc
private
Initial value:
{
this,
"MuonIdHelperSvc",
"Muon::MuonIdHelperSvc/MuonIdHelperSvc",
}

Definition at line 72 of file MuonHitSummaryTool.h.

◆ m_printer

PublicToolHandle<MuonEDMPrinterTool> Muon::MuonHitSummaryTool::m_printer
private
Initial value:
{
this,
"Printer",
"Muon::MuonEDMPrinterTool/MuonEDMPrinterTool",
}

Definition at line 84 of file MuonHitSummaryTool.h.

◆ m_summaryHelperTool

ToolHandle<Trk::ITrackSummaryHelperTool> Muon::MuonHitSummaryTool::m_summaryHelperTool
private
Initial value:
{
this,
"MuonTrackSummaryHelperTool",
"Muon::MuonTrackSummaryHelperTool/MuonTrackSummaryHelperTool",
}

Definition at line 89 of file MuonHitSummaryTool.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
Muon::MuonHitSummaryTool::getMuonTrackSummary
void getMuonTrackSummary(Trk::MuonTrackSummary &muonSummary, const Trk::Track &track) const
helper function to calculate MuonTrackSummary from track
Definition: MuonHitSummaryTool.cxx:28
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
Muon::MuonHitSummaryTool::summary
virtual CompactSummary summary(const Trk::Track &track) const
Calculate compact summary.
Definition: MuonHitSummaryTool.cxx:41
index
Definition: index.py:1
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Muon::MuonHitSummaryTool::m_edmHelperSvc
ServiceHandle< IMuonEDMHelperSvc > m_edmHelperSvc
Definition: MuonHitSummaryTool.h:77
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
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Muon::MuonStationIndex::PhiIndex
PhiIndex
enum to classify the different phi layers in the muon spectrometer
Definition: MuonStationIndex.h:31
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
Muon::IMuonHitSummaryTool::HitSummary::nphiHoleLayers
unsigned int nphiHoleLayers
number of eta trigger layer holes
Definition: IMuonHitSummaryTool.h:56
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
Muon::MuonHitSummaryTool::m_summaryHelperTool
ToolHandle< Trk::ITrackSummaryHelperTool > m_summaryHelperTool
Definition: MuonHitSummaryTool.h:89
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Muon::IMuonHitSummaryTool::HitSummary::netaTriggerHoleLayers
unsigned int netaTriggerHoleLayers
number of precision holes
Definition: IMuonHitSummaryTool.h:55
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
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
Muon::MuonHitSummaryTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonHitSummaryTool.h:72
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
Muon::IMuonHitSummaryTool::HitSummary::isEndcap
bool isEndcap
number of out of bounds hits
Definition: IMuonHitSummaryTool.h:64
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
Trk::TrackSummary
A summary of the information contained by a track.
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:287
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Muon::IMuonHitSummaryTool::HitSummary
Definition: IMuonHitSummaryTool.h:30
Muon::MuonHitSummaryTool::m_printer
PublicToolHandle< MuonEDMPrinterTool > m_printer
Definition: MuonHitSummaryTool.h:84
Muon::IMuonHitSummaryTool::HitSummary::isSmall
bool isSmall
Definition: IMuonHitSummaryTool.h:65
Muon::IMuonHitSummaryTool::HitSummary::nprecisionHits
unsigned int nprecisionHits
hit counts
Definition: IMuonHitSummaryTool.h:47
DeMoScan.index
string index
Definition: DeMoScan.py:364
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
DEBUG
#define DEBUG
Definition: page_access.h:11
Muon::MuonStationIndex::CSC
@ CSC
Definition: MuonStationIndex.h:33
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
Muon::IMuonHitSummaryTool::HitSummary::netaTriggerLayers
unsigned int netaTriggerLayers
number of precision hits that are not deweighted
Definition: IMuonHitSummaryTool.h:49
Muon::IMuonHitSummaryTool::HitSummary::nprecisionHoles
unsigned int nprecisionHoles
number of paired eta/phi trigger layers
Definition: IMuonHitSummaryTool.h:54
Muon::MuonStationIndex::StIndex
StIndex
enum to classify the different station layers in the muon spectrometer
Definition: MuonStationIndex.h:23
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
Trk::TrackSummary::muonTrackSummary
const MuonTrackSummary * muonTrackSummary() const
returns a pointer to the MuonTrackSummary if available
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
fitman.k
k
Definition: fitman.py:528
NSWL1::PadTriggerAdapter::segment
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
Definition: PadTriggerAdapter.cxx:5
Muon::IMuonHitSummaryTool::HitSummary::nprecisionGoodHits
unsigned int nprecisionGoodHits
number of precision hits
Definition: IMuonHitSummaryTool.h:48
Muon::MuonHitSummaryTool::calculateSummaryCounts
static void calculateSummaryCounts(CompactSummary &sum)
Definition: MuonHitSummaryTool.cxx:139
Identifier
Definition: IdentifierFieldParser.cxx:14