CMS 3D CMS Logo

EcalShowerContainmentCorrections.cc
Go to the documentation of this file.
1 // Implementation of class EcalShowerContainmentCorrections
2 // Author: Stefano Argiro'
3 // $Id: EcalShowerContainmentCorrections.cc,v 1.1 2007/05/15 20:37:22 argiro Exp $
4 
8 //#include <iostream>
9 
12 
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 }
27 
28 
29 void
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 }
46 
47 
48 void
50  const Coefficients& coefficients){
51 
52 
53  if (module>EBDetId::kModulesPerSM) {
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 }
69 
71 const double
73  double position,
76  ) const{
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;
87  if (position<0) offset+= 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 }
100 
101 const double
103  const math::XYZPoint& pos) const {
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 }
113 
114 
115 
116 
117 const double
119  const math::XYZPoint& pos) const {
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 }
129 
type
Definition: HCALResponse.h:21
const double correctionXY(const EBDetId &xtal, double position, Direction dir, Type type) const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
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.
const double correction3x3(const EBDetId &xtal, const math::XYZPoint &pos) const
The correction factor for 3x3 matrix.
static const int kModulesPerSM
Definition: EBDetId.h:140
const double correction5x5(const EBDetId &xtal, const math::XYZPoint &pos) const
The correction factor for 5x5 matrix.
JetCorrectorParameters corr
Definition: classes.h:5
const Coefficients correctionCoefficients(const EBDetId &centerxtal) const
Get the correction coefficients for the given xtal.
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
static int position[264][3]
Definition: ReadPGInfo.cc:509
dbl *** dir
Definition: mlp_gen.cc:35
static const int SMCRYSTALMODE
Definition: EBDetId.h:159
Definition: vlib.h:208
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void fillCorrectionCoefficients(const EBDetId &xtal, int group, const Coefficients &coefficients)
Fill the correction coefficients for a given xtal, part of group .