CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 45 of file EcalShowerContainmentCorrections.h.

Member Typedef Documentation

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

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

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

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

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

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

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

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 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
Log< level::Error, false > LogError
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
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.

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

Referenced by correction3x3(), and correction5x5().

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)
75  offset += 2 * Coefficients::kPolynomialDegree;
76  if (position < 0)
78  if (type == e5x5)
79  offset += 4 * Coefficients::kPolynomialDegree;
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 }
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.
tuple group
Definition: watchdog.py:82
static int position[264][3]
Definition: ReadPGInfo.cc:289
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
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 26 of file EcalShowerContainmentCorrections.cc.

References coefficients_, watchdog::group, and groupmap_.

Referenced by fillCorrectionCoefficients().

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

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

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 }
Log< level::Error, false > LogError
static const int kModulesPerSM
Definition: EBDetId.h:140
static const int SMCRYSTALMODE
Definition: EBDetId.h:159
tuple module
Definition: callgraph.py:69
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 129 of file EcalShowerContainmentCorrections.h.

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

Definition at line 129 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 127 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 124 of file EcalShowerContainmentCorrections.h.

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