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 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);
134 "Do not have valid WriteHandle for MuonContainer with name: " << selectedMuonsWriteHandle.key());
141 return StatusCode::SUCCESS;
155 else ATH_MSG_WARNING(
"This muon has an invalid pointer to its cluster ");
157 else ATH_MSG_WARNING(
"This muon has an invalid element link to its cluster");
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());
173 else ATH_MSG_WARNING(
"This cluster has an invalid pointer to its cells, in storeLeptonCells");
185 if (
sc.isFailure()) {
186 ATH_MSG_WARNING(
"Could not record electron WriteHandle with key: " << selectedElectronsWriteHandle.key());
192 if (
sc.isFailure()) {
193 ATH_MSG_WARNING(
"Could not record muon WriteHandle with key: " << selectedMuonsWriteHandle.key());
202 if (
sc.isFailure()) {
203 ATH_MSG_WARNING(
"Could not record CaloCell WriteHandle with key: " << leptonCaloCellsWriteHandle);
208 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.
ElementLink implementation for ROOT usage.
bool isValid() const
Test to see if the link can be dereferenced.
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 AthAlgorithm 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: