ATLAS Offline Software
Loading...
Searching...
No Matches
CookieCutterHelpers.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
7
9{
11 const std::vector<const xAOD::CaloCluster*>& clusters,
12 const CaloDetDescrManager& mgr)
13 : AthMessaging("CookieCutterHelpers::CentralPosition")
14{
15 for (const auto* cluster : clusters) {
16 if (cluster->hasSampling(CaloSampling::EMB2)) {
17 const float thisEmax = cluster->energy_max(CaloSampling::EMB2);
18 if (thisEmax > emaxB) {
19 emaxB = thisEmax;
20 etaB = cluster->etamax(CaloSampling::EMB2);
21 phiB = cluster->phimax(CaloSampling::EMB2);
22 }
23 }
24 if (cluster->hasSampling(CaloSampling::EME2)) {
25 const float thisEmax = cluster->energy_max(CaloSampling::EME2);
26 if (thisEmax > emaxEC) {
27 emaxEC = thisEmax;
28 etaEC = cluster->etamax(CaloSampling::EME2);
29 phiEC = cluster->phimax(CaloSampling::EME2);
30 }
31 }
32 if (cluster->hasSampling(CaloSampling::FCAL0)) {
33 const float thisEmax = cluster->energy_max(CaloSampling::FCAL0);
34 if (thisEmax > emaxF) {
35 emaxF = thisEmax;
36 etaF = cluster->etamax(CaloSampling::FCAL0);
37 phiF = cluster->phimax(CaloSampling::FCAL0);
38 }
39 }
40 }
41
42 if (emaxB > 0) {
43 const CaloDetDescrElement* dde =
44 mgr.get_element(CaloCell_ID::EMB2, etaB, phiB);
45 if (dde) {
46 etaB = dde->eta_raw();
47 phiB = dde->phi_raw();
48 } else {
49 ATH_MSG_WARNING("Couldn't get CaloDetDescrElement from mgr for eta = "
50 << etaB << ", phi = " << phiB);
51 }
52 }
53 if (emaxEC > 0) {
54 const CaloDetDescrElement* dde =
55 mgr.get_element(CaloCell_ID::EME2, etaEC, phiEC);
56 if (dde) {
57 etaEC = dde->eta_raw();
58 phiEC = dde->phi_raw();
59 } else {
60 ATH_MSG_WARNING("Couldn't get CaloDetDescrElement from mgr for eta = "
61 << etaEC << ", phi = " << phiEC);
62 }
63 }
64 if (emaxF > 0) {
65 const CaloDetDescrElement* dde =
66 mgr.get_element(CaloCell_ID::FCAL0, etaF, phiF);
67 if (dde) {
68 etaF = dde->eta_raw();
69 phiF = dde->phi_raw();
70 } else {
71 ATH_MSG_WARNING("Couldn't get CaloDetDescrElement from mgr for eta = "
72 << etaF << ", phi = " << phiF);
73 }
74 }
75}
76
78{
79 auto cell_itr = cluster.cell_cbegin();
80 auto cell_end = cluster.cell_cend();
81 for (; cell_itr != cell_end; ++cell_itr) {
82
83 const CaloCell* cell = *cell_itr;
84 if (!cell) {
85 continue;
86 }
87
88 const CaloDetDescrElement* dde = cell->caloDDE();
89 if (!dde) {
90 continue;
91 }
92
93 if (cp0.emaxB > 0 && CaloCell_ID::EMB2 == dde->getSampling()) {
94 const float phi0 = cp0.phiB;
95 double cell_phi = proxim(dde->phi_raw(), phi0);
96 if (cell_phi > phi0) {
97 auto diff = cell_phi - phi0;
98 if (diff > plusB) {
99 plusB = diff;
100 }
101 } else {
102 auto diff = phi0 - cell_phi;
103 if (diff > minusB) {
104 minusB = diff;
105 }
106 }
107 } else if (cp0.emaxEC > 0 && CaloCell_ID::EME2 == dde->getSampling()) {
108 const float phi0 = cp0.phiEC;
109 double cell_phi = proxim(dde->phi_raw(), phi0);
110 if (cell_phi > phi0) {
111 auto diff = cell_phi - phi0;
112 if (diff > plusEC) {
113 plusEC = diff;
114 }
115 } else {
116 auto diff = phi0 - cell_phi;
117 if (diff > minusEC) {
118 minusEC = diff;
119 }
120 }
121 }
122 }
123}
124}
125
#define ATH_MSG_WARNING(x)
void diff(const Jet &rJet1, const Jet &rJet2, std::map< std::string, double > varDiff)
Difference between jets - Non-Class function required by trigger.
Definition Jet.cxx:631
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
This class groups all DetDescr information related to a CaloCell.
CaloCell_ID::CaloSample getSampling() const
cell sampling
This class provides the client interface for accessing the detector description information common to...
const_cell_iterator cell_cend() const
const_cell_iterator cell_cbegin() const
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
double proxim(double b, double a)
Definition proxim.h:17
Find the reference position (eta, phi) relative to which cells are restricted.