ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
InDet::SlidingWindowMultiSeedFinder Class Referencefinal

#include <SlidingWindowMultiSeedFinder.h>

Inheritance diagram for InDet::SlidingWindowMultiSeedFinder:
Collaboration diagram for InDet::SlidingWindowMultiSeedFinder:

Public Member Functions

virtual StatusCode initialize () override
 
 SlidingWindowMultiSeedFinder (const std::string &t, const std::string &n, const IInterface *p)
 Constructor and destructor. More...
 
 ~SlidingWindowMultiSeedFinder ()
 
virtual std::vector< std::vector< const Trk::Track * > > seeds (const std::vector< const Trk::Track * > &tracks) const override
 Clustering method itself. More...
 
virtual std::vector< std::vector< const Trk::TrackParameters * > > seeds (const std::vector< const xAOD::TrackParticle * > &tracks) const override
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 AlgTool interface methods. More...
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

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

float m_clusterLength
 
float m_breakingDistance
 
float m_addingDistance
 
bool m_useMaxInCluster
 
int m_ignoreLevel
 
bool m_ignoreBeamSpot
 
ToolHandle< Trk::ITrackSelectorToolm_trkFilter
 
ToolHandle< InDetTrackZ0SortingToolm_sortingTool
 
ToolHandle< Trk::IVertexSeedFinderm_vtxSeedFinder
 
SG::ReadCondHandleKey< InDet::BeamSpotDatam_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }
 
ToolHandle< Trk::IExtrapolatorm_extrapolator
 
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 28 of file SlidingWindowMultiSeedFinder.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ SlidingWindowMultiSeedFinder()

InDet::SlidingWindowMultiSeedFinder::SlidingWindowMultiSeedFinder ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Constructor and destructor.

Definition at line 53 of file SlidingWindowMultiSeedFinder.cxx.

54  :AthAlgTool(t,n,p),
55  m_clusterLength(5.),
56  m_breakingDistance(3.),
57  m_addingDistance(0.1),
58  m_useMaxInCluster(false),
59  m_ignoreLevel(0),
60  m_ignoreBeamSpot(false),
61  m_vtxSeedFinder("Trk::CrossDistancesSeedFinder"),
62  m_extrapolator("Trk::Extrapolator")
63  {
64  declareInterface<IMultiPVSeedFinder>(this);
65  declareProperty("clusterLength", m_clusterLength);
66  declareProperty("BreakingDistance", m_breakingDistance);
67  declareProperty("AddingDistance", m_addingDistance);
68  declareProperty("UseMaxInCluster", m_useMaxInCluster);
69  declareProperty("IgnoreLevel", m_ignoreLevel);
70  declareProperty("IgnoreBeamSpot", m_ignoreBeamSpot);
71 
72  //track filter
73  declareProperty("TrackSelector", m_trkFilter);
74 
75  //sorting tool
76  declareProperty("SortingTool", m_sortingTool);
77 
78  //vertex finder tool (needed when no beam spot is available)
79  declareProperty("VertexSeedFinder",m_vtxSeedFinder);
80 
81  //extrapolator
82  declareProperty("Extrapolator", m_extrapolator);
83 
84  }

◆ ~SlidingWindowMultiSeedFinder()

InDet::SlidingWindowMultiSeedFinder::~SlidingWindowMultiSeedFinder ( )
default

Member Function Documentation

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ initialize()

StatusCode InDet::SlidingWindowMultiSeedFinder::initialize ( )
overridevirtual

Definition at line 18 of file SlidingWindowMultiSeedFinder.cxx.

19  {
20  if(m_trkFilter.retrieve().isFailure())
21  {
22  ATH_MSG_ERROR(" Unable to retrieve "<<m_trkFilter);
23  return StatusCode::FAILURE;
24  }
25  ATH_MSG_DEBUG("Track selector tool retrieved");
26 
27  if(m_sortingTool.retrieve().isFailure()){
28  ATH_MSG_ERROR(" Unable to retrieve "<<m_sortingTool);
29  return StatusCode::FAILURE;
30  }
31  ATH_MSG_DEBUG("Track sorting tool retrieved");
32 
34 
35  if(m_vtxSeedFinder.retrieve().isFailure())
36  {
37  ATH_MSG_ERROR("Unable to retrieve " << m_vtxSeedFinder);
38  return StatusCode::FAILURE;
39  }
40  ATH_MSG_DEBUG("Vertex seed finder retriever");
41 
42  if(m_extrapolator.retrieve().isFailure())
43  {
44  ATH_MSG_ERROR("Failed to retrieve tool " << m_extrapolator);
45  return StatusCode::FAILURE;
46  }
47  ATH_MSG_DEBUG("Retrieved tool " << m_extrapolator);
48 
49  return StatusCode::SUCCESS;
50  }//end of initialize mtehod

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

static const InterfaceID& InDet::IMultiPVSeedFinder::interfaceID ( )
inlinestaticinherited

AlgTool interface methods.

Definition at line 48 of file IMultiPVSeedFinder.h.

48 { return IID_IMultiPVSeedFinder; };

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

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

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ seeds() [1/2]

std::vector< std::vector< const Trk::Track * > > InDet::SlidingWindowMultiSeedFinder::seeds ( const std::vector< const Trk::Track * > &  tracks) const
overridevirtual

Clustering method itself.

Implements InDet::IMultiPVSeedFinder.

Definition at line 89 of file SlidingWindowMultiSeedFinder.cxx.

90  {
91  const EventContext& ctx = Gaudi::Hive::currentContext();
92  std::vector<const Trk::Track*> preselectedTracks(0);
93  std::vector<const Trk::Track*>::const_iterator tr = tracks.begin();
94  std::vector<const Trk::Track*>::const_iterator tre = tracks.end();
95 
97  Trk::RecVertex beamRecVertex(beamSpotHandle->beamVtx());
98  for(;tr!=tre;++tr) if(m_trkFilter->decision(**tr,&beamRecVertex)) preselectedTracks.push_back(*tr);
99  ATH_MSG_DEBUG("Beam spot position is: "<< beamRecVertex.position());
100 
101  Trk::Vertex* beamVertex=&beamRecVertex;
102 
103  Trk::Vertex myVertex;
104  if (m_ignoreBeamSpot)
105  {
106  myVertex = Trk::Vertex(m_vtxSeedFinder->findSeed(tracks));
107  ATH_MSG_DEBUG(" vtx seed x: " << myVertex.position().x() <<
108  " vtx seed y: " << myVertex.position().y() <<
109  " vtx seed z: " << myVertex.position().z());
110  beamVertex = &myVertex;
111  }
112 
113  //output container
114  std::vector< std::vector<const Trk::Track *> > result(0);
115 
116  //sorting the tracks on their z_0 basis.
117  if(!preselectedTracks.empty())
118  {
119  std::vector<int> indexOfSorted = m_sortingTool->sortedIndex(preselectedTracks,beamVertex);
120 
121  std::vector<const Trk::Track *> tmp_cluster(0);
122 
123  Trk::PerigeeSurface perigeeSurface(beamVertex->position());
124 
125  const Trk::TrackParameters * exPerigee = nullptr;
126  if(!indexOfSorted.empty()){
127  exPerigee =
129  ->extrapolateTrack(ctx, *preselectedTracks[indexOfSorted[0]], perigeeSurface, Trk::anyDirection, true, Trk::pion)
130  .release();
131  }
132 
133  float lastTrackZ0 = -999.;
134  if(exPerigee) { lastTrackZ0 = exPerigee->parameters()[Trk::z0]; delete exPerigee; }
135  else {
136  ATH_MSG_WARNING("Impossible to extrapolate the first track; returning 0 container for this event");
137  return result;
138  }
139 
140  //looping over sorted container:
141  //storing the Z0 of last iteration...
142  float prevTrackZ0 = 0.;
143 
144  float addingDistance = m_addingDistance;
145  if(m_useMaxInCluster) addingDistance = 0.;
146  for(unsigned int i=0;i<indexOfSorted.size();++i)
147  {
148  const Trk::TrackParameters * lexPerigee = m_extrapolator->extrapolateTrack(ctx, *preselectedTracks[indexOfSorted[i]],
149  perigeeSurface,Trk::anyDirection,true, Trk::pion).release();
150  float currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
151  delete lexPerigee;
152 
153  if(!i) prevTrackZ0 = currentTrackZ0;
154 
155  ATH_MSG_DEBUG("Z0 of current track"<< currentTrackZ0);
156 
157  if((std::abs(currentTrackZ0 - lastTrackZ0)>m_clusterLength &&
158  std::abs(currentTrackZ0 - prevTrackZ0)>addingDistance) ||
159  std::abs(currentTrackZ0 - prevTrackZ0)>m_breakingDistance)
160  {
161  //this track is outside the current cluster
162  if(int(tmp_cluster.size())>m_ignoreLevel) result.push_back(tmp_cluster);
163  tmp_cluster.clear();
164  tmp_cluster.push_back(preselectedTracks[indexOfSorted[i]]);
165  lastTrackZ0 = currentTrackZ0;
166  }else{
167  //this track is within the current cluster
168  tmp_cluster.push_back(preselectedTracks[indexOfSorted[i]]);
169  //checking whethet this is the last track in list
170  if(i==indexOfSorted.size()-1 && int(tmp_cluster.size())>m_ignoreLevel) result.push_back(tmp_cluster);
171  }//end of check for the cluster size
172 
173  //making adding distance max in cluster
174  if(m_useMaxInCluster){
175  float diff = std::abs(currentTrackZ0-prevTrackZ0);
176  if(addingDistance < diff) addingDistance = diff;
177  }//end of using max in cluster
178  prevTrackZ0 = currentTrackZ0;
179  }//end of loop over the sorted container, using sorted index
180 
181  }//end of check for successfull preselection
182 
183  return result;
184  }//end of seeding method

◆ seeds() [2/2]

std::vector< std::vector< const Trk::TrackParameters * > > InDet::SlidingWindowMultiSeedFinder::seeds ( const std::vector< const xAOD::TrackParticle * > &  tracks) const
overridevirtual

Implements InDet::IMultiPVSeedFinder.

Definition at line 187 of file SlidingWindowMultiSeedFinder.cxx.

188  {
189  const EventContext& ctx = Gaudi::Hive::currentContext();
190  //step 1: preselection
191  std::vector<const xAOD::TrackParticle*> preselectedTracks(0);
192 
193  //selecting with respect to the beam spot
194  xAOD::Vertex beamposition;
196  beamposition.setPosition(beamSpotHandle->beamVtx().position());
197  beamposition.setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition());
198 
199  for (const auto *track : tracks) {
200  if (m_trkFilter->decision(*track,&beamposition)) preselectedTracks.push_back(track);
201  }
202 
203  std::vector<const Trk::TrackParameters*> perigeeList;
204  std::vector<const xAOD::TrackParticle*>::const_iterator trackBegin=tracks.begin();
205  std::vector<const xAOD::TrackParticle*>::const_iterator trackEnd=tracks.end();
206  for (std::vector<const xAOD::TrackParticle*>::const_iterator trackIter=trackBegin;trackIter!=trackEnd;++trackIter)
207  {
208  perigeeList.push_back(&((*trackIter)->perigeeParameters()));
209  }
210 
211  Trk::RecVertex myVertex (m_vtxSeedFinder->findSeed(perigeeList));
212 
213  if (m_ignoreBeamSpot)
214  {
215  ATH_MSG_DEBUG(" vtx seed x: " << myVertex.position().x() <<
216  " vtx seed y: " << myVertex.position().y() <<
217  " vtx seed z: " << myVertex.position().z());
218  beamposition.setPosition(myVertex.position());
219  beamposition.setCovariancePosition(myVertex.covariancePosition());
220  }
221 
222  //step 2: sorting in z0
223  //output container
224  std::vector< std::vector<const Trk::TrackParameters *> > result(0);
225  if(!preselectedTracks.empty())
226  {
227  std::vector<int> indexOfSorted = m_sortingTool->sortedIndex(preselectedTracks, &beamposition);
228 
229  std::vector<const Trk::TrackParameters *> tmp_cluster(0);
230 
231  //extrapolating the tracks to the actual beam spot
232  const Trk::TrackParameters * exPerigee(nullptr);
233  Trk::PerigeeSurface perigeeSurface(beamposition.position());
234 
235  exPerigee = m_extrapolator->extrapolate(ctx, preselectedTracks[indexOfSorted[0]]->perigeeParameters(),
236  perigeeSurface,Trk::anyDirection,true, Trk::pion).release();
237 
238  float lastTrackZ0 = -999.;
239  if(exPerigee) { lastTrackZ0 = exPerigee->parameters()[Trk::z0]; delete exPerigee; }
240  else
241  {
242  ATH_MSG_WARNING("Impossible to extrapolate the first track; returning 0 container for this event");
243  return result;
244  }
245 
246  ATH_MSG_DEBUG("Z0 of last track"<< lastTrackZ0);
247 
248  //looping over sorted container: storing the Z0 of last iteration...
249  float prevTrackZ0 =0.;
250 
251  float addingDistance = m_addingDistance;
252  if(m_useMaxInCluster) addingDistance = 0.;
253 
254  for(unsigned int i=0;i<indexOfSorted.size();++i){
255 
256  const Trk::TrackParameters* lexPerigee =
258  ->extrapolate(
259  ctx,
260  preselectedTracks[indexOfSorted[i]]->perigeeParameters(),
261  perigeeSurface,
263  true, Trk::pion).release();
264  float currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
265  delete lexPerigee;
266 
267  if(!i) prevTrackZ0 = currentTrackZ0;
268  ATH_MSG_DEBUG("Z0 of current track" << currentTrackZ0);
269 
270  if ((std::abs(currentTrackZ0 - lastTrackZ0) > m_clusterLength &&
271  std::abs(currentTrackZ0 - prevTrackZ0) > addingDistance) ||
272  std::abs(currentTrackZ0 - prevTrackZ0) > m_breakingDistance) {
273  // this track is outside the current cluster or the distance is too big. breaking the cluster here
274  if (int(tmp_cluster.size()) > m_ignoreLevel) result.push_back(tmp_cluster);
275  tmp_cluster.clear();
276  tmp_cluster.push_back(&(preselectedTracks[indexOfSorted[i]]->perigeeParameters()));
277  lastTrackZ0 = currentTrackZ0;
278  ATH_MSG_DEBUG("Finishing a cluster, starting the new one");
279  }else{
280  //this track is within the current cluster or the distance to next is too short. Keeping populating it.
281  tmp_cluster.push_back(&(preselectedTracks[indexOfSorted[i]]->perigeeParameters()));
282  ATH_MSG_DEBUG("Pushing a track to a cluster");
283 
284  if(i==indexOfSorted.size()-1 && int(tmp_cluster.size())>m_ignoreLevel) result.push_back(tmp_cluster);
285 
286  }//end of check for the cluster size
287 
288  //making adding distance max in cluster
290  {
291  float diff = std::abs(currentTrackZ0-prevTrackZ0);
292  if(addingDistance < diff) addingDistance = diff;
293  }//end of using max in cluster
294  prevTrackZ0 = currentTrackZ0;
295  }//end of loop
296  }//end of preselection size check
297 
298  ATH_MSG_DEBUG("Returning number of clusters: "<< result.size());
299  return result;
300 
301  }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_addingDistance

float InDet::SlidingWindowMultiSeedFinder::m_addingDistance
private

Definition at line 55 of file SlidingWindowMultiSeedFinder.h.

◆ m_beamSpotKey

SG::ReadCondHandleKey<InDet::BeamSpotData> InDet::SlidingWindowMultiSeedFinder::m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }
private

Definition at line 65 of file SlidingWindowMultiSeedFinder.h.

◆ m_breakingDistance

float InDet::SlidingWindowMultiSeedFinder::m_breakingDistance
private

Definition at line 54 of file SlidingWindowMultiSeedFinder.h.

◆ m_clusterLength

float InDet::SlidingWindowMultiSeedFinder::m_clusterLength
private

Definition at line 53 of file SlidingWindowMultiSeedFinder.h.

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extrapolator

ToolHandle<Trk::IExtrapolator> InDet::SlidingWindowMultiSeedFinder::m_extrapolator
private

Definition at line 66 of file SlidingWindowMultiSeedFinder.h.

◆ m_ignoreBeamSpot

bool InDet::SlidingWindowMultiSeedFinder::m_ignoreBeamSpot
private

Definition at line 58 of file SlidingWindowMultiSeedFinder.h.

◆ m_ignoreLevel

int InDet::SlidingWindowMultiSeedFinder::m_ignoreLevel
private

Definition at line 57 of file SlidingWindowMultiSeedFinder.h.

◆ m_sortingTool

ToolHandle<InDetTrackZ0SortingTool> InDet::SlidingWindowMultiSeedFinder::m_sortingTool
private

Definition at line 61 of file SlidingWindowMultiSeedFinder.h.

◆ m_trkFilter

ToolHandle<Trk::ITrackSelectorTool> InDet::SlidingWindowMultiSeedFinder::m_trkFilter
private

Definition at line 60 of file SlidingWindowMultiSeedFinder.h.

◆ m_useMaxInCluster

bool InDet::SlidingWindowMultiSeedFinder::m_useMaxInCluster
private

Definition at line 56 of file SlidingWindowMultiSeedFinder.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.

◆ m_vtxSeedFinder

ToolHandle<Trk::IVertexSeedFinder> InDet::SlidingWindowMultiSeedFinder::m_vtxSeedFinder
private

Definition at line 62 of file SlidingWindowMultiSeedFinder.h.


The documentation for this class was generated from the following files:
Trk::anyDirection
@ anyDirection
Definition: PropDirection.h:22
Trk::Vertex
Definition: Tracking/TrkEvent/VxVertex/VxVertex/Vertex.h:26
xAOD::Vertex_v1::setPosition
void setPosition(const Amg::Vector3D &position)
Sets the 3-position.
get_generator_info.result
result
Definition: get_generator_info.py:21
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
xAOD::Vertex
Vertex_v1 Vertex
Define the latest version of the vertex class.
Definition: Event/xAOD/xAODTracking/xAODTracking/Vertex.h:16
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
InDet::SlidingWindowMultiSeedFinder::m_sortingTool
ToolHandle< InDetTrackZ0SortingTool > m_sortingTool
Definition: SlidingWindowMultiSeedFinder.h:61
Trk::PerigeeSurface
Definition: PerigeeSurface.h:43
InDet::SlidingWindowMultiSeedFinder::m_addingDistance
float m_addingDistance
Definition: SlidingWindowMultiSeedFinder.h:55
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
InDet::SlidingWindowMultiSeedFinder::m_clusterLength
float m_clusterLength
Definition: SlidingWindowMultiSeedFinder.h:53
InDet::SlidingWindowMultiSeedFinder::m_vtxSeedFinder
ToolHandle< Trk::IVertexSeedFinder > m_vtxSeedFinder
Definition: SlidingWindowMultiSeedFinder.h:62
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
Trk::z0
@ z0
Definition: ParamDefs.h:70
xAOD::Vertex_v1::position
const Amg::Vector3D & position() const
Returns the 3-pos.
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
InDet::SlidingWindowMultiSeedFinder::m_trkFilter
ToolHandle< Trk::ITrackSelectorTool > m_trkFilter
Definition: SlidingWindowMultiSeedFinder.h:60
InDet::SlidingWindowMultiSeedFinder::m_useMaxInCluster
bool m_useMaxInCluster
Definition: SlidingWindowMultiSeedFinder.h:56
Trk::RecVertex
Trk::RecVertex inherits from Trk::Vertex.
Definition: RecVertex.h:44
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
InDet::SlidingWindowMultiSeedFinder::m_ignoreBeamSpot
bool m_ignoreBeamSpot
Definition: SlidingWindowMultiSeedFinder.h:58
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:92
beamspotman.n
n
Definition: beamspotman.py:731
InDet::SlidingWindowMultiSeedFinder::m_ignoreLevel
int m_ignoreLevel
Definition: SlidingWindowMultiSeedFinder.h:57
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Trk::pion
@ pion
Definition: ParticleHypothesis.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
Trk::ParametersBase
Definition: ParametersBase.h:55
Trk::Vertex::position
const Amg::Vector3D & position() const
return position of vertex
Definition: Vertex.cxx:72
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
Trk::perigeeParameters
@ perigeeParameters
Definition: MeasurementType.h:19
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
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
InDet::SlidingWindowMultiSeedFinder::m_extrapolator
ToolHandle< Trk::IExtrapolator > m_extrapolator
Definition: SlidingWindowMultiSeedFinder.h:66
InDet::SlidingWindowMultiSeedFinder::m_beamSpotKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Definition: SlidingWindowMultiSeedFinder.h:65
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
InDet::SlidingWindowMultiSeedFinder::m_breakingDistance
float m_breakingDistance
Definition: SlidingWindowMultiSeedFinder.h:54
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
xAOD::Vertex_v1::setCovariancePosition
void setCovariancePosition(const AmgSymMatrix(3)&covariancePosition)
Sets the vertex covariance matrix.
fitman.k
k
Definition: fitman.py:528