ATLAS Offline Software
EFexEMEnergyWeightedClusterTool.cxx
Go to the documentation of this file.
1 // Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2 
11 
12 LVL1::EFexEMEnergyWeightedClusterTool::EFexEMEnergyWeightedClusterTool(const std::string& type, const std::string& name, const IInterface* parent)
14 {}
15 
16 
17 void
18 LVL1::EFexEMEnergyWeightedClusterTool::findCellsAbove(const CaloConstCellContainer* scells, const float& Thr, std::vector<const CaloCell*>& out) const
19 {
20  out.clear();
21  for(auto scell : *scells) {
22  if ( scell->et() < Thr ) continue;
23  out.push_back(scell);
24  }
25 }
26 
27 
28 void
29 LVL1::EFexEMEnergyWeightedClusterTool::findCellsAbove_EMB2_EMEC2(const CaloConstCellContainer* scells, const float& Thr, std::vector<const CaloCell*>& out) const
30 {
31  out.clear();
32  for(auto scell : *scells) {
33  if ( scell->et() < Thr ) continue;
34  if ( scell->caloDDE()->getSampling()==2 || scell->caloDDE()->getSampling()==6 ) {
35  out.push_back(scell);
36  }
37  }
38 }
39 
40 
41 void
43  const float detaSize, const float dphiSize) const
44 {
45  out.clear();
46  if ( !cell ) return;
47  float etacell = cell->eta();
48  float phicell = cell->phi();
49  for(auto scell : *scells) {
50  if ( std::abs( scell->eta() - etacell) > detaSize ) continue;
51  float dphi = std::abs( scell->phi() - phicell);
52  dphi = std::abs( M_PI - dphi );
53  dphi = std::abs( M_PI - dphi );
54  if ( std::abs( dphi ) > dphiSize ) continue;
55  out.push_back(scell);
56  }
57 }
58 
59 
60 void
61 LVL1::EFexEMEnergyWeightedClusterTool::findCellsAround(const CaloConstCellContainer* scells, const float etacell, const float phicell,
62  std::vector<const CaloCell*>& out, const float detaSize, const float dphiSize) const
63 {
64  out.clear();
65  for(auto scell : *scells) {
66  if ( std::abs( scell->eta() - etacell) > detaSize ) continue;
67  float dphi = std::abs( scell->phi() - phicell);
68  dphi = std::abs( M_PI - dphi );
69  dphi = std::abs( M_PI - dphi );
70  if ( std::abs( dphi ) > dphiSize ) continue;
71  out.push_back(scell);
72  }
73 }
74 
75 
76 void
77 LVL1::EFexEMEnergyWeightedClusterTool::findTTsAround(const xAOD::TriggerTowerContainer* scells, const float etacell, const float phicell,
78  std::vector<const xAOD::TriggerTower*>& out) const
79 {
80  out.clear();
81  for(auto scell : *scells) {
82  if ( std::abs( scell->eta() - etacell) > m_detaTT ) continue;
83  float dphi = std::abs( scell->phi() - phicell);
84  dphi = std::abs( M_PI - dphi );
85  dphi = std::abs( M_PI - dphi );
86  if ( std::abs( dphi ) > m_dphiTT ) continue;
87  out.push_back(scell);
88  }
89 }
90 
91 
92 bool
93 LVL1::EFexEMEnergyWeightedClusterTool::isCellEmMaximum(const std::vector<const CaloCell*>& scells, const CaloCell* cell) const
94 {
95  if ( !cell ) return false;
96  int samp = cell->caloDDE()->getSampling();
97  if ( (samp >= 8) && (samp!=21) ) return false; // include FCAL0 EM
98  float cellpt = 1.0001*cell->et(); //make sure you don't get thecell itself
99  for(auto scell : scells){
100  int samp1 = scell->caloDDE()->getSampling();
101  if ( ( samp1 >= 8 ) && (samp1!=21) ) continue;
102  if ( scell->ID() == cell->ID() ) continue;
103  if ( scell->et() > cellpt ) return false;
104  }
105  return true;
106 }
107 
108 
109 float
110 LVL1::EFexEMEnergyWeightedClusterTool::sumEmCells(const std::vector<const CaloCell*>& scells) const
111 {
112  float totalSum = 0.0;
113  for(auto scell : scells) {
114  int samp1 = scell->caloDDE()->getSampling();
115  if ( (samp1<8) || (samp1==21) ) totalSum+= scell->energy();
116  }
117  return totalSum;
118 }
119 
120 
121 float
122 LVL1::EFexEMEnergyWeightedClusterTool::sumEmCells2nd(const std::vector<const CaloCell*>& scells) const
123 {
124  float totalSum = 0.0;
125  for(auto scell : scells) {
126  if ( (scell->caloDDE()->getSampling()==2) ||(scell->caloDDE()->getSampling()==6) ) {
127  totalSum+= scell->energy();
128  }
129  }
130  return totalSum;
131 }
132 
133 
134 float
135 LVL1::EFexEMEnergyWeightedClusterTool::sumHadCells(const std::vector<const CaloCell*>& scells) const
136 {
137  float totalSum = 0.0;
138  for(auto scell : scells){
139  if ( (scell->caloDDE()->getSampling() <8) || ( scell->caloDDE()->getSampling()>=22) ) continue;
140  //totalSum+= (scell->et())*TMath::CosH(scell->eta());
141  totalSum+= (scell->energy());
142  }
143  return totalSum;
144 }
145 
146 
147 float
148 LVL1::EFexEMEnergyWeightedClusterTool::sumHadTTs(const std::vector<const xAOD::TriggerTower*>& scells) const
149 {
150  float totalSum = 0.0;
151  for(auto scell : scells){
152  if ( std::abs( scell->eta() ) > 1.5 ) continue;
153  if ( scell->sampling() == 0 ) continue;
154  totalSum+= (scell->pt())*TMath::CosH(scell->eta());
155  }
156  return totalSum * 1e3; // express in MeV
157 }
158 
159 
160 void
161 LVL1::EFexEMEnergyWeightedClusterTool::findCluster(const std::vector<const CaloCell*>& scells, float &etaCluster, float &phiCluster) const
162 {
163  etaCluster=0.0;
164  phiCluster=0.0;
165  double etaClusterD=0.0;
166  double phiClusterD=0.0;
167  double energyCluster=0.0;
168  bool cross_phi_bound=false;
169  int last_sign=0;
170  for(auto scell : scells){
171  if ( std::abs( scell->phi() ) < 2.7 ) continue;
172  int layer = scell->caloDDE()->getSampling();
173  if ( ( layer != 2 ) && ( layer != 6 ) ) continue;
174  int cell_sign = ( scell->phi() >=0 ? 1 : -1 );
175  if ( ( last_sign!=0 ) && ( last_sign != cell_sign ) ) cross_phi_bound = true;
176  last_sign = cell_sign;
177  }
178  for(auto scell : scells){
179  int layer = scell->caloDDE()->getSampling();
180  if ( ( layer != 2 ) && ( layer != 6 ) ) continue;
181  double scelleta = scell->eta();
182  double scellphi = scell->phi();
183  double scellet = scell->et();
184  etaClusterD+= (scellet * scelleta);
185  if (cross_phi_bound && scellphi < 0 ) scellphi += 2 * M_PI;
186  phiClusterD+= (scellet * scellphi);
187  energyCluster+= (scellet) ;
188  }
189  if ( energyCluster > 0.1 ) {
190  etaClusterD/=energyCluster;
191  phiClusterD/=energyCluster;
192  etaCluster = (float)etaClusterD;
193  phiCluster = (float)phiClusterD;
194  if ( phiCluster > M_PI ) phiCluster-=2*M_PI;
195  } else {
196  etaCluster=-999.0;
197  phiCluster=-999.0;
198  }
199 }
LVL1::EFexEMEnergyWeightedClusterTool::sumEmCells2nd
float sumEmCells2nd(const std::vector< const CaloCell * > &scells) const
sum all cells from the vector that are in the EM calorimeter part (only 2nd layer)
Definition: EFexEMEnergyWeightedClusterTool.cxx:122
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
LVL1::EFexEMEnergyWeightedClusterTool::sumHadTTs
float sumHadTTs(const std::vector< const xAOD::TriggerTower * > &scells) const
sum all TTs from the vector that are in the HAD calorimeter part, but only for |eta|<1....
Definition: EFexEMEnergyWeightedClusterTool.cxx:148
LVL1::EFexEMEnergyWeightedClusterTool::findCellsAbove_EMB2_EMEC2
void findCellsAbove_EMB2_EMEC2(const CaloConstCellContainer *, const float &thr, std::vector< const CaloCell * > &out) const
Definition: EFexEMEnergyWeightedClusterTool.cxx:29
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
M_PI
#define M_PI
Definition: ActiveFraction.h:11
LVL1::EFexEMEnergyWeightedClusterTool::EFexEMEnergyWeightedClusterTool
EFexEMEnergyWeightedClusterTool(const std::string &type, const std::string &name, const IInterface *parent)
Name : EFexEMEnergyWeightedClusterTool.cxx PACKAGE : Trigger/TrigT1/TrigT1CaloFexPerf AUTHOR : Denis ...
Definition: EFexEMEnergyWeightedClusterTool.cxx:12
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
test_pyathena.parent
parent
Definition: test_pyathena.py:15
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
TrigConf::name
Definition: HLTChainList.h:35
EFexEMEnergyWeightedClusterTool.h
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
CaloConstCellContainer
CaloCellContainer that can accept const cell pointers.
Definition: CaloConstCellContainer.h:45
LVL1::EFexEMEnergyWeightedClusterTool::findCluster
void findCluster(const std::vector< const CaloCell * > &scells, float &etaCluster, float &phiCluster) const
detect central cluster position
Definition: EFexEMEnergyWeightedClusterTool.cxx:161
LVL1::EFexEMEnergyWeightedClusterTool::findCellsAbove
void findCellsAbove(const CaloConstCellContainer *, const float &thr, std::vector< const CaloCell * > &out) const
Definition: EFexEMEnergyWeightedClusterTool.cxx:18
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LVL1::EFexEMEnergyWeightedClusterTool::sumHadCells
float sumHadCells(const std::vector< const CaloCell * > &scells) const
sum all cells from the vector that are in the HAD calorimeter part
Definition: EFexEMEnergyWeightedClusterTool.cxx:135
LVL1::EFexEMEnergyWeightedClusterTool::isCellEmMaximum
bool isCellEmMaximum(const std::vector< const CaloCell * > &scells, const CaloCell *cell) const
checks if a give (seed) cell is the highest in a vector of cells.
Definition: EFexEMEnergyWeightedClusterTool.cxx:93
AthAlgTool
Definition: AthAlgTool.h:26
LVL1::EFexEMEnergyWeightedClusterTool::findTTsAround
void findTTsAround(const xAOD::TriggerTowerContainer *, const float eta, const float phi, std::vector< const xAOD::TriggerTower * > &out) const
finds TTs around a seed cell.
Definition: EFexEMEnergyWeightedClusterTool.cxx:77
LVL1::EFexEMEnergyWeightedClusterTool::findCellsAround
void findCellsAround(const CaloConstCellContainer *, const CaloCell *cell, std::vector< const CaloCell * > &out, const float deta, const float dphi) const
Definition: EFexEMEnergyWeightedClusterTool.cxx:42
readCCLHist.float
float
Definition: readCCLHist.py:83
LVL1::EFexEMEnergyWeightedClusterTool::sumEmCells
float sumEmCells(const std::vector< const CaloCell * > &scells) const
sum all cells from the vector that are in the EM calorimeter part
Definition: EFexEMEnergyWeightedClusterTool.cxx:110