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

#include <ParticleRemoverAlg.h>

Inheritance diagram for ParticleRemoverAlg:
Collaboration diagram for ParticleRemoverAlg:

Public Member Functions

 ParticleRemoverAlg (const std::string &name, ISvcLocator *pSvcLocator)
 Standard constructor.
virtual ~ParticleRemoverAlg ()
 Standard destructor.
virtual StatusCode initialize ()
 Standard Gaudi initialize method called once before the event loop.
virtual StatusCode execute (const EventContext &ctx)
 Standard Gaudi execute method called once for every event.
virtual StatusCode finalize ()
 Standard Gaudi finalize method called once after the event loop.
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual StatusCode execute ()
 Execute method without EventContext (deprecated).
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
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

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.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

template<class CONT>
StatusCode removeParticles (const std::vector< bool > &keepParticleVec, const EventContext &ctx)
 Private function to perform the actual work.
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
The properties that can be defined via the python job options
Gaudi::Property< std::string > m_inCont {this, "Input", "", "Input container name"}
 The input container name.
Gaudi::Property< std::string > m_separator {this, "Separator", "___", "The string separator between the output container name and the sytematic variation"}
 The string separator between the output container name and the sytematic variation (default="___").
Gaudi::Property< std::string > m_outCont {this, "Output", "", "The name of the output container with the deep copy of input objects"}
 The output container name.
Gaudi::Property< std::vector< std::string > > m_suffixes {this, "Suffixes", {}, "The names of all suffixes for the input and output container names"}
 The names of all suffixes for the input and output container names.
Gaudi::Property< std::vector< std::string > > m_viewContNames {this, "SelectedViewContainers", {}, "The names of all view containers that contain particles that we want to retain"}
 The names of all view containers that contain particles that we want to retain.
Gaudi::Property< bool > m_resetViewConts {this, "RemapViewContainers", true, "Boolean to decide if the existing view containers should be re-mapped"}
 Boolean to decide if the existing view containers should be re-mapped (default: true).
Gaudi::Property< std::string > m_outPrefix {this, "OutputViewContainerPrefix", "", "Prefix to be used for all created output view containers"}
 Prefix to be used for all created output view containers.

Internal members

enum  contType_t {
  UNKNOWN , PHOTON , ELECTRON , MUON ,
  TAU , JET , PARITCLEFLOW , NEUTRALPARTICLE ,
  TRACKPARTICLE , TRUTHPARTICLE , COMPOSITEPARTICLE , PARTICLE ,
  CALOCLUSTER
}
 An enumaration for the actual container type. More...
std::vector< std::string > m_inContNameList
 Vector of all input container names.
std::vector< std::string > m_outContNameList
 Vector of all output container names.
std::vector< const xAOD::IParticleContainer * > m_inContList
 Vector of all input containers.
std::vector< xAOD::IParticleContainer * > m_outContList
 Vector of all output containers.
std::vector< std::vector< std::string > > m_inViewContNameListList
 Vector of all input view container names.
std::vector< std::vector< std::string > > m_outViewContNameListList
 Vector of all output view container names.
contType_t m_contType {UNKNOWN}
 The variable that holds the value that we find for the input container.

Detailed Description

Definition at line 14 of file ParticleRemoverAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ contType_t

An enumaration for the actual container type.

Enumerator
UNKNOWN 
PHOTON 
ELECTRON 
MUON 
TAU 
JET 
PARITCLEFLOW 
NEUTRALPARTICLE 
TRACKPARTICLE 
TRUTHPARTICLE 
COMPOSITEPARTICLE 
PARTICLE 
CALOCLUSTER 

Definition at line 89 of file ParticleRemoverAlg.h.

Constructor & Destructor Documentation

◆ ParticleRemoverAlg()

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

Standard constructor.

Definition at line 28 of file ParticleRemoverAlg.cxx.

29 : AthAlgorithm( name, pSvcLocator )
30{
31}
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:

◆ ~ParticleRemoverAlg()

ParticleRemoverAlg::~ParticleRemoverAlg ( )
virtual

Standard destructor.

Definition at line 34 of file ParticleRemoverAlg.cxx.

34{}

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

virtual StatusCode AthAlgorithm::execute ( )
inlinevirtualinherited

Execute method without EventContext (deprecated).

Override this method if the EventContext is not needed.

Reimplemented in AthenaMonManager, AthPrescaler, BuildVertexPointingAlg, CP::AsgClassificationDecorationAlg, CP::AsgEnergyDecoratorAlg, CP::AsgEventScaleFactorAlg, CP::AsgLeptonTrackDecorationAlg, CP::AsgObjectScaleFactorAlg, CP::AsgPriorityDecorationAlg, CP::AsgSelectionAlg, CP::AsgShallowCopyAlg, CP::AsgUnionPreselectionAlg, CP::AsgUnionSelectionAlg, CP::AsgViewFromSelectionAlg, CP::AsgxAODNTupleMakerAlg, CP::BJetCalibrationAlg, CP::BootstrapGeneratorAlg, CP::BTaggingEfficiencyAlg, CP::BTaggingInformationDecoratorAlg, CP::BTaggingTriggerEfficiencyAlg, CP::BTaggingTriggerMatchingAlg, CP::ChargeSelectorAlg, CP::CopyNominalSelectionAlg, CP::DileptonInvariantMassSelectorAlg, CP::DileptonInvariantMassWindowSelectorAlg, CP::DileptonOSSFInvariantMassWindowSelectorAlg, CP::DiTauEfficiencyCorrectionsAlg, CP::DiTauMassCalculatorAlg, CP::DiTauSmearingAlg, CP::DiTauTruthMatchingAlg, CP::EgammaCalibrationAndSmearingAlg, CP::EgammaFSRForMuonsCollectorAlg, CP::EgammaIsolationCorrectionAlg, CP::EgammaIsolationSelectionAlg, CP::ElectronEfficiencyCorrectionAlg, CP::ElectronSiHitDecAlg, CP::EventCutFlowHistAlg, CP::EventFlagSelectionAlg, CP::EventSelectionByObjectFlagAlg, CP::EventStatusSelectionAlg, CP::FakeBkgCalculatorAlg, CP::InDetTrackBiasingAlg, CP::InDetTrackExtraVarDecoratorAlg, CP::InDetTrackSelectionAlg, CP::InDetTrackSmearingAlg, CP::JetCalibAlg, CP::JetCalibrationAlg, CP::JetDecoratorAlg, CP::JetFFSmearingAlg, CP::JetGhostMuonAssociationAlg, CP::JetModifierAlg, CP::JetNGhostSelectorAlg, CP::JetReclusteringAlg, CP::JetSelectionAlg, CP::JetTriggerDecoratorAlg, CP::JetUncertaintiesAlg, CP::JvtEfficiencyAlg, CP::JvtUpdateAlg, CP::KinematicHistAlg, CP::LeptonSFCalculatorAlg, CP::MCTCDecorationAlg, CP::MetadataHistAlg, CP::MetBuilderAlg, CP::MetMakerAlg, CP::MetSignificanceAlg, CP::MissingETPlusTransverseMassSelectorAlg, CP::MissingETSelectorAlg, CP::MuonCalibrationAndSmearingAlg, CP::MuonEfficiencyScaleFactorAlg, CP::MuonIsolationAlg, CP::MuonSelectionAlgV2, CP::MuonTriggerEfficiencyScaleFactorAlg, CP::NJetDecoratorAlg, CP::NLargeRJetMassWindowSelectorAlg, CP::NObjectMassSelectorAlg, CP::NObjectPtSelectorAlg, CP::ObjectCutFlowHistAlg, CP::OverlapRemovalAlg, CP::PhotonEfficiencyCorrectionAlg, CP::PhotonExtraVariablesAlg, CP::PhotonShowerShapeFudgeAlg, CP::PileupReweightingAlg, CP::PileupReweightingProvider, CP::PMGTruthWeightAlg, CP::RNtupleTreeMakerAlg, CP::RunNumberSelectorAlg, CP::RunPartonHistoryAlg, CP::SaveFilterAlg, CP::SecVertexTruthMatchAlg, CP::SSVWeightsAlg, CP::SumNLeptonPtSelectorAlg, CP::SysListDumperAlg, CP::SysTruthWeightAlg, CP::TauCombineMuonRMTausAlg, CP::TauEfficiencyCorrectionsAlg, CP::TauSmearingAlg, CP::TauTruthMatchingAlg, CP::TransverseMassSelectorAlg, CP::TreeFillerAlg, CP::TreeMakerAlg, CP::TrigEventSelectionAlg, CP::TrigGlobalEfficiencyAlg, CP::TrigMatchingAlg, CP::TrigPrescalesAlg, CP::VGammaORAlg, CP::xAODWriterAlg, CP::XbbEfficiencyAlg, CP::XbbInformationDecoratorAlg, DecoratePhotonPointingAlg, DecorateVertexScoreAlg, DumpGeo, EL::AnaAlgorithm, EL::UnitTestAlg2, EL::UnitTestAlg3, EL::UnitTestAlg4, EL::UnitTestAlg5, EL::UnitTestAlg7, EventReco::KLFitterFinalizeOutputAlg, EventReco::RunKLFitterAlg, GRLSelectorAlg, IdDictCnvTest, InDetUpdateCaches, JetGlobalEventSetup, LArAutoCorrAlgToDB, LArAutoCorrFromStdNtuple, LArBadChannelHunter, LArBlockCorrections, LArCalibCopyAlg< CONDITIONSCONTAINER >, LArCalibCopyAlg< LArDAC2uAMC >, LArCalibCopyAlg< LArPhysWaveContainer >, LArCalibCopyAlg< LArTdriftComplete >, LArCalibPatchingAlg< CONDITIONSCONTAINER >, LArCalibPatchingAlg< LArAutoCorrComplete >, LArCalibPatchingAlg< LArCaliWaveContainer >, LArCalibPatchingAlg< LArMphysOverMcalComplete >, LArCalibPatchingAlg< LArRampComplete >, LArCalibValidationAlg< CONDITIONSCONTAINER, REFCONTAINER >, LArCalibValidationAlg< LArAutoCorrComplete, LArAutoCorrComplete >, LArCalibValidationAlg< LArCaliWaveContainer, LArCaliWaveContainer >, LArCalibValidationAlg< LArPedestalComplete, ILArPedestal >, LArCalibValidationAlg< LArRampComplete, ILArRamp >, LArCaliWaveSelector, LArCompleteToFlat, LArDeltaRespPredictor, LArDSPThresholdFillInline, LArDuplicateConstants, LArFillDSPConfig, LArFlatFromFile, LArGeoWeightsFill, LArMasterWaveBuilder, LArMphysOverMcalFromTuple, LArOFCAlg, LArOFCBin_PhysCaliTdiffFromStdNtuple, LArOFCtoOFC, LArOFPhaseFill, LArParamsFromStdNtuple, LArPhysWaveFromAscii, LArPhysWaveFromStdNtuple, LArPhysWaveFromTuple, LArPhysWavePredictor, LArPhysWaveShifter, LArRampAdHocPatchingAlg, LArReadParamsFromFile< DATA >, LArReadParamsFromFile< LArCableAttenuationComplete >, LArReadParamsFromFile< LArCableLengthComplete >, LArReadParamsFromFile< LArCaliPulseParamsComplete >, LArReadParamsFromFile< LArDetCellParamsComplete >, LArReadParamsFromFile< LArEMEC_CphiComplete >, LArReadParamsFromFile< LArEMEC_HValphaComplete >, LArReadParamsFromFile< LArEMEC_HVbetaComplete >, LArReadParamsFromFile< LArMphysOverMcalComplete >, LArReadParamsFromFile< LArPhysCaliTdiffComplete >, LArReadParamsFromFile< LArRinjComplete >, LArReadParamsFromFile< LArTdriftComplete >, LArReadParamsFromFile< LArTshaperComplete >, LArRTMParamExtractor, LArShapeFromStdNtuple, LArTimePhysPrediction, LisNtuple, LVL1::eFEXDriver, LVL1::L1CaloTriggerTowerDecoratorAlg, LVL1::L1TopoSimulation, LVL1::TrigT1MBTS, OverlapRemovalGenUseAlg, PyAthena::Alg, SGInputLoader, SUSYToolsAlg, TBBPCRec, TBMWPCRec, TBScintillatorRec, TBTailCatcherRec, TBTrackInfoFromTag, Trig::TrigMatchTestAlg, TrkEDMTestAlg, ZdcLEDNtuple, and ZdcNtuple.

Definition at line 76 of file AthAlgorithm.h.

76 {
77 throw GaudiException( "execute() or execute(const EventContext&) needs to be implemented", name(),
78 StatusCode::FAILURE );
79 }

◆ execute() [2/2]

StatusCode ParticleRemoverAlg::execute ( const EventContext & ctx)
virtual

Standard Gaudi execute method called once for every event.

Reimplemented from AthAlgorithm.

Definition at line 175 of file ParticleRemoverAlg.cxx.

176{
177
178 ATH_MSG_DEBUG ("Executing " << name() << "...");
179 // Let's first clear some stuff
180 m_inContList.clear();
181 m_inContList.resize(m_inContNameList.size());
182 m_outContList.clear();
183
184 // Figure out what type the input container has, if we didn't do it yet
185 if ( m_contType == UNKNOWN ){
190 else if ( evtStore()->contains<xAOD::JetContainer>(m_inCont.value()) ){ m_contType = JET; }
198 }
199 if ( m_contType == UNKNOWN ){
200 ATH_MSG_FATAL("We couldn't determine the type of the container... abort!");
201 return StatusCode::FAILURE;
202 }
203
204 // Open the input container
205 for ( std::size_t i=0; i<m_inContNameList.size(); ++i ) {
206 ATH_CHECK( evtStore()->retrieve( m_inContList[i], m_inContNameList.at(i) ));
207 }
208
209 // Make a quick check that all input containers have the same size
210 const std::size_t inContSize = m_inContList[0]->size();
211 for ( const xAOD::IParticleContainer* inCont : m_inContList ){
212 if ( inContSize != inCont->size() ){
213 ATH_MSG_FATAL("The input container and its shallow copies don't have the same size! Aborting...");
214 return StatusCode::FAILURE;
215 }
216 }
217
218 // Create a vector of bools with the same size as the input container. This
219 // will be used to say if we want to keep that particular object.
220 // All entries will be initialized to false.
221 std::vector<bool> keepParticleVec (inContSize, false);
222 // Now, loop over all view containers and flag the particles that we want to
223 // keep with true in the above vector of bools.
224 for ( const std::string& viewContName : m_viewContNames.value() ){
225 const xAOD::IParticleContainer* inViewCont = nullptr;
226 ATH_CHECK( evtStore()->retrieve( inViewCont, viewContName ) );
227 // Make a quick check that the provided view containers are not larger
228 if ( inViewCont->size() > inContSize ){
229 ATH_MSG_FATAL("One of the input view containers is larger than the input container... aborting.");
230 return StatusCode::FAILURE;
231 }
232 for ( const xAOD::IParticle* part : *inViewCont ){
233 const std::size_t idx = part->index();
234 keepParticleVec[idx] = true;
235 }
236 }
237
238 // Do the heavy lifting of actually creating the new and reduced output container(s)
239 if ( m_contType == PHOTON ){
240 ATH_CHECK( this->removeParticles<xAOD::PhotonContainer>(keepParticleVec, ctx) );
241 }
242 else if ( m_contType == ELECTRON ){
243 ATH_CHECK( this->removeParticles<xAOD::ElectronContainer>(keepParticleVec, ctx) );
244 }
245 else if ( m_contType == MUON ){
246 ATH_CHECK( this->removeParticles<xAOD::MuonContainer>(keepParticleVec, ctx) );
247 }
248 else if ( m_contType == TAU ){
249 ATH_CHECK( this->removeParticles<xAOD::TauJetContainer>(keepParticleVec, ctx) );
250 }
251 else if ( m_contType == JET ){
252 ATH_CHECK( this->removeParticles<xAOD::JetContainer>(keepParticleVec, ctx) );
253 }
254 else if ( m_contType == TRUTHPARTICLE ){
255 ATH_CHECK( this->removeParticles<xAOD::TruthParticleContainer>(keepParticleVec, ctx) );
256 }
257 else if ( m_contType == COMPOSITEPARTICLE ){
259 }
260 else if ( m_contType == PARITCLEFLOW ){
261 ATH_CHECK( this->removeParticles<xAOD::PFOContainer>(keepParticleVec, ctx) );
262 }
263 else if ( m_contType == NEUTRALPARTICLE ){
264 ATH_CHECK( this->removeParticles<xAOD::NeutralParticleContainer>(keepParticleVec, ctx) );
265 }
266 else if ( m_contType == TRACKPARTICLE ){
267 ATH_CHECK( this->removeParticles<xAOD::TrackParticleContainer>(keepParticleVec, ctx) );
268 }
269 else if ( m_contType == PARTICLE ){
270 ATH_CHECK( this->removeParticles<xAOD::ParticleContainer>(keepParticleVec, ctx) );
271 }
272 else if ( m_contType == CALOCLUSTER ){
273 ATH_CHECK( this->removeParticles<xAOD::CaloClusterContainer>(keepParticleVec, ctx) );
274 }
275
276 return StatusCode::SUCCESS;
277}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
size_type size() const noexcept
Returns the number of elements in the collection.
std::vector< xAOD::IParticleContainer * > m_outContList
Vector of all output containers.
Gaudi::Property< std::vector< std::string > > m_viewContNames
The names of all view containers that contain particles that we want to retain.
std::vector< std::string > m_inContNameList
Vector of all input container names.
contType_t m_contType
The variable that holds the value that we find for the input container.
std::vector< const xAOD::IParticleContainer * > m_inContList
Vector of all input containers.
Gaudi::Property< std::string > m_inCont
The input container name.
StatusCode removeParticles(const std::vector< bool > &keepParticleVec, const EventContext &ctx)
Private function to perform the actual work.
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:116
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.

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

bool AthAlgorithm::filterPassed ( ) const
inherited

Definition at line 94 of file AthAlgorithm.cxx.

94 {
95 return execState( Gaudi::Hive::currentContext() ).filterPassed();
96}

◆ finalize()

StatusCode ParticleRemoverAlg::finalize ( )
virtual

Standard Gaudi finalize method called once after the event loop.

Definition at line 166 of file ParticleRemoverAlg.cxx.

167{
168 ATH_MSG_DEBUG ("Finalizing " << name() << "...");
169
170 return StatusCode::SUCCESS;
171}

◆ 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 ParticleRemoverAlg::initialize ( )
virtual

Standard Gaudi initialize method called once before the event loop.

Definition at line 37 of file ParticleRemoverAlg.cxx.

38{
39 ATH_MSG_DEBUG ("Initializing " << name() << "...");
40
41 // Print the configuration to the log file
42 ATH_MSG_DEBUG( "Using: " << m_inCont );
43 ATH_MSG_DEBUG( "Using: " << m_outCont );
44 ATH_MSG_DEBUG( "Using: " << m_separator );
45 ATH_MSG_DEBUG( "Using: " << m_suffixes );
46 ATH_MSG_DEBUG( "Using: " << m_viewContNames );
47 ATH_MSG_DEBUG( "Using: " << m_resetViewConts );
48 ATH_MSG_DEBUG( "Using: " << m_outPrefix );
49
50 // Perform some sanity checks on the given container names
51 if ( m_inCont.value().empty() || m_outCont.value().empty() || m_viewContNames.value().empty() ) {
52 ATH_MSG_ERROR("Wrong user setup! You need to give a valid name for both the Input, Output, and SelectedViewContainers!");
53 return StatusCode::FAILURE;
54 }
55
56 // Abort on an unchecked systematics code
57 // StatusCode::enableFailure();
58
59 // Build the vector of all input and output container names
60 const std::size_t totSize = 1 + m_suffixes.value().size(); // the '1' comes from the InputContainer
61 m_inContNameList.resize(totSize);
62 m_inContList.resize(totSize);
63 m_outContNameList.resize(totSize);
64 m_inContNameList[0] = m_inCont.value();
65 m_outContNameList[0] = m_outCont.value();
66 for ( std::size_t i=1; i<totSize; ++i ) {
67 const std::string& currentSuffix = m_suffixes.value()[i-1];
68 ATH_MSG_VERBOSE("Using current suffix " << currentSuffix << " to search for matching containers");
69 if ( currentSuffix.rfind( m_separator.value(),0 ) == 0 ) { // If the currentSuffix starts with m_separator.value()
70 m_inContNameList[i] = m_inCont.value() + currentSuffix;
71 m_outContNameList[i] = m_outCont.value() + currentSuffix;
72 }
73 else {
74 m_inContNameList[i] = m_inCont.value() + m_separator.value() + currentSuffix;
75 m_outContNameList[i] = m_outCont.value() + m_separator.value() + currentSuffix;
76 }
77 }
78 // Print out the matches that we found
79 if ( msgLvl(MSG::VERBOSE) ) {
80 for ( std::size_t i=0; i<m_inContNameList.size(); ++i ){
81 ATH_MSG_VERBOSE("Matched input number " << i << " with input name " << m_inContNameList[i] << " to output name " << m_outContNameList[i]);
82 }
83 }
84
85
86
87 // Now, also try to map all the view container names to the input (shallow
88 // copy) containers. Set up with that the correct mapping of the new output
89 // view container names.
90 // Assume that all names where we have a suffix, but where we cannot match it
91 // to a suffix of the input container, it belongs to the origninal one.
92 if ( m_resetViewConts.value() || !(m_outPrefix.value().empty()) ){
93 ATH_MSG_VERBOSE("Going to iterate over " << totSize << " elements");
94 m_inViewContNameListList.reserve(totSize);
95 m_outViewContNameListList.reserve(totSize);
96 for ( std::size_t i=0; i<totSize; ++i ) {
97 ATH_MSG_VERBOSE("At " << i << "-th element");
98 if (i==0){
99 // This is the master container without any "___" in its name
100 std::vector<std::string> inViewNames;
101 std::vector<std::string> outViewNames;
102 for ( const std::string& inViewName : m_viewContNames.value() ){
103 ATH_MSG_VERBOSE("Looking at input view container name: " << inViewName);
104 std::size_t pos = inViewName.find(m_separator.value());
105 if ( pos == std::string::npos ){ // the separator is not found
106 ATH_MSG_VERBOSE("No seperator found");
107 inViewNames.push_back(inViewName);
108 outViewNames.push_back( m_outPrefix.value() + inViewName );
109 ATH_MSG_VERBOSE("Added input name " << inViewNames.back() << " and output name " << outViewNames.back());
110 }
111 else {
112 pos += m_separator.value().length();
113 const std::string foundSuffix = inViewName.substr(pos, std::string::npos);
114 ATH_MSG_VERBOSE("Seperator found and suffix found: " << foundSuffix);
115 // the separator is found, but the found suffix doesn't match any of the provided ones
116 if ( std::find( m_suffixes.value().begin(), m_suffixes.value().end(), foundSuffix) == m_suffixes.value().end() ){
117 inViewNames.push_back(inViewName);
118 outViewNames.push_back( m_outPrefix.value() + inViewName );
119 ATH_MSG_VERBOSE("Added2 input name " << inViewNames.back() << " and output name " << outViewNames.back());
120 }
121 }
122 }
123 m_inViewContNameListList.push_back(inViewNames);
124 m_outViewContNameListList.push_back(outViewNames);
125 }
126 else {
127 const std::string& currentSuffix = m_suffixes.value()[i-1];
128 ATH_MSG_VERBOSE("Looking at current suffix: " << currentSuffix);
129 std::vector<std::string> inViewNames;
130 std::vector<std::string> outViewNames;
131 for ( const std::string& inViewName : m_viewContNames.value() ){
132 ATH_MSG_VERBOSE("Looking at current input view container name: " << inViewName);
133 if ( inViewName.find(m_separator.value()+currentSuffix) != std::string::npos ){ // the suffix is found
134 inViewNames.push_back(inViewName);
135 outViewNames.push_back( m_outPrefix.value() + inViewName );
136 ATH_MSG_VERBOSE("Added3 input name " << inViewNames.back() << " and output name " << outViewNames.back());
137 }
138 }
139 m_inViewContNameListList.push_back(inViewNames);
140 m_outViewContNameListList.push_back(outViewNames);
141 }
142 } // End: loop over all containers
143 }
144 // Some sanity printouts
145 if ( msgLvl(MSG::VERBOSE) ) {
146 ATH_MSG_VERBOSE("Printing final input and output names...");
147 for ( std::size_t i=0; i<m_inViewContNameListList.size(); ++i ){
148 ATH_MSG_VERBOSE(" At i=" << i << "-th element");
149 const std::vector<std::string>& inViewNameList = m_inViewContNameListList[i];
150 const std::vector<std::string>& outViewNameList = m_outViewContNameListList[i];
151 ATH_MSG_VERBOSE(" Have " << inViewNameList.size() << " in view elements and " << outViewNameList.size() << " out view elements");
152 for ( std::size_t j=0; j<inViewNameList.size(); ++j ){
153 ATH_MSG_VERBOSE(" At j=" << j << "-th element");
154 const std::string& inName = inViewNameList[j];
155 const std::string& outName = outViewNameList[j];
156 ATH_MSG_VERBOSE(" Have input name " << inName << " paired with out name " << outName);
157 }
158 }
159 }
160
161 return StatusCode::SUCCESS;
162}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
bool msgLvl(const MSG::Level lvl) const
Gaudi::Property< std::vector< std::string > > m_suffixes
The names of all suffixes for the input and output container names.
std::vector< std::vector< std::string > > m_inViewContNameListList
Vector of all input view container names.
std::vector< std::vector< std::string > > m_outViewContNameListList
Vector of all output view container names.
Gaudi::Property< bool > m_resetViewConts
Boolean to decide if the existing view containers should be re-mapped (default: true).
std::vector< std::string > m_outContNameList
Vector of all output container names.
Gaudi::Property< std::string > m_separator
The string separator between the output container name and the sytematic variation (default="___").
Gaudi::Property< std::string > m_outCont
The output container name.
Gaudi::Property< std::string > m_outPrefix
Prefix to be used for all created output view containers.
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)

◆ 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 118 of file AthAlgorithm.h.

118{ 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.

◆ removeParticles()

template<class CONT>
StatusCode ParticleRemoverAlg::removeParticles ( const std::vector< bool > & keepParticleVec,
const EventContext & ctx )
private

Private function to perform the actual work.

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

void AthAlgorithm::setFilterPassed ( bool state) const
inherited

Definition at line 98 of file AthAlgorithm.cxx.

98 {
99 execState( Gaudi::Hive::currentContext() ).setFilterPassed(state);
100}

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

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

contType_t ParticleRemoverAlg::m_contType {UNKNOWN}
private

The variable that holds the value that we find for the input container.

Definition at line 106 of file ParticleRemoverAlg.h.

106{UNKNOWN};

◆ 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 AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 121 of file AthAlgorithm.h.

◆ m_inCont

Gaudi::Property<std::string> ParticleRemoverAlg::m_inCont {this, "Input", "", "Input container name"}
private

The input container name.

Definition at line 43 of file ParticleRemoverAlg.h.

43{this, "Input", "", "Input container name"};

◆ m_inContList

std::vector< const xAOD::IParticleContainer* > ParticleRemoverAlg::m_inContList
private

Vector of all input containers.

Definition at line 76 of file ParticleRemoverAlg.h.

◆ m_inContNameList

std::vector<std::string> ParticleRemoverAlg::m_inContNameList
private

Vector of all input container names.

Definition at line 70 of file ParticleRemoverAlg.h.

◆ m_inViewContNameListList

std::vector< std::vector<std::string> > ParticleRemoverAlg::m_inViewContNameListList
private

Vector of all input view container names.

Definition at line 82 of file ParticleRemoverAlg.h.

◆ m_outCont

Gaudi::Property<std::string> ParticleRemoverAlg::m_outCont {this, "Output", "", "The name of the output container with the deep copy of input objects"}
private

The output container name.

Definition at line 49 of file ParticleRemoverAlg.h.

49{this, "Output", "", "The name of the output container with the deep copy of input objects"};

◆ m_outContList

std::vector< xAOD::IParticleContainer* > ParticleRemoverAlg::m_outContList
private

Vector of all output containers.

Definition at line 79 of file ParticleRemoverAlg.h.

◆ m_outContNameList

std::vector<std::string> ParticleRemoverAlg::m_outContNameList
private

Vector of all output container names.

Definition at line 73 of file ParticleRemoverAlg.h.

◆ m_outPrefix

Gaudi::Property<std::string> ParticleRemoverAlg::m_outPrefix {this, "OutputViewContainerPrefix", "", "Prefix to be used for all created output view containers"}
private

Prefix to be used for all created output view containers.

Definition at line 61 of file ParticleRemoverAlg.h.

61{this, "OutputViewContainerPrefix", "", "Prefix to be used for all created output view containers"};

◆ m_outViewContNameListList

std::vector< std::vector<std::string> > ParticleRemoverAlg::m_outViewContNameListList
private

Vector of all output view container names.

Definition at line 85 of file ParticleRemoverAlg.h.

◆ m_resetViewConts

Gaudi::Property<bool> ParticleRemoverAlg::m_resetViewConts {this, "RemapViewContainers", true, "Boolean to decide if the existing view containers should be re-mapped"}
private

Boolean to decide if the existing view containers should be re-mapped (default: true).

Definition at line 58 of file ParticleRemoverAlg.h.

58{this, "RemapViewContainers", true, "Boolean to decide if the existing view containers should be re-mapped"};

◆ m_separator

Gaudi::Property<std::string> ParticleRemoverAlg::m_separator {this, "Separator", "___", "The string separator between the output container name and the sytematic variation"}
private

The string separator between the output container name and the sytematic variation (default="___").

Definition at line 46 of file ParticleRemoverAlg.h.

46{this, "Separator", "___", "The string separator between the output container name and the sytematic variation"};

◆ m_suffixes

Gaudi::Property<std::vector<std::string> > ParticleRemoverAlg::m_suffixes {this, "Suffixes", {}, "The names of all suffixes for the input and output container names"}
private

The names of all suffixes for the input and output container names.

Definition at line 52 of file ParticleRemoverAlg.h.

52{this, "Suffixes", {}, "The names of all suffixes for the input and output container names"};

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.

◆ m_viewContNames

Gaudi::Property<std::vector<std::string> > ParticleRemoverAlg::m_viewContNames {this, "SelectedViewContainers", {}, "The names of all view containers that contain particles that we want to retain"}
private

The names of all view containers that contain particles that we want to retain.

Definition at line 55 of file ParticleRemoverAlg.h.

55{this, "SelectedViewContainers", {}, "The names of all view containers that contain particles that we want to retain"};

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