- Timestamp:
- 03/01/07 23:06:34 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.cc
r8343 r8347 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MHCalibrationPulseTimeCam.cc,v 1. 29 2007-03-01 21:16:55 tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MHCalibrationPulseTimeCam.cc,v 1.30 2007-03-01 23:04:55 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 103 103 ///////////////////////////////////////////////////////////////////////////// 104 104 #include "MHCalibrationPulseTimeCam.h" 105 #include "MHCalibrationCam.h" 106 105 106 #include <TEnv.h> 107 #include <TGraph.h> 108 #include <TLegend.h> 109 #include <TCanvas.h> 107 110 #include <TOrdCollection.h> 108 #include <TPad.h>109 #include <TVirtualPad.h>110 #include <TCanvas.h>111 #include <TStyle.h>112 #include <TF1.h>113 #include <TLatex.h>114 #include <TLegend.h>115 #include <TGraph.h>116 #include <TEnv.h>117 111 118 112 #include "MLog.h" … … 121 115 #include "MParList.h" 122 116 117 #include "MArrayD.h" 118 #include "MRawRunHeader.h" 119 #include "MExtractedSignalCam.h" 120 #include "MPedestalSubtractedEvt.h" 121 122 #include "MCalibrationPix.h" 123 123 #include "MHCalibrationPix.h" 124 125 124 #include "MCalibrationIntensityCam.h" 126 #include "MCalibrationChargeCam.h" 127 #include "MCalibrationChargePix.h" 125 #include "MBadPixelsIntensityCam.h" 128 126 129 127 #include "MGeomCam.h" 130 128 #include "MGeomPix.h" 131 129 132 #include "MBadPixelsIntensityCam.h"133 130 #include "MBadPixelsCam.h" 134 #include "MBadPixelsPix.h"135 136 #include "MRawEvtData.h"137 #include "MRawRunHeader.h"138 #include "MRawEvtPixelIter.h"139 140 #include "MExtractedSignalCam.h"141 #include "MExtractedSignalPix.h"142 143 #include "MArrayI.h"144 #include "MArrayD.h"145 131 146 132 ClassImp(MHCalibrationPulseTimeCam); … … 149 135 150 136 const Byte_t MHCalibrationPulseTimeCam::fgSaturationLimit = 254; 151 const Byte_t MHCalibrationPulseTimeCam::fgLowerSignalLimit = 100;137 const Byte_t MHCalibrationPulseTimeCam::fgLowerSignalLimit = 85; 152 138 const Int_t MHCalibrationPulseTimeCam::fgNumPixelsRequired = 2; 153 139 const Int_t MHCalibrationPulseTimeCam::fgHiGainNbins = 20; … … 160 146 const TString MHCalibrationPulseTimeCam::gsHistYTitle = "Nr. events"; 161 147 const TString MHCalibrationPulseTimeCam::fgReferenceFile = "mjobs/signalref.rc"; 148 162 149 // -------------------------------------------------------------------------- 163 150 // … … 298 285 299 286 InitHiGainArrays(npixels,nareas,nsectors); 300 301 fSumhiarea .Set(nareas);302 fSumhisector.Set(nsectors);303 287 304 288 return kTRUE; … … 378 362 Bool_t MHCalibrationPulseTimeCam::FillHists(const MParContainer *par, const Stat_t w) 379 363 { 380 381 MRawEvtData *data = (MRawEvtData*)par; 382 if (!data) 383 { 384 *fLog << err << "No argument in MHCalibrationPulseTimeCam::Fill... abort." << endl; 385 return kFALSE; 386 } 387 388 const UInt_t nareas = fGeom->GetNumAreas(); 389 const UInt_t nsectors = fGeom->GetNumSectors(); 390 391 fSumhiarea .Reset(); 392 fSumhisector.Reset(); 393 fAverageAreaNum.Reset(); 394 fAverageSectorNum.Reset(); 395 396 MRawEvtPixelIter pixel(data); 397 while (pixel.Next()) 398 { 399 400 const Int_t i = pixel.GetPixelId(); 401 402 if (fBadPixels) 364 MPedestalSubtractedEvt *evt = (MPedestalSubtractedEvt*)par; 365 if (!evt) 366 { 367 *fLog << err << "No argument in MHCalibrationPulseTimeCam::Fill... abort." << endl; 368 return kFALSE; 369 } 370 371 const UInt_t nareas = fGeom->GetNumAreas(); 372 const UInt_t nsectors = fGeom->GetNumSectors(); 373 374 MArrayD sumarea(nareas); 375 MArrayD sumsector(nsectors); 376 377 fAverageAreaNum.Reset(); 378 fAverageSectorNum.Reset(); 379 380 const Int_t npix = evt->GetNumPixels(); 381 for (int idx=0; idx<npix; idx++) 382 { 383 if (fBadPixels) 384 if ((*fBadPixels)[idx].IsUnsuitable()) 385 continue; 386 387 Float_t *beg = evt->GetSamples(idx); 388 Float_t *end = beg + evt->GetNumSamples();; 389 Float_t *max = beg; 390 391 for (Float_t *ptr=beg+1; ptr<end; ptr++) 392 if (*ptr>*max) 393 max = ptr; 394 395 if (*max<fLowerSignalLimit || *max>fSaturationLimit) 396 continue; 397 398 const Int_t maxpos = max-beg-1; 399 400 (*this)[idx].FillHist(maxpos); 401 402 const Int_t aidx = (*fGeom)[idx].GetAidx(); 403 const Int_t sector = (*fGeom)[idx].GetSector(); 404 405 sumarea[aidx] += maxpos; 406 sumsector[sector] += maxpos; 407 408 fAverageAreaNum[aidx]++; 409 fAverageSectorNum[sector]++; 410 } 411 412 for (UInt_t j=0; j<nareas; j++) 413 { 414 const Int_t npix = fAverageAreaNum[j]; 415 416 if (npix > fNumPixelsRequired) 403 417 { 404 MBadPixelsPix &bad = (*fBadPixels)[i]; 405 if (bad.IsUnsuitable()) 406 continue; 418 if (IsOscillations()) 419 GetAverageHiGainArea(j).FillHistAndArray(sumarea[j]/npix); 420 else 421 GetAverageHiGainArea(j).FillHist(sumarea[j]/npix); 422 407 423 } 408 409 Byte_t *start = pixel.GetHiGainSamples(); 410 Byte_t *end = start + pixel.GetNumHiGainSamples(); 411 Byte_t *p = start; 412 Byte_t *max = start; 413 Int_t maxpos = 0; 414 415 while (p < end) 416 { 417 if (*p > *max) 418 { 419 max = p; 420 maxpos = p-start-1; 421 } 422 p++; 423 } 424 425 if (*max > fSaturationLimit) 426 continue; 427 428 start = pixel.GetLoGainSamples(); 429 end = start + pixel.GetNumLoGainSamples(); 430 p = start; 431 432 while (p < end) 433 { 434 if (*p > *max) 435 { 436 max = p; 437 maxpos = p-start-1 + pixel.GetNumHiGainSamples(); 438 } 439 p++; 440 } 441 442 if (*max < fLowerSignalLimit || *max > fSaturationLimit) 443 continue; 444 445 (*this)[i].FillHist(maxpos); 446 447 const Int_t aidx = (*fGeom)[i].GetAidx(); 448 const Int_t sector = (*fGeom)[i].GetSector(); 449 450 fSumhiarea[aidx] += maxpos; 451 fSumhisector[sector] += maxpos; 452 453 fAverageAreaNum[aidx]++; 454 fAverageSectorNum[sector]++; 455 } 456 457 for (UInt_t j=0; j<nareas; j++) 458 { 459 460 const Int_t npix = fAverageAreaNum[j]; 461 462 if (npix > fNumPixelsRequired) 463 { 464 if (IsOscillations()) 465 GetAverageHiGainArea(j).FillHistAndArray(fSumhiarea[j]/npix); 466 else 467 GetAverageHiGainArea(j).FillHist(fSumhiarea[j]/npix); 468 469 } 470 } 471 472 for (UInt_t j=0; j<nsectors; j++) 473 { 474 475 const Int_t npix = fAverageSectorNum[j]; 476 477 if (npix > 0) 478 { 479 if (IsOscillations()) 480 GetAverageHiGainSector(j).FillHistAndArray(fSumhisector [j]/npix); 481 else 482 GetAverageHiGainSector(j).FillHist(fSumhisector [j]/npix); 483 } 484 } 485 486 return kTRUE; 424 } 425 426 for (UInt_t j=0; j<nsectors; j++) 427 { 428 const Int_t npix = fAverageSectorNum[j]; 429 430 if (npix > 0) 431 { 432 if (IsOscillations()) 433 GetAverageHiGainSector(j).FillHistAndArray(sumsector[j]/npix); 434 else 435 GetAverageHiGainSector(j).FillHist(sumsector[j]/npix); 436 } 437 } 438 439 return kTRUE; 487 440 } 488 441
Note:
See TracChangeset
for help on using the changeset viewer.