Ignore:
Timestamp:
09/11/04 21:44:12 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhcalib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationCam.cc

    r4946 r4949  
    5050/////////////////////////////////////////////////////////////////////////////
    5151#include "MHCalibrationCam.h"
     52#include "MHCalibrationPix.h"
    5253
    5354#include <TVirtualPad.h>
     
    6061#include "MLogManip.h"
    6162
     63#include "MCalibrationIntensityCam.h"
     64#include "MCalibrationCam.h"
    6265#include "MCalibrationPix.h"
    63 #include "MCalibrationCam.h"
    64 
    65 #include "MHCalibrationPix.h"
    6666
    6767#include "MBadPixelsPix.h"
     
    8080
    8181const Int_t   MHCalibrationCam::fgPulserFrequency = 500;
     82const TString MHCalibrationCam::gsHistName   = "Hist";
     83const TString MHCalibrationCam::gsHistTitle  = "";
     84const TString MHCalibrationCam::gsHistXTitle = "";
     85const TString MHCalibrationCam::gsHistYTitle = "Nr. events";
    8286// --------------------------------------------------------------------------
    8387//
     
    96100//
    97101MHCalibrationCam::MHCalibrationCam(const char *name, const char *title)
    98     :  fColor(MCalibrationCam::kNONE),
     102    :  fHistName(gsHistName),fHistTitle(gsHistTitle),
     103       fHistXTitle(gsHistXTitle),fHistYTitle(gsHistYTitle),
     104       fColor(MCalibrationCam::kNONE),
    99105       fBadPixels(NULL), fIntensCam(NULL), fCam(NULL), fGeom(NULL), fRunHeader(NULL)
    100106{
     
    300306
    301307
    302 const TArrayI &MHCalibrationCam::GetRunNumbers() const
    303 {
    304   return fRunNumbers;
    305 }
    306 
    307308// --------------------------------------------------------------------------
    308309//
     
    427428}
    428429
    429 
    430 Bool_t MHCalibrationCam::SetupHists(const MParList *pList)
    431 {
    432   return kTRUE;
    433 }
    434430
    435431// --------------------------------------------------------------------------
     
    570566}
    571567
    572 
    573 
    574 Bool_t MHCalibrationCam::ReInitHists(MParList *pList)
    575 {
    576   return kTRUE;
    577 }
     568//--------------------------------------------------------------------------------------
     569//
     570// Initializes the High Gain Arrays:
     571//
     572// - Expand fHiGainArrays to npixels
     573// - Expand fAverageHiGainAreas to nareas
     574// - Expand fAverageHiGainSectors to nsectors
     575//
     576// - For every entry in the expanded arrays:
     577//   * call new MHCalibrationPix(fHistName,fHistTitle)
     578//   * SetNbins(fNbins), SetFirst(fFirst), SetLast(fLast)
     579//   * Set fHistName and fHistTitle in the Histogram of MHCalibrationPix
     580//   * Set X-axis and Y-axis titles with fHistXTitle and fHistYTitle
     581//   * Call InitHists
     582//
     583void MHCalibrationCam::InitHiGainArrays(const Int_t npixels, const Int_t nareas, const Int_t nsectors)
     584{
     585
     586  if (fHiGainArray->GetEntries()==0)
     587  {
     588      fHiGainArray->Expand(npixels);
     589      for (Int_t i=0; i<npixels; i++)
     590      {
     591        (*fHiGainArray)[i] = new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainPix"),
     592                                                  Form("%s%s",fHistTitle.Data()," High Gain Pixel"));
     593       
     594        MHCalibrationPix &pix = (*this)[i];         
     595        pix.SetNbins(fNbins);
     596        pix.SetFirst(fFirst);
     597        pix.SetLast (fLast);
     598       
     599        TH1F *h =  pix.GetHGausHist();
     600       
     601        h->SetName (Form("%s%s%s","H",fHistName.Data(),"HiGainPix"));
     602        h->SetTitle(Form("%s%s",fHistTitle.Data()," High Gain Pixel ")); 
     603        h->SetXTitle(fHistXTitle.Data());
     604        h->SetYTitle(fHistYTitle.Data());
     605       
     606        InitHists(pix,(*fBadPixels)[i],i);
     607      }
     608  }
     609
     610  if (fAverageHiGainAreas->GetEntries()==0)
     611  {
     612    fAverageHiGainAreas->Expand(nareas);
     613   
     614    for (Int_t j=0; j<nareas; j++)
     615      {
     616        (*fAverageHiGainAreas)[j] = new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainArea"),
     617                                                         Form("%s%s",fHistTitle.Data()," High Gain Area Idx "));
     618       
     619        MHCalibrationPix &pix = GetAverageHiGainArea(j);
     620       
     621        pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nareas));
     622        pix.SetFirst(fFirst);
     623        pix.SetLast (fLast);
     624       
     625        TH1F *h =  pix.GetHGausHist();
     626
     627        h->SetName (Form("%s%s%s","H",fHistName.Data(),"HiGainArea"));
     628        h->SetXTitle(fHistXTitle.Data());
     629        h->SetYTitle(fHistYTitle.Data());
     630
     631        if (fGeom && fGeom->InheritsFrom("MGeomCamMagic"))
     632          {
     633            h->SetTitle(Form("%s%s%s%s",fHistTitle.Data()," averaged on event-by-event basis ",
     634                             j==0 ? "Inner Pixels " : "Outer Pixels ","High Gain Runs: "));
     635            pix.InitBins();
     636            pix.SetEventFrequency(fPulserFrequency);
     637          }
     638        else
     639          {
     640            h->SetTitle(Form("%s%s",fHistTitle.Data()," averaged on event-by-event basis High Gain Area Idx "));
     641            InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
     642          }
     643      }
     644  }
     645
     646  if (fAverageHiGainSectors->GetEntries()==0)
     647    {
     648      fAverageHiGainSectors->Expand(nsectors);
     649
     650      for (Int_t j=0; j<nsectors; j++)
     651        {
     652          (*fAverageHiGainSectors)[j] = new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainSector"),
     653                                                             Form("%s%s",fHistTitle.Data()," High Gain Sector "));
     654          MHCalibrationPix &pix = GetAverageHiGainSector(j);
     655
     656          pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nsectors));
     657          pix.SetFirst(fFirst);
     658          pix.SetLast (fLast);
     659         
     660          TH1F *h =  pix.GetHGausHist();
     661
     662          h->SetName (Form("%s%s%s","H",fHistName.Data(),"HiGainSector"));
     663          h->SetTitle(Form("%s%s",fHistTitle.Data()," High Gain Sector ")); 
     664          h->SetXTitle(fHistXTitle.Data());
     665          h->SetYTitle(fHistYTitle.Data());
     666
     667          InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
     668      }
     669  }
     670}
     671
     672//--------------------------------------------------------------------------------------
     673//
     674// Return, if IsLoGain() is kFALSE
     675//
     676// Initializes the Low Gain Arrays:
     677//
     678// - Expand fLoGainArrays to npixels
     679// - Expand fAverageLoGainAreas to nareas
     680// - Expand fAverageLoGainSectors to nsectors
     681//
     682// - For every entry in the expanded arrays:
     683//   * call new MHCalibrationPix(fHistName,fHistTitle)
     684//   * SetBins(fNbins), SetFirst(fFirst), SetLast(fLast)
     685//   * Set fHistName and fHistTitle in the Histogram of MHCalibrationPix
     686//   * Set X-axis and Y-axis titles with fHistXTitle and fHistYTitle
     687//   * Call InitHists
     688//
     689void MHCalibrationCam::InitLoGainArrays(const Int_t npixels, const Int_t nareas, const Int_t nsectors)
     690{
     691
     692  if (!IsLoGain())
     693    return;
     694
     695  if (fLoGainArray->GetEntries()==0)
     696  {
     697      fLoGainArray->Expand(npixels);
     698      for (Int_t i=0; i<npixels; i++)
     699      {
     700        (*fLoGainArray)[i] = new MHCalibrationPix(Form("%s%s",fHistName.Data(),"LoGainPix"),
     701                                                  Form("%s%s",fHistTitle.Data()," Low Gain Pixel"));
     702
     703          MHCalibrationPix &pix = (*this)[i];         
     704          pix.SetNbins(fNbins);
     705          pix.SetFirst(fFirst);
     706          pix.SetLast (fLast);
     707
     708          TH1F *h =  pix.GetHGausHist();
     709         
     710          h->SetName (Form("%s%s%s","H",fHistName.Data(),"LoGainPix"));
     711          h->SetTitle(Form("%s%s",fHistTitle.Data()," Low Gain Pixel ")); 
     712          h->SetXTitle(fHistXTitle.Data());
     713          h->SetYTitle(fHistYTitle.Data());
     714
     715          InitHists(pix,(*fBadPixels)[i],i);
     716      }
     717  }
     718
     719  if (fAverageLoGainAreas->GetEntries()==0)
     720  {
     721    fAverageLoGainAreas->Expand(nareas);
     722   
     723    for (Int_t j=0; j<nareas; j++)
     724      {
     725        (*fAverageLoGainAreas)[j] = new MHCalibrationPix(Form("%s%s",fHistName.Data(),"LoGainArea"),
     726                                                         Form("%s%s",fHistTitle.Data()," Low Gain Area Idx "));
     727       
     728        MHCalibrationPix &pix = GetAverageLoGainArea(j);
     729       
     730        pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nareas));
     731        pix.SetFirst(fFirst);
     732        pix.SetLast (fLast);
     733       
     734        TH1F *h =  pix.GetHGausHist();
     735
     736        h->SetName (Form("%s%s%s","H",fHistName.Data(),"LoGainArea"));
     737        h->SetXTitle(fHistXTitle.Data());
     738        h->SetYTitle(fHistYTitle.Data());
     739
     740        if (fGeom && fGeom->InheritsFrom("MGeomCamMagic"))
     741          {
     742            h->SetTitle(Form("%s%s%s%s",fHistTitle.Data()," averaged on event-by-event basis ",
     743                             j==0 ? "Inner Pixels " : "Outer Pixels ","Low Gain Runs: "));
     744            pix.InitBins();
     745            pix.SetEventFrequency(fPulserFrequency);
     746          }
     747        else
     748          {
     749            h->SetTitle(Form("%s%s",fHistTitle.Data()," averaged on event-by-event basis Low Gain Area Idx "));
     750            InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
     751          }
     752      }
     753  }
     754
     755  if (fAverageLoGainSectors->GetEntries()==0)
     756    {
     757      fAverageLoGainSectors->Expand(nsectors);
     758
     759      for (Int_t j=0; j<nsectors; j++)
     760        {
     761          (*fAverageLoGainSectors)[j] = new MHCalibrationPix(Form("%s%s",fHistName.Data(),"LoGainSector"),
     762                                                             Form("%s%s",fHistTitle.Data()," Low Gain Sector "));
     763          MHCalibrationPix &pix = GetAverageLoGainSector(j);
     764
     765          pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nsectors));
     766          pix.SetFirst(fFirst);
     767          pix.SetLast (fLast);
     768         
     769          TH1F *h =  pix.GetHGausHist();
     770
     771          h->SetName (Form("%s%s%s","H",fHistName.Data(),"LoGainSector"));
     772          h->SetTitle(Form("%s%s",fHistTitle.Data()," Low Gain Sector ")); 
     773          h->SetXTitle(fHistXTitle.Data());
     774          h->SetYTitle(fHistYTitle.Data());
     775
     776          InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
     777      }
     778  }
     779}
     780
     781
    578782
    579783//--------------------------------------------------------------------------------
     
    10991303    if (IsEnvDefined(env, prefix, "Oscillations", print))
    11001304    {
    1101         SetDebug(GetEnvValue(env, prefix, "Oscillations", IsOscillations()));
     1305        SetOscillations(GetEnvValue(env, prefix, "Oscillations", IsOscillations()));
    11021306        rc = kTRUE;
    11031307    }
    11041308
     1309    if (IsEnvDefined(env, prefix, "Nbins", print))
     1310    {
     1311        SetNbins(GetEnvValue(env, prefix, "Nbins", fNbins));
     1312        rc = kTRUE;
     1313    }
     1314    if (IsEnvDefined(env, prefix, "First", print))
     1315    {
     1316        SetFirst(GetEnvValue(env, prefix, "First", fFirst));
     1317        rc = kTRUE;
     1318    }
     1319    if (IsEnvDefined(env, prefix, "Last", print))
     1320    {
     1321        SetLast(GetEnvValue(env, prefix, "Last", fLast));
     1322        rc = kTRUE;
     1323    }
    11051324
    11061325    return rc;
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationCam.h

    r4946 r4949  
    4444  static const Int_t fgPulserFrequency;  //! The default for fPulserFrequency (now set to: 500)
    4545
     46  static const TString gsHistName;       //! Default Histogram names
     47  static const TString gsHistTitle;      //! Default Histogram titles
     48  static const TString gsHistXTitle;     //! Default Histogram x-axis titles
     49  static const TString gsHistYTitle;     //! Default Histogram y-axis titles
     50 
    4651protected:
    4752
     
    5055  Axis_t  fLast;                         // Upper histogram limit
    5156
     57  TString fHistName;                     // Histogram names
     58  TString fHistTitle;                    // Histogram titles
     59  TString fHistXTitle;                   // Histogram x-axis titles
     60  TString fHistYTitle;                   // Histogram y-axis titles
     61 
    5262  Float_t fNumHiGainSaturationLimit;     // Rel. amount sat. higain FADC slices until pixel is called saturated
    5363  Float_t fNumLoGainSaturationLimit;     // Rel. amount sat. logain FADC slices until pixel is called saturated
     
    8494  Byte_t     fFlags;                     // Bit-field to hold the flags
    8595 
    86   virtual Bool_t SetupHists(const MParList *pList);
    87   virtual Bool_t ReInitHists(MParList *pList); 
    88   virtual Bool_t FillHists(const MParContainer *par, const Stat_t w=1);
    89   virtual Bool_t FinalizeHists();
     96  virtual Bool_t SetupHists ( const MParList *pList ) { return kTRUE; }
     97  virtual Bool_t ReInitHists(       MParList *pList ) { return kTRUE; }
     98  virtual Bool_t FillHists  ( const MParContainer *par, const Stat_t w=1);
     99  virtual Bool_t FinalizeHists    ();
    90100  virtual void   FinalizeBadPixels();
    91101 
    92102  virtual void   CalcAverageSigma();
    93103 
    94   void DrawAverageSigma(Bool_t sat, Bool_t inner,
    95                         Float_t sigma, Float_t sigmaerr,
    96                         Float_t relsigma, Float_t relsigmaerr) const;
    97  
    98   void FitHiGainArrays(MCalibrationCam &calcam, MBadPixelsCam &badcam,
    99                        MBadPixelsPix::UncalibratedType_t fittyp,
    100                        MBadPixelsPix::UncalibratedType_t osctyp);
    101  
    102   void FitHiGainHists(MHCalibrationPix &hist,
    103                       MCalibrationPix &pix,
    104                       MBadPixelsPix &bad,
    105                       MBadPixelsPix::UncalibratedType_t fittyp,
    106                       MBadPixelsPix::UncalibratedType_t osctyp);
    107  
    108   void FitLoGainArrays(MCalibrationCam &calcam, MBadPixelsCam &badcam,
    109                        MBadPixelsPix::UncalibratedType_t fittyp,
    110                        MBadPixelsPix::UncalibratedType_t osctyp);
    111  
    112   void FitLoGainHists(MHCalibrationPix &hist,
    113                       MCalibrationPix &pix,
    114                       MBadPixelsPix &bad,
    115                       MBadPixelsPix::UncalibratedType_t fittyp,
    116                       MBadPixelsPix::UncalibratedType_t osctyp);
    117 
    118   void InitHists(MHCalibrationPix &hist, MBadPixelsPix &bad, const Int_t i);
     104  virtual void   InitHiGainArrays( const Int_t npix, const Int_t nareas, const Int_t nsectors );
     105  virtual void   InitLoGainArrays( const Int_t npix, const Int_t nareas, const Int_t nsectors );
     106
     107  void DrawAverageSigma( Bool_t sat, Bool_t inner,
     108                         Float_t sigma, Float_t sigmaerr,
     109                         Float_t relsigma, Float_t relsigmaerr) const;
     110 
     111  void FitHiGainArrays ( MCalibrationCam &calcam, MBadPixelsCam &badcam,
     112                         MBadPixelsPix::UncalibratedType_t fittyp,
     113                         MBadPixelsPix::UncalibratedType_t osctyp);
     114 
     115  void FitHiGainHists  ( MHCalibrationPix &hist,
     116                         MCalibrationPix &pix,
     117                         MBadPixelsPix &bad,
     118                         MBadPixelsPix::UncalibratedType_t fittyp,
     119                         MBadPixelsPix::UncalibratedType_t osctyp);
     120 
     121  void FitLoGainArrays ( MCalibrationCam &calcam, MBadPixelsCam &badcam,
     122                         MBadPixelsPix::UncalibratedType_t fittyp,
     123                         MBadPixelsPix::UncalibratedType_t osctyp);
     124 
     125  void FitLoGainHists  ( MHCalibrationPix &hist,
     126                         MCalibrationPix &pix,
     127                         MBadPixelsPix &bad,
     128                         MBadPixelsPix::UncalibratedType_t fittyp,
     129                         MBadPixelsPix::UncalibratedType_t osctyp);
     130
     131  void InitHists       ( MHCalibrationPix &hist, MBadPixelsPix &bad, const Int_t i);
    119132
    120133  Bool_t IsDebug       () const  { return TESTBIT(fFlags,kDebug);        }
     
    122135  Bool_t IsLoGain      () const  { return TESTBIT(fFlags,kLoGain);       }
    123136 
    124   Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
     137  Int_t ReadEnv        ( const TEnv &env, TString prefix, Bool_t print);
    125138
    126139public:
     
    158171  const Float_t        GetNumHiGainSaturationLimit()     const  { return fNumHiGainSaturationLimit; }
    159172  const Float_t        GetNumLoGainSaturationLimit()     const  { return fNumLoGainSaturationLimit; }
    160   const TArrayI       &GetRunNumbers         ()          const;
     173  const TArrayI       &GetRunNumbers         ()          const { return fRunNumbers;            }
    161174  const Int_t          GetSize               ()          const;
    162175
     
    176189                                                                ? SETBIT(fFlags,kOscillations)
    177190                                                                : CLRBIT(fFlags,kOscillations); }
    178 
     191  void SetHistName  ( const char *name )  { fHistName  = name;  }
     192  void SetHistTitle ( const char *name )  { fHistTitle = name;  }
     193  void SetHistXTitle( const char *name )  { fHistXTitle = name; }
     194  void SetHistYTitle( const char *name )  { fHistYTitle = name; }
     195   
    179196  void SetNbins                   ( const Int_t  i )       { fNbins   = i; }
    180197  void SetFirst                   ( const Axis_t f )       { fFirst   = f; }
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationRelTimeCam.cc

    r4946 r4949  
    114114const Float_t MHCalibrationRelTimeCam::fgNumHiGainSaturationLimit = 0.25;
    115115const UInt_t  MHCalibrationRelTimeCam::fgReferencePixel = 1;
    116 const Int_t   MHCalibrationRelTimeCam::fgRelTimeNbins    = 900;
    117 const Axis_t  MHCalibrationRelTimeCam::fgRelTimeFirst    = -5.;
    118 const Axis_t  MHCalibrationRelTimeCam::fgRelTimeLast     =  5.;
     116const Int_t   MHCalibrationRelTimeCam::fgNbins    = 900;
     117const Axis_t  MHCalibrationRelTimeCam::fgFirst    = -5.;
     118const Axis_t  MHCalibrationRelTimeCam::fgLast     =  5.;
     119const TString MHCalibrationRelTimeCam::gsHistName   = "RelTime";
     120const TString MHCalibrationRelTimeCam::gsHistTitle  = "Rel. Arr. Times";
     121const TString MHCalibrationRelTimeCam::gsHistXTitle = "Rel. Arr. Time [FADC slices]";
     122const TString MHCalibrationRelTimeCam::gsHistYTitle = "Nr. events";
    119123// --------------------------------------------------------------------------
    120124//
     
    123127// Sets:
    124128// - fReferencePixel to fgReferencePixel
    125 // - fRelTimeNbins to fgRelTimeNbins
    126 // - fRelTimeFirst to fgRelTimeFirst
    127 // - fRelTimeLast  to fgRelTimeLast
     129// - fNbins to fgNbins
     130// - fFirst to fgFirst
     131// - fLast  to fgLast
     132//
     133// - fHistName   to gsHistName 
     134// - fHistTitle  to gsHistTitle
     135// - fHistXTitle to gsHistXTitle
     136// - fHistYTitle to gsHistYTitle
    128137//
    129138MHCalibrationRelTimeCam::MHCalibrationRelTimeCam(const char *name, const char *title)
     
    137146  SetReferencePixel();
    138147
    139   SetNbins(fgRelTimeNbins);
    140   SetFirst(fgRelTimeFirst);
    141   SetLast (fgRelTimeLast );
     148  SetNbins(fgNbins);
     149  SetFirst(fgFirst);
     150  SetLast (fgLast );
     151
     152  SetHistName  (gsHistName  .Data());
     153  SetHistTitle (gsHistTitle .Data());
     154  SetHistXTitle(gsHistXTitle.Data());
     155  SetHistYTitle(gsHistYTitle.Data());
     156
    142157}
    143158
     
    150165// - MArrivalTimeCam
    151166//
    152 // Initializes, if empty to MGeomCam::GetNumPixels():
    153 // - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray
    154 //
    155 // Initializes, if empty to MGeomCam::GetNumAreas() for:
    156 // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
    157 //
    158 // Initializes, if empty to MGeomCam::GetNumSectors() for:
    159 // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
     167// Calls:
     168// - MHCalibrationCam::InitHiGainArrays()
     169// - MHCalibrationCam::InitLoGainArrays()
    160170//
    161 // Calls MHCalibrationCam::InitHists() for every entry in:
    162 // - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray
    163 // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
    164 // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
    165 //
    166 // Sets Titles and Names for the Histograms
    167 // - MHCalibrationCam::fAverageHiGainAreas
    168 // - MHCalibrationCam::fAverageHiGainSectors
    169 //
     171// Sets:
     172// - fSumareahi   to nareas
     173// - fSumarealo   to nareas
     174// - fSumsectorhi to nareas
     175// - fSumsectorlo to nareas
     176// - fNumareahi   to nareas
     177// - fNumarealo   to nareas
     178// - fNumsectorhi to nareas
     179// - fNumsectorlo to nareas
     180//
    170181Bool_t MHCalibrationRelTimeCam::ReInitHists(MParList *pList)
    171182{
     
    200211  const Int_t nareas   = fGeom->GetNumAreas();
    201212
    202   if (fHiGainArray->GetEntries()==0)
    203   {
    204       fHiGainArray->Expand(npixels);
    205       for (Int_t i=0; i<npixels; i++)
    206       {
    207           (*fHiGainArray)[i] = new MHCalibrationPix("RelTimePixHiGain",
    208                                                     "Rel. Arr. Time High Gain Pixel ");
    209 
    210           MHCalibrationPix &pix = (*this)[i];         
    211           pix.SetNbins(fNbins);
    212           pix.SetFirst(fFirst);
    213           pix.SetLast (fLast);
    214 
    215           TH1F *h =  pix.GetHGausHist();
    216          
    217           h->SetName ("HRelTimeHiGainPix");
    218           h->SetTitle("Rel. Times High Gain Pixel "); 
    219           h->SetXTitle("Rel. Arr. Time [FADC slices]");
    220           h->SetYTitle("Nr. of events");
    221 
    222           InitHists(pix,(*fBadPixels)[i],i);
    223       }
    224   }
    225  
    226   if (fLoGainArray->GetEntries()==0 && IsLoGain() )
    227   {
    228       fLoGainArray->Expand(npixels);
    229       for (Int_t i=0; i<npixels; i++)
    230       {
    231           (*fLoGainArray)[i] = new MHCalibrationPix("RelTimePixLoGain",
    232                                                     "Rel. Arr. Time Low Gain Pixel ");
    233           MHCalibrationPix &pix = (*this)(i);         
    234 
    235           pix.SetNbins(fNbins);
    236           pix.SetFirst(fFirst);
    237           pix.SetLast (fLast);
    238 
    239           TH1F *h =  pix.GetHGausHist();
    240          
    241           h->SetName ("HRelTimeLoGainPix");
    242           h->SetTitle("Rel. Times Low Gain Pixel "); 
    243           h->SetXTitle("Rel. Arr. Time [FADC slices]");
    244           h->SetYTitle("Nr. of events");
    245 
    246           InitHists((*this)(i),(*fBadPixels)[i],i);
    247       }
    248   }
    249 
    250 
    251   if (fAverageHiGainAreas->GetEntries()==0)
    252   {
    253     fAverageHiGainAreas->Expand(nareas);
    254    
    255     for (Int_t j=0; j<nareas; j++)
    256       {
    257         (*fAverageHiGainAreas)[j] =
    258           new MHCalibrationPix("RelTimeAverageHiGainArea",
    259                                       "Average Rel. Arr. Times High Gain Area Idx ");
    260        
    261         MHCalibrationPix &pix = GetAverageHiGainArea(j);
    262        
    263         pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nareas));
    264         pix.SetFirst(fFirst);
    265         pix.SetLast (fLast);
    266        
    267         TH1F *h =  pix.GetHGausHist();
    268 
    269         h->SetName ("HRelTimeHiGainArea");
    270         h->SetXTitle("Rel. Arr. Time [FADC slices]");
    271         h->SetYTitle("Nr. of events");
    272 
    273         if (fGeom->InheritsFrom("MGeomCamMagic"))
    274           {
    275             h->SetTitle(Form("%s%s%s","Rel. Times averaged on event-by-event basis ",
    276                              j==0 ? "Inner Pixels " : "Outer Pixels ","High Gain Runs: "));
    277             pix.InitBins();
    278             pix.SetEventFrequency(fPulserFrequency);
    279           }
    280         else
    281           {
    282             h->SetTitle("Signal averaged on event-by-event basis High Gain Area Idx ");
    283             InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
    284           }
    285       }
    286   }
    287 
    288   if (fAverageLoGainAreas->GetEntries()==0 && IsLoGain() )
    289   {
    290     fAverageLoGainAreas->Expand(nareas);
    291    
    292     for (Int_t j=0; j<nareas; j++)
    293       {
    294         (*fAverageLoGainAreas)[j] =
    295           new MHCalibrationPix("RelTimeAverageAreaLoGain",
    296                                       "Average Rel. Arr. Times Low Gain Area Idx ");
    297 
    298         MHCalibrationPix &pix = GetAverageLoGainArea(j);
    299 
    300         pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nareas));
    301         pix.SetFirst(fFirst);
    302         pix.SetLast (fLast);
    303        
    304         TH1F *h =  pix.GetHGausHist();
    305 
    306         h->SetName ("HRelTimeLoGainArea");
    307         h->SetXTitle("Rel. Arr. Time [FADC slices]");
    308         h->SetYTitle("Nr. of events");
    309 
    310         if (fGeom->InheritsFrom("MGeomCamMagic"))
    311           {
    312             h->SetTitle(Form("%s%s%s","Rel. Times averaged on event-by-event basis ",
    313                              j==0 ? "Inner Pixels " : "Outer Pixels ","Low Gain Runs: "));
    314             pix.InitBins();
    315             pix.SetEventFrequency(fPulserFrequency);
    316           }
    317         else
    318           {
    319             h->SetTitle("Rel. Times averaged on event-by-event basis Low Gain Area Idx ");
    320             InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
    321           }
    322       }
    323   }
    324  
    325   if (fAverageHiGainSectors->GetEntries()==0)
    326     {
    327       fAverageHiGainSectors->Expand(nsectors);
    328 
    329       for (Int_t j=0; j<nsectors; j++)
    330         {
    331           (*fAverageHiGainSectors)[j] =
    332             new MHCalibrationPix("RelTimeAverageSectorHiGain",
    333                                         "Average Rel. Arr. Times High Gain Sector ");
    334          
    335           MHCalibrationPix &pix = GetAverageHiGainSector(j);
    336 
    337           pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nsectors));
    338           pix.SetFirst(fFirst);
    339           pix.SetLast (fLast);
    340          
    341           TH1F *h =  pix.GetHGausHist();
    342 
    343           h->SetName ("HRelTimeHiGainSector");
    344           h->SetTitle("Rel. Times average High Gain Sector "); 
    345           h->SetXTitle("Rel. Arr. Time [FADC slices]");
    346           h->SetYTitle("Nr. of events");
    347 
    348           InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
    349       }
    350   }
    351  
    352   if (fAverageLoGainSectors->GetEntries()==0 && IsLoGain() )
    353     {
    354       fAverageLoGainSectors->Expand(nsectors);
    355      
    356       for (Int_t j=0; j<nsectors; j++)
    357         {
    358           (*fAverageLoGainSectors)[j] =
    359             new MHCalibrationPix("RelTimeAverageSectorLoGain",
    360                                         "Average Rel. Arr. Times Low Gain Sector ");
    361          
    362           MHCalibrationPix &pix = GetAverageLoGainSector(j);
    363 
    364           pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nsectors));
    365           pix.SetFirst(fFirst);
    366           pix.SetLast (fLast);
    367          
    368           TH1F *h =  pix.GetHGausHist();
    369          
    370           h->SetName ("HRelTimeLoGainSector");
    371           h->SetTitle("Rel. Times average Low Gain Sector "); 
    372           h->SetXTitle("Rel. Arr. Time [FADC slices]");
    373           h->SetYTitle("Nr. of events");
    374 
    375           InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
    376         }
    377     }
     213  InitHiGainArrays(npixels,nareas,nsectors);
     214  InitLoGainArrays(npixels,nareas,nsectors);
    378215
    379216  fSumareahi  .Set(nareas);
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationRelTimeCam.h

    r4946 r4949  
    2222  static const Float_t fgNumHiGainSaturationLimit;   //! The default for fNumHiGainSaturationLimit (now at: 0.25)
    2323  static const UInt_t  fgReferencePixel;             //! Default for fReferencePixel   (now set to: 1)
    24   static const Int_t   fgRelTimeNbins;               //! Default number of bins        (now set to: 900   )
    25   static const Axis_t  fgRelTimeFirst;               //! Default lower histogram limit (now set to: -13.5 )
    26   static const Axis_t  fgRelTimeLast;                //! Default upper histogram limit (now set to:  13.5 )
    27 
     24  static const Int_t   fgNbins;                      //! Default number of bins        (now set to: 900   )
     25  static const Axis_t  fgFirst;                      //! Default lower histogram limit (now set to: -13.5 )
     26  static const Axis_t  fgLast;                       //! Default upper histogram limit (now set to:  13.5 )
     27                                                   
     28  static const TString gsHistName;                   //! Default Histogram names
     29  static const TString gsHistTitle;                  //! Default Histogram titles
     30  static const TString gsHistXTitle;                 //! Default Histogram x-axis titles
     31  static const TString gsHistYTitle;                 //! Default Histogram y-axis titles
     32 
    2833  MArrayD fSumareahi  ;               //!
    2934  MArrayD fSumarealo  ;               //!
Note: See TracChangeset for help on using the changeset viewer.