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::DivisiveMultiSeedFinder Class Referencefinal

#include <DivisiveMultiSeedFinder.h>

Inheritance diagram for InDet::DivisiveMultiSeedFinder:
Collaboration diagram for InDet::DivisiveMultiSeedFinder:

Public Member Functions

virtual StatusCode initialize () override
 
 DivisiveMultiSeedFinder (const std::string &t, const std::string &n, const IInterface *p)
 Constructor and destructor. More...
 
 ~DivisiveMultiSeedFinder ()
 
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

double m_sepDistance
 
unsigned int m_nRemaining
 
bool m_ignoreBeamSpot
 
ToolHandle< Trk::ITrackSelectorToolm_trkFilter
 
ToolHandle< InDetTrackZ0SortingToolm_sortingTool
 
ToolHandle< InDetTrackClusterCleaningToolm_cleaningTool
 
SG::ReadCondHandleKey< InDet::BeamSpotDatam_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }
 
ToolHandle< Trk::IExtrapolatorm_extrapolator
 
ToolHandle< Trk::IVertexSeedFinderm_vtxSeedFinder
 
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 26 of file DivisiveMultiSeedFinder.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

◆ DivisiveMultiSeedFinder()

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

Constructor and destructor.

Definition at line 58 of file DivisiveMultiSeedFinder.cxx.

59  :AthAlgTool(t,n,p),
60  m_sepDistance(0.5),
61  m_nRemaining(1),
62  m_ignoreBeamSpot(false),
63  m_extrapolator("Trk::Extrapolator"),
64  m_vtxSeedFinder("Trk::CrossDistancesSeedFinder")
65  {
66  declareInterface<IMultiPVSeedFinder>(this);
67  declareProperty("separationDistance", m_sepDistance);
68  declareProperty("nRemainTracks", m_nRemaining);
69  declareProperty("IgnoreBeamSpot", m_ignoreBeamSpot);
70 
71  //track filter
72  declareProperty("TrackSelector",m_trkFilter);
73 
74  //sorting tool
75  declareProperty("SortingTool", m_sortingTool);
76 
77  //cleaning tool
78  declareProperty("CleaningTool", m_cleaningTool);
79 
80  //vertex finder tool (needed when no beam spot is available)
81  declareProperty("VertexSeedFinder",m_vtxSeedFinder);
82 
83  //extrapolator
84  declareProperty("Extrapolator",m_extrapolator);
85 
86  }//end of constructor

◆ ~DivisiveMultiSeedFinder()

InDet::DivisiveMultiSeedFinder::~DivisiveMultiSeedFinder ( )
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::DivisiveMultiSeedFinder::initialize ( )
overridevirtual

Definition at line 19 of file DivisiveMultiSeedFinder.cxx.

20  {
21 
22  if(m_trkFilter.retrieve().isFailure())
23  {
24  ATH_MSG_ERROR("Unable to retrieve "<<m_trkFilter);
25  return StatusCode::FAILURE;
26  }
27 
28  if(m_sortingTool.retrieve().isFailure())
29  {
30  ATH_MSG_ERROR("Unable to retrieve "<<m_sortingTool);
31  return StatusCode::FAILURE;
32  }
33 
34  if(m_vtxSeedFinder.retrieve().isFailure())
35  {
36  ATH_MSG_ERROR("Unable to retrieve " << m_vtxSeedFinder);
37  return StatusCode::FAILURE;
38  }
39 
40  if(m_cleaningTool.retrieve().isFailure())
41  {
42  ATH_MSG_ERROR("Unable to retrieve "<<m_cleaningTool);
43  return StatusCode::FAILURE;
44  }
45 
47 
48  if ( m_extrapolator.retrieve().isFailure() )
49  {
50  ATH_MSG_ERROR("Failed to retrieve tool " << m_extrapolator);
51  return StatusCode::FAILURE;
52  }
53 
54  return StatusCode::SUCCESS;
55  }//end of initialize method

◆ 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::DivisiveMultiSeedFinder::seeds ( const std::vector< const Trk::Track * > &  tracks) const
overridevirtual

Clustering method itself.

Implements InDet::IMultiPVSeedFinder.

Definition at line 91 of file DivisiveMultiSeedFinder.cxx.

92  {
93  const EventContext& ctx = Gaudi::Hive::currentContext();
94 
95  //step 1: preselection
96  std::vector<const Trk::Track*> preselectedTracks(0);
97  std::vector<const Trk::Track*>::const_iterator tr = tracks.begin();
98  std::vector<const Trk::Track*>::const_iterator tre = tracks.end();
99 
101  Trk::RecVertex beamrecposition(beamSpotHandle->beamVtx());
102  for(;tr!=tre;++tr) if(m_trkFilter->decision(**tr,&beamrecposition)) preselectedTracks.push_back(*tr);
103  ATH_MSG_DEBUG("Beam spot position is: "<< beamrecposition.position());
104  Trk::Vertex* beamposition=&beamrecposition;
105 
106  Trk::Vertex myVertex;
107  if (m_ignoreBeamSpot)
108  {
109  myVertex = Trk::Vertex(m_vtxSeedFinder->findSeed(tracks));
110  ATH_MSG_DEBUG(" vtx seed x: " << myVertex.position().x() <<
111  " vtx seed y: " << myVertex.position().y() <<
112  " vtx seed z: " << myVertex.position().z());
113  beamposition = &myVertex;
114  }
115 
116  //step 2: sorting in z0
117  //output container
118  std::vector< std::vector<const Trk::Track *> > result(0);
119  if(!preselectedTracks.empty())
120  {
121  std::vector<int> indexOfSorted = m_sortingTool->sortedIndex(preselectedTracks, beamposition);
122 
123  //step 3 preclustering
124  std::vector< std::vector<const Trk::Track *> > preClusters(0);
125 
126  //left-handed track position
127  std::vector<const Trk::Track *> tmp_cluster(0);
128 
129  Trk::PerigeeSurface perigeeSurface(beamposition->position());
130 
131  const Trk::TrackParameters* exPerigee =
133  ->extrapolateTrack(ctx, *preselectedTracks[indexOfSorted[0]], perigeeSurface, Trk::anyDirection, true, Trk::pion)
134  .release();
135 
136  double lastTrackZ0 = -999.;
137  if(exPerigee) { lastTrackZ0 = exPerigee->parameters()[Trk::z0]; delete exPerigee; }
138  else
139  {
140  ATH_MSG_WARNING("Impossible to extrapolate the first track; returning 0 container for this event");
141  return result;
142  }
143 
144  //looping over container
145  for(int i : indexOfSorted)
146  {
147  const Trk::TrackParameters* lexPerigee =
149  ->extrapolateTrack(ctx, *preselectedTracks[i], perigeeSurface, Trk::anyDirection, true, Trk::pion)
150  .release();
151 
152  double currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
153  delete lexPerigee;
154 
155  if (std::fabs(currentTrackZ0 - lastTrackZ0) < m_sepDistance) {
156  // the distance is below separation, adding to the same cluster
157  tmp_cluster.push_back(preselectedTracks[i]);
158  }else{
159  //the distance is above separation, starting new cluster
160  preClusters.push_back(tmp_cluster);
161  tmp_cluster.clear();
162  tmp_cluster.push_back(preselectedTracks[i]);
163  }//end of gap size check
164  lastTrackZ0 = currentTrackZ0;
165  }//end of loop over the sorted container
166 
167  //storing the last (or the only cluster)
168  preClusters.push_back(tmp_cluster);
169 
170  //step 4 iterative cleaning of clusters
171  for(const auto & preCluster : preClusters)
172  {
173  //------------------------------Debug code -------------------------------------------------------
174  /* std::vector<const Trk::Track *>::const_iterator cb = i->begin();
175  std::vector<const Trk::Track *>::const_iterator ce = i->end();
176  std::cout<<"*********Starting next cluster of size "<<i->size()<<std::endl;
177  for(;cb!=ce;++cb)
178  {
179  std::cout<<"Track Z0 in cluster: "<<(*cb)->perigeeParameters()->parameters()[Trk::z0]<<std::endl;
180  }//end of loop over the cluster entries
181  */
182  //-------------------------------end of debug code-------------------------------------------------
183 
184  if(preCluster.size()>m_nRemaining){
185  //iterative cleaning until outlying tracks remain
186  std::vector<const Trk::Track *> tracks_to_clean = preCluster;
187  bool clean_again = false;
188  do {
189  std::pair<std::vector<const Trk::Track *>, std::vector<const Trk::Track *> > clusterAndOutl =
190  m_cleaningTool->clusterAndOutliers(tracks_to_clean, beamposition);
191 
192  //if core size is miningfull, storing it
193  std::vector<const Trk::Track *> core_cluster = clusterAndOutl.first;
194  std::vector<const Trk::Track *> core_outl = clusterAndOutl.second;
195 
196  //--------------Debug output-----------------------------------------------------
197  // std::cout<<"Cleaning iteration "<<clean_count<<std::endl;
198  // std::cout<<"Reduced cluster size: "<<core_cluster.size()<<std::endl;
199  // std::cout<<"Outliers size: "<<core_outl.size()<<std::endl;
200  // ++clean_count;
201  //-------------------End of debug output -----------------------------------------
202 
203  if(core_cluster.empty()){
204  ATH_MSG_DEBUG("Core cluster has 0 size, remaining tracks are discarded.");
205  clean_again = false;
206  }else{
207  //storing clusters with >1 track (optional)
208  if(core_cluster.size()>1) result.push_back(core_cluster);
209 
210  //checking the outliers, whether more cleaning is to be done
211  if(core_outl.size()>m_nRemaining){
212  clean_again = true;
213  tracks_to_clean.clear();
214  tracks_to_clean = core_outl;
215  }else if(core_outl.size()>1){
216  clean_again = false;
217  ATH_MSG_DEBUG("There were remaining outliers of size: "<< core_outl.size());
218  ATH_MSG_DEBUG("Not evident, whether these tracks form a cluster. Rejected...");
219  }else clean_again = false;//end of outlier size check
220  }//end of core cluster 0 check
221 
222  }while(clean_again);//end of loop
223 
224  }else if(preCluster.size()==2){
225  //case of two track cluster. accepting without cleaning
226  result.push_back(preCluster);
227  }//end of cluster size check
228  }//end of loop over all the clusters
229  }//end of preselection size check
230 
231  return result;
232  }//end of clustering method

◆ seeds() [2/2]

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

Implements InDet::IMultiPVSeedFinder.

Definition at line 234 of file DivisiveMultiSeedFinder.cxx.

235  {
236  const EventContext& ctx = Gaudi::Hive::currentContext();
237 
238  //step 1: preselection
239  std::vector<const xAOD::TrackParticle*> preselectedTracks(0);
240 
241  //selecting with respect to the beam spot
242  xAOD::Vertex beamposition;
244  beamposition.setPosition(beamSpotHandle->beamVtx().position());
245  beamposition.setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition());
246 
247  for (const auto *track : tracks) {
248  if (m_trkFilter->decision(*track,&beamposition)) preselectedTracks.push_back(track);
249  }
250 
251  std::vector<const Trk::TrackParameters*> perigeeList;
252  std::vector<const xAOD::TrackParticle*>::const_iterator trackBegin=tracks.begin();
253  std::vector<const xAOD::TrackParticle*>::const_iterator trackEnd=tracks.end();
254  for (std::vector<const xAOD::TrackParticle*>::const_iterator trackIter=trackBegin;trackIter!=trackEnd;++trackIter){
255  perigeeList.push_back(&((*trackIter)->perigeeParameters()));
256  }
257 
258  Trk::RecVertex myVertex (m_vtxSeedFinder->findSeed(perigeeList));
259 
260  if (m_ignoreBeamSpot) {
261  ATH_MSG_DEBUG(" vtx seed x: " << myVertex.position().x() <<
262  " vtx seed y: " << myVertex.position().y() <<
263  " vtx seed z: " << myVertex.position().z());
264  beamposition.setPosition(myVertex.position());
265  beamposition.setCovariancePosition(myVertex.covariancePosition());
266  }
267 
268  //step 2: sorting in z0
269  //output container
270  std::vector< std::vector<const Trk::TrackParameters *> > result(0);
271  if(!preselectedTracks.empty()){
272  std::vector<int> indexOfSorted = m_sortingTool->sortedIndex(preselectedTracks, &beamposition);
273 
274  //need new sort method, either for xAODTrackParticles, or TrackParameters. Neither currently supported...
275 
276  //step 3 preclustering
277  std::vector< std::vector<const xAOD::TrackParticle *> > preClusters(0);
278 
279  //left-handed track position
280  std::vector<const xAOD::TrackParticle *> tmp_cluster(0);
281 
282  Trk::PerigeeSurface perigeeSurface(beamposition.position());
283  const Trk::TrackParameters* exPerigee =
285  ->extrapolate(ctx, preselectedTracks[indexOfSorted[0]]->perigeeParameters(),
286  perigeeSurface, Trk::anyDirection, true, Trk::pion)
287  .release();
288 
289  double lastTrackZ0 = -999.;
290  if(exPerigee){
291  lastTrackZ0 = exPerigee->parameters()[Trk::z0];delete exPerigee;
292  }
293  else{
294  ATH_MSG_WARNING("Impossible to extrapolate the first track; returning 0 container for this event");
295  return result;
296  }
297 
298  //looping over container
299  for(int i : indexOfSorted){
300  const Trk::TrackParameters* lexPerigee =
301  m_extrapolator->extrapolate(ctx, preselectedTracks[i]->perigeeParameters(),
302  perigeeSurface, Trk::anyDirection, true, Trk::pion).release();
303 
304  double currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
305  delete lexPerigee;
306 
307  if (std::fabs(currentTrackZ0 - lastTrackZ0) < m_sepDistance) {
308  // the distance is below separation, adding to the same cluster
309  tmp_cluster.push_back(preselectedTracks[i]);
310  }else{
311  //the distance is above separation, starting new cluster
312  preClusters.push_back(tmp_cluster);
313  tmp_cluster.clear();
314  tmp_cluster.push_back(preselectedTracks[i]);
315  }//end of gap size check
316 
317  lastTrackZ0 = currentTrackZ0;
318  }//end of loop over the sorted container
319 
320  //storing the last (or the only) cluster
321  preClusters.push_back(tmp_cluster);
322  ATH_MSG_DEBUG("The preselection returns clusters: "<<preClusters.size());
323 
324  //step 4 iterative cleaning of clusters
325  for(const auto & preCluster : preClusters){
326 
327  //------------------------------Debug code -------------------------------------------------------
328  /* std::vector<const Trk::Track *>::const_iterator cb = i->begin();
329  std::vector<const Trk::Track *>::const_iterator ce = i->end();
330  std::cout<<"*********Starting next cluster of size "<<i->size()<<std::endl;
331  for(;cb!=ce;++cb)
332  {
333  std::cout<<"Track Z0 in cluster: "<<(*cb)->perigeeParameters()->parameters()[Trk::z0]<<std::endl;
334  }//end of loop over the cluster entries
335  */
336  //-------------------------------end of debug code-------------------------------------------------
337 
338  if(preCluster.size()>m_nRemaining){
339  //iterative cleaning until outlying tracks remain
340  std::vector<const xAOD::TrackParticle *> tracks_to_clean = preCluster;
341  bool clean_again = false;
342  do{
343  std::pair<std::vector<const Trk::TrackParameters *>,
344  std::vector<const xAOD::TrackParticle *> > clusterAndOutl = m_cleaningTool->clusterAndOutliers(tracks_to_clean, &beamposition);
345 
346  //if core size is miningfull, storing it
347  std::vector<const Trk::TrackParameters *> core_cluster = clusterAndOutl.first;
348  std::vector<const xAOD::TrackParticle *> core_outl = clusterAndOutl.second;
349 
350  //--------------Debug output-----------------------------------------------------
351  // std::cout<<"Cleaning iteration "<<clean_count<<std::endl;
352  // std::cout<<"Reduced cluster size: "<<core_cluster.size()<<std::endl;
353  // std::cout<<"Outliers size: "<<core_outl.size()<<std::endl;
354  // ++clean_count;
355  //-------------------End of debug output -----------------------------------------
356 
357  if(core_cluster.empty()){
358  ATH_MSG_DEBUG("Core cluster has 0 size, remaining tracks are discarded.");
359  clean_again = false;
360  }else{
361  //storing clusters with >1 track (optional)
362  if(core_cluster.size()>1) result.push_back(core_cluster);
363 
364  //checking the outliers, whether more cleaning is to be done
365  if(core_outl.size()>m_nRemaining){
366  clean_again = true;
367  tracks_to_clean.clear();
368  tracks_to_clean = core_outl;
369  }else if(core_outl.size()>1){
370  clean_again = false;
371  ATH_MSG_DEBUG("There were remaining outliers of size: "<< core_outl.size());
372  ATH_MSG_DEBUG("Not evident, whether these tracks form a cluster. Rejected...");
373  }else clean_again = false;//end of outlier size check
374  }//end of core cluster 0 check
375 
376  }while(clean_again);//end of loop
377 
378  }else if(preCluster.size()==2){
379  //case of two track cluster. accepting without cleaning
380  std::vector<const Trk::TrackParameters *> twotrack;
381  twotrack.push_back(&(preCluster[0]->perigeeParameters()));
382  twotrack.push_back(&(preCluster[1]->perigeeParameters()));
383  result.push_back(twotrack);
384  }//end of cluster size check
385  }//end of loop over all the clusters
386  }//end of preselection size check
387  return result;
388 
389  }

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

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

Definition at line 73 of file DivisiveMultiSeedFinder.h.

◆ m_cleaningTool

ToolHandle<InDetTrackClusterCleaningTool> InDet::DivisiveMultiSeedFinder::m_cleaningTool
private

Definition at line 70 of file DivisiveMultiSeedFinder.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::DivisiveMultiSeedFinder::m_extrapolator
private

Definition at line 75 of file DivisiveMultiSeedFinder.h.

◆ m_ignoreBeamSpot

bool InDet::DivisiveMultiSeedFinder::m_ignoreBeamSpot
private

Definition at line 56 of file DivisiveMultiSeedFinder.h.

◆ m_nRemaining

unsigned int InDet::DivisiveMultiSeedFinder::m_nRemaining
private

Definition at line 54 of file DivisiveMultiSeedFinder.h.

◆ m_sepDistance

double InDet::DivisiveMultiSeedFinder::m_sepDistance
private

Definition at line 52 of file DivisiveMultiSeedFinder.h.

◆ m_sortingTool

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

Definition at line 67 of file DivisiveMultiSeedFinder.h.

◆ m_trkFilter

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

Definition at line 64 of file DivisiveMultiSeedFinder.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::DivisiveMultiSeedFinder::m_vtxSeedFinder
private

Definition at line 78 of file DivisiveMultiSeedFinder.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
Trk::PerigeeSurface
Definition: PerigeeSurface.h:43
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
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
Trk::z0
@ z0
Definition: ParamDefs.h:70
InDet::DivisiveMultiSeedFinder::m_beamSpotKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Definition: DivisiveMultiSeedFinder.h:73
xAOD::Vertex_v1::position
const Amg::Vector3D & position() const
Returns the 3-pos.
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Trk::RecVertex
Trk::RecVertex inherits from Trk::Vertex.
Definition: RecVertex.h:44
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
InDet::DivisiveMultiSeedFinder::m_sepDistance
double m_sepDistance
Definition: DivisiveMultiSeedFinder.h:52
InDet::DivisiveMultiSeedFinder::m_trkFilter
ToolHandle< Trk::ITrackSelectorTool > m_trkFilter
Definition: DivisiveMultiSeedFinder.h:64
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
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:
InDet::DivisiveMultiSeedFinder::m_extrapolator
ToolHandle< Trk::IExtrapolator > m_extrapolator
Definition: DivisiveMultiSeedFinder.h:75
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
InDet::DivisiveMultiSeedFinder::m_vtxSeedFinder
ToolHandle< Trk::IVertexSeedFinder > m_vtxSeedFinder
Definition: DivisiveMultiSeedFinder.h:78
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
InDet::DivisiveMultiSeedFinder::m_cleaningTool
ToolHandle< InDetTrackClusterCleaningTool > m_cleaningTool
Definition: DivisiveMultiSeedFinder.h:70
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
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
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
InDet::DivisiveMultiSeedFinder::m_nRemaining
unsigned int m_nRemaining
Definition: DivisiveMultiSeedFinder.h:54
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.
InDet::DivisiveMultiSeedFinder::m_ignoreBeamSpot
bool m_ignoreBeamSpot
Definition: DivisiveMultiSeedFinder.h:56
fitman.k
k
Definition: fitman.py:528
InDet::DivisiveMultiSeedFinder::m_sortingTool
ToolHandle< InDetTrackZ0SortingTool > m_sortingTool
Definition: DivisiveMultiSeedFinder.h:67