Changeset 2932 for trunk/MagicSoft


Ignore:
Timestamp:
01/27/04 20:39:14 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mcalib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mcalib/MCalibrationPix.h

    r2904 r2932  
    1212private:
    1313
    14   Int_t   fPixId;                        // the pixel Id
     14  Int_t   fPixId;                     // the pixel Id
    1515 
    16   Float_t fCharge;                       // The mean reduced charge after the fit
    17   Float_t fErrCharge;                    // The error of reduced mean charge after the fit
    18   Float_t fSigmaCharge;                  // The sigma of the mean charge after the fit
    19   Float_t fErrSigmaCharge;               // The error of the sigma of the mean charge after the fit
    20   Float_t fRSigmaSquare;                 // The reduced squares of sigmas after the fit
    21   Float_t fChargeProb;                   // The probability of the fit function
     16  const Float_t fElectronicPedRms;    // The pure electronic component of the RMS
     17  const Float_t fErrElectronicPedRms; // The error of the pure electronic component of the RMS
    2218
    23   Float_t fPed;                          // The mean pedestal (from MPedestalPix)
    24   Float_t fPedRms;                       // The pedestal  RMS (from MPedestalPix)
    25   Float_t fErrPedRms;                    // The error of the pedestal  RMS (from MPedestalPix) 
    26   Float_t fElectronicPedRms;             // The pure electronic component of the RMS
    27   Float_t fErrElectronicPedRms;          // The error of the pure electronic component of the RMS
     19  const Float_t fFactor;              // The laboratory F-factor
     20  const Float_t fFactorError;         // The laboratory F-factor Error
    2821
    29   Float_t fTime;                         // The mean arrival time after the fit 
    30   Float_t fSigmaTime;                    // The error of the mean arrival time after the fit
    31   Float_t fTimeChiSquare;                // The Chi Square of the fit function
    32   Float_t fTimeProb;                     // The probability of the fit function
     22  const Float_t fChargeLimit;         // The limit (in units of PedRMS) for acceptance of the fitted mean charge
     23  const Float_t fChargeErrLimit;      // The limit (in units of PedRMS) for acceptance of the fitted charge sigma
     24  const Float_t fChargeRelErrLimit;   // The limit (in units of Error of fitted charge) for acceptance of the fitted mean
     25  Byte_t  fFlags;               // Flag for the set Bits
    3326 
    34   Float_t fFactor;                       // The laboratory F-factor
    35   Float_t fFactorError;                  // The laboratory F-factor Error
    36   Float_t fPheFFactorMethod;             // The number of Phe's calculated (F-factor method)
    37   Float_t fPheFFactorMethodError;        // The error on the number of Phe's calculated (F-factor method)
     27  Float_t fCharge;              // The mean reduced charge after the fit
     28  Float_t fErrCharge;           // The error of reduced mean charge after the fit
     29  Float_t fSigmaCharge;         // The sigma of the mean charge after the fit
     30  Float_t fErrSigmaCharge;      // The error of the sigma of the mean charge after the fit
     31  Float_t fRSigmaSquare;        // The reduced squares of sigmas after the fit
     32  Float_t fChargeProb;          // The probability of the fit function
    3833
    39   Float_t fConversionFFactorMethod;      // The conversion factor to Phe's (F-factor method)
    40   Float_t fConversionBlindPixelMethod;   // The conversion factor to Ph's (Blind Pixel method)
    41   Float_t fConversionPINDiodeMethod;     // The conversion factor to Ph's (PIN Diode method)
     34  Float_t fPed;                 // The mean pedestal (from MPedestalPix)
     35  Float_t fPedRms;              // The pedestal  RMS (from MPedestalPix)
     36  Float_t fErrPedRms;           // The error of the pedestal  RMS (from MPedestalPix) 
     37
     38  Float_t fTime;                // The mean arrival time after the fit 
     39  Float_t fSigmaTime;           // The error of the mean arrival time after the fit
     40  Float_t fTimeChiSquare;       // The Chi Square of the fit function
     41  Float_t fTimeProb;            // The probability of the fit function
     42 
     43  Float_t fPheFFactorMethod;                // The number of Phe's calculated (F-factor method)
     44  Float_t fPheFFactorMethodError;           // The error on the number of Phe's calculated (F-factor method)
     45
     46  Float_t fConversionFFactorMethod;         // The conversion factor to Phe's (F-factor method)
     47  Float_t fConversionBlindPixelMethod;      // The conversion factor to Ph's (Blind Pixel method)
     48  Float_t fConversionPINDiodeMethod;        // The conversion factor to Ph's (PIN Diode method)
    4249
    4350  Float_t fConversionErrorFFactorMethod;    // The error of the conversion factor to Phe's (F-factor method)
     
    5259  Float_t fConversionHiLoError;             // The error of the conversion factor between Hi Gain and Lo Gain 
    5360 
    54   Byte_t  fFlags;                           // Flag for the set Bits
    55 
    5661  enum  { kHiGainSaturation,
    5762          kExcluded, kExcludeQualityCheck,
     
    6166  MHCalibrationPixel *fHist;                //! Pointer to the histograms performing the fits, etc. 
    6267
    63   Float_t fChargeLimit;
    64   Float_t fChargeErrLimit;
    65   Float_t fChargeRelErrLimit; 
    66  
    6768  Bool_t CheckChargeFitValidity();
    6869  Bool_t CheckTimeFitValidity();
     
    144145 
    145146  // Fill histos
    146   Bool_t FillChargeHiGain(Float_t q)                   { return fHist->FillChargeHiGain(q); }
    147   Bool_t FillTimeHiGain(Float_t t)                     { return fHist->FillTimeHiGain(t); } 
    148   Bool_t FillRChargevsTimeHiGain(Float_t rq, Int_t t) { return fHist->FillChargevsNHiGain(rq,t); }   
     147  Bool_t FillChargeHiGain(Float_t q) const                  { return fHist->FillChargeHiGain(q); }
     148  Bool_t FillTimeHiGain(Float_t t)   const                  { return fHist->FillTimeHiGain(t); } 
     149  Bool_t FillRChargevsTimeHiGain(Float_t rq, Int_t t) const { return fHist->FillChargevsNHiGain(rq,t); }   
    149150
    150   Bool_t FillChargeLoGain(Float_t q)                   { return fHist->FillChargeLoGain(q); }
    151   Bool_t FillTimeLoGain(Float_t t)                     { return fHist->FillTimeLoGain(t); } 
    152   Bool_t FillRChargevsTimeLoGain(Float_t rq, Int_t t) { return fHist->FillChargevsNLoGain(rq,t); }   
     151  Bool_t FillChargeLoGain(Float_t q) const                  { return fHist->FillChargeLoGain(q); }
     152  Bool_t FillTimeLoGain(Float_t t)   const                  { return fHist->FillTimeLoGain(t); } 
     153  Bool_t FillRChargevsTimeLoGain(Float_t rq, Int_t t) const { return fHist->FillChargevsNLoGain(rq,t); }   
    153154 
    154   Bool_t FillChargesInGraph(Float_t qhi,Float_t qlo)   { return fHist->FillPointInGraph(qhi,qlo); }
     155  Bool_t FillChargesInGraph(Float_t qhi,Float_t qlo) const  { return fHist->FillPointInGraph(qhi,qlo); }
    155156
    156157  void   DefinePixId(Int_t i);
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationPixel.cc

    r2922 r2932  
    5656MHCalibrationPixel::MHCalibrationPixel(const char *name, const char *title)
    5757      : fPixId(-1),
    58         fTotalEntries(0),
    59         fHChargeHiGain(NULL), 
    60         fHTimeHiGain(NULL),
    61         fHChargevsNHiGain(NULL),
    62         fHChargeLoGain(NULL), 
    63         fHTimeLoGain(NULL),   
    64         fHChargevsNLoGain(NULL),
    65         fChargeGausFit(NULL), 
     58        fChargeNbinsHiGain(2100),
     59        fChargeNbinsLoGain(1010),
     60        fTimeNbins(32),
     61        fChargevsNbins(1000),
     62        fTimeFirst(-0.25),
     63        fTimeLast(15.75),
     64        fHivsLoGain(NULL),
     65        fChargeGausFit(NULL),
    6666        fTimeGausFit(NULL),
    67         fHivsLoGain(NULL),
    68         fFitLegend(NULL),
    69         fChargeFirstHiGain(-100.5),
    70         fChargeLastHiGain(1999.5),
    71         fChargeNbinsHiGain(2100),
    72         fChargeFirstLoGain(-100.5),
    73         fChargeLastLoGain(9999.5),
    74         fChargeNbinsLoGain(1010),
    75         fChargeChisquare(-1.),
    76         fChargeProb(-1.),
    77         fChargeNdf(-1),
    78         fTimeChisquare(-1.),
    79         fTimeProb(-1.),
    80         fTimeNdf(-1),
    81         fTimeMean(-1.),
    82         fTimeSigma(-1.),
    83         fTimeLowerFitRangeHiGain(0),
    84         fTimeUpperFitRangeHiGain(0),
    85         fTimeLowerFitRangeLoGain(0),
    86         fTimeUpperFitRangeLoGain(0),
    87         fOffset(0.),
    88         fSlope(0.)
     67        fFitLegend(NULL)
    8968{
    9069
    9170    fName  = name  ? name  : "MHCalibrationPixel";
    9271    fTitle = title ? title : "Fill the accumulated charges and times of all events and perform fits";
     72
     73    fChargeFirstHiGain = -100.5;
     74    fChargeLastHiGain  = 1999.5;
     75    fChargeFirstLoGain = -100.5;
     76    fChargeLastLoGain  = 9999.5;
    9377
    9478    // Create a large number of bins, later we will rebin
    9579    fHChargeHiGain = new TH1F("HChargeHiGain","Distribution of Summed FADC Hi Gain Slices Pixel ",
    9680                              fChargeNbinsHiGain,fChargeFirstHiGain,fChargeLastHiGain);
    97     fHChargeHiGain->SetXTitle("Sum FADC Slices (Hi Gain)");
    98     fHChargeHiGain->SetYTitle("Nr. of events");
    99     fHChargeHiGain->Sumw2();
    100 
    101     fHChargeHiGain->SetDirectory(NULL);
    102 
    10381    fHChargeLoGain = new TH1F("HChargeLoGain","Distribution of Summed FADC Lo Gain Slices Pixel ",
    10482                              fChargeNbinsLoGain,fChargeFirstLoGain,fChargeLastLoGain);
     83
    10584    fHChargeLoGain->SetXTitle("Sum FADC Slices (Lo Gain)");
     85    fHChargeHiGain->SetXTitle("Sum FADC Slices (Hi Gain)");
     86
    10687    fHChargeLoGain->SetYTitle("Nr. of events");
     88    fHChargeHiGain->SetYTitle("Nr. of events");
     89
     90    fHChargeHiGain->Sumw2();
    10791    fHChargeLoGain->Sumw2();
    10892
     93    fHTimeHiGain = new TH1F("HTimeHiGain","Distribution of Mean Arrival Hi Gain Times Pixel ",
     94                            fTimeNbins,fTimeFirst,fTimeLast);
     95    fHTimeLoGain = new TH1F("HTimeLoGain","Distribution of Mean Arrival Lo Gain Times Pixel ",
     96                            fTimeNbins,fTimeFirst,fTimeLast);
     97
     98    fHTimeHiGain->SetXTitle("Mean Arrival Times [Hi Gain FADC slice nr]");
     99    fHTimeLoGain->SetXTitle("Mean Arrival Times [Lo Gain FADC slice nr]");
     100
     101    fHTimeHiGain->SetYTitle("Nr. of events");
     102    fHTimeLoGain->SetYTitle("Nr. of events");
     103
     104    // We define a reasonable number and later enlarge it if necessary
     105    fHChargevsNHiGain = new TH1I("HChargevsNHiGain","Sum of Hi Gain Charges vs. Event Number Pixel ",
     106                                 fChargevsNbins,-0.5,(Axis_t)fChargevsNbins - 0.5);
     107    fHChargevsNLoGain = new TH1I("HChargevsNLoGain","Sum of Lo Gain Charges vs. Event Number Pixel ",
     108                                 fChargevsNbins,-0.5,(Axis_t)fChargevsNbins - 0.5);
     109
     110    fHChargevsNHiGain->SetXTitle("Event Nr.");
     111    fHChargevsNLoGain->SetXTitle("Event Nr.");
     112
     113    fHChargevsNHiGain->SetYTitle("Sum of Hi Gain FADC slices");
     114    fHChargevsNLoGain->SetYTitle("Sum of Lo Gain FADC slices");
     115
     116    fHChargeHiGain->SetDirectory(NULL);
    109117    fHChargeLoGain->SetDirectory(NULL);
    110 
    111     Axis_t tfirst = -0.5;
    112     Axis_t tlast  = 15.5;
    113     Int_t  ntbins = 32;
    114 
    115     fHTimeHiGain = new TH1F("HTimeHiGain","Distribution of Mean Arrival Hi Gain Times Pixel ",
    116                             ntbins,tfirst,tlast);
    117     fHTimeHiGain->SetXTitle("Mean Arrival Times [Hi Gain FADC slice nr]");
    118     fHTimeHiGain->SetYTitle("Nr. of events");
    119118    fHTimeHiGain->SetDirectory(NULL);
    120 
    121     fHTimeLoGain = new TH1F("HTimeLoGain","Distribution of Mean Arrival Lo Gain Times Pixel ",
    122                             ntbins,tfirst,tlast);
    123     fHTimeLoGain->SetXTitle("Mean Arrival Times [Lo Gain FADC slice nr]");
    124     fHTimeLoGain->SetYTitle("Nr. of events");
    125119    fHTimeLoGain->SetDirectory(NULL);
    126 
    127     // We define a reasonable number and later enlarge it if necessary
    128     Int_t  nqbins = 20000;
    129     Axis_t nfirst = -0.5;
    130     Axis_t nlast  = (Axis_t)nqbins - 0.5;
    131 
    132     fHChargevsNHiGain = new TH1I("HChargevsNHiGain","Sum of Hi Gain Charges vs. Event Number Pixel ",
    133                                  nqbins,nfirst,nlast);
    134     fHChargevsNHiGain->SetXTitle("Event Nr.");
    135     fHChargevsNHiGain->SetYTitle("Sum of Hi Gain FADC slices");
    136 
    137120    fHChargevsNHiGain->SetDirectory(NULL);
    138 
    139     fHChargevsNLoGain = new TH1I("HChargevsNLoGain","Sum of Lo Gain Charges vs. Event Number Pixel ",
    140                                  nqbins,nfirst,nlast);
    141     fHChargevsNLoGain->SetXTitle("Event Nr.");
    142     fHChargevsNLoGain->SetYTitle("Sum of Lo Gain FADC slices");
    143 
    144121    fHChargevsNLoGain->SetDirectory(NULL);
    145122
    146123    fHiGains = new TArrayF();
    147124    fLoGains = new TArrayF();
     125
     126    Clear();
    148127
    149128}
     
    171150  if (fHivsLoGain)
    172151    delete fHivsLoGain;
    173 
    174 }
     152}
     153
     154
     155void MHCalibrationPixel::Clear(Option_t *o)
     156{
     157 
     158  fTotalEntries            = 0;
     159
     160  fChargeFirstHiGain       = -100.5;
     161  fChargeLastHiGain        = 1999.5;
     162  fChargeFirstLoGain       = -100.5;
     163  fChargeLastLoGain        = 9999.5;
     164
     165  fChargeChisquare         = -1.;
     166  fChargeProb              = -1.;
     167  fChargeNdf               = -1;
     168  fTimeChisquare           = -1.;
     169  fTimeProb                = -1.;
     170  fTimeNdf                 = -1;
     171  fTimeMean                = -1.;
     172  fTimeSigma               = -1.;
     173
     174  fTimeLowerFitRangeHiGain = 0;
     175  fTimeUpperFitRangeHiGain = 0;
     176  fTimeLowerFitRangeLoGain = 0;
     177  fTimeUpperFitRangeLoGain = 0;
     178
     179  fOffset = 0.;
     180  fSlope  = 0;
     181
     182  if (fChargeGausFit)
     183    delete fChargeGausFit;
     184  if (fTimeGausFit)
     185    delete fTimeGausFit;
     186  if (fFitLegend)
     187    delete fFitLegend;
     188  if (fHivsLoGain)
     189    delete fHivsLoGain;
     190  if (fHPSD)
     191    delete fHPSD;
     192
     193  return;
     194}
     195
     196
     197void MHCalibrationPixel::Reset()
     198{
     199 
     200  Clear();
     201 
     202  fHChargeHiGain->Reset();
     203  fHChargeLoGain->Reset();
     204  fHTimeHiGain->Reset();
     205  fHTimeLoGain->Reset();
     206  fHChargevsNHiGain->Reset();
     207  fHChargevsNLoGain->Reset();
     208
     209  fHChargeHiGain->SetName("HChargeHiGain");
     210  fHChargeLoGain->SetName("HChargeLoGain");
     211  fHTimeHiGain->SetName("HTimeHiGain");
     212  fHTimeLoGain->SetName("HTimeLoGain");
     213  fHChargevsNHiGain->SetName("HChargevsNHiGain");
     214  fHChargevsNLoGain->SetName("HChargevsNLoGain");
     215
     216  fHiGains->Reset();
     217  fLoGains->Reset();
     218
     219}
     220
     221
    175222
    176223Bool_t MHCalibrationPixel::IsEmpty() const
     
    295342
    296343  return kTRUE;
    297 }
    298 
    299 
    300 void MHCalibrationPixel::Reset()
    301 {
    302  
    303   for (Int_t i = fHChargeHiGain->FindBin(fChargeFirstHiGain);
    304        i <= fHChargeHiGain->FindBin(fChargeLastHiGain); i++)
    305     fHChargeHiGain->SetBinContent(i, 1.e-20);
    306 
    307   for (Int_t i = 0; i < 16; i++)
    308     fHTimeHiGain->SetBinContent(i, 1.e-20);
    309 
    310   fChargeFirstHiGain    = -100.5;
    311   fChargeLastHiGain     = 1999.5;
    312 
    313   fHChargeHiGain->GetXaxis()->UnZoom();
    314 
    315  for (Int_t i = fHChargeLoGain->FindBin(fChargeFirstLoGain);
    316        i <= fHChargeLoGain->FindBin(fChargeLastLoGain); i++)
    317     fHChargeLoGain->SetBinContent(i, 1.e-20);
    318 
    319   for (Int_t i = 0; i < 16; i++)
    320       fHTimeLoGain->SetBinContent(i, 1.e-20);
    321  
    322   fChargeFirstLoGain    = -100.5;
    323   fChargeLastLoGain     = 9999.5;
    324 
    325   fHChargeLoGain->GetXaxis()->UnZoom();
    326 
    327   return;
    328344}
    329345
     
    866882  fChargeLastHiGain  = fHChargeHiGain->GetBinLowEdge(fHChargeHiGain->GetXaxis()->GetLast())
    867883                      +fHChargeHiGain->GetBinWidth(0);
    868   fChargeNbinsHiGain = nbins;
    869884
    870885  CutEdges(fHChargeLoGain,nbins);
     
    873888  fChargeLastLoGain  = fHChargeLoGain->GetBinLowEdge(fHChargeLoGain->GetXaxis()->GetLast())
    874889                      +fHChargeLoGain->GetBinWidth(0);
    875   fChargeNbinsLoGain = nbins;
    876890
    877891  CutEdges(fHChargevsNHiGain,0);
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationPixel.h

    r2931 r2932  
    44#ifndef MARS_MH
    55#include "MH.h"
     6#endif
     7
     8#ifndef MARS_MFFT
     9#include "MFFT.h"
    610#endif
    711
     
    1216class TProfile;
    1317class TPaveText;
     18class MFFT;
    1419
    1520class MHCalibrationPixel : public MH
     
    2328  TArrayF *fLoGains;             //->
    2429
     30  const Int_t   fChargeNbinsHiGain;
     31  const Int_t   fChargeNbinsLoGain;
     32  const Int_t   fTimeNbins;
     33  const Int_t   fChargevsNbins;
     34
     35  const Axis_t  fTimeFirst;
     36  const Axis_t  fTimeLast;
     37 
     38  TProfile* fHivsLoGain;
     39
     40  Double_t fOffset;
     41  Double_t fSlope;
     42 
    2543protected:
    26 
    27   Int_t fTotalEntries;           // Number of entries
    2844
    2945  TH1F* fHChargeHiGain;          // Summed FADC slices High Gain
     
    3551  TH1I* fHChargevsNLoGain;       // Summed Charge vs. Event Nr.
    3652
     53  TH1F* fHPSD;                   // Power spectrum density of fHBlindPixelChargevsN
     54 
    3755  TF1* fChargeGausFit;
    3856  TF1* fTimeGausFit;
    3957 
    40   TProfile* fHivsLoGain;
    41 
    4258  TPaveText *fFitLegend; 
    4359 
     60  Int_t fTotalEntries;           // Number of entries
     61
    4462  Axis_t  fChargeFirstHiGain;
    4563  Axis_t  fChargeLastHiGain;
    46   Int_t   fChargeNbinsHiGain;
    47 
    4864  Axis_t  fChargeFirstLoGain;
    4965  Axis_t  fChargeLastLoGain;
    50   Int_t   fChargeNbinsLoGain;
    5166
    5267  Double_t fChargeChisquare;
     
    7590  enum   { kUseLoGain, kFitOK };
    7691 
    77   Double_t fOffset;
    78   Double_t fSlope;
    79  
    8092  virtual void DrawLegend();
    8193 
     
    8496  MHCalibrationPixel(const char *name=NULL, const char *title=NULL);
    8597  ~MHCalibrationPixel();
     98
     99  void Clear(Option_t *o="");
     100  void Reset(); 
    86101
    87102  void ChangeHistId(Int_t i);
     
    97112
    98113  // Getters
    99   const TH1F *GetHCharge()                 { return fHChargeHiGain;    }
    100114  const TH1F *GetHCharge() const           { return fHChargeHiGain;    }
    101115
     
    167181  // Others
    168182  virtual void CutAllEdges();
    169   virtual void Reset();
    170183
    171   ClassDef(MHCalibrationPixel, 1)     // Histograms for each calibrated pixel
     184  ClassDef(MHCalibrationPixel, 0)     // Histograms for each calibrated pixel
    172185};
    173186
Note: See TracChangeset for help on using the changeset viewer.