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 | Friends
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
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

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

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

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);
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.1 2007/05/15 20:37:22 argiro Exp

Definition at line 46 of file EcalShowerContainmentCorrections.h.

Member Typedef Documentation

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

Definition at line 140 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 102 of file EcalShowerContainmentCorrections.cc.

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

103  {
104 
105  double x= pos.X()*10; // correction functions use mm
106  double y= pos.Y()*10;
107 
108  double corrx = correctionXY(xtal,x,eX,e3x3);
109  double corry = correctionXY(xtal,y,eY,e3x3);
110 
111  return corrx*corry;
112 }
const double correctionXY(const EBDetId &xtal, double position, Direction dir, Type type) const
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 118 of file EcalShowerContainmentCorrections.cc.

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

119  {
120 
121  double x= pos.X()*10; // correction functions use mm
122  double y= pos.Y()*10;
123 
124  double corrx = correctionXY(xtal,x,eX,e5x5);
125  double corry = correctionXY(xtal,y,eY,e5x5);
126 
127  return corrx*corry;
128 }
const double correctionXY(const EBDetId &xtal, double position, Direction dir, Type type) const
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 14 of file EcalShowerContainmentCorrections.cc.

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

15 {
16  GroupMap::const_iterator iter = groupmap_.find(centerxtal.rawId());
17 
18  if (iter!=groupmap_.end()) {
19  int group =iter->second;
20  return coefficients_[group-1];
21  }
22 
23  edm::LogError("ShowerContaiment Correction not found");
24  return Coefficients();
25 
26 }
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:43
tuple group
Definition: watchdog.py:82
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 72 of file EcalShowerContainmentCorrections.cc.

References coefficients_, corr, EcalShowerContainmentCorrections::Coefficients::data, e5x5, eY, watchdog::group, groupmap_, i, EcalShowerContainmentCorrections::Coefficients::kPolynomialDegree, hltrates_dqm_sourceclient-live_cfg::offset, and funct::pow().

Referenced by correction3x3(), and correction5x5().

76  {
77 
78  GroupMap::const_iterator iter=groupmap_.find(xtal);
79  if (iter==groupmap_.end()) return -1;
80 
81  int group=iter->second;
83 
84  int offset=0;
85 
86  if (dir==eY) offset+= 2* Coefficients::kPolynomialDegree;
88  if (type==e5x5) offset+= 4* Coefficients::kPolynomialDegree;
89 
90  double corr=0;
91 
92  for ( int i=offset;
94  ++i){
95  corr+= coeff.data[i] * pow( position ,i-offset) ;
96  }
97 
98  return corr;
99 }
type
Definition: HCALResponse.h:21
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.
JetCorrectorParameters corr
Definition: classes.h:5
tuple group
Definition: watchdog.py:82
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 30 of file EcalShowerContainmentCorrections.cc.

References coefficients_, watchdog::group, and groupmap_.

Referenced by fillCorrectionCoefficients().

30  {
31 
32  // do not replace if we already have the xtal
33  if (groupmap_.find(xtal)!=groupmap_.end()) return;
34  groupmap_[xtal]=group;
35 
36 
37  if (coefficients_.size()<(unsigned int)(group)) {
38  coefficients_.resize(group);
39  coefficients_[group-1]=coefficients;
40  }
41 
42  // we don't need to fill coefficients if the group has already been inserted
43 
44 
45 }
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.
tuple group
Definition: watchdog.py:82
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 49 of file EcalShowerContainmentCorrections.cc.

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

50  {
51 
52 
54  edm::LogError("Invalid Module Number");
55  return;
56  }
57 
58 
59  // what is EBDetID::kModuleBoundaries ? we better redefine them here ...
60  const int kModuleLow[]={1,501,901,1301};
61  const int kModuleHigh[]={500,900,1300,1700};
62 
63  for (int xtal =kModuleLow[module-1] ; xtal <= kModuleHigh[module-1];++xtal){
64  EBDetId detid(supermodule,xtal,EBDetId::SMCRYSTALMODE);
65  fillCorrectionCoefficients(detid,module,coefficients);
66  }
67 
68 }
static const int kModulesPerSM
Definition: EBDetId.h:147
static const int SMCRYSTALMODE
Definition: EBDetId.h:167
Definition: vlib.h:208
void fillCorrectionCoefficients(const EBDetId &xtal, int group, const Coefficients &coefficients)
Fill the correction coefficients for a given xtal, part of group .
template<class Archive >
void EcalShowerContainmentCorrections::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 150 of file EcalShowerContainmentCorrections.h.

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 150 of file EcalShowerContainmentCorrections.h.

Member Data Documentation

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

Holds the coeffiecients. The index corresponds to the group.

Definition at line 147 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 143 of file EcalShowerContainmentCorrections.h.

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