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
22 return StatusCode::SUCCESS;
23}
24
25
26
27StatusCode TauPi0CreateROI::executePi0CreateROI(xAOD::TauJet& tau, CaloConstCellContainer& pi0CellContainer, boost::dynamic_bitset<>& addedCellsMap) const {
28
29 // only run on 0-5 prong taus
31 return StatusCode::SUCCESS;
32 }
33
35 if (!caloCellInHandle.isValid()) {
36 ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << caloCellInHandle.key());
37 return StatusCode::FAILURE;
38 }
39
40 const CaloCellContainer *cellContainer = caloCellInHandle.cptr();
41 std::vector<const CaloCell*> removed_cells;
44 if (!removedClustersHandle.isValid()){
45 ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << removedClustersHandle.key());
46 return StatusCode::FAILURE;
47 }
48 const xAOD::CaloClusterContainer *removed_clusters_cont = removedClustersHandle.cptr();
49
50 for (auto cluster : *removed_clusters_cont){
51 for(auto cell_it = cluster->cell_cbegin(); cell_it != cluster->cell_cend(); cell_it++){
52 removed_cells.push_back(*cell_it);
53 }
54 }
55 }
56
58 const CaloDetDescrManager* caloDDMgr = *caloMgrHandle;
59
60 // get only EM cells within dR < 0.4
61 std::vector<CaloCell_ID::SUBCALO> emSubCaloBlocks;
62 emSubCaloBlocks.push_back(CaloCell_ID::LAREM);
63 std::unique_ptr<CaloCellList> cellList = std::make_unique<CaloCellList>(caloDDMgr, cellContainer, emSubCaloBlocks);
64 // FIXME: tau p4 is corrected to point at tau vertex, but the cells are not
65 cellList->select(tau.eta(), tau.phi(), m_maxDeltaRTauCells);
66
67 // take this opportunity to select EM1 cells for shot reconstruction
68 std::vector<const CaloCell*> shotCells;
69
70 for (const CaloCell* cell : *cellList) {
71 // only keep cells that are in Ecal (PS, EM1, EM2 and EM3, both barrel and endcap).
72 int sampling = cell->caloDDE()->getSampling();
73 if (sampling > 7) continue;
74 // if in EleRM, check the clusters do not include electron activities
75 if (m_removeElectronCells && inEleRM() && std::find(removed_cells.cbegin(), removed_cells.cend(), cell) != removed_cells.cend()) continue;
76 // Store cell in output container
77 const IdentifierHash cellHash = cell->caloDDE()->calo_hash();
78
79 if (!addedCellsMap.test(cellHash)) {
80 pi0CellContainer.push_back(cell);
81 addedCellsMap.set(cellHash);
82 }
83
84 if (sampling == CaloCell_ID::EMB1 || sampling == CaloCell_ID::EME1) {
85 if (cell->pt() > 0) {
86 shotCells.push_back(cell);
87 }
88 }
89
90 }
91
92 static const SG::Accessor<std::vector<const CaloCell*>> acc_shotCells("shotCells");
93 acc_shotCells(tau) = shotCells;
94
95 return StatusCode::SUCCESS;
96}
97
98#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.