ATLAS Offline Software
Loading...
Searching...
No Matches
AthExThinning::WriteThinnedData Class Reference

#include <WriteThinnedData.h>

Inheritance diagram for AthExThinning::WriteThinnedData:
Collaboration diagram for AthExThinning::WriteThinnedData:

Public Member Functions

 WriteThinnedData (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor with parameters:
virtual ~WriteThinnedData ()
 Destructor:
virtual StatusCode initialize () override
virtual StatusCode execute (const EventContext &ctx) override
 Execute method.
virtual StatusCode finalize () 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

 WriteThinnedData ()
 Default constructor:
StatusCode test (const EventContext &ctx, int testNum, const std::string &testName)
 Exercise the following thinning tests: [testName = "test1"] retrieve a AthExParticles container remove some of the AthExParticle using an 'AND' filter [testName = "test2"] retrieve a AthExParticles container remove some of the AthExParticle using an 'OR' filter [testName = "test3"] retrieve a AthExIParticles container remove some of the AthExIParticle using an 'AND' filter.
StatusCode doThinningTest1 (const EventContext &ctx, const SG::ThinningHandleKey< AthExParticles > &particlesKey) const
 Apply the real thinning.
StatusCode doThinningTest2 (const EventContext &ctx, const SG::ThinningHandleKey< AthExParticles > &particlesKey) const
 Apply the real thinning.
StatusCode doThinningTest3 (const EventContext &ctx, const SG::ThinningHandleKey< AthExIParticles > &iparticlesKey) const
 Apply the real thinning.
virtual bool isReEntrant () const override final
 Legacy algorithms are not thread-safe.
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

StringProperty m_particlesName
 Particles input location.
SG::ThinningHandleKey< AthExParticles > m_particlesKey1 { this, "ParticlesKey1", "", "" }
SG::ThinningHandleKey< AthExParticles > m_particlesKey2 { this, "ParticlesKey2", "", "" }
SG::ReadHandleKeyArray< AthExIParticles > m_iparticlesKeys { this, "IParticlesKeys", {}, "" }
SG::ThinningHandleKey< AthExIParticles > m_iparticlesKey3 { this, "IParticlesKey3", "", "" }
StringProperty m_decayName { this, "Decay", "TwoBodyDecay", "Input location of Decay" }
 Decay input location.
SG::ReadHandleKeyArray< AthExDecay > m_decayKeys { this, "DecayKeys", {}, "" }
StringProperty m_elephantinoName { this, "Elephantino", "PinkElephantino", "Input location of Elephantino" }
 Elephantino input location.
SG::ReadHandleKeyArray< AthExElephantino > m_elephantinoKeys { this, "ElephantinoKeys", {}, "" }
BooleanArrayProperty m_filter
 Filter to apply on the Particles.

Private Types

typedef ServiceHandle< StoreGateSvc > StoreGateSvc_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

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 58 of file WriteThinnedData.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ WriteThinnedData() [1/2]

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

Constructor with parameters:

Definition at line 41 of file WriteThinnedData.cxx.

42 :
43 ::AthAlgorithm( name, pSvcLocator )
44{
45 //
46 // Property declaration
47 //
48 //declareProperty( "Property", m_nProperty );
49
50 declareProperty( "Particles",
51 m_particlesName = "Particles",
52 "Input location of particles (to be thinned)" );
53
54 declareProperty( "Filter",
55 m_filter,
56 "Filter to apply on Particles (true == keep element)" );
57 std::vector<bool> filter( 10, false );
58 m_filter.set( filter );
59
60}
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
StringProperty m_particlesName
Particles input location.
BooleanArrayProperty m_filter
Filter to apply on the Particles.

◆ ~WriteThinnedData()

WriteThinnedData::~WriteThinnedData ( )
virtual

Destructor:

Definition at line 64 of file WriteThinnedData.cxx.

65{}

◆ WriteThinnedData() [2/2]

AthExThinning::WriteThinnedData::WriteThinnedData ( )
protected

Default constructor:

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 }

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

◆ doThinningTest1()

StatusCode WriteThinnedData::doThinningTest1 ( const EventContext & ctx,
const SG::ThinningHandleKey< AthExParticles > & particlesKey ) const
protected

Apply the real thinning.

Definition at line 215 of file WriteThinnedData.cxx.

217{
218 SG::ThinningHandle<AthExParticles> particles (particlesKey, ctx);
219 std::vector<bool> filter = m_filter.value();
220
221 const double igev = 1. / Gaudi::Units::GeV;
222 ATH_MSG_INFO("Particles | filter :");
223 for ( unsigned int i = 0; i != particles->size(); ++i ) {
224 const std::string kr = filter[i] ? "keep" : "remove";
225 ATH_MSG_INFO("{:9} | {}", (*particles)[i]->px() * igev, kr);
226 }
227 ATH_MSG_INFO("===================");
228
229 std::fill( filter.begin() + (filter.size() / 2),
230 filter.end(),
231 true );
232 ATH_MSG_INFO("Filter {}", filter);
233
234 ATH_MSG_INFO("... Processing [pre-thinning] ...");
235 particles.keep (filter);
236 ATH_MSG_INFO("======== Index table =========");
237 {
238 SG::ThinningDecisionBase tmp = particles.decision();
239 tmp.buildIndexMap();
240 for ( std::size_t i = 0; i != particles->size(); ++i ) {
241 std::size_t newIdx = tmp.index( i );
242 ATH_MSG_INFO(" idx {} -> {}",
243 i,
244 newIdx == SG::ThinningDecision::RemovedIdx ? "-" : std::to_string(newIdx));
245 }
246 }
247
248
249 filter = m_filter.value();
250 std::fill( filter.begin(),
251 filter.begin() + (filter.size() / 2),
252 true );
253
254 ATH_MSG_INFO("Filter {}", filter);
255
256 ATH_MSG_INFO("... Processing [thinning] ...");
258
259 ATH_MSG_INFO("======== Index table =========");
260 {
261 SG::ThinningDecisionBase tmp = particles.decision();
262 tmp.buildIndexMap();
263 for ( std::size_t i = 0; i != particles->size(); ++i ) {
264 std::size_t newIdx = tmp.index( i );
265 ATH_MSG_INFO(" idx {} -> {}",
266 i,
267 newIdx == SG::ThinningDecision::RemovedIdx ? "-" : std::to_string(newIdx));
268 }
269 }
270
271 return StatusCode::SUCCESS;
272}
#define ATH_MSG_INFO(x,...)
static const std::size_t RemovedIdx
Flag used to show that an index has been thinned away.

◆ doThinningTest2()

StatusCode WriteThinnedData::doThinningTest2 ( const EventContext & ctx,
const SG::ThinningHandleKey< AthExParticles > & particlesKey ) const
protected

Apply the real thinning.

Definition at line 275 of file WriteThinnedData.cxx.

277{
278 SG::ThinningHandle<AthExParticles> particles (particlesKey, ctx);
279 std::vector<bool> filter = m_filter.value();
280
281 const double igev = 1. / Gaudi::Units::GeV;
282 ATH_MSG_INFO( "Particles | filter :");
283 for ( unsigned int i = 0; i != particles->size(); ++i ) {
284 const std::string kr = filter[i] ? "keep" : "remove";
285 ATH_MSG_INFO("{:9} | {}",(*particles)[i]->px() * igev, kr);
286 }
287 ATH_MSG_INFO("===================");
288
289 std::fill( filter.begin() + (filter.size() / 2),
290 filter.end(),
291 false );
292 ATH_MSG_INFO("Filter {}", filter);
293
294 ATH_MSG_INFO("... Processing [pre-thinning] ...");
295 particles.keep (filter);
296 ATH_MSG_INFO("======== Index table =========");
297 {
298 SG::ThinningDecisionBase tmp = particles.decision();
299 tmp.buildIndexMap();
300 for ( std::size_t i = 0; i != particles->size(); ++i ) {
301 std::size_t newIdx = tmp.index( i );
302 ATH_MSG_INFO(" idx {} -> {}",
303 i,
304 newIdx == SG::ThinningDecision::RemovedIdx ? "-" : std::to_string(newIdx));
305 }
306 }
307
308
309 filter = m_filter.value();
310 std::fill( filter.begin(),
311 filter.begin() + (filter.size() / 2),
312 false );
313
314 ATH_MSG_INFO("Filter {}", filter);
315
316 ATH_MSG_INFO("... Processing [thinning] ...");
318
319 ATH_MSG_INFO("======== Index table =========");
320 {
321 SG::ThinningDecisionBase tmp = particles.decision();
322 tmp.buildIndexMap();
323 for ( std::size_t i = 0; i != particles->size(); ++i ) {
324 std::size_t newIdx = tmp.index( i );
325 ATH_MSG_INFO(" idx {} -> {}",
326 i,
327 newIdx == SG::ThinningDecision::RemovedIdx ? "-" : std::to_string(newIdx));
328 }
329 }
330
331 return StatusCode::SUCCESS;
332}

◆ doThinningTest3()

StatusCode WriteThinnedData::doThinningTest3 ( const EventContext & ctx,
const SG::ThinningHandleKey< AthExIParticles > & iparticlesKey ) const
protected

Apply the real thinning.

Definition at line 336 of file WriteThinnedData.cxx.

338{
339 SG::ThinningHandle<AthExIParticles> iparticles (iparticlesKey, ctx);
340 std::vector<bool> filter = m_filter.value();
341
342 const double igev = 1. / Gaudi::Units::GeV;
343 ATH_MSG_INFO("IParticles | filter :");
344 for ( unsigned int i = 0; i != iparticles->size(); ++i ) {
345 const std::string kr = filter[i] ? "keep" : "remove";
346 ATH_MSG_INFO("{:9} | {}", (*iparticles)[i]->px() * igev, kr);
347 }
348 ATH_MSG_INFO("===================");
349
350 std::fill( filter.begin() + (filter.size() / 2),
351 filter.end(),
352 true );
353 ATH_MSG_INFO("Filter {}", filter);
354
355 ATH_MSG_INFO("... Processing [pre-thinning] ...");
356 iparticles.keep (filter);
357 ATH_MSG_INFO("======== Index table =========");
358 {
359 SG::ThinningDecisionBase tmp = iparticles.decision();
360 tmp.buildIndexMap();
361 for ( std::size_t i = 0; i != iparticles->size(); ++i ) {
362 std::size_t newIdx = tmp.index( i );
363 ATH_MSG_INFO(" idx {} -> {}",
364 i,
365 newIdx == SG::ThinningDecision::RemovedIdx ? "-" : std::to_string(newIdx));
366 }
367 }
368
369
370 filter = m_filter.value();
371 std::fill( filter.begin(),
372 filter.begin() + (filter.size() / 2),
373 true );
374
375 ATH_MSG_INFO("Filter {}", filter);
376
377 ATH_MSG_INFO("... Processing [thinning] ...");
378 iparticles.keep (filter, SG::ThinningDecisionBase::Op::And);
379
380 ATH_MSG_INFO("======== Index table =========");
381 {
382 SG::ThinningDecisionBase tmp = iparticles.decision();
383 tmp.buildIndexMap();
384 for ( std::size_t i = 0; i != iparticles->size(); ++i ) {
385 std::size_t newIdx = tmp.index( i );
386 ATH_MSG_INFO(" idx {} -> {}",
387 i,
388 newIdx == SG::ThinningDecision::RemovedIdx ? "-" : std::to_string(newIdx));
389 }
390 }
391
392 return StatusCode::SUCCESS;
393}

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

Execute method.

Implements AthAlgorithm.

Definition at line 101 of file WriteThinnedData.cxx.

102{
103 ATH_MSG_DEBUG("Executing {}...", name());
104
105 bool allGood = true;
106 if ( !test( ctx, 0, "test1" ).isSuccess() ) {
107 ATH_MSG_WARNING("Could not perform 'thinning test1' !!");
108 allGood = false;
109 }
110
111 if ( !test( ctx, 1, "test2" ).isSuccess() ) {
112 ATH_MSG_WARNING("Could not perform 'thinning test2' !!");
113 allGood = false;
114 }
115
116 if ( !test( ctx, 2, "test3" ).isSuccess() ) {
117 ATH_MSG_WARNING("Could not perform 'thinning test3' !!");
118 allGood = false;
119 }
120
121 return allGood ? StatusCode::SUCCESS : StatusCode::FAILURE;
122}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
StatusCode test(const EventContext &ctx, int testNum, const std::string &testName)
Exercise the following thinning tests: [testName = "test1"] retrieve a AthExParticles container remov...
bool allGood
Loop over the SDOs & Digits.

◆ 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 WriteThinnedData::finalize ( )
overridevirtual

Definition at line 95 of file WriteThinnedData.cxx.

96{
97 ATH_MSG_INFO("Finalizing {}...", name());
98 return StatusCode::SUCCESS;
99}

◆ initialize()

StatusCode WriteThinnedData::initialize ( )
overridevirtual

Definition at line 69 of file WriteThinnedData.cxx.

70{
71 ATH_MSG_INFO("Initializing {}...", name());
72
73 for (int i = 0; i < 3; i++) {
74 std::ostringstream ss;
75 std::print (ss, "_test{}", (i+1));
76 m_elephantinoKeys.emplace_back (m_elephantinoName.value() + ss.str());
77 m_decayKeys.emplace_back (m_decayName.value() + ss.str());
78 m_iparticlesKeys.emplace_back (m_particlesName.value() + ss.str());
79 }
80 ATH_CHECK( m_elephantinoKeys.initialize() );
81 ATH_CHECK( m_decayKeys.initialize() );
82 ATH_CHECK( m_iparticlesKeys.initialize() );
83
84 m_particlesKey1 = m_particlesName.value() + "_test1";
85 m_particlesKey2 = m_particlesName.value() + "_test2";
86 ATH_CHECK( m_particlesKey1.initialize ("StreamUSR_0") );
87 ATH_CHECK( m_particlesKey2.initialize ("StreamUSR_0") );
88
89 m_iparticlesKey3 = m_particlesName.value() + "_test3";
90 ATH_CHECK( m_iparticlesKey3.initialize ("StreamUSR_0") );
91
92 return StatusCode::SUCCESS;
93}
#define ATH_CHECK
Evaluate an expression and check for errors.
static Double_t ss
StringProperty m_elephantinoName
Elephantino input location.
SG::ReadHandleKeyArray< AthExElephantino > m_elephantinoKeys
SG::ThinningHandleKey< AthExParticles > m_particlesKey1
StringProperty m_decayName
Decay input location.
SG::ThinningHandleKey< AthExParticles > m_particlesKey2
SG::ReadHandleKeyArray< AthExIParticles > m_iparticlesKeys
SG::ReadHandleKeyArray< AthExDecay > m_decayKeys
SG::ThinningHandleKey< AthExIParticles > m_iparticlesKey3

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

◆ isReEntrant()

virtual bool AthAlgorithm::isReEntrant ( ) const
inlinefinaloverrideprotectedvirtualinherited

Legacy algorithms are not thread-safe.

Definition at line 47 of file AthAlgorithm.h.

47{ return false; }

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

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, 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_ERROR(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.

◆ test()

StatusCode WriteThinnedData::test ( const EventContext & ctx,
int testNum,
const std::string & testName )
protected

Exercise the following thinning tests: [testName = "test1"] retrieve a AthExParticles container remove some of the AthExParticle using an 'AND' filter [testName = "test2"] retrieve a AthExParticles container remove some of the AthExParticle using an 'OR' filter [testName = "test3"] retrieve a AthExIParticles container remove some of the AthExIParticle using an 'AND' filter.

thinning

Definition at line 124 of file WriteThinnedData.cxx.

126{
127 const std::string& test = testName;
128 ATH_MSG_INFO("Performing thinning test [{}]...", test);
129
130 // fetch Particles
131 const std::string particlesName = m_particlesName.value() + "_" + test;
132 const AthExParticles * particles = 0;
133 if ( !evtStore()->retrieve(particles, particlesName).isSuccess() ||
134 0 == particles ) {
136 ("Could not fetch particles at [{}] !!", particlesName);
137 return StatusCode::RECOVERABLE;
138 }
139
140 // fetch IParticles
141 SG::ReadHandle<AthExIParticles> iparticles (m_iparticlesKeys[testNum], ctx);
142
143 if ( iparticles->size() != particles->size() ||
144 iparticles->at(0)->px() != particles->at(0)->px() ) {
145 ATH_MSG_WARNING ("symlinked containers are corrupted: ");
146 ATH_MSG_WARNING (" #iparticles: {}", iparticles->size());
147 ATH_MSG_WARNING (" # particles: {}", particles->size());
148 ATH_MSG_WARNING (" ipx[0] = {}", iparticles->at(0)->px());
149 ATH_MSG_WARNING (" px[0] = {}", particles->at(0)->px());
150 return StatusCode::RECOVERABLE;
151 }
152
153 // fetch Decay
154 SG::ReadHandle<AthExDecay> decay (m_decayKeys[testNum], ctx);
155
156 // fetch Elephantino
157 SG::ReadHandle<AthExElephantino> elephantino (m_elephantinoKeys[testNum], ctx);
158
159 const double igev = 1. / Gaudi::Units::GeV;
160 ATH_MSG_INFO("IN particles: {}", particles->size());
161 ATH_MSG_INFO("IN decay: ");
162 ATH_MSG_INFO(" p1: px= {}", decay->p1()->px() * igev);
163 ATH_MSG_INFO(" p2: px= {}", decay->p2()->px() * igev);
164 ATH_MSG_INFO(" l1: px= {}", decay->l1()->px() * igev);
165 ATH_MSG_INFO(" l2: px= {}", decay->l2()->px() * igev);
166
167 ATH_MSG_INFO("IN elephantino: ");
168 ATH_MSG_INFO(" leg1: px= {}", elephantino->leg1()->px() * igev);
169 ATH_MSG_INFO(" leg2: px= {}", elephantino->leg2()->px() * igev);
170 ATH_MSG_INFO(" leg3: px= {}", elephantino->leg3()->px() * igev);
171 ATH_MSG_INFO(" leg4: px= {}", elephantino->leg4()->px() * igev);
172 ATH_MSG_INFO(" ear1: px= {}", elephantino->ear1()->px() * igev);
173 ATH_MSG_INFO(" ear2: px= {}", elephantino->ear2()->px() * igev);
174
177 if ( test == "test1" ) {
178 if ( !doThinningTest1(ctx, m_particlesKey1).isSuccess() ) {
179 ATH_MSG_WARNING("Could not exercise Thinning !!");
180 }
181 } else if ( test == "test2" ) {
182 if ( !doThinningTest2(ctx, m_particlesKey2).isSuccess() ) {
183 ATH_MSG_WARNING("Could not exercise Thinning !!");
184 }
185 } else if ( test == "test3" ) {
186 if ( !doThinningTest3(ctx, m_iparticlesKey3).isSuccess() ) {
187 ATH_MSG_WARNING("Could not exercise Thinning !!");
188 }
189 } else {
190 ATH_MSG_ERROR("Unknown test: [{}]", test);
191 return StatusCode::FAILURE;
192 }
194
195 ATH_MSG_INFO("Decay is now:");
196 ATH_MSG_INFO(" p1: px= {}", decay->p1()->px() * igev);
197 ATH_MSG_INFO(" p2: px= {}", decay->p2()->px() * igev);
198 ATH_MSG_INFO(" l1: px= {}", decay->l1()->px() * igev);
199 ATH_MSG_INFO(" l2: px= {}", decay->l2()->px() * igev);
200
201 ATH_MSG_INFO("Elephantino is now: ");
202 ATH_MSG_INFO(" leg1: px= {}", elephantino->leg1()->px() * igev);
203 ATH_MSG_INFO(" leg2: px= {}", elephantino->leg2()->px() * igev);
204 ATH_MSG_INFO(" leg3: px= {}", elephantino->leg3()->px() * igev);
205 ATH_MSG_INFO(" leg4: px= {}", elephantino->leg4()->px() * igev);
206 ATH_MSG_INFO(" ear1: px= {}", elephantino->ear1()->px() * igev);
207 ATH_MSG_INFO(" ear2: px= {}", elephantino->ear2()->px() * igev);
208
209
210 ATH_MSG_INFO("[{}] has been performed.", test);
211 return StatusCode::SUCCESS;
212}
Athena::TPCnvVers::Current AthExParticles
ServiceHandle< StoreGateSvc > & evtStore()
StatusCode doThinningTest2(const EventContext &ctx, const SG::ThinningHandleKey< AthExParticles > &particlesKey) const
Apply the real thinning.
StatusCode doThinningTest3(const EventContext &ctx, const SG::ThinningHandleKey< AthExIParticles > &iparticlesKey) const
Apply the real thinning.
StatusCode doThinningTest1(const EventContext &ctx, const SG::ThinningHandleKey< AthExParticles > &particlesKey) const
Apply the real thinning.

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

SG::ReadHandleKeyArray<AthExDecay> AthExThinning::WriteThinnedData::m_decayKeys { this, "DecayKeys", {}, "" }
protected

Definition at line 128 of file WriteThinnedData.h.

129{ this, "DecayKeys", {}, "" };

◆ m_decayName

StringProperty AthExThinning::WriteThinnedData::m_decayName { this, "Decay", "TwoBodyDecay", "Input location of Decay" }
protected

Decay input location.

Definition at line 125 of file WriteThinnedData.h.

126{ this, "Decay", "TwoBodyDecay", "Input location of Decay" };

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

SG::ReadHandleKeyArray<AthExElephantino> AthExThinning::WriteThinnedData::m_elephantinoKeys { this, "ElephantinoKeys", {}, "" }
protected

Definition at line 135 of file WriteThinnedData.h.

136{ this, "ElephantinoKeys", {}, "" };

◆ m_elephantinoName

StringProperty AthExThinning::WriteThinnedData::m_elephantinoName { this, "Elephantino", "PinkElephantino", "Input location of Elephantino" }
protected

Elephantino input location.

Definition at line 132 of file WriteThinnedData.h.

133{ this, "Elephantino", "PinkElephantino", "Input location of Elephantino" };

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

BooleanArrayProperty AthExThinning::WriteThinnedData::m_filter
protected

Filter to apply on the Particles.

For each element of the filter being true the corresponding particle will be kept.

Definition at line 140 of file WriteThinnedData.h.

◆ m_iparticlesKey3

SG::ThinningHandleKey<AthExIParticles> AthExThinning::WriteThinnedData::m_iparticlesKey3 { this, "IParticlesKey3", "", "" }
protected

Definition at line 121 of file WriteThinnedData.h.

122{ this, "IParticlesKey3", "", "" };

◆ m_iparticlesKeys

SG::ReadHandleKeyArray<AthExIParticles> AthExThinning::WriteThinnedData::m_iparticlesKeys { this, "IParticlesKeys", {}, "" }
protected

Definition at line 118 of file WriteThinnedData.h.

119{ this, "IParticlesKeys", {}, "" };

◆ m_particlesKey1

SG::ThinningHandleKey<AthExParticles> AthExThinning::WriteThinnedData::m_particlesKey1 { this, "ParticlesKey1", "", "" }
protected

Definition at line 113 of file WriteThinnedData.h.

114{ this, "ParticlesKey1", "", "" };

◆ m_particlesKey2

SG::ThinningHandleKey<AthExParticles> AthExThinning::WriteThinnedData::m_particlesKey2 { this, "ParticlesKey2", "", "" }
protected

Definition at line 115 of file WriteThinnedData.h.

116{ this, "ParticlesKey2", "", "" };

◆ m_particlesName

StringProperty AthExThinning::WriteThinnedData::m_particlesName
protected

Particles input location.

Definition at line 111 of file WriteThinnedData.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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