CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
EcalClusterCrackCorrection Class Reference
Inheritance diagram for EcalClusterCrackCorrection:
EcalClusterFunctionBaseClass

Public Member Functions

void checkInit () const
 
 EcalClusterCrackCorrection (const edm::ParameterSet &)
 
const EcalClusterCrackCorrParametersgetParameters () const
 
float getValue (const reco::BasicCluster &, const EcalRecHitCollection &) const override
 
float getValue (const reco::CaloCluster &) const override
 
float getValue (const reco::SuperCluster &, const int mode) const override
 
void init (const edm::EventSetup &es) override
 
- Public Member Functions inherited from EcalClusterFunctionBaseClass
virtual ~EcalClusterFunctionBaseClass ()
 

Private Attributes

const edm::EventSetupes_
 
edm::ESHandle< EcalClusterCrackCorrParametersesParams_
 
const EcalClusterCrackCorrParametersparams_
 

Detailed Description

Function to correct cluster for cracks in the calorimeter

$Id: EcalClusterCrackCorrection.h $Date: $Revision:

Author
Federico Ferri, CEA Saclay, November 2008

Definition at line 22 of file EcalClusterCrackCorrection.cc.

Constructor & Destructor Documentation

◆ EcalClusterCrackCorrection()

EcalClusterCrackCorrection::EcalClusterCrackCorrection ( const edm::ParameterSet )
inline

Definition at line 24 of file EcalClusterCrackCorrection.cc.

24 {};

Member Function Documentation

◆ checkInit()

void EcalClusterCrackCorrection::checkInit ( ) const

Definition at line 52 of file EcalClusterCrackCorrection.cc.

52  {
53  if (!params_) {
54  // non initialized function parameters: throw exception
55  throw cms::Exception("EcalClusterCrackCorrection::checkInit()")
56  << "Trying to access an uninitialized crack correction function.\n"
57  "Please call `init( edm::EventSetup &)' before any use of the function.\n";
58  }
59 }

References Exception, and params_.

Referenced by getValue().

◆ getParameters()

const EcalClusterCrackCorrParameters* EcalClusterCrackCorrection::getParameters ( ) const
inline

Definition at line 27 of file EcalClusterCrackCorrection.cc.

27 { return params_; }

References params_.

◆ getValue() [1/3]

float EcalClusterCrackCorrection::getValue ( const reco::BasicCluster ,
const EcalRecHitCollection  
) const
inlineoverridevirtual

Implements EcalClusterFunctionBaseClass.

Definition at line 32 of file EcalClusterCrackCorrection.cc.

32 { return 1.f; }

Referenced by getValue().

◆ getValue() [2/3]

float EcalClusterCrackCorrection::getValue ( const reco::CaloCluster seedbclus) const
overridevirtual

Reimplemented from EcalClusterFunctionBaseClass.

Definition at line 61 of file EcalClusterCrackCorrection.cc.

61  {
62  checkInit();
63 
64  //correction factor to be returned, and to be calculated in this present function:
65  double correction_factor = 1.;
66  double fetacor = 1.; //eta dependent part of the correction factor
67  double fphicor = 1.; //phi dependent part of the correction factor
68 
69  //********************************************************************************************************************//
70  //These ECAL barrel module and supermodule border corrections correct a photon energy for leakage outside a 5x5 crystal cluster. They depend on the local position in the hit crystal. The hit crystal needs to be at the border of a barrel module. The local position coordinates, called later EtaCry and PhiCry in the code, are comprised between -0.5 and 0.5 and correspond to the distance between the photon supercluster position and the center of the hit crystal, expressed in number of crystal widthes. The correction parameters (that should be filled in CalibCalorimetry/EcalTrivialCondModules/python/EcalTrivialCondRetriever_cfi.py) were calculated using simulaion and thus take into account the effect of the magnetic field. They only apply to unconverted photons in the barrel, but a use for non brem electrons could be considered (not tested yet). For more details, cf the CMS internal note 2009-013 by S. Tourneur and C. Seez
71 
72  //Beware: The user should make sure it only uses this correction factor for unconverted photons (or not breming electrons)
73 
74  //const reco::CaloClusterPtr & seedbclus = superCluster.seed();
75 
76  //If not barrel, return 1:
77  if (std::abs(seedbclus.eta()) > 1.4442)
78  return 1.;
79 
81  es_->get<CaloGeometryRecord>().get(pG);
82 
84 
85  const math::XYZPoint &position_ = seedbclus.position();
86  double Theta = -position_.theta() + 0.5 * M_PI;
87  double Eta = position_.eta();
88  double Phi = TVector2::Phi_mpi_pi(position_.phi());
89 
90  //Calculate expected depth of the maximum shower from energy (like in PositionCalc::Calculate_Location()):
91  // The parameters X0 and T0 are hardcoded here because these values were used to calculate the corrections:
92  const float X0 = 0.89;
93  const float T0 = 7.4;
94  double depth = X0 * (T0 + log(seedbclus.energy()));
95 
96  //search which crystal is closest to the cluster position and call it crystalseed:
97  //std::vector<DetId> crystals_vector = seedbclus.getHitsByDetId(); //deprecated
98  std::vector<std::pair<DetId, float> > crystals_vector = seedbclus.hitsAndFractions();
99  float dphimin = 999.;
100  float detamin = 999.;
101  int ietaclosest = 0;
102  int iphiclosest = 0;
103  for (unsigned int icry = 0; icry != crystals_vector.size(); ++icry) {
104  EBDetId crystal(crystals_vector[icry].first);
105  auto cell = geom->getGeometry(crystal);
106  GlobalPoint center_pos = cell->getPosition(depth);
107  double EtaCentr = center_pos.eta();
108  double PhiCentr = TVector2::Phi_mpi_pi(center_pos.phi());
109  if (std::abs(EtaCentr - Eta) < detamin) {
110  detamin = std::abs(EtaCentr - Eta);
111  ietaclosest = crystal.ieta();
112  }
113  if (std::abs(TVector2::Phi_mpi_pi(PhiCentr - Phi)) < dphimin) {
114  dphimin = std::abs(TVector2::Phi_mpi_pi(PhiCentr - Phi));
115  iphiclosest = crystal.iphi();
116  }
117  }
118  EBDetId crystalseed(ietaclosest, iphiclosest);
119 
120  // Get center cell position from shower depth
121  auto cell = geom->getGeometry(crystalseed);
122  GlobalPoint center_pos = cell->getPosition(depth);
123 
124  //if the seed crystal isn't neighbourgh of a supermodule border, don't apply the phi dependent crack corrections, but use the smaller phi dependent local containment correction instead.
125  if (ietaclosest < 0)
126  iphiclosest = 361 - iphiclosest; //inversion of phi 3 degree tilt
127  int iphimod20 = iphiclosest % 20;
128  if (iphimod20 > 1)
129  fphicor = 1.;
130 
131  else {
132  double PhiCentr = TVector2::Phi_mpi_pi(center_pos.phi());
133  double PhiWidth = (M_PI / 180.);
134  double PhiCry = (TVector2::Phi_mpi_pi(Phi - PhiCentr)) / PhiWidth;
135  if (PhiCry > 0.5)
136  PhiCry = 0.5;
137  if (PhiCry < -0.5)
138  PhiCry = -0.5;
139  //flip to take into account ECAL barrel symmetries:
140  if (ietaclosest < 0)
141  PhiCry *= -1.;
142 
143  //Fetching parameters of the polynomial (see CMS IN-2009/013)
144  double g[5];
145  int offset = iphimod20 == 0 ? 10 //coefficients for one phi side of a SM
146  : 15; //coefficients for the other side
147  for (int k = 0; k != 5; ++k)
148  g[k] = (params_->params())[k + offset];
149 
150  fphicor = 0.;
151  for (int k = 0; k != 5; ++k)
152  fphicor += g[k] * std::pow(PhiCry, k);
153  }
154 
155  //if the seed crystal isn't neighbourgh of a module border, don't apply the eta dependent crack corrections, but use the smaller eta dependent local containment correction instead.
156  int ietamod20 = ietaclosest % 20;
157  if (std::abs(ietaclosest) < 25 || (std::abs(ietamod20) != 5 && std::abs(ietamod20) != 6))
158  fetacor = 1.;
159 
160  else {
161  double ThetaCentr = -center_pos.theta() + 0.5 * M_PI;
162  double ThetaWidth = (M_PI / 180.) * std::cos(ThetaCentr);
163  double EtaCry = (Theta - ThetaCentr) / ThetaWidth;
164  if (EtaCry > 0.5)
165  EtaCry = 0.5;
166  if (EtaCry < -0.5)
167  EtaCry = -0.5;
168  //flip to take into account ECAL barrel symmetries:
169  if (ietaclosest < 0)
170  EtaCry *= -1.;
171 
172  //Fetching parameters of the polynomial (see CMS IN-2009/013)
173  double f[5];
174  int offset = std::abs(ietamod20) == 5
175  ? 0 //coefficients for eta side of an intermodule gap closer to the interaction point
176  : 5; //coefficients for the other eta side
177  for (int k = 0; k != 5; ++k)
178  f[k] = (params_->params())[k + offset];
179 
180  fetacor = 0.;
181  for (int k = 0; k != 5; ++k)
182  fetacor += f[k] * std::pow(EtaCry, k);
183  }
184 
185  correction_factor = 1. / (fetacor * fphicor);
186  //*********************************************************************************************************************//
187 
188  //return the correction factor. Use it to multiply the cluster energy.
189  return correction_factor;
190 }

References funct::abs(), checkInit(), funct::cos(), LEDCalibrationChannels::depth, DetId::Ecal, EcalBarrel, reco::CaloCluster::energy(), es_, PV3DBase< T, PVType, FrameType >::eta(), reco::CaloCluster::eta(), f, dqmdumpme::first, g, relativeConstraints::geom, edm::EventSetup::get(), get, CaloGeometry::getSubdetectorGeometry(), reco::CaloCluster::hitsAndFractions(), EBDetId::ieta(), EBDetId::iphi(), dqmdumpme::k, dqm-mbProfile::log, M_PI, hltrates_dqm_sourceclient-live_cfg::offset, EcalFunParams::params(), params_, PV3DBase< T, PVType, FrameType >::phi(), VtxSmearedParameters_cfi::Phi, reco::CaloCluster::position(), funct::pow(), PV3DBase< T, PVType, FrameType >::theta(), and MonitorAlCaEcalPi0_cfi::X0.

◆ getValue() [3/3]

float EcalClusterCrackCorrection::getValue ( const reco::SuperCluster superCluster,
const int  mode 
) const
overridevirtual

Implements EcalClusterFunctionBaseClass.

Definition at line 192 of file EcalClusterCrackCorrection.cc.

192  {
193  checkInit();
194 
195  //********************************************************************************************************************//
196  //These ECAL barrel module and supermodule border corrections correct a photon energy for leakage outside a 5x5 crystal cluster. They depend on the local position in the hit crystal. The hit crystal needs to be at the border of a barrel module. The local position coordinates, called later EtaCry and PhiCry in the code, are comprised between -0.5 and 0.5 and correspond to the distance between the photon supercluster position and the center of the hit crystal, expressed in number of crystal widthes. The correction parameters (that should be filled in CalibCalorimetry/EcalTrivialCondModules/python/EcalTrivialCondRetriever_cfi.py) were calculated using simulaion and thus take into account the effect of the magnetic field. They only apply to unconverted photons in the barrel, but a use for non brem electrons could be considered (not tested yet). For more details, cf the CMS internal note 2009-013 by S. Tourneur and C. Seez
197 
198  //Beware: The user should make sure it only uses this correction factor for unconverted photons (or not breming electrons)
199 
200  return getValue(*(superCluster.seed()));
201 }

References checkInit(), getValue(), and reco::SuperCluster::seed().

◆ init()

void EcalClusterCrackCorrection::init ( const edm::EventSetup es)
overridevirtual

Implements EcalClusterFunctionBaseClass.

Definition at line 46 of file EcalClusterCrackCorrection.cc.

46  {
48  params_ = esParams_.product();
49  es_ = &es; //needed to access the ECAL geometry
50 }

References es_, esParams_, edm::EventSetup::get(), get, and params_.

Member Data Documentation

◆ es_

const edm::EventSetup* EcalClusterCrackCorrection::es_
private

Definition at line 43 of file EcalClusterCrackCorrection.cc.

Referenced by getValue(), and init().

◆ esParams_

edm::ESHandle<EcalClusterCrackCorrParameters> EcalClusterCrackCorrection::esParams_
private

Definition at line 41 of file EcalClusterCrackCorrection.cc.

Referenced by init().

◆ params_

const EcalClusterCrackCorrParameters* EcalClusterCrackCorrection::params_
private

Definition at line 42 of file EcalClusterCrackCorrection.cc.

Referenced by checkInit(), getParameters(), getValue(), and init().

f
double f[11][100]
Definition: MuScleFitUtils.cc:78
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
EBDetId
Definition: EBDetId.h:17
PV3DBase::theta
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
CaloGeometry::getSubdetectorGeometry
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
EcalClusterCrackCorrection::params_
const EcalClusterCrackCorrParameters * params_
Definition: EcalClusterCrackCorrection.cc:42
EcalClusterCrackCorrection::es_
const edm::EventSetup * es_
Definition: EcalClusterCrackCorrection.cc:43
dqmdumpme.first
first
Definition: dqmdumpme.py:55
EcalBarrel
Definition: EcalSubdetector.h:10
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
EcalClusterCrackCorrection::checkInit
void checkInit() const
Definition: EcalClusterCrackCorrection.cc:52
EcalClusterCrackCorrection::esParams_
edm::ESHandle< EcalClusterCrackCorrParameters > esParams_
Definition: EcalClusterCrackCorrection.cc:41
edm::ESHandle< CaloGeometry >
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
VtxSmearedParameters_cfi.Phi
Phi
Definition: VtxSmearedParameters_cfi.py:112
dqmdumpme.k
k
Definition: dqmdumpme.py:60
Point3DBase< float, GlobalTag >
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
EcalClusterCrackCorrection::getValue
float getValue(const reco::BasicCluster &, const EcalRecHitCollection &) const override
Definition: EcalClusterCrackCorrection.cc:32
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
reco::SuperCluster::seed
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:77
reco::CaloCluster::eta
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:181
reco::CaloCluster::hitsAndFractions
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
PV3DBase::eta
T eta() const
Definition: PV3DBase.h:73
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
MonitorAlCaEcalPi0_cfi.X0
X0
Definition: MonitorAlCaEcalPi0_cfi.py:77
DetId::Ecal
Definition: DetId.h:27
get
#define get
reco::CaloCluster::position
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:154
EcalFunParams::params
EcalFunctionParameters & params()
Definition: EcalFunctionParameters.h:13
Exception
Definition: hltDiff.cc:246
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
EcalClusterCrackCorrParametersRcd
Definition: EcalClusterCrackCorrParametersRcd.h:5
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:78
reco::CaloCluster::energy
double energy() const
cluster energy
Definition: CaloCluster.h:149
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
g
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4