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

#include <InDetVertexSplitter.h>

Inheritance diagram for InDet::InDetVertexSplitter:
Collaboration diagram for InDet::InDetVertexSplitter:

Public Member Functions

 InDetVertexSplitter (const std::string &name, ISvcLocator *pSvcLocator)
 Author: Peter V. More...
 
 ~InDetVertexSplitter ()
 Destructor - check up memory allocation delete any memory allocation on the heap. More...
 
StatusCode initialize ()
 Initialize initialize StoreGate. More...
 
StatusCode finalize ()
 Finalize - delete any memory allocation from the heap. More...
 
StatusCode execute ()
 Execute - on event by event. More...
 
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

StatusCode split_vertices ()
 
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::vector< std::string > m_trackKeys
 
bool m_isMatchedOdd
 
bool m_isUnmatchOdd
 
int m_addToVxMatched
 
int m_addToVxUnmatch
 
int m_eventN
 
std::string m_vertexContainerName
 containers to retrieve More...
 
std::string m_tpbContainerName
 
std::string m_trackContainerName
 
int m_maxVtx
 
bool m_priOnly
 
bool m_savetpb
 
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 31 of file InDetVertexSplitter.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

◆ InDetVertexSplitter()

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

Author: Peter V.

Loscutoff (plosc.nosp@m.utof.nosp@m.f@gma.nosp@m.il.c.nosp@m.om February 2009 head file Constructor

switches to control the analysis through job options

Definition at line 38 of file InDetVertexSplitter.cxx.

39  :
40  AthAlgorithm(name, pSvcLocator),
41  m_isMatchedOdd(false),
42  m_isUnmatchOdd(false),
45  m_eventN(0){
46 
48  declareProperty("TPBContainerName", m_tpbContainerName = "TrackParticleCandidate");
49  declareProperty("TrackContainerName", m_trackContainerName = "Tracks");
50  declareProperty("VertexContainerName", m_vertexContainerName = "VxPrimaryCandidate");
51  declareProperty("MaxVertexNumber", m_maxVtx = 1); //this should not be changed until a more robust handling of multi vertices is implemented
52  declareProperty("PrimaryOnly",m_priOnly = true); //this should not be changed presently
53  declareProperty("UseTrackParticleBase",m_savetpb = true); //is this needed?
54 }

◆ ~InDetVertexSplitter()

InDet::InDetVertexSplitter::~InDetVertexSplitter ( )
default

Destructor - check up memory allocation delete any memory allocation on the heap.

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 InDet::InDetVertexSplitter::execute ( )

Execute - on event by event.

Definition at line 105 of file InDetVertexSplitter.cxx.

105  {
106 
107  ATH_MSG_DEBUG("in execute()");
108 
109  StatusCode sc = StatusCode::SUCCESS;
110 
111  sc = split_vertices();
112  if (sc.isFailure()) {
113  ATH_MSG_ERROR("InDetVertexSplitter Failed");
114  return sc;
115  }
116 
117  return sc;
118 }

◆ 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 InDet::InDetVertexSplitter::finalize ( )

Finalize - delete any memory allocation from the heap.

Definition at line 95 of file InDetVertexSplitter.cxx.

95  {
96  ATH_MSG_DEBUG("in finalize()");
97 
98  return StatusCode::SUCCESS;
99 
100 }

◆ initialize()

StatusCode InDet::InDetVertexSplitter::initialize ( )

Initialize initialize StoreGate.

Definition at line 66 of file InDetVertexSplitter.cxx.

66  {
67 
68  m_isMatchedOdd = false;
69  m_isUnmatchOdd = false;
70  m_addToVxMatched = 1;
71  m_addToVxUnmatch = 1;
72  m_eventN = 0;
73  std::stringstream ss;
74  for (int i = 1; i <=m_maxVtx; i++){
75  ss.str("");
76  ss << "odd_" << i << "_Tracks";
77  m_trackKeys.push_back(ss.str());
78  ss.str("");
79  ss << "even_" << i << "_Tracks";
80  m_trackKeys.push_back(ss.str());
81  ss.str("");
82  ss << "all_" << i << "_Tracks";
83  m_trackKeys.push_back(ss.str());
84  ss.str("");
85  }
86 
87  ATH_MSG_INFO ("Initializing InDetVertexSplitter");
88 
89  return StatusCode::SUCCESS;
90 }

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

◆ split_vertices()

StatusCode InDet::InDetVertexSplitter::split_vertices ( )
private

Definition at line 122 of file InDetVertexSplitter.cxx.

122  {
123 
124  ATH_MSG_DEBUG("in split_vertices()");
125 
126  StatusCode sc = StatusCode::SUCCESS;
127 
128  const VxContainer* vtxTES=nullptr;
129  sc=evtStore()->retrieve( vtxTES, m_vertexContainerName);
130  if( sc.isFailure() || !vtxTES ) {
131  ATH_MSG_WARNING("No VxContainer container found in TDS tried " << m_vertexContainerName);
132  return StatusCode::SUCCESS;
133  }
134 
135  ATH_MSG_DEBUG("Vertex successfully retrieved");
136 
137  const Rec::TrackParticleContainer* tpbTES=nullptr;
138  const TrackCollection* trkTES=nullptr;
139 
140  if (m_savetpb){
141  sc=evtStore()->retrieve( tpbTES, m_tpbContainerName);
142  if( sc.isFailure() || !tpbTES ) {
143  ATH_MSG_WARNING("No TrackParticleBase container found in TDS tried " << m_tpbContainerName);
144  return StatusCode::SUCCESS;
145  }
146  ATH_MSG_DEBUG("TrackParticleCandidate Collection successfully retrieved");
147  }
148  else {
149  sc=evtStore()->retrieve( trkTES, m_trackContainerName);
150  if( sc.isFailure() || !trkTES ) {
151  ATH_MSG_WARNING("No TrackCollection container found in TDS tried " << m_trackContainerName);
152  return StatusCode::SUCCESS;
153  }
154  ATH_MSG_DEBUG("TrackParticleCandidate Collection successfully retrieved");
155  }
156 
157  std::map<std::string,TrackCollection*> trackmap;
158  std::map<std::string,Trk::TrackParticleBaseCollection*> tpbmap;
159 
160 // We need to create every container for each event, even if we don't write to them
161 
162  for (const auto & thisKey : m_trackKeys){
163  TrackCollection* tempTracks = nullptr;
164  trackmap[thisKey] = tempTracks;
165  if (evtStore()->contains<TrackCollection>(thisKey) && (evtStore()->retrieve(trackmap[thisKey],thisKey)).isSuccess()){
166  //nop
167  } else {
168  trackmap[thisKey] = new TrackCollection;
169  }
170  }
171 
172  for (const auto & thisKey : m_trackKeys){
173  Trk::TrackParticleBaseCollection* tempTpbs = nullptr;
174  tpbmap[thisKey] = tempTpbs;
175  if (evtStore()->contains<Trk::TrackParticleBaseCollection>(thisKey) &&
176  (evtStore()->retrieve(tpbmap[thisKey],thisKey)).isSuccess()){
177  } else {
178  tpbmap[thisKey] = new Trk::TrackParticleBaseCollection;
179  }
180  }
181 
182  if (m_savetpb and tpbTES){
183  //we loop over that list
184  for (const Rec::TrackParticle* tpb: *tpbTES){
185  const Trk::TrackParameters* trkPerigee = &(tpb->definingParameters());
186  bool trackmatched = false;
187  //we compare it to the tracks already associated with vertices
188 
189  ATH_MSG_DEBUG("Found "<<vtxTES->size()<<" vertices");
190 
191  int i_vtx = 0;
192  // We're relying here on the implicit sorting of vertices by sqrt(N_tracks)*Sum Pt_track^2
193  // This should pick out the most interesting N vertices
194  // Hopefully we have only 1 primary vertex, but if there is > 1 we can grab all of those too
195  std::stringstream sss;
196  std::string oeNameString;
197  oeNameString.reserve(20);
198  for (const Trk::VxCandidate* vtx : *vtxTES){
199  if ( (!m_priOnly || vtx->vertexType() == 1) && (i_vtx < m_maxVtx) ){
200  i_vtx++;
201  const std::vector<Trk::VxTrackAtVertex*> & vertexTracks = *vtx->vxTrackAtVertex();
202  ATH_MSG_DEBUG("parent vertex has "<<vertexTracks.size()<<" tracks, at position: "<<vtx->recVertex().position().x());
203  std::vector<Trk::VxTrackAtVertex*>::const_iterator tavI = vertexTracks.begin();
204  std::vector<Trk::VxTrackAtVertex*>::const_iterator tavIe= vertexTracks.end();
205  for (; tavI != tavIe; ++tavI){
206  const Trk::TrackParameters* vxTrkPerigee = (*tavI)->initialPerigee();
207  if (trkPerigee == vxTrkPerigee) {trackmatched = true;}
208  }
209  Trk::TrackParticleBase *trkCopy1 = new Trk::TrackParticleBase((*tpb));
210  Trk::TrackParticleBase *trkCopy2 = new Trk::TrackParticleBase((*tpb));
211  if (!trackmatched){
212  oeNameString.clear();
213  if (m_isUnmatchOdd) oeNameString = "odd";
214  if (!m_isUnmatchOdd) oeNameString = "even";
215  sss.str("");
216  sss << oeNameString << "_" << m_addToVxUnmatch << "_Tracks";
217  std::string oecontainerName = sss.str();
218  std::string allNameString = "all";
219  sss.str("");
220  sss << allNameString << "_" << m_addToVxUnmatch << "_Tracks";
221  std::string allcontainerName = sss.str();
222  ATH_MSG_DEBUG("found an unmatched trackparticlebase, giving it the key: "<< oecontainerName);
223  tpbmap[oecontainerName]->push_back(trkCopy1);
224  ATH_MSG_DEBUG("found an unmatched trackparticlebase, giving it the key: "<< allcontainerName);
225  tpbmap[allcontainerName]->push_back(trkCopy2);
229  }
230  if (trackmatched){
231  oeNameString.clear();
232  if (m_isMatchedOdd) oeNameString = "odd";
233  if (!m_isMatchedOdd) oeNameString = "even";
234  sss.str("");
235  sss << oeNameString << "_" << m_addToVxMatched << "_Tracks";
236  std::string oecontainerName = sss.str();
237  std::string allNameString = "all";
238  sss.str("");
239  sss << allNameString << "_" << m_addToVxMatched << "_Tracks";
240  std::string allcontainerName = sss.str();
241  ATH_MSG_DEBUG("found a matched trackparticlebase, giving it the key: "<< oecontainerName);
242  tpbmap[oecontainerName]->push_back(trkCopy1);
243  ATH_MSG_DEBUG("found a matched trackparticlebase, giving it the key: "<< allcontainerName);
244  tpbmap[allcontainerName]->push_back(trkCopy2);
248  }
249  }
250  }
251  }
252  }
253  if (!m_savetpb and trkTES){
254  TrackCollection::const_iterator trkItr = trkTES->begin();
255  TrackCollection::const_iterator trkItrE = trkTES->end();
256  //we loop over that list
257  for (; trkItr != trkItrE; ++trkItr){
258  const Trk::Perigee* trkPerigee = (*trkItr)->perigeeParameters();
259  bool trackmatched = false;
260  //we compare it to the tracks already associated with vertices
261 
262  VxContainer::const_iterator vtxItr = vtxTES->begin();
263  VxContainer::const_iterator vtxItrE = vtxTES->end();
264 
265  ATH_MSG_DEBUG("Found "<<vtxTES->size()<<" vertices");
266 
267  int i_vtx = 0;
268  // We're relying here on the implicit sorting of vertices by sqrt(N_tracks)*Sum Pt_track^2
269  // This should pick out the most interesting N vertices
270  // Hopefully we have only 1 primary vertex, but if there is > 1 we can grab all of those too
271  std::stringstream sss;
272  std::string oeNameString;
273  oeNameString.reserve(20);
274  for (; vtxItr != vtxItrE; ++vtxItr){
275  if ( (!m_priOnly || (*vtxItr)->vertexType() == 1) && (i_vtx < m_maxVtx) ){
276  i_vtx++;
277  const std::vector<Trk::VxTrackAtVertex*> & vertexTracks = (*(*vtxItr)->vxTrackAtVertex());
278  ATH_MSG_DEBUG("parent vertex has "<<vertexTracks.size()<<" tracks, at position: "<<(*vtxItr)->recVertex().position().x());
279  std::vector<Trk::VxTrackAtVertex*>::const_iterator tavI = vertexTracks.begin();
280  std::vector<Trk::VxTrackAtVertex*>::const_iterator tavIe= vertexTracks.end();
281  for (; tavI != tavIe; ++tavI){
282  const Trk::TrackParameters* vxTrkPerigee = (*tavI)->initialPerigee();
283  if (trkPerigee == vxTrkPerigee) {trackmatched = true;}
284  }
285  Trk::Track *trkCopy1 = new Trk::Track((*(*trkItr)));
286  Trk::Track *trkCopy2 = new Trk::Track((*(*trkItr)));
287  if (!trackmatched){
288  oeNameString.clear();
289  if (m_isUnmatchOdd) oeNameString = "odd";
290  if (!m_isUnmatchOdd) oeNameString = "even";
291  sss.str("");
292  sss << oeNameString << "_" << m_addToVxUnmatch << "_Tracks";
293  std::string oecontainerName = sss.str();
294  std::string allNameString = "all";
295  sss.str("");
296  sss << allNameString << "_" << m_addToVxUnmatch << "_Tracks";
297  std::string allcontainerName = sss.str();
298  ATH_MSG_DEBUG("found an unmatched track, giving it the key: "<< oecontainerName);
299  trackmap[oecontainerName]->push_back(trkCopy1);
300  ATH_MSG_DEBUG("found an unmatched track, giving it the key: "<< allcontainerName);
301  trackmap[allcontainerName]->push_back(trkCopy2);
305  }
306  if (trackmatched){
307  oeNameString.clear();
308  if (m_isMatchedOdd) oeNameString = "odd";
309  if (!m_isMatchedOdd) oeNameString = "even";
310  sss.str("");
311  sss << oeNameString << "_" << m_addToVxMatched << "_Tracks";
312  std::string oecontainerName = sss.str();
313  std::string allNameString = "all";
314  sss.str("");
315  sss << allNameString << "_" << m_addToVxMatched << "_Tracks";
316  std::string allcontainerName = sss.str();
317  ATH_MSG_DEBUG("found a matched track, giving it the key: "<< oecontainerName);
318  trackmap[oecontainerName]->push_back(trkCopy1);
319  ATH_MSG_DEBUG("found a matched track, giving it the key: "<< allcontainerName);
320  trackmap[allcontainerName]->push_back(trkCopy2);
324  }
325  }
326  }
327  }
328  }
329  if (m_savetpb){
330  for (const auto & key: m_trackKeys){
331  if(evtStore()->record(tpbmap[key],key,false).isFailure() ){
332  ATH_MSG_ERROR("Could not save the "<< key);
333  }
334  }
335  } else {
336  for (const auto & key: m_trackKeys){
337  if(evtStore()->record(trackmap[key],key,false).isFailure() ){
338  ATH_MSG_ERROR("Could not save the "<< key);
339  }
340  }
341  }
342  ATH_MSG_DEBUG("split_vertices() succeeded");
343  m_eventN++;
344  return StatusCode::SUCCESS;
345 }

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

int InDet::InDetVertexSplitter::m_addToVxMatched
private

Definition at line 48 of file InDetVertexSplitter.h.

◆ m_addToVxUnmatch

int InDet::InDetVertexSplitter::m_addToVxUnmatch
private

Definition at line 49 of file InDetVertexSplitter.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_eventN

int InDet::InDetVertexSplitter::m_eventN
private

Definition at line 50 of file InDetVertexSplitter.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_isMatchedOdd

bool InDet::InDetVertexSplitter::m_isMatchedOdd
private

Definition at line 46 of file InDetVertexSplitter.h.

◆ m_isUnmatchOdd

bool InDet::InDetVertexSplitter::m_isUnmatchOdd
private

Definition at line 47 of file InDetVertexSplitter.h.

◆ m_maxVtx

int InDet::InDetVertexSplitter::m_maxVtx
private

Definition at line 58 of file InDetVertexSplitter.h.

◆ m_priOnly

bool InDet::InDetVertexSplitter::m_priOnly
private

Definition at line 59 of file InDetVertexSplitter.h.

◆ m_savetpb

bool InDet::InDetVertexSplitter::m_savetpb
private

Definition at line 60 of file InDetVertexSplitter.h.

◆ m_tpbContainerName

std::string InDet::InDetVertexSplitter::m_tpbContainerName
private

Definition at line 56 of file InDetVertexSplitter.h.

◆ m_trackContainerName

std::string InDet::InDetVertexSplitter::m_trackContainerName
private

Definition at line 57 of file InDetVertexSplitter.h.

◆ m_trackKeys

std::vector<std::string> InDet::InDetVertexSplitter::m_trackKeys
private

Definition at line 44 of file InDetVertexSplitter.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vertexContainerName

std::string InDet::InDetVertexSplitter::m_vertexContainerName
private

containers to retrieve

Definition at line 55 of file InDetVertexSplitter.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:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
InDet::InDetVertexSplitter::m_priOnly
bool m_priOnly
Definition: InDetVertexSplitter.h:59
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
xAOD::JetInput::Track
@ Track
Definition: JetContainerInfo.h:61
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
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
InDet::InDetVertexSplitter::m_savetpb
bool m_savetpb
Definition: InDetVertexSplitter.h:60
InDet::InDetVertexSplitter::m_isMatchedOdd
bool m_isMatchedOdd
Definition: InDetVertexSplitter.h:46
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
Trk::TrackParticleBase
Definition: TrackParticleBase.h:41
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
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
AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
lumiFormat.i
int i
Definition: lumiFormat.py:85
TrackCollection
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
Definition: TrackCollection.h:19
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
InDet::InDetVertexSplitter::m_addToVxMatched
int m_addToVxMatched
Definition: InDetVertexSplitter.h:48
InDet::InDetVertexSplitter::m_maxVtx
int m_maxVtx
Definition: InDetVertexSplitter.h:58
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
Trk::ParametersBase
Definition: ParametersBase.h:55
VxContainer
Definition: VxContainer.h:28
DataVector< Trk::Track >
InDet::InDetVertexSplitter::m_isUnmatchOdd
bool m_isUnmatchOdd
Definition: InDetVertexSplitter.h:47
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
InDet::InDetVertexSplitter::split_vertices
StatusCode split_vertices()
Definition: InDetVertexSplitter.cxx:122
Rec::TrackParticleContainer
Definition: Reconstruction/Particle/Particle/TrackParticleContainer.h:33
Rec::TrackParticle
Definition: Reconstruction/Particle/Particle/TrackParticle.h:47
AthAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Definition: AthAlgorithm.h:79
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Trk::VxCandidate
Definition: VxCandidate.h:27
InDet::InDetVertexSplitter::m_trackKeys
std::vector< std::string > m_trackKeys
Definition: InDetVertexSplitter.h:44
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
Trk::TrackParticleBaseCollection
DataVector< TrackParticleBase > TrackParticleBaseCollection
Definition: TrackParticleBaseCollection.h:14
AthAlgorithm::AthAlgorithm
AthAlgorithm()
Default constructor:
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
InDet::InDetVertexSplitter::m_vertexContainerName
std::string m_vertexContainerName
containers to retrieve
Definition: InDetVertexSplitter.h:55
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
InDet::InDetVertexSplitter::m_eventN
int m_eventN
Definition: InDetVertexSplitter.h:50
InDet::InDetVertexSplitter::m_tpbContainerName
std::string m_tpbContainerName
Definition: InDetVertexSplitter.h:56
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
InDet::InDetVertexSplitter::m_addToVxUnmatch
int m_addToVxUnmatch
Definition: InDetVertexSplitter.h:49
fitman.k
k
Definition: fitman.py:528
InDet::InDetVertexSplitter::m_trackContainerName
std::string m_trackContainerName
Definition: InDetVertexSplitter.h:57
ServiceHandle< ICondSvc >
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37