ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
PFLeptonSelector Class Reference

#include <PFLeptonSelector.h>

Inheritance diagram for PFLeptonSelector:
Collaboration diagram for PFLeptonSelector:

Public Member Functions

 PFLeptonSelector (const std::string &name, ISvcLocator *pSvcLocator)
 Default constructor. More...
 
 ~PFLeptonSelector ()
 Default destructor. More...
 
StatusCode initialize ()
 Gaudi AthAlgorithm hooks. More...
 
StatusCode execute (const EventContext &ctx) const
 
StatusCode finalize ()
 
virtual StatusCode sysInitialize () override
 Override sysInitialize. More...
 
virtual bool isClonable () const override
 Specify if the algorithm is clonable. More...
 
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant. More...
 
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm. More...
 
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies. More...
 
virtual bool filterPassed (const EventContext &ctx) const
 
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
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. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

StatusCode selectElectrons (SG::WriteHandle< ConstDataVector< xAOD::ElectronContainer >> &selectedElectronsWriteHandle, const SG::WriteHandle< ConstDataVector< CaloCellContainer >> &leptonCaloCellsWriteHandle) const
 Select electrons to use. More...
 
void storeElectronCells (const xAOD::Egamma &electron, SG::WriteHandle< ConstDataVector< CaloCellContainer >> leptonCaloCellsWriteHandle) const
 store the cells of the electrons More...
 
StatusCode selectMuons (SG::WriteHandle< ConstDataVector< xAOD::MuonContainer >> &selectedMuonsWriteHandle, const SG::WriteHandle< ConstDataVector< CaloCellContainer >> &leptonCaloCellsWriteHandle) const
 select muons to use More...
 
void storeMuonCells (const xAOD::Muon &muon, SG::WriteHandle< ConstDataVector< CaloCellContainer >> leptonCaloCellsWriteHandle) const
 store the cells of the muons More...
 
void storeLeptonCells (const xAOD::CaloCluster &theCluster, SG::WriteHandle< ConstDataVector< CaloCellContainer >> leptonCaloCellsWriteHandle) const
 puts set of lepton cells into the lepton container More...
 
StatusCode recordLeptonContainers (SG::WriteHandle< ConstDataVector< xAOD::ElectronContainer >> &selectedElectronsWriteHandle, SG::WriteHandle< ConstDataVector< xAOD::MuonContainer >> &selectedMuonsWriteHandle, SG::WriteHandle< ConstDataVector< CaloCellContainer >> leptonCaloCellsWriteHandle) const
 Put lepton containers and list of lepton cells into Storegate. More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

SG::ReadHandleKey< xAOD::ElectronContainerm_electronsReadHandleKey
 ReadHandle for the ElectronContainer to be used as input. More...
 
SG::ReadHandleKey< xAOD::MuonContainerm_muonsReadHandleKey
 ReadHandle for the MuonContainer to be used as input. More...
 
SG::WriteHandleKey< ConstDataVector< xAOD::ElectronContainer > > m_selectedElectronsWriteHandleKey
 WriteHandle for the ElectronContainer, that will be filled with electrons passing the electron ID in PFLeptonSelector::selectElectrons. More...
 
SG::WriteHandleKey< ConstDataVector< xAOD::MuonContainer > > m_selectedMuonsWriteHandleKey
 WriteHandle for the MuonContainer, that will be filled with muons passing the muon ID in PFLeptonSelector::selectMuons. More...
 
SG::WriteHandleKey< ConstDataVector< CaloCellContainer > > m_leptonCaloCellsWriteHandleKey
 WriteHandle for the CaloCellContainer, that will store calorimeter cells associated to leptons. More...
 
Gaudi::Property< bool > m_storeLeptonCells { this, "storeLeptonCells", false, "Toggle storage of lepton CaloCells" }
 Toggle storage of lepton CaloCells. More...
 
Gaudi::Property< std::string > m_electronID { this, "electronID", "LHMedium", "Select electron ID" }
 
Gaudi::Property< bool > m_selectElectrons { this, "selectElectrons", true, "Toggle usage of electron ID" }
 Toggle to determine whether we select any electrons or not - if selected then tracks matched to those electrons in PFTrackSelector are not used in particle flow. More...
 
Gaudi::Property< bool > m_selectMuons { this, "selectMuons", true, "Toggle usage of muon ID" }
 Toggle to determine whether we select any muons or not - if selected then tracks matched to those muons in PFTrackSelector are not used in particle flow. More...
 
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks. More...
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 18 of file PFLeptonSelector.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

◆ PFLeptonSelector()

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

Default constructor.

Definition at line 7 of file PFLeptonSelector.cxx.

7  :
8  AthReentrantAlgorithm(name, pSvcLocator)
9 {
10 }

◆ ~PFLeptonSelector()

PFLeptonSelector::~PFLeptonSelector ( )
inline

Default destructor.

Definition at line 25 of file PFLeptonSelector.h.

25 {};

Member Function Documentation

◆ cardinality()

unsigned int AthReentrantAlgorithm::cardinality ( ) const
overridevirtualinherited

Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.

Override this to return 0 for reentrant algorithms.

Override this to return 0 for reentrant algorithms.

Definition at line 55 of file AthReentrantAlgorithm.cxx.

56 {
57  return 0;
58 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

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

95 { return m_detStore; }

◆ evtStore() [1/2]

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.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ execute()

StatusCode PFLeptonSelector::execute ( const EventContext &  ctx) const

Definition at line 24 of file PFLeptonSelector.cxx.

24  {
25 
29 
30  if (recordLeptonContainers(selectedElectronsWriteHandle,selectedMuonsWriteHandle,leptonCaloCellsWriteHandle).isFailure()) {
31  return StatusCode::SUCCESS;
32  }
33 
34  /* Select electrons */
35  if (m_selectElectrons) {
36  StatusCode sc = this->selectElectrons(selectedElectronsWriteHandle,leptonCaloCellsWriteHandle);
37  //if fail to select electrons issue warning, but carry on processing event
38  if (sc.isFailure()) ATH_MSG_WARNING(" Problem selecting electrons");
39  }
40 
41  /* Select muons */
42  if (m_selectMuons){
43  StatusCode sc = this->selectMuons(selectedMuonsWriteHandle,leptonCaloCellsWriteHandle);
44  //if fail to select muons issue warning, but carry on processing event
45  if (sc.isFailure()) ATH_MSG_WARNING("Problem selecting muons ");
46  }
47 
48  return StatusCode::SUCCESS;
49 }

◆ 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 & AthReentrantAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

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

Definition at line 79 of file AthReentrantAlgorithm.cxx.

80 {
81  // If we didn't find any symlinks to add, just return the collection
82  // from the base class. Otherwise, return the extended collection.
83  if (!m_extendedExtraObjects.empty()) {
85  }
86  return Algorithm::extraOutputDeps();
87 }

◆ filterPassed()

virtual bool AthReentrantAlgorithm::filterPassed ( const EventContext &  ctx) const
inlinevirtualinherited

Definition at line 135 of file AthReentrantAlgorithm.h.

135  {
136  return execState( ctx ).filterPassed();
137  }

◆ finalize()

StatusCode PFLeptonSelector::finalize ( )

Definition at line 51 of file PFLeptonSelector.cxx.

51 { return StatusCode::SUCCESS; }

◆ initialize()

StatusCode PFLeptonSelector::initialize ( )

Gaudi AthAlgorithm hooks.

Definition at line 12 of file PFLeptonSelector.cxx.

12  {
14  ATH_CHECK( m_muonsReadHandleKey.initialize() );
15 
18 
20 
21  return StatusCode::SUCCESS;
22 }

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

bool AthReentrantAlgorithm::isClonable ( ) const
overridevirtualinherited

◆ msg() [1/2]

MsgStream& AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< Gaudi::Algorithm >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

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

◆ recordLeptonContainers()

StatusCode PFLeptonSelector::recordLeptonContainers ( SG::WriteHandle< ConstDataVector< xAOD::ElectronContainer >> &  selectedElectronsWriteHandle,
SG::WriteHandle< ConstDataVector< xAOD::MuonContainer >> &  selectedMuonsWriteHandle,
SG::WriteHandle< ConstDataVector< CaloCellContainer >>  leptonCaloCellsWriteHandle 
) const
private

Put lepton containers and list of lepton cells into Storegate.

Definition at line 177 of file PFLeptonSelector.cxx.

181 {
182 
184 
185  if (sc.isFailure()) {
186  ATH_MSG_WARNING("Could not record electron WriteHandle with key: " << selectedElectronsWriteHandle.key());
187  return sc;
188  }
189 
191 
192  if (sc.isFailure()) {
193  ATH_MSG_WARNING("Could not record muon WriteHandle with key: " << selectedMuonsWriteHandle.key());
194  return sc;
195  }
196 
197  if (true == m_storeLeptonCells) {
198 
199  //record the cell container
201 
202  if (sc.isFailure()) {
203  ATH_MSG_WARNING("Could not record CaloCell WriteHandle with key: " << leptonCaloCellsWriteHandle);
204  return sc;
205  }
206  }
207 
208  return StatusCode::SUCCESS;
209 }

◆ 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();
383  PBASE::renounce (h);
384  }

◆ 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  {
365  handlesArray.renounce();
366  }

◆ selectElectrons()

StatusCode PFLeptonSelector::selectElectrons ( SG::WriteHandle< ConstDataVector< xAOD::ElectronContainer >> &  selectedElectronsWriteHandle,
const SG::WriteHandle< ConstDataVector< CaloCellContainer >> &  leptonCaloCellsWriteHandle 
) const
private

Select electrons to use.

Definition at line 54 of file PFLeptonSelector.cxx.

57 {
58 
60 
61  if (!electronsReadHandle.isValid()){
62  ATH_MSG_WARNING("Invalid read handle to electron container with name: " << electronsReadHandle.key());
63  return StatusCode::FAILURE;
64  }
65 
66  for (const auto* theElectron : *electronsReadHandle) {
67 
68  if (theElectron) {
69  if (theElectron->pt() > 10000) {
70  bool passElectronID = false;
71  bool gotID = theElectron->passSelection(passElectronID, m_electronID);
72  if (!gotID) {
73  ATH_MSG_WARNING("Could not get Electron ID");
74  continue;
75  }
76  if (passElectronID) {
77  if (selectedElectronsWriteHandle.isValid())
78  selectedElectronsWriteHandle->push_back(theElectron);
79  else
81  "Do not have valid WriteHandle for ElectronContainer with name: " << selectedElectronsWriteHandle.key());
82  if (true == m_storeLeptonCells)
83  this->storeElectronCells(*theElectron, leptonCaloCellsWriteHandle);
84  } // mediumPP
85  } // 10GeV pt cut
86  } // valid egamma pointer
87  else
88  ATH_MSG_WARNING("This electron is a NULL pointer");
89 
90  } // electron loop
91 
92  return StatusCode::SUCCESS;
93 }

◆ selectMuons()

StatusCode PFLeptonSelector::selectMuons ( SG::WriteHandle< ConstDataVector< xAOD::MuonContainer >> &  selectedMuonsWriteHandle,
const SG::WriteHandle< ConstDataVector< CaloCellContainer >> &  leptonCaloCellsWriteHandle 
) const
private

select muons to use

Definition at line 108 of file PFLeptonSelector.cxx.

110 {
111 
113 
114  if (!muonsReadHandle.isValid()) {
115  ATH_MSG_WARNING("Invalid read handle to muon container with name: " << muonsReadHandle.key());
116  return StatusCode::FAILURE;
117  }
118 
119  for (const auto *theMuon : *muonsReadHandle){
120 
121  // Details of medium muons are here:
122  // https://twiki.cern.ch/twiki/bin/view/Atlas/MuonSelectionTool
123  // We only care about muons with ID tracks. Of the muon types which could be medium, only Combined have ID tracks
124  // (for looser selections other muon types could have ID tracks)
125 
126  xAOD::Muon::Quality muonQuality = theMuon->quality();
127  if (muonQuality <= xAOD::Muon::Medium) {
128  xAOD::Muon::MuonType muonType = theMuon->muonType();
129  if (xAOD::Muon::Combined == muonType) {
130  if (selectedMuonsWriteHandle.isValid())
131  selectedMuonsWriteHandle->push_back(theMuon);
132  else
134  "Do not have valid WriteHandle for MuonContainer with name: " << selectedMuonsWriteHandle.key());
135  if (true == m_storeLeptonCells)
136  this->storeMuonCells(*theMuon, leptonCaloCellsWriteHandle);
137  } // combined muons
138  } // Medium muons
139  } // muon loop
140 
141  return StatusCode::SUCCESS;
142 }

◆ setFilterPassed()

virtual void AthReentrantAlgorithm::setFilterPassed ( bool  state,
const EventContext &  ctx 
) const
inlinevirtualinherited

Definition at line 139 of file AthReentrantAlgorithm.h.

139  {
140  execState( ctx ).setFilterPassed( state );
141  }

◆ storeElectronCells()

void PFLeptonSelector::storeElectronCells ( const xAOD::Egamma electron,
SG::WriteHandle< ConstDataVector< CaloCellContainer >>  leptonCaloCellsWriteHandle 
) const
private

store the cells of the electrons

Definition at line 96 of file PFLeptonSelector.cxx.

98 {
99 
100  const xAOD::CaloCluster* electronCluster = electron.caloCluster();
101  if (electronCluster){
102  this->storeLeptonCells(*electronCluster,std::move(leptonCaloCellsWriteHandle));
103  }
104  else ATH_MSG_WARNING("This electron has an invalid pointer to its cluster");
105 }

◆ storeLeptonCells()

void PFLeptonSelector::storeLeptonCells ( const xAOD::CaloCluster theCluster,
SG::WriteHandle< ConstDataVector< CaloCellContainer >>  leptonCaloCellsWriteHandle 
) const
private

puts set of lepton cells into the lepton container

Definition at line 161 of file PFLeptonSelector.cxx.

163 {
164 
165  const CaloClusterCellLink* theCellLink = theCluster.getCellLinks();
166 
167  if (theCellLink){
168  for (const auto *theCaloCell : *theCellLink){
169  if (leptonCaloCellsWriteHandle.isValid()) leptonCaloCellsWriteHandle->push_back(theCaloCell);
170  else ATH_MSG_WARNING(" Do not have valid WriteHandle for CaloCellContaienr with name: " << leptonCaloCellsWriteHandle.key());
171  }//cell loop
172  }
173  else ATH_MSG_WARNING("This cluster has an invalid pointer to its cells, in storeLeptonCells");
174 }

◆ storeMuonCells()

void PFLeptonSelector::storeMuonCells ( const xAOD::Muon muon,
SG::WriteHandle< ConstDataVector< CaloCellContainer >>  leptonCaloCellsWriteHandle 
) const
private

store the cells of the muons

Definition at line 145 of file PFLeptonSelector.cxx.

147 {
148 
149  const ElementLink<xAOD::CaloClusterContainer>& theLink = muon.clusterLink();
150  if (theLink.isValid()){
151  const xAOD::CaloCluster* muonCluster = *theLink;
152  if (muonCluster){
153  this->storeLeptonCells(*muonCluster,std::move(leptonCaloCellsWriteHandle));
154  }
155  else ATH_MSG_WARNING("This muon has an invalid pointer to its cluster ");
156  }
157  else ATH_MSG_WARNING("This muon has an invalid element link to its cluster");
158 }

◆ sysExecute()

StatusCode AthReentrantAlgorithm::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.

Definition at line 67 of file AthReentrantAlgorithm.cxx.

68 {
69  return Gaudi::Algorithm::sysExecute (ctx);
70 }

◆ sysInitialize()

StatusCode AthReentrantAlgorithm::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 InputMakerBase, and HypoBase.

Definition at line 96 of file AthReentrantAlgorithm.cxx.

96  {
98 
99  if (sc.isFailure()) {
100  return sc;
101  }
102 
103  ServiceHandle<ICondSvc> cs("CondSvc",name());
104  for (auto h : outputHandles()) {
105  if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
106  // do this inside the loop so we don't create the CondSvc until needed
107  if ( cs.retrieve().isFailure() ) {
108  ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
109  return StatusCode::SUCCESS;
110  }
111  if (cs->regHandle(this,*h).isFailure()) {
112  sc = StatusCode::FAILURE;
113  ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
114  << " with CondSvc");
115  }
116  }
117  }
118  return sc;
119 }

◆ 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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

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

Gaudi::Property<std::string> PFLeptonSelector::m_electronID { this, "electronID", "LHMedium", "Select electron ID" }
private

Definition at line 104 of file PFLeptonSelector.h.

◆ m_electronsReadHandleKey

SG::ReadHandleKey<xAOD::ElectronContainer> PFLeptonSelector::m_electronsReadHandleKey
private
Initial value:
{
this,
"inputElectronsName",
"Electrons",
"ReadHandle for the ElectronContainer to be used as input"
}

ReadHandle for the ElectronContainer to be used as input.

Definition at line 60 of file PFLeptonSelector.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 AthReentrantAlgorithm::m_extendedExtraObjects
privateinherited

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

Empty if no symlinks were found.

Definition at line 153 of file AthReentrantAlgorithm.h.

◆ m_leptonCaloCellsWriteHandleKey

SG::WriteHandleKey<ConstDataVector<CaloCellContainer> > PFLeptonSelector::m_leptonCaloCellsWriteHandleKey
private
Initial value:
{
this,
"outputLeptonCellsName",
"eflowRec_leptonCellContainer",
"WriteHandle for the CaloCellContainer, that will store calorimeter cells associated to leptons"
}

WriteHandle for the CaloCellContainer, that will store calorimeter cells associated to leptons.

Definition at line 94 of file PFLeptonSelector.h.

◆ m_muonsReadHandleKey

SG::ReadHandleKey<xAOD::MuonContainer> PFLeptonSelector::m_muonsReadHandleKey
private
Initial value:
{ this,
"inputMuonsName",
"Muons",
"ReadHandle for the MuonContainer to be used as input" }

ReadHandle for the MuonContainer to be used as input.

Definition at line 68 of file PFLeptonSelector.h.

◆ m_selectedElectronsWriteHandleKey

SG::WriteHandleKey<ConstDataVector<xAOD::ElectronContainer> > PFLeptonSelector::m_selectedElectronsWriteHandleKey
private
Initial value:
{
this,
"outputElectronsName",
"eflowRec_selectedElectrons",
"WriteHandle for the ElectronContainer, that will be filled with electrons passing the electron ID in "
"PFLeptonSelector::selectElectrons"
}

WriteHandle for the ElectronContainer, that will be filled with electrons passing the electron ID in PFLeptonSelector::selectElectrons.

Definition at line 75 of file PFLeptonSelector.h.

◆ m_selectedMuonsWriteHandleKey

SG::WriteHandleKey<ConstDataVector<xAOD::MuonContainer> > PFLeptonSelector::m_selectedMuonsWriteHandleKey
private
Initial value:
{
this,
"outputMuonsName",
"eflowRec_selectedMuons",
"WriteHandle for the MuonContainer, that will be filled with muons passing the muon ID in "
"PFLeptonSelector::selectMuons"
}

WriteHandle for the MuonContainer, that will be filled with muons passing the muon ID in PFLeptonSelector::selectMuons.

Definition at line 85 of file PFLeptonSelector.h.

◆ m_selectElectrons

Gaudi::Property<bool> PFLeptonSelector::m_selectElectrons { this, "selectElectrons", true, "Toggle usage of electron ID" }
private

Toggle to determine whether we select any electrons or not - if selected then tracks matched to those electrons in PFTrackSelector are not used in particle flow.

If not selected then an empty electron container is created, and hence PFTrackSelector won't find any electrons to match its selected tracks to.

Definition at line 110 of file PFLeptonSelector.h.

◆ m_selectMuons

Gaudi::Property<bool> PFLeptonSelector::m_selectMuons { this, "selectMuons", true, "Toggle usage of muon ID" }
private

Toggle to determine whether we select any muons or not - if selected then tracks matched to those muons in PFTrackSelector are not used in particle flow.

If not selected then an empty muon container is created, and hence PFTrackSelector won't find any muons to match its selected tracks to.

Definition at line 116 of file PFLeptonSelector.h.

◆ m_storeLeptonCells

Gaudi::Property<bool> PFLeptonSelector::m_storeLeptonCells { this, "storeLeptonCells", false, "Toggle storage of lepton CaloCells" }
private

Toggle storage of lepton CaloCells.

Definition at line 102 of file PFLeptonSelector.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:
PFLeptonSelector::selectElectrons
StatusCode selectElectrons(SG::WriteHandle< ConstDataVector< xAOD::ElectronContainer >> &selectedElectronsWriteHandle, const SG::WriteHandle< ConstDataVector< CaloCellContainer >> &leptonCaloCellsWriteHandle) const
Select electrons to use.
Definition: PFLeptonSelector.cxx:54
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:195
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
AthCommonDataStore::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 > renounce(T &h)
Definition: AthCommonDataStore.h:380
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
PFLeptonSelector::m_storeLeptonCells
Gaudi::Property< bool > m_storeLeptonCells
Toggle storage of lepton CaloCells.
Definition: PFLeptonSelector.h:102
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
PFLeptonSelector::m_selectedElectronsWriteHandleKey
SG::WriteHandleKey< ConstDataVector< xAOD::ElectronContainer > > m_selectedElectronsWriteHandleKey
WriteHandle for the ElectronContainer, that will be filled with electrons passing the electron ID in ...
Definition: PFLeptonSelector.h:75
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
PFLeptonSelector::storeElectronCells
void storeElectronCells(const xAOD::Egamma &electron, SG::WriteHandle< ConstDataVector< CaloCellContainer >> leptonCaloCellsWriteHandle) const
store the cells of the electrons
Definition: PFLeptonSelector.cxx:96
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
AthCommonDataStore
Definition: AthCommonDataStore.h:52
AthReentrantAlgorithm::AthReentrantAlgorithm
AthReentrantAlgorithm()
Default constructor:
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
PFLeptonSelector::m_electronID
Gaudi::Property< std::string > m_electronID
Definition: PFLeptonSelector.h:104
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
xAOD::CaloCluster_v1::getCellLinks
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
Definition: CaloCluster_v1.cxx:905
AthReentrantAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
Definition: AthReentrantAlgorithm.h:153
Trk::Combined
@ Combined
Definition: TrackSummaryTool.h:32
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
SG::WriteHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
PFLeptonSelector::m_selectedMuonsWriteHandleKey
SG::WriteHandleKey< ConstDataVector< xAOD::MuonContainer > > m_selectedMuonsWriteHandleKey
WriteHandle for the MuonContainer, that will be filled with muons passing the muon ID in PFLeptonSele...
Definition: PFLeptonSelector.h:85
AthReentrantAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthReentrantAlgorithm.cxx:96
ConstDataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::VarHandleBase::key
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:64
PFLeptonSelector::storeMuonCells
void storeMuonCells(const xAOD::Muon &muon, SG::WriteHandle< ConstDataVector< CaloCellContainer >> leptonCaloCellsWriteHandle) const
store the cells of the muons
Definition: PFLeptonSelector.cxx:145
PFLeptonSelector::recordLeptonContainers
StatusCode recordLeptonContainers(SG::WriteHandle< ConstDataVector< xAOD::ElectronContainer >> &selectedElectronsWriteHandle, SG::WriteHandle< ConstDataVector< xAOD::MuonContainer >> &selectedMuonsWriteHandle, SG::WriteHandle< ConstDataVector< CaloCellContainer >> leptonCaloCellsWriteHandle) const
Put lepton containers and list of lepton cells into Storegate.
Definition: PFLeptonSelector.cxx:177
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
PFLeptonSelector::m_selectMuons
Gaudi::Property< bool > m_selectMuons
Toggle to determine whether we select any muons or not - if selected then tracks matched to those muo...
Definition: PFLeptonSelector.h:116
PFLeptonSelector::m_leptonCaloCellsWriteHandleKey
SG::WriteHandleKey< ConstDataVector< CaloCellContainer > > m_leptonCaloCellsWriteHandleKey
WriteHandle for the CaloCellContainer, that will store calorimeter cells associated to leptons.
Definition: PFLeptonSelector.h:94
a
TList * a
Definition: liststreamerinfos.cxx:10
h
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
LikeEnum::Medium
@ Medium
Definition: LikelihoodEnums.h:14
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
ConstDataVector
DataVector adapter that acts like it holds const pointers.
Definition: ConstDataVector.h:76
PFLeptonSelector::selectMuons
StatusCode selectMuons(SG::WriteHandle< ConstDataVector< xAOD::MuonContainer >> &selectedMuonsWriteHandle, const SG::WriteHandle< ConstDataVector< CaloCellContainer >> &leptonCaloCellsWriteHandle) const
select muons to use
Definition: PFLeptonSelector.cxx:108
xAOD::EgammaParameters::electron
@ electron
Definition: EgammaEnums.h:18
PFLeptonSelector::storeLeptonCells
void storeLeptonCells(const xAOD::CaloCluster &theCluster, SG::WriteHandle< ConstDataVector< CaloCellContainer >> leptonCaloCellsWriteHandle) const
puts set of lepton cells into the lepton container
Definition: PFLeptonSelector.cxx:161
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
PFLeptonSelector::m_electronsReadHandleKey
SG::ReadHandleKey< xAOD::ElectronContainer > m_electronsReadHandleKey
ReadHandle for the ElectronContainer to be used as input.
Definition: PFLeptonSelector.h:60
PFLeptonSelector::m_muonsReadHandleKey
SG::ReadHandleKey< xAOD::MuonContainer > m_muonsReadHandleKey
ReadHandle for the MuonContainer to be used as input.
Definition: PFLeptonSelector.h:68
fitman.k
k
Definition: fitman.py:528
PFLeptonSelector::m_selectElectrons
Gaudi::Property< bool > m_selectElectrons
Toggle to determine whether we select any electrons or not - if selected then tracks matched to those...
Definition: PFLeptonSelector.h:110
ServiceHandle< ICondSvc >