Go to the documentation of this file.00001 #include <string>
00002 #include <vector>
00003 #include "SimG4CMS/Calo/interface/EvolutionECAL.h"
00004 #include "SimG4CMS/Calo/interface/EnergyResolutionVsLumi.h"
00005 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00006 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00007 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
00008
00009
00010 EnergyResolutionVsLumi::EnergyResolutionVsLumi()
00011 {
00012 m_lumi=0;
00013 m_instlumi=0;
00014
00015 }
00016
00017 EnergyResolutionVsLumi::~EnergyResolutionVsLumi()
00018 {
00019 }
00020
00021
00022 EnergyResolutionVsLumi::DegradationAtEta EnergyResolutionVsLumi::CalculateDegradation(double eta)
00023 {
00024 DegradationAtEta result;
00025
00026 result.eta = eta;
00027 double totLumi = m_lumi;
00028 double instLumi = m_instlumi;
00029
00030 EvolutionECAL model;
00031
00032
00033 result.muEM = model.InducedAbsorptionEM(instLumi, eta);
00034
00035
00036 result.muHD = model.InducedAbsorptionHadronic(totLumi, eta);
00037
00038
00039 result.ampDropTransparency = model.DegradationMeanEM50GeV(result.muEM+result.muHD);
00040
00041
00042 result.ampDropPhotoDetector = model.AgingVPT(instLumi, totLumi, eta);
00043
00044 result.ampDropTotal = result.ampDropTransparency*result.ampDropPhotoDetector;
00045
00046
00047 result.noiseIncreaseADC = model.NoiseFactorFE(totLumi, eta);
00048
00049
00050 result.resolutitonConstantTerm = model.ResolutionConstantTermEM50GeV(result.muEM+result.muHD);
00051
00052 return result;
00053 }
00054
00055
00056 double EnergyResolutionVsLumi::calcmuEM(double eta)
00057 {
00058 double instLumi = m_instlumi;
00059 EvolutionECAL model;
00060 double result = model.InducedAbsorptionEM(instLumi, eta);
00061 return result;
00062 }
00063
00064 double EnergyResolutionVsLumi::calcmuHD(double eta)
00065 {
00066 double totLumi = m_lumi;
00067 EvolutionECAL model;
00068 double result = model.InducedAbsorptionHadronic(totLumi, eta);
00069 return result;
00070 }
00071
00072
00073 void EnergyResolutionVsLumi::calcmuTot(){
00074
00075 for(int iEta=1; iEta<=EBDetId::MAX_IETA ;++iEta) {
00076 if(iEta==0) continue;
00077
00078 double eta=EBDetId::approxEta(EBDetId(iEta,1));
00079 eta = fabs(eta);
00080 double r= calcmuTot(eta);
00081
00082 mu_eta[iEta]=r;
00083 vpt_eta[iEta]=1.0;
00084
00085 }
00086
00087 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
00088 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
00089 if (EEDetId::validDetId(iX,iY,1))
00090 {
00091 EEDetId eedetidpos(iX,iY,1);
00092 double eta= -log(tan(0.5*atan(sqrt((iX-50.0)*(iX-50.0)+(iY-50.0)*(iY-50.0))*2.98/328.)));
00093 eta = fabs(eta);
00094 double r=calcmuTot(eta);
00095 double v=calcampDropPhotoDetector(eta);
00096
00097 mu_eta[EBDetId::MAX_IETA+iX+iY*(EEDetId::IX_MAX)]=r;
00098 vpt_eta[EBDetId::MAX_IETA+iX+iY*(EEDetId::IX_MAX)]=v;
00099
00100 }
00101 }
00102 }
00103
00104 }
00105
00106
00107 double EnergyResolutionVsLumi::calcLightCollectionEfficiencyWeighted(DetId id, double z)
00108 {
00109
00110 double v=1.0;
00111 double muTot=0;
00112 if(id.subdetId()==EcalBarrel) {
00113 EBDetId ebId(id);
00114 int ieta= fabs(ebId.ieta());
00115 muTot= mu_eta[ieta];
00116
00117 } else if(id.subdetId()==EcalEndcap){
00118 EEDetId eeId(id);
00119 int ix= eeId.ix();
00120 int iy= eeId.iy();
00121
00122 muTot= mu_eta[EBDetId::MAX_IETA+ix+iy*(EEDetId::IX_MAX)];
00123 v=vpt_eta[EBDetId::MAX_IETA+ix+iy*(EEDetId::IX_MAX)];
00124 } else {
00125 muTot=0;
00126 }
00127 double zcor=z;
00128 EvolutionECAL model;
00129 if(z<0.02 ) zcor=0.02;
00130 if(z>0.98) zcor=0.98;
00131
00132 double result=model.LightCollectionEfficiencyWeighted( zcor , muTot)*v;
00133
00134
00135
00136 return result;
00137
00138 }
00139
00140
00141
00142 double EnergyResolutionVsLumi::calcLightCollectionEfficiencyWeighted2(double eta, double z, double mu_ind)
00143 {
00144 if(mu_ind<0) mu_ind=this->calcmuTot(eta);
00145 double v= this->calcampDropPhotoDetector(eta);
00146 EvolutionECAL model;
00147 double result=model.LightCollectionEfficiencyWeighted( z , mu_ind)*v;
00148 return result;
00149 }
00150
00151
00152 double EnergyResolutionVsLumi::calcmuTot(double eta)
00153 {
00154 double totLumi = m_lumi;
00155 double instLumi = m_instlumi;
00156 EvolutionECAL model;
00157 double muEM = model.InducedAbsorptionEM(instLumi, eta);
00158 double muH = model.InducedAbsorptionHadronic(totLumi, eta);
00159 double result=muEM+muH;
00160 return result;
00161 }
00162
00163 double EnergyResolutionVsLumi::calcampDropTransparency(double eta)
00164 {
00165 double muEM=this->calcmuEM(eta);
00166 double muHD=this->calcmuHD(eta);
00167 EvolutionECAL model;
00168 double result = model.DegradationMeanEM50GeV(muEM+muHD);
00169 return result;
00170 }
00171
00172 double EnergyResolutionVsLumi::calcampDropPhotoDetector(double eta)
00173 {
00174 double instLumi = m_instlumi;
00175 double totLumi = m_lumi;
00176 EvolutionECAL model;
00177 double result = model.AgingVPT(instLumi, totLumi, eta);
00178 return result;
00179 }
00180
00181 double EnergyResolutionVsLumi::calcampDropTotal(double eta)
00182 {
00183 double tra= this->calcampDropTransparency(eta);
00184 double pho= this->calcampDropPhotoDetector(eta);
00185 double result = tra*pho;
00186 return result;
00187 }
00188
00189 double EnergyResolutionVsLumi::calcnoiseIncreaseADC(double eta)
00190 {
00191 double totLumi = m_lumi;
00192 EvolutionECAL model;
00193 double result = model.NoiseFactorFE(totLumi, eta);
00194 return result;
00195
00196 }
00197
00198 double EnergyResolutionVsLumi::calcnoiseADC(double eta)
00199 {
00200 double totLumi = m_lumi;
00201 double Nadc = 1.1;
00202 double result =1.0;
00203 EvolutionECAL model;
00204 if(fabs(eta)<1.497){
00205 Nadc = 1.1;
00206 result = model.NoiseFactorFE(totLumi, eta)*Nadc;
00207 }else{
00208 Nadc = 2.0;
00209 result=Nadc;
00210
00211 }
00212 return result;
00213
00214 }
00215
00216 double EnergyResolutionVsLumi::calcresolutitonConstantTerm(double eta)
00217 {
00218 double muEM=this->calcmuEM(eta);
00219 double muHD=this->calcmuHD(eta);
00220 EvolutionECAL model;
00221 double result = model.ResolutionConstantTermEM50GeV(muEM+muHD);
00222 return result;
00223 }
00224
00225
00226 double EnergyResolutionVsLumi::Resolution(double eta, double ene)
00227 {
00228
00229
00230
00231 double S;
00232 double Nadc;
00233 double adc2GeV;
00234 double C;
00235 if(eta<1.497){
00236 S = 0.028;
00237 Nadc = 1.1;
00238 adc2GeV = 0.039;
00239 C = 0.003;
00240 }else{
00241 S = 0.052;
00242 Nadc = 2.0;
00243 adc2GeV = 0.069;
00244 C = 0.004;
00245 }
00246
00247
00248 DegradationAtEta d = CalculateDegradation(eta);
00249
00250
00251 S /= sqrt(d.ampDropTotal);
00252 Nadc *= d.noiseIncreaseADC;
00253 adc2GeV /= d.ampDropTotal;
00254 double N = Nadc*adc2GeV*3.0;
00255 C = sqrt(C*C + d.resolutitonConstantTerm*d.resolutitonConstantTerm);
00256
00257 return sqrt(S*S/ene + N*N/ene/ene + C*C);
00258
00259 }
00260
00261
00262
00263
00264
00265
00266
00267 void EnergyResolutionVsLumi::Decomposition()
00268 {
00269
00270 double eta = 2.2;
00271 m_instlumi = 5.0e+34;
00272 m_lumi = 3000.0;
00273
00274 DegradationAtEta d = this->CalculateDegradation(eta);
00275
00276
00277
00278 double S;
00279 double Nadc;
00280 double adc2GeV;
00281 double C;
00282 if(eta<1.497){
00283 S = 0.028;
00284 Nadc = 1.1;
00285 adc2GeV = 0.039;
00286 C = 0.003;
00287 }else{
00288 S = 0.052;
00289 Nadc = 2.0;
00290 adc2GeV = 0.069;
00291 C = 0.0038;
00292 }
00293
00294
00295
00296 S /= sqrt(d.ampDropTotal);
00297 Nadc *= d.noiseIncreaseADC;
00298 adc2GeV /= d.ampDropTotal;
00299
00300 C = sqrt(C*C + d.resolutitonConstantTerm*d.resolutitonConstantTerm);
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320 }
00321
00322
00323
00324
00325