CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/SimG4CMS/Calo/src/EnergyResolutionVsLumi.cc

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   // Index of induced absorption due to EM damages in PWO4
00033   result.muEM = model.InducedAbsorptionEM(instLumi, eta);
00034   
00035   // Index of induced absorption due to hadron damages in PWO4
00036   result.muHD = model.InducedAbsorptionHadronic(totLumi, eta);
00037 
00038   // Average degradation of amplitude due to transparency change
00039   result.ampDropTransparency = model.DegradationMeanEM50GeV(result.muEM+result.muHD);
00040 
00041   // Average degradation of amplitude due to photo-detector aging
00042   result.ampDropPhotoDetector = model.AgingVPT(instLumi, totLumi, eta);
00043 
00044   result.ampDropTotal = result.ampDropTransparency*result.ampDropPhotoDetector;
00045 
00046   // Noise increase in ADC counts due to photo-detector and front-end
00047   result.noiseIncreaseADC =  model.NoiseFactorFE(totLumi, eta);
00048 
00049   // Resolution degradation due to LY non-uniformity caused by transparency loss
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           //std::cout<<"eta/mu/vpt"<<eta<<"/"<<r<<"/"<<v<<std::endl;
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   // noise increase in ADC
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     // endcaps no increase in ADC
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   // Initial parameters for ECAL resolution
00231   double S;
00232   double Nadc;
00233   double adc2GeV;
00234   double C;
00235   if(eta<1.497){
00236     S = 0.028;           // CMS note 2006/148 (EB test beam)
00237     Nadc = 1.1; 
00238     adc2GeV = 0.039;
00239     C = 0.003;
00240   }else{
00241     S = 0.052;          //  CMS DN 2009/002
00242     Nadc = 2.0;
00243     adc2GeV = 0.069;
00244     C = 0.004;
00245   }
00246 
00247 
00248   DegradationAtEta d = CalculateDegradation(eta);
00249 
00250   // adjust resolution parameters
00251   S /= sqrt(d.ampDropTotal);
00252   Nadc *= d.noiseIncreaseADC;
00253   adc2GeV /= d.ampDropTotal;
00254   double N = Nadc*adc2GeV*3.0;   // 3x3 noise in GeV 
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   // Initial parameters for ECAL resolution
00278   double S;
00279   double Nadc;
00280   double adc2GeV;
00281   double C;
00282   if(eta<1.497){
00283     S = 0.028;           // CMS note 2006/148 (EB test beam)
00284     Nadc = 1.1; 
00285     adc2GeV = 0.039;
00286     C = 0.003;
00287   }else{
00288     S = 0.052;          //  CMS DN 2009/002
00289     Nadc = 2.0;
00290     adc2GeV = 0.069;
00291     C = 0.0038;
00292   }
00293 
00294 
00295   // adjust resolution parameters
00296   S /= sqrt(d.ampDropTotal);
00297   Nadc *= d.noiseIncreaseADC;
00298   adc2GeV /= d.ampDropTotal;
00299   //  double N = Nadc*adc2GeV*3.0;   // 3x3 noise in GeV 
00300   C = sqrt(C*C + d.resolutitonConstantTerm*d.resolutitonConstantTerm);
00301 
00302 
00303 
00304   /*  for(double ene=1.0; ene<1e+3; ene*=1.1){
00305 
00306 
00307     // this is the resolution
00308 
00309     double res =  sqrt(S*S/ene + N*N/ene/ene + C*C);
00310 
00311     double factor = 1.0;
00312     factor = sin(2.0*atan(exp(-1.0*eta)));
00313   
00314 
00315   }
00316 
00317   */
00318 
00319 
00320 }
00321 
00322 
00323 
00324 
00325