21 return StatusCode::SUCCESS;
30 if (
recordLeptonContainers(selectedElectronsWriteHandle,selectedMuonsWriteHandle,leptonCaloCellsWriteHandle).isFailure()) {
31 return StatusCode::SUCCESS;
36 StatusCode
sc = this->
selectElectrons(selectedElectronsWriteHandle,leptonCaloCellsWriteHandle);
43 StatusCode
sc = this->
selectMuons(selectedMuonsWriteHandle,leptonCaloCellsWriteHandle);
48 return StatusCode::SUCCESS;
61 if (!electronsReadHandle.
isValid()){
62 ATH_MSG_WARNING(
"Invalid read handle to electron container with name: " << electronsReadHandle.
key());
63 return StatusCode::FAILURE;
66 for (
const auto* theElectron : *electronsReadHandle) {
69 if (theElectron->pt() > 10000) {
70 bool passElectronID =
false;
71 bool gotID = theElectron->passSelection(passElectronID,
m_electronID);
77 if (selectedElectronsWriteHandle.isValid())
78 selectedElectronsWriteHandle->push_back(theElectron);
81 "Do not have valid WriteHandle for ElectronContainer with name: " << selectedElectronsWriteHandle.key());
92 return StatusCode::SUCCESS;
101 if (electronCluster){
102 this->
storeLeptonCells(*electronCluster,std::move(leptonCaloCellsWriteHandle));
104 else ATH_MSG_WARNING(
"This electron has an invalid pointer to its cluster");
114 if (!muonsReadHandle.
isValid()) {
115 ATH_MSG_WARNING(
"Invalid read handle to muon container with name: " << muonsReadHandle.
key());
116 return StatusCode::FAILURE;
119 for (
const auto *theMuon : *muonsReadHandle){
126 if (theMuon->quality() <= xAOD::Muon::Quality::Medium) {
127 if (xAOD::Muon::MuonType::Combined == theMuon->muonType()) {
128 if (selectedMuonsWriteHandle.isValid())
129 selectedMuonsWriteHandle->push_back(theMuon);
132 "Do not have valid WriteHandle for MuonContainer with name: " << selectedMuonsWriteHandle.key());
139 return StatusCode::SUCCESS;
147 if (
const xAOD::CaloCluster* muonCluster = muon.cluster(); muonCluster !=
nullptr){
151 else ATH_MSG_WARNING(
"This muon has an invalid element link to its cluster");
162 for (
const auto *theCaloCell : *theCellLink){
163 if (leptonCaloCellsWriteHandle.isValid()) leptonCaloCellsWriteHandle->push_back(theCaloCell);
164 else ATH_MSG_WARNING(
" Do not have valid WriteHandle for CaloCellContaienr with name: " << leptonCaloCellsWriteHandle.key());
167 else ATH_MSG_WARNING(
"This cluster has an invalid pointer to its cells, in storeLeptonCells");
179 if (
sc.isFailure()) {
180 ATH_MSG_WARNING(
"Could not record electron WriteHandle with key: " << selectedElectronsWriteHandle.key());
186 if (
sc.isFailure()) {
187 ATH_MSG_WARNING(
"Could not record muon WriteHandle with key: " << selectedMuonsWriteHandle.key());
196 if (
sc.isFailure()) {
197 ATH_MSG_WARNING(
"Could not record CaloCell WriteHandle with key: " << leptonCaloCellsWriteHandle);
202 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
An algorithm that can be simultaneously executed in multiple threads.
Bookkeeping of cells that make up a cluster Simplified replacement for CaloCellLink,...
DataVector adapter that acts like it holds const pointers.
StatusCode selectElectrons(SG::WriteHandle< ConstDataVector< xAOD::ElectronContainer > > &selectedElectronsWriteHandle, const SG::WriteHandle< ConstDataVector< CaloCellContainer > > &leptonCaloCellsWriteHandle) const
Select electrons to use.
StatusCode execute(const EventContext &ctx) const
void storeLeptonCells(const xAOD::CaloCluster &theCluster, SG::WriteHandle< ConstDataVector< CaloCellContainer > > leptonCaloCellsWriteHandle) const
puts set of lepton cells into the lepton container
SG::ReadHandleKey< xAOD::ElectronContainer > m_electronsReadHandleKey
ReadHandle for the ElectronContainer to be used as input.
StatusCode initialize()
Gaudi AthReentrantAlgorithm hooks.
void storeMuonCells(const xAOD::Muon &muon, SG::WriteHandle< ConstDataVector< CaloCellContainer > > leptonCaloCellsWriteHandle) const
store the cells of the muons
SG::WriteHandleKey< ConstDataVector< xAOD::ElectronContainer > > m_selectedElectronsWriteHandleKey
WriteHandle for the ElectronContainer, that will be filled with electrons passing the electron ID in ...
StatusCode selectMuons(SG::WriteHandle< ConstDataVector< xAOD::MuonContainer > > &selectedMuonsWriteHandle, const SG::WriteHandle< ConstDataVector< CaloCellContainer > > &leptonCaloCellsWriteHandle) const
select muons to use
SG::WriteHandleKey< ConstDataVector< CaloCellContainer > > m_leptonCaloCellsWriteHandleKey
WriteHandle for the CaloCellContainer, that will store calorimeter cells associated to leptons.
SG::WriteHandleKey< ConstDataVector< xAOD::MuonContainer > > m_selectedMuonsWriteHandleKey
WriteHandle for the MuonContainer, that will be filled with muons passing the muon ID in PFLeptonSele...
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.
Gaudi::Property< std::string > m_electronID
Gaudi::Property< bool > m_storeLeptonCells
Toggle storage of lepton CaloCells.
Gaudi::Property< bool > m_selectElectrons
Toggle to determine whether we select any electrons or not - if selected then tracks matched to those...
SG::ReadHandleKey< xAOD::MuonContainer > m_muonsReadHandleKey
ReadHandle for the MuonContainer to be used as input.
PFLeptonSelector(const std::string &name, ISvcLocator *pSvcLocator)
Default constructor.
void storeElectronCells(const xAOD::Egamma &electron, SG::WriteHandle< ConstDataVector< CaloCellContainer > > leptonCaloCellsWriteHandle) const
store the cells of the electrons
Gaudi::Property< bool > m_selectMuons
Toggle to determine whether we select any muons or not - if selected then tracks matched to those muo...
virtual bool isValid() override final
Can the handle be successfully dereferenced?
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version).
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Egamma_v1 Egamma
Definition of the current "egamma version".
Muon_v1 Muon
Reference the current persistent version: