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

Legend:

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

    r2905 r2931  
    3636#include <TH1.h>
    3737#include <TF1.h>
     38#include <TPaveText.h>
    3839
    3940ClassImp(MHCalibrationPINDiode);
     
    4647//
    4748MHCalibrationPINDiode::MHCalibrationPINDiode(const char *name, const char *title)
    48     : fVarGausFit(NULL)
     49    : fChargeNbins(1000),
     50      fTimeNbins(64),
     51      fChargevsNbins(10000),
     52      fTimeFirst(-0.25),
     53      fTimeLast(31.75)
    4954{
    5055
     
    5358
    5459    // Create a large number of bins, later we will rebin
    55     fChargeFirstHiGain = -1000.;
    56     fChargeLastHiGain  = gkStartPINDiodeBinNr;
    57     fChargeNbinsHiGain = gkStartPINDiodeBinNr;
     60    fChargeFirstHiGain = -100.5;
     61    fChargeLastHiGain  = 1999.5;
    5862
    59     fHPCharge = new TH1I("HPCharge","Distribution of Summed FADC Slices",
    60                          fChargeNbinsHiGain,fChargeFirstHiGain,fChargeLastHiGain);
    61     fHPCharge->SetXTitle("Sum FADC Slices");
    62     fHPCharge->SetYTitle("Nr. of events");
    63     fHPCharge->Sumw2();
    64     fHPCharge->SetDirectory(0);
     63    fHPINDiodeCharge   = new TH1F("HPINDiodeCharge","Distribution of Summed FADC Slices PINDiode",
     64                                  fChargeNbins,fChargeFirstHiGain,fChargeLastHiGain);
     65    fHPINDiodeCharge->SetXTitle("Sum FADC Slices");
     66    fHPINDiodeCharge->SetYTitle("Nr. of events");
     67    fHPINDiodeCharge->Sumw2();
     68    fHPINDiodeCharge->SetDirectory(NULL);
    6569
    66     fErrChargeFirst = 0.;
    67     fErrChargeLast  = gkStartPINDiodeBinNr;
    68     fErrChargeNbins = gkStartPINDiodeBinNr;
     70    fHPINDiodeTime = new TH1F("HPINDiodeTime","Distribution of Mean Arrival Times PINDiode",
     71                              fTimeNbins,fTimeFirst,fTimeLast);
     72    fHPINDiodeTime->SetXTitle("Mean Arrival Times [FADC slice nr]");
     73    fHPINDiodeTime->SetYTitle("Nr. of events");
     74    fHPINDiodeTime->Sumw2();
     75    fHPINDiodeTime->SetDirectory(NULL);
    6976
    70     fHErrCharge = new TH1F("HErrCharge","Distribution of Variances of Summed FADC Slices",fErrChargeNbins,fErrChargeFirst,fErrChargeLast);
    71     fHErrCharge->SetXTitle("Variance Summed FADC Slices");
    72     fHErrCharge->SetYTitle("Nr. of events");
    73     fHErrCharge->Sumw2();
    74     fHErrCharge->SetDirectory(0);
     77    fHPINDiodeChargevsN = new TH1I("HPINDiodeChargevsN","Sum of Hi Gain Charges vs. Event Number Pixel ",
     78                                 fChargevsNbins,-0.5,(Axis_t)fChargevsNbins - 0.5);
     79    fHPINDiodeChargevsN->SetXTitle("Event Nr.");
     80    fHPINDiodeChargevsN->SetYTitle("Sum of Hi Gain FADC slices");
     81    fHPINDiodeChargevsN->SetDirectory(NULL);
    7582
    76     Int_t tfirst = 0;
    77     Int_t tlast  = 31;
    78     Int_t nbins   = 32;
    79 
    80     fHPTime = new TH1F("HPTime","Distribution of Mean Arrival Times",nbins,tfirst,tlast);
    81     fHPTime->SetXTitle("Mean Arrival Times [FADC slice nr]");
    82     fHPTime->SetYTitle("Nr. of events");
    83     fHPTime->Sumw2();
    84     fHPTime->SetDirectory(0);
    85 
     83    Clear();
    8684}
    8785
     
    8987{
    9088
    91   delete fHPCharge;
    92   delete fHErrCharge;
     89  delete fHPINDiodeCharge;
     90  delete fHPINDiodeTime;
     91  delete fHPINDiodeChargevsN;
     92
     93  if (fChargeGausFit)
     94    delete fChargeGausFit;
     95  if (fTimeGausFit)
     96    delete fTimeGausFit;
     97  if (fFitLegend)
     98    delete fFitLegend;
     99}
     100
     101void MHCalibrationPINDiode::Clear(Option_t *o)
     102{
    93103 
    94   if (fVarGausFit)
    95     delete fVarGausFit;
    96  
    97   delete fHPTime;
     104  fTotalEntries            = 0;
     105
     106  fChargeFirstHiGain       = -100.5;
     107  fChargeLastHiGain        = 1999.5;
     108
     109  fChargeChisquare         = -1.;
     110  fChargeProb              = -1.;
     111  fChargeNdf               = -1;
     112  fTimeChisquare           = -1.;
     113  fTimeProb                = -1.;
     114  fTimeNdf                 = -1;
     115  fTimeMean                = -1.;
     116  fTimeSigma               = -1.;
     117
     118  fTimeLowerFitRangeHiGain = 0;
     119  fTimeUpperFitRangeHiGain = 0;
     120  fTimeLowerFitRangeLoGain = 0;
     121  fTimeUpperFitRangeLoGain = 0;
     122
     123  if (fChargeGausFit)
     124    delete fChargeGausFit;
     125  if (fTimeGausFit)
     126    delete fTimeGausFit;
     127  if (fFitLegend)
     128    delete fFitLegend;
     129
     130  return;
    98131
    99132}
    100133
    101 const Double_t MHCalibrationPINDiode::GetTime() const
     134void MHCalibrationPINDiode::Reset()
    102135{
    103     return fVarGausFit->GetParameter(2);
     136
     137  Clear();
     138
     139  fHPINDiodeCharge->Reset();
     140  fHPINDiodeTime->Reset();
     141  fHPINDiodeChargevsN->Reset();
    104142}
    105143
    106 const Double_t MHCalibrationPINDiode::GetErrTime() const
     144
     145Bool_t MHCalibrationPINDiode::FillCharge(Float_t q)
    107146{
    108     return fVarGausFit->GetParameter(3);
     147    return (fHPINDiodeCharge->Fill(q) > -1);
    109148}
     149
     150Bool_t MHCalibrationPINDiode::FillTime(Float_t t)
     151{
     152    return (fHPINDiodeTime->Fill(t)   > -1);
     153}
     154
     155Bool_t MHCalibrationPINDiode::FillChargevsN(Float_t q, Int_t n)
     156{
     157    return (fHPINDiodeChargevsN->Fill(n,q) > -1);
     158}
     159
     160void MHCalibrationPINDiode::CutAllEdges()
     161{
     162
     163  Int_t nbins = 30;
     164
     165  CutEdges(fHPINDiodeCharge,nbins);
     166
     167  fChargeFirstHiGain = fHPINDiodeCharge->GetBinLowEdge(fHPINDiodeCharge->GetXaxis()->GetFirst());
     168  fChargeLastHiGain  = fHPINDiodeCharge->GetBinLowEdge(fHPINDiodeCharge->GetXaxis()->GetLast())
     169                      +fHPINDiodeCharge->GetBinWidth(0);
     170  CutEdges(fHPINDiodeChargevsN,0);
     171
     172}
     173
Note: See TracChangeset for help on using the changeset viewer.