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 const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
bool filterPassed (const EventContext &ctx) const
void setFilterPassed (bool state, const EventContext &ctx) const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
const EventContext & getContext () const
 Deprecated methods (use the ones with EventContext).
bool filterPassed () const
void setFilterPassed (bool state) 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< AthExParticlesm_particlesKey1 { this, "ParticlesKey1", "", "" }
SG::ThinningHandleKey< AthExParticlesm_particlesKey2 { this, "ParticlesKey2", "", "" }
SG::ReadHandleKeyArray< AthExIParticlesm_iparticlesKeys { this, "IParticlesKeys", {}, "" }
SG::ThinningHandleKey< AthExIParticlesm_iparticlesKey3 { this, "IParticlesKey3", "", "" }
StringProperty m_decayName { this, "Decay", "TwoBodyDecay", "Input location of Decay" }
 Decay input location.
SG::ReadHandleKeyArray< AthExDecaym_decayKeys { this, "DecayKeys", {}, "" }
StringProperty m_elephantinoName { this, "Elephantino", "PinkElephantino", "Input location of Elephantino" }
 Elephantino input location.
SG::ReadHandleKeyArray< AthExElephantinom_elephantinoKeys { this, "ElephantinoKeys", {}, "" }
BooleanArrayProperty m_filter
 Filter to apply on the Particles.

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

DataObjIDColl m_extendedExtraObjects
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 with parameters:
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 218 of file WriteThinnedData.cxx.

220{
221 SG::ThinningHandle<AthExParticles> particles (particlesKey, ctx);
222 std::vector<bool> filter = m_filter.value();
223
224 const double igev = 1. / Gaudi::Units::GeV;
225 msg(MSG::INFO) << "Particles | filter :" << endmsg;
226 for ( unsigned int i = 0; i != particles->size(); ++i ) {
227 const std::string kr = filter[i] ? "keep" : "remove";
228 msg(MSG::INFO)
229 << std::setw(9) << (*particles)[i]->px() * igev
230 << " | " << kr
231 << endmsg;
232 }
233 msg(MSG::INFO) << "===================" << endmsg;
234
235 std::fill( filter.begin() + (filter.size() / 2),
236 filter.end(),
237 true );
238 msg(MSG::INFO) << "Filter [" << std::boolalpha;
239 std::copy( filter.begin(), filter.end(),
240 std::ostream_iterator<bool>(msg(MSG::INFO).stream(), " ") );
241 msg(MSG::INFO) << "]" << endmsg;
242
243 msg(MSG::INFO) << "... Processing [pre-thinning] ..." << endmsg;
244 particles.keep (filter);
245 msg(MSG::INFO) << "======== Index table =========" << endmsg;
246 {
247 SG::ThinningDecisionBase tmp = particles.decision();
248 tmp.buildIndexMap();
249 for ( std::size_t i = 0; i != particles->size(); ++i ) {
250 std::size_t newIdx = tmp.index( i );
251 std::stringstream newIdxStr;
252 newIdxStr << newIdx;
253 msg(MSG::INFO)
254 << " idx " << i
255 << " -> " << (newIdx == SG::ThinningDecision::RemovedIdx
256 ? "-"
257 : newIdxStr.str() )
258 << endmsg;
259 }
260 }
261
262
263 filter = m_filter.value();
264 std::fill( filter.begin(),
265 filter.begin() + (filter.size() / 2),
266 true );
267
268 msg(MSG::INFO) << "Filter [" << std::boolalpha;
269 std::copy( filter.begin(), filter.end(),
270 std::ostream_iterator<bool>(msg(MSG::INFO).stream(), " ") );
271 msg(MSG::INFO) << "]" << endmsg;
272
273 msg(MSG::INFO) << "... Processing [thinning] ..." << endmsg;
275
276 msg(MSG::INFO) << "======== Index table =========" << endmsg;
277 {
278 SG::ThinningDecisionBase tmp = particles.decision();
279 tmp.buildIndexMap();
280 for ( std::size_t i = 0; i != particles->size(); ++i ) {
281 std::size_t newIdx = tmp.index( i );
282 std::stringstream newIdxStr;
283 newIdxStr << newIdx;
284 msg(MSG::INFO)
285 << " idx " << i
286 << " -> " << (newIdx == SG::ThinningDecision::RemovedIdx
287 ? "-"
288 : newIdxStr.str() )
289 << endmsg;
290 }
291 }
292
293 return StatusCode::SUCCESS;
294}
#define endmsg
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 297 of file WriteThinnedData.cxx.

299{
300 SG::ThinningHandle<AthExParticles> particles (particlesKey, ctx);
301 std::vector<bool> filter = m_filter.value();
302
303 const double igev = 1. / Gaudi::Units::GeV;
304 msg(MSG::INFO) << "Particles | filter :" << endmsg;
305 for ( unsigned int i = 0; i != particles->size(); ++i ) {
306 const std::string kr = filter[i] ? "keep" : "remove";
307 msg(MSG::INFO)
308 << std::setw(9) << (*particles)[i]->px() * igev
309 << " | " << kr
310 << endmsg;
311 }
312 msg(MSG::INFO) << "===================" << endmsg;
313
314 std::fill( filter.begin() + (filter.size() / 2),
315 filter.end(),
316 false );
317 msg(MSG::INFO) << "Filter [" << std::boolalpha;
318 std::copy( filter.begin(), filter.end(),
319 std::ostream_iterator<bool>(msg(MSG::INFO).stream(), " ") );
320 msg(MSG::INFO) << "]" << endmsg;
321
322 msg(MSG::INFO) << "... Processing [pre-thinning] ..." << endmsg;
323 particles.keep (filter);
324 msg(MSG::INFO) << "======== Index table =========" << endmsg;
325 {
326 SG::ThinningDecisionBase tmp = particles.decision();
327 tmp.buildIndexMap();
328 for ( std::size_t i = 0; i != particles->size(); ++i ) {
329 std::size_t newIdx = tmp.index( i );
330 std::stringstream newIdxStr;
331 newIdxStr << newIdx;
332 msg(MSG::INFO)
333 << " idx " << i
334 << " -> " << (newIdx == SG::ThinningDecision::RemovedIdx
335 ? "-"
336 : newIdxStr.str() )
337 << endmsg;
338 }
339 }
340
341
342 filter = m_filter.value();
343 std::fill( filter.begin(),
344 filter.begin() + (filter.size() / 2),
345 false );
346
347 msg(MSG::INFO) << "Filter [" << std::boolalpha;
348 std::copy( filter.begin(), filter.end(),
349 std::ostream_iterator<bool>(msg(MSG::INFO).stream(), " ") );
350 msg(MSG::INFO) << "]" << endmsg;
351
352 msg(MSG::INFO) << "... Processing [thinning] ..." << endmsg;
354
355 msg(MSG::INFO) << "======== Index table =========" << endmsg;
356 {
357 SG::ThinningDecisionBase tmp = particles.decision();
358 tmp.buildIndexMap();
359 for ( std::size_t i = 0; i != particles->size(); ++i ) {
360 std::size_t newIdx = tmp.index( i );
361 std::stringstream newIdxStr;
362 newIdxStr << newIdx;
363 msg(MSG::INFO)
364 << " idx " << i
365 << " -> " << (newIdx == SG::ThinningDecision::RemovedIdx
366 ? "-"
367 : newIdxStr.str() )
368 << endmsg;
369 }
370 }
371
372 return StatusCode::SUCCESS;
373}

◆ doThinningTest3()

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

Apply the real thinning.

Definition at line 377 of file WriteThinnedData.cxx.

379{
380 SG::ThinningHandle<AthExIParticles> iparticles (iparticlesKey, ctx);
381 std::vector<bool> filter = m_filter.value();
382
383 const double igev = 1. / Gaudi::Units::GeV;
384 msg(MSG::INFO) << "IParticles | filter :" << endmsg;
385 for ( unsigned int i = 0; i != iparticles->size(); ++i ) {
386 const std::string kr = filter[i] ? "keep" : "remove";
387 msg(MSG::INFO)
388 << std::setw(9) << (*iparticles)[i]->px() * igev
389 << " | " << kr
390 << endmsg;
391 }
392 msg(MSG::INFO) << "===================" << endmsg;
393
394 std::fill( filter.begin() + (filter.size() / 2),
395 filter.end(),
396 true );
397 msg(MSG::INFO) << "Filter [" << std::boolalpha;
398 std::copy( filter.begin(), filter.end(),
399 std::ostream_iterator<bool>(msg(MSG::INFO).stream(), " ") );
400 msg(MSG::INFO) << "]" << endmsg;
401
402 msg(MSG::INFO) << "... Processing [pre-thinning] ..." << endmsg;
403 iparticles.keep (filter);
404 msg(MSG::INFO) << "======== Index table =========" << endmsg;
405 {
406 SG::ThinningDecisionBase tmp = iparticles.decision();
407 tmp.buildIndexMap();
408 for ( std::size_t i = 0; i != iparticles->size(); ++i ) {
409 std::size_t newIdx = tmp.index( i );
410 std::stringstream newIdxStr;
411 newIdxStr << newIdx;
412 msg(MSG::INFO)
413 << " idx " << i
414 << " -> " << (newIdx == SG::ThinningDecision::RemovedIdx
415 ? "-"
416 : newIdxStr.str() )
417 << endmsg;
418 }
419 }
420
421
422 filter = m_filter.value();
423 std::fill( filter.begin(),
424 filter.begin() + (filter.size() / 2),
425 true );
426
427 msg(MSG::INFO) << "Filter [" << std::boolalpha;
428 std::copy( filter.begin(), filter.end(),
429 std::ostream_iterator<bool>(msg(MSG::INFO).stream(), " ") );
430 msg(MSG::INFO) << "]" << endmsg;
431
432 msg(MSG::INFO) << "... Processing [thinning] ..." << endmsg;
433 iparticles.keep (filter, SG::ThinningDecisionBase::Op::And);
434
435 msg(MSG::INFO) << "======== Index table =========" << endmsg;
436 {
437 SG::ThinningDecisionBase tmp = iparticles.decision();
438 tmp.buildIndexMap();
439 for ( std::size_t i = 0; i != iparticles->size(); ++i ) {
440 std::size_t newIdx = tmp.index( i );
441 std::stringstream newIdxStr;
442 newIdxStr << newIdx;
443 msg(MSG::INFO)
444 << " idx " << i
445 << " -> " << (newIdx == SG::ThinningDecision::RemovedIdx
446 ? "-"
447 : newIdxStr.str() )
448 << endmsg;
449 }
450 }
451
452 return StatusCode::SUCCESS;
453}

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

Provides access to the EventContext if needed but is non-const as opposed to AthReentrantAlgorithm.

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_WARNING(x)
#define ATH_MSG_DEBUG(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 & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

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

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ filterPassed() [1/2]

bool AthAlgorithm::filterPassed ( ) const
inherited

Definition at line 94 of file AthAlgorithm.cxx.

94 {
95 return filterPassed( Gaudi::Hive::currentContext() );
96}
bool filterPassed() const

◆ filterPassed() [2/2]

bool AthAlgorithm::filterPassed ( const EventContext & ctx) const
inherited

Definition at line 98 of file AthAlgorithm.cxx.

98 {
99 return execState( ctx ).filterPassed();
100}

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

◆ getContext()

const EventContext & AthAlgorithm::getContext ( ) const
inherited

Deprecated methods (use the ones with EventContext).

Definition at line 90 of file AthAlgorithm.cxx.

90 {
91 return Gaudi::Hive::currentContext();
92}

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

◆ isReEntrant()

virtual bool AthAlgorithm::isReEntrant ( ) const
inlinefinaloverrideprotectedvirtualinherited

Legacy algorithms are not thread-safe.

Definition at line 111 of file AthAlgorithm.h.

111{ 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() [1/2]

void AthAlgorithm::setFilterPassed ( bool state) const
inherited

Definition at line 102 of file AthAlgorithm.cxx.

102 {
103 setFilterPassed( state, Gaudi::Hive::currentContext() );
104}
void setFilterPassed(bool state) const

◆ setFilterPassed() [2/2]

void AthAlgorithm::setFilterPassed ( bool state,
const EventContext & ctx ) const
inherited

Definition at line 106 of file AthAlgorithm.cxx.

106 {
107 execState( ctx ).setFilterPassed(state);
108}

◆ sysInitialize()

StatusCode AthAlgorithm::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, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
#define ATH_MSG_ERROR(x)
static Double_t sc
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ 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() ) {
146 ("symlinked containers are corrupted: " << endmsg
147 << " #iparticles: " << iparticles->size() << endmsg
148 << " # particles: " << particles->size() << endmsg
149 << " ipx[0] = " << iparticles->at(0)->px() << endmsg
150 << " px[0] = " << particles->at(0)->px());
151 return StatusCode::RECOVERABLE;
152 }
153
154 // fetch Decay
155 SG::ReadHandle<AthExDecay> decay (m_decayKeys[testNum], ctx);
156
157 // fetch Elephantino
158 SG::ReadHandle<AthExElephantino> elephantino (m_elephantinoKeys[testNum], ctx);
159
160 const double igev = 1. / Gaudi::Units::GeV;
161 ATH_MSG_INFO("IN particles: " << particles->size() << endmsg
162 << "IN decay: " << endmsg
163 << " p1: px= " << decay->p1()->px() * igev << endmsg
164 << " p2: px= " << decay->p2()->px() * igev << endmsg
165 << " l1: px= " << decay->l1()->px() * igev << endmsg
166 << " l2: px= " << decay->l2()->px() * igev);
167
168 ATH_MSG_INFO("IN elephantino: " << endmsg
169 << " leg1: px= " << elephantino->leg1()->px() * igev << endmsg
170 << " leg2: px= " << elephantino->leg2()->px() * igev << endmsg
171 << " leg3: px= " << elephantino->leg3()->px() * igev << endmsg
172 << " leg4: px= " << elephantino->leg4()->px() * igev << endmsg
173 << " ear1: px= " << elephantino->ear1()->px() * igev << endmsg
174 << " ear2: px= " << elephantino->ear2()->px() * igev);
175
178 if ( test == "test1" ) {
179 if ( !doThinningTest1(ctx, m_particlesKey1).isSuccess() ) {
180 ATH_MSG_WARNING("Could not exercise Thinning !!");
181 }
182 } else if ( test == "test2" ) {
183 if ( !doThinningTest2(ctx, m_particlesKey2).isSuccess() ) {
184 ATH_MSG_WARNING("Could not exercise Thinning !!");
185 }
186 } else if ( test == "test3" ) {
187 if ( !doThinningTest3(ctx, m_iparticlesKey3).isSuccess() ) {
188 ATH_MSG_WARNING("Could not exercise Thinning !!");
189 }
190 } else {
191 ATH_MSG_ERROR("Unknown test: [" << test << "]");
192 return StatusCode::FAILURE;
193 }
195
197 ("Decay is now: " << endmsg
198 << " p1: px= " << decay->p1()->px() * igev << endmsg
199 << " p2: px= " << decay->p2()->px() * igev << endmsg
200 << " l1: px= " << decay->l1()->px() * igev << endmsg
201 << " l2: px= " << decay->l2()->px() * igev);
202
204 ("Elephantino is now: " << endmsg
205 << " leg1: px= " << elephantino->leg1()->px() * igev << endmsg
206 << " leg2: px= " << elephantino->leg2()->px() * igev << endmsg
207 << " leg3: px= " << elephantino->leg3()->px() * igev << endmsg
208 << " leg4: px= " << elephantino->leg4()->px() * igev << endmsg
209 << " ear1: px= " << elephantino->ear1()->px() * igev << endmsg
210 << " ear2: px= " << elephantino->ear2()->px() * igev);
211
212
213 ATH_MSG_INFO("[" << test << "] has been performed.");
214 return StatusCode::SUCCESS;
215}
Athena::TPCnvVers::Current AthExParticles
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 AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 114 of file AthAlgorithm.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: