ATLAS Offline Software
Loading...
Searching...
No Matches
TauPi0CreateROI.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef XAOD_ANALYSIS
6
7#include "TauPi0CreateROI.h"
9
11
12TauPi0CreateROI::TauPi0CreateROI(const std::string& name) :
13 TauRecToolBase(name) {}
14
16
17 ATH_CHECK( m_caloCellInputContainer.initialize() );
18 ATH_CHECK( m_caloMgrKey.initialize() );
20 ATH_MSG_INFO("Find Pi0 in context: " << (inEleRM() ? "`EleRM`" : "`Standard`") << ", with Electron cell removal Flag: " << m_removeElectronCells);
21 return StatusCode::SUCCESS;
22}
23
24
25
26StatusCode TauPi0CreateROI::executePi0CreateROI(xAOD::TauJet& tau, CaloConstCellContainer& pi0CellContainer, boost::dynamic_bitset<>& addedCellsMap) const {
27
28 // only run on 0-5 prong taus
30 return StatusCode::SUCCESS;
31 }
32
34 if (!caloCellInHandle.isValid()) {
35 ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << caloCellInHandle.key());
36 return StatusCode::FAILURE;
37 }
38
39 const CaloCellContainer *cellContainer = caloCellInHandle.cptr();
40 std::vector<const CaloCell*> removed_cells;
43 if (!removedClustersHandle.isValid()){
44 ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << removedClustersHandle.key());
45 return StatusCode::FAILURE;
46 }
47 const xAOD::CaloClusterContainer *removed_clusters_cont = removedClustersHandle.cptr();
48
49 for (auto cluster : *removed_clusters_cont){
50 for(auto cell_it = cluster->cell_cbegin(); cell_it != cluster->cell_cend(); cell_it++){
51 removed_cells.push_back(*cell_it);
52 }
53 }
54 }
55
57 const CaloDetDescrManager* caloDDMgr = *caloMgrHandle;
58
59 // get only EM cells within dR < 0.4
60 std::vector<CaloCell_ID::SUBCALO> emSubCaloBlocks;
61 emSubCaloBlocks.push_back(CaloCell_ID::LAREM);
62 std::unique_ptr<CaloCellList> cellList = std::make_unique<CaloCellList>(caloDDMgr, cellContainer, emSubCaloBlocks);
63 // FIXME: tau p4 is corrected to point at tau vertex, but the cells are not
64 cellList->select(tau.eta(), tau.phi(), m_maxDeltaRTauCells);
65
66 // take this opportunity to select EM1 cells for shot reconstruction
67 std::vector<const CaloCell*> shotCells;
68
69 for (const CaloCell* cell : *cellList) {
70 // only keep cells that are in Ecal (PS, EM1, EM2 and EM3, both barrel and endcap).
71 int sampling = cell->caloDDE()->getSampling();
72 if (sampling > 7) continue;
73 // if in EleRM, check the clusters do not include electron activities
74 if (m_removeElectronCells && inEleRM() && std::find(removed_cells.cbegin(), removed_cells.cend(), cell) != removed_cells.cend()) continue;
75 // Store cell in output container
76 const IdentifierHash cellHash = cell->caloDDE()->calo_hash();
77
78 if (!addedCellsMap.test(cellHash)) {
79 pi0CellContainer.push_back(cell);
80 addedCellsMap.set(cellHash);
81 }
82
83 if (sampling == CaloCell_ID::EMB1 || sampling == CaloCell_ID::EME1) {
84 shotCells.push_back(cell);
85 }
86
87 }
88
89 static const SG::Accessor<std::vector<const CaloCell*>> acc_shotCells("shotCells");
90 acc_shotCells(tau) = shotCells;
91
92 return StatusCode::SUCCESS;
93}
94
95#endif
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
Container class for CaloCell.
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
void set(const CaloDetDescrElement *caloDDE, const Identifier &ID)
Fast method to change the identity of a cell.
Definition CaloCell.h:511
CaloCellContainer that can accept const cell pointers.
This class provides the client interface for accessing the detector description information common to...
value_type push_back(value_type pElem)
Add an element to the end of the collection.
This is a "hash" representation of an Identifier.
Helper class to provide type-safe access to aux data.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
virtual StatusCode executePi0CreateROI(xAOD::TauJet &pTau, CaloConstCellContainer &Pi0CellContainer, boost::dynamic_bitset<> &map) const override
TauPi0CreateROI(const std::string &name)
Gaudi::Property< bool > m_removeElectronCells
SG::ReadHandleKey< CaloCellContainer > m_caloCellInputContainer
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_removedClusterInputContainer
Gaudi::Property< double > m_maxDeltaRTauCells
virtual StatusCode initialize() override
Tool initializer.
TauRecToolBase(const std::string &name)
bool inEleRM() const
virtual double phi() const
The azimuthal angle ( ) of the particle.
virtual double eta() const
The pseudorapidity ( ) of the particle.
bool doPi0andShots(const xAOD::TauJet &tau)
Determines whether pi0s and shots should be built for a tau candidate.
TauJet_v3 TauJet
Definition of the current "tau version".
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.