ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
HeavyIonRec
HIJetRec
src
HISubtractedCellMakerTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
HISubtractedCellMakerTool.h
"
6
#include "
HICaloCellHelper.h
"
7
#include "
xAODHIEvent/HIEventShapeContainer.h
"
8
#include "
CaloEvent/CaloCellContainer.h
"
9
#include "
HIEventUtils/HIEventDefs.h
"
10
#include "
HIEventUtils/HICaloRange.h
"
11
12
#include "
StoreGate/ReadHandle.h
"
13
#include "
StoreGate/WriteHandle.h
"
14
15
#include <algorithm>
16
17
//**********************************************************************
18
19
HISubtractedCellMakerTool::HISubtractedCellMakerTool
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent) :
AthAlgTool
(
type
, name, parent)
20
{
21
declareInterface<ICaloCellMakerTool>(
this
);
22
}
23
24
//**********************************************************************
25
26
StatusCode
HISubtractedCellMakerTool::initialize
()
27
{
28
ATH_CHECK
(
m_eventShapeKey
.initialize() );
29
return
StatusCode::SUCCESS;
30
}
31
32
StatusCode
HISubtractedCellMakerTool::process
(
CaloCellContainer
* theCells,
33
const
EventContext& ctx)
const
34
{
35
const
xAOD::HIEventShapeContainer
* shape=0;
36
37
SG::ReadHandle<xAOD::HIEventShapeContainer>
readHandleEvtShape (
m_eventShapeKey
, ctx);
38
shape = readHandleEvtShape.
cptr
();
39
40
const
HIEventShapeIndex
*
index
=
m_eventShapeMapTool
->getIndexFromShape( shape );
41
if
(
index
==
nullptr
)
42
{
43
ATH_MSG_ERROR
(
"Could not retrieve HIEventShapeIndex for key "
<<
m_eventShapeKey
.key());
44
return
StatusCode::FAILURE;
45
}
46
47
if
(shape->
size
()==0)
48
{
49
ATH_MSG_WARNING
(
"HIEventShapeContainer "
<<
m_eventShapeKey
.key() <<
" exists but has zero size"
);
50
return
StatusCode::SUCCESS;
51
}
52
53
const
xAOD::HIEventShape
* modShape =
nullptr
;
54
ATH_CHECK
(
m_modulatorTool
->getShape (modShape) );
55
56
for
(
auto
pCell : *theCells)
57
{
58
unsigned
int
sample = (
CaloSampling::CaloSample
) pCell->caloDDE()->getSampling();
59
double
eta
=pCell->eta();
60
double
phi
=pCell->phi();
61
62
unsigned
int
bin
=
index
->getIndex(
eta
,sample);
63
if
(
bin
>= shape->
size
() )
64
{
65
if
( std::abs(
eta
) -
HICaloRange::getRange
().getRangeMax(sample) )
66
{
67
double
fp_round=(
eta
> 0.) ? -5e-3 : 5e-3;
68
bin
=
index
->getIndex(
eta
+fp_round,sample);
69
}
70
}
71
72
const
xAOD::HIEventShape
* s=shape->
at
(
bin
);
73
float
nCells=s->nCells();
74
float
rho=0;
75
if
(nCells!=0.) rho=s->rho()/nCells;
76
rho*=
m_modulatorTool
->getModulation(
phi
, modShape);
77
float
ue=rho*
HICaloCellHelper::getAreaEtaPhi
(pCell)*std::cosh(
eta
);
78
pCell->addEnergy(-ue);
79
}
80
return
StatusCode::SUCCESS;
81
}
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
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_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
CaloCellContainer.h
HICaloCellHelper.h
HICaloRange.h
HIEventDefs.h
HIEventShapeContainer.h
HISubtractedCellMakerTool.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteHandle.h
Handle class for recording to StoreGate.
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
CaloCellContainer
Container class for CaloCell.
Definition
CaloCellContainer.h:55
CaloSampling::CaloSample
CaloSample
Definition
Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
HICaloRange::getRange
static const HICaloRange & getRange()
Definition
HICaloRange.cxx:13
HIEventShapeIndex
Definition
HIEventShapeIndex.h:16
HISubtractedCellMakerTool::process
virtual StatusCode process(CaloCellContainer *theCellContainer, const EventContext &ctx) const override
Definition
HISubtractedCellMakerTool.cxx:32
HISubtractedCellMakerTool::m_eventShapeKey
SG::ReadHandleKey< xAOD::HIEventShapeContainer > m_eventShapeKey
Definition
HISubtractedCellMakerTool.h:32
HISubtractedCellMakerTool::m_modulatorTool
ToolHandle< IHIUEModulatorTool > m_modulatorTool
Definition
HISubtractedCellMakerTool.h:33
HISubtractedCellMakerTool::m_eventShapeMapTool
ToolHandle< IHIEventShapeMapTool > m_eventShapeMapTool
Definition
HISubtractedCellMakerTool.h:34
HISubtractedCellMakerTool::HISubtractedCellMakerTool
HISubtractedCellMakerTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
HISubtractedCellMakerTool.cxx:19
HISubtractedCellMakerTool::initialize
virtual StatusCode initialize() override
Definition
HISubtractedCellMakerTool.cxx:26
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
bin
Definition
BinsDiffFromStripMedian.h:43
HICaloCellHelper::getAreaEtaPhi
float getAreaEtaPhi(const CaloCell *theCell)
Definition
HICaloCellHelper.cxx:15
index
Definition
index.py:1
xAOD::HIEventShapeContainer
HIEventShapeContainer_v2 HIEventShapeContainer
Define the latest version of the container.
Definition
HIEventShapeContainer.h:17
xAOD::HIEventShape
HIEventShape_v2 HIEventShape
Definition of the latest event info version.
Definition
HIEventShape.h:16
type
Generated on
for ATLAS Offline Software by
1.17.0