CMS 3D CMS Logo

PhotonFix.h
Go to the documentation of this file.
1 #ifndef PhotonFix_Defined_hh
2 #define PhotonFix_Defined_hh
3 
4 //-------------------------------------------------------//
5 // Project: PhotonFix
6 // Author: Paul Dauncey (p.dauncey@imperial.ac.uk)
7 // Modified: 11/07/2011
8 // Admins: Paul Dauncey (p.dauncey@imperial.ac.uk)
9 // Matt Kenzie (matthew.william.kenzie@cern.ch)
10 //-------------------------------------------------------//
11 
12 /*
13  Does post-reco fixes to ECAL photon energy and estimates resolution.
14  This can run outside of the usual CMS software framework but requires
15  access to a file 'EcalGaps.dat' which must be in the same directory as
16  that used to run.
17 
18  To run within CMSSW use PhotonFixCMS.h (which can access the geometry
19  directly - go to "RecoEcal/EgammaCoreTools/plugins/PhotonFixCMS.h"
20  for details.
21 
22  Before instantiating any objects of PhotonFix, the constants must be
23  initialised in the first event using
24  PhotonFix::initialise("3_8");
25 
26  The string gives the reco version used. Valid strings are
27  "3_8", "3_11", "4_2" and "Nominal", where the latter gives no correction
28  to the energy and a nominal resolution value. There is also "4_2e" which
29  provides corrections for electrons which are reconstructed as photons (to
30  aid with testing the performance of these corrections in data).
31 
32  Make objects using
33  PhotonFix a(energy,eta,phi,r9);
34  where energy is the photon energy, eta and phi are the ECAL
35  cluster positions (NB from the Supercluster object, _not_ the
36  Photon object, as the latter gives eta and phi directions,
37  not positions), and r9 is the R9 value of the SC.
38 
39  Get the corrected energy using
40  a.fixedEnergy();
41  and the resolution using
42  a.sigmaEnergy();
43 
44 */
45 
46 #include <iostream>
47 #include <string>
48 
49 class PhotonFix {
50 public:
51  PhotonFix(double e, double eta, double phi, double r9);
52 
53  // Must be called before instantiating any PhotonFix objects
54  static bool initialise(const std::string &s = "Nominal");
55  static bool initialised();
56 
57  // Used by above; do not call directly
58  static bool initialiseParameters(const std::string &s);
59  static bool initialiseGeometry(const std::string &s);
60 
61  void setup();
62 
63  // Corrected energy and sigma
64  double fixedEnergy() const;
65  double sigmaEnergy() const;
66 
67  // Input values
68  double rawEnergy() const;
69  double eta() const;
70  double phi() const;
71  double r9() const;
72 
73  // Derived EB crystal, submodule and module relative coordinates
74  double etaC() const;
75  double etaS() const;
76  double etaM() const;
77 
78  double phiC() const;
79  double phiS() const;
80  double phiM() const;
81 
82  // Derived EE zeta, crystal, subcrystal and D-module relative coordinates
83  double xZ() const;
84  double xC() const;
85  double xS() const;
86  double xM() const;
87 
88  double yZ() const;
89  double yC() const;
90  double yS() const;
91  double yM() const;
92 
93  // Return arrays containing positions of ecal gaps
94  static void barrelCGap(unsigned i, unsigned j, unsigned k, double c);
95  static void barrelSGap(unsigned i, unsigned j, unsigned k, double c);
96  static void barrelMGap(unsigned i, unsigned j, unsigned k, double c);
97  static void endcapCrystal(unsigned i, unsigned j, bool c);
98  static void endcapCGap(unsigned i, unsigned j, unsigned k, double c);
99  static void endcapSGap(unsigned i, unsigned j, unsigned k, double c);
100  static void endcapMGap(unsigned i, unsigned j, unsigned k, double c);
101 
102  void print() const;
103 
104  // Input and output the fit parameters
105  static void setParameters(unsigned be, unsigned hl, const double *p);
106  static void getParameters(unsigned be, unsigned hl, double *p);
107 
108  static void dumpParameters(std::ostream &o);
109  static void printParameters(std::ostream &o);
110 
111  // Utility functions
112  static double GetaPhi(double f0, double f1);
113  static double asinh(double s);
114  static void dumpGaps(std::ostream &o);
115 
116 private:
117  // Utility functions
118  static double dPhi(double f0, double f1);
119  static double aPhi(double f0, double f1);
120 
121  static double expCorrection(double a, const double *p);
122  static double gausCorrection(double a, const double *p);
123 
124  // Actual data for each instantiated object
125  unsigned _be, _hl;
126  double _e, _eta, _phi, _r9;
127  double _aC, _aS, _aM, _bC, _bS, _bM;
128 
129  // Constants
130  static const double _onePi;
131  static const double _twoPi;
132 
133  // Initialisation flag
134  static bool _initialised;
135 
136  // Parameters for fixes
137  static double _meanScale[2][2][4];
138  static double _meanAT[2][2][4];
139  static double _meanAC[2][2][4];
140  static double _meanAS[2][2][4];
141  static double _meanAM[2][2][4];
142  static double _meanBT[2][2][4];
143  static double _meanBC[2][2][4];
144  static double _meanBS[2][2][4];
145  static double _meanBM[2][2][4];
146  static double _meanR9[2][2][4];
147 
148  // Parameters for resolution
149  static double _sigmaScale[2][2][4];
150  static double _sigmaAT[2][2][4];
151  static double _sigmaAC[2][2][4];
152  static double _sigmaAS[2][2][4];
153  static double _sigmaAM[2][2][4];
154  static double _sigmaBT[2][2][4];
155  static double _sigmaBC[2][2][4];
156  static double _sigmaBS[2][2][4];
157  static double _sigmaBM[2][2][4];
158  static double _sigmaR9[2][2][4];
159 
160  // EB gap positions
161  static double _barrelCGap[169][360][2];
162  static double _barrelSGap[33][180][2];
163  static double _barrelMGap[7][18][2];
164 
165  // EE crystal existence and gap positions
166  static bool _endcapCrystal[100][100];
167  static double _endcapCGap[2][7080][2];
168  static double _endcapSGap[2][264][2];
169  static double _endcapMGap[2][1][2];
170 };
171 
172 #endif
PhotonFix::_endcapCrystal
static bool _endcapCrystal[100][100]
Definition: PhotonFix.h:166
PhotonFix::_barrelSGap
static double _barrelSGap[33][180][2]
Definition: PhotonFix.h:162
mps_fire.i
i
Definition: mps_fire.py:355
PhotonFix::yC
double yC() const
Definition: PhotonFix.cc:312
PhotonFix::yZ
double yZ() const
Definition: PhotonFix.cc:307
PhotonFix::_meanAT
static double _meanAT[2][2][4]
Definition: PhotonFix.h:138
PhotonFix::getParameters
static void getParameters(unsigned be, unsigned hl, double *p)
Definition: PhotonFix.cc:368
PhotonFix::_meanBC
static double _meanBC[2][2][4]
Definition: PhotonFix.h:143
PhotonFix::etaS
double etaS() const
Definition: PhotonFix.cc:262
PhotonFix::_meanScale
static double _meanScale[2][2][4]
Definition: PhotonFix.h:137
PhotonFix::fixedEnergy
double fixedEnergy() const
Definition: PhotonFix.cc:149
PhotonFix::_barrelCGap
static double _barrelCGap[169][360][2]
Definition: PhotonFix.h:161
PhotonFix::_sigmaBC
static double _sigmaBC[2][2][4]
Definition: PhotonFix.h:155
PhotonFix::initialiseParameters
static bool initialiseParameters(const std::string &s)
Definition: PhotonFix.cc:680
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
PhotonFix::_sigmaR9
static double _sigmaR9[2][2][4]
Definition: PhotonFix.h:158
PhotonFix::xC
double xC() const
Definition: PhotonFix.cc:292
PhotonFix::_endcapCGap
static double _endcapCGap[2][7080][2]
Definition: PhotonFix.h:167
PhotonFix::barrelMGap
static void barrelMGap(unsigned i, unsigned j, unsigned k, double c)
Definition: PhotonFix.cc:331
PhotonFix::dumpParameters
static void dumpParameters(std::ostream &o)
Definition: PhotonFix.cc:394
PhotonFix::rawEnergy
double rawEnergy() const
Definition: PhotonFix.cc:249
PhotonFix::_bC
double _bC
Definition: PhotonFix.h:127
PhotonFix::_endcapMGap
static double _endcapMGap[2][1][2]
Definition: PhotonFix.h:169
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:36
PhotonFix::initialiseGeometry
static bool initialiseGeometry(const std::string &s)
Definition: PhotonFix.cc:2059
PhotonFix::_endcapSGap
static double _endcapSGap[2][264][2]
Definition: PhotonFix.h:168
PhotonFix::initialise
static bool initialise(const std::string &s="Nominal")
Definition: PhotonFix.cc:671
PhotonFix::_meanAC
static double _meanAC[2][2][4]
Definition: PhotonFix.h:139
PhotonFix::gausCorrection
static double gausCorrection(double a, const double *p)
Definition: PhotonFix.cc:660
alignCSCRings.s
s
Definition: alignCSCRings.py:92
PhotonFix::_sigmaScale
static double _sigmaScale[2][2][4]
Definition: PhotonFix.h:149
PhotonFix::_hl
unsigned _hl
Definition: PhotonFix.h:125
PhotonFix::xS
double xS() const
Definition: PhotonFix.cc:297
PhotonFix::dumpGaps
static void dumpGaps(std::ostream &o)
Definition: PhotonFix.cc:564
PhotonFix::etaM
double etaM() const
Definition: PhotonFix.cc:267
PhotonFix::xZ
double xZ() const
Definition: PhotonFix.cc:287
PhotonFix::_meanBS
static double _meanBS[2][2][4]
Definition: PhotonFix.h:144
PhotonFix::PhotonFix
PhotonFix(double e, double eta, double phi, double r9)
Definition: PhotonFix.cc:9
PhotonFix::_bS
double _bS
Definition: PhotonFix.h:127
PhotonFix::printParameters
static void printParameters(std::ostream &o)
Definition: PhotonFix.cc:464
PhotonFix::initialised
static bool initialised()
Definition: PhotonFix.cc:670
PhotonFix::barrelCGap
static void barrelCGap(unsigned i, unsigned j, unsigned k, double c)
Definition: PhotonFix.cc:329
PhotonFix::endcapMGap
static void endcapMGap(unsigned i, unsigned j, unsigned k, double c)
Definition: PhotonFix.cc:335
PhotonFix::_sigmaBT
static double _sigmaBT[2][2][4]
Definition: PhotonFix.h:154
dqmdumpme.k
k
Definition: dqmdumpme.py:60
PhotonFix
Definition: PhotonFix.h:49
PhotonFix::phiM
double phiM() const
Definition: PhotonFix.cc:282
PhotonFix::GetaPhi
static double GetaPhi(double f0, double f1)
Definition: PhotonFix.cc:327
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PhotonFix::setParameters
static void setParameters(unsigned be, unsigned hl, const double *p)
Definition: PhotonFix.cc:342
PhotonFix::_sigmaBM
static double _sigmaBM[2][2][4]
Definition: PhotonFix.h:157
PhotonFix::_sigmaBS
static double _sigmaBS[2][2][4]
Definition: PhotonFix.h:156
PhotonFix::phiC
double phiC() const
Definition: PhotonFix.cc:272
a
double a
Definition: hdecay.h:119
PhotonFix::dPhi
static double dPhi(double f0, double f1)
Definition: PhotonFix.cc:625
PhotonFix::_meanBM
static double _meanBM[2][2][4]
Definition: PhotonFix.h:145
PhotonFix::_initialised
static bool _initialised
Definition: PhotonFix.h:134
PhotonFix::_aS
double _aS
Definition: PhotonFix.h:127
PhotonFix::expCorrection
static double expCorrection(double a, const double *p)
Definition: PhotonFix.cc:649
PhotonFix::print
void print() const
Definition: PhotonFix.cc:337
PhotonFix::phi
double phi() const
Definition: PhotonFix.cc:253
PhotonFix::_sigmaAS
static double _sigmaAS[2][2][4]
Definition: PhotonFix.h:152
PhotonFix::endcapCrystal
static void endcapCrystal(unsigned i, unsigned j, bool c)
Definition: PhotonFix.cc:332
PhotonFix::_bM
double _bM
Definition: PhotonFix.h:127
PhotonFix::etaC
double etaC() const
Definition: PhotonFix.cc:257
PhotonFix::aPhi
static double aPhi(double f0, double f1)
Definition: PhotonFix.cc:634
PhotonFix::_meanBT
static double _meanBT[2][2][4]
Definition: PhotonFix.h:142
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
PhotonFix::_meanR9
static double _meanR9[2][2][4]
Definition: PhotonFix.h:146
PhotonFix::xM
double xM() const
Definition: PhotonFix.cc:302
PhotonFix::_phi
double _phi
Definition: PhotonFix.h:126
PhotonFix::endcapSGap
static void endcapSGap(unsigned i, unsigned j, unsigned k, double c)
Definition: PhotonFix.cc:334
PhotonFix::_onePi
static const double _onePi
Definition: PhotonFix.h:130
PhotonFix::_aM
double _aM
Definition: PhotonFix.h:127
PhotonFix::_be
unsigned _be
Definition: PhotonFix.h:125
PhotonFix::yM
double yM() const
Definition: PhotonFix.cc:322
PhotonFix::asinh
static double asinh(double s)
Definition: PhotonFix.cc:557
PhotonFix::sigmaEnergy
double sigmaEnergy() const
Definition: PhotonFix.cc:189
PhotonFix::_barrelMGap
static double _barrelMGap[7][18][2]
Definition: PhotonFix.h:163
PhotonFix::_sigmaAT
static double _sigmaAT[2][2][4]
Definition: PhotonFix.h:150
PhotonFix::_sigmaAC
static double _sigmaAC[2][2][4]
Definition: PhotonFix.h:151
PhotonFix::yS
double yS() const
Definition: PhotonFix.cc:317
PhotonFix::_sigmaAM
static double _sigmaAM[2][2][4]
Definition: PhotonFix.h:153
PhotonFix::eta
double eta() const
Definition: PhotonFix.cc:251
PhotonFix::_meanAM
static double _meanAM[2][2][4]
Definition: PhotonFix.h:141
PhotonFix::_twoPi
static const double _twoPi
Definition: PhotonFix.h:131
cms::cuda::be
int be
Definition: HistoContainer.h:126
PhotonFix::barrelSGap
static void barrelSGap(unsigned i, unsigned j, unsigned k, double c)
Definition: PhotonFix.cc:330
PhotonFix::_eta
double _eta
Definition: PhotonFix.h:126
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
PhotonFix::_meanAS
static double _meanAS[2][2][4]
Definition: PhotonFix.h:140
PhotonFix::_aC
double _aC
Definition: PhotonFix.h:127
DeadROC_duringRun.f1
f1
Definition: DeadROC_duringRun.py:219
PhotonFix::phiS
double phiS() const
Definition: PhotonFix.cc:277
PhotonFix::setup
void setup()
Definition: PhotonFix.cc:11
PhotonFix::r9
double r9() const
Definition: PhotonFix.cc:255
PhotonFix::endcapCGap
static void endcapCGap(unsigned i, unsigned j, unsigned k, double c)
Definition: PhotonFix.cc:333
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
PhotonFix::_e
double _e
Definition: PhotonFix.h:126
PhotonFix::_r9
double _r9
Definition: PhotonFix.h:126