CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes
EcalShowerContainmentCorrections Class Reference

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

Classes

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

Public Member Functions

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

Private Types

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

Private Member Functions

const double correctionXY (const EBDetId &xtal, double position, Direction dir, Type type) const
 

Private Attributes

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

Detailed Description

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

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

iESetup.get<EcalShowerContainmentCorrectionsRcd>().get(pGapCorr);
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

Member Function Documentation

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

The correction factor for 3x3 matrix.

Parameters
posis 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, vdt::x, and detailsBasic3DVector::y.

101  {
102 
103  double x= pos.X()*10; // correction functions use mm
104  double y= pos.Y()*10;
105 
106  double corrx = correctionXY(xtal,x,eX,e3x3);
107  double corry = correctionXY(xtal,y,eY,e3x3);
108 
109  return corrx*corry;
110 }
const double correctionXY(const EBDetId &xtal, double position, Direction dir, Type type) const
x
Definition: VDTMath.h:216
const double EcalShowerContainmentCorrections::correction5x5 ( const EBDetId xtal,
const math::XYZPoint pos 
) const

The correction factor for 5x5 matrix.

Parameters
posis 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, vdt::x, and detailsBasic3DVector::y.

117  {
118 
119  double x= pos.X()*10; // correction functions use mm
120  double y= pos.Y()*10;
121 
122  double corrx = correctionXY(xtal,x,eX,e5x5);
123  double corry = correctionXY(xtal,y,eY,e5x5);
124 
125  return corrx*corry;
126 }
const double correctionXY(const EBDetId &xtal, double position, Direction dir, Type type) const
x
Definition: VDTMath.h:216
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_, groupmap_, and DetId::rawId().

13 {
14  GroupMap::const_iterator iter = groupmap_.find(centerxtal.rawId());
15 
16  if (iter!=groupmap_.end()) {
17  int group =iter->second;
18  return coefficients_[group-1];
19  }
20 
21  edm::LogError("ShowerContaiment Correction not found");
22  return Coefficients();
23 
24 }
GroupMap groupmap_
Maps in which group a particular xtal has been placed.
std::vector< Coefficients > coefficients_
Holds the coeffiecients. The index corresponds to the group.
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
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_, corr, EcalShowerContainmentCorrections::Coefficients::data, e5x5, eY, groupmap_, i, EcalShowerContainmentCorrections::Coefficients::kPolynomialDegree, evf::evtn::offset(), and funct::pow().

Referenced by correction3x3(), and correction5x5().

74  {
75 
76  GroupMap::const_iterator iter=groupmap_.find(xtal);
77  if (iter==groupmap_.end()) return -1;
78 
79  int group=iter->second;
81 
82  int offset=0;
83 
84  if (dir==eY) offset+= 2* Coefficients::kPolynomialDegree;
86  if (type==e5x5) offset+= 4* Coefficients::kPolynomialDegree;
87 
88  double corr=0;
89 
90  for ( int i=offset;
92  ++i){
93  corr+= coeff.data[i] * pow( position ,i-offset) ;
94  }
95 
96  return corr;
97 }
type
Definition: HCALResponse.h:22
int i
Definition: DBlmapReader.cc:9
GroupMap groupmap_
Maps in which group a particular xtal has been placed.
Structure defining the container for correction coefficients.
std::vector< Coefficients > coefficients_
Holds the coeffiecients. The index corresponds to the group.
static const int kPolynomialDegree
The degree of the polynomial used as correction function plus one.
unsigned int offset(bool)
JetCorrectorParameters corr
Definition: classes.h:9
static int position[264][3]
Definition: ReadPGInfo.cc:509
dbl *** dir
Definition: mlp_gen.cc:35
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
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_, and groupmap_.

Referenced by fillCorrectionCoefficients().

28  {
29 
30  // do not replace if we already have the xtal
31  if (groupmap_.find(xtal)!=groupmap_.end()) return;
32  groupmap_[xtal]=group;
33 
34 
35  if (coefficients_.size()<(unsigned int)(group)) {
36  coefficients_.resize(group);
37  coefficients_[group-1]=coefficients;
38  }
39 
40  // we don't need to fill coefficients if the group has already been inserted
41 
42 
43 }
GroupMap groupmap_
Maps in which group a particular xtal has been placed.
std::vector< Coefficients > coefficients_
Holds the coeffiecients. The index corresponds to the group.
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 cond::rpcobgas::detid, fillCorrectionCoefficients(), EBDetId::kModulesPerSM, and EBDetId::SMCRYSTALMODE.

48  {
49 
50 
52  edm::LogError("Invalid Module Number");
53  return;
54  }
55 
56 
57  // what is EBDetID::kModuleBoundaries ? we better redefine them here ...
58  const int kModuleLow[]={1,501,901,1301};
59  const int kModuleHigh[]={500,900,1300,1700};
60 
61  for (int xtal =kModuleLow[module-1] ; xtal <= kModuleHigh[module-1];++xtal){
62  EBDetId detid(supermodule,xtal,EBDetId::SMCRYSTALMODE);
64  }
65 
66 }
static const int kModulesPerSM
Definition: EBDetId.h:126
static const int SMCRYSTALMODE
Definition: EBDetId.h:146
Definition: vlib.h:209
void fillCorrectionCoefficients(const EBDetId &xtal, int group, const Coefficients &coefficients)
Fill the correction coefficients for a given xtal, part of group .

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().