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 &, edm::ConsumesCollector iC)
 
const EcalClusterCrackCorrParametersgetParameters () const
 
float getValue (const reco::BasicCluster &, const EcalRecHitCollection &) const override
 
float getValue (const reco::SuperCluster &, const int mode) const override
 
float getValue (const reco::CaloCluster &) const override
 
void init (const edm::EventSetup &es) override
 
- Public Member Functions inherited from EcalClusterFunctionBaseClass
virtual ~EcalClusterFunctionBaseClass ()
 

Private Attributes

const CaloGeometrycaloGeom_ = nullptr
 
const edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeomToken_
 
const EcalClusterCrackCorrParametersparams_ = nullptr
 
const edm::ESGetToken< EcalClusterCrackCorrParameters, EcalClusterCrackCorrParametersRcdparamsToken_
 

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 24 of file EcalClusterCrackCorrection.cc.

Constructor & Destructor Documentation

◆ EcalClusterCrackCorrection()

EcalClusterCrackCorrection::EcalClusterCrackCorrection ( const edm::ParameterSet ,
edm::ConsumesCollector  iC 
)
inline

Definition at line 26 of file EcalClusterCrackCorrection.cc.

const edm::ESGetToken< EcalClusterCrackCorrParameters, EcalClusterCrackCorrParametersRcd > paramsToken_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_

Member Function Documentation

◆ checkInit()

void EcalClusterCrackCorrection::checkInit ( ) const

Definition at line 55 of file EcalClusterCrackCorrection.cc.

References Exception, and params_.

Referenced by getValue().

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

◆ getParameters()

const EcalClusterCrackCorrParameters* EcalClusterCrackCorrection::getParameters ( ) const
inline

Definition at line 30 of file EcalClusterCrackCorrection.cc.

References params_.

30 { return params_; }
const EcalClusterCrackCorrParameters * params_

◆ getValue() [1/3]

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

Implements EcalClusterFunctionBaseClass.

Definition at line 35 of file EcalClusterCrackCorrection.cc.

Referenced by getValue().

35 { return 1.f; }

◆ getValue() [2/3]

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

Implements EcalClusterFunctionBaseClass.

Definition at line 192 of file EcalClusterCrackCorrection.cc.

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

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 }
float getValue(const reco::BasicCluster &, const EcalRecHitCollection &) const override
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:79

◆ getValue() [3/3]

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

Reimplemented from EcalClusterFunctionBaseClass.

Definition at line 64 of file EcalClusterCrackCorrection.cc.

References funct::abs(), caloGeom_, checkInit(), funct::cos(), LEDCalibrationChannels::depth, DetId::Ecal, EcalBarrel, reco::CaloCluster::energy(), PV3DBase< T, PVType, FrameType >::eta(), reco::CaloCluster::eta(), f, dqmdumpme::first, g, relativeConstraints::geom, 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 ecalPiZeroTask_cfi::X0.

64  {
65  checkInit();
66 
67  //correction factor to be returned, and to be calculated in this present function:
68  double correction_factor = 1.;
69  double fetacor = 1.; //eta dependent part of the correction factor
70  double fphicor = 1.; //phi dependent part of the correction factor
71 
72  //********************************************************************************************************************//
73  //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
74 
75  //Beware: The user should make sure it only uses this correction factor for unconverted photons (or not breming electrons)
76 
77  //const reco::CaloClusterPtr & seedbclus = superCluster.seed();
78 
79  //If not barrel, return 1:
80  if (std::abs(seedbclus.eta()) > 1.4442)
81  return 1.;
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 }
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:154
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
T eta() const
Definition: PV3DBase.h:73
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
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
EcalFunctionParameters & params()
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
#define M_PI
double energy() const
cluster energy
Definition: CaloCluster.h:149
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
const EcalClusterCrackCorrParameters * params_
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:181
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72

◆ init()

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

Implements EcalClusterFunctionBaseClass.

Definition at line 50 of file EcalClusterCrackCorrection.cc.

References caloGeom_, geomToken_, edm::EventSetup::getData(), params_, and paramsToken_.

50  {
53 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::ESGetToken< EcalClusterCrackCorrParameters, EcalClusterCrackCorrParametersRcd > paramsToken_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
const EcalClusterCrackCorrParameters * params_

Member Data Documentation

◆ caloGeom_

const CaloGeometry* EcalClusterCrackCorrection::caloGeom_ = nullptr
private

Definition at line 47 of file EcalClusterCrackCorrection.cc.

Referenced by getValue(), and init().

◆ geomToken_

const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> EcalClusterCrackCorrection::geomToken_
private

Definition at line 45 of file EcalClusterCrackCorrection.cc.

Referenced by init().

◆ params_

const EcalClusterCrackCorrParameters* EcalClusterCrackCorrection::params_ = nullptr
private

Definition at line 46 of file EcalClusterCrackCorrection.cc.

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

◆ paramsToken_

const edm::ESGetToken<EcalClusterCrackCorrParameters, EcalClusterCrackCorrParametersRcd> EcalClusterCrackCorrection::paramsToken_
private

Definition at line 44 of file EcalClusterCrackCorrection.cc.

Referenced by init().