Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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

using accessorFloat_t = SG::Accessor< float >
 
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

bool decorateLepWithReFitPrimaryVertex (const FittingInput &input, const xAOD::TrackParticle *tracklep, 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
 
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::optional< accessorFloat_tm_distToRefittedPriVtx
 
std::optional< accessorFloat_tm_normdistToRefittedPriVtx
 
SG::WriteDecorHandleKey< xAOD::IParticleContainerm_lepRefittedVtxWithoutLeptonLinkName { this, "RefittedVtxWithoutLeptonLinkName", m_leptonContainerKey, "default", "" }
 
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 55 of file PrimaryVertexReFitter.h.

Member Typedef Documentation

◆ accessorFloat_t

Definition at line 78 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 20 of file PrimaryVertexReFitter.cxx.

20  :
21  AthAlgorithm (name, pSvcLocator)
22 {}

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 std::vector< const xAOD::TrackParticle * > &  tracks,
xAOD::VertexContainer refitVtxContainer 
)
private

Definition at line 251 of file PrimaryVertexReFitter.cxx.

256 {
257  //
258  // Check if the lepton track has been used for primary vertex reconstruction.
259  // if true, then remove the lepton track from the input track list, re-fit primary vertex again.
260  // Save the ElementLink of the re-fit primary vertex to the lepton
261  //
262  if(!input.priVtx) {
263  ATH_MSG_WARNING("decorateLepWithReFitPrimaryVertex - invalid input primary vertex pointer");
264  return false;
265  }
266 
267  //--------------------------------------------------------
268  // Remove the lepton track from the track list
269  // get re-fitted non-prompt primary vertex
270  //
271  std::vector<const xAOD::TrackParticle*> priVtx_tracks_pass;
272  bool isRefit = false;
273 
274  for(const xAOD::TrackParticle *track: tracks) {
275  if(track == tracklep) {
276  isRefit = true;
277  ATH_MSG_DEBUG("decorateLepWithReFitPrimaryVertex -- lepton has been used, lepton pT =" << tracklep->pt() << ", track pT =" << track->pt());
278  continue;
279  }
280 
281  priVtx_tracks_pass.push_back(track);
282  }
283 
284  if(!isRefit) {
285  ATH_MSG_DEBUG("decorateLepWithReFitPrimaryVertex -- Skip the primary vertex without lepton track");
286 
287  return false;
288  }
289 
290  if(priVtx_tracks_pass.size() < 2) {
291  ATH_MSG_DEBUG("decorateLepWithReFitPrimaryVertex -- Skip the primary vertex refitting: N tracks =" << priVtx_tracks_pass.size());
292 
293  return false;
294  }
295 
296  std::unique_ptr<xAOD::Vertex> refittedVtxRMLep = m_vertexFitterTool->fitVertexWithSeed(
297  input, priVtx_tracks_pass, input.priVtx->position(),
299 
300  if(refittedVtxRMLep) {
301  ATH_MSG_DEBUG("decorateLepWithReFitPrimaryVertex -- save refitted non-prompt primary vertex with NTrack = " << refittedVtxRMLep->nTrackParticles());
302 
303  if(input.refittedPriVtx) {
304  (*m_distToRefittedPriVtx) (*refittedVtxRMLep) = Prompt::getDistance(input.refittedPriVtx->position(), refittedVtxRMLep->position());
305  (*m_normdistToRefittedPriVtx)(*refittedVtxRMLep) = Prompt::getNormDist(
306  input.refittedPriVtx->position(),
307  refittedVtxRMLep->position(),
308  refittedVtxRMLep->covariance(),
309  msg(MSG::WARNING)
310  );
311  }
312  //
313  // Record vertex with output container
314  //
315  refitVtxContainer.push_back(std::move(refittedVtxRMLep));
316 
317  return true;
318  }
319  return false;
320 }

◆ 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 91 of file PrimaryVertexReFitter.cxx.

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

◆ 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 75 of file PrimaryVertexReFitter.cxx.

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

◆ initialize()

StatusCode Prompt::PrimaryVertexReFitter::initialize ( )
overridevirtual

Definition at line 25 of file PrimaryVertexReFitter.cxx.

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

◆ 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::optional<accessorFloat_t> Prompt::PrimaryVertexReFitter::m_distToRefittedPriVtx
private

Definition at line 132 of file PrimaryVertexReFitter.h.

◆ m_distToRefittedPriVtxName

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

Definition at line 101 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 112 of file PrimaryVertexReFitter.h.

◆ m_lepRefittedVtxWithoutLeptonLinkName

SG::WriteDecorHandleKey<xAOD::IParticleContainer> Prompt::PrimaryVertexReFitter::m_lepRefittedVtxWithoutLeptonLinkName { this, "RefittedVtxWithoutLeptonLinkName", m_leptonContainerKey, "default", "" }
private

Definition at line 135 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 116 of file PrimaryVertexReFitter.h.

◆ m_normdistToRefittedPriVtx

std::optional<accessorFloat_t> Prompt::PrimaryVertexReFitter::m_normdistToRefittedPriVtx
private

Definition at line 133 of file PrimaryVertexReFitter.h.

◆ m_normDistToRefittedPriVtxName

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

Definition at line 104 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 121 of file PrimaryVertexReFitter.h.

◆ m_printTime

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

Definition at line 99 of file PrimaryVertexReFitter.h.

◆ m_reFitPrimaryVertexKey

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

Definition at line 125 of file PrimaryVertexReFitter.h.

◆ m_timerAll

TStopwatch Prompt::PrimaryVertexReFitter::m_timerAll
private

Definition at line 108 of file PrimaryVertexReFitter.h.

◆ m_timerExec

TStopwatch Prompt::PrimaryVertexReFitter::m_timerExec
private

Definition at line 109 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 92 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
Prompt::PrimaryVertexReFitter::decorateLepWithReFitPrimaryVertex
bool decorateLepWithReFitPrimaryVertex(const FittingInput &input, const xAOD::TrackParticle *tracklep, const std::vector< const xAOD::TrackParticle * > &tracks, xAOD::VertexContainer &refitVtxContainer)
Definition: PrimaryVertexReFitter.cxx:251
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:196
Prompt::PrimaryVertexReFitter::m_timerExec
TStopwatch m_timerExec
Definition: PrimaryVertexReFitter.h:109
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:67
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:92
Prompt::PrimaryVertexReFitter::m_timerAll
TStopwatch m_timerAll
Definition: PrimaryVertexReFitter.h:108
Prompt::PrimaryVertexReFitter::m_leptonContainerKey
SG::ReadHandleKey< xAOD::IParticleContainer > m_leptonContainerKey
Definition: PrimaryVertexReFitter.h:116
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:125
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
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_normDistToRefittedPriVtxName
Gaudi::Property< std::string > m_normDistToRefittedPriVtxName
Definition: PrimaryVertexReFitter.h:104
Prompt::PrimaryVertexReFitter::m_lepRefittedVtxWithoutLeptonLinkName
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_lepRefittedVtxWithoutLeptonLinkName
Definition: PrimaryVertexReFitter.h:136
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
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
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
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:100
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:99
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
Prompt::PrimaryVertexReFitter::m_normdistToRefittedPriVtx
std::optional< accessorFloat_t > m_normdistToRefittedPriVtx
Definition: PrimaryVertexReFitter.h:133
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
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:73
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:112
Prompt::PrimaryVertexReFitter::m_primaryVertexContainerKey
SG::ReadHandleKey< xAOD::VertexContainer > m_primaryVertexContainerKey
Definition: PrimaryVertexReFitter.h:121
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:629
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:101
xAOD::track
@ track
Definition: TrackingPrimitives.h:513
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
Prompt::PrimaryVertexReFitter::m_distToRefittedPriVtx
std::optional< accessorFloat_t > m_distToRefittedPriVtx
Definition: PrimaryVertexReFitter.h:132
ServiceHandle< ICondSvc >
ANA_MSG_DEBUG
#define ANA_MSG_DEBUG(xmsg)
Macro printing debug messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:288