Changeset 2828
- Timestamp:
- 01/16/04 14:13:39 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2827 r2828 4 4 5 5 -*-*- END OF LINE -*-*- 6 7 2004/01/16: Markus Gaug 8 9 * mcalib/MCalibrationFits.h 10 - removed and incorporated in MHCalibrationBlindPixel.h 11 12 * mcalib/MHCalibrationBlindPixel.[h,cc] 13 - incorporate Fit functions 14 - fixed a bug due to which DrawClone crashed when class was used 15 in a compiled macro 6 16 7 17 2004/01/16: Abelardo Moralejo -
trunk/MagicSoft/Mars/mcalib/MHCalibrationBlindPixel.h
r2791 r2828 25 25 #include "TPaveText.h" 26 26 #endif 27 28 const Double_t NoWay = 10000000000.0; 27 29 28 30 class TMath; … … 50 52 Bool_t fFitOK; 51 53 52 BlindPixelFitFunc fgSinglePheFitFunc; // In the beginning,53 Int_t fgSinglePheFitNPar; // we want to be flexible using different functions54 55 54 Double_t fLambda; 56 55 Double_t fMu0; … … 81 80 MHCalibrationBlindPixel(const char *name=NULL, const char *title=NULL); 82 81 ~MHCalibrationBlindPixel(); 82 83 typedef Double_t (*BlindPixelFitFunc)(Double_t *, Double_t *); 83 84 84 85 Bool_t FillBlindPixelCharge(Float_t q) { return fHBlindPixelCharge->Fill(q) > -1; } … … 118 119 Bool_t FitTime(Axis_t rmin=0., Axis_t rmax=0.,Option_t *opt="R0+Q"); 119 120 120 void ChangeFitFunc(BlindPixelFitFunc fitfunc, Int_t par= 5);121 void ChangeFitFunc(BlindPixelFitFunc fitfunc, Int_t par=6); 121 122 122 123 void CutAllEdges(); … … 127 128 Bool_t IsFitOK() { return fFitOK; } 128 129 130 private: 131 132 BlindPixelFitFunc fgSinglePheFitFunc; //! In the beginning, 133 Int_t fgSinglePheFitNPar; //! we want to be flexible using different functions 134 135 inline static Double_t gfKto4(Double_t *x, Double_t *par) 136 { 137 138 Double_t lambda = par[0]; 139 140 Double_t sum = 0.; 141 Double_t arg = 0.; 142 143 Double_t mu0 = par[1]; 144 Double_t mu1 = par[2]; 145 146 if (mu1 < mu0) 147 return NoWay; 148 149 Double_t sigma0 = par[3]; 150 Double_t sigma1 = par[4]; 151 152 if (sigma1 < sigma0) 153 return NoWay; 154 155 156 Double_t mu2 = (2.*mu1)-mu0; 157 Double_t mu3 = (3.*mu1)-(2.*mu0); 158 Double_t mu4 = (4.*mu1)-(3.*mu0); 159 160 Double_t sigma2 = TMath::Sqrt((2.*sigma1*sigma1) - (sigma0*sigma0)); 161 Double_t sigma3 = TMath::Sqrt((3.*sigma1*sigma1) - (2.*sigma0*sigma0)); 162 Double_t sigma4 = TMath::Sqrt((4.*sigma1*sigma1) - (3.*sigma0*sigma0)); 163 164 Double_t lambda2 = lambda*lambda; 165 Double_t lambda3 = lambda2*lambda; 166 Double_t lambda4 = lambda3*lambda; 167 168 // k=0: 169 arg = (x[0] - mu0)/sigma0; 170 sum = TMath::Exp(-0.5*arg*arg)/sigma0; 171 172 // k=1: 173 arg = (x[0] - mu1)/sigma1; 174 sum += lambda*TMath::Exp(-0.5*arg*arg)/sigma1; 175 176 // k=2: 177 arg = (x[0] - mu2)/sigma2; 178 sum += 0.5*lambda2*TMath::Exp(-0.5*arg*arg)/sigma2; 179 180 // k=3: 181 arg = (x[0] - mu3)/sigma3; 182 sum += 0.1666666667*lambda3*TMath::Exp(-0.5*arg*arg)/sigma3; 183 184 // k=4: 185 arg = (x[0] - mu4)/sigma4; 186 sum += 0.041666666666667*lambda4*TMath::Exp(-0.5*arg*arg)/sigma4; 187 188 return TMath::Exp(-1.*lambda)*par[5]*sum; 189 190 } //-> 191 192 inline static Double_t gfKto5(Double_t *x, Double_t *par) 193 { 194 195 Double_t lambda = par[0]; 196 197 Double_t sum = 0.; 198 Double_t arg = 0.; 199 200 Double_t mu0 = par[1]; 201 Double_t mu1 = par[2]; 202 203 if (mu1 < mu0) 204 return NoWay; 205 206 Double_t sigma0 = par[3]; 207 Double_t sigma1 = par[4]; 208 209 if (sigma1 < sigma0) 210 return NoWay; 211 212 213 Double_t mu2 = (2.*mu1)-mu0; 214 Double_t mu3 = (3.*mu1)-(2.*mu0); 215 Double_t mu4 = (4.*mu1)-(3.*mu0); 216 Double_t mu5 = (5.*mu1)-(4.*mu0); 217 218 Double_t sigma2 = TMath::Sqrt((2.*sigma1*sigma1) - (sigma0*sigma0)); 219 Double_t sigma3 = TMath::Sqrt((3.*sigma1*sigma1) - (2.*sigma0*sigma0)); 220 Double_t sigma4 = TMath::Sqrt((4.*sigma1*sigma1) - (3.*sigma0*sigma0)); 221 Double_t sigma5 = TMath::Sqrt((5.*sigma1*sigma1) - (4.*sigma0*sigma0)); 222 223 Double_t lambda2 = lambda*lambda; 224 Double_t lambda3 = lambda2*lambda; 225 Double_t lambda4 = lambda3*lambda; 226 Double_t lambda5 = lambda4*lambda; 227 228 // k=0: 229 arg = (x[0] - mu0)/sigma0; 230 sum = TMath::Exp(-0.5*arg*arg)/sigma0; 231 232 // k=1: 233 arg = (x[0] - mu1)/sigma1; 234 sum += lambda*TMath::Exp(-0.5*arg*arg)/sigma1; 235 236 // k=2: 237 arg = (x[0] - mu2)/sigma2; 238 sum += 0.5*lambda2*TMath::Exp(-0.5*arg*arg)/sigma2; 239 240 // k=3: 241 arg = (x[0] - mu3)/sigma3; 242 sum += 0.1666666667*lambda3*TMath::Exp(-0.5*arg*arg)/sigma3; 243 244 // k=4: 245 arg = (x[0] - mu4)/sigma4; 246 sum += 0.041666666666667*lambda4*TMath::Exp(-0.5*arg*arg)/sigma4; 247 248 // k=5: 249 arg = (x[0] - mu5)/sigma5; 250 sum += 0.008333333333333*lambda5*TMath::Exp(-0.5*arg*arg)/sigma5; 251 252 return TMath::Exp(-1.*lambda)*par[5]*sum; 253 254 } 255 256 257 inline static Double_t gfKto6(Double_t *x, Double_t *par) 258 { 259 260 Double_t lambda = par[0]; 261 262 Double_t sum = 0.; 263 Double_t arg = 0.; 264 265 Double_t mu0 = par[1]; 266 Double_t mu1 = par[2]; 267 268 if (mu1 < mu0) 269 return NoWay; 270 271 Double_t sigma0 = par[3]; 272 Double_t sigma1 = par[4]; 273 274 if (sigma1 < sigma0) 275 return NoWay; 276 277 278 Double_t mu2 = (2.*mu1)-mu0; 279 Double_t mu3 = (3.*mu1)-(2.*mu0); 280 Double_t mu4 = (4.*mu1)-(3.*mu0); 281 Double_t mu5 = (5.*mu1)-(4.*mu0); 282 Double_t mu6 = (6.*mu1)-(5.*mu0); 283 284 Double_t sigma2 = TMath::Sqrt((2.*sigma1*sigma1) - (sigma0*sigma0)); 285 Double_t sigma3 = TMath::Sqrt((3.*sigma1*sigma1) - (2.*sigma0*sigma0)); 286 Double_t sigma4 = TMath::Sqrt((4.*sigma1*sigma1) - (3.*sigma0*sigma0)); 287 Double_t sigma5 = TMath::Sqrt((5.*sigma1*sigma1) - (4.*sigma0*sigma0)); 288 Double_t sigma6 = TMath::Sqrt((6.*sigma1*sigma1) - (5.*sigma0*sigma0)); 289 290 Double_t lambda2 = lambda*lambda; 291 Double_t lambda3 = lambda2*lambda; 292 Double_t lambda4 = lambda3*lambda; 293 Double_t lambda5 = lambda4*lambda; 294 Double_t lambda6 = lambda5*lambda; 295 296 // k=0: 297 arg = (x[0] - mu0)/sigma0; 298 sum = TMath::Exp(-0.5*arg*arg)/sigma0; 299 300 // k=1: 301 arg = (x[0] - mu1)/sigma1; 302 sum += lambda*TMath::Exp(-0.5*arg*arg)/sigma1; 303 304 // k=2: 305 arg = (x[0] - mu2)/sigma2; 306 sum += 0.5*lambda2*TMath::Exp(-0.5*arg*arg)/sigma2; 307 308 // k=3: 309 arg = (x[0] - mu3)/sigma3; 310 sum += 0.1666666667*lambda3*TMath::Exp(-0.5*arg*arg)/sigma3; 311 312 // k=4: 313 arg = (x[0] - mu4)/sigma4; 314 sum += 0.041666666666667*lambda4*TMath::Exp(-0.5*arg*arg)/sigma4; 315 316 // k=5: 317 arg = (x[0] - mu5)/sigma5; 318 sum += 0.008333333333333*lambda5*TMath::Exp(-0.5*arg*arg)/sigma5; 319 320 // k=6: 321 arg = (x[0] - mu6)/sigma6; 322 sum += 0.001388888888889*lambda6*TMath::Exp(-0.5*arg*arg)/sigma6; 323 324 return TMath::Exp(-1.*lambda)*par[5]*sum; 325 326 } 327 129 328 ClassDef(MHCalibrationBlindPixel, 1) 130 329 };
Note:
See TracChangeset
for help on using the changeset viewer.