CMS 3D CMS Logo

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 @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);
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
Id
EcalShowerContainmentCorrections.h,v 1.1 2007/05/15 20:37:22 argiro Exp

Definition at line 45 of file EcalShowerContainmentCorrections.h.

Member Typedef Documentation

◆ GroupMap

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

Definition at line 121 of file EcalShowerContainmentCorrections.h.

Member Enumeration Documentation

◆ Direction

Enumerator
eX 
eY 

Definition at line 115 of file EcalShowerContainmentCorrections.h.

115 { eX, eY };

◆ Type

Enumerator
e3x3 
e5x5 

Definition at line 116 of file EcalShowerContainmentCorrections.h.

116 { e3x3, e5x5 };

Member Function Documentation

◆ correction3x3()

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 90 of file EcalShowerContainmentCorrections.cc.

90  {
91  double x = pos.X() * 10; // correction functions use mm
92  double y = pos.Y() * 10;
93 
94  double corrx = correctionXY(xtal, x, eX, e3x3);
95  double corry = correctionXY(xtal, y, eY, e3x3);
96 
97  return corrx * corry;
98 }

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

◆ correction5x5()

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 100 of file EcalShowerContainmentCorrections.cc.

100  {
101  double x = pos.X() * 10; // correction functions use mm
102  double y = pos.Y() * 10;
103 
104  double corrx = correctionXY(xtal, x, eX, e5x5);
105  double corry = correctionXY(xtal, y, eY, e5x5);
106 
107  return corrx * corry;
108 }

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

◆ correctionCoefficients()

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 13 of file EcalShowerContainmentCorrections.cc.

14  {
15  GroupMap::const_iterator iter = groupmap_.find(centerxtal.rawId());
16 
17  if (iter != groupmap_.end()) {
18  int group = iter->second;
19  return coefficients_[group - 1];
20  }
21 
22  edm::LogError("ShowerContaiment Correction not found");
23  return Coefficients();
24 }

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

◆ correctionXY()

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 61 of file EcalShowerContainmentCorrections.cc.

64  {
65  GroupMap::const_iterator iter = groupmap_.find(xtal);
66  if (iter == groupmap_.end())
67  return -1;
68 
69  int group = iter->second;
71 
72  int offset = 0;
73 
74  if (dir == eY)
76  if (position < 0)
78  if (type == e5x5)
80 
81  double corr = 0;
82 
83  for (int i = offset; i < offset + Coefficients::kPolynomialDegree; ++i) {
84  corr += coeff.data[i] * pow(position, i - offset);
85  }
86 
87  return corr;
88 }

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

Referenced by correction3x3(), and correction5x5().

◆ fillCorrectionCoefficients() [1/2]

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

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

Do not replace if xtal is already there

Definition at line 26 of file EcalShowerContainmentCorrections.cc.

28  {
29  // do not replace if we already have the xtal
30  if (groupmap_.find(xtal) != groupmap_.end())
31  return;
32  groupmap_[xtal] = group;
33 
34  if (coefficients_.size() < (unsigned int)(group)) {
35  coefficients_.resize(group);
36  coefficients_[group - 1] = coefficients;
37  }
38 
39  // we don't need to fill coefficients if the group has already been inserted
40 }

References coefficients_, watchdog::group, groupmap_, and createfilelist::int.

Referenced by fillCorrectionCoefficients().

◆ fillCorrectionCoefficients() [2/2]

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 42 of file EcalShowerContainmentCorrections.cc.

44  {
46  edm::LogError("Invalid Module Number");
47  return;
48  }
49 
50  // what is EBDetID::kModuleBoundaries ? we better redefine them here ...
51  const int kModuleLow[] = {1, 501, 901, 1301};
52  const int kModuleHigh[] = {500, 900, 1300, 1700};
53 
54  for (int xtal = kModuleLow[module - 1]; xtal <= kModuleHigh[module - 1]; ++xtal) {
55  EBDetId detid(supermodule, xtal, EBDetId::SMCRYSTALMODE);
56  fillCorrectionCoefficients(detid, module, coefficients);
57  }
58 }

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

◆ serialize()

template<class Archive >
void EcalShowerContainmentCorrections::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 129 of file EcalShowerContainmentCorrections.h.

◆ cond::serialization::access

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

Definition at line 129 of file EcalShowerContainmentCorrections.h.

Member Data Documentation

◆ coefficients_

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

Holds the coeffiecients. The index corresponds to the group.

Definition at line 127 of file EcalShowerContainmentCorrections.h.

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

◆ groupmap_

GroupMap EcalShowerContainmentCorrections::groupmap_
private

Maps in which group a particular xtal has been placed.

Definition at line 124 of file EcalShowerContainmentCorrections.h.

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

EcalShowerContainmentCorrections::correction3x3
const double correction3x3(const EBDetId &xtal, const math::XYZPoint &pos) const
The correction factor for 3x3 matrix.
Definition: EcalShowerContainmentCorrections.cc:90
DDAxes::y
mps_fire.i
i
Definition: mps_fire.py:428
EcalShowerContainmentCorrections::Coefficients::kPolynomialDegree
static const int kPolynomialDegree
The degree of the polynomial used as correction function plus one.
Definition: EcalShowerContainmentCorrections.h:73
EBDetId
Definition: EBDetId.h:17
EcalShowerContainmentCorrections::e3x3
Definition: EcalShowerContainmentCorrections.h:116
pos
Definition: PixelAliasList.h:18
ESHandle
DDAxes::x
EcalShowerContainmentCorrections::eX
Definition: EcalShowerContainmentCorrections.h:115
EBDetId::kModulesPerSM
static const int kModulesPerSM
Definition: EBDetId.h:140
EcalShowerContainmentCorrections::Coefficients
Structure defining the container for correction coefficients.
Definition: EcalShowerContainmentCorrections.h:58
EcalShowerContainmentCorrections::e5x5
Definition: EcalShowerContainmentCorrections.h:116
alignCSCRings.corr
dictionary corr
Definition: alignCSCRings.py:124
EcalShowerContainmentCorrectionsRcd
Definition: EcalShowerContainmentCorrectionsRcd.h:5
EcalShowerContainmentCorrections::eY
Definition: EcalShowerContainmentCorrections.h:115
EcalShowerContainmentCorrections::coefficients_
std::vector< Coefficients > coefficients_
Holds the coeffiecients. The index corresponds to the group.
Definition: EcalShowerContainmentCorrections.h:127
EcalShowerContainmentCorrections::correction5x5
const double correction5x5(const EBDetId &xtal, const math::XYZPoint &pos) const
The correction factor for 5x5 matrix.
Definition: EcalShowerContainmentCorrections.cc:100
EcalShowerContainmentCorrections::Coefficients::data
double data[kSize]
Definition: EcalShowerContainmentCorrections.h:79
EcalShowerContainmentCorrections::groupmap_
GroupMap groupmap_
Maps in which group a particular xtal has been placed.
Definition: EcalShowerContainmentCorrections.h:124
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
PositionCalc
Definition: PositionCalc.h:29
createfilelist.int
int
Definition: createfilelist.py:10
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
callgraph.module
module
Definition: callgraph.py:61
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
EcalShowerContainmentCorrections::correctionXY
const double correctionXY(const EBDetId &xtal, double position, Direction dir, Type type) const
Definition: EcalShowerContainmentCorrections.cc:61
EcalShowerContainmentCorrections::fillCorrectionCoefficients
void fillCorrectionCoefficients(const EBDetId &xtal, int group, const Coefficients &coefficients)
Fill the correction coefficients for a given xtal, part of group @group.
Definition: EcalShowerContainmentCorrections.cc:26
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
EBDetId::SMCRYSTALMODE
static const int SMCRYSTALMODE
Definition: EBDetId.h:159
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
watchdog.group
group
Definition: watchdog.py:82