Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:08

0001 // Implementation of class EcalGlobalShowerContainmentCorrectionsVsEta
0002 // Author: Paolo Meridiani
0003 // $Id: EcalGlobalShowerContainmentCorrectionsVsEta.cc,v 1.1 2007/07/13 17:37:04 meridian Exp $
0004 
0005 #include "CondFormats/EcalCorrections/interface/EcalGlobalShowerContainmentCorrectionsVsEta.h"
0006 #include <DataFormats/DetId/interface/DetId.h>
0007 #include <DataFormats/EcalDetId/interface/EBDetId.h>
0008 #include <FWCore/MessageLogger/interface/MessageLogger.h>
0009 //#include <iostream>
0010 
0011 const EcalGlobalShowerContainmentCorrectionsVsEta::Coefficients
0012 EcalGlobalShowerContainmentCorrectionsVsEta::correctionCoefficients() const {
0013   return coefficients_;
0014 }
0015 
0016 void EcalGlobalShowerContainmentCorrectionsVsEta::fillCorrectionCoefficients(const Coefficients& coefficients) {
0017   coefficients_ = coefficients;
0018 }
0019 
0020 /** Calculate the correction for the given direction and type  */
0021 const double EcalGlobalShowerContainmentCorrectionsVsEta::correction(
0022     const DetId& xtal, EcalGlobalShowerContainmentCorrectionsVsEta::Type type) const {
0023   if (xtal.det() == DetId::Ecal && xtal.subdetId() == EcalBarrel) {
0024     double corr = 0;
0025 
0026     if (EBDetId(xtal).ieta() < coefficients_.data[0])
0027       corr = coefficients_.data[1];
0028     else
0029       corr = coefficients_.data[1] + coefficients_.data[2] * pow(EBDetId(xtal).ieta() - coefficients_.data[0], 2);
0030 
0031     return corr;
0032   } else if (xtal.det() == DetId::Ecal && xtal.subdetId() == EcalEndcap)
0033     return 1.;
0034   else
0035     return -1;
0036 }
0037 
0038 const double EcalGlobalShowerContainmentCorrectionsVsEta::correction3x3(const DetId& xtal) const {
0039   double corr = correction(xtal, e3x3);
0040   return corr;
0041 }
0042 
0043 const double EcalGlobalShowerContainmentCorrectionsVsEta::correction5x5(const DetId& xtal) const {
0044   double corr = correction(xtal, e5x5);
0045   return corr;
0046 }