ATLAS Offline Software
Loading...
Searching...
No Matches
InDetPhysValTruthDecoratorAlg Class Reference

#include <InDetPhysValTruthDecoratorAlg.h>

Inheritance diagram for InDetPhysValTruthDecoratorAlg:

Public Member Functions

 InDetPhysValTruthDecoratorAlg (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~InDetPhysValTruthDecoratorAlg ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode execute (const EventContext &ctx) const
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
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
 Get filter decision:
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 Set filter decision:
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

enum  { kPixel , kSCT , kNClusterTypes }
enum  EDecorations {
  kDecorD0 , kDecorZ0 , kDecorPhi , kDecorTheta ,
  kDecorZ0st , kDecorQOverP , kDecorProdR , kDecorProdZ ,
  kDecorNSilHits , kDecorTime , kNDecorators
}
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

bool decorateTruth (const xAOD::TruthParticle &particle, std::vector< std::pair< SG::WriteDecorHandle< xAOD::TruthParticleContainer, float >, bool > > &float_decor, const Amg::Vector3D &perigeePos, const std::vector< std::array< uint16_t, kNClusterTypes > > &counts) const
const xAOD::TruthEventgetTruthHSEvent () const
bool decorateTruthTime (std::vector< std::pair< SG::WriteDecorHandle< xAOD::TruthParticleContainer, float >, bool > > &float_decor) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

PublicToolHandle< Trk::IExtrapolatorm_extrapolator {this,"Extrapolator","Trk::Extrapolator/AtlasExtrapolator",""}
SG::ReadDecorHandleKeyArray< xAOD::EventInfom_beamSpotDecoKey
std::atomic< std::size_t > m_nMissingTruthParticles = 0u
std::atomic< bool > m_errorEmitted {false}
SG::ReadHandleKey< xAOD::TruthParticleContainerm_truthParticleName {this, "TruthParticleContainerName", "TruthParticles", ""}
 TruthParticle container's name needed to create decorators.
Gaudi::Property< std::string > m_prefix {this, "Prefix", "", "Decoration prefix to avoid clashes."}
Gaudi::Property< bool > m_decoTime {this, "decorateTime", false}
SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainerm_truthPixelClusterName {this, "PixelClusterContainerName", "PixelClusters", ""}
 TruthPixelClusterContainer and TruthSCTClusterContainer needed for truth silicon hit cut.
SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainerm_truthSCTClusterName {this, "SCTClusterContainerName", "SCT_Clusters", ""}
SG::ReadDecorHandleKey< xAOD::TruthParticleContainerm_truthParticleIndexDecor {this, "TruthParticleIndexDecoration", m_truthParticleName, "origTruthIndex", "decoration name for the original truth particle index."}
SG::ReadHandleKey< xAOD::TruthEventContainerm_truthEventName {this, "TruthEventContainerName", "TruthEvents", ""}
SG::ReadHandleKey< xAOD::TruthPileupEventContainerm_truthPileupEventName {this, "TruthPileupEventContainerName", "TruthPileupEvents", ""}
Gaudi::Property< bool > m_useTruthPVAsPerigee {this, "UseTruthPVAsPerigee", false, "Use the truth PV to calculate the perigee parameters instead of the BS"}
std::vector< std::pair< SG::WriteDecorHandleKey< xAOD::TruthParticleContainer >, SG::AuxElement::ConstAccessor< float > > > m_decor
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 37 of file InDetPhysValTruthDecoratorAlg.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

◆ anonymous enum

◆ EDecorations

Enumerator
kDecorD0 
kDecorZ0 
kDecorPhi 
kDecorTheta 
kDecorZ0st 
kDecorQOverP 
kDecorProdR 
kDecorProdZ 
kDecorNSilHits 
kDecorTime 
kNDecorators 

Definition at line 95 of file InDetPhysValTruthDecoratorAlg.h.

Constructor & Destructor Documentation

◆ InDetPhysValTruthDecoratorAlg()

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

Definition at line 26 of file InDetPhysValTruthDecoratorAlg.cxx.

26 :
27 AthReentrantAlgorithm(name, pSvcLocator)
28{
29}

◆ ~InDetPhysValTruthDecoratorAlg()

InDetPhysValTruthDecoratorAlg::~InDetPhysValTruthDecoratorAlg ( )
virtual

Definition at line 31 of file InDetPhysValTruthDecoratorAlg.cxx.

31 {
32 // nop
33}

Member Function Documentation

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

◆ decorateTruth()

bool InDetPhysValTruthDecoratorAlg::decorateTruth ( const xAOD::TruthParticle & particle,
std::vector< std::pair< SG::WriteDecorHandle< xAOD::TruthParticleContainer, float >, bool > > & float_decor,
const Amg::Vector3D & perigeePos,
const std::vector< std::array< uint16_t, kNClusterTypes > > & counts ) const
private

Definition at line 185 of file InDetPhysValTruthDecoratorAlg.cxx.

188 {
189 ATH_MSG_VERBOSE("Decorate truth with d0 etc");
190 if (particle.isNeutral()) {
191 return false;
192 }
193 const EventContext& ctx = Gaudi::Hive::currentContext();
194 const Amg::Vector3D momentum(particle.px(), particle.py(), particle.pz());
195 const int pid(particle.pdgId());
196 double charge = particle.charge();
197
198 if (std::isnan(charge)) {
199 ATH_MSG_DEBUG("charge not found on particle with pid " << pid);
200 return false;
201 }
202
203 // @TODO float?
204 float nSiHits = std::accumulate(counts.at(particle.index()).begin(), counts[particle.index()].end(), 0u);
205
206 IDPVM::decorateOrRejectQuietly(particle,float_decor[kDecorNSilHits], nSiHits);
207
208 const xAOD::TruthVertex* ptruthVertex(nullptr);
209 try{
210 ptruthVertex = particle.prodVtx();
211 } catch (const std::exception& e) {
212 if (not m_errorEmitted) {
213 ATH_MSG_WARNING("A non existent production vertex was requested in calculating the track parameters d0 etc");
214 }
215 m_errorEmitted = true;
216 return false;
217 }
218 if (!ptruthVertex) {
219 ATH_MSG_DEBUG("A production vertex pointer was retrieved, but it is NULL");
220 return false;
221 }
222 const auto xPos = ptruthVertex->x();
223 const auto yPos = ptruthVertex->y();
224 const auto z_truth = ptruthVertex->z();
225 const Amg::Vector3D position(xPos, yPos, z_truth);
226 const float prodR_truth = std::sqrt(xPos * xPos + yPos * yPos);
227 // delete ptruthVertex;ptruthVertex=0;
228 const Trk::CurvilinearParameters cParameters(position, momentum, charge);
229
230 Trk::PerigeeSurface persf(perigeePos);
231
232 std::unique_ptr<const Trk::TrackParameters> tP ( m_extrapolator->extrapolate(ctx,
233 cParameters,
234 persf, Trk::anyDirection, false) );
235 if (tP) {
236 float d0_truth = tP->parameters()[Trk::d0];
237 float theta_truth = tP->parameters()[Trk::theta];
238 float z0_truth = tP->parameters()[Trk::z0];
239 float phi_truth = tP->parameters()[Trk::phi];
240 float qOverP_truth = tP->parameters()[Trk::qOverP]; // P or Pt ??
241 float z0st_truth = z0_truth * std::sin(theta_truth);
242
243 // 'safeDecorator' used to prevent a crash in case of adding something which pre-exists.
244 // behaviour chosen is to reject quietly
245 IDPVM::decorateOrRejectQuietly(particle,float_decor[kDecorD0],d0_truth);
246 IDPVM::decorateOrRejectQuietly(particle,float_decor[kDecorZ0],z0_truth);
247 IDPVM::decorateOrRejectQuietly(particle,float_decor[kDecorPhi],phi_truth);
248 IDPVM::decorateOrRejectQuietly(particle,float_decor[kDecorTheta],theta_truth);
249 IDPVM::decorateOrRejectQuietly(particle,float_decor[kDecorZ0st],z0st_truth);
250 IDPVM::decorateOrRejectQuietly(particle,float_decor[kDecorQOverP],qOverP_truth);
251 IDPVM::decorateOrRejectQuietly(particle,float_decor[kDecorProdR],prodR_truth);
252 IDPVM::decorateOrRejectQuietly(particle,float_decor[kDecorProdZ],z_truth);
253
254 return true;
255 } else {
256 ATH_MSG_DEBUG("The TrackParameters pointer for this TruthParticle is NULL");
257 return false;
258 }
259}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
double charge(const T &p)
Definition AtlasPID.h:1003
PublicToolHandle< Trk::IExtrapolator > m_extrapolator
Eigen::Matrix< double, 3, 1 > Vector3D
void decorateOrRejectQuietly(const T_Cont_Elm &particle, OptionalDecoration< T_Cont, T > &decorator, const T &value)
float nSiHits(const U &p)
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
@ anyDirection
CurvilinearParametersT< TrackParametersDim, Charged, PlaneSurface > CurvilinearParameters
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
@ phi
Definition ParamDefs.h:75
@ d0
Definition ParamDefs.h:63
@ z0
Definition ParamDefs.h:64
const Amg::Vector3D & position() const
Method to retrieve the position of the Intersection.
TruthVertex_v1 TruthVertex
Typedef to implementation.
Definition TruthVertex.h:15

◆ decorateTruthTime()

bool InDetPhysValTruthDecoratorAlg::decorateTruthTime ( std::vector< std::pair< SG::WriteDecorHandle< xAOD::TruthParticleContainer, float >, bool > > & float_decor) const
private

Definition at line 282 of file InDetPhysValTruthDecoratorAlg.cxx.

282 {
283
284 const EventContext& ctx = Gaudi::Hive::currentContext();
285
286 const xAOD::TruthEvent* event = nullptr;
287 const xAOD::TruthVertex* truthVtx = nullptr;
288 float truthTime;
289
290 // First HS event
291 if (!m_truthEventName.key().empty()) {
292 event = getTruthHSEvent();
293 if (event) {
294 truthVtx = event->signalProcessVertex();
295 truthTime = (truthVtx) ? truthVtx->t() / Gaudi::Units::c_light : -9999.;
296 for (const auto& link : event->truthParticleLinks()) {
297 if (link.isValid()) {
298 IDPVM::decorateOrRejectQuietly(**link, float_decor[kDecorTime], truthTime);
299 }
300 }
301 }
302 }
303
304 // Then PU events
305 if (!m_truthPileupEventName.key().empty()) {
306 ATH_MSG_VERBOSE("Getting TruthPileupEventContainer");
307 SG::ReadHandle<xAOD::TruthPileupEventContainer> truthPileupEventContainer(m_truthPileupEventName, ctx);
308 if (!truthPileupEventContainer.isPresent()) {
309 ATH_MSG_WARNING("TruthPileupEventContainer name was specified, but no container is present");
310 return true;
311 }
312 if (truthPileupEventContainer.isValid()) {
313 for (const auto event : *truthPileupEventContainer) {
314 truthVtx = nullptr;
315 for (std::size_t i = 0; i < event->nTruthVertices(); i++) {
316 truthVtx = event->truthVertex(i);
317 if (truthVtx) {
318 break;
319 }
320 }
321 truthTime = (truthVtx) ? truthVtx->t() / Gaudi::Units::c_light: -9999.;
322 for (const auto& link : event->truthParticleLinks()) {
323 if (link.isValid()) {
324 IDPVM::decorateOrRejectQuietly(**link, float_decor[kDecorTime], truthTime);
325 }
326 }
327 }
328 }
329 else {
330 ATH_MSG_ERROR("TruthPileupEventContainer is invalid!");
331 return false;
332 }
333 }
334
335 return true;
336
337}
#define ATH_MSG_ERROR(x,...)
SG::ReadHandleKey< xAOD::TruthEventContainer > m_truthEventName
SG::ReadHandleKey< xAOD::TruthPileupEventContainer > m_truthPileupEventName
const xAOD::TruthEvent * getTruthHSEvent() const
float t() const
Vertex time.
pointer & link(pointer p) const
Return a reference to the link for an element.
TruthEvent_v1 TruthEvent
Typedef to implementation.
Definition TruthEvent.h:17

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

truthbarcode-cluster maps to be pre-stored at event level

Definition at line 74 of file InDetPhysValTruthDecoratorAlg.cxx.

74 {
75 SG::ReadHandle<xAOD::TruthParticleContainer> ptruth(m_truthParticleName, ctx);
76 if ((not ptruth.isValid())) {
77 return StatusCode::FAILURE;
78 }
79
80 std::size_t ptruth_size=ptruth->size();
81
82 std::vector<unsigned int> truthIndexMap;
83 if (!m_truthParticleIndexDecor.empty()) {
84 SG::ReadDecorHandle<xAOD::TruthParticleContainer, unsigned int> decor_index(m_truthParticleIndexDecor, ctx);
85 unsigned int max_size=0;
86 assert( ptruth_size < std::numeric_limits<unsigned int>::max());
87 for (const xAOD::TruthParticle *truth_particle : *ptruth) {
88 max_size = std::max( max_size, decor_index(*truth_particle) );
89 }
90 if (max_size>=std::numeric_limits<unsigned int>::max()) {
91 ATH_MSG_ERROR("Truth index exceed max allowed range.");
92 return StatusCode::FAILURE;
93 }
94 ++max_size;
95 truthIndexMap.resize( max_size, std::numeric_limits<unsigned int>::max());
96 unsigned int new_index=0;
97 for (const xAOD::TruthParticle *truth_particle : *ptruth) {
98 truthIndexMap.at( decor_index(*truth_particle) ) = new_index;
99 ++new_index;
100 }
101 }
102 else {
103 truthIndexMap.reserve(ptruth_size);
104 for (unsigned int i=0; i<ptruth_size; ++i) {
105 truthIndexMap.push_back(i);
106 }
107 }
108
109 std::vector< IDPVM::OptionalDecoration<xAOD::TruthParticleContainer,float> >
110 float_decor( IDPVM::createDecoratorsIfNeeded(*ptruth, m_decor, ctx, msgLvl(MSG::DEBUG)) );
111
113 std::vector< std::array<uint16_t, kNClusterTypes> > tp_clustercount;
114 tp_clustercount.resize(ptruth_size,std::array<uint16_t,kNClusterTypes>{});
115 unsigned int missing_truth_particle=0u;
116 //Loop over the pixel and sct clusters to fill the truth barcode - cluster count maps
117 SG::ReadHandle<xAOD::TrackMeasurementValidationContainer> sctClusters(m_truthSCTClusterName, ctx);
118 SG::ReadHandle<xAOD::TrackMeasurementValidationContainer> pixelClusters(m_truthPixelClusterName, ctx);
119 //only decorate the truth particles with truth silicon hits if both containers are available
120 if (sctClusters.isValid() && pixelClusters.isValid()) {
121 for (const auto *const sct : *sctClusters) {
122 const xAOD::TrackMeasurementValidation* sctCluster = sct;
123 static const SG::AuxElement::ConstAccessor< std::vector<unsigned int> > truthIndexAcc("truth_index");
124 if (truthIndexAcc.isAvailable(*sctCluster)) {
125 const std::vector<unsigned int> &truth_indices = truthIndexAcc(*sctCluster);
126 for (auto index : truth_indices) {
127 if (index != std::numeric_limits<unsigned int>::max()) {
128 if (index < truthIndexMap.size() && truthIndexMap[index] != std::numeric_limits<unsigned int>::max()) {
129 ++tp_clustercount.at(truthIndexMap[index])[kSCT];
130 }
131 else {
132 ++missing_truth_particle;
133 }
134 }
135 }
136 }
137 } // Loop over SCT clusters
138
139 for (const auto *const pix : *pixelClusters) {
140 const xAOD::TrackMeasurementValidation* pixCluster = pix;
141 static const SG::AuxElement::ConstAccessor< std::vector<unsigned int> > truthIndexAcc("truth_index");
142 if (truthIndexAcc.isAvailable(*pixCluster)) {
143 const std::vector<unsigned int> &truth_indices = truthIndexAcc(*pixCluster);
144 for (auto index : truth_indices) {
145 if (index != std::numeric_limits<unsigned int>::max()) {
146 if (index < truthIndexMap.size() && truthIndexMap[index] != std::numeric_limits<unsigned int>::max()) {
147 ++tp_clustercount.at(truthIndexMap[index])[kPixel];
148 }
149 else {
150 ++missing_truth_particle;
151 }
152 }
153 }
154 }
155 } // Loop over PIX clusters
156 }
157 m_nMissingTruthParticles += missing_truth_particle;
158
159 if (not float_decor.empty()) {
160 Amg::Vector3D perigeePos;
162 if (m_useTruthPVAsPerigee && truthVtx) {
163 perigeePos = Amg::Vector3D(truthVtx->x(), truthVtx->y(), truthVtx->z());
164 }
165 else {
166 SG::ReadDecorHandle<xAOD::EventInfo, float> beamPosX(m_beamSpotDecoKey[0], ctx);
167 SG::ReadDecorHandle<xAOD::EventInfo, float> beamPosY(m_beamSpotDecoKey[1], ctx);
168 SG::ReadDecorHandle<xAOD::EventInfo, float> beamPosZ(m_beamSpotDecoKey[2], ctx);
169 perigeePos = Amg::Vector3D(beamPosX(0), beamPosY(0), beamPosZ(0));
170 }
171 for (const xAOD::TruthParticle *truth_particle : *ptruth) {
172 decorateTruth(*truth_particle, float_decor, perigeePos, tp_clustercount);
173 }
174 if (m_decoTime) {
175 if (!decorateTruthTime(float_decor)) {
176 return StatusCode::FAILURE;
177 }
178 }
179 }
180
181 return StatusCode::SUCCESS;
182}
bool msgLvl(const MSG::Level lvl) const
bool decorateTruth(const xAOD::TruthParticle &particle, std::vector< std::pair< SG::WriteDecorHandle< xAOD::TruthParticleContainer, float >, bool > > &float_decor, const Amg::Vector3D &perigeePos, const std::vector< std::array< uint16_t, kNClusterTypes > > &counts) const
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_truthParticleIndexDecor
std::vector< std::pair< SG::WriteDecorHandleKey< xAOD::TruthParticleContainer >, SG::AuxElement::ConstAccessor< float > > > m_decor
SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainer > m_truthPixelClusterName
TruthPixelClusterContainer and TruthSCTClusterContainer needed for truth silicon hit cut.
std::atomic< std::size_t > m_nMissingTruthParticles
SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainer > m_truthSCTClusterName
SG::ReadDecorHandleKeyArray< xAOD::EventInfo > m_beamSpotDecoKey
bool decorateTruthTime(std::vector< std::pair< SG::WriteDecorHandle< xAOD::TruthParticleContainer, float >, bool > > &float_decor) const
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleName
TruthParticle container's name needed to create decorators.
const TruthVertex * signalProcessVertex() const
Pointer to a vertex representing the primary beam interaction point.
float z() const
Vertex longitudinal distance along the beam line form the origin.
float y() const
Vertex y displacement.
float x() const
Vertex x displacement.
std::vector< OptionalDecoration< T_Cont, T > > createDecoratorsIfNeeded(const T_Cont &container, const std::vector< WriteKeyAccessorPair< T_Cont, T > > &keys, const EventContext &ctx, bool verbose=false)
@ u
Enums for curvilinear frames.
Definition ParamDefs.h:77
TrackMeasurementValidation_v1 TrackMeasurementValidation
Reference the current persistent version:
TruthParticle_v1 TruthParticle
Typedef to implementation.

◆ 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 & AthCommonAlgorithm< 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 89 of file AthCommonAlgorithm.cxx.

54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
61}
Common base class for algorithms.

◆ filterPassed()

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

Get filter decision:

Definition at line 93 of file AthCommonAlgorithm.h.

93 {
94 return execState( ctx ).filterPassed();
95 }
virtual bool filterPassed(const EventContext &ctx) const
Get filter decision:

◆ finalize()

StatusCode InDetPhysValTruthDecoratorAlg::finalize ( )
virtual

Definition at line 66 of file InDetPhysValTruthDecoratorAlg.cxx.

66 {
68 ATH_MSG_INFO( "Clusters which reference missing / thinned truth particles : " << m_nMissingTruthParticles );
69 }
70 return StatusCode::SUCCESS;
71}
#define ATH_MSG_INFO(x,...)

◆ getTruthHSEvent()

const xAOD::TruthEvent * InDetPhysValTruthDecoratorAlg::getTruthHSEvent ( ) const
private

Definition at line 262 of file InDetPhysValTruthDecoratorAlg.cxx.

262 {
263 const EventContext& ctx = Gaudi::Hive::currentContext();
264 const xAOD::TruthEvent* event = nullptr;
265 if (!m_truthEventName.key().empty()) {
266 ATH_MSG_VERBOSE("Getting TruthEventContainer");
267 SG::ReadHandle<xAOD::TruthEventContainer> truthEventContainer(m_truthEventName, ctx);
268 if (truthEventContainer.isPresent()) {
269 event = (truthEventContainer.isValid()) ? truthEventContainer->at(0) : nullptr;
270 }
271 else {
272 ATH_MSG_WARNING("TruthEventContainer name was specified, but no container is present");
273 }
274 }
275 else {
276 ATH_MSG_ERROR("No valid TruthEvent!");
277 }
278 return event;
279}

◆ initialize()

StatusCode InDetPhysValTruthDecoratorAlg::initialize ( )
virtual

Definition at line 36 of file InDetPhysValTruthDecoratorAlg.cxx.

36 {
37 ATH_CHECK(m_extrapolator.retrieve());
38 ATH_CHECK(m_beamSpotDecoKey.initialize());
39 ATH_CHECK( m_truthPixelClusterName.initialize() );
40 ATH_CHECK( m_truthSCTClusterName.initialize() );
41
42 ATH_CHECK( m_truthParticleName.initialize());
44
45 ATH_CHECK(m_truthEventName.initialize(!m_truthEventName.key().empty()));
47
48 std::vector<std::string> decor_names(kNDecorators);
49 decor_names[kDecorD0]="d0";
50 decor_names[kDecorZ0]="z0";
51 decor_names[kDecorPhi]="phi";
52 decor_names[kDecorTheta]="theta";
53 decor_names[kDecorZ0st]="z0st";
54 decor_names[kDecorQOverP]="qOverP";
55 decor_names[kDecorProdR]="prodR";
56 decor_names[kDecorProdZ]="prodZ";
57 decor_names[kDecorNSilHits]="nSilHits";
58 decor_names[kDecorTime]="time";
59
61 assert( m_decor.size() == kNDecorators);
62 return StatusCode::SUCCESS;
63}
#define ATH_CHECK
Evaluate an expression and check for errors.
Gaudi::Property< std::string > m_prefix
void createDecoratorKeysAndAccessor(T_Parent &parent, const SG::ReadHandleKey< T_Cont > &container_key, const std::string &prefix, const std::vector< std::string > &decor_names, std::vector< WriteKeyAccessorPair< T_Cont, T > > &decor_out)

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

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::isClonable ( ) const
inlineoverridevirtualinherited

Specify if the algorithm is clonable.

Only relevant for non-reentrant algorithms. Actual number of clones needs to be set via the "Cardinality" property.

Reimplemented in AFP_DigiTop, AlgB, AlgT, BCM_Digitization, CscDigitBuilder, CscDigitToCscRDO, G4AtlasAlg, G4RunAlg, HGTD_Digitization, HiveAlgBase, InDet::GNNSeedingTrackMaker, InDet::SCT_Clusterization, InDet::SiSPGNNTrackMaker, InDet::SiSPSeededTrackFinder, InDet::SiTrackerSpacePointFinder, ISF::SimKernelMT, ITk::StripDigitization, ITkPixelCablingAlg, ITkStripCablingAlg, LArHitEMapMaker, LArTTL1Maker, LUCID_DigiTop, LVL1::L1TopoSimulation, MergeCalibHits, MergeGenericMuonSimHitColl, MergeHijingPars, MergeMcEventCollection, MergeTrackRecordCollection, MergeTruthJets, MergeTruthParticles, MuonDigitizer, PileUpMTAlg, PixelDigitization, RoIBResultToxAOD, SCT_ByteStreamErrorsTestAlg, SCT_CablingCondAlgFromCoraCool, SCT_CablingCondAlgFromText, SCT_ConditionsParameterTestAlg, SCT_ConditionsSummaryTestAlg, SCT_ConfigurationConditionsTestAlg, SCT_Digitization, SCT_FlaggedConditionTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_PrepDataToxAOD, SCT_RawDataToxAOD, SCT_ReadCalibChipDataTestAlg, SCT_ReadCalibDataTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_SiliconConditionsTestAlg, SCT_StripVetoTestAlg, SCT_TdaqEnabledTestAlg, SCT_TestCablingAlg, SCTEventFlagWriter, SCTRawDataProvider, SCTSiLorentzAngleTestAlg, SCTSiPropertiesTestAlg, SGInputLoader, Simulation::BeamEffectsAlg, TileHitVecToCnt, TileMuonFitter, TilePulseForTileMuonReceiver, TileRawChannelMaker, TRTDigitization, and ZDC_DigiTop.

Definition at line 68 of file AthCommonAlgorithm.h.

68 {
69 return true;
70 }

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

◆ setFilterPassed()

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

Set filter decision:

Reimplemented in AthFilterAlgorithm.

Definition at line 99 of file AthCommonAlgorithm.h.

99 {
101 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Set filter decision:

◆ sysExecute()

StatusCode AthCommonAlgorithm< 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.

Reimplemented in AthAnalysisAlgorithm.

Definition at line 80 of file AthCommonAlgorithm.cxx.

41{
42 return BaseAlg::sysExecute (ctx);
43}

◆ sysInitialize()

StatusCode AthCommonAlgorithm< 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 AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, HypoBase, InputMakerBase, and PyAthena::Alg.

Definition at line 60 of file AthCommonAlgorithm.cxx.

71 {
73
74 if (sc.isFailure()) {
75 return sc;
76 }
77
78 ServiceHandle<ICondSvc> cs("CondSvc",name());
79 for (auto h : outputHandles()) {
80 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
81 // do this inside the loop so we don't create the CondSvc until needed
82 if ( cs.retrieve().isFailure() ) {
83 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
85 }
86 if (cs->regHandle(this,*h).isFailure()) {
88 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
89 << " with CondSvc");
90 }
91 }
92 }
93 return sc;
94}
virtual StatusCode sysInitialize() override
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

◆ m_beamSpotDecoKey

SG::ReadDecorHandleKeyArray<xAOD::EventInfo> InDetPhysValTruthDecoratorAlg::m_beamSpotDecoKey
private
Initial value:
{this, "BeamSpotDecoKeys",
{"EventInfo.beamPosX", "EventInfo.beamPosY", "EventInfo.beamPosZ"},
"Beamspot position decoration keys"}

Definition at line 58 of file InDetPhysValTruthDecoratorAlg.h.

59 {this, "BeamSpotDecoKeys",
60 {"EventInfo.beamPosX", "EventInfo.beamPosY", "EventInfo.beamPosZ"},
61 "Beamspot position decoration keys"};

◆ m_decor

std::vector< std::pair<SG::WriteDecorHandleKey<xAOD::TruthParticleContainer>,SG::AuxElement::ConstAccessor<float> > > InDetPhysValTruthDecoratorAlg::m_decor
private

Definition at line 108 of file InDetPhysValTruthDecoratorAlg.h.

◆ m_decoTime

Gaudi::Property<bool> InDetPhysValTruthDecoratorAlg::m_decoTime {this, "decorateTime", false}
private

Definition at line 73 of file InDetPhysValTruthDecoratorAlg.h.

73{this, "decorateTime", false};

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

std::atomic<bool> InDetPhysValTruthDecoratorAlg::m_errorEmitted {false}
mutableprivate

Definition at line 64 of file InDetPhysValTruthDecoratorAlg.h.

64{false};

◆ 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 AthCommonAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

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

Empty if no symlinks were found.

Definition at line 108 of file AthCommonAlgorithm.h.

◆ m_extrapolator

PublicToolHandle<Trk::IExtrapolator> InDetPhysValTruthDecoratorAlg::m_extrapolator {this,"Extrapolator","Trk::Extrapolator/AtlasExtrapolator",""}
private

Definition at line 56 of file InDetPhysValTruthDecoratorAlg.h.

57{this,"Extrapolator","Trk::Extrapolator/AtlasExtrapolator",""};

◆ m_nMissingTruthParticles

std::atomic<std::size_t> InDetPhysValTruthDecoratorAlg::m_nMissingTruthParticles = 0u
mutableprivate

Definition at line 63 of file InDetPhysValTruthDecoratorAlg.h.

◆ m_prefix

Gaudi::Property<std::string> InDetPhysValTruthDecoratorAlg::m_prefix {this, "Prefix", "", "Decoration prefix to avoid clashes."}
private

Definition at line 70 of file InDetPhysValTruthDecoratorAlg.h.

71{this, "Prefix", "", "Decoration prefix to avoid clashes."};

◆ m_truthEventName

SG::ReadHandleKey<xAOD::TruthEventContainer> InDetPhysValTruthDecoratorAlg::m_truthEventName {this, "TruthEventContainerName", "TruthEvents", ""}
private

Definition at line 85 of file InDetPhysValTruthDecoratorAlg.h.

86{this, "TruthEventContainerName", "TruthEvents", ""};

◆ m_truthParticleIndexDecor

SG::ReadDecorHandleKey<xAOD::TruthParticleContainer> InDetPhysValTruthDecoratorAlg::m_truthParticleIndexDecor {this, "TruthParticleIndexDecoration", m_truthParticleName, "origTruthIndex", "decoration name for the original truth particle index."}
private

Definition at line 82 of file InDetPhysValTruthDecoratorAlg.h.

83{this, "TruthParticleIndexDecoration", m_truthParticleName, "origTruthIndex", "decoration name for the original truth particle index."};

◆ m_truthParticleName

SG::ReadHandleKey<xAOD::TruthParticleContainer> InDetPhysValTruthDecoratorAlg::m_truthParticleName {this, "TruthParticleContainerName", "TruthParticles", ""}
private

TruthParticle container's name needed to create decorators.

Definition at line 67 of file InDetPhysValTruthDecoratorAlg.h.

68{this, "TruthParticleContainerName", "TruthParticles", ""};

◆ m_truthPileupEventName

SG::ReadHandleKey<xAOD::TruthPileupEventContainer> InDetPhysValTruthDecoratorAlg::m_truthPileupEventName {this, "TruthPileupEventContainerName", "TruthPileupEvents", ""}
private

Definition at line 88 of file InDetPhysValTruthDecoratorAlg.h.

89{this, "TruthPileupEventContainerName", "TruthPileupEvents", ""};

◆ m_truthPixelClusterName

SG::ReadHandleKey<xAOD::TrackMeasurementValidationContainer> InDetPhysValTruthDecoratorAlg::m_truthPixelClusterName {this, "PixelClusterContainerName", "PixelClusters", ""}
private

TruthPixelClusterContainer and TruthSCTClusterContainer needed for truth silicon hit cut.

Definition at line 76 of file InDetPhysValTruthDecoratorAlg.h.

77{this, "PixelClusterContainerName", "PixelClusters", ""};

◆ m_truthSCTClusterName

SG::ReadHandleKey<xAOD::TrackMeasurementValidationContainer> InDetPhysValTruthDecoratorAlg::m_truthSCTClusterName {this, "SCTClusterContainerName", "SCT_Clusters", ""}
private

Definition at line 79 of file InDetPhysValTruthDecoratorAlg.h.

80{this, "SCTClusterContainerName", "SCT_Clusters", ""};

◆ m_useTruthPVAsPerigee

Gaudi::Property<bool> InDetPhysValTruthDecoratorAlg::m_useTruthPVAsPerigee {this, "UseTruthPVAsPerigee", false, "Use the truth PV to calculate the perigee parameters instead of the BS"}
private

Definition at line 91 of file InDetPhysValTruthDecoratorAlg.h.

92{this, "UseTruthPVAsPerigee", false, "Use the truth PV to calculate the perigee parameters instead of the BS"};

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