CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
EcalClusterCrackCorrection Class Reference

#include <EcalClusterCrackCorrection.h>

Inheritance diagram for EcalClusterCrackCorrection:
EcalClusterCrackCorrectionBaseClass EcalClusterFunctionBaseClass

Public Member Functions

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

Additional Inherited Members

- Protected Attributes inherited from EcalClusterCrackCorrectionBaseClass
const edm::EventSetupes_
 
edm::ESHandle
< EcalClusterCrackCorrParameters
esParams_
 
const
EcalClusterCrackCorrParameters
params_
 

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 15 of file EcalClusterCrackCorrection.h.

Constructor & Destructor Documentation

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

Definition at line 17 of file EcalClusterCrackCorrection.h.

17 {};

Member Function Documentation

float EcalClusterCrackCorrection::getValue ( const reco::BasicCluster basicCluster,
const EcalRecHitCollection recHit 
) const
virtual

Implements EcalClusterCrackCorrectionBaseClass.

Definition at line 26 of file EcalClusterCrackCorrection.cc.

References EcalClusterCrackCorrectionBaseClass::checkInit(), gather_cfg::cout, EcalFunParams::params(), and EcalClusterCrackCorrectionBaseClass::params_.

Referenced by getValue().

27 {
28  //this is a dummy function, could be deleted in mother classes and here
29  checkInit();
30 
31  // private member params_ = EcalClusterCrackCorrectionParameters
32  // (see in CondFormats/EcalObjects/interface)
33  EcalFunctionParameters::const_iterator it;
34  std::cout << "[[EcalClusterCrackCorrectionBaseClass::getValue]] "
35  << params_->params().size() << " parameters:";
36  for ( it = params_->params().begin(); it != params_->params().end(); ++it ) {
37  std::cout << " " << *it;
38  }
39  std::cout << "\n";
40  return 1;
41 }
const EcalClusterCrackCorrParameters * params_
EcalFunctionParameters & params()
tuple cout
Definition: gather_cfg.py:121
float EcalClusterCrackCorrection::getValue ( const reco::SuperCluster superCluster,
const int  mode 
) const
virtual

Implements EcalClusterCrackCorrectionBaseClass.

Definition at line 174 of file EcalClusterCrackCorrection.cc.

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

175 {
176  checkInit();
177 
178  //********************************************************************************************************************//
179  //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
180 
181  //Beware: The user should make sure it only uses this correction factor for unconverted photons (or not breming electrons)
182 
183  return getValue(*(superCluster.seed()));
184 
185 
186 }
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:68
virtual float getValue(const reco::BasicCluster &, const EcalRecHitCollection &) const
float EcalClusterCrackCorrection::getValue ( const reco::CaloCluster seedbclus) const
virtual

Reimplemented from EcalClusterCrackCorrectionBaseClass.

Definition at line 44 of file EcalClusterCrackCorrection.cc.

References EcalClusterCrackCorrectionBaseClass::checkInit(), DetId::Ecal, EcalBarrel, reco::CaloCluster::energy(), EcalClusterCrackCorrectionBaseClass::es_, reco::tau::disc::Eta(), PV3DBase< T, PVType, FrameType >::eta(), reco::CaloCluster::eta(), f, first, g, relativeConstraints::geom, edm::EventSetup::get(), CaloSubdetectorGeometry::getGeometry(), reco::CaloCluster::hitsAndFractions(), EBDetId::ieta(), EBDetId::iphi(), gen::k, create_public_lumi_plots::log, evf::evtn::offset(), EcalFunParams::params(), EcalClusterCrackCorrectionBaseClass::params_, colinearityKinematic::Phi, PV3DBase< T, PVType, FrameType >::phi(), Phi_mpi_pi(), Pi, reco::CaloCluster::position(), funct::pow(), PV3DBase< T, PVType, FrameType >::theta(), and X0.

45 {
46  checkInit();
47 
48  //correction factor to be returned, and to be calculated in this present function:
49  double correction_factor=1.;
50  double fetacor=1.; //eta dependent part of the correction factor
51  double fphicor=1.; //phi dependent part of the correction factor
52 
53 
54  //********************************************************************************************************************//
55  //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
56 
57  //Beware: The user should make sure it only uses this correction factor for unconverted photons (or not breming electrons)
58 
59  //const reco::CaloClusterPtr & seedbclus = superCluster.seed();
60 
61  //If not barrel, return 1:
62  if (TMath::Abs(seedbclus.eta()) >1.4442 ) return 1.;
63 
65  es_->get<CaloGeometryRecord>().get(pG);
66 
67  const CaloSubdetectorGeometry* geom=pG->getSubdetectorGeometry(DetId::Ecal,EcalBarrel);//EcalBarrel = 1
68 
69  const math::XYZPoint position_ = seedbclus.position();
70  double Theta = -position_.theta()+0.5*TMath::Pi();
71  double Eta = position_.eta();
72  double Phi = TVector2::Phi_mpi_pi(position_.phi());
73 
74  //Calculate expected depth of the maximum shower from energy (like in PositionCalc::Calculate_Location()):
75  // The parameters X0 and T0 are hardcoded here because these values were used to calculate the corrections:
76  const float X0 = 0.89; const float T0 = 7.4;
77  double depth = X0 * (T0 + log(seedbclus.energy()));
78 
79 
80  //search which crystal is closest to the cluster position and call it crystalseed:
81  //std::vector<DetId> crystals_vector = seedbclus.getHitsByDetId(); //deprecated
82  std::vector< std::pair<DetId, float> > crystals_vector = seedbclus.hitsAndFractions();
83  float dphimin=999.;
84  float detamin=999.;
85  int ietaclosest = 0;
86  int iphiclosest = 0;
87  for (unsigned int icry=0; icry!=crystals_vector.size(); ++icry) {
88  EBDetId crystal(crystals_vector[icry].first);
89  const CaloCellGeometry* cell=geom->getGeometry(crystal);
90  GlobalPoint center_pos = (dynamic_cast<const TruncatedPyramid*>(cell))->getPosition(depth);
91  double EtaCentr = center_pos.eta();
92  double PhiCentr = TVector2::Phi_mpi_pi(center_pos.phi());
93  if (TMath::Abs(EtaCentr-Eta) < detamin) {
94  detamin = TMath::Abs(EtaCentr-Eta);
95  ietaclosest = crystal.ieta();
96  }
97  if (TMath::Abs(TVector2::Phi_mpi_pi(PhiCentr-Phi)) < dphimin) {
98  dphimin = TMath::Abs(TVector2::Phi_mpi_pi(PhiCentr-Phi));
99  iphiclosest = crystal.iphi();
100  }
101  }
102  EBDetId crystalseed(ietaclosest, iphiclosest);
103 
104  // Get center cell position from shower depth
105  const CaloCellGeometry* cell=geom->getGeometry(crystalseed);
106  GlobalPoint center_pos = (dynamic_cast<const TruncatedPyramid*>(cell))->getPosition(depth);
107 
108  //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.
109  if (ietaclosest<0) iphiclosest = 361 - iphiclosest; //inversion of phi 3 degree tilt
110  int iphimod20 = iphiclosest%20;
111  if ( iphimod20 >1 ) fphicor=1.;
112 
113  else{
114  double PhiCentr = TVector2::Phi_mpi_pi(center_pos.phi());
115  double PhiWidth = (TMath::Pi()/180.);
116  double PhiCry = (TVector2::Phi_mpi_pi(Phi-PhiCentr))/PhiWidth;
117  if (PhiCry>0.5) PhiCry=0.5;
118  if (PhiCry<-0.5) PhiCry=-0.5;
119  //flip to take into account ECAL barrel symmetries:
120  if (ietaclosest<0) PhiCry *= -1.;
121 
122  //Fetching parameters of the polynomial (see CMS IN-2009/013)
123  double g[5];
124  int offset = iphimod20==0 ?
125  10 //coefficients for one phi side of a SM
126  : 15; //coefficients for the other side
127  for (int k=0; k!=5; ++k) g[k] = (params_->params())[k+offset];
128 
129  fphicor=0.;
130  for (int k=0; k!=5; ++k) fphicor += g[k]*std::pow(PhiCry,k);
131  }
132 
133  //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.
134  int ietamod20 = ietaclosest%20;
135  if (TMath::Abs(ietaclosest) <25 || (TMath::Abs(ietamod20)!=5 && TMath::Abs(ietamod20)!=6) ) fetacor = 1.;
136 
137  else
138  {
139  double ThetaCentr = -center_pos.theta()+0.5*TMath::Pi();
140  double ThetaWidth = (TMath::Pi()/180.)*TMath::Cos(ThetaCentr);
141  double EtaCry = (Theta-ThetaCentr)/ThetaWidth;
142  if (EtaCry>0.5) EtaCry=0.5;
143  if (EtaCry<-0.5) EtaCry=-0.5;
144  //flip to take into account ECAL barrel symmetries:
145  if (ietaclosest<0) EtaCry *= -1.;
146 
147  //Fetching parameters of the polynomial (see CMS IN-2009/013)
148  double f[5];
149  int offset = TMath::Abs(ietamod20)==5 ?
150  0 //coefficients for eta side of an intermodule gap closer to the interaction point
151  : 5; //coefficients for the other eta side
152  for (int k=0; k!=5; ++k) f[k] = (params_->params())[k+offset];
153 
154  fetacor=0.;
155  for (int k=0; k!=5; ++k) fetacor += f[k]*std::pow(EtaCry,k);
156  }
157 
158  correction_factor = 1./(fetacor*fphicor);
159  //*********************************************************************************************************************//
160 
161  //return the correction factor. Use it to multiply the cluster energy.
162  return correction_factor;
163 }
const double Pi
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:123
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:189
double Phi_mpi_pi(double x)
Definition: JetUtil.h:24
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
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:160
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
const EcalClusterCrackCorrParameters * params_
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
EcalFunctionParameters & params()
double f[11][100]
double energy() const
cluster energy
Definition: CaloCluster.h:120
unsigned int offset(bool)
bool first
Definition: L1TdeRCT.cc:94
int k[5][pyjets_maxn]
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
const T & get() const
Definition: EventSetup.h:55
A base class to handle the particular shape of Ecal Xtals. Taken from ORCA Calorimetry Code...
T eta() const
Definition: PV3DBase.h:76
static const double X0
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40