ATLAS Offline Software
Loading...
Searching...
No Matches
TauPi0CreateROI.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 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
22 return StatusCode::SUCCESS;
23}
24
25
26
28 const EventContext& ctx,
29 CaloConstCellContainer& pi0CellContainer,
30 boost::dynamic_bitset<>& addedCellsMap) const {
31
32 // only run on 0-5 prong taus
34 return StatusCode::SUCCESS;
35 }
36
38 if (!caloCellInHandle.isValid()) {
39 ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << caloCellInHandle.key());
40 return StatusCode::FAILURE;
41 }
42
43 const CaloCellContainer *cellContainer = caloCellInHandle.cptr();
44 std::vector<const CaloCell*> removed_cells;
47 if (!removedClustersHandle.isValid()){
48 ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << removedClustersHandle.key());
49 return StatusCode::FAILURE;
50 }
51 const xAOD::CaloClusterContainer *removed_clusters_cont = removedClustersHandle.cptr();
52
53 for (auto cluster : *removed_clusters_cont){
54 for(auto cell_it = cluster->cell_cbegin(); cell_it != cluster->cell_cend(); cell_it++){
55 removed_cells.push_back(*cell_it);
56 }
57 }
58 }
59
61 const CaloDetDescrManager* caloDDMgr = *caloMgrHandle;
62
63 // get only EM cells within dR < 0.4
64 std::vector<CaloCell_ID::SUBCALO> emSubCaloBlocks;
65 emSubCaloBlocks.push_back(CaloCell_ID::LAREM);
66 std::unique_ptr<CaloCellList> cellList = std::make_unique<CaloCellList>(caloDDMgr, cellContainer, emSubCaloBlocks);
67 // use tau p4 not vertex corrected since the cells are also not corrected
68 TLorentzVector tauAxis = tauRecTools::getTauAxis(tau, false);
69 cellList->select(tauAxis.Eta(),tauAxis.Phi(), m_maxDeltaRTauCells);
70
71 // take this opportunity to select EM1 cells for shot reconstruction
72 std::vector<const CaloCell*> shotCells;
73
74 for (const CaloCell* cell : *cellList) {
75 // only keep cells that are in Ecal (PS, EM1, EM2 and EM3, both barrel and endcap).
76 int sampling = cell->caloDDE()->getSampling();
77 if (sampling > 7) continue;
78 // if in EleRM, check the clusters do not include electron activities
79 if (m_removeElectronCells && inEleRM() && std::find(removed_cells.cbegin(), removed_cells.cend(), cell) != removed_cells.cend()) continue;
80 // Store cell in output container
81 const IdentifierHash cellHash = cell->caloDDE()->calo_hash();
82
83 if (!addedCellsMap.test(cellHash)) {
84 pi0CellContainer.push_back(cell);
85 addedCellsMap.set(cellHash);
86 }
87
88 if (sampling == CaloCell_ID::EMB1 || sampling == CaloCell_ID::EME1) {
89 if (cell->pt() > 0) {
90 shotCells.push_back(cell);
91 }
92 }
93
94 }
95
96 static const SG::Accessor<std::vector<const CaloCell*>> acc_shotCells("shotCells");
97 acc_shotCells(tau) = std::move(shotCells);
98
99 return StatusCode::SUCCESS;
100}
101
102#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 executeTool(xAOD::TauJet &pTau, const EventContext &ctx, 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
bool doPi0andShots(const xAOD::TauJet &tau)
Determines whether pi0s and shots should be built for a tau candidate.
TLorentzVector getTauAxis(const xAOD::TauJet &tau, bool doVertexCorrection=true)
Return the four momentum of the tau axis The tau axis is widely used to select clusters and cells in ...
TauJet_v3 TauJet
Definition of the current "tau version".
Definition TauJet.h:17
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.