ATLAS Offline Software
Loading...
Searching...
No Matches
H1WeightToolCSC12Generic.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5/***********************************************************************
6Filename : H1WeightToolCSC12Generic.cxx
7Author : Walter Lampl
8Created : Feb 2007
9
10***********************************************************************/
11
13#include "CaloEvent/CaloCell.h"
14//#include "CaloEvent/CaloSampling.h"
15
16#include "CLHEP/Units/SystemOfUnits.h"
17//#include "GaudiKernel/Service.h"
18//#include "GaudiKernel/MsgStream.h"
19
20#include <cmath>
21#include <string>
22
23using CLHEP::millimeter;
24using CLHEP::GeV;
25
27 ATH_CHECK( base_class::initialize() );
28 return StatusCode::SUCCESS;
29}
30
31
32double H1WeightToolCSC12Generic::etCell(const CaloCell* thisCell, double weight)
33{
34
35 double etcell = weight * thisCell->et() * wtCell(thisCell);
36 return etcell;
37
38}
39
40
41double H1WeightToolCSC12Generic::wtCell(const CaloCell* thisCell) const
42{
43 Context myctx = context (Gaudi::Hive::currentContext());
44
45 const double mm3 = millimeter*millimeter*millimeter;
46 const double log2 = 0.69314718056;
47 const double inv_log2 = 1. / log2;
48
49 int dim=m_wtEMB1(myctx).size(); //FIXME: Assume same size for all m_wtXXXXX
50
51 // Process cell
52
53 double ecell = thisCell->e();
54 double etaa = fabs( thisCell->eta() );
55 double vol = thisCell->caloDDE()->volume();
56 const CaloSampling::CaloSample s = thisCell->caloDDE()->getSampling();//CaloSampling::getSampling( *thisCell );
57
58 int iET=0;
59 if( fabs(ecell) > 0 && vol > 0 ) {
60 iET=static_cast<int>(log(fabs(ecell)/fabs(vol)*(mm3/GeV))*inv_log2+26);
61 if(iET<0) iET=0;
62 if(iET >= dim) iET = dim-1;
63 } else {
64 iET=-1;
65 }
66
67 double wt = 0;
68
69 switch ( s ) {
70
71 // Presampler
72 case CaloSampling::PreSamplerB:
73 wt = m_wtEMB0(myctx)[0];
74 break;
75
76 case CaloSampling::PreSamplerE:
77 wt = m_wtEME0(myctx)[0];
78 break;
79
80 // First EM layer
81
82 case CaloSampling::EMB1:
83 wt = m_wtEMB0(myctx)[1];
84 break;
85
86 case CaloSampling::EME1:
87 wt = m_wtEME0(myctx)[1];
88 break;
89
90
91 // EM Barrel
92 case CaloSampling::EMB2:
93 case CaloSampling::EMB3:
94 if(iET >= 0 && etaa < 0.8) wt = m_wtEMB1(myctx)[iET];
95 if(iET >= 0 && etaa >= 0.8) wt = m_wtEMB2(myctx)[iET];
96 break;
97
98 // EM Endcap
99 case CaloSampling::EME2:
100 case CaloSampling::EME3:
101 if(iET >= 0 && etaa < 2.5) wt = m_wtEME1(myctx)[iET];
102 if(iET >= 0 && etaa >= 2.5) wt = m_wtEME2(myctx)[iET];
103 break;
104
105 // Tile
106 case CaloSampling::TileBar0:
107 case CaloSampling::TileBar1:
108 case CaloSampling::TileBar2:
109 if(iET >= 0) wt = m_wtTile1(myctx)[iET];
110 break;
111
112 case CaloSampling::TileExt0:
113 case CaloSampling::TileExt1:
114 case CaloSampling::TileExt2:
115 if(iET >= 0) wt = m_wtTile2(myctx)[iET];
116 break;
117
118 // Had endcap
119 case CaloSampling::HEC0:
120 case CaloSampling::HEC1:
121 case CaloSampling::HEC2:
122 case CaloSampling::HEC3:
123 if(iET>=0 && etaa<2.5) wt = m_wtHec1(myctx)[iET];
124 if(iET>=0 && etaa>=2.5) wt = m_wtHec2(myctx)[iET];
125 break;
126
127 // FCal
128 case CaloSampling::FCAL0:
129 if(iET >= 0) wt = m_wtFCal1(myctx)[iET];
130 break;
131
132 case CaloSampling::FCAL1:
133 case CaloSampling::FCAL2:
134 if(iET >= 0) wt = m_wtFCal2(myctx)[iET];
135 break;
136
137 // Gap calorimeter
138 case CaloSampling::TileGap3:
139 wt = m_wtGap(myctx);
140 break;
141
142 // Gap scintillators
143 case CaloSampling::TileGap1:
144 case CaloSampling::TileGap2:
145 wt = m_wtScint(myctx);
146 break;
147
148 case CaloSampling::MINIFCAL0:
149 case CaloSampling::MINIFCAL1:
150 case CaloSampling::MINIFCAL2:
151 case CaloSampling::MINIFCAL3:
152 case CaloSampling::Unknown:
153 break;
154
155 } // end switch
156
157 return wt;
158
159}
160
161
162double H1WeightToolCSC12Generic::etCryo(double etAccb3, double etTile1)
163{
164
165 if( etAccb3*etTile1 > 0 ) {
166 return wtCryo() * sqrt( etAccb3*etTile1 );
167 } else {
168 return 0;
169 }
170
171}
172
174{
175 Context myctx = context (Gaudi::Hive::currentContext());
176 return m_wtCryo(myctx);
177}
178
179// Jet Energy scale
180
182{
183 Context myctx = context (Gaudi::Hive::currentContext());
184 const CxxUtils::Array<2> etaFit = m_etaFit(myctx);
185
186 int nEtaBins=etaFit.size();
187 if (nEtaBins==0)
188 return 1.0;
189
190 int ieta = static_cast<int>(fabs(eta)*(1./0.10));
191 if (ieta>=nEtaBins) ieta=nEtaBins-1;
192 //if(ieta > 49) ieta = 49;
193 double ptlog = log(fabs(e)/(cosh(eta)*GeV));
194 if(ptlog < 2.3) ptlog = 2.3;
195 if(ptlog > etaFit[ieta][4]) ptlog = etaFit[ieta][4];
196 double func = etaFit[ieta][0] + etaFit[ieta][1]/ptlog
197 + etaFit[ieta][2]/(ptlog*ptlog)
198 + etaFit[ieta][3]/(ptlog*ptlog*ptlog);
199
200 return 1./func;
201
202}
Scalar eta() const
pseudorapidity method
#define ATH_CHECK
Evaluate an expression and check for errors.
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
virtual double e() const override final
get energy (data member) (synonym to method energy()
Definition CaloCell.h:333
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition CaloCell.h:321
virtual double eta() const override final
get eta (through CaloDetDescrElement)
Definition CaloCell.h:382
virtual double et() const override final
get et
Definition CaloCell.h:423
CaloCell_ID::CaloSample getSampling() const
cell sampling
Read-only multidimensional array.
unsigned int size(unsigned int dim=0) const
Return the size of the array along one dimension.
Constant< CxxUtils::Array< 1 > > m_wtTile2
Constant< CxxUtils::Array< 1 > > m_wtEME2
Constant< CxxUtils::Array< 1 > > m_wtTile1
Constant< CxxUtils::Array< 1 > > m_wtFCal2
virtual double jetScale(double e, double eta) override
virtual double etCryo(double etAccb3, double etTile1) override
virtual double wtCryo() override
virtual double etCell(const CaloCell *thisCell, double weight) override
Constant< CxxUtils::Array< 1 > > m_wtHec1
Constant< CxxUtils::Array< 1 > > m_wtEME1
Constant< CxxUtils::Array< 1 > > m_wtHec2
Constant< CxxUtils::Array< 1 > > m_wtEME0
Constant< CxxUtils::Array< 1 > > m_wtFCal1
Constant< CxxUtils::Array< 1 > > m_wtEMB0
virtual double wtCell(const CaloCell *thisCell) const override
Constant< CxxUtils::Array< 1 > > m_wtEMB1
virtual StatusCode initialize() override
Constant< CxxUtils::Array< 2 > > m_etaFit
Constant< CxxUtils::Array< 1 > > m_wtEMB2