- Timestamp:
- 08/29/04 17:28:42 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mpedestal
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mpedestal/MPedestalCam.cc
r4784 r4794 36 36 37 37 #include <TArrayI.h> 38 #include <TArrayF.h> 38 39 #include <TArrayD.h> 39 40 … … 326 327 // in the calculation of the size average. 327 328 // 328 Float_t MPedestalCam::GetAveragedPedPerArea(const MGeomCam &geom, const UInt_t ai, MBadPixelsCam *bad) 329 // Returns a TArrayF of dimension 2: 330 // arr[0]: averaged pedestal (default: -1.) 331 // arr[1]: Error (rms) of averaged pedestal (default: 0.) 332 // 333 // ATTENTION: THE USER HAS TO DELETE THE RETURNED TARRAYF ACCORDINGLY 334 // 335 TArrayF *MPedestalCam::GetAveragedPedPerArea(const MGeomCam &geom, const UInt_t ai, MBadPixelsCam *bad) 329 336 { 330 337 331 338 const Int_t np = GetSize(); 332 339 333 Double_t mean = 0.; 334 Int_t nr = 0; 340 Double_t mean = 0.; 341 Double_t mean2 = 0.; 342 Int_t nr = 0; 335 343 336 344 for (int i=0; i<np; i++) … … 346 354 const MPedestalPix &pix = (*this)[i]; 347 355 348 mean += pix.GetPedestal(); 349 nr ++; 350 351 } 352 353 return mean/nr; 356 mean += pix.GetPedestal(); 357 mean2 += pix.GetPedestal()*pix.GetPedestal(); 358 nr ++; 359 360 } 361 362 TArrayF *arr = new TArrayF(2); 363 arr->AddAt(nr ? mean/nr : -1.,0); 364 arr->AddAt(nr>1 ? TMath::Sqrt((mean2 - mean*mean/nr)/(nr-1)) : 0. ,1); 365 366 return arr; 354 367 } 355 368 … … 362 375 // in the calculation of the size average. 363 376 // 364 Float_t MPedestalCam::GetAveragedRmsPerArea(const MGeomCam &geom, const UInt_t ai, MBadPixelsCam *bad) 377 // Returns a TArrayF of dimension 2: 378 // arr[0]: averaged pedestal RMS (default: -1.) 379 // arr[1]: Error (rms) of averaged pedestal RMS (default: 0.) 380 // 381 // ATTENTION: THE USER HAS TO DELETE THE RETURNED TARRAYF ACCORDINGLY 382 // 383 TArrayF *MPedestalCam::GetAveragedRmsPerArea(const MGeomCam &geom, const UInt_t ai, MBadPixelsCam *bad) 365 384 { 366 385 367 386 const Int_t np = GetSize(); 368 387 369 Double_t rms = 0.; 370 Int_t nr = 0; 388 Double_t rms = 0.; 389 Double_t rms2 = 0.; 390 Int_t nr = 0; 371 391 372 392 for (int i=0; i<np; i++) … … 382 402 const MPedestalPix &pix = (*this)[i]; 383 403 384 rms += pix.GetPedestalRms(); 385 nr ++; 386 } 387 388 return rms/nr; 404 rms += pix.GetPedestalRms(); 405 rms2 += pix.GetPedestalRms()*pix.GetPedestalRms(); 406 nr ++; 407 } 408 409 TArrayF *arr = new TArrayF(2); 410 arr->AddAt(nr ? rms/nr : -1.,0); 411 arr->AddAt(nr>1 ? TMath::Sqrt((rms2 - rms*rms/nr)/(nr-1)) : 0. ,1); 412 413 return arr; 389 414 } 390 415 … … 397 422 // in the calculation of the size average. 398 423 // 399 Float_t MPedestalCam::GetAveragedPedPerSector(const MGeomCam &geom, const UInt_t sec, MBadPixelsCam *bad) 424 // Returns a TArrayF of dimension 2: 425 // arr[0]: averaged pedestal (default: -1.) 426 // arr[1]: Error (rms) of averaged pedestal (default: 0.) 427 // 428 // ATTENTION: THE USER HAS TO DELETE THE RETURNED TARRAYF ACCORDINGLY 429 // 430 TArrayF *MPedestalCam::GetAveragedPedPerSector(const MGeomCam &geom, const UInt_t sec, MBadPixelsCam *bad) 400 431 { 401 432 … … 403 434 404 435 Double_t mean = 0.; 436 Double_t mean2 = 0.; 405 437 Int_t nr = 0; 406 438 … … 417 449 const MPedestalPix &pix = (*this)[i]; 418 450 419 mean += pix.GetPedestal(); 420 nr ++; 421 422 } 423 424 return mean/nr; 451 mean += pix.GetPedestal(); 452 mean2 += pix.GetPedestal()*pix.GetPedestal(); 453 nr ++; 454 455 } 456 457 TArrayF *arr = new TArrayF(2); 458 arr->AddAt(nr ? mean/nr : -1.,0); 459 arr->AddAt(nr>1 ? TMath::Sqrt((mean2 - mean*mean/nr)/(nr-1)) : 0. ,1); 460 461 return arr; 425 462 } 426 463 … … 433 470 // in the calculation of the size average. 434 471 // 435 Float_t MPedestalCam::GetAveragedRmsPerSector(const MGeomCam &geom, const UInt_t sec, MBadPixelsCam *bad) 472 // Returns a TArrayF of dimension 2: 473 // arr[0]: averaged pedestal RMS (default: -1.) 474 // arr[1]: Error (rms) of averaged pedestal RMS (default: 0.) 475 // 476 // ATTENTION: THE USER HAS TO DELETE THE RETURNED TARRAYF ACCORDINGLY 477 // 478 TArrayF *MPedestalCam::GetAveragedRmsPerSector(const MGeomCam &geom, const UInt_t sec, MBadPixelsCam *bad) 436 479 { 437 480 438 481 const Int_t np = GetSize(); 439 482 440 Double_t rms = 0.; 441 Int_t nr = 0; 483 Double_t rms = 0.; 484 Double_t rms2 = 0.; 485 Int_t nr = 0; 442 486 443 487 for (int i=0; i<np; i++) … … 453 497 const MPedestalPix &pix = (*this)[i]; 454 498 455 rms += pix.GetPedestalRms(); 456 nr ++; 457 458 } 459 460 return rms/nr; 499 rms += pix.GetPedestalRms(); 500 rms2 += pix.GetPedestalRms()*pix.GetPedestalRms(); 501 nr ++; 502 503 } 504 505 TArrayF *arr = new TArrayF(2); 506 arr->AddAt(nr ? rms/nr : -1.,0); 507 arr->AddAt(nr>1 ? TMath::Sqrt((rms2 - rms*rms/nr)/(nr-1)) : 0. ,1); 508 509 return arr; 510 461 511 } 462 512 -
trunk/MagicSoft/Mars/mpedestal/MPedestalCam.h
r4784 r4794 14 14 class MPedestalPix; 15 15 class MBadPixelsCam; 16 16 class TArrayF; 17 17 class MPedestalCam : public MParContainer, public MCamEvent 18 18 { … … 44 44 ULong_t GetTotalEntries () const { return fTotalEntries; } 45 45 46 Float_tGetAveragedPedPerArea ( const MGeomCam &geom, const UInt_t ai=0, MBadPixelsCam *bad=NULL );47 Float_tGetAveragedPedPerSector( const MGeomCam &geom, const UInt_t sec=0, MBadPixelsCam *bad=NULL );48 Float_tGetAveragedRmsPerArea ( const MGeomCam &geom, const UInt_t ai=0, MBadPixelsCam *bad=NULL );49 Float_tGetAveragedRmsPerSector( const MGeomCam &geom, const UInt_t sec=0, MBadPixelsCam *bad=NULL );46 TArrayF *GetAveragedPedPerArea ( const MGeomCam &geom, const UInt_t ai=0, MBadPixelsCam *bad=NULL ); 47 TArrayF *GetAveragedPedPerSector( const MGeomCam &geom, const UInt_t sec=0, MBadPixelsCam *bad=NULL ); 48 TArrayF *GetAveragedRmsPerArea ( const MGeomCam &geom, const UInt_t ai=0, MBadPixelsCam *bad=NULL ); 49 TArrayF *GetAveragedRmsPerSector( const MGeomCam &geom, const UInt_t sec=0, MBadPixelsCam *bad=NULL ); 50 50 51 51 MPedestalPix &operator[] ( Int_t i );
Note:
See TracChangeset
for help on using the changeset viewer.