ATLAS Offline Software
Loading...
Searching...
No Matches
ThinInDetClustersAlg Class Referencefinal

#include <ThinInDetClustersAlg.h>

Inheritance diagram for ThinInDetClustersAlg:
Collaboration diagram for ThinInDetClustersAlg:

Public Member Functions

 ThinInDetClustersAlg (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor with parameters:
virtual ~ThinInDetClustersAlg ()=default
 Destructor:
virtual StatusCode initialize () override
 Athena algorithm's initalize hook.
virtual StatusCode execute (const EventContext &ctx) const override
 Athena algorithm's execute hook.
virtual StatusCode finalize () override
 Athena algorithm's finalize hook.
StatusCode initializeParser (const ExpressionParsing::SelectionArg< 1 > &selection_string)
StatusCode finalizeParser ()
virtual bool updateDataNeeds (const std::vector< const DataObjID * > &input_data_in, const std::vector< const DataObjID * > &output_data_in, std::vector< Gaudi::DataHandle * > &new_input_handles, std::vector< Gaudi::DataHandle * > &new_output_handles) override
 Inform a dynamic data consumer about all consumed or produced data.
virtual bool renounceInput (const DataObjID &output_data_id) override
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

StatusCode _initializeParser (const ExpressionParsing::SelectionArg< 1 > &selection_string, ExpressionParsing::AppendLoaderFunc pre_xaod_loader=ExpressionParsing::NoLoaderFunc, ExpressionParsing::AppendLoaderFunc post_xaod_loader=ExpressionParsing::NoLoaderFunc)
StatusCode _initializeParser (const ExpressionParsing::SelectionArg< NUM_PARSER > &selection_string, ExpressionParsing::AppendLoaderFunc pre_xaod_loader=ExpressionParsing::NoLoaderFunc, ExpressionParsing::AppendLoaderFunc post_xaod_loader=ExpressionParsing::NoLoaderFunc)
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.

Protected Attributes

ExpressionParsing::SGxAODProxyLoaderm_xAODProxyLoader
 The expression parser.
std::unique_ptr< ExpressionParsing::IProxyLoaderm_proxyLoaders
std::conditional< 1==1, std::unique_ptr< ExpressionParsing::ExpressionParser >, std::array< std::unique_ptr< ExpressionParsing::ExpressionParser >, 1 > >::type m_parser
std::vector< std::string > m_renounce

Private Types

enum  MeasurementType {
  TrkState_unidentified = 0 , TrkState_Pixel = 1 , TrkState_SCT = 2 , TrkState_TRT = 3 ,
  TrkState_Pseudo = 8 , TrkState_Vertex = 9 , TrkState_SpacePoint = 11 , TrkState_NumberOfMeasurementTypes =16
}
 Track state types Subset of enum MeasurementType from Athena: Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/TrackStateDefs.h. More...
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

void selectTrackHits (const xAOD::TrackParticleContainer &inputTrackParticles, const std::vector< bool > &inputMask, MeasurementType detTypeToSelect, std::vector< bool > &outputStatesMask, std::vector< bool > &outputMeasurementsMask) const
 Select TrackStateValidation and TrackMeasurementValidation objects that are used in the (thinned) track container.
StatusCode filterTrackHits (MeasurementType detTypeToSelect, const xAOD::TrackParticleContainer &inputTrackParticles, const std::vector< bool > &inputMask, const SG::ThinningHandleKey< xAOD::TrackStateValidationContainer > &statesKey, const SG::ThinningHandleKey< xAOD::TrackMeasurementValidationContainer > &measurementsKey, std::atomic< unsigned int > &ntot_states, std::atomic< unsigned int > &npass_states, std::atomic< unsigned int > &npass_measurements, const EventContext &ctx) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

std::atomic< unsigned int > m_ntot {}
 Counters and keys for xAOD::TrackParticle container.
std::atomic< unsigned int > m_npass {}
BooleanProperty m_thinPixelHitsOnTrack { this, "ThinPixelHitsOnTrack", false, ""}
 Thinning logic.
BooleanProperty m_thinSCTHitsOnTrack { this, "ThinSCTHitsOnTrack", false, ""}
BooleanProperty m_thinTRTHitsOnTrack { this, "ThinTRTHitsOnTrack", false, ""}
StringProperty m_streamName { this, "StreamName", "", "Name of the stream being thinned" }
 Stream for object thinning selections.
StringProperty m_selectionString { this, "SelectionString", "InDetTrackParticles.pt>10*GeV", "Selection string for each TrackParticle container" }
 Expressions for object thinning selections Default InDetTrackParticles (also accomplished through flag.Tracking.thinPixelClustersSelectionStrings defaults)
SG::ThinningHandleKey< xAOD::TrackParticleContainerm_inDetSGKey { this, "InDetTrackParticlesKey", "InDetTrackParticles", "" }
 SGKey for TrackParticleContainer.
std::atomic< unsigned int > m_ntot_pix_states {}
 Counters and keys for xAOD::TrackStateValidation and xAOD::TrackMeasurementValidation containers.
std::atomic< unsigned int > m_npass_pix_states {}
SG::ThinningHandleKey< xAOD::TrackStateValidationContainerm_statesPixSGKey { this, "InDetTrackStatesPixKey", "PixelMSOSs", "" }
std::atomic< unsigned int > m_ntot_pix_measurements {}
std::atomic< unsigned int > m_npass_pix_measurements {}
SG::ThinningHandleKey< xAOD::TrackMeasurementValidationContainerm_measurementsPixSGKey { this, "InDetTrackMeasurementsPixKey", "PixelClusters", "" }
std::atomic< unsigned int > m_ntot_sct_states {}
std::atomic< unsigned int > m_npass_sct_states {}
SG::ThinningHandleKey< xAOD::TrackStateValidationContainerm_statesSctSGKey { this, "InDetTrackStatesSctKey", "SCT_MSOSs", "" }
std::atomic< unsigned int > m_ntot_sct_measurements {}
std::atomic< unsigned int > m_npass_sct_measurements {}
SG::ThinningHandleKey< xAOD::TrackMeasurementValidationContainerm_measurementsSctSGKey { this, "InDetTrackMeasurementsSctKey", "SCT_Clusters", "" }
std::atomic< unsigned int > m_ntot_trt_states {}
std::atomic< unsigned int > m_npass_trt_states {}
SG::ThinningHandleKey< xAOD::TrackStateValidationContainerm_statesTrtSGKey { this, "InDetTrackStatesTrtKey", "TRT_MSOSs", "" }
std::atomic< unsigned int > m_ntot_trt_measurements {}
std::atomic< unsigned int > m_npass_trt_measurements {}
SG::ThinningHandleKey< xAOD::TrackMeasurementValidationContainerm_measurementsTrtSGKey { this, "InDetTrackMeasurementsTrtKey", "TRT_DriftCircles", "" }
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollectionm_SCTDetEleCollKey {this, "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"}
 For P->T converter of SCT_Clusters.
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 32 of file ThinInDetClustersAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ MeasurementType

Track state types Subset of enum MeasurementType from Athena: Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/TrackStateDefs.h.

Enumerator
TrkState_unidentified 
TrkState_Pixel 
TrkState_SCT 
TrkState_TRT 
TrkState_Pseudo 
TrkState_Vertex 
TrkState_SpacePoint 
TrkState_NumberOfMeasurementTypes 

Definition at line 112 of file ThinInDetClustersAlg.h.

Constructor & Destructor Documentation

◆ ThinInDetClustersAlg()

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

Constructor with parameters:

Definition at line 33 of file ThinInDetClustersAlg.cxx.

◆ ~ThinInDetClustersAlg()

virtual ThinInDetClustersAlg::~ThinInDetClustersAlg ( )
virtualdefault

Destructor:

Member Function Documentation

◆ _initializeParser() [1/2]

◆ _initializeParser() [2/2]

StatusCode ExpressionParserUserBase< ::AthReentrantAlgorithm, NUM_PARSER >::_initializeParser ( const ExpressionParsing::SelectionArg< NUM_PARSER > & selection_string,
ExpressionParsing::AppendLoaderFunc pre_xaod_loader = ExpressionParsing::NoLoaderFunc,
ExpressionParsing::AppendLoaderFunc post_xaod_loader = ExpressionParsing::NoLoaderFunc )
protectedinherited

◆ 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 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

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

◆ 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 ThinInDetClustersAlg::execute ( const EventContext & ctx) const
overridevirtual

Athena algorithm's execute hook.

Definition at line 117 of file ThinInDetClustersAlg.cxx.

118{
119
120 // Retrieve main TrackParticle collection
121 SG::ThinningHandle<xAOD::TrackParticleContainer> importedTrackParticles(m_inDetSGKey, ctx);
122 ATH_CHECK( importedTrackParticles.isValid() );
123
126 SG::ReadHandle<xAOD::TrackMeasurementValidationContainer> importedMeasurements(m_measurementsPixSGKey, ctx);
127 ATH_CHECK( importedMeasurements.isValid() );
128 unsigned int size_measurements = importedMeasurements->size();
129 m_ntot_pix_measurements += size_measurements;
130 }
132 SG::ReadHandle<xAOD::TrackMeasurementValidationContainer> importedMeasurements(m_measurementsSctSGKey, ctx);
133 ATH_CHECK( importedMeasurements.isValid() );
134 unsigned int size_measurements = importedMeasurements->size();
135 m_ntot_sct_measurements += size_measurements;
136 }
138 SG::ReadHandle<xAOD::TrackMeasurementValidationContainer> importedMeasurements(m_measurementsTrtSGKey, ctx);
139 ATH_CHECK( importedMeasurements.isValid() );
140 unsigned int size_measurements = importedMeasurements->size();
141 m_ntot_trt_measurements += size_measurements;
142 }
144
145 // Check the event contains tracks
146 unsigned int nTracks = importedTrackParticles->size();
147 if (nTracks==0) return StatusCode::SUCCESS;
148
149 // Set up a mask with the same entries as the full TrackParticle collection
150 std::vector<bool> mask;
151 mask.assign(nTracks,false); // default: don't keep any tracks
152 m_ntot += nTracks;
153
154 // Execute the text parser and update the mask
155 if (m_parser) {
156 std::vector<int> entries = m_parser->evaluateAsVector();
157 unsigned int nEntries = entries.size();
158 // check the sizes are compatible
159 if (nTracks != nEntries ) {
160 ATH_MSG_ERROR("Sizes incompatible! Are you sure your selection string used ID TrackParticles?");
161 return StatusCode::FAILURE;
162 }
163 // set mask
164 for (unsigned int i=0; i<nTracks; ++i) {
165 if (entries[i]==1) {
166 mask[i]=true; // Set track mask
167 m_npass += 1; // Count passing tracks.
168 }
169 }
170 }
171
175 *importedTrackParticles,
176 mask,
182 ctx) );
183 }
187 *importedTrackParticles,
188 mask,
194 ctx) );
195 }
199 *importedTrackParticles,
200 mask,
206 ctx) );
207 }
208
209 return StatusCode::SUCCESS;
210}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
std::conditional< NUM_PARSER==1, std::unique_ptr< ExpressionParsing::ExpressionParser >, std::array< std::unique_ptr< ExpressionParsing::ExpressionParser >, NUM_PARSER > >::type m_parser
std::atomic< unsigned int > m_ntot_sct_states
std::atomic< unsigned int > m_npass_pix_states
std::atomic< unsigned int > m_npass_sct_measurements
SG::ThinningHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurementsPixSGKey
SG::ThinningHandleKey< xAOD::TrackStateValidationContainer > m_statesSctSGKey
BooleanProperty m_thinPixelHitsOnTrack
Thinning logic.
BooleanProperty m_thinTRTHitsOnTrack
SG::ThinningHandleKey< xAOD::TrackStateValidationContainer > m_statesTrtSGKey
std::atomic< unsigned int > m_npass_trt_measurements
std::atomic< unsigned int > m_npass
std::atomic< unsigned int > m_ntot_sct_measurements
std::atomic< unsigned int > m_ntot_pix_states
Counters and keys for xAOD::TrackStateValidation and xAOD::TrackMeasurementValidation containers.
SG::ThinningHandleKey< xAOD::TrackParticleContainer > m_inDetSGKey
SGKey for TrackParticleContainer.
SG::ThinningHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurementsTrtSGKey
std::atomic< unsigned int > m_npass_sct_states
std::atomic< unsigned int > m_ntot_pix_measurements
std::atomic< unsigned int > m_npass_pix_measurements
std::atomic< unsigned int > m_ntot_trt_states
std::atomic< unsigned int > m_npass_trt_states
SG::ThinningHandleKey< xAOD::TrackStateValidationContainer > m_statesPixSGKey
std::atomic< unsigned int > m_ntot_trt_measurements
StatusCode filterTrackHits(MeasurementType detTypeToSelect, const xAOD::TrackParticleContainer &inputTrackParticles, const std::vector< bool > &inputMask, const SG::ThinningHandleKey< xAOD::TrackStateValidationContainer > &statesKey, const SG::ThinningHandleKey< xAOD::TrackMeasurementValidationContainer > &measurementsKey, std::atomic< unsigned int > &ntot_states, std::atomic< unsigned int > &npass_states, std::atomic< unsigned int > &npass_measurements, const EventContext &ctx) const
BooleanProperty m_thinSCTHitsOnTrack
std::atomic< unsigned int > m_ntot
Counters and keys for xAOD::TrackParticle container.
SG::ThinningHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurementsSctSGKey
double entries
Definition listroot.cxx:49

◆ 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

◆ filterTrackHits()

StatusCode ThinInDetClustersAlg::filterTrackHits ( MeasurementType detTypeToSelect,
const xAOD::TrackParticleContainer & inputTrackParticles,
const std::vector< bool > & inputMask,
const SG::ThinningHandleKey< xAOD::TrackStateValidationContainer > & statesKey,
const SG::ThinningHandleKey< xAOD::TrackMeasurementValidationContainer > & measurementsKey,
std::atomic< unsigned int > & ntot_states,
std::atomic< unsigned int > & npass_states,
std::atomic< unsigned int > & npass_measurements,
const EventContext & ctx ) const
private

Definition at line 212 of file ThinInDetClustersAlg.cxx.

222{
223 std::vector<bool> maskStates;
224 std::vector<bool> maskMeasurements;
225
226 selectTrackHits (inputTrackParticles, inputMask, detTypeToSelect,
227 maskStates, maskMeasurements);
228
229 auto count = [] (const std::vector<bool>& m)
230 { return std::count (m.begin(), m.end(), true); };
231 npass_states += count (maskStates);
232 npass_measurements += count (maskMeasurements);
233
234 if (!statesKey.empty()) {
235 SG::ThinningHandle<xAOD::TrackStateValidationContainer> importedStates(statesKey, ctx);
236 ATH_CHECK( importedStates.isValid() );
237 unsigned int size_states = importedStates->size();
238 if (size_states == 0) {
239 ATH_MSG_WARNING("States container is empty: " << statesKey.key());
240 }
241 else {
242 ntot_states += size_states;
243 if (maskStates.size() > size_states) {
244 ATH_MSG_ERROR("States mask size mismatch: mask size (" << maskStates.size() << ") > number of states (" << size_states << ").");
245 return StatusCode::FAILURE;
246 }
247 maskStates.resize (size_states);
248 importedStates.keep (maskStates);
249 }
250 }
251
252 if (!measurementsKey.empty()) {
253 SG::ThinningHandle<xAOD::TrackMeasurementValidationContainer> importedMeasurements(measurementsKey, ctx);
254 ATH_CHECK( importedMeasurements.isValid() );
255 unsigned int size_measurements = importedMeasurements->size();
256 if (size_measurements == 0) {
257 ATH_MSG_WARNING("Measurements container is empty: " << measurementsKey.key());
258 }
259 else {
260 if (maskMeasurements.size() > size_measurements) {
261 ATH_MSG_ERROR("Measurements mask size mismatch: mask size (" << maskMeasurements.size() << ") > number of measurements (" << size_measurements << ").");
262 return StatusCode::FAILURE;
263 }
264 maskMeasurements.resize (size_measurements);
265 importedMeasurements.keep (maskMeasurements);
266 }
267 }
268
269 return StatusCode::SUCCESS;
270}
#define ATH_MSG_WARNING(x)
const std::string & key() const
Return the StoreGate ID for the referenced object.
bool empty() const
Test if the key is blank.
void selectTrackHits(const xAOD::TrackParticleContainer &inputTrackParticles, const std::vector< bool > &inputMask, MeasurementType detTypeToSelect, std::vector< bool > &outputStatesMask, std::vector< bool > &outputMeasurementsMask) const
Select TrackStateValidation and TrackMeasurementValidation objects that are used in the (thinned) tra...
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146

◆ finalize()

StatusCode ThinInDetClustersAlg::finalize ( )
overridevirtual

Athena algorithm's finalize hook.

Definition at line 85 of file ThinInDetClustersAlg.cxx.

86{
87 ATH_MSG_VERBOSE("finalize() ...");
88 ATH_MSG_INFO("Processed "<< m_ntot <<" tracks, "<< m_npass<< " had their hits retained ");
90 ATH_MSG_INFO("Pixel state objects thinning, Total / Passed (Efficiency): "
92 << " (" << (m_ntot_pix_states == 0 ? 0 : static_cast<float>(m_npass_pix_states) / m_ntot_pix_states) << ")");
93 ATH_MSG_INFO("Total pixel measurements objects from *all* track collections:: " << m_ntot_pix_measurements);
94 ATH_MSG_INFO("Pixel measurements objects from this track collection passing selection: " << m_npass_pix_measurements);
95 }
97 ATH_MSG_INFO("SCT state objects thinning, Total / Passed (Efficiency): "
99 << " (" << (m_ntot_sct_states == 0 ? 0 : static_cast<float>(m_npass_sct_states) / m_ntot_sct_states) << ")");
100 ATH_MSG_INFO("Total SCT measurements objects from *all* track collections:: " << m_ntot_sct_measurements);
101 ATH_MSG_INFO("SCT measurements objects from this track collection passing selection: " << m_npass_sct_measurements);
102 }
104 ATH_MSG_INFO("TRT state objects thinning, Total / Passed (Efficiency): "
106 << " (" << (m_ntot_trt_states == 0 ? 0 : static_cast<float>(m_npass_trt_states) / m_ntot_trt_states) << ")");
107 ATH_MSG_INFO("Total TRT measurements objects from *all* track collections:: " << m_ntot_trt_measurements);
108 ATH_MSG_INFO("TRT measurements objects from this track collection passing selection: " << m_npass_trt_measurements);
109 }
110
112
113 return StatusCode::SUCCESS;
114}
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)

◆ finalizeParser()

StatusCode ExpressionParserUserBase< ::AthReentrantAlgorithm, 1 >::finalizeParser ( )
inherited

◆ initialize()

StatusCode ThinInDetClustersAlg::initialize ( )
overridevirtual

Athena algorithm's initalize hook.

Definition at line 43 of file ThinInDetClustersAlg.cxx.

44{
45
46 // Set up the text-parsing machinery for thinning the tracks directly according to user cuts
47 if (m_selectionString.empty()) {
48 ATH_MSG_FATAL("No inner detector track selection strings provided!");
49 return StatusCode::FAILURE;
50 }
51 ATH_MSG_INFO("Track thinning selection string: " << m_selectionString);
53
54 ATH_CHECK( m_inDetSGKey.initialize (m_streamName) );
55 ATH_MSG_INFO("Using " << m_inDetSGKey << "as the source collection for inner detector track particles");
56
58 ATH_MSG_INFO("Pixel states collection as source for thinning: " << m_statesPixSGKey.key());
59 ATH_MSG_INFO("Pixel measurements collection as source for thinning: " << m_measurementsPixSGKey.key());
60 }
62 ATH_MSG_INFO("SCT states collection as source for thinning: " << m_statesSctSGKey.key());
63 ATH_MSG_INFO("SCT measurements collection as source for thinning: " << m_measurementsSctSGKey.key());
64 }
66 ATH_MSG_INFO("TRT states collection as source for thinning: " << m_statesTrtSGKey.key());
67 ATH_MSG_INFO("TRT measurements collection as source for thinning: " << m_measurementsTrtSGKey.key());
68 }
69
70 ATH_MSG_DEBUG("Initializing measurement ThinningHandleKeys.");
74
75 ATH_MSG_DEBUG("Initializing MSOS ThinningHandleKeyArrays.");
79
80 ATH_CHECK(m_SCTDetEleCollKey.initialize( !m_SCTDetEleCollKey.key().empty() ));
81
82 return StatusCode::SUCCESS;
83}
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
StatusCode initializeParser(const ExpressionParsing::SelectionArg< 1 > &selection_string)
StringProperty m_selectionString
Expressions for object thinning selections Default InDetTrackParticles (also accomplished through fla...
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
For P->T converter of SCT_Clusters.
StringProperty m_streamName
Stream for object thinning selections.

◆ initializeParser()

StatusCode ExpressionParserUser< ::AthReentrantAlgorithm, 1 >::initializeParser ( const ExpressionParsing::SelectionArg< 1 > & selection_string)
inherited

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

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

◆ renounceInput()

virtual bool ExpressionParserUserBase< ::AthReentrantAlgorithm, 1 >::renounceInput ( const DataObjID & output_data_id)
overridevirtualinherited

◆ selectTrackHits()

void ThinInDetClustersAlg::selectTrackHits ( const xAOD::TrackParticleContainer & inputTrackParticles,
const std::vector< bool > & inputMask,
MeasurementType detTypeToSelect,
std::vector< bool > & outputStatesMask,
std::vector< bool > & outputMeasurementsMask ) const
private

Select TrackStateValidation and TrackMeasurementValidation objects that are used in the (thinned) track container.

Definition at line 272 of file ThinInDetClustersAlg.cxx.

276{
277 using StatesOnTrack = std::vector<ElementLink<xAOD::TrackStateValidationContainer>>;
278
279 // loop over track particles, consider only the ones pre-selected by the mask
280 int trkIndex=-1;
281 for (const xAOD::TrackParticle* trkIt : inputTrackParticles) {
282 trkIndex++;
283
284 if (not inputMask[trkIndex]) continue;
285
286 // loop over the TrackStateValidation objects, and add them to the outputStatesMask
287 static const SG::AuxElement::ConstAccessor< StatesOnTrack > trackStateAcc("Reco_msosLink");
288 if( ! trackStateAcc.isAvailable( *trkIt ) ) {
289 ATH_MSG_INFO("Cannot find TrackState link from xAOD::TrackParticle. Skipping track.");
290 continue;
291 }
292 const StatesOnTrack& measurementsOnTrack = trackStateAcc(*trkIt);
293
294 for( const ElementLink<xAOD::TrackStateValidationContainer>& trkState_el : measurementsOnTrack) {
295 if (not trkState_el.isValid()) {
296 ATH_MSG_INFO("Cannot find a valid link to TrackStateValidation object for track index: " << trkIndex);
297 continue; //not a valid link
298 }
299 if ((*trkState_el)->detType() != detTypeToSelect) {
300 ATH_MSG_VERBOSE("Discarding TrackState as not of correct type " << detTypeToSelect);
301 continue;
302 }
303 if (trkState_el.index() >= outputStatesMask.size()) {
304 outputStatesMask.resize (trkState_el.index()+1);
305 }
306 outputStatesMask[trkState_el.index()] = true;
307
308 // get the corresponding TrackMeasurementValidation object, if any, and add it to the outputMeasurementsMask
309 const ElementLink<xAOD::TrackMeasurementValidationContainer> trkMeasurement_el = (*trkState_el)->trackMeasurementValidationLink();
310 if (not trkMeasurement_el.isValid()) {
311 ATH_MSG_VERBOSE("Cannot find a valid link to TrackMeasurementValidation object from track state for track index: " << trkIndex
312 << ", trackState index: " << trkState_el.index());
313 continue; //not a valid link
314 }
315 if (*trkMeasurement_el == nullptr) {
316 ATH_MSG_VERBOSE("Invalid pointer to TrackMeasurementValidation object from track state for track index: " << trkIndex
317 << ", trackState index: " << trkState_el.index());
318 continue; //not linking to a valid object -- is it necessary?
319 }
320 if (trkMeasurement_el.index() >= outputMeasurementsMask.size()) {
321 outputMeasurementsMask.resize (trkMeasurement_el.index()+1);
322 }
323 outputMeasurementsMask[trkMeasurement_el.index()] = true;
324 }
325 } // end loop over xAOD::TrackParticle container
326}
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:569
TrackParticle_v1 TrackParticle
Reference the current persistent version:

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

◆ updateDataNeeds()

virtual bool ExpressionParserUserBase< ::AthReentrantAlgorithm, 1 >::updateDataNeeds ( const std::vector< const DataObjID * > & input_data_in,
const std::vector< const DataObjID * > & output_data_in,
std::vector< Gaudi::DataHandle * > & new_input_handles,
std::vector< Gaudi::DataHandle * > & new_output_handles )
overridevirtualinherited

Inform a dynamic data consumer about all consumed or produced data.

Parameters
input_data_inthe input data object IDs of all algorithms and tools
output_data_inthe output data object IDs of all algorithms and tools
new_input_handlesthe new input data handles added by this call
new_output_handlesthe new output data handles added by this call
Returns
true if the consumer did update its handles, false otherwise

◆ 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

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

SG::ThinningHandleKey<xAOD::TrackParticleContainer> ThinInDetClustersAlg::m_inDetSGKey { this, "InDetTrackParticlesKey", "InDetTrackParticles", "" }
private

SGKey for TrackParticleContainer.

Definition at line 73 of file ThinInDetClustersAlg.h.

74{ this, "InDetTrackParticlesKey", "InDetTrackParticles", "" };

◆ m_measurementsPixSGKey

SG::ThinningHandleKey<xAOD::TrackMeasurementValidationContainer> ThinInDetClustersAlg::m_measurementsPixSGKey { this, "InDetTrackMeasurementsPixKey", "PixelClusters", "" }
private

Definition at line 84 of file ThinInDetClustersAlg.h.

85{ this, "InDetTrackMeasurementsPixKey", "PixelClusters", "" };

◆ m_measurementsSctSGKey

SG::ThinningHandleKey<xAOD::TrackMeasurementValidationContainer> ThinInDetClustersAlg::m_measurementsSctSGKey { this, "InDetTrackMeasurementsSctKey", "SCT_Clusters", "" }
private

Definition at line 94 of file ThinInDetClustersAlg.h.

95{ this, "InDetTrackMeasurementsSctKey", "SCT_Clusters", "" };

◆ m_measurementsTrtSGKey

SG::ThinningHandleKey<xAOD::TrackMeasurementValidationContainer> ThinInDetClustersAlg::m_measurementsTrtSGKey { this, "InDetTrackMeasurementsTrtKey", "TRT_DriftCircles", "" }
private

Definition at line 104 of file ThinInDetClustersAlg.h.

105{ this, "InDetTrackMeasurementsTrtKey", "TRT_DriftCircles", "" };

◆ m_npass

std::atomic<unsigned int> ThinInDetClustersAlg::m_npass {}
mutableprivate

Definition at line 53 of file ThinInDetClustersAlg.h.

53{};

◆ m_npass_pix_measurements

std::atomic<unsigned int> ThinInDetClustersAlg::m_npass_pix_measurements {}
mutableprivate

Definition at line 83 of file ThinInDetClustersAlg.h.

83{};

◆ m_npass_pix_states

std::atomic<unsigned int> ThinInDetClustersAlg::m_npass_pix_states {}
mutableprivate

Definition at line 78 of file ThinInDetClustersAlg.h.

78{};

◆ m_npass_sct_measurements

std::atomic<unsigned int> ThinInDetClustersAlg::m_npass_sct_measurements {}
mutableprivate

Definition at line 93 of file ThinInDetClustersAlg.h.

93{};

◆ m_npass_sct_states

std::atomic<unsigned int> ThinInDetClustersAlg::m_npass_sct_states {}
mutableprivate

Definition at line 88 of file ThinInDetClustersAlg.h.

88{};

◆ m_npass_trt_measurements

std::atomic<unsigned int> ThinInDetClustersAlg::m_npass_trt_measurements {}
mutableprivate

Definition at line 103 of file ThinInDetClustersAlg.h.

103{};

◆ m_npass_trt_states

std::atomic<unsigned int> ThinInDetClustersAlg::m_npass_trt_states {}
mutableprivate

Definition at line 98 of file ThinInDetClustersAlg.h.

98{};

◆ m_ntot

std::atomic<unsigned int> ThinInDetClustersAlg::m_ntot {}
mutableprivate

Counters and keys for xAOD::TrackParticle container.

Definition at line 52 of file ThinInDetClustersAlg.h.

52{};

◆ m_ntot_pix_measurements

std::atomic<unsigned int> ThinInDetClustersAlg::m_ntot_pix_measurements {}
mutableprivate

Definition at line 82 of file ThinInDetClustersAlg.h.

82{};

◆ m_ntot_pix_states

std::atomic<unsigned int> ThinInDetClustersAlg::m_ntot_pix_states {}
mutableprivate

Counters and keys for xAOD::TrackStateValidation and xAOD::TrackMeasurementValidation containers.

Definition at line 77 of file ThinInDetClustersAlg.h.

77{};

◆ m_ntot_sct_measurements

std::atomic<unsigned int> ThinInDetClustersAlg::m_ntot_sct_measurements {}
mutableprivate

Definition at line 92 of file ThinInDetClustersAlg.h.

92{};

◆ m_ntot_sct_states

std::atomic<unsigned int> ThinInDetClustersAlg::m_ntot_sct_states {}
mutableprivate

Definition at line 87 of file ThinInDetClustersAlg.h.

87{};

◆ m_ntot_trt_measurements

std::atomic<unsigned int> ThinInDetClustersAlg::m_ntot_trt_measurements {}
mutableprivate

Definition at line 102 of file ThinInDetClustersAlg.h.

102{};

◆ m_ntot_trt_states

std::atomic<unsigned int> ThinInDetClustersAlg::m_ntot_trt_states {}
mutableprivate

Definition at line 97 of file ThinInDetClustersAlg.h.

97{};

◆ m_parser

std::conditional<1==1,std::unique_ptr<ExpressionParsing::ExpressionParser>,std::array<std::unique_ptr<ExpressionParsing::ExpressionParser>,1>>::type ExpressionParserUserBase< ::AthReentrantAlgorithm, 1 >::m_parser
protectedinherited

Definition at line 100 of file ExpressionParserUser.h.

◆ m_proxyLoaders

std::unique_ptr<ExpressionParsing::IProxyLoader> ExpressionParserUserBase< ::AthReentrantAlgorithm, 1 >::m_proxyLoaders
protectedinherited

Definition at line 97 of file ExpressionParserUser.h.

◆ m_renounce

std::vector<std::string> ExpressionParserUserBase< ::AthReentrantAlgorithm, 1 >::m_renounce
protectedinherited

Definition at line 102 of file ExpressionParserUser.h.

◆ m_SCTDetEleCollKey

SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> ThinInDetClustersAlg::m_SCTDetEleCollKey {this, "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"}
private

For P->T converter of SCT_Clusters.

Definition at line 108 of file ThinInDetClustersAlg.h.

108{this, "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"};

◆ m_selectionString

StringProperty ThinInDetClustersAlg::m_selectionString { this, "SelectionString", "InDetTrackParticles.pt>10*GeV", "Selection string for each TrackParticle container" }
private

Expressions for object thinning selections Default InDetTrackParticles (also accomplished through flag.Tracking.thinPixelClustersSelectionStrings defaults)

Definition at line 69 of file ThinInDetClustersAlg.h.

70{ this, "SelectionString", "InDetTrackParticles.pt>10*GeV", "Selection string for each TrackParticle container" };

◆ m_statesPixSGKey

SG::ThinningHandleKey<xAOD::TrackStateValidationContainer> ThinInDetClustersAlg::m_statesPixSGKey { this, "InDetTrackStatesPixKey", "PixelMSOSs", "" }
private

Definition at line 79 of file ThinInDetClustersAlg.h.

80{ this, "InDetTrackStatesPixKey", "PixelMSOSs", "" }; // original

◆ m_statesSctSGKey

SG::ThinningHandleKey<xAOD::TrackStateValidationContainer> ThinInDetClustersAlg::m_statesSctSGKey { this, "InDetTrackStatesSctKey", "SCT_MSOSs", "" }
private

Definition at line 89 of file ThinInDetClustersAlg.h.

90{ this, "InDetTrackStatesSctKey", "SCT_MSOSs", "" };

◆ m_statesTrtSGKey

SG::ThinningHandleKey<xAOD::TrackStateValidationContainer> ThinInDetClustersAlg::m_statesTrtSGKey { this, "InDetTrackStatesTrtKey", "TRT_MSOSs", "" }
private

Definition at line 99 of file ThinInDetClustersAlg.h.

100{ this, "InDetTrackStatesTrtKey", "TRT_MSOSs", "" };

◆ m_streamName

StringProperty ThinInDetClustersAlg::m_streamName { this, "StreamName", "", "Name of the stream being thinned" }
private

Stream for object thinning selections.

Definition at line 63 of file ThinInDetClustersAlg.h.

64{ this, "StreamName", "", "Name of the stream being thinned" };

◆ m_thinPixelHitsOnTrack

BooleanProperty ThinInDetClustersAlg::m_thinPixelHitsOnTrack { this, "ThinPixelHitsOnTrack", false, ""}
private

Thinning logic.

Definition at line 55 of file ThinInDetClustersAlg.h.

56{ this, "ThinPixelHitsOnTrack", false, ""};

◆ m_thinSCTHitsOnTrack

BooleanProperty ThinInDetClustersAlg::m_thinSCTHitsOnTrack { this, "ThinSCTHitsOnTrack", false, ""}
private

Definition at line 57 of file ThinInDetClustersAlg.h.

58{ this, "ThinSCTHitsOnTrack", false, ""};

◆ m_thinTRTHitsOnTrack

BooleanProperty ThinInDetClustersAlg::m_thinTRTHitsOnTrack { this, "ThinTRTHitsOnTrack", false, ""}
private

Definition at line 59 of file ThinInDetClustersAlg.h.

60{ this, "ThinTRTHitsOnTrack", false, ""};

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

◆ m_xAODProxyLoader

The expression parser.

Definition at line 96 of file ExpressionParserUser.h.


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