ATLAS Offline Software
Loading...
Searching...
No Matches
InDet::HoleSearchValidation Class Reference

#include <HoleSearchValidation.h>

Inheritance diagram for InDet::HoleSearchValidation:

Classes

struct  Parts

Public Member Functions

 HoleSearchValidation (const std::string &name, ISvcLocator *pSvcLocator)
 Standard Athena-Algorithm Constructor.
 ~HoleSearchValidation ()
 Default Destructor.
StatusCode initialize ()
 standard Athena-Algorithm method
StatusCode execute (const EventContext &ctx) const
 standard Athena-Algorithm method
StatusCode finalize ()
 standard Athena-Algorithm method
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
virtual void setFilterPassed (bool state, const EventContext &ctx) const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
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.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

void printInfoTSoS (const Trk::TrackStateOnSurface *tsos) const
unsigned int doHoleSearch (const Trk::Track *track) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

const AtlasDetectorIDm_idHelper
const PixelIDm_pixelID
const SCT_IDm_sctID
const TRT_IDm_trtID
const SiliconIDm_siliconID
ToolHandle< Trk::ITrackHoleSearchToolm_holeSearchTool
SG::ReadHandleKey< TrackCollectionm_trackCollectionKey
 jobOption: name of the TrackCollection
SG::WriteHandleKey< TrackCollectionm_trackCollectionOutputKey
 jobOption: name of the TrackCollection
bool m_saveNewTracksInSG
 jobOption: save new tracks to SG ?
bool m_removeParts [Parts::kNParts]
bool m_removeOverlapHitsOnly
bool m_ignoreTrackEnds
bool m_randomRemovalMode
unsigned int m_maxNumberOfHoles
ServiceHandle< IAthRNGSvcm_rndmGenSvc
 Random number generator.
std::string m_randomEngineName
 Name of the random number stream.
std::mutex m_trackStatsMutex
std::vector< std::vector< unsigned int > > m_trackStats ATLAS_THREAD_SAFE
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 52 of file HoleSearchValidation.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ HoleSearchValidation()

HoleSearchValidation::HoleSearchValidation ( const std::string & name,
ISvcLocator * pSvcLocator )

Standard Athena-Algorithm Constructor.

Definition at line 30 of file HoleSearchValidation.cxx.

30 :
31 AthReentrantAlgorithm(name, pSvcLocator),
32 m_idHelper(nullptr),
33 m_pixelID(nullptr),
34 m_sctID(nullptr),
35 m_trtID(nullptr),
36 m_siliconID(nullptr),
37 m_holeSearchTool("InDet::InDetTrackHoleSearchTool"),
38 m_trackCollectionKey("Tracks"),
45 m_rndmGenSvc("AthRNGSvc", name),
46 m_randomEngineName("HoleSearchRnd")
47
48{
49 declareProperty("HoleSearchTool" , m_holeSearchTool);
50 declareProperty("TrackCollection" , m_trackCollectionKey, "Name of the reference track collection");
51
52 declareProperty("SaveNewTracksInSG" , m_saveNewTracksInSG , "Boolean: save tracks in SG");
53
54 // for (unsigned int part_i=0; part_i<Parts::kNParts; ++part_i) {
55 // m_removeParts[part_i]=false;
56 // }
57 declareProperty("RemovePIX0" , m_removeParts[Parts::kPix0] , "Remove hit(s) in PIXEL layer 0");
58 declareProperty("RemovePIX1" , m_removeParts[Parts::kPix1] , "Remove hit(s) in PIXEL layer 1");
59 declareProperty("RemovePIX2" , m_removeParts[Parts::kPix2] , "Remove hit(s) in PIXEL layer 2");
60
61 declareProperty("RemoveSCT0" , m_removeParts[Parts::kSct0] , "Remove hit(s) in SCT layer 0");
62 declareProperty("RemoveSCT1" , m_removeParts[Parts::kSct1] , "Remove hit(s) in SCT layer 1");
63 declareProperty("RemoveSCT2" , m_removeParts[Parts::kSct2] , "Remove hit(s) in SCT layer 2");
64 declareProperty("RemoveSCT3" , m_removeParts[Parts::kSct3] , "Remove hit(s) in SCT layer 3");
65
66 declareProperty("RemoveSCT4" , m_removeParts[Parts::kSct4] , "Remove hit(s) in SCT endcap layer 4");
67 declareProperty("RemoveSCT5" , m_removeParts[Parts::kSct5] , "Remove hit(s) in SCT endcap layer 5");
68 declareProperty("RemoveSCT6" , m_removeParts[Parts::kSct6] , "Remove hit(s) in SCT endcap layer 6");
69 declareProperty("RemoveSCT7" , m_removeParts[Parts::kSct7] , "Remove hit(s) in SCT endcap layer 7");
70 declareProperty("RemoveSCT8" , m_removeParts[Parts::kSct8] , "Remove hit(s) in SCT endcap layer 8");
71
72 declareProperty("RemoveSCTSide0" , m_removeParts[Parts::kSctSide0] , "Remove SCT hits on side 0");
73 declareProperty("RemoveSCTSide1" , m_removeParts[Parts::kSctSide1] , "Remove SCT hits on side 1");
74
75 declareProperty("RemoveOverlapHitsOnly" , m_removeOverlapHitsOnly, "Only remove overlap track hits");
76 declareProperty("IgnoreTrackEnds" , m_ignoreTrackEnds , "Ignore hits at the end of the track");
77
78 declareProperty("RandomRemovalMode" , m_randomRemovalMode , "Randomly remove track hits (overwrites the other flags!)");
79 declareProperty("MaximalHoles" , m_maxNumberOfHoles , "Number of maximal holes to be created");
80
82
83 // start with 10x10
84 m_trackStats = std::vector< std::vector< unsigned int> >(0, std::vector< unsigned int>(0));
85}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
SG::WriteHandleKey< TrackCollection > m_trackCollectionOutputKey
jobOption: name of the TrackCollection
ServiceHandle< IAthRNGSvc > m_rndmGenSvc
Random number generator.
std::string m_randomEngineName
Name of the random number stream.
SG::ReadHandleKey< TrackCollection > m_trackCollectionKey
jobOption: name of the TrackCollection
const AtlasDetectorID * m_idHelper
bool m_saveNewTracksInSG
jobOption: save new tracks to SG ?
ToolHandle< Trk::ITrackHoleSearchTool > m_holeSearchTool

◆ ~HoleSearchValidation()

HoleSearchValidation::~HoleSearchValidation ( )
default

Default Destructor.

Member Function Documentation

◆ cardinality()

unsigned int AthCommonReentrantAlgorithm< Gaudi::Algorithm >::cardinality ( ) const
overridevirtualinherited

Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.

Override this to return 0 for reentrant algorithms.

Definition at line 75 of file AthCommonReentrantAlgorithm.cxx.

64{
65 return 0;
66}

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

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

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

Definition at line 95 of file AthCommonDataStore.h.

◆ doHoleSearch()

unsigned int HoleSearchValidation::doHoleSearch ( const Trk::Track * track) const
private

Definition at line 476 of file HoleSearchValidation.cxx.

477{
478 ATH_MSG_VERBOSE( "start hole search for track ( " << track << ")" ) ;
479 unsigned int nHoles(0);
480
481 std::unique_ptr<const Trk::TrackStates> holesOnTrack
482 (m_holeSearchTool->getHolesOnTrack(*track, track->info().particleHypothesis()));
483 // loop over holes
484 if (!holesOnTrack) {
485 ATH_MSG_WARNING( "HoleSearchTool returned NULL !" ) ;
486 return nHoles;
487 } else {
488 nHoles = holesOnTrack->size();
489 ATH_MSG_DEBUG( "found " << nHoles << " holes on track." ) ;
490 for (Trk::TrackStates::const_iterator it=holesOnTrack->begin();
491 it!=holesOnTrack->end(); ++it) {
492 if (!(*it)) {
493 ATH_MSG_WARNING( "TrackStateOnSurface from hole search tool == Null" ) ;
494 continue;
495 }
496 ATH_MSG_DEBUG( "Found hole:" ) ;
497 printInfoTSoS( *it );
498 } // end loop on holes
499 }
500 return nHoles;
501}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
void printInfoTSoS(const Trk::TrackStateOnSurface *tsos) const

◆ evtStore()

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

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

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode HoleSearchValidation::execute ( const EventContext & ctx) const

standard Athena-Algorithm method

Definition at line 151 of file HoleSearchValidation.cxx.

151 {
152
153 ATHRNG::RNGWrapper* wrapper = m_rndmGenSvc->getEngine(this, m_randomEngineName);
154 wrapper->setSeed (this->name(), ctx);
155 CLHEP::HepRandomEngine* engine = wrapper->getEngine (ctx);
156
157 std::array<bool,Parts::kNParts> remove_parts{};
158 for (unsigned int part_i=0; part_i<Parts::kNParts; ++part_i) {
159 remove_parts[part_i]=( !m_randomRemovalMode ? m_removeParts[part_i] : false );
160 }
161 ATH_MSG_VERBOSE( "HoleSearchValidation execute() start" ) ;
162
163 std::unique_ptr<TrackCollection> newTrackCollection( m_saveNewTracksInSG ? std::make_unique<TrackCollection>() : nullptr );
164
165 // get track collection
166 SG::ReadHandle<TrackCollection> tracks(m_trackCollectionKey,ctx);
167 if (!tracks.isValid()) {
168 ATH_MSG_ERROR("Missing input track collection " << m_trackCollectionKey.key());
169 return StatusCode::FAILURE;
170 }
171
172 // loop over tracks
173 TrackCollection::const_iterator trackIterator = tracks->begin();
174 for ( ; trackIterator < tracks->end(); ++trackIterator) {
175 if (!((*trackIterator))) {
176 ATH_MSG_WARNING( "TrackCollection " << m_trackCollectionKey.key() << "contains empty entries" ) ;
177 continue;
178 }
179
180 // get all TSOS
181 const Trk::Track& track = *(*trackIterator);
182 const Trk::TrackStates* tsos = track.trackStateOnSurfaces();
183 ATH_MSG_DEBUG( "Perform hole search on unmodified track (" << *trackIterator << ")"
184 << " which contains " << tsos->size() <<" track states" ) ;
185 // perform hole search
186 unsigned int oldHoles = doHoleSearch( *trackIterator );
187
188 auto vecTsos = std::make_unique<Trk::TrackStates>();
189
190 // loop over TSOS, copy TSOS and push into vector
192 Trk::TrackStates::const_iterator iTsosEnd = tsos->end();
193
194 unsigned int nRemoved = 0;
195
196 std::vector< unsigned int > pixelHitsPerLayer = std::vector< unsigned int>(3);
197 std::vector< unsigned int > sctHitsPerLayer = std::vector< unsigned int>(9);
198
199 // in case of removing the end hits we need to parse the track first once,
200 // variables will be call pl (for preloop)
201 int maxPixelLayerBarrel = -1;
202 int maxPixelLayerEndcap = -1;
203 int maxSctLayerBarrel = -1;
204 int maxSctLayerEndcap = -1;
205
207 ATH_MSG_VERBOSE( "Parsing track first to find end layers and maximal numbers" ) ;
208 for ( ; iTsos != iTsosEnd ; ++iTsos) {
209 //
210 Identifier plSurfaceID;
211 const Trk::MeasurementBase* plMesb = (*iTsos)->measurementOnTrack();
212 if (plMesb && plMesb->associatedSurface().associatedDetectorElement()){
213 plSurfaceID = plMesb->associatedSurface().associatedDetectorElement()->identify();
214 // to find out whether it is barrel / endcap
215 // check pixel / sct
216 if ( m_idHelper->is_pixel( plSurfaceID ) ) {
217 int plLayer = abs(m_pixelID->layer_disk( plSurfaceID ));
218 bool isBarrel = m_pixelID->is_barrel( plSurfaceID );
219 // set the maximal pixel layer: barrel / ec
220 if ( isBarrel )
221 maxPixelLayerBarrel = plLayer > maxPixelLayerBarrel ? plLayer : maxPixelLayerBarrel;
222 else
223 maxPixelLayerEndcap = plLayer > maxPixelLayerEndcap ? plLayer : maxPixelLayerEndcap;
224 } else if (m_idHelper->is_sct( plSurfaceID ) ) {
225 int plLayer = abs(m_sctID->layer_disk( plSurfaceID ));
226 bool isBarrel = m_sctID->is_barrel( plSurfaceID );
227 // set the maximal pixel layer: barrel / ec
228 if ( isBarrel )
229 maxSctLayerBarrel = plLayer > maxSctLayerBarrel ? plLayer : maxSctLayerBarrel;
230 else
231 maxSctLayerEndcap = plLayer > maxSctLayerEndcap ? plLayer : maxSctLayerEndcap;
232 }
233 }
234 }
235 // sct overrules pixels
236 maxPixelLayerBarrel = maxSctLayerBarrel > 0 ? -1 : maxPixelLayerBarrel;
237 maxPixelLayerEndcap = maxSctLayerEndcap > 0 ? -1 : maxPixelLayerEndcap;
238 // reset to start the main loop correctly
239 iTsos = tsos->begin();
240 }
241
242
243 for ( ; iTsos != iTsosEnd ; ++iTsos) {
244 if ((*iTsos)->type(Trk::TrackStateOnSurface::Measurement)) {
245
246 Identifier surfaceID;
247 const Trk::MeasurementBase* mesb = (*iTsos)->measurementOnTrack();
248
249 // also reset the identifiers
250 unsigned int randomHoles = 0;
252 // ---------------------------------------------------------------------------------------
253 randomHoles = (unsigned int)(m_maxNumberOfHoles*CLHEP::RandFlat::shoot(engine));
254 ATH_MSG_VERBOSE("Random mode chosen: will create " << randomHoles << " holes on the track.");
255
256 // max int pixel
257 unsigned int maxPixel = maxPixelLayerBarrel > maxPixelLayerEndcap
258 ? maxPixelLayerBarrel : maxPixelLayerEndcap;
259 // max int sct
260 unsigned int maxSct = maxSctLayerBarrel > maxSctLayerEndcap
261 ? maxSctLayerBarrel : maxSctLayerEndcap;
262 // -------------------------------------------------------------------
263 int maxHit = maxPixel + maxSct;
264 int holesTriggered = 0;
265 maxHit -= m_ignoreTrackEnds ? 1 : 0;
266 // make the switch
267 for (unsigned int ihole = 0; ihole < randomHoles && holesTriggered < int(randomHoles); ++ihole){
268 // throw the dices
269 unsigned int holeId = (unsigned int)(maxHit*CLHEP::RandFlat::shoot(engine));
270 ATH_MSG_VERBOSE( "Random mode : layer identifier " << holeId << " chosen." );
271 {
272 // now switch between --------
273 switch (holeId) {
274 case 0 : { remove_parts[Parts::kPix0] = true; ++holesTriggered; }; break;
275 case 1 : { remove_parts[Parts::kPix1] = true; ++holesTriggered; }; break;
276 case 2 : { remove_parts[Parts::kPix2] = true; ++holesTriggered; }; break;
277 case 3 : { remove_parts[Parts::kSct0] = true; ++holesTriggered; }; break;
278 case 4 : { remove_parts[Parts::kSct1] = true; ++holesTriggered; }; break;
279 case 5 : { remove_parts[Parts::kSct2] = true; ++holesTriggered; }; break;
280 case 6 : { remove_parts[Parts::kSct3] = true; ++holesTriggered; }; break;
281 case 7 : { remove_parts[Parts::kSct4] = true; ++holesTriggered; }; break;
282 case 8 : { remove_parts[Parts::kSct5] = true; ++holesTriggered; }; break;
283 case 9 : { remove_parts[Parts::kSct6] = true; ++holesTriggered; }; break;
284 case 10 : { remove_parts[Parts::kSct7] = true; ++holesTriggered; }; break;
285 case 11 : { remove_parts[Parts::kSct8] = true; ++holesTriggered; }; break;
286 default : break;
287 }
288 // make the side decision on the side
289 if (holeId > 2) {
290 double sideDecision = CLHEP::RandFlat::shoot(engine);
291 if ( sideDecision < 1./3. )
292 remove_parts[Parts::kSctSide0] = true;
293 else if ( sideDecision < 2./3. )
294 remove_parts[Parts::kSctSide1] = true;
295 else {
296 remove_parts[Parts::kSctSide0] = true;
297 remove_parts[Parts::kSctSide1] = true;
298 ++holesTriggered;
299 }
300 }
301 }
302 }
303 }
304
305 // hits, outliers
306 if (mesb != nullptr && mesb->associatedSurface().associatedDetectorElement() != nullptr) {
308 // the pixel case
309 if ( m_idHelper->is_pixel( surfaceID ) ) {
310 int layer = abs(m_pixelID->layer_disk( surfaceID ));
311 // check barrel / ec
312 bool isBarrel = m_pixelID->is_barrel( surfaceID );
313 // indicate how many pixel hits are per layer
314 pixelHitsPerLayer[layer]++;
315 ATH_MSG_VERBOSE( "Pixel hits on layer " << layer << " : " << pixelHitsPerLayer[layer] ) ;
316 // check for last layer
317 bool isLastLayer = (isBarrel && layer == maxPixelLayerBarrel) || (!isBarrel && layer == maxPixelLayerEndcap);
318 // only in the ignore track case
319 if (m_ignoreTrackEnds && isLastLayer){
320 ATH_MSG_VERBOSE( "This pixel hit is not removed, it is at the track end." ) ;
321 } else if ( !m_removeOverlapHitsOnly || pixelHitsPerLayer[layer] > 1) {
322 if ( !m_ignoreTrackEnds && layer == 0 && remove_parts[Parts::kPix0] ) {
323 ATH_MSG_DEBUG( "Removing PIXEL layer 0 hit" ) ;
324 printInfoTSoS( *iTsos );
325 nRemoved++;
326 continue;
327 } else if( layer == 1 && remove_parts[Parts::kPix1] ) {
328 ATH_MSG_DEBUG( "Removing PIXEL layer 1 hit" ) ;
329 printInfoTSoS( *iTsos );
330 nRemoved++;
331 continue;
332 } else if( layer == 2 && remove_parts[Parts::kPix2] ) {
333 ATH_MSG_DEBUG( "Removing PIXEL layer 2 hit" ) ;
334 printInfoTSoS( *iTsos );
335 nRemoved++;
336 continue;
337 }
338 }
339 } else if ( m_idHelper->is_sct( surfaceID ) ) {
340 int layer = abs(m_sctID->layer_disk( surfaceID ));
341 // check barrel / ec
342 bool isBarrel = m_sctID->is_barrel( surfaceID );
343 // counter for number of layers
344 sctHitsPerLayer[layer]++;
345 ATH_MSG_VERBOSE( "SCT hits on layer " << layer << " : " << sctHitsPerLayer[layer] ) ;
346 // steer the side to be removed
347 int side = m_sctID->side( surfaceID );
348 bool canRemoveSide = (side == 0) ? remove_parts[Parts::kSctSide0] : remove_parts[Parts::kSctSide1];
349 // check for last layer
350 bool isLastLayer = (isBarrel && layer == maxSctLayerBarrel) || (!isBarrel && layer == maxSctLayerEndcap);
351 // only in the ignore track case
352 if (m_ignoreTrackEnds && isLastLayer){
353 ATH_MSG_VERBOSE( "This SCT hit is not removed, it is at the track end." ) ;
354 } else if ( layer == 0 && remove_parts[Parts::kSct0] && canRemoveSide ) {
355 ATH_MSG_DEBUG( "Removing SCT layer 0 hit" ) ;
356 printInfoTSoS( *iTsos );
357 nRemoved++;
358 continue;
359 } else if ( layer == 1 && remove_parts[Parts::kSct1] && canRemoveSide ) {
360 ATH_MSG_DEBUG( "Removing SCT layer 1 hit" ) ;
361 printInfoTSoS( *iTsos );
362 nRemoved++;
363 continue;
364 } else if ( layer == 2 && remove_parts[Parts::kSct2] && canRemoveSide ) {
365 ATH_MSG_DEBUG( "Removing SCT layer 2 hit" ) ;
366 printInfoTSoS( *iTsos );
367 nRemoved++;
368 continue;
369 } else if ( layer == 3 && remove_parts[Parts::kSct3] && canRemoveSide ) {
370 ATH_MSG_DEBUG( "Removing SCT layer 3 hit" ) ;
371 printInfoTSoS( *iTsos );
372 nRemoved++;
373 continue;
374 } else if ( layer == 4 && remove_parts[Parts::kSct4] && canRemoveSide ) {
375 ATH_MSG_DEBUG( "Removing SCT endcap layer 4 hit" ) ;
376 printInfoTSoS( *iTsos );
377 nRemoved++;
378 continue;
379 } else if ( layer == 5 && remove_parts[Parts::kSct5] && canRemoveSide ) {
380 ATH_MSG_DEBUG( "Removing SCT endcap layer 5 hit" ) ;
381 printInfoTSoS( *iTsos );
382 nRemoved++;
383 continue;
384 } else if ( layer == 6 && remove_parts[Parts::kSct6] && canRemoveSide ) {
385 ATH_MSG_DEBUG( "Removing SCT endcap layer 6 hit" ) ;
386 printInfoTSoS( *iTsos );
387 nRemoved++;
388 continue;
389 } else if ( layer == 7 && remove_parts[Parts::kSct7] && canRemoveSide ) {
390 ATH_MSG_DEBUG( "Removing SCT endcap layer 7 hit" ) ;
391 printInfoTSoS( *iTsos );
392 nRemoved++;
393 continue;
394 } else if ( layer == 8 && remove_parts[Parts::kSct8] && canRemoveSide ) {
395 ATH_MSG_DEBUG( "Removing SCT endcap layer 8 hit" ) ;
396 printInfoTSoS( *iTsos );
397 nRemoved++;
398 continue;
399 }
400
401 } // end SCT hit
402 } // end have identifier
403 } // end TSoS is of type measurement
404
405 const Trk::TrackStateOnSurface* newTsos = new Trk::TrackStateOnSurface(**iTsos);
406 vecTsos->push_back(newTsos);
407 } // end loop over all TSoS
408
409 ATH_MSG_DEBUG( "Removed total of " << nRemoved << " TSoS on track." ) ;
410
411 Trk::Track* newTrack = new Trk::Track(track.info(), std::move(vecTsos), nullptr );
412 ATH_MSG_VERBOSE( "Perform hole search on new track:" ) ;
413 // perform hole search
414 unsigned int newHoles = doHoleSearch( newTrack );
415 unsigned int foundHoles = abs(static_cast<int>(newHoles) - static_cast<int>(oldHoles));
416
417 if ( foundHoles == nRemoved )
418 ATH_MSG_DEBUG( "== OK : "<< nRemoved <<" generated holes out of which all were found" ) ;
419 else
420 ATH_MSG_DEBUG( "== PROBLEM : "<< nRemoved <<" generated holes out of which "<< newHoles - oldHoles << " were found" ) ;
421
422 // fill track statistics
423 // first, check size of vectors
424 {
425 std::lock_guard<std::mutex> lock(m_trackStatsMutex);
426 while (m_trackStats.size() < nRemoved+1) {
427 m_trackStats.emplace_back(0 );
428 }
429 while (m_trackStats[nRemoved].size() < foundHoles+1) {
430 m_trackStats[nRemoved].push_back( 0 );
431 }
432 ATH_MSG_DEBUG( "m_trackStats.size()= " << m_trackStats.size() );
433 // // increase counter
434 m_trackStats[nRemoved][foundHoles]++;
435 }
436
437 // posibly save new track into container and SG
439 newTrackCollection->push_back( newTrack );
440 } else {
441 delete newTrack; // TSOS are owned by track (so no need to delete them manually)
442 }
443
444 } // end loop over all input tracks
445 ATH_MSG_DEBUG( "Finished looping over all input tracks" ) ;
446
448 SG::WriteHandle<TrackCollection> newTrackCollection_handle(m_trackCollectionOutputKey,ctx);
449 if (newTrackCollection_handle.record( std::move(newTrackCollection) ).isFailure()){
450 ATH_MSG_ERROR("Failed to record output collection " << m_trackCollectionOutputKey.key());
451 return StatusCode::FAILURE;
452 }
453 }
454 return StatusCode::SUCCESS;
455}
#define ATH_MSG_ERROR(x)
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Definition RNGWrapper.h:169
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Definition RNGWrapper.h:134
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
unsigned int doHoleSearch(const Trk::Track *track) const
virtual const Surface & associatedSurface() const =0
Interface method to get the associated Surface.
const TrkDetElementBase * associatedDetectorElement() const
return associated Detector Element
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
virtual Identifier identify() const =0
Identifier.
@ layer
Definition HitInfo.h:79
DataVector< const Trk::TrackStateOnSurface > TrackStates

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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

◆ extraOutputDeps()

const DataObjIDColl & AthCommonReentrantAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 94 of file AthCommonReentrantAlgorithm.cxx.

90{
91 // If we didn't find any symlinks to add, just return the collection
92 // from the base class. Otherwise, return the extended collection.
93 if (!m_extendedExtraObjects.empty()) {
95 }
97}
An algorithm that can be simultaneously executed in multiple threads.

◆ filterPassed()

virtual bool AthCommonReentrantAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Definition at line 96 of file AthCommonReentrantAlgorithm.h.

96 {
97 return execState( ctx ).filterPassed();
98 }
virtual bool filterPassed(const EventContext &ctx) const

◆ finalize()

StatusCode HoleSearchValidation::finalize ( )

standard Athena-Algorithm method

Definition at line 457 of file HoleSearchValidation.cxx.

457 {
458 ATH_MSG_INFO( "HoleSearchValidation finalize()" ) ;
459
460 ATH_MSG_INFO( "Printing statistics for hole search validation:" ) ;
461 ATH_MSG_INFO( " # removed hits | # tracks / found holes | ... " ) ;
462 for ( unsigned int nRemoved = 0; nRemoved < m_trackStats.size(); ++nRemoved) {
463 unsigned int nTracks = 0;
464 for ( unsigned int holes = 0; holes < m_trackStats[nRemoved].size(); ++holes) nTracks += m_trackStats[nRemoved][holes];
465 if ( nTracks == 0) continue;
466 ATH_MSG_INFO( "Removed " << nRemoved << " hits from track -- found: " ) ;
467 for ( unsigned int holes = 0; holes < m_trackStats[nRemoved].size(); ++holes) {
468 ATH_MSG_INFO( " -- " << 100.0 * m_trackStats[nRemoved][holes]/float(nTracks)
469 << "% of tracks with " << holes << " holes (" << m_trackStats[nRemoved][holes] << " / " << float(nTracks) << ")") ;
470 }
471 }
472
473 return StatusCode::SUCCESS;
474}
#define ATH_MSG_INFO(x)

◆ initialize()

StatusCode HoleSearchValidation::initialize ( )

standard Athena-Algorithm method

Definition at line 89 of file HoleSearchValidation.cxx.

89 {
90 ATH_MSG_INFO( "HoleSearchValidation initialize()" ) ;
91
92 //ID Helper
93 StatusCode sc = detStore()->retrieve(m_idHelper, "AtlasID" );
94 if (sc.isFailure()) {
95 ATH_MSG_WARNING( "Could not get AtlasDetectorID !" ) ;
96 return StatusCode::SUCCESS;
97 }else{
98 ATH_MSG_DEBUG( "Found AtlasDetectorID" ) ;
99 }
100
101 sc = detStore()->retrieve(m_pixelID, "PixelID");
102 if (sc.isFailure()) {
103 ATH_MSG_WARNING( "Could not get Pixel ID helper !" ) ;
104 return StatusCode::SUCCESS;
105 }
106 ATH_MSG_DEBUG( "Initialized PixelIDHelper" ) ;
107
108 sc = detStore()->retrieve(m_sctID, "SCT_ID");
109 if (sc.isFailure()) {
110 ATH_MSG_WARNING( "Could not get SCT ID helper !" ) ;
111 return StatusCode::SUCCESS;
112 }
113 ATH_MSG_DEBUG( "Initialized SCTIDHelper" ) ;
114
115 sc = detStore()->retrieve(m_trtID, "TRT_ID");
116 if (sc.isFailure()) {
117 ATH_MSG_WARNING( "Could not get TRT ID helper !" ) ;
118 return StatusCode::SUCCESS;
119 }
120 ATH_MSG_DEBUG( "Initialized TRTIDHelper" ) ;
121
122 sc = detStore()->retrieve(m_siliconID, "SiliconID");
123 if (sc.isFailure()) {
124 ATH_MSG_WARNING( "Could not get Silicon ID helper !" ) ;
125 return StatusCode::SUCCESS;
126 }
127 ATH_MSG_DEBUG( "Initialized SiliconIDHelper" ) ;
128
129
130 // Get HoleSearchTool
131 sc = m_holeSearchTool.retrieve();
132 if (sc.isFailure()) {
133 ATH_MSG_FATAL( "Could not retrieve "<< m_holeSearchTool ) ;
134 return sc;
135 }
136
137 if ( m_rndmGenSvc.retrieve().isFailure() ){
138 ATH_MSG_FATAL( "Could not retrieve " << m_rndmGenSvc );
139 return StatusCode::FAILURE;
140 }
141
142 ATH_CHECK(m_trackCollectionKey.initialize());
144 m_trackCollectionOutputKey = m_trackCollectionKey.key() + "_removedHits";
146 }
147
148 return StatusCode::SUCCESS;
149}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
static Double_t sc
const ServiceHandle< StoreGateSvc > & detStore() const
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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.

◆ isClonable()

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::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< Gaudi::Algorithm > >::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.

◆ printInfoTSoS()

void HoleSearchValidation::printInfoTSoS ( const Trk::TrackStateOnSurface * tsos) const
private

Definition at line 504 of file HoleSearchValidation.cxx.

505{
506
507 ATH_MSG_VERBOSE( "Position : " << tsos->trackParameters()->position()
508 << " with R = " << sqrt(pow(tsos->trackParameters()->position().x(),2)
509 +pow(tsos->trackParameters()->position().y(),2)) );
510 Identifier surfaceID;
511 const Trk::MeasurementBase* mesb = tsos->measurementOnTrack();
512 // hits, outliers
513 if (mesb != nullptr && mesb->associatedSurface().associatedDetectorElement() != nullptr) {
515 if ( m_siliconID->is_barrel( surfaceID ) ) {
516 ATH_MSG_VERBOSE( " -- Barrel:");
517 } else {
518 ATH_MSG_VERBOSE( " -- Endcap:");
519 }
520 if ( m_idHelper->is_sct( surfaceID ) ) {
521 ATH_MSG_VERBOSE( " -> SCT layer = " << m_sctID->layer_disk( surfaceID )
522 << " side = " << m_sctID->side( surfaceID ) );
523 //ATH_MSG_VERBOSE( m_sctID->show_to_string(surfaceID) ) ;
524
525 }
526 if ( m_idHelper->is_pixel( surfaceID ) ) {
527 ATH_MSG_VERBOSE( " -> PIXEL layer = " << m_pixelID->layer_disk( surfaceID ) );
528 //ATH_MSG_VERBOSE( m_pixelID->show_to_string(surfaceID) ) ;
529 }
530 }
531
532}
constexpr int pow(int base, int exp) noexcept
const Amg::Vector3D & position() const
Access method for the position.
const MeasurementBase * measurementOnTrack() const
returns MeasurementBase const overload
const TrackParameters * trackParameters() const
return ptr to trackparameters const overload

◆ 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< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
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)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed()

virtual void AthCommonReentrantAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Definition at line 100 of file AthCommonReentrantAlgorithm.h.

100 {
102 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const

◆ sysExecute()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Definition at line 85 of file AthCommonReentrantAlgorithm.cxx.

77{
78 return BaseAlg::sysExecute (ctx);
79}

◆ sysInitialize()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in HypoBase, and InputMakerBase.

Definition at line 61 of file AthCommonReentrantAlgorithm.cxx.

107 {
109
110 if (sc.isFailure()) {
111 return sc;
112 }
113
114 ServiceHandle<ICondSvc> cs("CondSvc",name());
115 for (auto h : outputHandles()) {
116 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
117 // do this inside the loop so we don't create the CondSvc until needed
118 if ( cs.retrieve().isFailure() ) {
119 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
120 return StatusCode::SUCCESS;
121 }
122 if (cs->regHandle(this,*h).isFailure()) {
124 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
125 << " with CondSvc");
126 }
127 }
128 }
129 return sc;
130}
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::vector< std::vector< unsigned int > > m_trackStats InDet::HoleSearchValidation::ATLAS_THREAD_SAFE
mutableprivate

tracks as function of [#generated holes, #found holes]. Guarded by m_trackStatsMutex

Definition at line 118 of file HoleSearchValidation.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonReentrantAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 114 of file AthCommonReentrantAlgorithm.h.

◆ m_holeSearchTool

ToolHandle<Trk::ITrackHoleSearchTool> InDet::HoleSearchValidation::m_holeSearchTool
private

Definition at line 77 of file HoleSearchValidation.h.

◆ m_idHelper

const AtlasDetectorID* InDet::HoleSearchValidation::m_idHelper
private

Definition at line 71 of file HoleSearchValidation.h.

◆ m_ignoreTrackEnds

bool InDet::HoleSearchValidation::m_ignoreTrackEnds
private

Definition at line 108 of file HoleSearchValidation.h.

◆ m_maxNumberOfHoles

unsigned int InDet::HoleSearchValidation::m_maxNumberOfHoles
private

Definition at line 111 of file HoleSearchValidation.h.

◆ m_pixelID

const PixelID* InDet::HoleSearchValidation::m_pixelID
private

Definition at line 72 of file HoleSearchValidation.h.

◆ m_randomEngineName

std::string InDet::HoleSearchValidation::m_randomEngineName
private

Name of the random number stream.

Definition at line 114 of file HoleSearchValidation.h.

◆ m_randomRemovalMode

bool InDet::HoleSearchValidation::m_randomRemovalMode
private

Definition at line 110 of file HoleSearchValidation.h.

◆ m_removeOverlapHitsOnly

bool InDet::HoleSearchValidation::m_removeOverlapHitsOnly
private

Definition at line 107 of file HoleSearchValidation.h.

◆ m_removeParts

bool InDet::HoleSearchValidation::m_removeParts[Parts::kNParts]
private

Definition at line 106 of file HoleSearchValidation.h.

◆ m_rndmGenSvc

ServiceHandle<IAthRNGSvc> InDet::HoleSearchValidation::m_rndmGenSvc
private

Random number generator.

Definition at line 113 of file HoleSearchValidation.h.

◆ m_saveNewTracksInSG

bool InDet::HoleSearchValidation::m_saveNewTracksInSG
private

jobOption: save new tracks to SG ?

Definition at line 82 of file HoleSearchValidation.h.

◆ m_sctID

const SCT_ID* InDet::HoleSearchValidation::m_sctID
private

Definition at line 73 of file HoleSearchValidation.h.

◆ m_siliconID

const SiliconID* InDet::HoleSearchValidation::m_siliconID
private

Definition at line 75 of file HoleSearchValidation.h.

◆ m_trackCollectionKey

SG::ReadHandleKey<TrackCollection> InDet::HoleSearchValidation::m_trackCollectionKey
private

jobOption: name of the TrackCollection

Definition at line 78 of file HoleSearchValidation.h.

◆ m_trackCollectionOutputKey

SG::WriteHandleKey<TrackCollection> InDet::HoleSearchValidation::m_trackCollectionOutputKey
private

jobOption: name of the TrackCollection

Definition at line 79 of file HoleSearchValidation.h.

◆ m_trackStatsMutex

std::mutex InDet::HoleSearchValidation::m_trackStatsMutex
mutableprivate

Definition at line 117 of file HoleSearchValidation.h.

◆ m_trtID

const TRT_ID* InDet::HoleSearchValidation::m_trtID
private

Definition at line 74 of file HoleSearchValidation.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: