CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/CondFormats/EcalCorrections/src/EcalGlobalShowerContainmentCorrectionsVsEta.cc

Go to the documentation of this file.
00001 // Implementation of class EcalGlobalShowerContainmentCorrectionsVsEta
00002 // Author: Paolo Meridiani
00003 // $Id: EcalGlobalShowerContainmentCorrectionsVsEta.cc,v 1.2 2007/07/16 17:30:54 meridian Exp $
00004 
00005 #include "CondFormats/EcalCorrections/interface/EcalGlobalShowerContainmentCorrectionsVsEta.h"
00006 #include <DataFormats/DetId/interface/DetId.h>
00007 #include <DataFormats/EcalDetId/interface/EBDetId.h>
00008 #include <FWCore/MessageLogger/interface/MessageLogger.h>
00009 //#include <iostream>
00010 
00011 
00012 const EcalGlobalShowerContainmentCorrectionsVsEta::Coefficients
00013 EcalGlobalShowerContainmentCorrectionsVsEta::correctionCoefficients() const {
00014   return coefficients_;
00015 }
00016 
00017 
00018 void 
00019 EcalGlobalShowerContainmentCorrectionsVsEta::fillCorrectionCoefficients(const Coefficients&  coefficients)
00020 {
00021   coefficients_=coefficients;
00022 }
00023 
00025 const double 
00026 EcalGlobalShowerContainmentCorrectionsVsEta::correction(const DetId& xtal, 
00027                                                         EcalGlobalShowerContainmentCorrectionsVsEta::Type type
00028                                                           ) const
00029 {
00030   if (xtal.det() == DetId::Ecal && xtal.subdetId() == EcalBarrel )
00031     {
00032       int offset=0;
00033       
00034       if (type==e5x5) offset+= Coefficients::kCoefficients;
00035       
00036       double corr=0;
00037       
00038       if (EBDetId(xtal).ieta() < coefficients_.data[0])
00039         corr=coefficients_.data[1];
00040       else
00041         corr=coefficients_.data[1] + coefficients_.data[2] * pow ( EBDetId(xtal).ieta() - coefficients_.data[0] , 2);
00042       
00043       return corr;
00044     }
00045   else if (xtal.det() == DetId::Ecal && xtal.subdetId() == EcalEndcap )
00046     return 1.;
00047   else
00048     return -1;
00049 }
00050 
00051 const double 
00052 EcalGlobalShowerContainmentCorrectionsVsEta::correction3x3(const DetId& xtal) const 
00053 {
00054   double corr = correction(xtal,e3x3);
00055   return corr;
00056 }
00057 
00058 
00059 
00060 
00061 const double 
00062 EcalGlobalShowerContainmentCorrectionsVsEta::correction5x5(const DetId& xtal) const 
00063 { 
00064   double corr = correction(xtal,e5x5);
00065   return corr;
00066 }
00067