Changeset 6329
- Timestamp:
- 02/10/05 01:45:41 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r6328 r6329 64 64 - initialize the bad events counters to 0 also in constructor 65 65 - release the limit for bad events a bit 66 67 * mcalib/MCalibrationTestCam.h 68 - take out include of TArrayI (already in base class) 66 69 67 70 -
trunk/MagicSoft/Mars/mcalib/MCalibrationTestCam.h
r6242 r6329 4 4 #ifndef MARS_MCalibrationCam 5 5 #include "MCalibrationCam.h" 6 #endif7 8 #ifndef ROOT_TArrayI9 #include <TArrayI.h>10 6 #endif 11 7 -
trunk/MagicSoft/Mars/mhcalib/HCalibLinkDef.h
r5749 r6329 16 16 #pragma link C++ class MHCalibrationHiLoCam+; 17 17 #pragma link C++ class MHPedestalCam+; 18 #pragma link C++ class MHPedestalPix+; 18 19 #pragma link C++ class MHCalibrationTestTimeCam+; 19 20 -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationTestTimeCam.h
r6204 r6329 14 14 static const Axis_t fgFirst; //! Default for fFirst (now set to: -0.5 ) 15 15 static const Axis_t fgLast; //! Default for fLast (now set to: 29.5 ) 16 static const Float_t fgProbLimit; //! The default for fProbLimit (now set to: 0.000001)16 static const Float_t fgProbLimit; //! Default for fProbLimit (now set to: 0.000001) 17 17 18 18 static const TString gsHistName; //! Default Histogram names -
trunk/MagicSoft/Mars/mhcalib/MHPedestalCam.cc
r6323 r6329 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@atsro.uni-wuerzburh.de>19 18 ! Author(s): Markus Gaug 02/2004 <mailto:markus@ifae.es> 20 19 ! … … 91 90 #include "MHPedestalPix.h" 92 91 93 #include "MBadPixelsCam.h"94 95 92 #include "MLog.h" 96 93 #include "MLogManip.h" … … 103 100 #include "MPedestalCam.h" 104 101 #include "MPedestalPix.h" 102 103 #include "MCalibrationIntensityCam.h" 105 104 #include "MCalibrationPix.h" 105 106 #include "MBadPixelsIntensityCam.h" 107 #include "MBadPixelsCam.h" 106 108 107 109 #include "MGeomCam.h" … … 118 120 using namespace std; 119 121 120 const Int_t MHPedestalCam::fgNbins= 100;121 const Axis_t MHPedestalCam::fgFirst = -50.;122 const Axis_t MHPedestalCam::fgLast = 50.;122 const Int_t MHPedestalCam::fgNbins = 100; 123 const Axis_t MHPedestalCam::fgFirst = -49.; 124 const Axis_t MHPedestalCam::fgLast = 151.; 123 125 const TString MHPedestalCam::gsHistName = "Pedestal"; 124 126 const TString MHPedestalCam::gsHistTitle = "Pedestal"; 125 127 const TString MHPedestalCam::gsHistXTitle = "Charge [FADC slices]"; 126 128 const TString MHPedestalCam::gsHistYTitle = "Nr. events"; 129 const TString MHPedestalCam::fgNamePedestalCam = "MPedestalCam"; 127 130 // -------------------------------------------------------------------------- 128 131 // … … 132 135 // - fExtractHiGainSlices to 0. 133 136 // - the event frequency to 1200 Hz. 134 // - the fRenorm 137 // - the fRenormflag to kFALSE 135 138 // 136 139 // - fNbins to fgNbins … … 144 147 // 145 148 MHPedestalCam::MHPedestalCam(const char *name, const char *title) 146 : fNumEvents(0), fExtractHiGainSlices(0.) 149 : fNamePedestalCamOut(fgNamePedestalCam), fNumEvents(0), 150 fExtractHiGainSlices(0.), fPedestalsOut(NULL) 147 151 { 148 152 … … 151 155 152 156 SetPulserFrequency(1200); 153 SetRenorm(k TRUE);157 SetRenorm(kFALSE); 154 158 SetLoGain(kFALSE); 155 159 … … 162 166 SetHistXTitle(gsHistXTitle.Data()); 163 167 SetHistYTitle(gsHistYTitle.Data()); 168 164 169 } 165 170 … … 170 175 // Resets: 171 176 // - fSum 172 // - fSum 2177 // - fSumSquare 173 178 // - fAreaSum 174 // - fAreaSum 2175 // - fArea Val179 // - fAreaSumSquare 180 // - fAreaNum 176 181 // - fSectorSum 177 // - fSectorSum 2178 // - fSector Val182 // - fSectorSumSquare 183 // - fSectorNum 179 184 // 180 185 void MHPedestalCam::ResetHists() … … 190 195 // Reset contents of arrays. 191 196 fSum.Reset(); 192 fSum 2.Reset();197 fSumSquare.Reset(); 193 198 194 199 fAreaSum. Reset(); 195 fAreaSum 2.Reset();196 fArea Val.Reset();200 fAreaSumSquare.Reset(); 201 fAreaNum.Reset(); 197 202 198 203 fSectorSum. Reset(); 199 fSectorSum2.Reset(); 200 fSectorVal.Reset(); 201 } 202 } 203 204 fSectorSumSquare.Reset(); 205 fSectorNum.Reset(); 206 } 207 } 204 208 // -------------------------------------------------------------------------- 205 209 // … … 269 273 270 274 MExtractedSignalCam *signal = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam"); 271 if (!signal) 272 { 273 *fLog << err << "Cannot find MExtractedSignalCam... abort." << endl; 275 if (!signal && fRenorm) 276 { 277 *fLog << err << "Cannot find MExtractedSignalCam, but re-normalization switched on..." 278 << " Cannot find number of used slices ...abort." << endl; 274 279 return kFALSE; 275 280 } 276 281 277 282 278 fPedestals = (MPedestalCam*)pList->FindObject("MPedestalCam"); 279 280 if (!fPedestals) 281 *fLog << warn << "Cannot find MPedestalCam ..." << endl; 283 fPedestalsOut = (MPedestalCam*)pList->FindObject(AddSerialNumber(fNamePedestalCamOut),"MPedestalCam"); 284 285 if (!fPedestalsOut) 286 { 287 *fLog << err << "Cannot find nor create outgoing MPedestalCam ..." << endl; 288 return kFALSE; 289 } 282 290 283 291 const Int_t npixels = fGeom->GetNumPixels(); … … 295 303 } 296 304 305 InitHiGainArrays(npixels,nareas,nsectors); 306 307 if (fSum.GetSize()==0) 308 { 309 fSum. Set(npixels); 310 fSumSquare. Set(npixels); 311 fAreaSum. Set(nareas); 312 fAreaSumSquare. Set(nareas); 313 fAreaNum. Set(nareas); 314 fSectorSum. Set(nsectors); 315 fSectorSumSquare.Set(nsectors); 316 fSectorNum.Set(nsectors); 317 } 318 319 fNumEvents = 0; 320 321 if (!signal) 322 return kTRUE; 323 324 297 325 Float_t sliceshi = signal->GetNumUsedHiGainFADCSlices(); 298 326 299 327 if (sliceshi == 0.) 300 328 { 301 329 *fLog << err << "Number of used signal slices in MExtractedSignalCam is zero ... abort." 302 << endl;330 << endl; 303 331 return kFALSE; 304 332 } 305 333 306 334 if (fExtractHiGainSlices != 0. && sliceshi != fExtractHiGainSlices ) 307 335 { 308 336 *fLog << err << "Number of used High Gain signal slices changed in MExtractedSignalCam ... abort." 309 << endl;337 << endl; 310 338 return kFALSE; 311 339 } 312 340 313 341 fExtractHiGainSlices = sliceshi; 314 315 342 *fLog << endl; 316 343 *fLog << inf << GetDescriptor() 317 << ": Number of found High Gain signal slices: " << fExtractHiGainSlices << endl; 318 319 InitHiGainArrays(npixels,nareas,nsectors); 320 321 if (fSum.GetSize()==0) 322 { 323 fSum. Set(npixels); 324 fSum2. Set(npixels); 325 fAreaSum. Set(nareas); 326 fAreaSum2. Set(nareas); 327 fAreaVal. Set(nareas); 328 fSectorSum. Set(nsectors); 329 fSectorSum2.Set(nsectors); 330 fSectorVal.Set(nsectors); 331 } 332 333 fNumEvents = 0; 344 << ": Number of found High Gain signal slices: " << fExtractHiGainSlices << endl; 334 345 335 346 return kTRUE; 336 347 } 337 348 349 // -------------------------------------------------------------------------- 350 // 351 // Initializes the High Gain Arrays: 352 // 353 // - For every entry in the expanded arrays: 354 // * Initialize an MHCalibrationChargePix 355 // * Set Binning from fNbins, fFirst and fLast 356 // * Set Binning of Abs Times histogram from fAbsNbins, fAbsFirst and fAbsLast 357 // * Set Histgram names and titles from fHistName and fHistTitle 358 // * Set Abs Times Histgram names and titles from fAbsHistName and fAbsHistTitle 359 // * Set X-axis and Y-axis titles from fHistXTitle and fHistYTitle 360 // * Set X-axis and Y-axis titles of Abs Times Histogram from fAbsHistXTitle and fAbsHistYTitle 361 // * Call InitHists 362 // 363 // 364 void MHPedestalCam::InitHiGainArrays(const Int_t npixels, const Int_t nareas, const Int_t nsectors) 365 { 366 367 if (fHiGainArray->GetSize()==0) 368 { 369 for (Int_t i=0; i<npixels; i++) 370 { 371 fHiGainArray->AddAt(new MHPedestalPix(Form("%sHiGainPix%04d",fHistName.Data(),i), 372 Form("%s High Gain Pixel%04d",fHistTitle.Data(),i)),i); 373 374 MHPedestalPix &pix = (MHPedestalPix&)(*this)[i]; 375 376 pix.SetNbins(fNbins); 377 pix.SetFirst(fFirst); 378 pix.SetLast (fLast); 379 380 pix.SetProbLimit(fProbLimit); 381 382 MBadPixelsPix &bad = fIntensBad ? (*fIntensBad)[i] : (*fBadPixels)[i]; 383 InitHists(pix,bad,i); 384 } 385 } 386 387 if (!IsAverageing()) 388 return; 389 390 if (fAverageHiGainAreas->GetSize()==0) 391 { 392 for (Int_t j=0; j<nareas; j++) 393 { 394 fAverageHiGainAreas->AddAt(new MHPedestalPix(Form("%sHiGainArea%d",fHistName.Data(),j), 395 Form("%s High Gain Area Idx %d",fHistTitle.Data(),j)),j); 396 397 MHPedestalPix &pix = (MHPedestalPix&)GetAverageHiGainArea(j); 398 399 pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nareas)); 400 pix.SetFirst(fFirst); 401 pix.SetLast (fLast); 402 403 InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j); 404 405 } 406 } 407 408 if (fAverageHiGainSectors->GetSize()==0) 409 { 410 for (Int_t j=0; j<nsectors; j++) 411 { 412 fAverageHiGainSectors->AddAt(new MHPedestalPix(Form("%sHiGainSector%02d",fHistName.Data(),j), 413 Form("%s High Gain Sector %02d",fHistTitle.Data(),j)),j); 414 415 MHPedestalPix &pix = (MHPedestalPix&)GetAverageHiGainSector(j); 416 417 pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nareas)); 418 pix.SetFirst(fFirst); 419 pix.SetLast (fLast); 420 421 InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j); 422 423 } 424 } 425 } 338 426 339 427 // ------------------------------------------------------------------------------- … … 352 440 { 353 441 354 M ExtractedSignalCam *signal = (MExtractedSignalCam*)par;355 if (! signal)356 { 357 *fLog << err << "No argument in M ExtractedSignalCam::Fill... abort." << endl;442 MPedestalCam *pedestal = (MPedestalCam*)par; 443 if (!pedestal) 444 { 445 *fLog << err << "No argument in MHPedestalCam::Fill... abort." << endl; 358 446 return kFALSE; 359 447 } … … 376 464 continue; 377 465 378 const M ExtractedSignalPix &pix = (*signal)[i];379 380 const Float_t ped hi = pix.GetExtractedSignalHiGain();466 const MPedestalPix &ped = (*pedestal)[i]; 467 468 const Float_t pedes = ped.GetPedestal(); 381 469 382 470 const Int_t aidx = (*fGeom)[i].GetAidx(); 383 471 const Int_t sector = (*fGeom)[i].GetSector(); 384 472 385 histhi.FillHistAndArray(ped hi) ;386 387 fSum[i] += ped hi;388 fAreaSum[aidx] += ped hi;389 fSectorSum[sector] += ped hi;390 391 const Float_t sqrsum = ped hi*pedhi;392 fSum 2[i] += sqrsum;393 fAreaSum 2[aidx] += sqrsum;394 fSectorSum 2[sector] += sqrsum;395 396 sumareahi [aidx] += ped hi;473 histhi.FillHistAndArray(pedes) ; 474 475 fSum[i] += pedes; 476 fAreaSum[aidx] += pedes; 477 fSectorSum[sector] += pedes; 478 479 const Float_t sqrsum = pedes*pedes; 480 fSumSquare[i] += sqrsum; 481 fAreaSumSquare[aidx] += sqrsum; 482 fSectorSumSquare[sector] += sqrsum; 483 484 sumareahi [aidx] += pedes; 397 485 numareahi [aidx] ++; 398 sumsectorhi[sector] += ped hi;486 sumsectorhi[sector] += pedes; 399 487 numsectorhi[sector] ++; 400 488 … … 449 537 { 450 538 451 MH CalibrationPix &hist =(*this)[i];539 MHPedestalPix &hist = (MHPedestalPix&)(*this)[i]; 452 540 MCalibrationPix &pix = (*fCam)[i]; 453 541 … … 456 544 // 457 545 pix.SetLoGainMean ( fSum[i] / fNumEvents ); 458 const Double_t diff = fSum 2[i] - fSum[i]*fSum[i]/fNumEvents;546 const Double_t diff = fSumSquare[i] - fSum[i]*fSum[i]/fNumEvents; 459 547 pix.SetLoGainSigma ( diff > 0. ? TMath::Sqrt( diff / (fNumEvents-1) ) : 0.); 460 548 pix.SetLoGainMeanVar ( pix.GetLoGainSigma() * pix.GetLoGainSigma() / fNumEvents ); … … 467 555 // 2) Fit the Hi Gain histograms with a Gaussian 468 556 // 557 // if (i%100) 558 // hist.FitTripleGaus(); 559 // else 469 560 hist.FitGaus(); 470 561 // … … 529 620 // 6) Store calculated means and variances in the low-gain slices 530 621 // 531 const ULong_t aevts = fNumEvents * fArea Val[j];622 const ULong_t aevts = fNumEvents * fAreaNum[j]; 532 623 if (aevts <= 1) 533 624 continue; 534 625 535 626 pix.SetLoGainMean ( fAreaSum[j] / aevts ); 536 const Double_t diff = fAreaSum 2[j] - fAreaSum[j]*fAreaSum[j]/aevts ;627 const Double_t diff = fAreaSumSquare[j] - fAreaSum[j]*fAreaSum[j]/aevts ; 537 628 pix.SetLoGainSigma( diff > 0. ? TMath::Sqrt( diff / (aevts-1) ) : 0.); 538 629 } … … 573 664 // 6) Store calculated means and variances in the low-gain slices 574 665 // 575 const ULong_t sevts = fNumEvents * fSector Val[j];666 const ULong_t sevts = fNumEvents * fSectorNum[j]; 576 667 if (sevts <= 1) 577 668 continue; 578 669 579 670 pix.SetLoGainMean ( fSectorSum[j] / sevts ); 580 const Double_t diff = fSectorSum 2[j] - fSectorSum[j]*fSectorSum[j]/sevts ;671 const Double_t diff = fSectorSumSquare[j] - fSectorSum[j]*fSectorSum[j]/sevts ; 581 672 pix.SetLoGainSigma( diff > 0. ? TMath::Sqrt( diff / (sevts-1) ) : 0.); 582 673 } … … 694 785 return kFALSE; 695 786 696 const Float_t ped = (*fPedestals )[idx].GetPedestal();697 const Float_t rms = (*fPedestals )[idx].GetPedestalRms();698 699 const Float_t entsqr = TMath::Sqrt((Float_t)fPedestals ->GetTotalEntries());787 const Float_t ped = (*fPedestalsOut)[idx].GetPedestal(); 788 const Float_t rms = (*fPedestalsOut)[idx].GetPedestalRms(); 789 790 const Float_t entsqr = TMath::Sqrt((Float_t)fPedestalsOut->GetTotalEntries()); 700 791 701 792 const Float_t pederr = rms/entsqr; -
trunk/MagicSoft/Mars/mhcalib/MHPedestalCam.h
r6323 r6329 17 17 private: 18 18 19 static const Int_t fgNbins; //! Default number of bins (now set to: 100 ) 20 static const Axis_t fgFirst; //! Default lower histogram limit (now set to: -50. ) 21 static const Axis_t fgLast; //! Default upper histogram limit (now set to: 50. ) 22 23 static const TString gsHistName; //! Default Histogram names 24 static const TString gsHistTitle; //! Default Histogram titles 25 static const TString gsHistXTitle; //! Default Histogram x-axis titles 26 static const TString gsHistYTitle; //! Default Histogram y-axis titles 19 static const Int_t fgNbins; //! Default number of bins (now set to: 100 ) 20 static const Axis_t fgFirst; //! Default lower histogram limit (now set to: -50. ) 21 static const Axis_t fgLast; //! Default upper histogram limit (now set to: 50. ) 22 23 static const TString gsHistName; //! Default Histogram names 24 static const TString gsHistTitle; //! Default Histogram titles 25 static const TString gsHistXTitle; //! Default Histogram x-axis titles 26 static const TString gsHistYTitle; //! Default Histogram y-axis titles 27 28 static const TString fgNamePedestalCam; //! "MPedestalCam" 29 30 TString fNamePedestalCamOut; // Name of the 'MPedestalCam' container with results 27 31 28 32 ULong_t fNumEvents; // Number of processed events … … 31 35 Float_t fExtractLoGainSlices; // Number of FADC slices used for low gain signal extraction 32 36 33 MPedestalCam *fPedestals ; //! Pedestal Cam filled by MPedCalcPedRun34 37 MPedestalCam *fPedestalsOut; //! Pedestal Cam with results 38 35 39 Bool_t fRenorm; // Flag if the results will be re-normalized 36 40 37 MArrayD fSum; //! sum of values38 MArrayD fSum 2;//! sum of squared values39 MArrayD fAreaSum; //! averaged sum of values per area idx40 MArrayD fAreaSum 2;//! averaged sum of squared values per area idx41 MArrayI fArea Val;//! number of valid pixel with area idx42 MArray D fSectorSum; //! averaged sum of values per sector43 MArrayD fSectorSum 2; //! averaged sum of squaredvalues per sector44 MArray I fSectorVal; //! number of valid pixel with sector idx41 MArrayD fSum; //! sum of values 42 MArrayD fSumSquare; //! sum of squared values 43 MArrayD fAreaSum; //! averaged sum of values per area idx 44 MArrayD fAreaSumSquare; //! averaged sum of squared values per area idx 45 MArrayI fAreaNum; //! number of valid pixel with area idx 46 MArrayI fSectorNum; //! number of valid pixel with sector idx 47 MArrayD fSectorSum; //! averaged sum of values per sector 48 MArrayD fSectorSumSquare; //! averaged sum of squared values per sector 45 49 46 50 Bool_t ReInitHists(MParList *pList); 47 51 Bool_t FillHists(const MParContainer *par, const Stat_t w=1); 48 52 Bool_t FinalizeHists(); 53 54 void InitHiGainArrays( const Int_t npix, const Int_t nareas, const Int_t nsectors ); 49 55 50 56 void RenormResults(); … … 55 61 MHPedestalCam(const char *name=NULL, const char *title=NULL); 56 62 57 63 // Clone 58 64 TObject *Clone(const char *name="") const; 59 65 … … 62 68 63 69 void ResetHists(); 64 void SetRenorm( const Bool_t b=kTRUE ) { fRenorm = b; } 70 71 void SetNamePedestalCamOut(const char *name) { fNamePedestalCamOut = name; } 72 void SetRenorm (const Bool_t b=kTRUE ) { fRenorm = b; } 65 73 66 74 ClassDef(MHPedestalCam, 1) // Histogram class for Charge Camera Pedestals -
trunk/MagicSoft/Mars/mhcalib/Makefile
r5864 r6329 43 43 MHCalibrationTestCam.cc \ 44 44 MHPedestalCam.cc \ 45 MHPedestalPix.cc \ 45 46 MHCalibrationTestTimeCam.cc \ 46 47 MHGausEvents.cc
Note:
See TracChangeset
for help on using the changeset viewer.