Ignore:
Timestamp:
02/10/04 16:10:52 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mcalib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationBlindPixel.cc

    r3075 r3081  
    8888const Double_t MHCalibrationBlindPixel::fgBlindPixelElectronicAmpError = 0.002;
    8989 
    90 const Axis_t  MHCalibrationBlindPixel::fNyquistFreq       = 1.0;
    91 const Axis_t  MHCalibrationBlindPixel::fMinFreq           = 0.;
    9290const Int_t   MHCalibrationBlindPixel::fPSDNbins          = 30;
    9391 
     
    266264  fPSDHiGain = fourier.PowerSpectrumDensity(fHiGains);
    267265
    268   Int_t entries;
    269   TArrayF *array;
    270  
    271   fHPSD = new TH1F("HBlindPixelPSD",
    272                    "Power Spectrum Density Projection Blind Pixel",
    273                    fPSDNbins,fMinFreq,fNyquistFreq);
    274 
    275   array   = fPSDHiGain;
    276   entries = array->GetSize();
    277  
    278   for (Int_t i=0;i<entries;i++)
    279     fHPSD->Fill(array->At(i));
    280 
     266  fHPSD = MH::ProjectArray(fPSDHiGain, fPSDNbins,
     267                           "PSDProjectionBlindPixel",
     268                           "Power Spectrum Density Projection HiGain Blind Pixel");
    281269  //
    282270  // First guesses for the fit (should be as close to reality as possible,
    283271  //
    284   const Double_t area_guess  = entries*10.;
    285 
    286   fPSDExpFit = new TF1("PSDExpFit","[0]*exp(-[1]*x)",0.,1.);
    287 
    288   fPSDExpFit->SetParameters(entries,10.);
    289   fPSDExpFit->SetParNames("Area","slope");
    290   fPSDExpFit->SetParLimits(0,0.,3.*area_guess);
    291   fPSDExpFit->SetParLimits(1,0.,20.);
    292   fPSDExpFit->SetRange(fMinFreq,fNyquistFreq);
     272  const Double_t xmax = fHPSD->GetXaxis()->GetXmax();
     273
     274  fPSDExpFit = new TF1("PSDExpFit","exp([0]-[1]*x)",0.,xmax);
     275
     276  const Double_t slope_guess = (TMath::Log(fHPSD->GetEntries())+1.)/xmax;
     277  const Double_t offset_guess = slope_guess*xmax;
     278
     279  fPSDExpFit->SetParameters(offset_guess, slope_guess);
     280  fPSDExpFit->SetParNames("Offset","Slope");
     281  fPSDExpFit->SetParLimits(0,offset_guess/2.,2.*offset_guess);
     282  fPSDExpFit->SetParLimits(1,slope_guess/2.,2.*slope_guess);
     283  fPSDExpFit->SetRange(0.,xmax);
    293284
    294285  fHPSD->Fit(fPSDExpFit,"RQL0");
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationBlindPixel.h

    r3061 r3081  
    2525  static const Double_t fgBlindPixelElectronicAmpError;
    2626
    27   static const Axis_t  fNyquistFreq;
    28   static const Axis_t  fMinFreq;
    2927  static const Int_t   fPSDNbins;
    3028 
     
    4038  TArrayF* fPSDLoGain;           //-> Power spectrum density of fLoGains
    4139
    42   TH1F* fHPSD;                   //->
     40  TH1I* fHPSD;                   //->
    4341  TF1*  fPSDExpFit;              //->
    4442 
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationPixel.cc

    r3075 r3081  
    6161const Int_t   MHCalibrationPixel::fNDFLimit          = 5;
    6262
    63 const Axis_t  MHCalibrationPixel::fMinFreq           = 0.;
    64 const Int_t   MHCalibrationPixel::fPSDNbins          = 50;
     63const Int_t   MHCalibrationPixel::fPSDNbins          = 30;
    6564 
    6665// --------------------------------------------------------------------------
     
    268267  fPSDHiGain = fourier.PowerSpectrumDensity(fHiGains);
    269268
    270   Int_t entries;
    271   TArrayF *array;
    272 
    273   const Double_t max_freq = (fChargeSigma > 0.) ? fChargeSigma*0.2 : 2.;
    274   const Double_t min_freq = 0.;
    275 
    276269  if (IsUseLoGain())
    277     {
    278       fHPSD = new TH1F(Form("%s%d","HPSD",fPixId),
    279                        Form("%s%s","Power Spectrum Density Projection ","LoGain"),
    280                        fPSDNbins,min_freq,max_freq);
    281      
    282       array = fPSDLoGain;
    283     }
     270    fHPSD = MH::ProjectArray(fPSDLoGain, fPSDNbins,
     271                             Form("%s%d","PSDProjection",fPixId),
     272                             Form("%s%d","Power Spectrum Density Projection LoGain ",fPixId));
    284273  else
    285     {
    286 
    287       fHPSD = new TH1F(Form("%s%d","HPSD",fPixId),
    288                        Form("%s%s","Power Spectrum Density Projection ","HiGain"),
    289                        fPSDNbins,min_freq,max_freq);
    290      
    291       array = fPSDHiGain;
    292     }
    293  
    294   entries = array->GetSize();
    295  
    296   for (Int_t i=0;i<entries;i++)
    297     fHPSD->Fill(array->At(i));
     274    fHPSD = MH::ProjectArray(fPSDHiGain, fPSDNbins,
     275                             Form("%s%d","PSDProjection",fPixId),
     276                             Form("%s%d","Power Spectrum Density Projection HiGain ",fPixId));
    298277
    299278  //
    300279  // First guesses for the fit (should be as close to reality as possible,
    301280  //
    302   const Double_t area_guess  = entries*10.;
    303 
    304   fPSDExpFit = new TF1(Form("%s%d","PSDExpFit",fPixId),"[0]*exp(-[1]*x)",0.,1.);
    305 
    306   fPSDExpFit->SetParameters(area_guess,10.);
    307   fPSDExpFit->SetParNames("Area","slope");
    308   fPSDExpFit->SetParLimits(0,0.,20.*area_guess);
    309   fPSDExpFit->SetParLimits(1,0.,30.);
    310   fPSDExpFit->SetRange(min_freq,max_freq);
     281  const Double_t xmax = fHPSD->GetXaxis()->GetXmax();
     282
     283  fPSDExpFit = new TF1(Form("%s%d","PSDExpFit",fPixId),"exp([0]-[1]*x)",0.,xmax);
     284
     285  const Double_t slope_guess  = (TMath::Log(fHPSD->GetEntries())+1.)/xmax;
     286  const Double_t offset_guess = slope_guess*xmax;
     287
     288  fPSDExpFit->SetParameters(offset_guess, slope_guess);
     289  fPSDExpFit->SetParNames("Offset","Slope");
     290  fPSDExpFit->SetParLimits(0,offset_guess/2.,2.*offset_guess);
     291  fPSDExpFit->SetParLimits(1,slope_guess/2.,2.*slope_guess);
     292  fPSDExpFit->SetRange(0.,xmax);
    311293
    312294  fHPSD->Fit(fPSDExpFit,"RQL0");
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationPixel.h

    r3075 r3081  
    2626  static const Int_t   fNDFLimit; 
    2727
    28   static const Axis_t  fMinFreq;
    2928  static const Int_t   fPSDNbins;
    3029 
     
    4948  TF1* fChargeGausFit;           //->
    5049
    51   TH1F* fHPSD;                   //->
     50  TH1I* fHPSD;                   //->
    5251  TF1*  fPSDExpFit;              //->
    5352 
Note: See TracChangeset for help on using the changeset viewer.