Ignore:
Timestamp:
01/27/04 20:39:14 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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);
Note: See TracChangeset for help on using the changeset viewer.