Changeset 3038 for trunk/MagicSoft/Mars/manalysis
- Timestamp:
- 02/05/04 17:50:16 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc
r3014 r3038 143 143 // Get i-th pixel (pixel number) 144 144 // 145 constMHPedestalPixel &MPedestalCam::operator()(UInt_t i) const145 MHPedestalPixel &MPedestalCam::operator()(UInt_t i) const 146 146 { 147 147 return *static_cast<MHPedestalPixel*>(fHArray->UncheckedAt(i)); … … 155 155 156 156 fArray->ForEach(TObject, Clear)(); 157 // fHArray->ForEach(TObject, Clear)();158 157 159 158 fTotalEntries = 0; 160 159 fExtractSlices = 0.; 161 160 } 161 162 163 // -------------------------------------------------------------------------- 164 // 165 // Our own clone function is necessary since root 3.01/06 or Mars 0.4 166 // I don't know the reason 167 // 168 TObject *MPedestalCam::Clone(const char *) const 169 { 170 171 const Int_t n1 = fArray->GetSize(); 172 const Int_t n2 = fHArray->GetSize(); 173 174 // 175 // FIXME, this might be done faster and more elegant, by direct copy. 176 // 177 MPedestalCam *cam = new MPedestalCam; 178 179 cam->fArray->Expand(n1); 180 cam->fHArray->Expand(n2); 181 182 for (int i=0; i<n1; i++) 183 { 184 delete (*cam->fArray)[i]; 185 (*cam->fArray)[i] = (*fArray)[i]->Clone(); 186 } 187 188 for (int i=0; i<n2; i++) 189 { 190 delete (*cam->fHArray)[i]; 191 (*cam->fHArray)[i] = (*fHArray)[i]->Clone(); 192 } 193 return cam; 194 } 195 196 162 197 163 198 // -------------------------------------------------------------------------- … … 170 205 { 171 206 172 fArray->ForEach(MPedestalPix, InitUseHists)();173 207 fHArray->Delete(); 174 208 … … 189 223 } 190 224 225 191 226 Float_t slices = (Float_t)signal->GetNumUsedFADCSlices(); 192 227 … … 218 253 MHPedestalPixel &hist = (*this)(i); 219 254 hist.ChangeHistId(i); 255 MPedestalPix &pix = (*this)[i]; 256 pix.InitUseHists(); 220 257 } 221 258 } … … 229 266 for (Int_t i=0; i<n; i++) 230 267 { 268 231 269 const MExtractedSignalPix &pix = (*signal)[i]; 232 270 233 271 const Float_t sig = pix.GetExtractedSignalHiGain(); 234 const Float_t sigPerSlice = sig/fExtractSlices; 235 272 236 273 MHPedestalPixel &hist = (*this)(i); 237 238 hist.FillCharge(sigPerSlice); 239 hist.FillChargevsN(sigPerSlice); 274 // 275 // Don't fill signal per slice, we get completely screwed up 276 // with the sigma. Better fill like it is and renorm later 277 // 278 // const Float_t sigPerSlice = sig/fExtractSlices; 279 // hist.FillCharge(sigPerSlice); 280 // hist.FillChargevsN(sigPerSlice); 281 const Float_t signal = sig; 282 hist.FillCharge(signal); 283 hist.FillChargevsN(signal); 240 284 } 241 285 … … 247 291 for (Int_t i=0; i<fHArray->GetSize(); i++) 248 292 { 293 249 294 MHPedestalPixel &hist = (*this)(i); 250 295 … … 262 307 // 263 308 hist.FitCharge(); 309 hist.Renorm(fExtractSlices); 310 264 311 } 265 312 return kTRUE; … … 343 390 344 391 const Float_t pederr = rms/TMath::Sqrt((Float_t)fTotalEntries); 345 const Float_t rmserr = rms/TMath::Sqrt((Float_t)fTotalEntries /2.);392 const Float_t rmserr = rms/TMath::Sqrt((Float_t)fTotalEntries*2.); 346 393 347 394 const MHPedestalPixel &hist = (*this)(idx); 348 395 349 396 const Float_t mean = hist.GetChargeMean(); 350 const Float_t meanerr = hist.GetChargeMeanErr() * TMath::Sqrt((Float_t)fExtractSlices);351 const Float_t sigma = hist.GetChargeSigma() * TMath::Sqrt((Float_t)fExtractSlices);352 const Float_t sigmaerr = hist.GetChargeSigmaErr() * TMath::Sqrt((Float_t)fExtractSlices);397 const Float_t meanerr = hist.GetChargeMeanErr(); 398 const Float_t sigma = hist.GetChargeSigma() ; 399 const Float_t sigmaerr = hist.GetChargeSigmaErr(); 353 400 const Float_t prob = hist.GetChargeProb(); 354 401 … … 368 415 break; 369 416 case 4: 370 // if ((*this)[idx].IsFitValid()) 417 if (!(*this)(idx).IsFitOK()) 418 return kFALSE; 371 419 val = mean; 372 // else373 // return kFALSE;374 420 break; 375 421 case 5: 376 // if ((*this)[idx].IsFitValid()) 422 if (!(*this)(idx).IsFitOK()) 423 return kFALSE; 377 424 val = meanerr; 378 // else379 // return kFALSE;380 425 break; 381 426 case 6: 382 // if ((*this)[idx].IsFitValid()) 427 if (!(*this)(idx).IsFitOK()) 428 return kFALSE; 383 429 val = sigma; 384 // else385 // return kFALSE;386 430 break; 387 431 case 7: 388 // if ((*this)[idx].IsFitValid()) 432 if (!(*this)(idx).IsFitOK()) 433 return kFALSE; 389 434 val = sigmaerr; 390 // else391 // return kFALSE;392 435 break; 393 436 case 8: 394 // if ((*this)[idx].IsFitValid()) 437 if (!(*this)(idx).IsFitOK()) 438 return kFALSE; 395 439 val = prob; 396 // else397 // return kFALSE;398 440 break; 399 441 case 9: 400 // if ((*this)[idx].IsFitValid()) 442 if (!(*this)(idx).IsFitOK()) 443 return kFALSE; 401 444 val = 2.*(ped-mean)/(ped+mean); 402 // else403 // return kFALSE;404 445 break; 405 446 case 10: 447 if (!(*this)(idx).IsFitOK()) 448 return kFALSE; 406 449 val = TMath::Sqrt((pederr*pederr + meanerr*meanerr) * (ped*ped + mean*mean)) 407 450 *2./(ped+mean)/(ped+mean); 408 451 break; 409 452 case 11: 453 if (!(*this)(idx).IsFitOK()) 454 return kFALSE; 410 455 val = 2.*(pederr - meanerr)/(pederr + meanerr); 411 456 break; 412 457 case 12: 413 val = 2.*(rms-sigma)/(rms+sigma); 458 if (!(*this)(idx).IsFitOK()) 459 return kFALSE; 460 val = 2.*(sigma-rms)/(sigma+rms); 414 461 break; 415 462 case 13: 463 if (!(*this)(idx).IsFitOK()) 464 return kFALSE; 416 465 val = TMath::Sqrt((rmserr*rmserr + sigmaerr*sigmaerr) * (rms*rms + sigma*sigma)) 417 466 *2./(rms+sigma)/(rms+sigma); 418 467 break; 419 468 case 14: 420 // if ((*this)[idx].IsFitValid()) 421 val = 2.*(rmserr - sigmaerr)/(rmserr + sigmaerr); 422 // else 423 // return kFALSE; 469 if (!(*this)(idx).IsFitOK()) 470 return kFALSE; 471 val = 2.*(sigmaerr - rmserr)/(sigmaerr + rmserr); 424 472 break; 425 473 default: … … 431 479 void MPedestalCam::DrawPixelContent(Int_t idx) const 432 480 { 433 (*this) [idx].Draw();434 } 481 (*this)(idx).Draw(); 482 }
Note:
See TracChangeset
for help on using the changeset viewer.