CMS 3D CMS Logo

List of all members | Public Member Functions
EcalClusterLocalContCorrection Class Reference

#include <EcalClusterLocalContCorrection.h>

Inheritance diagram for EcalClusterLocalContCorrection:
EcalClusterLocalContCorrectionBaseClass EcalClusterFunctionBaseClass

Public Member Functions

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

Additional Inherited Members

- Protected Attributes inherited from EcalClusterLocalContCorrectionBaseClass
const edm::EventSetupes_
 
edm::ESHandle< EcalClusterLocalContCorrParametersesParams_
 
const EcalClusterLocalContCorrParametersparams_
 

Detailed Description

Function to correct em object energy for energy not contained in a 5x5 crystal area in the calorimeter

$Id: EcalClusterLocalContCorrection.h $Date: $Revision:

Author
Federico Ferri, CEA Saclay, November 2008

Function to correct cluster for the so called local containment

$Id: EcalClusterLocalContCorrection.h $Date: $Revision:

Author
Federico Ferri, CEA Saclay, November 2008

Definition at line 15 of file EcalClusterLocalContCorrection.h.

Constructor & Destructor Documentation

EcalClusterLocalContCorrection::EcalClusterLocalContCorrection ( const edm::ParameterSet )
inline

Member Function Documentation

float EcalClusterLocalContCorrection::getValue ( const reco::BasicCluster basicCluster,
const EcalRecHitCollection recHit 
) const
overridevirtual

Implements EcalClusterLocalContCorrectionBaseClass.

Definition at line 27 of file EcalClusterLocalContCorrection.cc.

References gather_cfg::cout.

Referenced by EcalClusterLocalContCorrection().

28 {
29  checkInit();
30  // private member params_ = EcalClusterLocalContCorrectionParameters
31  // (see in CondFormats/EcalObjects/interface)
32  EcalFunctionParameters::const_iterator it;
33  std::cout << "[[EcalClusterLocalContCorrection::getValue]] "
34  << params_->params().size() << " parameters:";
35  for ( it = params_->params().begin(); it != params_->params().end(); ++it ) {
36  std::cout << " " << *it;
37  }
38  std::cout << "\n";
39  return 1;
40 }
EcalFunctionParameters & params()
const EcalClusterLocalContCorrParameters * params_
float EcalClusterLocalContCorrection::getValue ( const reco::SuperCluster superCluster,
const int  mode 
) const
overridevirtual

Implements EcalClusterLocalContCorrectionBaseClass.

Definition at line 43 of file EcalClusterLocalContCorrection.cc.

References Abs(), DEFINE_EDM_PLUGIN, egammaForCoreTracking_cff::depth, DetId::Ecal, EcalBarrel, reco::tau::disc::Eta(), PV3DBase< T, PVType, FrameType >::eta(), f, plotBeamSpotDB::first, g, relativeConstraints::geom, CaloSubdetectorGeometry::getGeometry(), CaloGeometry::getSubdetectorGeometry(), EBDetId::ieta(), EBDetId::iphi(), gen::k, cmsBatch::log, colinearityKinematic::Phi, PV3DBase< T, PVType, FrameType >::phi(), Pi, funct::pow(), reco::SuperCluster::seed(), PV3DBase< T, PVType, FrameType >::theta(), and X0.

44 {
45  checkInit();
46 
47  //correction factor to be returned, and to be calculated in this present function:
48  double correction_factor=1.;
49  double fetacor=1.; //eta dependent part of the correction factor
50  double fphicor=1.; //phi dependent part of the correction factor
51 
52  //********************************************************************************************************************//
53  //These local containment corrections correct a photon energy for leakage outside a 5x5 crystal cluster. They depend on the local position in the hit crystal. 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
54 
55  //Beware: The user should make sure it only uses this correction factor for unconverted photons (or not breming electrons)
56 
57 
58  const reco::CaloClusterPtr & seedbclus = superCluster.seed();
59 
60  //If not barrel, return 1:
61  if (TMath::Abs(seedbclus->eta()) >1.4442 ) return 1.;
62 
64  es_->get<CaloGeometryRecord>().get(pG);
65 
67 
68  const math::XYZPoint position_ = seedbclus->position();
69  double Theta = -position_.theta()+0.5*TMath::Pi();
70  double Eta = position_.eta();
71  double Phi = TVector2::Phi_mpi_pi(position_.phi());
72 
73  //Calculate expected depth of the maximum shower from energy (like in PositionCalc::Calculate_Location()):
74  // The parameters X0 and T0 are hardcoded here because these values were used to calculate the corrections:
75  const float X0 = 0.89; const float T0 = 7.4;
76  double depth = X0 * (T0 + log(seedbclus->energy()));
77 
78 
79  //search which crystal is closest to the cluster position and call it crystalseed:
80  //std::vector<DetId> crystals_vector = seedbclus->getHitsByDetId(); //deprecated
81  std::vector< std::pair<DetId, float> > crystals_vector = seedbclus->hitsAndFractions();
82  float dphimin=999.;
83  float detamin=999.;
84  int ietaclosest = 0;
85  int iphiclosest = 0;
86  for (unsigned int icry=0; icry!=crystals_vector.size(); ++icry) {
87  EBDetId crystal(crystals_vector[icry].first);
88  auto cell = geom->getGeometry(crystal);
89  GlobalPoint center_pos = cell->getPosition(depth);
90  double EtaCentr = center_pos.eta();
91  double PhiCentr = TVector2::Phi_mpi_pi(center_pos.phi());
92  if (TMath::Abs(EtaCentr-Eta) < detamin) {
93  detamin = TMath::Abs(EtaCentr-Eta);
94  ietaclosest = crystal.ieta();
95  }
96  if (TMath::Abs(TVector2::Phi_mpi_pi(PhiCentr-Phi)) < dphimin) {
97  dphimin = TMath::Abs(TVector2::Phi_mpi_pi(PhiCentr-Phi));
98  iphiclosest = crystal.iphi();
99  }
100  }
101  EBDetId crystalseed(ietaclosest, iphiclosest);
102 
103  // Get center cell position from shower depth
104  auto cell = geom->getGeometry(crystalseed);
105  GlobalPoint center_pos = cell->getPosition(depth);
106 
107  //if the seed crystal is neighbourgh of a supermodule border, don't apply the phi dependent containment corrections, but use the larger crack corrections instead.
108  int iphimod20 = TMath::Abs(iphiclosest%20);
109  if ( iphimod20 <=1 ) fphicor=1.;
110 
111  else{
112  double PhiCentr = TVector2::Phi_mpi_pi(center_pos.phi());
113  double PhiWidth = (TMath::Pi()/180.);
114  double PhiCry = (TVector2::Phi_mpi_pi(Phi-PhiCentr))/PhiWidth;
115  if (PhiCry>0.5) PhiCry=0.5;
116  if (PhiCry<-0.5) PhiCry=-0.5;
117  //Some flips to take into account ECAL barrel symmetries:
118  if (ietaclosest<0) PhiCry *= -1.;
119 
120  //Fetching parameters of the polynomial (see CMS IN-2009/013)
121  double g[5];
122  for (int k=0; k!=5; ++k) g[k] = (params_->params())[k+5];
123 
124  fphicor=0.;
125  for (int k=0; k!=5; ++k) fphicor += g[k]*std::pow(PhiCry,k);
126  }
127 
128  //if the seed crystal is neighbourgh of a module border, don't apply the eta dependent containment corrections, but use the larger crack corrections instead.
129  int ietamod20 = TMath::Abs(ietaclosest%20);
130  if (TMath::Abs(ietaclosest) >24 && (ietamod20==5 || ietamod20==6) ) fetacor = 1.;
131 
132  else
133  {
134  double ThetaCentr = -center_pos.theta()+0.5*TMath::Pi();
135  double ThetaWidth = (TMath::Pi()/180.)*TMath::Cos(ThetaCentr);
136  double EtaCry = (Theta-ThetaCentr)/ThetaWidth;
137  if (EtaCry>0.5) EtaCry=0.5;
138  if (EtaCry<-0.5) EtaCry=-0.5;
139  //flip to take into account ECAL barrel symmetries:
140  if (ietaclosest<0) EtaCry *= -1.;
141 
142  //Fetching parameters of the polynomial (see CMS IN-2009/013)
143  double f[5];
144  for (int k=0; k!=5; ++k) f[k] = (params_->params())[k];
145 
146  fetacor=0.;
147  for (int k=0; k!=5; ++k) fetacor += f[k]*std::pow(EtaCry,k);
148  }
149 
150 
151  correction_factor = (params_->params())[10]/(fetacor*fphicor);
152 
153  //*********************************************************************************************************************//
154 
155  //return the correction factor. Use it to multiply the cluster energy.
156  return correction_factor;
157 }
const double Pi
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:49
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
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
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
T Abs(T a)
Definition: MathUtil.h:49
EcalFunctionParameters & params()
double f[11][100]
int k[5][pyjets_maxn]
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
T eta() const
Definition: PV3DBase.h:76
const EcalClusterLocalContCorrParameters * params_
T get() const
Definition: EventSetup.h:63
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:66
static const double X0
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40