ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
FPGATrackSimOverlapRemovalTool Class Reference

Remove (mark) duplicate tracks This tool takes FPGATrackSimTrack as input and mark their status of passing/failing the overlap removal criteria. More...

#include <FPGATrackSimOverlapRemovalTool.h>

Inheritance diagram for FPGATrackSimOverlapRemovalTool:
Collaboration diagram for FPGATrackSimOverlapRemovalTool:

Public Member Functions

 FPGATrackSimOverlapRemovalTool (const std::string &, const std::string &, const IInterface *)
 
 FPGATrackSimOverlapRemovalTool ()=delete
 
StatusCode initialize () override
 
StatusCode runOverlapRemoval (std::vector< std::shared_ptr< const FPGATrackSimRoad >> &roads)
 
StatusCode runOverlapRemoval (std::vector< FPGATrackSimTrack > &tracks)
 
void setDoSecondStage (bool v)
 
bool getDoSecondStage () const
 
ORAlgo getAlgorithm () const
 
StatusCode removeOverlapping (FPGATrackSimTrack &track1, FPGATrackSimTrack &track2)
 
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, V, H > &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 bool compareTrackQuality (const FPGATrackSimTrack &track1, const FPGATrackSimTrack &track2)
 

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 runOverlapRemoval_fast (std::vector< FPGATrackSimTrack > &tracks)
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

Gaudi::Property< bool > m_do2ndStage { this, "DoSecondStage", false, "Do second stage of not?"}
 
Gaudi::Property< int > m_NumOfHitPerGrouping { this, "NumOfHitPerGrouping", 5, "Number of hits pre grouping"}
 
Gaudi::Property< float > m_minChi2 { this, "MinChi2", 40, "Minimum chi2 requirement for tracks being considered in OR"}
 
Gaudi::Property< bool > m_roadSliceOR { this, "roadSliceOR", true, "Do slice-wise overlap removal for roads (Hough-only)"}
 
Gaudi::Property< int > m_localMaxWindowSize { this, "localMaxWindowSize", 0, "Only create roads that are a local maximum within this window size. Set this to 0 to turn off local max filtering"}
 
Gaudi::Property< unsigned > m_imageSize_x { this, "nBins_x", 0, "number of bins in, eg, phi_track"}
 
Gaudi::Property< unsigned > m_imageSize_y { this, "nBins_y", 0, "number of bins in, eg, q/pT"}
 
Gaudi::Property< std::string > m_algorithm { this, "ORAlgo", "Normal", "Overlap removal algorithm"}
 
Gaudi::Property< bool > m_doFastOR { this, "doFastOR", false, "Use fast overlap removal algorithm instead of default"}
 
Gaudi::Property< bool > m_compareAllHits {this, "compareAllHits", true, "Compare all hits to all other hits when comparing two tracks"}
 
ToolHandle< GenericMonitoringToolm_monTool {this,"MonTool", "", "Monitoring tool"}
 
ORAlgo m_algo {ORAlgo::Normal}
 
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

Remove (mark) duplicate tracks This tool takes FPGATrackSimTrack as input and mark their status of passing/failing the overlap removal criteria.

Definition at line 35 of file FPGATrackSimOverlapRemovalTool.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

◆ FPGATrackSimOverlapRemovalTool() [1/2]

FPGATrackSimOverlapRemovalTool::FPGATrackSimOverlapRemovalTool ( const std::string &  algname,
const std::string &  name,
const IInterface *  ifc 
)

Definition at line 14 of file FPGATrackSimOverlapRemovalTool.cxx.

14  :
15  AthAlgTool(algname, name, ifc)
16 {
17 }

◆ FPGATrackSimOverlapRemovalTool() [2/2]

FPGATrackSimOverlapRemovalTool::FPGATrackSimOverlapRemovalTool ( )
delete

Member Function Documentation

◆ compareTrackQuality()

bool FPGATrackSimOverlapRemovalTool::compareTrackQuality ( const FPGATrackSimTrack track1,
const FPGATrackSimTrack track2 
)
static

Definition at line 190 of file FPGATrackSimOverlapRemovalTool.cxx.

191 {
192  std::vector<const FPGATrackSimHit*> hitsInTrack1;
193  for ( auto& hit : track1.getFPGATrackSimHits()) {
194  if (hit.isReal()) hitsInTrack1.push_back(&hit);
195  }
196 
197  std::vector<const FPGATrackSimHit*> hitsInTrack2;
198  for ( auto& hit: track2.getFPGATrackSimHits()){
199  if (hit.isReal()) hitsInTrack2.push_back(&hit);
200  }
201 
202  // If one track has more hits than the other, it's better.
203  // Return true if track 2 is better than track 1.
204  // Otherwise, decide based on chi2.
205  bool goodOrder = true;
206  if (hitsInTrack1.size() == hitsInTrack2.size()) {
207  // Surprising number of cases where the chi2 is actually identical.
208  // In these cases, let's default to the track ID number as the next most important property.
209  // So put it higher since we are considering later tracks to be better.
210  if (track1.getChi2ndof() == track2.getChi2ndof() && track1.getTrackID() < track2.getTrackID()) goodOrder = false;
211  // Now assuming they're different, we want them in decreasing chi2 order
212  else if (track1.getChi2ndof() < track2.getChi2ndof()) goodOrder = false;
213  } else if (hitsInTrack1.size() > hitsInTrack2.size()) {
214  goodOrder = false;
215  }
216 
217  return goodOrder;
218 
219 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > &  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, V, H > &  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, V, H > &  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, V, H > &  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, V, H > &  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

◆ getAlgorithm()

ORAlgo FPGATrackSimOverlapRemovalTool::getAlgorithm ( ) const
inline

Definition at line 51 of file FPGATrackSimOverlapRemovalTool.h.

51 {return m_algo;}

◆ getDoSecondStage()

bool FPGATrackSimOverlapRemovalTool::getDoSecondStage ( ) const
inline

Definition at line 50 of file FPGATrackSimOverlapRemovalTool.h.

50 { return m_do2ndStage; }

◆ initialize()

StatusCode FPGATrackSimOverlapRemovalTool::initialize ( )
override

Definition at line 19 of file FPGATrackSimOverlapRemovalTool.cxx.

20 {
21  ATH_MSG_INFO( "FPGATrackSimOverlapRemovalTool::initialize()" );
22 
23  if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve());
24 
25  // Check road OR
27  ATH_MSG_WARNING("LocalMaxOR only being run per hough slice (i.e. this tool does nothing) since roadSliceOR is turned off");
28 
29 
30  // Setup OR algorithm
31  if(m_algorithm == "Normal") m_algo=ORAlgo::Normal;
32  else if(m_algorithm == "Invert") m_algo=ORAlgo::InvertGrouping;
33  else
34  {
35  ATH_MSG_ERROR("initialize(): OR algorithm doesn't exist. ");
36  return StatusCode::FAILURE;
37  }
38  ATH_MSG_DEBUG("Overlap removal algorithm is "<<m_algorithm.value());
39 
40  return StatusCode::SUCCESS;
41 }

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

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

◆ removeOverlapping()

StatusCode FPGATrackSimOverlapRemovalTool::removeOverlapping ( FPGATrackSimTrack track1,
FPGATrackSimTrack track2 
)

Definition at line 117 of file FPGATrackSimOverlapRemovalTool.cxx.

117  {
118 
119  // Hit comparison
120  struct HitCompare {
121  bool operator()(const FPGATrackSimHit* a, const FPGATrackSimHit* b) const {
122  auto hash_a = a->getIdentifierHash();
123  auto hash_b = b->getIdentifierHash();
124  if ( hash_a == hash_b ) {
125  auto phi_a = a->getPhiIndex();
126  auto phi_b = b->getPhiIndex();
127  if ( phi_a == phi_b ) {
128  auto eta_a = a->getEtaIndex();
129  auto eta_b = b->getEtaIndex();
130  if ( eta_a == eta_b) {
131  auto layer_a = a->getPhysLayer();
132  auto layer_b = b->getPhysLayer();
133  return layer_a < layer_b;
134  }
135  return eta_a < eta_b;
136  }
137  return phi_a < phi_b;
138  }
139  return hash_a < hash_b;
140  }
141  };
142 
143  std::set<const FPGATrackSimHit*, HitCompare > hitsInTrack1;
144  for ( auto& hit : track1.getFPGATrackSimHits()) {
145  if (hit.isReal()) hitsInTrack1.insert(&hit);
146  }
147 
148  std::set<const FPGATrackSimHit*, HitCompare> hitsInTrack2;
149  for ( auto& hit: track2.getFPGATrackSimHits()){
150  if (hit.isReal()) hitsInTrack2.insert(&hit);
151  }
152 
153  std::vector<const FPGATrackSimHit*> sharedHits;
154  std::set_intersection( hitsInTrack1.begin(), hitsInTrack1.end(),
155  hitsInTrack2.begin(), hitsInTrack2.end(),
156  std::back_inserter(sharedHits),
157  HitCompare() );
158 
159  // Number of real hits in track 1, number of real hits in track 2, number of shared hits, number of non-shared hits (?)
160  int nHitsInTrack1 = hitsInTrack1.size();
161  int nHitsInTrack2 = hitsInTrack2.size();
162  int nSharedHits = sharedHits.size();
163  // Original version seems to be only track 1; I want to compare each pair only once so
164  // let's make this the most conservative option (i.e. smallest number) ?
165  int nonOverlappingHits = std::min(nHitsInTrack1 - nSharedHits, nHitsInTrack2 - nSharedHits);
166 
167  // Now check if these pass our criteria for overlapping. If not, just return.
168  if(getAlgorithm() == ORAlgo::Normal) {
169  // Here decision is based on number of overlapping hits.
170  // Consider these overlapping if they share >= m_NumOfHitPerGrouping
171  if(nSharedHits < m_NumOfHitPerGrouping) return StatusCode::SUCCESS;
172 
173  } else if(getAlgorithm() == ORAlgo::InvertGrouping) {
174  // This is the opposite: duplicates of number of unique hits is <= m_NumOfHitPerGrouping.
175  if(nonOverlappingHits > m_NumOfHitPerGrouping) return StatusCode::SUCCESS;
176 
177  } else {
178  // Unknown.
179  return StatusCode::FAILURE;
180  }
181 
182  // Made it here: these tracks are overlapping.
183  // But we already sorted them such that track 2 is the one
184  // we want to keep, so we can just set track 1 to be removed.
185  track1.setPassedOR(0);
186 
187  return StatusCode::SUCCESS;
188 }

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

◆ runOverlapRemoval() [1/2]

StatusCode FPGATrackSimOverlapRemovalTool::runOverlapRemoval ( std::vector< FPGATrackSimTrack > &  tracks)

Definition at line 102 of file FPGATrackSimOverlapRemovalTool.cxx.

103 {
104 
105  // Do fast OR instead of requested
106  if (m_doFastOR) return runOverlapRemoval_fast(tracks);
107 
108  // Otherwise, proceed
109  ATH_MSG_DEBUG("Beginning runOverlapRemoval()");
110 
111  ATH_MSG_DEBUG("Tracks in event: " << tracks.size());
112 
114 }

◆ runOverlapRemoval() [2/2]

StatusCode FPGATrackSimOverlapRemovalTool::runOverlapRemoval ( std::vector< std::shared_ptr< const FPGATrackSimRoad >> &  roads)

Definition at line 66 of file FPGATrackSimOverlapRemovalTool.cxx.

67 {
68  if (roads.empty()) return StatusCode::SUCCESS;
69 
70  if (!m_roadSliceOR) return StatusCode::SUCCESS;
71  size_t in = roads.size();
72 
73  // Hough image
75 
76  // Slice-wise duplicate removal: accept only one road (with most hits) per bin
77  for (auto &r: roads)
78  {
79  FPGATrackSimRoad* & old = acc(r->getYBin(), r->getXBin());
80  if (!old) old = new FPGATrackSimRoad (*r.get());
81  else if (r->getNHitLayers() > old->getNHitLayers()) *old = *r.get();
82  else if (r->getNHitLayers() == old->getNHitLayers() && r->getNHits() > old->getNHits()) *old = *r.get();
83  }
84 
85  // Reformat to vector
86  roads.clear();
87  for (unsigned y = 0; y < m_imageSize_y; y++)
88  for (unsigned x = 0; x < m_imageSize_x; x++)
89  if (FPGATrackSimRoad *tempPtr = acc(y, x); tempPtr && isLocalMax(acc, x, y, m_localMaxWindowSize)/*All-slices local max*/) {
90  roads.emplace_back(std::shared_ptr<const FPGATrackSimRoad>(tempPtr));
91  acc(y, x) = nullptr;
92  }
93  else {
94  delete acc(y,x);
95  acc(y,x) = nullptr;
96  }
97 
98  ATH_MSG_DEBUG("Input: " << in << " Output: " << roads.size());
99  return StatusCode::SUCCESS;
100 }

◆ runOverlapRemoval_fast()

StatusCode FPGATrackSimOverlapRemovalTool::runOverlapRemoval_fast ( std::vector< FPGATrackSimTrack > &  tracks)
private

Definition at line 221 of file FPGATrackSimOverlapRemovalTool.cxx.

222 {
223  ATH_MSG_DEBUG("Beginning fast overlap removal");
224 
225  // Sort tracks in order of increasing quality.
226  // This way, once a track has been eliminated in a comparison, we don't
227  // need to check it against any other tracks - they will always be
228  // better than it.
229  std::sort(std::begin(tracks),
230  std::end(tracks),
232 
233  // Now compare every pair of tracks.
234  // Set passedOR to 0 for the worst one (first one)
235  // if they are found to overlap.
236  for (unsigned int i=0; i < tracks.size(); i++) {
237 
238  // Skip track i if bad chi2.
239  if (tracks.at(i).getChi2ndof() > m_minChi2.value()) {
240  tracks.at(i).setPassedOR(0);
241  continue;
242  }
243 
244  // Now check against all other tracks.
245  for (unsigned int j=i+1; j< tracks.size(); j++) {
246 
247  // Uniquely comparing tracks i and j here.
248 
249  // If have set track i to 0 in a previous comparison,
250  // no need to look at it any more - we're done with it.
251  if (!tracks.at(i).passedOR()) break;
252 
253  // Ignore j if its chi2 is bad.
254  if (tracks.at(j).getChi2ndof() > m_minChi2.value()) tracks.at(j).setPassedOR(0);
255 
256  // If we just set track j to zero for bad chi2,
257  // no need to do the comparison.
258  if (!tracks.at(j).passedOR()) continue;
259 
260  // If we're still here, two at least semi-decent tracks.
261  // Compare them and remove one if necessary.
262  ATH_CHECK(removeOverlapping(tracks.at(i),tracks.at(j)));
263 
264  }
265  }
266 
267  return StatusCode::SUCCESS;
268 }

◆ setDoSecondStage()

void FPGATrackSimOverlapRemovalTool::setDoSecondStage ( bool  v)
inline

Definition at line 49 of file FPGATrackSimOverlapRemovalTool.h.

49 { m_do2ndStage = v; }

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

ORAlgo FPGATrackSimOverlapRemovalTool::m_algo {ORAlgo::Normal}
private

Definition at line 72 of file FPGATrackSimOverlapRemovalTool.h.

◆ m_algorithm

Gaudi::Property<std::string> FPGATrackSimOverlapRemovalTool::m_algorithm { this, "ORAlgo", "Normal", "Overlap removal algorithm"}
private

Definition at line 67 of file FPGATrackSimOverlapRemovalTool.h.

◆ m_compareAllHits

Gaudi::Property<bool> FPGATrackSimOverlapRemovalTool::m_compareAllHits {this, "compareAllHits", true, "Compare all hits to all other hits when comparing two tracks"}
private

Definition at line 69 of file FPGATrackSimOverlapRemovalTool.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_do2ndStage

Gaudi::Property<bool> FPGATrackSimOverlapRemovalTool::m_do2ndStage { this, "DoSecondStage", false, "Do second stage of not?"}
private

Definition at line 60 of file FPGATrackSimOverlapRemovalTool.h.

◆ m_doFastOR

Gaudi::Property<bool> FPGATrackSimOverlapRemovalTool::m_doFastOR { this, "doFastOR", false, "Use fast overlap removal algorithm instead of default"}
private

Definition at line 68 of file FPGATrackSimOverlapRemovalTool.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_imageSize_x

Gaudi::Property<unsigned> FPGATrackSimOverlapRemovalTool::m_imageSize_x { this, "nBins_x", 0, "number of bins in, eg, phi_track"}
private

Definition at line 65 of file FPGATrackSimOverlapRemovalTool.h.

◆ m_imageSize_y

Gaudi::Property<unsigned> FPGATrackSimOverlapRemovalTool::m_imageSize_y { this, "nBins_y", 0, "number of bins in, eg, q/pT"}
private

Definition at line 66 of file FPGATrackSimOverlapRemovalTool.h.

◆ m_localMaxWindowSize

Gaudi::Property<int> FPGATrackSimOverlapRemovalTool::m_localMaxWindowSize { this, "localMaxWindowSize", 0, "Only create roads that are a local maximum within this window size. Set this to 0 to turn off local max filtering"}
private

Definition at line 64 of file FPGATrackSimOverlapRemovalTool.h.

◆ m_minChi2

Gaudi::Property<float> FPGATrackSimOverlapRemovalTool::m_minChi2 { this, "MinChi2", 40, "Minimum chi2 requirement for tracks being considered in OR"}
private

Definition at line 62 of file FPGATrackSimOverlapRemovalTool.h.

◆ m_monTool

ToolHandle<GenericMonitoringTool> FPGATrackSimOverlapRemovalTool::m_monTool {this,"MonTool", "", "Monitoring tool"}
private

Definition at line 70 of file FPGATrackSimOverlapRemovalTool.h.

◆ m_NumOfHitPerGrouping

Gaudi::Property<int> FPGATrackSimOverlapRemovalTool::m_NumOfHitPerGrouping { this, "NumOfHitPerGrouping", 5, "Number of hits pre grouping"}
private

Definition at line 61 of file FPGATrackSimOverlapRemovalTool.h.

◆ m_roadSliceOR

Gaudi::Property<bool> FPGATrackSimOverlapRemovalTool::m_roadSliceOR { this, "roadSliceOR", true, "Do slice-wise overlap removal for roads (Hough-only)"}
private

Definition at line 63 of file FPGATrackSimOverlapRemovalTool.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.


The documentation for this class was generated from the following files:
beamspotman.r
def r
Definition: beamspotman.py:672
FPGATrackSimOverlapRemovalTool::m_NumOfHitPerGrouping
Gaudi::Property< int > m_NumOfHitPerGrouping
Definition: FPGATrackSimOverlapRemovalTool.h:61
getMenu.algname
algname
Definition: getMenu.py:54
FPGATrackSimTrack::getTrackID
int getTrackID() const
Definition: FPGATrackSimTrack.h:32
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
FPGATrackSimOverlapRemovalTool::m_do2ndStage
Gaudi::Property< bool > m_do2ndStage
Definition: FPGATrackSimOverlapRemovalTool.h:60
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
FPGATrackSimOverlapRemovalTool::getAlgorithm
ORAlgo getAlgorithm() const
Definition: FPGATrackSimOverlapRemovalTool.h:51
FPGATrackSimOverlapRemovalTool::m_compareAllHits
Gaudi::Property< bool > m_compareAllHits
Definition: FPGATrackSimOverlapRemovalTool.h:69
ORAlgo::Normal
@ Normal
FPGATrackSimOverlapRemovalTool::m_doFastOR
Gaudi::Property< bool > m_doFastOR
Definition: FPGATrackSimOverlapRemovalTool.h:68
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
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
FPGATrackSimTrack::setPassedOR
void setPassedOR(unsigned int)
Definition: FPGATrackSimTrack.cxx:259
FPGATrackSimOverlapRemovalTool::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: FPGATrackSimOverlapRemovalTool.h:70
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
FPGATrackSimOverlapRemovalTool::m_imageSize_x
Gaudi::Property< unsigned > m_imageSize_x
Definition: FPGATrackSimOverlapRemovalTool.h:65
FPGATrackSimOverlapRemovalTool::m_imageSize_y
Gaudi::Property< unsigned > m_imageSize_y
Definition: FPGATrackSimOverlapRemovalTool.h:66
x
#define x
isLocalMax
bool isLocalMax(vector2D< FPGATrackSimRoad * > const &acc, unsigned x, unsigned y, int localMaxWindowSize)
Definition: FPGATrackSimOverlapRemovalTool.cxx:43
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:92
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
FPGATrackSimHit
Definition: FPGATrackSimHit.h:41
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
FPGATrackSimTrack::getFPGATrackSimHits
const std::vector< FPGATrackSimHit > & getFPGATrackSimHits() const
Definition: FPGATrackSimTrack.h:63
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
vector2D
Definition: FPGATrackSimVectors.h:28
AthCommonDataStore
Definition: AthCommonDataStore.h:52
FPGATrackSimOverlapRemovalTool::m_roadSliceOR
Gaudi::Property< bool > m_roadSliceOR
Definition: FPGATrackSimOverlapRemovalTool.h:63
FPGATrackSimTrack::getChi2ndof
float getChi2ndof() const
Definition: FPGATrackSimTrack.h:45
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
FPGATrackSimOverlapRemovalTool::m_algorithm
Gaudi::Property< std::string > m_algorithm
Definition: FPGATrackSimOverlapRemovalTool.h:67
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
FPGATrackSimOverlapRemovalTool::m_minChi2
Gaudi::Property< float > m_minChi2
Definition: FPGATrackSimOverlapRemovalTool.h:62
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
FPGATrackSimOverlapRemovalTool::m_localMaxWindowSize
Gaudi::Property< int > m_localMaxWindowSize
Definition: FPGATrackSimOverlapRemovalTool.h:64
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:240
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:76
FPGATrackSimOverlapRemovalTool::m_algo
ORAlgo m_algo
Definition: FPGATrackSimOverlapRemovalTool.h:72
FPGATrackSimOverlapRemovalTool::compareTrackQuality
static bool compareTrackQuality(const FPGATrackSimTrack &track1, const FPGATrackSimTrack &track2)
Definition: FPGATrackSimOverlapRemovalTool.cxx:190
FPGATrackSimOverlapRemovalTool::runOverlapRemoval_fast
StatusCode runOverlapRemoval_fast(std::vector< FPGATrackSimTrack > &tracks)
Definition: FPGATrackSimOverlapRemovalTool.cxx:221
python.PyAthena.v
v
Definition: PyAthena.py:154
FPGATrackSimOverlapRemovalTool::removeOverlapping
StatusCode removeOverlapping(FPGATrackSimTrack &track1, FPGATrackSimTrack &track2)
Definition: FPGATrackSimOverlapRemovalTool.cxx:117
ORAlgo::InvertGrouping
@ InvertGrouping
a
TList * a
Definition: liststreamerinfos.cxx:10
y
#define y
h
runOverlapRemoval
StatusCode runOverlapRemoval(std::vector< FPGATrackSimTrack > &tracks, const float minChi2, const int NumOfHitPerGrouping, ORAlgo orAlgo, ToolHandle< GenericMonitoringTool > &monTool, bool compareAllHits=false)
Definition: FPGATrackSimHoughFunctions.cxx:15
CSV_InDetExporter.old
old
Definition: CSV_InDetExporter.py:145
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
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:629
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:801
columnar::operator()
decltype(auto) operator()(ObjectId< CI, CM > id) const noexcept
Definition: ColumnAccessor.h:173
set_intersection
Set * set_intersection(Set *set1, Set *set2)
Perform an intersection of two sets.
FPGATrackSimRoad
Definition: FPGATrackSimRoad.h:31
fitman.k
k
Definition: fitman.py:528