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 'PhotonFix.dat' which must be in the same directory as |
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 |
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. |
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); |
48 |
|
|
49 |
|
class PhotonFix { |
50 |
|
public: |
51 |
< |
PhotonFix(double e, double eta, double phi, double r9); |
51 |
> |
//PhotonFix(double e, double eta, double phi, double r9); |
52 |
|
|
53 |
+ |
PhotonFix() : _onePi(acos(-1.0)), _twoPi(2.0*acos(-1.0)), _initialised(false) {} |
54 |
|
// Must be called before instantiating any PhotonFix objects |
55 |
< |
static bool initialise(const std::string &s="Nominal", const std::string &infile = "PhotonFix.dat"); |
56 |
< |
static bool initialised() ; |
57 |
< |
|
58 |
< |
// Used by above; do not call directly |
59 |
< |
static bool initialiseParameters(const std::string &s); |
60 |
< |
static bool initialiseGeometry(const std::string &s, const std::string &infile); |
58 |
< |
|
59 |
< |
void setup(); |
55 |
> |
bool initialise(const std::string &s="Nominal", const std::string &infile="PhotonFix.dat"); |
56 |
> |
bool initialised() ; |
57 |
> |
|
58 |
> |
void setup(double e, double eta, double phi, double r9); |
59 |
> |
|
60 |
> |
bool isbarrel() const { return !_be; } |
61 |
|
|
62 |
|
// Corrected energy and sigma |
63 |
|
double fixedEnergy() const; |
90 |
|
double yM() const; |
91 |
|
|
92 |
|
// Return arrays containing positions of ecal gaps |
93 |
< |
static void barrelCGap(unsigned i, unsigned j, unsigned k, double c); |
94 |
< |
static void barrelSGap(unsigned i, unsigned j, unsigned k, double c); |
95 |
< |
static void barrelMGap(unsigned i, unsigned j, unsigned k, double c); |
96 |
< |
static void endcapCrystal(unsigned i, unsigned j, bool c); |
97 |
< |
static void endcapCGap(unsigned i, unsigned j, unsigned k, double c); |
98 |
< |
static void endcapSGap(unsigned i, unsigned j, unsigned k, double c); |
99 |
< |
static void endcapMGap(unsigned i, unsigned j, unsigned k, double c); |
93 |
> |
void barrelCGap(unsigned i, unsigned j, unsigned k, double c); |
94 |
> |
void barrelSGap(unsigned i, unsigned j, unsigned k, double c); |
95 |
> |
void barrelMGap(unsigned i, unsigned j, unsigned k, double c); |
96 |
> |
void endcapCrystal(unsigned i, unsigned j, bool c); |
97 |
> |
void endcapCGap(unsigned i, unsigned j, unsigned k, double c); |
98 |
> |
void endcapSGap(unsigned i, unsigned j, unsigned k, double c); |
99 |
> |
void endcapMGap(unsigned i, unsigned j, unsigned k, double c); |
100 |
|
|
101 |
|
void print() const; |
102 |
|
|
103 |
|
// Input and output the fit parameters |
104 |
< |
static void setParameters(unsigned be, unsigned hl, const double *p); |
105 |
< |
static void getParameters(unsigned be, unsigned hl, double *p); |
104 |
> |
void setParameters(unsigned be, unsigned hl, const double *p); |
105 |
> |
void getParameters(unsigned be, unsigned hl, double *p); |
106 |
|
|
107 |
< |
static void dumpParameters(std::ostream &o); |
108 |
< |
static void printParameters(std::ostream &o); |
107 |
> |
void dumpParameters(std::ostream &o); |
108 |
> |
void printParameters(std::ostream &o); |
109 |
|
|
110 |
|
// Utility functions |
111 |
< |
static double GetaPhi(double f0, double f1); |
112 |
< |
static double asinh(double s); |
113 |
< |
static void dumpGaps(std::ostream &o); |
111 |
> |
double GetaPhi(double f0, double f1) const; |
112 |
> |
double asinh(double s) const; |
113 |
> |
void dumpGaps(std::ostream &o); |
114 |
|
|
115 |
|
private: |
116 |
|
|
117 |
+ |
|
118 |
+ |
// Used by above; do not call directly |
119 |
+ |
bool initialiseParameters(const std::string &s); |
120 |
+ |
bool initialiseGeometry(const std::string &s, const std::string &infile); |
121 |
+ |
|
122 |
+ |
|
123 |
+ |
|
124 |
+ |
|
125 |
|
// Utility functions |
126 |
< |
static double dPhi(double f0, double f1); |
127 |
< |
static double aPhi(double f0, double f1); |
126 |
> |
double dPhi(double f0, double f1) const; |
127 |
> |
double aPhi(double f0, double f1) const; |
128 |
|
|
129 |
< |
static double expCorrection(double a, const double *p); |
130 |
< |
static double gausCorrection(double a, const double *p); |
129 |
> |
double expCorrection(double a, const double *p) const; |
130 |
> |
double gausCorrection(double a, const double *p) const; |
131 |
|
|
132 |
|
// Actual data for each instantiated object |
133 |
|
unsigned _be,_hl; |
135 |
|
double _aC,_aS,_aM,_bC,_bS,_bM; |
136 |
|
|
137 |
|
// Constants |
138 |
< |
static const double _onePi; |
139 |
< |
static const double _twoPi; |
138 |
> |
const double _onePi; |
139 |
> |
const double _twoPi; |
140 |
|
|
141 |
|
// Initialisation flag |
142 |
< |
static bool _initialised; |
142 |
> |
bool _initialised; |
143 |
|
|
144 |
|
// Parameters for fixes |
145 |
< |
static double _meanScale[2][2][4]; |
146 |
< |
static double _meanAC[2][2][4]; |
147 |
< |
static double _meanAS[2][2][4]; |
148 |
< |
static double _meanAM[2][2][4]; |
149 |
< |
static double _meanBC[2][2][4]; |
150 |
< |
static double _meanBS[2][2][4]; |
151 |
< |
static double _meanBM[2][2][4]; |
152 |
< |
static double _meanR9[2][2][4]; |
145 |
> |
double _meanScale[2][2][4]; |
146 |
> |
double _meanAT[2][2][4]; |
147 |
> |
double _meanAC[2][2][4]; |
148 |
> |
double _meanAS[2][2][4]; |
149 |
> |
double _meanAM[2][2][4]; |
150 |
> |
double _meanBT[2][2][4]; |
151 |
> |
double _meanBC[2][2][4]; |
152 |
> |
double _meanBS[2][2][4]; |
153 |
> |
double _meanBM[2][2][4]; |
154 |
> |
double _meanR9[2][2][4]; |
155 |
|
|
156 |
|
// Parameters for resolution |
157 |
< |
static double _sigmaScale[2][2][4]; |
158 |
< |
static double _sigmaAT[2][2][4]; |
159 |
< |
static double _sigmaAC[2][2][4]; |
160 |
< |
static double _sigmaAS[2][2][4]; |
161 |
< |
static double _sigmaAM[2][2][4]; |
162 |
< |
static double _sigmaBT[2][2][4]; |
163 |
< |
static double _sigmaBC[2][2][4]; |
164 |
< |
static double _sigmaBS[2][2][4]; |
165 |
< |
static double _sigmaBM[2][2][4]; |
166 |
< |
static double _sigmaR9[2][2][4]; |
157 |
> |
double _sigmaScale[2][2][4]; |
158 |
> |
double _sigmaAT[2][2][4]; |
159 |
> |
double _sigmaAC[2][2][4]; |
160 |
> |
double _sigmaAS[2][2][4]; |
161 |
> |
double _sigmaAM[2][2][4]; |
162 |
> |
double _sigmaBT[2][2][4]; |
163 |
> |
double _sigmaBC[2][2][4]; |
164 |
> |
double _sigmaBS[2][2][4]; |
165 |
> |
double _sigmaBM[2][2][4]; |
166 |
> |
double _sigmaR9[2][2][4]; |
167 |
|
|
168 |
|
// EB gap positions |
169 |
< |
static double _barrelCGap[169][360][2]; |
170 |
< |
static double _barrelSGap[33][180][2]; |
171 |
< |
static double _barrelMGap[7][18][2]; |
169 |
> |
double _barrelCGap[169][360][2]; |
170 |
> |
double _barrelSGap[33][180][2]; |
171 |
> |
double _barrelMGap[7][18][2]; |
172 |
|
|
173 |
|
// EE crystal existence and gap positions |
174 |
< |
static bool _endcapCrystal[100][100]; |
175 |
< |
static double _endcapCGap[2][7080][2]; |
176 |
< |
static double _endcapSGap[2][264][2]; |
177 |
< |
static double _endcapMGap[2][1][2]; |
174 |
> |
bool _endcapCrystal[100][100]; |
175 |
> |
double _endcapCGap[2][7080][2]; |
176 |
> |
double _endcapSGap[2][264][2]; |
177 |
> |
double _endcapMGap[2][1][2]; |
178 |
|
|
179 |
|
}; |
180 |
|
|