CMS 3D CMS Logo

EnergyResolutionVsLumi.cc
Go to the documentation of this file.
1 #include <string>
2 #include <vector>
8 
10  m_lumi = 0;
11  m_instlumi = 0;
12 }
13 
16 
17  result.eta = eta;
18  double totLumi = m_lumi;
19  double instLumi = m_instlumi;
20 
22 
23  // Index of induced absorption due to EM damages in PWO4
24  result.muEM = model.InducedAbsorptionEM(instLumi, eta);
25 
26  // Index of induced absorption due to hadron damages in PWO4
27  result.muHD = model.InducedAbsorptionHadronic(totLumi, eta);
28 
29  // Average degradation of amplitude due to transparency change
30  result.ampDropTransparency = model.DegradationMeanEM50GeV(result.muEM + result.muHD);
31 
32  // Average degradation of amplitude due to photo-detector aging
33  result.ampDropPhotoDetector = model.AgingVPT(instLumi, totLumi, eta);
34 
35  result.ampDropTotal = result.ampDropTransparency * result.ampDropPhotoDetector;
36 
37  // Noise increase in ADC counts due to photo-detector and front-end
38  result.noiseIncreaseADC = model.NoiseFactorFE(totLumi, eta);
39 
40  // Resolution degradation due to LY non-uniformity caused by transparency loss
41  result.resolutitonConstantTerm = model.ResolutionConstantTermEM50GeV(result.muEM + result.muHD);
42 
43  return result;
44 }
45 
47  double instLumi = m_instlumi;
49  double result = model.InducedAbsorptionEM(instLumi, eta);
50  return result;
51 }
52 
54  double totLumi = m_lumi;
56  double result = model.InducedAbsorptionHadronic(totLumi, eta);
57  return result;
58 }
59 
61  for (int iEta = 1; iEta <= EBDetId::MAX_IETA; ++iEta) {
62  if (iEta == 0)
63  continue;
64 
65  double eta = EBDetId::approxEta(EBDetId(iEta, 1));
66  eta = std::abs(eta);
67  double r = calcmuTot(eta);
68 
69  mu_eta[iEta] = r;
70  vpt_eta[iEta] = 1.0;
71  }
72 
73  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
74  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
75  if (EEDetId::validDetId(iX, iY, 1)) {
76  EEDetId eedetidpos(iX, iY, 1);
77  double eta = -log(tan(0.5 * atan(sqrt((iX - 50.0) * (iX - 50.0) + (iY - 50.0) * (iY - 50.0)) * 2.98 / 328.)));
78  eta = std::abs(eta);
79  double r = calcmuTot(eta);
80  double v = calcampDropPhotoDetector(eta);
81 
82  mu_eta[EBDetId::MAX_IETA + iX + iY * (EEDetId::IX_MAX)] = r;
83  vpt_eta[EBDetId::MAX_IETA + iX + iY * (EEDetId::IX_MAX)] = v;
84  //std::cout<<"eta/mu/vpt"<<eta<<"/"<<r<<"/"<<v<<std::endl;
85  }
86  }
87  }
88 }
89 
91  double v = 1.0;
92  double muTot = 0;
93  if (id.subdetId() == EcalBarrel) {
94  EBDetId ebId(id);
95  int ieta = std::abs(ebId.ieta());
96  muTot = mu_eta[ieta];
97 
98  } else if (id.subdetId() == EcalEndcap) {
99  EEDetId eeId(id);
100  int ix = eeId.ix();
101  int iy = eeId.iy();
102 
103  muTot = mu_eta[EBDetId::MAX_IETA + ix + iy * (EEDetId::IX_MAX)];
105  } else {
106  muTot = 0;
107  }
108  double zcor = z;
110  if (z < 0.02) {
111  zcor = 0.02;
112  } else if (z > 0.98) {
113  zcor = 0.98;
114  }
115 
116  double result = model.LightCollectionEfficiencyWeighted(zcor, muTot) * v;
117 
118  return result;
119 }
120 
122  if (mu_ind < 0)
123  mu_ind = this->calcmuTot(eta);
124  double v = this->calcampDropPhotoDetector(eta);
126  double result = model.LightCollectionEfficiencyWeighted(z, mu_ind) * v;
127  return result;
128 }
129 
131  double totLumi = m_lumi;
132  double instLumi = m_instlumi;
134  double muEM = model.InducedAbsorptionEM(instLumi, eta);
135  double muH = model.InducedAbsorptionHadronic(totLumi, eta);
136  double result = muEM + muH;
137  return result;
138 }
139 
141  double muEM = this->calcmuEM(eta);
142  double muHD = this->calcmuHD(eta);
144  double result = model.DegradationMeanEM50GeV(muEM + muHD);
145  return result;
146 }
147 
149  double instLumi = m_instlumi;
150  double totLumi = m_lumi;
152  double result = model.AgingVPT(instLumi, totLumi, eta);
153  return result;
154 }
155 
157  double tra = this->calcampDropTransparency(eta);
158  double pho = this->calcampDropPhotoDetector(eta);
159  double result = tra * pho;
160  return result;
161 }
162 
164  double totLumi = m_lumi;
166  double result = model.NoiseFactorFE(totLumi, eta);
167  return result;
168  // noise increase in ADC
169 }
170 
172  double totLumi = m_lumi;
173  double Nadc = 1.1;
174  double result = 1.0;
176  if (std::abs(eta) < 1.497) {
177  Nadc = 1.1;
178  result = model.NoiseFactorFE(totLumi, eta) * Nadc;
179  } else {
180  Nadc = 2.0;
181  result = Nadc;
182  // endcaps no increase in ADC
183  }
184  return result;
185 }
186 
188  double muEM = this->calcmuEM(eta);
189  double muHD = this->calcmuHD(eta);
191  double result = model.ResolutionConstantTermEM50GeV(muEM + muHD);
192  return result;
193 }
194 
195 double EnergyResolutionVsLumi::Resolution(double eta, double ene) {
196  // Initial parameters for ECAL resolution
197  double S;
198  double Nadc;
199  double adc2GeV;
200  double C;
201  if (eta < 1.497) {
202  S = 0.028; // CMS note 2006/148 (EB test beam)
203  Nadc = 1.1;
204  adc2GeV = 0.039;
205  C = 0.003;
206  } else {
207  S = 0.052; // CMS DN 2009/002
208  Nadc = 2.0;
209  adc2GeV = 0.069;
210  C = 0.004;
211  }
212 
214 
215  // adjust resolution parameters
216  S /= sqrt(d.ampDropTotal);
217  Nadc *= d.noiseIncreaseADC;
218  adc2GeV /= d.ampDropTotal;
219  double N = Nadc * adc2GeV * 3.0; // 3x3 noise in GeV
220  C = sqrt(C * C + d.resolutitonConstantTerm * d.resolutitonConstantTerm);
221 
222  return sqrt(S * S / ene + N * N / ene / ene + C * C);
223 }
224 /*
225 void EnergyResolutionVsLumi::Decomposition()
226 {
227  double eta = 2.2;
228  m_instlumi = 5.0e+34;
229  m_lumi = 3000.0;
230 
231  DegradationAtEta d = this->CalculateDegradation(eta);
232 
233  // Initial parameters for ECAL resolution
234  double S;
235  double Nadc;
236  double adc2GeV;
237  double C;
238  if(eta<1.497){
239  S = 0.028; // CMS note 2006/148 (EB test beam)
240  Nadc = 1.1;
241  adc2GeV = 0.039;
242  C = 0.003;
243  }else{
244  S = 0.052; // CMS DN 2009/002
245  Nadc = 2.0;
246  adc2GeV = 0.069;
247  C = 0.0038;
248  }
249 
250  // adjust resolution parameters
251  S /= sqrt(d.ampDropTotal);
252  Nadc *= d.noiseIncreaseADC;
253  adc2GeV /= d.ampDropTotal;
254  // double N = Nadc*adc2GeV*3.0; // 3x3 noise in GeV
255  C = sqrt(C*C + d.resolutitonConstantTerm*d.resolutitonConstantTerm);
256 
257  for(double ene=1.0; ene<1e+3; ene*=1.1){
258  // this is the resolution
259  double res = sqrt(S*S/ene + N*N/ene/ene + C*C);
260  double factor = 1.0;
261  factor = sin(2.0*atan(exp(-1.0*eta)));
262  }
263 }
264 */
double Resolution(double eta, double ene)
int ix() const
Definition: EEDetId.h:77
double calcampDropPhotoDetector(double eta)
double calcresolutitonConstantTerm(double eta)
static const int IX_MIN
Definition: EEDetId.h:290
float float float z
static const int IY_MIN
Definition: EEDetId.h:294
float approxEta() const
Definition: EBDetId.h:102
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
double calcnoiseIncreaseADC(double eta)
T sqrt(T t)
Definition: SSEVec.h:19
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double calcampDropTransparency(double eta)
d
Definition: ztail.py:151
double calcLightCollectionEfficiencyWeighted2(double eta, double z, double mu_ind=-1.0)
static const int IX_MAX
Definition: EEDetId.h:298
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
Definition: DetId.h:17
#define N
Definition: blowfish.cc:9
DegradationAtEta CalculateDegradation(double eta)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
static const int MAX_IETA
Definition: EBDetId.h:136
double calcLightCollectionEfficiencyWeighted(DetId id, double z)
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
static const int IY_MAX
Definition: EEDetId.h:302
double calcampDropTotal(double eta)
int iy() const
Definition: EEDetId.h:83