ATLAS Offline Software
Loading...
Searching...
No Matches
L0Muon::TgcL0TruthValidationAlg Class Referencefinal

Calculates event-local TGC truth-validation quantities. More...

#include <TgcL0TruthValidationAlg.h>

Inheritance diagram for L0Muon::TgcL0TruthValidationAlg:
Collaboration diagram for L0Muon::TgcL0TruthValidationAlg:

Public Member Functions

StatusCode initialize () override
StatusCode execute (const EventContext &ctx) const override
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

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< TgcL0CandidateContainerm_candidateKey
SG::ReadHandleKey< TgcL0SegmentContainerm_segmentKey
SG::ReadHandleKey< McEventCollectionm_truthEventKey
SG::WriteHandleKey< TgcL0ValidationEventm_outputKey
ToolHandle< Trk::IExtrapolatorm_extrapolator
Gaudi::Property< float > m_maxMeanDeltaR
Gaudi::Property< float > m_maxWireSegmentDeltaEta
Gaudi::Property< float > m_maxStripSegmentDeltaPhi
Gaudi::Property< double > m_minPt
Gaudi::Property< double > m_minAbsEta
Gaudi::Property< double > m_maxAbsEta
Gaudi::Property< int > m_requiredTruthStatus
Gaudi::Property< int > m_maxAbsBarcode
Gaudi::Property< int > m_requiredBcTag
Gaudi::Property< std::vector< double > > m_stationAbsZ
Gaudi::Property< double > m_validationMinR
Gaudi::Property< double > m_validationMaxR
Gaudi::Property< double > m_validationPlaneToleranceZ
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

Calculates event-local TGC truth-validation quantities.

The algorithm has no ROOT or histogram dependency. Its transient output can be consumed by replaceable validation-output backends.

Definition at line 25 of file TgcL0TruthValidationAlg.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 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>

◆ 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 L0Muon::TgcL0TruthValidationAlg::execute ( const EventContext & ctx) const
override

Definition at line 145 of file TgcL0TruthValidationAlg.cxx.

145 {
146 SG::ReadHandle<TgcL0CandidateContainer> candidates{m_candidateKey, ctx};
147 if (!candidates.isValid()) {
148 ATH_MSG_ERROR("Failed to retrieve " << m_candidateKey.fullKey());
149 return StatusCode::FAILURE;
150 }
151 SG::ReadHandle<TgcL0SegmentContainer> segments{m_segmentKey, ctx};
152 if (!segments.isValid()) {
153 ATH_MSG_ERROR("Failed to retrieve " << m_segmentKey.fullKey());
154 return StatusCode::FAILURE;
155 }
156 SG::ReadHandle<McEventCollection> truthEvents{m_truthEventKey, ctx};
157 if (!truthEvents.isValid()) {
158 ATH_MSG_ERROR("Failed to retrieve " << m_truthEventKey.fullKey());
159 return StatusCode::FAILURE;
160 }
161
162 auto output = std::make_unique<TgcL0ValidationEvent>();
163 output->event.runNumber = ctx.eventID().run_number();
164 output->event.eventNumber = ctx.eventID().event_number();
165 output->event.lumiBlock = ctx.eventID().lumi_block();
166 output->event.bcid = ctx.eventID().bunch_crossing_id();
167
168 const auto processParticle = [&](const auto& particle) -> StatusCode {
169 if (!particle || std::abs(particle->pdg_id()) != 13 ||
170 particle->status() != m_requiredTruthStatus.value() ||
171 std::abs(HepMC::barcode(particle)) > m_maxAbsBarcode.value()) {
172 return StatusCode::SUCCESS;
173 }
174
175 const auto& momentum = particle->momentum();
176 const double pt = momentum.perp();
177 const double eta = momentum.eta();
178 const double phi = momentum.phi();
179 if (pt < m_minPt.value() || std::abs(eta) < m_minAbsEta.value() ||
180 std::abs(eta) > m_maxAbsEta.value() || !std::isfinite(phi)) {
181 return StatusCode::SUCCESS;
182 }
183
184 const int pdgId = particle->pdg_id();
185 const double theta = 2.0 * std::atan(std::exp(-eta));
186 const double momentumMagnitude = pt * std::cosh(eta);
187 if (momentumMagnitude <= 0.0 || !std::isfinite(theta)) {
188 return StatusCode::SUCCESS;
189 }
190
191 const double charge = pdgId == 13 ? -1.0 : 1.0;
192 const Trk::PerigeeSurface perigeeSurface{Amg::Vector3D{0.0, 0.0, 0.0}};
193 const Trk::Perigee perigee{0.0, 0.0, phi, theta,
194 charge / momentumMagnitude, perigeeSurface};
195
196 StationPositions positions{};
197 std::uint8_t stationMask{0U};
198 const std::vector<double>& stationAbsZ = m_stationAbsZ.value();
199 for (std::size_t station = 0U; station < positions.size(); ++station) {
200 const double z = eta >= 0.0 ? stationAbsZ[station] : -stationAbsZ[station];
201 Amg::Transform3D transform = Amg::Transform3D::Identity();
202 transform.translation().z() = z;
203 const Trk::DiscSurface disc{transform, m_validationMinR.value(),
204 m_validationMaxR.value()};
205 const Trk::BoundaryCheck boundaryCheck{true};
206 const auto extrapolated = m_extrapolator->extrapolate(
207 ctx, perigee, disc, Trk::alongMomentum, boundaryCheck, Trk::muon);
208 if (!extrapolated) continue;
209 const Amg::Vector3D& position = extrapolated->position();
210 if (!std::isfinite(position.eta()) || !std::isfinite(position.phi()) ||
211 std::abs(position.z() - z) > m_validationPlaneToleranceZ.value()) {
212 continue;
213 }
214 positions[station] = StationPosition{
215 true, static_cast<float>(position.eta()),
216 static_cast<float>(xAOD::P4Helpers::deltaPhi(position.phi(), 0.))};
217 stationMask |= stationBit(station);
218 }
219
220 output->truth.pdgId.emplace_back(pdgId);
221 output->truth.barcode.emplace_back(HepMC::barcode(particle));
222 output->truth.pt.emplace_back(static_cast<float>(pt));
223 output->truth.eta.emplace_back(static_cast<float>(eta));
224 output->truth.phi.emplace_back(static_cast<float>(phi));
225 output->truth.charge.emplace_back(static_cast<float>(charge));
226 output->truth.extrapolatedStationMask.emplace_back(stationMask);
227 output->truth.m1Eta.emplace_back(positions[0].eta);
228 output->truth.m1Phi.emplace_back(positions[0].phi);
229 output->truth.m2Eta.emplace_back(positions[1].eta);
230 output->truth.m2Phi.emplace_back(positions[1].phi);
231 output->truth.m3Eta.emplace_back(positions[2].eta);
232 output->truth.m3Phi.emplace_back(positions[2].phi);
233 output->truth.matched.emplace_back(0U);
234 output->truth.matchedCandidateIndex.emplace_back(-1);
235 output->truth.matchMeanDeltaR.emplace_back(TgcL0ValidationInvalidValue);
236 output->truth.unmatchedReason.emplace_back(
237 stationMask == 0x7U
238 ? static_cast<std::uint8_t>(
240 : static_cast<std::uint8_t>(
242 output->truth.wireSegmentMatched.emplace_back(0U);
243 output->truth.stripSegmentMatched.emplace_back(0U);
244 output->truth.matchedWireSegmentIndex.emplace_back(-1);
245 output->truth.matchedStripSegmentIndex.emplace_back(-1);
246 output->truth.wireSegmentMatchResidual.emplace_back(
248 output->truth.stripSegmentMatchResidual.emplace_back(
250 return StatusCode::SUCCESS;
251 };
252
253 for (const HepMC::GenEvent* event : *truthEvents) {
254 if (event == nullptr) continue;
255#if __has_include("HepMC3/GenEvent.h")
256 for (const auto& particle : event->particles()) {
257 ATH_CHECK(processParticle(particle));
258 }
259#else
260 for (auto particle = event->particles_begin();
261 particle != event->particles_end(); ++particle) {
262 ATH_CHECK(processParticle(*particle));
263 }
264#endif
265 }
266
267 for (const TgcL0Candidate& candidate : *candidates) {
268 output->candidates.subdetectorId.emplace_back(candidate.subdetectorId);
269 output->candidates.triggerSector.emplace_back(candidate.sectorId);
270 output->candidates.readoutSector.emplace_back(candidate.readoutSector);
271 output->candidates.bcTag.emplace_back(candidate.bcTag);
272 output->candidates.stationMask.emplace_back(candidate.positionStationMask);
273 output->candidates.wireStationMask.emplace_back(candidate.wireStationMask);
274 output->candidates.stripStationMask.emplace_back(candidate.stripStationMask);
275 output->candidates.eta.emplace_back(candidate.eta);
276 output->candidates.phi.emplace_back(candidate.phi);
277 output->candidates.deltaTheta.emplace_back(candidate.deltaTheta);
278 output->candidates.deltaPhi.emplace_back(candidate.deltaPhi);
279 output->candidates.truthIndex.emplace_back(-1);
280 }
281
282 std::vector<CandidateMatch> candidateMatches;
283 std::vector<bool> hasCandidateInWindow(output->truth.pt.size(), false);
284 for (std::size_t truth = 0U; truth < output->truth.pt.size(); ++truth) {
285 if (output->truth.extrapolatedStationMask[truth] != 0x7U) continue;
286 const StationPositions positions = truthPositions(*output, truth);
287 for (std::size_t candidate = 0U; candidate < candidates->size();
288 ++candidate) {
289 const TgcL0Candidate& inputCandidate = (*candidates)[candidate];
290 if (m_requiredBcTag.value() >= 0 &&
291 inputCandidate.bcTag != static_cast<std::uint16_t>(m_requiredBcTag.value())) {
292 continue;
293 }
294 if (output->truth.eta[truth] * inputCandidate.eta < 0.F) continue;
295 const float residual = meanDeltaR(inputCandidate, positions);
296 if (!std::isfinite(residual) || residual > m_maxMeanDeltaR.value()) continue;
297 hasCandidateInWindow[truth] = true;
298 candidateMatches.push_back({residual, truth, candidate});
299 }
300 }
301 std::stable_sort(candidateMatches.begin(), candidateMatches.end(),
302 [](const CandidateMatch& lhs, const CandidateMatch& rhs) {
303 if (lhs.residual != rhs.residual) {
304 return lhs.residual < rhs.residual;
305 }
306 if (lhs.truth != rhs.truth) return lhs.truth < rhs.truth;
307 return lhs.candidate < rhs.candidate;
308 });
309 for (const CandidateMatch& match : candidateMatches) {
310 if (output->truth.matchedCandidateIndex[match.truth] >= 0 ||
311 output->candidates.truthIndex[match.candidate] >= 0) {
312 continue;
313 }
314 output->truth.matched[match.truth] = 1U;
315 output->truth.matchedCandidateIndex[match.truth] =
316 static_cast<int>(match.candidate);
317 output->truth.matchMeanDeltaR[match.truth] = match.residual;
318 output->truth.unmatchedReason[match.truth] =
320 output->candidates.truthIndex[match.candidate] =
321 static_cast<int>(match.truth);
322 }
323 for (std::size_t truth = 0U; truth < output->truth.pt.size(); ++truth) {
324 if (output->truth.matched[truth] != 0U ||
325 output->truth.extrapolatedStationMask[truth] != 0x7U) {
326 continue;
327 }
328 output->truth.unmatchedReason[truth] = static_cast<std::uint8_t>(
329 hasCandidateInWindow[truth]
332 }
333
334 for (const TgcL0Segment& segment : *segments) {
335 output->segments.subdetectorId.emplace_back(segment.subdetectorId);
336 output->segments.triggerSector.emplace_back(segment.triggerSector);
337 output->segments.bcTag.emplace_back(segment.bcTag);
338 output->segments.projection.emplace_back(
339 static_cast<std::uint8_t>(segment.projection));
340 output->segments.stationMask.emplace_back(segment.stationMask);
341 output->segments.summedQuality.emplace_back(segment.summedQuality);
342 output->segments.nStations.emplace_back(segment.nStations);
343 output->segments.eta.emplace_back(segment.eta);
344 output->segments.phi.emplace_back(segment.phi);
345 output->segments.residual.emplace_back(segment.residual);
346 output->segments.outputResidual.emplace_back(segment.outputResidual);
347 output->segments.consistency.emplace_back(segment.consistency);
348 output->segments.pivotChannel.emplace_back(segment.pivotChannel);
349 output->segments.truthIndex.emplace_back(-1);
350 output->segments.truthMatchResidual.emplace_back(
352 }
353
354 const auto matchProjection = [&](const TgcL0ValidationProjection projection,
355 const float maximumResidual) {
356 const auto projectionValue = static_cast<std::uint8_t>(projection);
357 std::vector<SegmentMatch> possibleMatches;
358 for (std::size_t truth = 0U; truth < output->truth.pt.size(); ++truth) {
359 for (std::size_t segment = 0U;
360 segment < output->segments.projection.size(); ++segment) {
361 if (output->segments.projection[segment] != projectionValue) continue;
362 if (m_requiredBcTag.value() >= 0 &&
363 output->segments.bcTag[segment] !=
364 static_cast<std::uint16_t>(m_requiredBcTag.value())) {
365 continue;
366 }
367 if (output->truth.eta[truth] * output->segments.eta[segment] < 0.F) {
368 continue;
369 }
370 const int station = pivotStation(output->segments.stationMask[segment]);
371 if (station < 0 ||
372 (output->truth.extrapolatedStationMask[truth] &
373 stationBit(static_cast<std::size_t>(station))) == 0U) {
374 continue;
375 }
376 const std::array<float, 3> truthEta{
377 output->truth.m1Eta[truth], output->truth.m2Eta[truth],
378 output->truth.m3Eta[truth]};
379 const std::array<float, 3> truthPhi{
380 output->truth.m1Phi[truth], output->truth.m2Phi[truth],
381 output->truth.m3Phi[truth]};
382 const float residual =
384 ? std::abs(output->segments.eta[segment] - truthEta[station])
385 : std::abs(static_cast<float>(xAOD::P4Helpers::deltaPhi(
386 output->segments.phi[segment], truthPhi[station])));
387 if (std::isfinite(residual) && residual <= maximumResidual) {
388 possibleMatches.push_back({residual, truth, segment});
389 }
390 }
391 }
392 std::stable_sort(possibleMatches.begin(), possibleMatches.end(),
393 [](const SegmentMatch& lhs, const SegmentMatch& rhs) {
394 if (lhs.residual != rhs.residual) {
395 return lhs.residual < rhs.residual;
396 }
397 if (lhs.truth != rhs.truth) return lhs.truth < rhs.truth;
398 return lhs.segment < rhs.segment;
399 });
400 for (const SegmentMatch& match : possibleMatches) {
401 int& truthSegment =
403 ? output->truth.matchedWireSegmentIndex[match.truth]
404 : output->truth.matchedStripSegmentIndex[match.truth];
405 if (truthSegment >= 0 ||
406 output->segments.truthIndex[match.segment] >= 0) {
407 continue;
408 }
409 truthSegment = static_cast<int>(match.segment);
410 output->segments.truthIndex[match.segment] =
411 static_cast<int>(match.truth);
412 output->segments.truthMatchResidual[match.segment] = match.residual;
413 if (projection == TgcL0ValidationProjection::Wire) {
414 output->truth.wireSegmentMatched[match.truth] = 1U;
415 output->truth.wireSegmentMatchResidual[match.truth] = match.residual;
416 } else {
417 output->truth.stripSegmentMatched[match.truth] = 1U;
418 output->truth.stripSegmentMatchResidual[match.truth] = match.residual;
419 }
420 }
421 };
422
423 matchProjection(TgcL0ValidationProjection::Wire,
425 matchProjection(TgcL0ValidationProjection::Strip,
427
428 const TgcL0ValidationCheckResult check = checkTgcL0ValidationEvent(*output);
429 if (!check.valid) {
430 ATH_MSG_ERROR("Refusing to record inconsistent validation data: "
431 << check.message);
432 return StatusCode::FAILURE;
433 }
434
435 SG::WriteHandle<TgcL0ValidationEvent> outputHandle{m_outputKey, ctx};
436 ATH_CHECK(outputHandle.record(std::move(output)));
437 return StatusCode::SUCCESS;
438}
Scalar eta() const
pseudorapidity method
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
Scalar phi() const
phi method
Scalar theta() const
theta method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
double charge(const T &p)
Definition AtlasPID.h:997
if(pathvar)
#define z
Gaudi::Property< float > m_maxMeanDeltaR
Gaudi::Property< int > m_requiredTruthStatus
SG::WriteHandleKey< TgcL0ValidationEvent > m_outputKey
Gaudi::Property< std::vector< double > > m_stationAbsZ
Gaudi::Property< double > m_validationMinR
SG::ReadHandleKey< TgcL0CandidateContainer > m_candidateKey
Gaudi::Property< double > m_validationMaxR
SG::ReadHandleKey< TgcL0SegmentContainer > m_segmentKey
Gaudi::Property< float > m_maxStripSegmentDeltaPhi
Gaudi::Property< double > m_minAbsEta
Gaudi::Property< double > m_maxAbsEta
Gaudi::Property< float > m_maxWireSegmentDeltaEta
Gaudi::Property< double > m_validationPlaneToleranceZ
ToolHandle< Trk::IExtrapolator > m_extrapolator
SG::ReadHandleKey< McEventCollection > m_truthEventKey
virtual bool isValid() override final
Can the handle be successfully dereferenced?
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition hcg.cxx:359
Eigen::Affine3d Transform3D
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Eigen::Matrix< double, 3, 1 > Vector3D
int barcode(const T *p)
Definition Barcode.h:15
HepMC3::GenEvent GenEvent
Definition GenEvent.h:39
TgcL0ValidationProjection
Projection encoding used in the validation segment block.
TgcL0ValidationCheckResult checkTgcL0ValidationEvent(const TgcL0ValidationEvent &event)
Check vector sizes and reciprocal cross-block indices.
static constexpr float TgcL0ValidationInvalidValue
Common sentinel for unavailable floating-point validation data.
static constexpr std::uint8_t TgcL0ValidationNoUnmatchedReason
Sentinel indicating that a matched truth object has no failure code.
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
@ alongMomentum
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
const Amg::Vector3D & position() const
Method to retrieve the position of the Intersection.
output
Definition merge.py:16
void stable_sort(DataModel_detail::iterator< DVL > beg, DataModel_detail::iterator< DVL > end)
Specialization of stable_sort for DataVector/List.
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[

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

◆ initialize()

StatusCode L0Muon::TgcL0TruthValidationAlg::initialize ( )
override

Definition at line 116 of file TgcL0TruthValidationAlg.cxx.

116 {
117 ATH_CHECK(m_candidateKey.initialize());
118 ATH_CHECK(m_segmentKey.initialize());
119 ATH_CHECK(m_truthEventKey.initialize());
120 ATH_CHECK(m_outputKey.initialize());
121 ATH_CHECK(m_extrapolator.retrieve());
122
123 if (m_stationAbsZ.value().size() != 3U) {
124 ATH_MSG_ERROR("StationAbsZ must contain exactly M1, M2, and M3 values");
125 return StatusCode::FAILURE;
126 }
127 if (m_validationMinR.value() < 0.0 || m_validationMaxR.value() <= m_validationMinR.value()) {
128 ATH_MSG_ERROR("Validation radii are invalid: min=" << m_validationMinR.value()
129 << ", max=" << m_validationMaxR.value());
130 return StatusCode::FAILURE;
131 }
132 if (m_validationPlaneToleranceZ.value() < 0.0) {
133 ATH_MSG_ERROR("ValidationPlaneToleranceZ must be non-negative");
134 return StatusCode::FAILURE;
135 }
136 if (m_requiredBcTag.value() < -1 ||
137 m_requiredBcTag.value() >
138 static_cast<int>(std::numeric_limits<std::uint16_t>::max())) {
139 ATH_MSG_ERROR("RequiredBcTag must be -1 or a uint16 value");
140 return StatusCode::FAILURE;
141 }
142 return StatusCode::SUCCESS;
143}

◆ 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}
#define ATH_MSG_WARNING(x)
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_candidateKey

SG::ReadHandleKey<TgcL0CandidateContainer> L0Muon::TgcL0TruthValidationAlg::m_candidateKey
private
Initial value:
{
this, "CandidateKey", "L0MuonTGCValidationCandidates",
"Pre-Inner-Coincidence transient candidates"}

Definition at line 33 of file TgcL0TruthValidationAlg.h.

33 {
34 this, "CandidateKey", "L0MuonTGCValidationCandidates",
35 "Pre-Inner-Coincidence transient candidates"};

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

ToolHandle<Trk::IExtrapolator> L0Muon::TgcL0TruthValidationAlg::m_extrapolator
private
Initial value:
{
this, "TrackExtrapolator", "", "Truth-only extrapolator"}

Definition at line 44 of file TgcL0TruthValidationAlg.h.

44 {
45 this, "TrackExtrapolator", "", "Truth-only extrapolator"};

◆ m_maxAbsBarcode

Gaudi::Property<int> L0Muon::TgcL0TruthValidationAlg::m_maxAbsBarcode
private
Initial value:
{
this, "MaxAbsBarcode", 9999,
"Maximum absolute HepMC barcode for selected truth muons"}

Definition at line 65 of file TgcL0TruthValidationAlg.h.

65 {
66 this, "MaxAbsBarcode", 9999,
67 "Maximum absolute HepMC barcode for selected truth muons"};

◆ m_maxAbsEta

Gaudi::Property<double> L0Muon::TgcL0TruthValidationAlg::m_maxAbsEta
private
Initial value:
{
this, "MaxTruthAbsEta", 2.50, "Maximum absolute truth eta"}

Definition at line 60 of file TgcL0TruthValidationAlg.h.

60 {
61 this, "MaxTruthAbsEta", 2.50, "Maximum absolute truth eta"};

◆ m_maxMeanDeltaR

Gaudi::Property<float> L0Muon::TgcL0TruthValidationAlg::m_maxMeanDeltaR
private
Initial value:
{
this, "TruthMatchMaxMeanDeltaR", 0.08F,
"Maximum station-averaged deltaR for truth matching"}

Definition at line 47 of file TgcL0TruthValidationAlg.h.

47 {
48 this, "TruthMatchMaxMeanDeltaR", 0.08F,
49 "Maximum station-averaged deltaR for truth matching"};

◆ m_maxStripSegmentDeltaPhi

Gaudi::Property<float> L0Muon::TgcL0TruthValidationAlg::m_maxStripSegmentDeltaPhi
private
Initial value:
{
this, "TruthStripSegmentMaxDeltaPhi", 0.08F,
"Maximum |delta phi| for truth-to-strip-segment matching"}

Definition at line 53 of file TgcL0TruthValidationAlg.h.

53 {
54 this, "TruthStripSegmentMaxDeltaPhi", 0.08F,
55 "Maximum |delta phi| for truth-to-strip-segment matching"};

◆ m_maxWireSegmentDeltaEta

Gaudi::Property<float> L0Muon::TgcL0TruthValidationAlg::m_maxWireSegmentDeltaEta
private
Initial value:
{
this, "TruthWireSegmentMaxDeltaEta", 0.08F,
"Maximum |delta eta| for truth-to-wire-segment matching"}

Definition at line 50 of file TgcL0TruthValidationAlg.h.

50 {
51 this, "TruthWireSegmentMaxDeltaEta", 0.08F,
52 "Maximum |delta eta| for truth-to-wire-segment matching"};

◆ m_minAbsEta

Gaudi::Property<double> L0Muon::TgcL0TruthValidationAlg::m_minAbsEta
private
Initial value:
{
this, "MinTruthAbsEta", 0.95, "Minimum absolute truth eta"}

Definition at line 58 of file TgcL0TruthValidationAlg.h.

58 {
59 this, "MinTruthAbsEta", 0.95, "Minimum absolute truth eta"};

◆ m_minPt

Gaudi::Property<double> L0Muon::TgcL0TruthValidationAlg::m_minPt
private
Initial value:
{
this, "MinTruthPt", 2000.0, "Minimum truth-muon pT in MeV"}

Definition at line 56 of file TgcL0TruthValidationAlg.h.

56 {
57 this, "MinTruthPt", 2000.0, "Minimum truth-muon pT in MeV"};

◆ m_outputKey

SG::WriteHandleKey<TgcL0ValidationEvent> L0Muon::TgcL0TruthValidationAlg::m_outputKey
private
Initial value:
{
this, "OutputKey", "L0MuonTGCValidationEvent",
"Calculated event-local truth-validation data"}

Definition at line 41 of file TgcL0TruthValidationAlg.h.

41 {
42 this, "OutputKey", "L0MuonTGCValidationEvent",
43 "Calculated event-local truth-validation data"};

◆ m_requiredBcTag

Gaudi::Property<int> L0Muon::TgcL0TruthValidationAlg::m_requiredBcTag
private
Initial value:
{
this, "RequiredBcTag", 0,
"BC tag used for truth matching; set to -1 to disable the filter"}

Definition at line 68 of file TgcL0TruthValidationAlg.h.

68 {
69 this, "RequiredBcTag", 0,
70 "BC tag used for truth matching; set to -1 to disable the filter"};

◆ m_requiredTruthStatus

Gaudi::Property<int> L0Muon::TgcL0TruthValidationAlg::m_requiredTruthStatus
private
Initial value:
{
this, "RequiredTruthStatus", 1,
"Generator status required for selected truth muons"}

Definition at line 62 of file TgcL0TruthValidationAlg.h.

62 {
63 this, "RequiredTruthStatus", 1,
64 "Generator status required for selected truth muons"};

◆ m_segmentKey

SG::ReadHandleKey<TgcL0SegmentContainer> L0Muon::TgcL0TruthValidationAlg::m_segmentKey
private
Initial value:
{
this, "SegmentKey", "L0MuonTGCValidationSegments",
"Projection segments published by reconstruction"}

Definition at line 36 of file TgcL0TruthValidationAlg.h.

36 {
37 this, "SegmentKey", "L0MuonTGCValidationSegments",
38 "Projection segments published by reconstruction"};

◆ m_stationAbsZ

Gaudi::Property<std::vector<double> > L0Muon::TgcL0TruthValidationAlg::m_stationAbsZ
private
Initial value:
{
this, "StationAbsZ", {13436.5, 14728.2, 15148.2},
"Nominal absolute z positions of the M1, M2, and M3 validation planes"}

Definition at line 71 of file TgcL0TruthValidationAlg.h.

71 {
72 this, "StationAbsZ", {13436.5, 14728.2, 15148.2},
73 "Nominal absolute z positions of the M1, M2, and M3 validation planes"};

◆ m_truthEventKey

SG::ReadHandleKey<McEventCollection> L0Muon::TgcL0TruthValidationAlg::m_truthEventKey
private
Initial value:
{
this, "TruthEventKey", "TruthEvent", "Input truth-event collection"}

Definition at line 39 of file TgcL0TruthValidationAlg.h.

39 {
40 this, "TruthEventKey", "TruthEvent", "Input truth-event collection"};

◆ m_validationMaxR

Gaudi::Property<double> L0Muon::TgcL0TruthValidationAlg::m_validationMaxR
private
Initial value:
{
this, "ValidationMaxR", 11977.0,
"Maximum radius of the truth-extrapolation validation planes"}

Definition at line 77 of file TgcL0TruthValidationAlg.h.

77 {
78 this, "ValidationMaxR", 11977.0,
79 "Maximum radius of the truth-extrapolation validation planes"};

◆ m_validationMinR

Gaudi::Property<double> L0Muon::TgcL0TruthValidationAlg::m_validationMinR
private
Initial value:
{
this, "ValidationMinR", 0.0,
"Minimum radius of the truth-extrapolation validation planes"}

Definition at line 74 of file TgcL0TruthValidationAlg.h.

74 {
75 this, "ValidationMinR", 0.0,
76 "Minimum radius of the truth-extrapolation validation planes"};

◆ m_validationPlaneToleranceZ

Gaudi::Property<double> L0Muon::TgcL0TruthValidationAlg::m_validationPlaneToleranceZ
private
Initial value:
{
this, "ValidationPlaneToleranceZ", 20.0,
"Maximum distance in z from an extrapolation target plane"}

Definition at line 80 of file TgcL0TruthValidationAlg.h.

80 {
81 this, "ValidationPlaneToleranceZ", 20.0,
82 "Maximum distance in z from an extrapolation target plane"};

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