ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
tauRecTools
src
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
"
8
#include "
tauRecTools/HelperFunctions.h
"
9
10
#include "
CaloUtils/CaloCellList.h
"
11
12
TauPi0CreateROI::TauPi0CreateROI
(
const
std::string& name) :
13
TauRecToolBase
(name) {}
14
15
StatusCode
TauPi0CreateROI::initialize
() {
16
17
ATH_CHECK
(
m_caloCellInputContainer
.initialize() );
18
ATH_CHECK
(
m_caloMgrKey
.initialize() );
19
ATH_CHECK
(
m_removedClusterInputContainer
.initialize(
SG::AllowEmpty
) );
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
27
StatusCode
TauPi0CreateROI::executePi0CreateROI
(
xAOD::TauJet
& tau,
CaloConstCellContainer
& pi0CellContainer, boost::dynamic_bitset<>& addedCellsMap)
const
{
28
29
// only run on 0-5 prong taus
30
if
(!
tauRecTools::doPi0andShots
(tau)) {
31
return
StatusCode::SUCCESS;
32
}
33
34
SG::ReadHandle<CaloCellContainer>
caloCellInHandle(
m_caloCellInputContainer
);
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;
42
if
(
inEleRM
() &&
m_removeElectronCells
){
43
SG::ReadHandle<xAOD::CaloClusterContainer>
removedClustersHandle(
m_removedClusterInputContainer
);
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
57
SG::ReadCondHandle<CaloDetDescrManager>
caloMgrHandle{
m_caloMgrKey
};
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
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
CaloCellList.h
HelperFunctions.h
TauPi0CreateROI.h
CaloCellContainer
Container class for CaloCell.
Definition
CaloCellContainer.h:55
CaloCell_Base_ID::LAREM
@ LAREM
Definition
CaloCell_Base_ID.h:45
CaloCell
Data object for each calorimeter readout cell.
Definition
CaloCell.h:57
CaloCell::set
void set(const CaloDetDescrElement *caloDDE, const Identifier &ID)
Fast method to change the identity of a cell.
Definition
CaloCell.h:511
CaloConstCellContainer
CaloCellContainer that can accept const cell pointers.
Definition
CaloConstCellContainer.h:45
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition
CaloDetDescrManager.h:469
ConstDataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition
Control/AthContainers/AthContainers/Accessor.h:68
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
SG::VarHandleBase::key
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
Definition
AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:64
TauPi0CreateROI::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition
TauPi0CreateROI.h:47
TauPi0CreateROI::executePi0CreateROI
virtual StatusCode executePi0CreateROI(xAOD::TauJet &pTau, CaloConstCellContainer &Pi0CellContainer, boost::dynamic_bitset<> &map) const override
Definition
TauPi0CreateROI.cxx:27
TauPi0CreateROI::TauPi0CreateROI
TauPi0CreateROI(const std::string &name)
Definition
TauPi0CreateROI.cxx:12
TauPi0CreateROI::m_removeElectronCells
Gaudi::Property< bool > m_removeElectronCells
Definition
TauPi0CreateROI.h:43
TauPi0CreateROI::m_caloCellInputContainer
SG::ReadHandleKey< CaloCellContainer > m_caloCellInputContainer
Definition
TauPi0CreateROI.h:46
TauPi0CreateROI::m_removedClusterInputContainer
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_removedClusterInputContainer
Definition
TauPi0CreateROI.h:48
TauPi0CreateROI::m_maxDeltaRTauCells
Gaudi::Property< double > m_maxDeltaRTauCells
Definition
TauPi0CreateROI.h:44
TauPi0CreateROI::initialize
virtual StatusCode initialize() override
Tool initializer.
Definition
TauPi0CreateROI.cxx:15
TauRecToolBase::TauRecToolBase
TauRecToolBase(const std::string &name)
Definition
TauRecToolBase.cxx:125
TauRecToolBase::inEleRM
bool inEleRM() const
Definition
TauRecToolBase.h:89
xAOD::TauJet_v3::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
xAOD::TauJet_v3::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:27
tauRecTools::doPi0andShots
bool doPi0andShots(const xAOD::TauJet &tau)
Determines whether pi0s and shots should be built for a tau candidate.
Definition
Reconstruction/tauRecTools/Root/HelperFunctions.cxx:87
xAOD::TauJet
TauJet_v3 TauJet
Definition of the current "tau version".
Definition
TauJet.h:17
xAOD::CaloClusterContainer
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.
Definition
Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloClusterContainer.h:17
Generated on
for ATLAS Offline Software by
1.17.0