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

#include <SharedHitMapper.h>

Inheritance diagram for SharedHitMapper:
Collaboration diagram for SharedHitMapper:

Public Member Functions

 SharedHitMapper (const std::string &name, ISvcLocator *pSvcLocator)
 
virtual ~SharedHitMapper ()
 
virtual StatusCode initialize ()
 
virtual StatusCode execute ()
 
virtual StatusCode finalize ()
 
int numberSharedBLayer () const
 
int numberSharedPix () const
 
int numberSharedSct () const
 
virtual StatusCode sysInitialize () override
 Override sysInitialize. More...
 
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies. 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 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
 

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

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

std::string m_inputTrackCollection
 
std::string m_sharedHitMapLocation
 location of inputTracks in StoreGate More...
 
double m_deltaRCut
 location of sharedHitMap in StoreGate More...
 
bool m_qualOrder
 pairs of tracks with dR>dRCut not considered More...
 
bool m_useTrackSummaryShared
 
const PixelIDm_pixelId
 if true use shared info from track summary instead of recomputing them More...
 
const SCT_IDm_sctId
 
int m_npl [m_nbpl]
 
int m_npd [m_nbpd]
 
int m_nsl [m_nbsl]
 
int m_nsd [m_nbsd]
 
DataObjIDColl m_extendedExtraObjects
 
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
 

Static Private Attributes

static const int m_nbpl = 3
 
static const int m_nbpd = 3
 
static const int m_nbsl = 4
 
static const int m_nbsd = 9
 

Detailed Description

Definition at line 21 of file SharedHitMapper.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ SharedHitMapper()

SharedHitMapper::SharedHitMapper ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 74 of file SharedHitMapper.cxx.

75  : AthAlgorithm(name, pSvcLocator) {
76  declareProperty("inputTrackCollection", m_inputTrackCollection = "TrackParticleCandidate");
77  declareProperty("sharedHitMapLocation", m_sharedHitMapLocation = "SharedHitMap");
78  declareProperty("deltaRCut", m_deltaRCut = 1.0);
79  declareProperty("QualityOrdering", m_qualOrder = false);
80  declareProperty("useTrackSummaryShared", m_useTrackSummaryShared = true);
81 }

◆ ~SharedHitMapper()

SharedHitMapper::~SharedHitMapper ( )
virtual

Definition at line 83 of file SharedHitMapper.cxx.

83  {
84 }

Member Function Documentation

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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; }

◆ execute()

StatusCode SharedHitMapper::execute ( )
virtual

retrieve input tracks:

Definition at line 102 of file SharedHitMapper.cxx.

102  {
103 
104  MsgStream mlog(msgSvc(), name());
105 
109  if (sc.isFailure()) {
110  ATH_MSG_ERROR("TrackParticles " << m_inputTrackCollection << " not found in StoreGate.");
111  return StatusCode::SUCCESS;
112  }
113  ATH_MSG_VERBOSE("TrackParticleContainer " << m_inputTrackCollection << " found.");
114 
116  ATH_MSG_INFO("Number of initial TrackParticles: " << inputTracks->size());
117 
119  // --- Use shared hit information from TrackSummary:
120  // loop on first track:
123  for (; trk1I!=trkE; ++trk1I) {
124  int nbs, nps, nss;
125  (*trk1I)->summaryValue(nbs, xAOD::numberOfInnermostPixelLayerSharedHits);
126  (*trk1I)->summaryValue(nps, xAOD::numberOfPixelSharedHits);
127  (*trk1I)->summaryValue(nss, xAOD::numberOfSCTSharedHits);
128  if (nbs < 0) nbs = 0;
129  if (nps < 0) nps = 0;
130  if (nss < 0) nss = 0;
131  if(nbs+nps+nss>0) assoc->add( (*trk1I), nbs, nps, nss);
132  }
133  } else {
134  // --- Recompute shared hit information from TrkTracks:
135 
136  vecpairTrkRio myvecTrkRio(0);
137 
138  // loop on first track:
141  for (; trk1I!=trkE; ++trk1I) {
142  const xAOD::TrackParticle* trk1 = (*trk1I);//->track();
143  if(trk1==0) {
144  ATH_MSG_ERROR("Can't get the original track ! Please run on ESD");
145  return StatusCode::SUCCESS;
146  }
147  //
148  // For the quality computation
149  int q1 = 0 ,q2 = 0;
150  int np1 = 0, np2 = 0, ns1 = 0, ns2 = 0;
151  int nhp1 = 0, nhp2 = 0, nhs1 = 0, nhs2 = 0, nh1 = 0, nh2 = 0;
152  int nprec1 = 0, nprec2 = 0;
153  double chi21 = 0., chi22 = 0.;
154  if (m_qualOrder) {
155  chi21 = (*trk1I)->chiSquared();
156  (*trk1I)->summaryValue(np1, xAOD::numberOfPixelHits); if (np1<0)np1=0;
157  (*trk1I)->summaryValue(ns1, xAOD::numberOfSCTHits); if (ns1<0)ns1=0;
158  nprec1 = np1 + ns1;
159  (*trk1I)->summaryValue(nhp1, xAOD::numberOfPixelHoles); if (nhp1<0)nhp1=0;
160  (*trk1I)->summaryValue(nhs1, xAOD::numberOfSCTHoles); if (nhs1<0)nhs1=0;
161  nh1 = nhp1 + nhs1;
162  q1 = 10000*(2*nprec1-nh1) - int(20.*chi21/float(nprec1));
163 
164  }
165  //
166  xAOD::IParticle::FourMom_t t1p4 = (*trk1I)->p4();
167  const DataVector<const Trk::MeasurementBase>* mb = (*trk1->track())->measurementsOnTrack();
170  ATH_MSG_VERBOSE("First track (pT="<<t1p4.Pt()<<", eta="<<t1p4.Eta ()<<") has " << mb->size() << " RIOs on track");
171  // init arrays for pixels:
172  bool pl[m_nbpl]; // layers
173  for(int i=0;i<m_nbpl;i++) m_npl[i] = 0;
174  bool pd[m_nbpd]; // disks
175  for(int i=0;i<m_nbpd;i++) m_npd[i] = 0;
176  // init arrays for sct:
177  bool sl[m_nbsl];
178  for(int i=0;i<m_nbsl;i++) m_nsl[i] = 0;
179  bool sd[m_nbsd];
180  for(int i=0;i<m_nbsd;i++) m_nsd[i] = 0;
181  // loop on second track:
183  for (; trk2I!=trkE; ++trk2I) {
184  if(trk2I==trk1I) continue;
185  const xAOD::TrackParticle* trk2 = (*trk2I);
186  if(trk2==0) {
187  ATH_MSG_ERROR("Can't get the original track ! Please run on ESD");
188  return StatusCode::SUCCESS;
189  }
190  xAOD::IParticle::FourMom_t t2p4 = (*trk2I)->p4();
191  double deltaR = t1p4.DeltaR(t2p4);
192  if(deltaR<m_deltaRCut) {
193  // Assign the shared hit to the worst quality track
194  // If a hit is shared by more than 2 tracks, this will not be perfect...
195  // From IG : Quality = 10000*(2*Nhit-Nhole) - int(20.*Xi2/float(Nhit))
196  if (m_qualOrder) {
197  chi22 = (*trk2I)->chiSquared();
198  (*trk2I)->summaryValue(np2, xAOD::numberOfPixelHits); if (np2<0)np2=0;
199  (*trk2I)->summaryValue(ns2, xAOD::numberOfSCTHits); if (ns2<0)ns2=0;
200  nprec1 = np1 + ns1;
201  (*trk2I)->summaryValue(nhp2, xAOD::numberOfPixelHoles); if (nhp2<0)nhp2=0;
202  (*trk2I)->summaryValue(nhs2, xAOD::numberOfSCTHoles); if (nhs2<0)nhs2=0;
203  nh2 = nhp2 + nhs2;
204  q2 = 10000*(2*nprec2-nh2) - int(20.*chi22/float(nprec2));
205  if (q1 > q2) continue;
206  }
207  // loop on 1st track clusters:
208  nextMb = mb->begin();
209  for(; nextMb != lastMb; ++nextMb) {
210  const Trk::RIO_OnTrack* nextRio = dynamic_cast<const Trk::RIO_OnTrack*>(*nextMb);
211  bool pixl = m_pixelId->is_pixel(nextRio->identify());
212  bool ssct = m_sctId->is_sct(nextRio->identify());
213  if( (!pixl) && (!ssct) ) continue;
214  // pixels:
215  for(int i=0;i<m_nbpl;i++) pl[i] = false;
216  for(int i=0;i<m_nbpd;i++) pd[i] = false;
217  if(pixl) {
218  pl[0] = m_pixelId->is_blayer(nextRio->identify());
219  if(m_pixelId->is_barrel(nextRio->identify())) {
220  int player = m_pixelId->layer_disk(nextRio->identify());
221  for(int i=1;i<m_nbpl;i++) pl[i] = ( player == i );
222  } else {
223  int pdisk = m_pixelId->layer_disk(nextRio->identify());
224  for(int i=0;i<m_nbpd;i++) pd[i] = ( pdisk == i );
225  }
226  }
227  // sct:
228  for(int i=0;i<m_nbsl;i++) sl[i] = false;
229  for(int i=0;i<m_nbsd;i++) sd[i] = false;
230  if(ssct) {
231  if(m_sctId->is_barrel(nextRio->identify())) {
232  int slayer = m_sctId->layer_disk(nextRio->identify());
233  for(int i=0;i<m_nbsl;i++) sl[i] = ( slayer == i );
234  } else {
235  int sdisk = m_sctId->layer_disk(nextRio->identify());
236  for(int i=0;i<m_nbsd;i++) sd[i] = ( sdisk == i );
237  }
238  }
239  // loop on 2nd track clusters:
240  const DataVector<const Trk::MeasurementBase>* mb2 = (*trk2->track())->measurementsOnTrack();
243  if (nextMb == mb->begin()) ATH_MSG_VERBOSE("Second track (pT="<<t2p4.Pt()<<") has " << mb2->size() << " RIOs on track");
244  int nriosi = 0;
245  for(; nextMb2 != lastMb2; ++nextMb2) {
246  const Trk::RIO_OnTrack* nextRio2 = dynamic_cast<const Trk::RIO_OnTrack*>(*nextMb2);
247  bool pixl2 = m_pixelId->is_pixel(nextRio2->identify());
248  bool ssct2 = m_sctId->is_sct(nextRio2->identify());
249  if( (!pixl2) && (!ssct2) ) continue;
250  nriosi++;
251  if( nextRio2->identify() == nextRio->identify() ) {
252  ATH_MSG_DEBUG("Shared hit ! Track1 Pt = " << t1p4.Pt() <<" Track2 Pt = " << t2p4.Pt());
253  if (m_qualOrder) {
254  ATH_MSG_VERBOSE("Track1 chi2 = " << chi21 << " nprec = " << nprec1 << " (np,ns) = (" << np1 << " , " << ns1 << ") " << " nhole = " << nh1 << " (nhp,nhs) = (" << nhp1 << " , " << nhs1 << ") " << " quality = " << q1);
255  ATH_MSG_VERBOSE("Track2 chi2 = " << chi22 << " nprec = " << nprec2 << " (np,ns) = (" << np2 << " , " << ns2 << ") " << " nhole = " << nh2 << " (nhp,nhs) = (" << nhp2 << " , " << nhs2 << ") " << " quality = " << q2);
256  }
257  ATH_MSG_DEBUG(pl[0] << " "<< pl[1] << " " << pl[2]);
258  ATH_MSG_DEBUG(pd[0] << " "<< pd[1] << " " << pd[2]);
259  ATH_MSG_DEBUG(sl[0] << " "<< sl[1] << " " << sl[2] << " " << sl[3]);
260  ATH_MSG_DEBUG(sd[0] << " "<< sd[1] << " " << sd[2] << " " << sd[3] << " " << sd[4] << " "<< sd[5] << " " << sd[6] << " " << sd[7] << " " << sd[8]);
261  pairTrkRio p = std::make_pair(*trk1I,nextRio);
262  for(int i=0;i<m_nbpl;i++) {
263  if (pl[i] && std::find(myvecTrkRio.begin(), myvecTrkRio.end(), p) == myvecTrkRio.end()) {m_npl[i]++;myvecTrkRio.push_back(p);}
264  }
265  for(int i=0;i<m_nbpd;i++) {
266  if (pd[i] && std::find(myvecTrkRio.begin(), myvecTrkRio.end(), p) == myvecTrkRio.end()) {m_npd[i]++;myvecTrkRio.push_back(p);}
267  }
268  for(int i=0;i<m_nbsl;i++) {
269  if (sl[i] && std::find(myvecTrkRio.begin(), myvecTrkRio.end(), p) == myvecTrkRio.end()) {m_nsl[i]++;myvecTrkRio.push_back(p);}
270  }
271  for(int i=0;i<m_nbsd;i++) {
272  if (sd[i] && std::find(myvecTrkRio.begin(), myvecTrkRio.end(), p) == myvecTrkRio.end()) {m_nsd[i]++;myvecTrkRio.push_back(p);}
273  }
274  }
275  } // end loop on rio2
276  } // end loop on rio1
277  }
278  } // end loop on trk2
279  // now store the result:
280  if(this->numberSharedBLayer()+this->numberSharedPix()+this->numberSharedSct()>0) {
281  assoc->add( (*trk1I), this->numberSharedBLayer(),
282  this->numberSharedPix(),
283  this->numberSharedSct() );
284  }
285  } // end loop on trk1
286  }
287 
288  ATH_MSG_INFO("Size of SharedHitMap: " << assoc->size());
289 
290  if (mlog.level() <= MSG::DEBUG) assoc->dump();
291 
292  if(evtStore()->record(assoc,m_sharedHitMapLocation,false).isFailure()) {
293  ATH_MSG_ERROR("recording of SharedHitAssoc " << m_sharedHitMapLocation << " failed.");
294  } else {
295  ATH_MSG_VERBOSE("Recording of SharedHitAssoc " << m_sharedHitMapLocation << " succeeded, coll is now const." );
296  }
297 
298 
299  return StatusCode::SUCCESS;
300 }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::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

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51 {
52  // If we didn't find any symlinks to add, just return the collection
53  // from the base class. Otherwise, return the extended collection.
54  if (!m_extendedExtraObjects.empty()) {
56  }
57  return Algorithm::extraOutputDeps();
58 }

◆ finalize()

StatusCode SharedHitMapper::finalize ( )
virtual

Definition at line 302 of file SharedHitMapper.cxx.

302  {
303  return StatusCode::SUCCESS;
304 }

◆ initialize()

StatusCode SharedHitMapper::initialize ( )
virtual

Definition at line 86 of file SharedHitMapper.cxx.

86  {
88  StatusCode sc = detStore()->retrieve(m_pixelId, "PixelID");
89  if (sc.isFailure()) {
90  ATH_MSG_ERROR("Could not get PixelID helper !");
91  }
92  sc = detStore()->retrieve(m_sctId, "SCT_ID");
93  if (sc.isFailure()) {
94  ATH_MSG_ERROR("Could not get SCT_ID helper !");
95  }
96  }
97  std::cout<<name()<<" with input tracks "<<m_inputTrackCollection<<std::endl;
98  std::cout<<name()<<" initialized"<<std::endl;
99  return StatusCode::SUCCESS;
100 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Algorithm > >::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.

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

MsgStream& AthCommonMsg< Algorithm >::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< Algorithm >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

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

◆ numberSharedBLayer()

int SharedHitMapper::numberSharedBLayer ( ) const

Definition at line 306 of file SharedHitMapper.cxx.

306  {
307  return m_npl[0];
308 }

◆ numberSharedPix()

int SharedHitMapper::numberSharedPix ( ) const

Definition at line 310 of file SharedHitMapper.cxx.

310  {
311  int nbs = 0;
312  for(int i=0;i<m_nbpl;i++) nbs += m_npl[i];
313  for(int i=0;i<m_nbpd;i++) nbs += m_npd[i];
314  return nbs;
315 }

◆ numberSharedSct()

int SharedHitMapper::numberSharedSct ( ) const

Definition at line 317 of file SharedHitMapper.cxx.

317  {
318  int nbs = 0;
319  for(int i=0;i<m_nbsl;i++) nbs += m_nsl[i];
320  for(int i=0;i<m_nbsd;i++) nbs += m_nsd[i];
321  return nbs;
322 }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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  }

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, PyAthena::Alg, and AthHistogramAlgorithm.

Definition at line 66 of file AthAlgorithm.cxx.

66  {
68 
69  if (sc.isFailure()) {
70  return sc;
71  }
72  ServiceHandle<ICondSvc> cs("CondSvc",name());
73  for (auto h : outputHandles()) {
74  if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75  // do this inside the loop so we don't create the CondSvc until needed
76  if ( cs.retrieve().isFailure() ) {
77  ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78  return StatusCode::SUCCESS;
79  }
80  if (cs->regHandle(this,*h).isFailure()) {
81  sc = StatusCode::FAILURE;
82  ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83  << " with CondSvc");
84  }
85  }
86  }
87  return sc;
88 }

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm > >::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_deltaRCut

double SharedHitMapper::m_deltaRCut
private

location of sharedHitMap in StoreGate

Definition at line 38 of file SharedHitMapper.h.

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_inputTrackCollection

std::string SharedHitMapper::m_inputTrackCollection
private

Definition at line 36 of file SharedHitMapper.h.

◆ m_nbpd

const int SharedHitMapper::m_nbpd = 3
staticprivate

Definition at line 45 of file SharedHitMapper.h.

◆ m_nbpl

const int SharedHitMapper::m_nbpl = 3
staticprivate

Definition at line 44 of file SharedHitMapper.h.

◆ m_nbsd

const int SharedHitMapper::m_nbsd = 9
staticprivate

Definition at line 47 of file SharedHitMapper.h.

◆ m_nbsl

const int SharedHitMapper::m_nbsl = 4
staticprivate

Definition at line 46 of file SharedHitMapper.h.

◆ m_npd

int SharedHitMapper::m_npd[m_nbpd]
private

Definition at line 49 of file SharedHitMapper.h.

◆ m_npl

int SharedHitMapper::m_npl[m_nbpl]
private

Definition at line 48 of file SharedHitMapper.h.

◆ m_nsd

int SharedHitMapper::m_nsd[m_nbsd]
private

Definition at line 51 of file SharedHitMapper.h.

◆ m_nsl

int SharedHitMapper::m_nsl[m_nbsl]
private

Definition at line 50 of file SharedHitMapper.h.

◆ m_pixelId

const PixelID* SharedHitMapper::m_pixelId
private

if true use shared info from track summary instead of recomputing them

Definition at line 41 of file SharedHitMapper.h.

◆ m_qualOrder

bool SharedHitMapper::m_qualOrder
private

pairs of tracks with dR>dRCut not considered

Definition at line 39 of file SharedHitMapper.h.

◆ m_sctId

const SCT_ID* SharedHitMapper::m_sctId
private

Definition at line 42 of file SharedHitMapper.h.

◆ m_sharedHitMapLocation

std::string SharedHitMapper::m_sharedHitMapLocation
private

location of inputTracks in StoreGate

Definition at line 37 of file SharedHitMapper.h.

◆ m_useTrackSummaryShared

bool SharedHitMapper::m_useTrackSummaryShared
private

Definition at line 40 of file SharedHitMapper.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
AtlasDetectorID::is_pixel
bool is_pixel(Identifier id) const
Definition: AtlasDetectorID.h:760
xAOD::numberOfPixelHoles
@ numberOfPixelHoles
number of pixel layers on track with absence of hits [unit8_t].
Definition: TrackingPrimitives.h:261
SharedHitTrackAssoc::size
int size() const
Definition: SharedHitMapper.h:67
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
vecpairTrkRio
std::vector< pairTrkRio > vecpairTrkRio
Definition: SharedHitMapper.cxx:19
SharedHitMapper::numberSharedBLayer
int numberSharedBLayer() const
Definition: SharedHitMapper.cxx:306
xAOD::numberOfSCTSharedHits
@ numberOfSCTSharedHits
number of SCT hits shared by several tracks [unit8_t].
Definition: TrackingPrimitives.h:272
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SharedHitMapper::m_nbsd
static const int m_nbsd
Definition: SharedHitMapper.h:47
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
SharedHitMapper::m_useTrackSummaryShared
bool m_useTrackSummaryShared
Definition: SharedHitMapper.h:40
AtlasDetectorID::is_sct
bool is_sct(Identifier id) const
Definition: AtlasDetectorID.h:770
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
pairTrkRio
std::pair< const xAOD::TrackParticle *, const Trk::RIO_OnTrack * > pairTrkRio
Definition: SharedHitMapper.cxx:18
SharedHitMapper::m_nbpl
static const int m_nbpl
Definition: SharedHitMapper.h:44
SharedHitMapper::m_nbsl
static const int m_nbsl
Definition: SharedHitMapper.h:46
SharedHitMapper::numberSharedPix
int numberSharedPix() const
Definition: SharedHitMapper.cxx:310
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
SharedHitMapper::m_pixelId
const PixelID * m_pixelId
if true use shared info from track summary instead of recomputing them
Definition: SharedHitMapper.h:41
xAOD::numberOfPixelHits
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
Definition: TrackingPrimitives.h:259
makeDTCalibBlob_pickPhase.pd
pd
Definition: makeDTCalibBlob_pickPhase.py:342
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SharedHitMapper::m_inputTrackCollection
std::string m_inputTrackCollection
Definition: SharedHitMapper.h:36
SharedHitTrackAssoc::add
void add(const xAOD::TrackParticle *const trk, int shPattern)
Definition: SharedHitMapper.cxx:26
PixelID::is_blayer
bool is_blayer(const Identifier &id) const
Test for b-layer - WARNING: id MUST be pixel id, otherwise answer is not accurate....
Definition: PixelID.h:633
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
xAOD::IParticle::FourMom_t
TLorentzVector FourMom_t
Definition of the 4-momentum type.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:69
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
python.selector.AtlRunQuerySelectorLhcOlc.sd
sd
Definition: AtlRunQuerySelectorLhcOlc.py:612
SharedHitMapper::m_nbpd
static const int m_nbpd
Definition: SharedHitMapper.h:45
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
PixelID::is_barrel
bool is_barrel(const Identifier &id) const
Test for barrel - WARNING: id MUST be pixel id, otherwise answer is not accurate. Use SiliconID for g...
Definition: PixelID.h:605
xAOD::numberOfPixelSharedHits
@ numberOfPixelSharedHits
number of Pixel all-layer hits shared by several tracks [unit8_t].
Definition: TrackingPrimitives.h:262
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
AthAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthAlgorithm.cxx:66
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
SharedHitMapper::m_qualOrder
bool m_qualOrder
pairs of tracks with dR>dRCut not considered
Definition: SharedHitMapper.h:39
python.InDetPriVxFinderConfig.mlog
mlog
Definition: InDetPriVxFinderConfig.py:134
AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
python.TrigInDetConfig.inputTracks
inputTracks
Definition: TrigInDetConfig.py:183
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
SharedHitMapper::m_nsl
int m_nsl[m_nbsl]
Definition: SharedHitMapper.h:50
SharedHitMapper::m_sharedHitMapLocation
std::string m_sharedHitMapLocation
location of inputTracks in StoreGate
Definition: SharedHitMapper.h:37
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
xAOD::numberOfSCTHoles
@ numberOfSCTHoles
number of SCT holes [unit8_t].
Definition: TrackingPrimitives.h:270
SharedHitMapper::m_nsd
int m_nsd[m_nbsd]
Definition: SharedHitMapper.h:51
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
SharedHitTrackAssoc
Definition: SharedHitMapper.h:60
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
PixelID::layer_disk
int layer_disk(const Identifier &id) const
Definition: PixelID.h:626
SharedHitMapper::m_deltaRCut
double m_deltaRCut
location of sharedHitMap in StoreGate
Definition: SharedHitMapper.h:38
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
SCT_ID::layer_disk
int layer_disk(const Identifier &id) const
Definition: SCT_ID.h:734
SharedHitTrackAssoc::dump
void dump() const
Definition: SharedHitMapper.cxx:55
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
AthAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Definition: AthAlgorithm.h:79
SharedHitMapper::numberSharedSct
int numberSharedSct() const
Definition: SharedHitMapper.cxx:317
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
TRT_PAI_physicsConstants::mb
const double mb
1mb to cm2
Definition: TRT_PAI_physicsConstants.h:15
SharedHitMapper::m_npd
int m_npd[m_nbpd]
Definition: SharedHitMapper.h:49
Trk::RIO_OnTrack::identify
Identifier identify() const
return the identifier -extends MeasurementBase
Definition: RIO_OnTrack.h:152
DEBUG
#define DEBUG
Definition: page_access.h:11
SharedHitMapper::m_npl
int m_npl[m_nbpl]
Definition: SharedHitMapper.h:48
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
xAOD::numberOfInnermostPixelLayerSharedHits
@ numberOfInnermostPixelLayerSharedHits
number of Pixel 0th layer barrel hits shared by several tracks.
Definition: TrackingPrimitives.h:239
xAOD::numberOfSCTHits
@ numberOfSCTHits
number of hits in SCT [unit8_t].
Definition: TrackingPrimitives.h:268
AthAlgorithm::AthAlgorithm
AthAlgorithm()
Default constructor:
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
xAOD::TrackParticle_v1::track
const Trk::Track * track() const
Returns a pointer (which can be NULL) to the Trk::Track which was used to make this TrackParticle.
Definition: TrackParticle_v1.cxx:805
makeComparison.deltaR
float deltaR
Definition: makeComparison.py:36
SharedHitMapper::m_sctId
const SCT_ID * m_sctId
Definition: SharedHitMapper.h:42
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::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
fitman.k
k
Definition: fitman.py:528
SCT_ID::is_barrel
bool is_barrel(const Identifier &id) const
Test for barrel - WARNING: id MUST be sct id, otherwise answer is not accurate. Use SiliconID for gen...
Definition: SCT_ID.h:721
ServiceHandle< ICondSvc >