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"}
 
int m_totLayers = 0
 
ORAlgo m_algo {ORAlgo::Normal}
 
ServiceHandle< IFPGATrackSimMappingSvcm_FPGATrackSimMapping {this,"FPGATrackSimMappingSvc","FPGATrackSimMappingSvc"}
 
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 201 of file FPGATrackSimOverlapRemovalTool.cxx.

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

◆ 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 if this is 2nd stage
26  if(m_do2ndStage)
27  {
28  m_totLayers = m_FPGATrackSimMapping->PlaneMap_2nd(0)->getNLogiLayers();
29  }
30  else
31  {
32  m_totLayers = m_FPGATrackSimMapping->PlaneMap_1st(0)->getNLogiLayers();
33  }
34  ATH_MSG_DEBUG("Total number of layer: " << m_totLayers);
35 
36  // Check road OR
38  ATH_MSG_WARNING("LocalMaxOR only being run per hough slice (i.e. this tool does nothing) since roadSliceOR is turned off");
39 
40 
41  // Setup OR algorithm
42  if(m_algorithm == "Normal") m_algo=ORAlgo::Normal;
43  else if(m_algorithm == "Invert") m_algo=ORAlgo::InvertGrouping;
44  else
45  {
46  ATH_MSG_ERROR("initialize(): OR algorithm doesn't exist. ");
47  return StatusCode::FAILURE;
48  }
49  ATH_MSG_DEBUG("Overlap removal algorithm is "<<m_algorithm.value());
50 
51  return StatusCode::SUCCESS;
52 }

◆ 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 128 of file FPGATrackSimOverlapRemovalTool.cxx.

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

◆ 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 113 of file FPGATrackSimOverlapRemovalTool.cxx.

114 {
115 
116  // Do fast OR instead of requested
117  if (m_doFastOR) return runOverlapRemoval_fast(tracks);
118 
119  // Otherwise, proceed
120  ATH_MSG_DEBUG("Beginning runOverlapRemoval()");
121 
122  ATH_MSG_DEBUG("Tracks in event: " << tracks.size());
123 
125 }

◆ runOverlapRemoval() [2/2]

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

Definition at line 77 of file FPGATrackSimOverlapRemovalTool.cxx.

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

◆ runOverlapRemoval_fast()

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

Definition at line 232 of file FPGATrackSimOverlapRemovalTool.cxx.

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

◆ 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 73 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_FPGATrackSimMapping

ServiceHandle<IFPGATrackSimMappingSvc> FPGATrackSimOverlapRemovalTool::m_FPGATrackSimMapping {this,"FPGATrackSimMappingSvc","FPGATrackSimMappingSvc"}
private

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

int FPGATrackSimOverlapRemovalTool::m_totLayers = 0
private

Definition at line 72 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:54
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
FPGATrackSimOverlapRemovalTool::m_totLayers
int m_totLayers
Definition: FPGATrackSimOverlapRemovalTool.h:72
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_FPGATrackSimMapping
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
Definition: FPGATrackSimOverlapRemovalTool.h:79
FPGATrackSimOverlapRemovalTool::m_algo
ORAlgo m_algo
Definition: FPGATrackSimOverlapRemovalTool.h:73
FPGATrackSimOverlapRemovalTool::compareTrackQuality
static bool compareTrackQuality(const FPGATrackSimTrack &track1, const FPGATrackSimTrack &track2)
Definition: FPGATrackSimOverlapRemovalTool.cxx:201
FPGATrackSimOverlapRemovalTool::runOverlapRemoval_fast
StatusCode runOverlapRemoval_fast(std::vector< FPGATrackSimTrack > &tracks)
Definition: FPGATrackSimOverlapRemovalTool.cxx:232
python.PyAthena.v
v
Definition: PyAthena.py:154
FPGATrackSimOverlapRemovalTool::removeOverlapping
StatusCode removeOverlapping(FPGATrackSimTrack &track1, FPGATrackSimTrack &track2)
Definition: FPGATrackSimOverlapRemovalTool.cxx:128
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