CMS 3D CMS Logo

EcalShowerContainmentCorrections Class Reference

Description: Holds the coefficients of a polynomial that describes the shower containment. More...

#include <src/CondFormats/interface/EcalShowerContainmentCorrections.h>

List of all members.

Public Member Functions

const double correction3x3 (const EBDetId &xtal, const math::XYZPoint &pos) const
 The correction factor for 3x3 matrix.
const double correction5x5 (const EBDetId &xtal, const math::XYZPoint &pos) const
 The correction factor for 5x5 matrix.
const Coefficients correctionCoefficients (const EBDetId &centerxtal) const
 Get the correction coefficients for the given xtal.
void fillCorrectionCoefficients (const int supermodule, const int module, const Coefficients &coefficients)
 Fill the correction coefficients for a given Ecal module.
void fillCorrectionCoefficients (const EBDetId &xtal, int group, const Coefficients &coefficients)
 Fill the correction coefficients for a given xtal, part of group .

Private Types

enum  Direction { eX, eY }
typedef std::map< EBDetId, intGroupMap
enum  Type { e3x3, e5x5 }

Private Member Functions

const double correctionXY (const EBDetId &xtal, double position, Direction dir, Type type) const
 Calculate the correction for the given direction and type.

Private Attributes

std::vector< Coefficientscoefficients_
 Holds the coeffiecients. The index corresponds to the group.
GroupMap groupmap_
 Maps in which group a particular xtal has been placed.

Classes

struct  Coefficients
 Structure defining the container for correction coefficients. More...


Detailed Description

Description: Holds the coefficients of a polynomial that describes the shower containment.

Usage example(for real code see CalibCalorimetry/EcalCorrectionModules/test) :

 ESHandle<EcalShowerContainmentCorrections> pGapCorr;
 iESetup.get<EcalShowerContainmentCorrectionsRcd>().get(pGapCorr);
  
 PositionCalc pos(...);
 
 Hep3Vector clusterPos= pos.CalculatePos(...);        
 math::XYZPoint mathpoint(clusterPos.x(),clusterPos.y(),clusterPos.z());
 
 double correction3x3 = pGapCorr->correction3x3(centerXtal,mathpoint);
 double correction5x5 = pGapCorr->correction5x5(centerXtal,mathpoint);
Author:
Stefano Argiro'
Date:
Fri Mar 2 16:50:49 CET 2007
Id
EcalShowerContainmentCorrections.h,v 1.2 2007/07/16 17:30:53 meridian Exp

Definition at line 44 of file EcalShowerContainmentCorrections.h.


Member Typedef Documentation

typedef std::map<EBDetId,int> EcalShowerContainmentCorrections::GroupMap [private]

Definition at line 136 of file EcalShowerContainmentCorrections.h.


Member Enumeration Documentation

enum EcalShowerContainmentCorrections::Direction [private]

Enumerator:
eX 
eY 

Definition at line 126 of file EcalShowerContainmentCorrections.h.

00126 {eX,eY};

enum EcalShowerContainmentCorrections::Type [private]

Enumerator:
e3x3 
e5x5 

Definition at line 127 of file EcalShowerContainmentCorrections.h.

00127 {e3x3,e5x5};


Member Function Documentation

const double EcalShowerContainmentCorrections::correction3x3 ( const EBDetId xtal,
const math::XYZPoint pos 
) const

The correction factor for 3x3 matrix.

Parameters:
pos is the distance in cm from the center of the xtal as calculated in RecoEcal/EgammaCoreTools/interface/PositionCalc.h The valid return value is in the range (0,1] (divide by this value to apply the correction) Returns -1 if correction is not avaiable for that xtal

Definition at line 100 of file EcalShowerContainmentCorrections.cc.

References correctionXY(), e3x3, eX, eY, x, and y.

00101                                                                              {
00102     
00103   double x= pos.X()*10; // correction functions use mm
00104   double y= pos.Y()*10;
00105 
00106   double corrx = correctionXY(xtal,x,eX,e3x3);
00107   double corry = correctionXY(xtal,y,eY,e3x3);
00108   
00109   return corrx*corry;
00110 }

const double EcalShowerContainmentCorrections::correction5x5 ( const EBDetId xtal,
const math::XYZPoint pos 
) const

The correction factor for 5x5 matrix.

Parameters:
pos is the distance in cm from the center of the xtal as calculated in RecoEcal/EgammaCoreTools/interface/PositionCalc.h The return value is in the range (0,1] (divide by this value to apply the correction) Returns -1 if correction is not avaiable for that xtal

Definition at line 116 of file EcalShowerContainmentCorrections.cc.

References correctionXY(), e5x5, eX, eY, x, and y.

00117                                                                              {
00118     
00119   double x= pos.X()*10; // correction functions use mm
00120   double y= pos.Y()*10;
00121 
00122   double corrx = correctionXY(xtal,x,eX,e5x5);
00123   double corry = correctionXY(xtal,y,eY,e5x5);
00124   
00125   return corrx*corry;
00126 }

const EcalShowerContainmentCorrections::Coefficients EcalShowerContainmentCorrections::correctionCoefficients ( const EBDetId centerxtal  )  const

Get the correction coefficients for the given xtal.

Return zero coefficients in case the correction is not available for that xtal

Definition at line 12 of file EcalShowerContainmentCorrections.cc.

References coefficients_, group, groupmap_, iter, and DetId::rawId().

00013 {
00014   GroupMap::const_iterator iter = groupmap_.find(centerxtal.rawId());
00015 
00016   if (iter!=groupmap_.end()) {
00017     int group =iter->second;
00018     return coefficients_[group-1];
00019   }
00020 
00021   edm::LogError("ShowerContaiment Correction not found");
00022   return Coefficients();
00023 
00024 }

const double EcalShowerContainmentCorrections::correctionXY ( const EBDetId xtal,
double  position,
EcalShowerContainmentCorrections::Direction  dir,
EcalShowerContainmentCorrections::Type  type 
) const [private]

Calculate the correction for the given direction and type.

Definition at line 70 of file EcalShowerContainmentCorrections.cc.

References coefficients_, EcalShowerContainmentCorrections::Coefficients::data, e5x5, eY, group, groupmap_, i, iter, EcalShowerContainmentCorrections::Coefficients::kPolynomialDegree, offset, and funct::pow().

Referenced by correction3x3(), and correction5x5().

00074                                        {
00075   
00076   GroupMap::const_iterator iter=groupmap_.find(xtal);
00077   if (iter==groupmap_.end()) return -1;
00078 
00079   int group=iter->second;
00080   EcalShowerContainmentCorrections::Coefficients coeff=coefficients_[group-1];
00081 
00082   int offset=0;
00083   
00084   if (dir==eY)    offset+=  2* Coefficients::kPolynomialDegree;
00085   if (position<0) offset+=     Coefficients::kPolynomialDegree;
00086   if (type==e5x5) offset+=  4* Coefficients::kPolynomialDegree;
00087 
00088   double corr=0;
00089 
00090   for (  int i=offset; 
00091          i<offset+Coefficients::kPolynomialDegree; 
00092          ++i){  
00093     corr+= coeff.data[i] * pow( position ,i-offset) ;    
00094   }
00095 
00096   return corr;  
00097 }

void EcalShowerContainmentCorrections::fillCorrectionCoefficients ( const int  supermodule,
const int  module,
const Coefficients coefficients 
)

Fill the correction coefficients for a given Ecal module.

Assume that corresponding modules in different supermodules use the same coefficients

Definition at line 47 of file EcalShowerContainmentCorrections.cc.

References fillCorrectionCoefficients(), EBDetId::kModulesPerSM, and EBDetId::SMCRYSTALMODE.

00048                                                                               {
00049 
00050 
00051   if (module>EBDetId::kModulesPerSM) {
00052     edm::LogError("Invalid Module Number");
00053     return;
00054   }
00055 
00056 
00057   // what is EBDetID::kModuleBoundaries ? we better redefine them here ...
00058   const int kModuleLow[]={1,501,901,1301};
00059   const int kModuleHigh[]={500,900,1300,1700};
00060 
00061   for (int xtal =kModuleLow[module-1] ; xtal <= kModuleHigh[module-1];++xtal){
00062     EBDetId detid(supermodule,xtal,EBDetId::SMCRYSTALMODE);
00063     fillCorrectionCoefficients(detid,module,coefficients);
00064   }
00065   
00066 }

void EcalShowerContainmentCorrections::fillCorrectionCoefficients ( const EBDetId xtal,
int  group,
const Coefficients coefficients 
)

Fill the correction coefficients for a given xtal, part of group .

Do not replace if xtal is already there

Definition at line 28 of file EcalShowerContainmentCorrections.cc.

References coefficients_, groupmap_, and int.

Referenced by fillCorrectionCoefficients().

00028                                                                                                                             {
00029 
00030   // do not replace if we already have the xtal
00031   if (groupmap_.find(xtal)!=groupmap_.end()) return;
00032   groupmap_[xtal]=group;
00033 
00034 
00035   if (coefficients_.size()<(unsigned int)(group)) {
00036     coefficients_.resize(group);
00037     coefficients_[group-1]=coefficients;
00038   }
00039 
00040   // we don't need to fill coefficients if the group has already been inserted
00041 
00042 
00043 }


Member Data Documentation

std::vector<Coefficients> EcalShowerContainmentCorrections::coefficients_ [private]

Holds the coeffiecients. The index corresponds to the group.

Definition at line 143 of file EcalShowerContainmentCorrections.h.

Referenced by correctionCoefficients(), correctionXY(), and fillCorrectionCoefficients().

GroupMap EcalShowerContainmentCorrections::groupmap_ [private]

Maps in which group a particular xtal has been placed.

Definition at line 139 of file EcalShowerContainmentCorrections.h.

Referenced by correctionCoefficients(), correctionXY(), and fillCorrectionCoefficients().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:19:53 2009 for CMSSW by  doxygen 1.5.4