ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Prompt::PrimaryVertexReFitter Class Reference

#include <PrimaryVertexReFitter.h>

Inheritance diagram for Prompt::PrimaryVertexReFitter:
Collaboration diagram for Prompt::PrimaryVertexReFitter:

Public Member Functions

 PrimaryVertexReFitter (const std::string &name, ISvcLocator *pSvcLocator)
 
virtual StatusCode initialize () override
 
virtual StatusCode execute () override
 
virtual StatusCode finalize () override
 
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 SG::AuxElement::Decorator< float > decoratorFloat_t
 
typedef SG::AuxElement::Decorator< ElementLink< xAOD::VertexContainer > > decoratorElemVtx_t
 
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

bool decorateLepWithReFitPrimaryVertex (const FittingInput &input, const xAOD::TrackParticle *tracklep, const xAOD::IParticle *lep, const std::vector< const xAOD::TrackParticle * > &tracks, xAOD::VertexContainer &refitVtxContainer)
 
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

ToolHandle< Prompt::VertexFittingToolm_vertexFitterTool
 
Gaudi::Property< bool > m_printTime {this, "PrintTime", false}
 
Gaudi::Property< std::string > m_distToRefittedPriVtxName
 
Gaudi::Property< std::string > m_normDistToRefittedPriVtxName
 
Gaudi::Property< std::string > m_lepVtxLinkName
 
Gaudi::Property< std::string > m_lepRefittedVtxWithoutLeptonLinkName
 
TStopwatch m_timerAll
 
TStopwatch m_timerExec
 
SG::ReadHandleKey< xAOD::TrackParticleContainerm_inDetTracksKey
 
SG::ReadHandleKey< xAOD::IParticleContainerm_leptonContainerKey
 
SG::ReadHandleKey< xAOD::VertexContainerm_primaryVertexContainerKey
 
SG::WriteHandleKey< xAOD::VertexContainerm_reFitPrimaryVertexKey
 
std::unique_ptr< decoratorFloat_tm_distToRefittedPriVtx
 
std::unique_ptr< decoratorFloat_tm_normdistToRefittedPriVtx
 
std::unique_ptr< decoratorElemVtx_tm_lepRefittedRMVtxLinkDec
 
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
 

Detailed Description

Definition at line 51 of file PrimaryVertexReFitter.h.

Member Typedef Documentation

◆ decoratorElemVtx_t

Definition at line 84 of file PrimaryVertexReFitter.h.

◆ decoratorFloat_t

Definition at line 83 of file PrimaryVertexReFitter.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ PrimaryVertexReFitter()

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

Definition at line 18 of file PrimaryVertexReFitter.cxx.

18  :
19  AthAlgorithm (name, pSvcLocator)
20 {}

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  }

◆ decorateLepWithReFitPrimaryVertex()

bool Prompt::PrimaryVertexReFitter::decorateLepWithReFitPrimaryVertex ( const FittingInput input,
const xAOD::TrackParticle tracklep,
const xAOD::IParticle lep,
const std::vector< const xAOD::TrackParticle * > &  tracks,
xAOD::VertexContainer refitVtxContainer 
)
private

Definition at line 243 of file PrimaryVertexReFitter.cxx.

249 {
250  //
251  // Check if the lepton track has been used for primary vertex reconstruction.
252  // if true, then remove the lepton track from the input track list, re-fit primary vertex again.
253  // Save the ElementLink of the re-fit primary vertex to the lepton
254  //
255  if(!input.priVtx) {
256  ATH_MSG_WARNING("decorateLepWithReFitPrimaryVertex - invalid input primary vertex pointer");
257  return false;
258  }
259 
260  //--------------------------------------------------------
261  // Remove the lepton track from the track list
262  // get re-fitted non-prompt primary vertex
263  //
264  std::vector<const xAOD::TrackParticle*> priVtx_tracks_pass;
265  bool isRefit = false;
266 
267  for(const xAOD::TrackParticle *track: tracks) {
268  if(track == tracklep) {
269  isRefit = true;
270  ATH_MSG_DEBUG("decorateLepWithReFitPrimaryVertex -- lepton has been used, lepton pT =" << tracklep->pt() << ", track pT =" << track->pt());
271  continue;
272  }
273 
274  priVtx_tracks_pass.push_back(track);
275  }
276 
277  ElementLink<xAOD::VertexContainer> refittedRM_pv_link;
278 
279  if(!isRefit) {
280  ATH_MSG_DEBUG("decorateLepWithReFitPrimaryVertex -- Skip the primary vertex without lepton track");
281 
282  (*m_lepRefittedRMVtxLinkDec)(*lep) = refittedRM_pv_link;
283  return false;
284  }
285 
286  if(priVtx_tracks_pass.size() < 2) {
287  ATH_MSG_DEBUG("decorateLepWithReFitPrimaryVertex -- Skip the primary vertex refitting: N tracks =" << priVtx_tracks_pass.size());
288 
289  (*m_lepRefittedRMVtxLinkDec)(*lep) = refittedRM_pv_link;
290  return false;
291  }
292 
293  // TODO: probably need to fix memory management here
294  // but I'm not sure what happens with the ElementLink later
295  // so didn't want the vertex to be deleted by accident
296  xAOD::Vertex* refittedVtxRMLep = m_vertexFitterTool->fitVertexWithSeed(
297  input, priVtx_tracks_pass, input.priVtx->position(),
299  ).release();
300 
301  if(refittedVtxRMLep) {
302  //
303  // Record vertex with output container
304  //
305  refitVtxContainer.push_back(refittedVtxRMLep);
306 
307  // TODO: I don't know if this is the correct use of an ElementLink
308  //
309  // Add refitted non-prompt vertex ElementLink to the lepton
310  //
311  refittedRM_pv_link.toContainedElement(refitVtxContainer, refittedVtxRMLep);
312 
313  ATH_MSG_DEBUG("decorateLepWithReFitPrimaryVertex -- save refitted non-prompt primary vertex with NTrack = " << refittedVtxRMLep->nTrackParticles());
314 
315  if(input.refittedPriVtx) {
316  (*m_distToRefittedPriVtx) (*refittedVtxRMLep) = Prompt::getDistance(input.refittedPriVtx->position(), refittedVtxRMLep->position());
317  (*m_normdistToRefittedPriVtx)(*refittedVtxRMLep) = Prompt::getNormDist(
318  input.refittedPriVtx->position(),
319  refittedVtxRMLep->position(),
320  refittedVtxRMLep->covariance(),
321  msg(MSG::WARNING)
322  );
323  }
324  }
325 
326  (*m_lepRefittedRMVtxLinkDec)(*lep) = refittedRM_pv_link;
327 
328  return true;
329 }

◆ 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 Prompt::PrimaryVertexReFitter::execute ( )
overridevirtual

Definition at line 90 of file PrimaryVertexReFitter.cxx.

91 {
92  //
93  // Start execute timer
94  //
95  TimerScopeHelper timer(m_timerExec);
96 
97  //
98  // Find Inner Detector tracks
99  //
101  if (!h_inDetTracks.isValid()){
102  ATH_MSG_FATAL("execute - failed to find the InDetTrackParticles");
103  return StatusCode::FAILURE;
104  }
105 
106  const xAOD::TrackParticleContainer inDetTracks = *h_inDetTracks;
107 
108  //
109  // Create output vertex collections and record them immediately
110  // in StoreGate for memory management
111  //
112  std::unique_ptr<xAOD::VertexContainer> refitVtxContainer = std::make_unique< xAOD::VertexContainer>();
113  std::unique_ptr<xAOD::VertexAuxContainer> refitVtxContainerAux = std::make_unique< xAOD::VertexAuxContainer>();
114 
115  refitVtxContainer->setStore(refitVtxContainerAux.get());
116 
117  // Take reference BEFORE pointers moved to SG
118  xAOD::VertexContainer &refitVtxContainerRef = *refitVtxContainer;
119 
121  ATH_CHECK(h_refitVtxContainer.record(
122  std::move(refitVtxContainer), std::move(refitVtxContainerAux)
123  ));
124 
125  //
126  // Retrieve containers from evtStore
127  //
129  if (!h_leptonContainer.isValid()){
130  ATH_MSG_FATAL("execute - failed to find the lepton container");
131  return StatusCode::FAILURE;
132  }
133 
135  if (!h_vertices.isValid()){
136  ATH_MSG_FATAL("execute - failed to find the vertices");
137  return StatusCode::FAILURE;
138  }
139 
140  const xAOD::IParticleContainer leptonContainer = *h_leptonContainer;
141  const xAOD::VertexContainer vertices = *h_vertices;
142 
143  Prompt::FittingInput fittingInput(&inDetTracks, 0, 0);
144 
145  for(const xAOD::Vertex *vertex: vertices) {
146  if(vertex->vertexType() == 1) {
147  fittingInput.priVtx = dynamic_cast<const xAOD::Vertex*>(vertex);
148  break;
149  }
150  }
151 
152  if(!fittingInput.priVtx) {
153  ATH_MSG_INFO("Failed to find primary vertices - save empty containers");
154  return StatusCode::SUCCESS;
155  }
156 
157  //
158  // Collect tracks used for primary vertex fit
159  //
160  std::vector<const xAOD::TrackParticle *> priVtx_tracks;
161  priVtx_tracks.reserve(fittingInput.priVtx->nTrackParticles());
162 
163  for(unsigned k = 0; k < fittingInput.priVtx->nTrackParticles(); ++k) {
164  const xAOD::TrackParticle *track = fittingInput.priVtx->trackParticle(k);
165 
166  if(track) {
167  priVtx_tracks.push_back(track);
168  }
169  }
170 
171  // Refit primary vertex
172  std::unique_ptr<xAOD::Vertex> refittedPriVtx = m_vertexFitterTool->fitVertexWithSeed(
173  fittingInput, priVtx_tracks,
174  fittingInput.priVtx->position(),
176  );
177 
178  if(!refittedPriVtx) {
179  ATH_MSG_WARNING("Failed to refit primary vertex - save empty containers");
180  return StatusCode::SUCCESS;
181  }
182 
183  //
184  // Save refitted primary vertex for fitting service
185  //
186  fittingInput.refittedPriVtx = refittedPriVtx.get();
187 
188  ATH_MSG_DEBUG("execute -- primary vertex NTrack = " << fittingInput.priVtx ->nTrackParticles());
189  ATH_MSG_DEBUG("execute -- refitted primary vertex NTrack = " << fittingInput.refittedPriVtx->nTrackParticles());
190 
191  //
192  // Dynamic cast IParticle container to electron or muon container
193  //
194  ATH_MSG_DEBUG("======================================="
195  << "\n\t\t\t Size of lepton container: " << leptonContainer.size()
196  << "\n-----------------------------------------------------------------");
197 
198  for(const xAOD::IParticle *lepton: leptonContainer) {
199  const xAOD::TrackParticle *tracklep = 0;
200  const xAOD::Electron *elec = dynamic_cast<const xAOD::Electron*>(lepton);
201  const xAOD::Muon *muon = dynamic_cast<const xAOD::Muon*>(lepton);
202 
203  if(elec) {
204  //
205  // get GSF track
206  //
207  const xAOD::TrackParticle *bestmatchedGSFElTrack=elec->trackParticle(0);
208 
209  //
210  // get origin ID track for later study
211  //
212  tracklep = xAOD::EgammaHelpers::getOriginalTrackParticleFromGSF(bestmatchedGSFElTrack);
213  }
214  else if(muon) {
215  if(muon->inDetTrackParticleLink().isValid()) {
216  tracklep = *(muon->inDetTrackParticleLink());
217  }
218  else {
219  ATH_MSG_DEBUG("PrimaryVertexReFitter::execute - skip muon without valid inDetTrackParticleLink()");
220  continue;
221  }
222  }
223 
224  if(!tracklep) {
225  ATH_MSG_WARNING("PrimaryVertexReFitter::execute - cannot find muon->inDetTrackParticleLink() nor electron->trackParticle()");
226  continue;
227  }
228 
229  decorateLepWithReFitPrimaryVertex(fittingInput, tracklep, lepton, priVtx_tracks, refitVtxContainerRef);
230  }
231 
232  h_refitVtxContainer->push_back(std::move(refittedPriVtx));
233 
234  ATH_MSG_DEBUG("SV Vertex container " << m_reFitPrimaryVertexKey << " recorded in store");
235 
236  ATH_MSG_DEBUG("execute - all done");
237  ATH_MSG_DEBUG("=======================================");
238 
239  return StatusCode::SUCCESS;
240 }

◆ 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 Prompt::PrimaryVertexReFitter::finalize ( )
overridevirtual

Definition at line 74 of file PrimaryVertexReFitter.cxx.

75 {
76  if(m_printTime) {
77  //
78  // Print full time stopwatch
79  //
80  m_timerAll.Stop();
81 
82  ATH_MSG_INFO("Real time: " << m_timerAll.RealTime() << "\t CPU time: " << m_timerAll.CpuTime());
83  ATH_MSG_INFO("Execute time: " << PrintResetStopWatch(m_timerExec));
84  }
85 
86  return StatusCode::SUCCESS;
87 }

◆ initialize()

StatusCode Prompt::PrimaryVertexReFitter::initialize ( )
overridevirtual

Definition at line 23 of file PrimaryVertexReFitter.cxx.

24 {
25  ANA_MSG_DEBUG("ReFitPriVtxName = " << m_reFitPrimaryVertexKey);
26  ANA_MSG_DEBUG("LeptonContainerName = " << m_leptonContainerKey);
27  ANA_MSG_DEBUG("PriVertexContainerName = " << m_primaryVertexContainerKey);
28 
29  ANA_MSG_DEBUG("PrintTime = " << m_printTime);
30 
31  ANA_MSG_DEBUG("DistToRefittedPriVtxName = " << m_distToRefittedPriVtxName);
32  ANA_MSG_DEBUG("NormDistToRefittedPriVtxName = " << m_normDistToRefittedPriVtxName);
33  ANA_MSG_DEBUG("RefittedVtxLinkName = " << m_lepVtxLinkName);
34  ANA_MSG_DEBUG("RefittedVtxWithoutLeptonLinkName = " << m_lepRefittedVtxWithoutLeptonLinkName);
35 
37 
38  ATH_CHECK(m_leptonContainerKey.initialize());
40 
41  ATH_CHECK(m_reFitPrimaryVertexKey.initialize());
42 
43  //
44  // Must have non-empty container name for refitted primary vertex with/without lepton
45  //
46  if(m_reFitPrimaryVertexKey.empty()) {
47  ATH_MSG_FATAL("initialize - SecVtx container invalid name: \"" << m_reFitPrimaryVertexKey << "\"");
48  return StatusCode::FAILURE;
49  }
50 
51  m_distToRefittedPriVtx = std::make_unique<decoratorFloat_t> (m_distToRefittedPriVtxName);
52  m_normdistToRefittedPriVtx = std::make_unique<decoratorFloat_t> (m_normDistToRefittedPriVtxName);
53  m_lepRefittedRMVtxLinkDec = std::make_unique<decoratorElemVtx_t>(m_lepRefittedVtxWithoutLeptonLinkName);
54 
55  ATH_CHECK(m_vertexFitterTool.retrieve());
56 
57  if(m_printTime) {
58  //
59  // Reset timers
60  //
61  m_timerAll .Reset();
62  m_timerExec.Reset();
63 
64  //
65  // Start full timer
66  //
67  m_timerAll.Start();
68  }
69 
70  return StatusCode::SUCCESS;
71 }

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

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

std::unique_ptr<decoratorFloat_t> Prompt::PrimaryVertexReFitter::m_distToRefittedPriVtx
private

Definition at line 137 of file PrimaryVertexReFitter.h.

◆ m_distToRefittedPriVtxName

Gaudi::Property<std::string> Prompt::PrimaryVertexReFitter::m_distToRefittedPriVtxName
private
Initial value:
{
this, "DistToRefittedPriVtxName", "default"
}

Definition at line 100 of file PrimaryVertexReFitter.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_inDetTracksKey

SG::ReadHandleKey<xAOD::TrackParticleContainer> Prompt::PrimaryVertexReFitter::m_inDetTracksKey
private
Initial value:
{
this, "InDetTrackParticlesKey", "InDetTrackParticles"
}

Definition at line 117 of file PrimaryVertexReFitter.h.

◆ m_lepRefittedRMVtxLinkDec

std::unique_ptr<decoratorElemVtx_t> Prompt::PrimaryVertexReFitter::m_lepRefittedRMVtxLinkDec
private

Definition at line 139 of file PrimaryVertexReFitter.h.

◆ m_lepRefittedVtxWithoutLeptonLinkName

Gaudi::Property<std::string> Prompt::PrimaryVertexReFitter::m_lepRefittedVtxWithoutLeptonLinkName
private
Initial value:
{
this, "RefittedVtxWithoutLeptonLinkName", "default"
}

Definition at line 109 of file PrimaryVertexReFitter.h.

◆ m_leptonContainerKey

SG::ReadHandleKey<xAOD::IParticleContainer> Prompt::PrimaryVertexReFitter::m_leptonContainerKey
private
Initial value:
{
this,
"LeptonContainerName",
"lepContainerNameDefault", "Name of lepton container"
}

Definition at line 121 of file PrimaryVertexReFitter.h.

◆ m_lepVtxLinkName

Gaudi::Property<std::string> Prompt::PrimaryVertexReFitter::m_lepVtxLinkName
private
Initial value:
{
this, "RefittedVtxLinkName", "default"
}

Definition at line 106 of file PrimaryVertexReFitter.h.

◆ m_normdistToRefittedPriVtx

std::unique_ptr<decoratorFloat_t> Prompt::PrimaryVertexReFitter::m_normdistToRefittedPriVtx
private

Definition at line 138 of file PrimaryVertexReFitter.h.

◆ m_normDistToRefittedPriVtxName

Gaudi::Property<std::string> Prompt::PrimaryVertexReFitter::m_normDistToRefittedPriVtxName
private
Initial value:
{
this, "NormDistToRefittedPriVtxName", "default"
}

Definition at line 103 of file PrimaryVertexReFitter.h.

◆ m_primaryVertexContainerKey

SG::ReadHandleKey<xAOD::VertexContainer> Prompt::PrimaryVertexReFitter::m_primaryVertexContainerKey
private
Initial value:
{
this, "PriVertexContainerName", "PrimaryVertices",
"Name of primary vertex container"
}

Definition at line 126 of file PrimaryVertexReFitter.h.

◆ m_printTime

Gaudi::Property<bool> Prompt::PrimaryVertexReFitter::m_printTime {this, "PrintTime", false}
private

Definition at line 98 of file PrimaryVertexReFitter.h.

◆ m_reFitPrimaryVertexKey

SG::WriteHandleKey<xAOD::VertexContainer> Prompt::PrimaryVertexReFitter::m_reFitPrimaryVertexKey
private
Initial value:
{
this, "ReFitPriVtxName", "default"
}

Definition at line 130 of file PrimaryVertexReFitter.h.

◆ m_timerAll

TStopwatch Prompt::PrimaryVertexReFitter::m_timerAll
private

Definition at line 113 of file PrimaryVertexReFitter.h.

◆ m_timerExec

TStopwatch Prompt::PrimaryVertexReFitter::m_timerExec
private

Definition at line 114 of file PrimaryVertexReFitter.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vertexFitterTool

ToolHandle<Prompt::VertexFittingTool> Prompt::PrimaryVertexReFitter::m_vertexFitterTool
private
Initial value:
{
this, "VertexFittingTool", "Prompt::VertexFittingTool/VertexFittingTool"
}

Definition at line 91 of file PrimaryVertexReFitter.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:
xAOD::TrackParticle_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: TrackParticle_v1.cxx:73
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:195
Prompt::PrimaryVertexReFitter::m_timerExec
TStopwatch m_timerExec
Definition: PrimaryVertexReFitter.h:114
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
xAOD::Vertex_v1::nTrackParticles
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
Definition: Vertex_v1.cxx:270
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Prompt::PrimaryVertexReFitter::m_vertexFitterTool
ToolHandle< Prompt::VertexFittingTool > m_vertexFitterTool
Definition: PrimaryVertexReFitter.h:91
Prompt::PrimaryVertexReFitter::m_timerAll
TStopwatch m_timerAll
Definition: PrimaryVertexReFitter.h:113
Prompt::PrimaryVertexReFitter::m_distToRefittedPriVtx
std::unique_ptr< decoratorFloat_t > m_distToRefittedPriVtx
Definition: PrimaryVertexReFitter.h:137
Prompt::PrimaryVertexReFitter::m_leptonContainerKey
SG::ReadHandleKey< xAOD::IParticleContainer > m_leptonContainerKey
Definition: PrimaryVertexReFitter.h:121
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
Prompt::PrimaryVertexReFitter::m_reFitPrimaryVertexKey
SG::WriteHandleKey< xAOD::VertexContainer > m_reFitPrimaryVertexKey
Definition: PrimaryVertexReFitter.h:130
xAOD::Electron_v1::trackParticle
const xAOD::TrackParticle * trackParticle(size_t index=0) const
Pointer to the xAOD::TrackParticle/s that match the electron candidate.
Definition: Electron_v1.cxx:55
Prompt::PrimaryVertexReFitter::m_lepRefittedRMVtxLinkDec
std::unique_ptr< decoratorElemVtx_t > m_lepRefittedRMVtxLinkDec
Definition: PrimaryVertexReFitter.h:139
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
Prompt::FittingInput
Definition: IVertexFittingTool.h:60
Prompt::PrintResetStopWatch
std::string PrintResetStopWatch(TStopwatch &watch)
Definition: PromptUtils.cxx:244
Prompt::PrimaryVertexReFitter::m_normdistToRefittedPriVtx
std::unique_ptr< decoratorFloat_t > m_normdistToRefittedPriVtx
Definition: PrimaryVertexReFitter.h:138
Prompt::PrimaryVertexReFitter::m_normDistToRefittedPriVtxName
Gaudi::Property< std::string > m_normDistToRefittedPriVtxName
Definition: PrimaryVertexReFitter.h:103
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
Prompt::PrimaryVertexReFitter::m_lepVtxLinkName
Gaudi::Property< std::string > m_lepVtxLinkName
Definition: PrimaryVertexReFitter.h:106
python.utils.AtlRunQueryTimer.timer
def timer(name, disabled=False)
Definition: AtlRunQueryTimer.py:86
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
Prompt::kRefittedPriVtxWithoutLep
@ kRefittedPriVtxWithoutLep
Definition: IVertexFittingTool.h:66
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
Prompt::getNormDist
double getNormDist(const Amg::Vector3D &PrimVtx, const Amg::Vector3D &SecVtx, const std::vector< float > &ErrorMatrix, MsgStream &msg)
Definition: PromptUtils.cxx:57
Prompt::PrimaryVertexReFitter::decorateLepWithReFitPrimaryVertex
bool decorateLepWithReFitPrimaryVertex(const FittingInput &input, const xAOD::TrackParticle *tracklep, const xAOD::IParticle *lep, const std::vector< const xAOD::TrackParticle * > &tracks, xAOD::VertexContainer &refitVtxContainer)
Definition: PrimaryVertexReFitter.cxx:243
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
Prompt::getDistance
double getDistance(const xAOD::Vertex *vtx1, const xAOD::Vertex *vtx2)
Definition: PromptUtils.cxx:41
AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
Prompt::kRefittedPriVtx
@ kRefittedPriVtx
Definition: IVertexFittingTool.h:65
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
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
Prompt::PrimaryVertexReFitter::m_printTime
Gaudi::Property< bool > m_printTime
Definition: PrimaryVertexReFitter.h:98
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
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
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Prompt::PrimaryVertexReFitter::m_lepRefittedVtxWithoutLeptonLinkName
Gaudi::Property< std::string > m_lepRefittedVtxWithoutLeptonLinkName
Definition: PrimaryVertexReFitter.h:109
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
xAOD::EgammaHelpers::getOriginalTrackParticleFromGSF
const xAOD::TrackParticle * getOriginalTrackParticleFromGSF(const xAOD::TrackParticle *trkPar)
Helper function for getting the "Original" Track Particle (i.e before GSF) via the GSF Track Particle...
Definition: ElectronxAODHelpers.cxx:22
xAOD::Electron_v1
Definition: Electron_v1.h:34
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
AthAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Definition: AthAlgorithm.h:79
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
Prompt::PrimaryVertexReFitter::m_inDetTracksKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_inDetTracksKey
Definition: PrimaryVertexReFitter.h:117
Prompt::PrimaryVertexReFitter::m_primaryVertexContainerKey
SG::ReadHandleKey< xAOD::VertexContainer > m_primaryVertexContainerKey
Definition: PrimaryVertexReFitter.h:126
a
TList * a
Definition: liststreamerinfos.cxx:10
h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AthCommonMsg< Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
AthAlgorithm::AthAlgorithm
AthAlgorithm()
Default constructor:
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
Prompt::PrimaryVertexReFitter::m_distToRefittedPriVtxName
Gaudi::Property< std::string > m_distToRefittedPriVtxName
Definition: PrimaryVertexReFitter.h:100
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
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
fitman.k
k
Definition: fitman.py:528
ServiceHandle< ICondSvc >
ANA_MSG_DEBUG
#define ANA_MSG_DEBUG(xmsg)
Macro printing debug messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:288