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

#include <TrackSelectionProcessorTool.h>

Inheritance diagram for Trk::TrackSelectionProcessorTool:
Collaboration diagram for Trk::TrackSelectionProcessorTool:

Public Types

typedef std::multimap< TrackScore, TrackPtrTrackScoreMap
 
typedef std::set< const PrepRawData * > PrdSignature
 
typedef std::set< PrdSignaturePrdSignatureSet
 

Public Member Functions

 TrackSelectionProcessorTool (const std::string &, const std::string &, const IInterface *)
 
virtual ~TrackSelectionProcessorTool ()
 
virtual StatusCode initialize () override
 
virtual StatusCode finalize () override
 
virtual const TrackCollectionprocess (const TrackCollection *tracksCol, Trk::PRDtoTrackMap *prdToTrackMap) const override
 Returns a processed TrackCollection from the passed 'tracks' WITHOUT copying or refitting the input tracks. More...
 
virtual const TrackCollectionprocess (const TracksScores *) const override
 
void statistics () override
 statistics output to be called by algorithm during finalize. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode 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 ()
 

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

void addNewTracks (TrackScoreMap &trackScoreTrackMap, Trk::PRDtoTrackMap &prdToTrackMap, const std::vector< const Track * > &tracks) const
 Add passed TrackCollection, and Trk::PrepRawData from tracks to caches. More...
 
void solveTracks (TrackScoreMap &trackScoreTrackMap, Trk::PRDtoTrackMap &prdToTrackMap, ConstDataVector< TrackCollection > &final_tracks) const
 
void dumpTracks (const TrackCollection &tracks) const
 print out tracks and their scores for debugging More...
 
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

bool m_dropDouble
 by default drop double tracks before refit More...
 
ToolHandle< ITrackScoringToolm_scoringTool
 Scoring tool This tool is used to 'score' the tracks, i.e. More...
 
ToolHandle< IAmbiTrackSelectionToolm_selectionTool
 selection tool - here the decision which hits remain on a track and which are removed are made More...
 
ToolHandle< Trk::IPRDtoTrackMapToolm_assoTool
 
SG::ReadHandleKey< Trk::PRDtoTrackMapm_assoMapName
 key for the PRDtoTrackMap to filled by the ambiguity score processor. More...
 
SG::ReadHandleKey< Trk::ClusterSplitProbabilityContainerm_clusterSplitProbContainerIn
 
SG::WriteHandleKey< Trk::ClusterSplitProbabilityContainerm_clusterSplitProbContainerOut
 
bool m_disableSorting
 option to disable sorting based on track score and use the ordering provided externally More...
 
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 35 of file TrackSelectionProcessorTool.h.

Member Typedef Documentation

◆ PrdSignature

Definition at line 42 of file TrackSelectionProcessorTool.h.

◆ PrdSignatureSet

Definition at line 43 of file TrackSelectionProcessorTool.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

◆ TrackScoreMap

Definition at line 40 of file TrackSelectionProcessorTool.h.

Constructor & Destructor Documentation

◆ TrackSelectionProcessorTool()

Trk::TrackSelectionProcessorTool::TrackSelectionProcessorTool ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Definition at line 14 of file TrackSelectionProcessorTool.cxx.

17  :
18  AthAlgTool(t,n,p),
19  m_scoringTool("Trk::TrackScoringTool/TrackScoringTool"),
20  m_selectionTool("InDet::InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool")
21 {
22  declareInterface<ITrackAmbiguityProcessorTool>(this);
23  declareProperty("DropDouble" , m_dropDouble = true);
24  declareProperty("ScoringTool" , m_scoringTool);
25  declareProperty("SelectionTool" , m_selectionTool);
26  declareProperty("DisableSorting" , m_disableSorting = false);
27 }

◆ ~TrackSelectionProcessorTool()

Trk::TrackSelectionProcessorTool::~TrackSelectionProcessorTool ( )
virtualdefault

Member Function Documentation

◆ addNewTracks()

void Trk::TrackSelectionProcessorTool::addNewTracks ( TrackScoreMap trackScoreTrackMap,
Trk::PRDtoTrackMap prdToTrackMap,
const std::vector< const Track * > &  tracks 
) const
private

Add passed TrackCollection, and Trk::PrepRawData from tracks to caches.

Parameters
tracksthe TrackCollection is looped over, and each Trk::Track is added to the various caches. The Trk::PrepRawData from each Trk::Track are added to the IPRD_AssociationTool

Definition at line 103 of file TrackSelectionProcessorTool.cxx.

105  {
106  ATH_MSG_DEBUG ("Number of tracks at Input: "<<tracks.size());
107  PrdSignatureSet prdSigSet;
108  TrackScore itrack=0;
109  for (const Track*a_track : tracks ) {
110  if(m_disableSorting) {
111  // add track to map using ordering provided by the collection
112  trackScoreTrackMap.insert( std::make_pair(itrack, TrackPtr(a_track)) );
113  itrack++;
114  continue;
115  }
116  bool reject = false;
117  TrackScore score = m_scoringTool->score( *a_track );
118  // veto tracks with score 0
119  if (score==0) {
120  ATH_MSG_DEBUG ("Track score is zero, reject it");
121  reject = true;
122  } else {
123  if (m_dropDouble) {
124  const std::vector<const Trk::PrepRawData*> & prds = m_assoTool->getPrdsOnTrack(prdToTrackMap, *a_track);
125  // unfortunately PrepRawDataSet is not a set !
126  PrdSignature prdSig;
127  prdSig.insert( prds.begin(),prds.end() );
128  // we try to insert it into the set, if we fail (pair.second), it then exits already
129  if ( !(prdSigSet.insert(prdSig)).second ) {
130  ATH_MSG_DEBUG ("Double track, reject it !");
131  reject = true;
132  } else {
133  ATH_MSG_DEBUG ("Insert new track in PrdSignatureSet");
134  }
135  }
136  }
137  if (!reject) {
138  // add track to map, map is sorted small to big ! set if fitted
139  ATH_MSG_VERBOSE ("Track ("<< a_track <<") has score "<<score);
140  trackScoreTrackMap.insert( std::make_pair(-score, TrackPtr(a_track) ) );
141  }
142  }
143  ATH_MSG_DEBUG ("Number of tracks in map:"<<trackScoreTrackMap.size());
144 }

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

◆ dumpTracks()

void Trk::TrackSelectionProcessorTool::dumpTracks ( const TrackCollection tracks) const
private

print out tracks and their scores for debugging

Definition at line 214 of file TrackSelectionProcessorTool.cxx.

214  {
215  ATH_MSG_VERBOSE ("Dumping tracks in collection");
216  int num=0;
217  TrackScore totalScore = 0;
218  TrackCollection::const_iterator it = tracks.begin();
219  TrackCollection::const_iterator itEnd = tracks.end();
220  for (; it != itEnd ; ++it){
221  // score track:
222  const TrackScore score = m_scoringTool->score( **it );
223  ATH_MSG_VERBOSE (num++<<"\tTrack :"<<*it<<"\tScore: "<<score);
224  totalScore+=score;
225  }
226  ATH_MSG_DEBUG ("Total event score : "<<totalScore);
227 }

◆ 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

◆ finalize()

StatusCode Trk::TrackSelectionProcessorTool::finalize ( )
overridevirtual

Definition at line 54 of file TrackSelectionProcessorTool.cxx.

54  {
56  return sc;
57 }

◆ initialize()

StatusCode Trk::TrackSelectionProcessorTool::initialize ( )
overridevirtual

Definition at line 34 of file TrackSelectionProcessorTool.cxx.

34  {
36  if (sc.isFailure()) {
37  ATH_MSG_FATAL( "AlgTool::initialise failed" );
38  return StatusCode::FAILURE;
39  }
41  ATH_CHECK( m_assoTool.retrieve() );
42  ATH_CHECK( m_scoringTool.retrieve());
43  ATH_CHECK(m_selectionTool.retrieve());
44 
47 
48  if (m_disableSorting) ATH_MSG_DEBUG( "Internal sorting disabled, using external ordering!" );
49  return sc;
50 }

◆ 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()

const InterfaceID & Trk::ITrackAmbiguityProcessorTool::interfaceID ( )
inlinestaticinherited

Definition at line 52 of file ITrackAmbiguityProcessorTool.h.

53 {
54  return IID_ITrackAmbiguityProcessorTool;
55 }

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

◆ process() [1/2]

const TrackCollection * Trk::TrackSelectionProcessorTool::process ( const TrackCollection tracksCol,
Trk::PRDtoTrackMap pPrdToTrackMap 
) const
overridevirtual

Returns a processed TrackCollection from the passed 'tracks' WITHOUT copying or refitting the input tracks.

Do actual processing of event.

The pointers of the tracks in the input collection are copied into the output collection which does NOT own the pointers. Clients must ensure that the Input Collection is not deleted before the output collection else all pointers in the output collection will be invalid!

Parameters
trackscollection of tracks which will have ambiguities resolved. Will not be modified.
prdToTrackMapon optional prd-to-track map being filled by the processor.
Returns
new collections of tracks, with ambiguities resolved. The returned track collection is a SG::VIEW_ELEMENTS container, meaning that it should NOT be written to disk. Ownership of the collection is passed on (i.e. client handles deletion)
  If no prd-to-track map is given the processor might create one internally
(for internal use only, or exported to storegate).

Takes a track container, and then returns the tracks which have been selected

Implements Trk::ITrackAmbiguityProcessorTool.

Definition at line 65 of file TrackSelectionProcessorTool.cxx.

66  {
67  //TODO: make sure the ownership; delete origin tracks from map?
68  std::vector<const Track*> tracks;
69  tracks.reserve(tracksCol->size());
70  for(const auto *e: *tracksCol){
71  tracks.push_back(e);
72  }
73  ATH_MSG_DEBUG ("Processing "<<tracks.size()<<" tracks");
74  std::unique_ptr<Trk::PRDtoTrackMap> tmpPrdToTrackMap;
75  if (!pPrdToTrackMap) {
76  tmpPrdToTrackMap = m_assoTool->createPRDtoTrackMap();
77  if (!m_assoMapName.key().empty()) {
79  if (!inputPrdMap.isValid()) {
80  ATH_MSG_ERROR("Failed to retrieve prd to track map " << m_assoMapName.key() );
81  } else {
82  *tmpPrdToTrackMap = *inputPrdMap;
83  }
84  }
85  pPrdToTrackMap = tmpPrdToTrackMap.get();
86  }
87  TrackScoreMap trackScoreTrackMap;
88  //put tracks into maps etc
89  addNewTracks(trackScoreTrackMap,*pPrdToTrackMap, tracks);
90  // going to do simple algorithm for now:
91  // - take track with highest score
92  // - remove shared hits from all other tracks
93  // - take next highest scoring tracks, and repeat
94  std::unique_ptr<ConstDataVector<TrackCollection> > result(std::make_unique<ConstDataVector<TrackCollection> >(SG::VIEW_ELEMENTS)); //TODO, old or new
95  solveTracks(trackScoreTrackMap, *pPrdToTrackMap, *result);
96  if (msgLvl(MSG::DEBUG)) dumpTracks(*result->asDataVector());
97  return result.release()->asDataVector();
98 }

◆ process() [2/2]

virtual const TrackCollection* Trk::TrackSelectionProcessorTool::process ( const TracksScores ) const
inlineoverridevirtual

Implements Trk::ITrackAmbiguityProcessorTool.

Definition at line 76 of file TrackSelectionProcessorTool.h.

77  {
78  return nullptr;
79  }

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

◆ solveTracks()

void Trk::TrackSelectionProcessorTool::solveTracks ( TrackScoreMap trackScoreTrackMap,
Trk::PRDtoTrackMap prdToTrackMap,
ConstDataVector< TrackCollection > &  final_tracks 
) const
private

Definition at line 147 of file TrackSelectionProcessorTool.cxx.

150 {
151  using namespace std;
152 
153  const EventContext& ctx = Gaudi::Hive::currentContext();
155  if (!m_clusterSplitProbContainerIn.key().empty()) {
156  splitProbContainerIn = SG::ReadHandle( m_clusterSplitProbContainerIn, ctx);
157  if (!splitProbContainerIn.isValid()) {
158  ATH_MSG_ERROR( "Failed to get input cluster split probability container " << m_clusterSplitProbContainerIn.key());
159  }
160  }
161  std::unique_ptr<Trk::ClusterSplitProbabilityContainer> splitProbContainerCleanup(!m_clusterSplitProbContainerIn.key().empty()
162  ? std::make_unique<ClusterSplitProbabilityContainer>(*splitProbContainerIn)
163  : std::make_unique<ClusterSplitProbabilityContainer>());
165  Trk::ClusterSplitProbabilityContainer *splitProbContainer;
166  if (!m_clusterSplitProbContainerOut.key().empty()) {
168  if (splitProbContainerHandle.record(std::move(splitProbContainerCleanup)).isFailure()) {
169  ATH_MSG_FATAL( "Failed to record output cluster split probability container " << m_clusterSplitProbContainerOut.key());
170  }
171  splitProbContainer=splitProbContainerHandle.ptr();
172  }
173  else {
174  splitProbContainer=splitProbContainerCleanup.get();
175  }
176 
177  ATH_MSG_VERBOSE ("Starting to solve tracks");
178  // now loop as long as map is not empty
179  while ( !trackScoreTrackMap.empty() ) {
180  TrackScoreMap::iterator itnext = trackScoreTrackMap.begin();
181  TrackPtr atrack( std::move(itnext->second) );
182  TrackScore ascore( itnext->first);
183  trackScoreTrackMap.erase(itnext);
184  ATH_MSG_VERBOSE ("--- Trying next track "<<atrack.track()<<"\t with score "<<-ascore);
185  std::unique_ptr<Trk::Track> cleanedTrack;
186  const auto &[cleanedTrack_tmp, keepOriginal] = m_selectionTool->getCleanedOutTrack( atrack.track() , -(ascore), *splitProbContainer, prdToTrackMap, -1, -1);
187  cleanedTrack.reset(cleanedTrack_tmp);
188  if (keepOriginal ){
189  // track can be kept as identical to the input track
190  ATH_MSG_DEBUG ("Accepted track "<<atrack.track()<<"\t has score "<<-(ascore));
191  // add track to PRD_AssociationTool
192  StatusCode sc = m_assoTool->addPRDs(prdToTrackMap,*atrack);
193  if (sc.isFailure()) ATH_MSG_ERROR( "addPRDs() failed" );
194  // add to output list
195  result.push_back( atrack.track() );
196 
197  } else if ( !cleanedTrack ) {
198  // track should be discarded
199  ATH_MSG_DEBUG ("Track "<< atrack.track() << " doesn't meet the cuts of the AmbiTrack Selection tool");
200  } else {
201  // delete cleaned track
202  cleanedTrack.reset();
203  // stripped down version cannot be handled discarding
204  ATH_MSG_DEBUG("Selection tool returned a new track, cannot handle memory management of new track, deleting it. Check you configuration ");
205  }
206  // don't forget to drop track from map
207  }
208  ATH_MSG_DEBUG ("Finished, number of track on output: "<<result.size());
209 }

◆ statistics()

void Trk::TrackSelectionProcessorTool::statistics ( )
inlineoverridevirtual

statistics output to be called by algorithm during finalize.

Implements Trk::ITrackAmbiguityProcessorTool.

Definition at line 82 of file TrackSelectionProcessorTool.h.

82 {}

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

SG::ReadHandleKey<Trk::PRDtoTrackMap> Trk::TrackSelectionProcessorTool::m_assoMapName
private
Initial value:
{
this, "AssociationMapName",
""}

key for the PRDtoTrackMap to filled by the ambiguity score processor.

the key given to the newly created association map

Definition at line 120 of file TrackSelectionProcessorTool.h.

◆ m_assoTool

ToolHandle<Trk::IPRDtoTrackMapTool> Trk::TrackSelectionProcessorTool::m_assoTool
private
Initial value:
{this, "AssociationTool",
"Trk::PRDtoTrackMapTool"}

Definition at line 116 of file TrackSelectionProcessorTool.h.

◆ m_clusterSplitProbContainerIn

SG::ReadHandleKey<Trk::ClusterSplitProbabilityContainer> Trk::TrackSelectionProcessorTool::m_clusterSplitProbContainerIn
private
Initial value:
{this, "InputClusterSplitProbabilityName",
"", ""}

Definition at line 125 of file TrackSelectionProcessorTool.h.

◆ m_clusterSplitProbContainerOut

SG::WriteHandleKey<Trk::ClusterSplitProbabilityContainer> Trk::TrackSelectionProcessorTool::m_clusterSplitProbContainerOut
private
Initial value:
{
this, "OutputClusterSplitProbabilityName", "", ""}

Definition at line 128 of file TrackSelectionProcessorTool.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_disableSorting

bool Trk::TrackSelectionProcessorTool::m_disableSorting
private

option to disable sorting based on track score and use the ordering provided externally

Definition at line 133 of file TrackSelectionProcessorTool.h.

◆ m_dropDouble

bool Trk::TrackSelectionProcessorTool::m_dropDouble
private

by default drop double tracks before refit

Definition at line 104 of file TrackSelectionProcessorTool.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_scoringTool

ToolHandle<ITrackScoringTool> Trk::TrackSelectionProcessorTool::m_scoringTool
private

Scoring tool This tool is used to 'score' the tracks, i.e.

to quantify what a good track is.

Todo:
The actual tool that is used should be configured through job options

Definition at line 109 of file TrackSelectionProcessorTool.h.

◆ m_selectionTool

ToolHandle<IAmbiTrackSelectionTool> Trk::TrackSelectionProcessorTool::m_selectionTool
private

selection tool - here the decision which hits remain on a track and which are removed are made

Definition at line 114 of file TrackSelectionProcessorTool.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:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Trk::TrackSelectionProcessorTool::m_selectionTool
ToolHandle< IAmbiTrackSelectionTool > m_selectionTool
selection tool - here the decision which hits remain on a track and which are removed are made
Definition: TrackSelectionProcessorTool.h:114
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:53
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
get_generator_info.result
result
Definition: get_generator_info.py:21
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
Trk::TrackSelectionProcessorTool::TrackScoreMap
std::multimap< TrackScore, TrackPtr > TrackScoreMap
Definition: TrackSelectionProcessorTool.h:40
Trk::TrackSelectionProcessorTool::m_disableSorting
bool m_disableSorting
option to disable sorting based on track score and use the ordering provided externally
Definition: TrackSelectionProcessorTool.h:133
Trk::TrackSelectionProcessorTool::PrdSignature
std::set< const PrepRawData * > PrdSignature
Definition: TrackSelectionProcessorTool.h:42
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
Trk::TrackSelectionProcessorTool::m_dropDouble
bool m_dropDouble
by default drop double tracks before refit
Definition: TrackSelectionProcessorTool.h:104
SG::ReadHandle< Trk::PRDtoTrackMap >
Trk::TrackSelectionProcessorTool::PrdSignatureSet
std::set< PrdSignature > PrdSignatureSet
Definition: TrackSelectionProcessorTool.h:43
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
initialize
void initialize()
Definition: run_EoverP.cxx:894
Trk::TrackSelectionProcessorTool::m_assoTool
ToolHandle< Trk::IPRDtoTrackMapTool > m_assoTool
Definition: TrackSelectionProcessorTool.h:116
skel.it
it
Definition: skel.GENtoEVGEN.py:423
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
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Trk::TrackSelectionProcessorTool::dumpTracks
void dumpTracks(const TrackCollection &tracks) const
print out tracks and their scores for debugging
Definition: TrackSelectionProcessorTool.cxx:214
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Trk::TrackScore
float TrackScore
Definition: TrackScore.h:10
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Trk::TrackSelectionProcessorTool::m_scoringTool
ToolHandle< ITrackScoringTool > m_scoringTool
Scoring tool This tool is used to 'score' the tracks, i.e.
Definition: TrackSelectionProcessorTool.h:109
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
Trk::TrackSelectionProcessorTool::m_clusterSplitProbContainerOut
SG::WriteHandleKey< Trk::ClusterSplitProbabilityContainer > m_clusterSplitProbContainerOut
Definition: TrackSelectionProcessorTool.h:128
Trk::TrackSelectionProcessorTool::m_clusterSplitProbContainerIn
SG::ReadHandleKey< Trk::ClusterSplitProbabilityContainer > m_clusterSplitProbContainerIn
Definition: TrackSelectionProcessorTool.h:125
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
Trk::ClusterSplitProbabilityContainer
Container to associate Cluster with cluster splitting probabilities.
Definition: ClusterSplitProbabilityContainer.h:17
xAOD::score
@ score
Definition: TrackingPrimitives.h:513
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
a
TList * a
Definition: liststreamerinfos.cxx:10
h
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Trk::TrackSelectionProcessorTool::m_assoMapName
SG::ReadHandleKey< Trk::PRDtoTrackMap > m_assoMapName
key for the PRDtoTrackMap to filled by the ambiguity score processor.
Definition: TrackSelectionProcessorTool.h:120
ConstDataVector
DataVector adapter that acts like it holds const pointers.
Definition: ConstDataVector.h:76
DEBUG
#define DEBUG
Definition: page_access.h:11
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
Track
Definition: TriggerChamberClusterOnTrackCreator.h:21
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
Trk::TrackSelectionProcessorTool::solveTracks
void solveTracks(TrackScoreMap &trackScoreTrackMap, Trk::PRDtoTrackMap &prdToTrackMap, ConstDataVector< TrackCollection > &final_tracks) const
Definition: TrackSelectionProcessorTool.cxx:147
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
Trk::TrackSelectionProcessorTool::addNewTracks
void addNewTracks(TrackScoreMap &trackScoreTrackMap, Trk::PRDtoTrackMap &prdToTrackMap, const std::vector< const Track * > &tracks) const
Add passed TrackCollection, and Trk::PrepRawData from tracks to caches.
Definition: TrackSelectionProcessorTool.cxx:103
CP::TrackPtr
SortedObjPtr< xAOD::TrackParticle > TrackPtr
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:70
fitman.k
k
Definition: fitman.py:528