Ignore:
Timestamp:
02/28/04 04:19:05 (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/MCalibrationChargeCam.cc

    r3350 r3352  
    377377  *fLog << all << id << " Excluded pixels " << endl;
    378378  *fLog << endl;
    379   *fLog << all << "Average Inner Pix:         "
    380                 << ":  Ped.  Rms: "            << fAverageInnerPix->GetPedRms()        << " +- " << fAverageInnerPix->GetPedRmsErr()
    381                 << "   Mean signal: "          << fAverageInnerPix->GetMeanCharge()    << " +- " << fAverageInnerPix->GetSigmaCharge()
     379  *fLog << all << "Average Inner Pix:"
     380                << "   Ped.  Rms: "            << fAverageInnerPix->GetPedRms()        << " +- " << fAverageInnerPix->GetPedRmsErr()
     381                << "   Mean signal: "          << fAverageInnerPix->GetMeanCharge()    << " +- " << fAverageInnerPix->GetMeanChargeErr()
     382                << "   Sigma signal: "         << fAverageInnerPix->GetSigmaCharge()    << " +- "<< fAverageInnerPix->GetSigmaChargeErr()
    382383                << "   Reduced Sigma: "        << fAverageInnerPix->GetRSigmaCharge()
    383384                << "   Nr Phe's: "             << fAverageInnerPix->GetPheFFactorMethod()
    384385                << endl;
    385   *fLog << all << "Average Outer Pix:         "
    386                 << ":  Ped.  Rms: "            << fAverageOuterPix->GetPedRms()        << " +- " << fAverageOuterPix->GetPedRmsErr()
    387                 << "   Mean signal: "          << fAverageOuterPix->GetMeanCharge()    << " +- " << fAverageOuterPix->GetSigmaCharge()
     386  *fLog << all << "Average Outer Pix:"
     387                << "   Ped.  Rms: "            << fAverageOuterPix->GetPedRms()        << " +- " << fAverageOuterPix->GetPedRmsErr()
     388                << "   Mean signal: "          << fAverageOuterPix->GetMeanCharge()    << " +- " << fAverageOuterPix->GetMeanChargeErr()
     389                << "   Sigma signal: "         << fAverageOuterPix->GetSigmaCharge()    << " +- "<< fAverageOuterPix->GetSigmaChargeErr()
    388390                << "   Reduced Sigma: "        << fAverageOuterPix->GetRSigmaCharge()
    389391                << "   Nr Phe's: "             << fAverageOuterPix->GetPheFFactorMethod()
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc

    r3283 r3352  
    2727//                                                               
    2828// MHCalibrationChargeCam                                               
     29//
     30// Fills the extracted signals of MExtractedSignalCam into the MH-classes:
     31//
     32// MHCalibrationChargeHiGainPix, MHCalibrationChargeLoGainPix for each pixel
     33// and additionally two classes containing an average of the inner and the outer
     34// pixels, respectively
     35//
     36// By default, subsequently the hi-gain classes are treated unless
     37// more than fNumHiGainSaturationLimit (default: 1%) of the overall FADC
     38// slices show saturation. In that case, the low-gain classes are treated.
     39// If more than fNumLoGainSaturationLimit (default: 1%) of the overall
     40// low-gain FADC slices saturate, the pixel is declared not valid and no further
     41// treatment is pursued.
     42//
     43// The filled histograms are fitted to a Gaussian and the mean and sigma with
     44// its errors and the fit probability are extracted. If none of these values are
     45// NaN's and if the probability is bigger than fProbLimit (default: 0.5%), the fit
     46// is declared valid. Otherwise, histogram means and RMS's are taken directly, but the
     47// flag kFitValid is set to FALSE. Outliers of more than fPickUpLimit (default: 5) sigmas
     48// from the mean are counted as PickUp events.
     49//
     50// Additionally, the slice number with the highest value is stored and a corresponding
     51// histogram is filled. This histogram serves only for a rought cross-check if the
     52// signal does not lie at the edges of chose extraction window.
     53//
     54// The class also fills arrays with the signal vs. event number, creates a fourier
     55// spectrum out of it and investigates if the projected frequencies follow an exponential
     56// distribution. In case that the probability of the exponential fit is less than
     57// fProbLimit, the pixel is declared HiGainOscillating or LoGainOscillating, respectively.
     58//
     59// The results are written into MCalibrationChargeCam.
    2960//                                                               
    30 // Contains a list of MHCalibrationPix
    31 // plus the MHCalibrationBlindPix
    32 // and the  MHCalibrationPINDiode
    3361/////////////////////////////////////////////////////////////////////////////
    3462#include "MHCalibrationChargeCam.h"
    3563
     64#include <TVirtualPad.h>
     65#include <TCanvas.h>
     66#include <TPad.h>
     67
    3668#include "MLog.h"
    3769#include "MLogManip.h"
     
    4173#include "MHCalibrationChargeHiGainPix.h"
    4274#include "MHCalibrationChargeLoGainPix.h"
     75#include "MHCalibrationChargePix.h"
    4376
    4477#include "MCalibrationChargeCam.h"
    4578#include "MCalibrationChargePix.h"
    4679
     80#include "MGeomCam.h"
     81#include "MGeomPix.h"
     82
    4783#include "MRawEvtData.h"
    4884#include "MRawEvtPixelIter.h"
     
    6399{
    64100    fName  = name  ? name  : "MHCalibrationChargeCam";
    65     fTitle = title ? title : "";
     101    fTitle = title ? title : "Class to fill the calibration histograms ";
    66102
    67103    fHiGainArray = new TObjArray;
     
    71107    fLoGainArray->SetOwner();
    72108
     109    fAverageHiGainInnerPix = new MHCalibrationChargeHiGainPix("AverageHiGainInnerPix","Average HiGain FADC sums of inner pixels");
     110    fAverageLoGainInnerPix = new MHCalibrationChargeLoGainPix("AverageLoGainInnerPix","Average LoGain FADC sums of inner pixels");
     111    fAverageHiGainOuterPix = new MHCalibrationChargeHiGainPix("AverageHiGainOuterPix","Average HiGain FADC sums of outer pixels");
     112    fAverageLoGainOuterPix = new MHCalibrationChargeLoGainPix("AverageLoGainOuterPix","Average LoGain FADC sums of outer pixels");
     113
     114/*
     115    fAverageHiGainInnerPix->GetHGausHist()->SetName("HCalibrationChargeAverageInnerHiGainPix");
     116    fAverageHiGainOuterPix->GetHGausHist()->SetName("HCalibrationChargeAverageOuterHiGainPix");
     117    fAverageLoGainInnerPix->GetHGausHist()->SetName("HCalibrationChargeAverageInnerLoGainPix");
     118    fAverageLoGainOuterPix->GetHGausHist()->SetName("HCalibrationChargeAverageOuterLoGainPix");
     119*/
     120    fAverageHiGainInnerPix->GetHGausHist()->SetTitle("Summed FADC slices average Inner pixels HiGain");
     121    fAverageLoGainInnerPix->GetHGausHist()->SetTitle("Summed FADC slices average Inner pixels LoGain");
     122    fAverageHiGainOuterPix->GetHGausHist()->SetTitle("Summed FADC slices average Outer pixels HiGain");
     123    fAverageLoGainOuterPix->GetHGausHist()->SetTitle("Summed FADC slices average Outer pixels LoGain");
     124
     125    fAverageHiGainInnerPix->GetHAbsTime()->SetTitle("Absolute Arrival Time average Inner pixels HiGain");
     126    fAverageLoGainInnerPix->GetHAbsTime()->SetTitle("Absolute Arrival Time average Inner pixels LoGain");
     127    fAverageHiGainOuterPix->GetHAbsTime()->SetTitle("Absolute Arrival Time average Outer pixels HiGain");
     128    fAverageLoGainOuterPix->GetHAbsTime()->SetTitle("Absolute Arrival Time average Outer pixels LoGain");
     129
     130    fAverageHiGainInnerPix->SetChargeLast(1000.);
     131    fAverageLoGainInnerPix->SetChargeLast(100.);
     132    fAverageHiGainOuterPix->SetChargeLast(1000.);
     133    fAverageLoGainOuterPix->SetChargeLast(100.);
     134
     135    fAverageHiGainInnerPix->SetChargeNbins(4000);
     136    fAverageLoGainInnerPix->SetChargeNbins(4000);
     137    fAverageHiGainOuterPix->SetChargeNbins(4000);
     138    fAverageLoGainOuterPix->SetChargeNbins(4000);
     139
    73140    SetNumHiGainSaturationLimit();
    74141    SetNumLoGainSaturationLimit();
     
    86153  delete fHiGainArray;
    87154  delete fLoGainArray;
     155
     156  delete fAverageHiGainInnerPix;
     157  delete fAverageLoGainInnerPix;
     158  delete fAverageHiGainOuterPix;
     159  delete fAverageLoGainOuterPix;
    88160}
    89161
     
    131203TObject *MHCalibrationChargeCam::Clone(const char *) const
    132204{
     205
    133206    const Int_t nhi = fHiGainArray->GetSize();
    134207    const Int_t nlo = fLoGainArray->GetSize();
    135 
    136208    //
    137209    // FIXME, this might be done faster and more elegant, by direct copy.
    138210    //
    139211    MHCalibrationChargeCam *cam = new MHCalibrationChargeCam;
    140 
     212//    MHCalibrationChargeCam cam;
     213    Copy(*cam);
     214
     215/*
    141216    cam->fHiGainArray->Expand(nhi);
    142217    cam->fLoGainArray->Expand(nlo);
     
    152227        (*cam->fLoGainArray)[i] = (*fLoGainArray)[i]->Clone();
    153228    }
     229
     230    delete cam->fAverageHiGainInnerPix;
     231    delete cam->fAverageLoGainInnerPix;
     232    delete cam->fAverageHiGainOuterPix;
     233    delete cam->fAverageLoGainOuterPix;
     234
     235    cam->GetAverageHiGainInnerPix() = *(MHCalibrationChargeHiGainPix*)fAverageHiGainInnerPix->Clone();
     236    cam->GetAverageLoGainInnerPix() = *(MHCalibrationChargeLoGainPix*)fAverageLoGainInnerPix->Clone();
     237
     238    cam->GetAverageHiGainOuterPix() = *(MHCalibrationChargeHiGainPix*)fAverageHiGainOuterPix->Clone();
     239    cam->GetAverageLoGainOuterPix() = *(MHCalibrationChargeLoGainPix*)fAverageLoGainOuterPix->Clone();
     240
     241    fAverageHiGainInnerPix->Copy(cam->GetAverageHiGainInnerPix());
     242    fAverageLoGainInnerPix->Copy(cam->GetAverageLoGainInnerPix());
     243    fAverageHiGainOuterPix->Copy(cam->GetAverageHiGainOuterPix());
     244    fAverageLoGainOuterPix->Copy(cam->GetAverageLoGainOuterPix());
     245*/
     246
    154247    return cam;
    155248}
     
    163256{
    164257 
     258  fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
     259
     260  if (!fRawEvt)
     261  {
     262      gLog << err << dbginf << "MRawEvtData not found... aborting." << endl;
     263      return kFALSE;
     264  }
     265
     266  fGeom = (MGeomCam*)pList->FindObject("MGeomCam");
     267
     268  if (!fGeom)
     269  {
     270      gLog << err << dbginf << "MGeomCam not found... aborting." << endl;
     271      return kFALSE;
     272  }
     273
    165274  fHiGainArray->Delete();
    166275  fLoGainArray->Delete();
     276
     277  fAverageHiGainInnerPix->Init();
     278  fAverageLoGainInnerPix->Init(); 
     279  fAverageHiGainOuterPix->Init();
     280  fAverageLoGainOuterPix->Init(); 
     281
    167282  return kTRUE;
    168 
    169283}
    170284
     
    179293  }
    180294
    181   fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
    182   if (!fRawEvt)
    183   {
    184       gLog << err << dbginf << "MRawEvtData not found... aborting." << endl;
    185       return kFALSE;
    186   }
    187 
    188295  MExtractedSignalCam *signal = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam");
    189296  if (!signal)
     
    192299      return kFALSE;
    193300    }
     301
     302  const Int_t n = signal->GetSize();
     303
     304  if (fHiGainArray->GetEntries()==0)
     305  {
     306      fHiGainArray->Expand(n);
    194307 
    195   const Int_t n = signal->GetSize();
    196 
    197   fHiGainArray->Expand(n);
     308      for (Int_t i=0; i<n; i++)
     309      {
     310          (*fHiGainArray)[i] = new MHCalibrationChargeHiGainPix;
     311          (*this)[i].Init();
     312          (*this)[i].ChangeHistId(i);
     313         
     314      }
     315  }
     316
     317  if (fLoGainArray->GetEntries()==0)
     318  {
     319      fLoGainArray->Expand(n);
     320     
     321      for (Int_t i=0; i<n; i++)
     322      {
     323          (*fLoGainArray)[i] = new MHCalibrationChargeLoGainPix;
     324          (*this)(i).Init();
     325          (*this)(i).ChangeHistId(i);
     326      }
     327  }
     328
     329  return kTRUE;
     330}
    198331 
    199   for (Int_t i=0; i<n; i++)
    200   {
    201       (*fHiGainArray)[i] = new MHCalibrationChargeHiGainPix;
    202       (*this)[i].Init();
    203       (*this)[i].ChangeHistId(i);
    204      
    205   }
    206 
    207   fLoGainArray->Expand(n);
    208  
    209   for (Int_t i=0; i<n; i++)
    210   {
    211       (*fLoGainArray)[i] = new MHCalibrationChargeLoGainPix;
    212       (*this)(i).Init();
    213       (*this)(i).ChangeHistId(i);
    214   }
    215  
    216   return kTRUE;
    217 }
    218 
    219332
    220333// --------------------------------------------------------------------------
     
    229342    }
    230343 
    231   const Int_t n = signal->GetSize();
     344  Int_t n = signal->GetSize();
    232345
    233346  if (fHiGainArray->GetEntries() != n)
     
    242355      return kFALSE;
    243356    }
    244  
     357
     358  //
     359  // First the extracted signal
     360  //
     361  Float_t sumhiinnertot = 0.;
     362  Float_t sumloinnertot = 0.;
     363  Float_t sumhioutertot = 0.;
     364  Float_t sumlooutertot = 0.;
     365  Int_t   sumhiinnersat = 0;
     366  Int_t   sumloinnersat = 0;
     367  Int_t   sumhioutersat = 0;
     368  Int_t   sumlooutersat = 0;
     369  Int_t   numinner = 0;
     370  Int_t   numouter = 0;
     371
    245372  for (int i=0; i<n; i++)
    246373    {
     374
    247375      const MExtractedSignalPix &pix = (*signal)[i];
    248376     
     
    253381      (*this)(i).FillHistAndArray(sumlo);
    254382
    255       (*this)[i].SetSaturated((Int_t)pix.GetNumHiGainSaturated());
    256       (*this)(i).SetSaturated((Int_t)pix.GetNumLoGainSaturated());
    257     }
    258 
     383      const Int_t sathi = (Int_t)pix.GetNumHiGainSaturated();
     384      const Int_t satlo = (Int_t)pix.GetNumLoGainSaturated();
     385
     386      (*this)[i].SetSaturated(sathi);
     387      (*this)(i).SetSaturated(satlo);
     388
     389      if (fGeom->GetPixRatio(i) == 1.)
     390      {
     391          sumhiinnertot += sumhi;
     392          sumloinnertot += sumlo;
     393          sumhiinnersat += sathi;
     394          sumloinnersat += satlo;
     395          numinner++;
     396      }
     397      else
     398      {
     399          sumhioutertot += sumhi;
     400          sumlooutertot += sumlo;
     401          sumhioutersat += sathi;
     402          sumlooutersat += satlo;
     403          numouter++;
     404      }
     405
     406    }
     407
     408  fAverageHiGainInnerPix->FillHistAndArray(sumhiinnertot/numinner);
     409  fAverageLoGainInnerPix->FillHistAndArray(sumloinnertot/numinner);
     410  fAverageHiGainOuterPix->FillHistAndArray(sumhioutertot/numouter);
     411  fAverageLoGainOuterPix->FillHistAndArray(sumlooutertot/numouter);
     412
     413  fAverageHiGainInnerPix->SetSaturated(sumhiinnersat/numinner);
     414  fAverageLoGainInnerPix->SetSaturated(sumloinnersat/numinner);
     415  fAverageHiGainOuterPix->SetSaturated(sumhioutersat/numouter);
     416  fAverageLoGainOuterPix->SetSaturated(sumlooutersat/numouter);
     417
     418  //
     419  // Now the times
     420  //
     421  sumhiinnertot = sumloinnertot = sumhioutertot = sumlooutertot = 0.;
     422  numinner = numouter = 0;
    259423  MRawEvtPixelIter pixel(fRawEvt);
    260  
    261424  while (pixel.Next())
    262425    {
     
    270433      (*this)(pixid).FillAbsTime(timelo);
    271434
    272     }
     435      if (fGeom->GetPixRatio(pixel.GetPixelId()) == 1.)
     436      {
     437          sumhiinnertot += timehi;
     438          sumloinnertot += timelo;
     439      }
     440      else
     441      {
     442          sumhioutertot += timehi;
     443          sumlooutertot += timelo;
     444      }
     445    }
     446
     447  fAverageHiGainInnerPix-> FillAbsTime(sumhiinnertot/numinner);
     448  fAverageLoGainInnerPix-> FillAbsTime(sumloinnertot/numinner);
     449  fAverageHiGainOuterPix-> FillAbsTime(sumhioutertot/numouter);
     450  fAverageLoGainOuterPix-> FillAbsTime(sumlooutertot/numouter);
    273451
    274452  return kTRUE;
     
    291469    {
    292470     
    293         MHCalibrationChargeHiGainPix &pixhi = (*this)[i];
    294         MCalibrationChargePix        &pix   = (*fCam)[i];
    295 
    296         if (pixhi.IsEmpty())
    297             continue;
    298 
    299         if (pixhi.GetSaturated() > fNumHiGainSaturationLimit*pixhi.GetHGausHist()->GetEntries())
    300         {
    301             pix.SetHiGainSaturation();
    302             continue;
    303         }
    304 
    305         //
    306         // 2) Fit the Hi Gain histograms with a Gaussian
    307         //
    308         if (pixhi.FitGaus())
    309             pix.SetHiGainFitted();
    310         //
    311         // 3) In case of failure set the bit kFitted to false and take histogram means and RMS
    312         //
    313         else if (pixhi.RepeatFit())
    314             pix.SetHiGainFitted();
    315         else
    316             pixhi.BypassFit();
    317 
    318         //
    319         // 4) Check for pickup
    320         //
    321         pixhi.CountPickup();
    322 
    323         //
    324         // 5) Check for oscillations
    325         //
    326         pixhi.CreateFourierSpectrum();
    327 
    328         //
    329         // 6) Retrieve the results and store them in this class
    330         //
    331         pix.SetHiGainMeanCharge(     pixhi.GetMean()     );
    332         pix.SetHiGainMeanChargeErr(  pixhi.GetMeanErr()  );
    333         pix.SetHiGainSigmaCharge(    pixhi.GetSigma()    );
    334         pix.SetHiGainSigmaChargeErr( pixhi.GetSigmaErr() );
    335         pix.SetHiGainChargeProb    ( pixhi.GetProb()     );
    336 
    337         pix.SetAbsTimeMean         ( pixhi.GetAbsTimeMean());
    338         pix.SetAbsTimeRms          ( pixhi.GetAbsTimeRms() );
    339 
    340         pix.SetHiGainOscillating   ( !pixhi.IsFourierSpectrumOK() );
    341         pix.SetHiGainNumPickup     (  pixhi.GetPickup()           );
     471        MHCalibrationChargeHiGainPix &histhi = (*this)[i];
     472        MCalibrationChargePix        &pix    = (*fCam)[i];
     473
     474        FinalizeHiGainHists(histhi,pix);
    342475    }
    343476
     
    345478    {
    346479     
    347         MHCalibrationChargeLoGainPix &pixlo = (*this)(i);
    348         MCalibrationChargePix        &pix   = (*fCam)[i];
    349 
    350         if (pixlo.IsEmpty())
    351             continue;
    352 
    353         if (pixlo.GetSaturated() > fNumHiGainSaturationLimit*pixlo.GetHGausHist()->GetEntries())
    354         {
    355             pix.SetLoGainSaturation();
    356             continue;
    357         }
    358         //
    359         // 2) Fit the Lo Gain histograms with a Gaussian
    360         //
    361         if (pixlo.FitGaus())
    362             pix.SetLoGainFitted();
    363         //
    364         // 3) In case of failure set the bit kFitted to false and take histogram means and RMS
    365         //
    366         else if (pixlo.RepeatFit())
    367             pix.SetLoGainFitted();
    368         else
    369             pixlo.BypassFit();
    370 
    371         //
    372         // 4) Check for pickup
    373         //
    374         pixlo.CountPickup();
    375 
    376         //
    377         // 5) Check for oscillations
    378         //
    379         pixlo.CreateFourierSpectrum();
    380 
    381         //
    382         // 6) Retrieve the results and store them in this class
    383         //
    384         pix.SetLoGainMeanCharge(     pixlo.GetMean()     );
    385         pix.SetLoGainMeanChargeErr(  pixlo.GetMeanErr()  );
    386         pix.SetLoGainSigmaCharge(    pixlo.GetSigma()    );
    387         pix.SetLoGainSigmaChargeErr( pixlo.GetSigmaErr() );
    388         pix.SetLoGainChargeProb    ( pixlo.GetProb()     );
    389 
    390         if (pix.IsHiGainSaturation())
    391         {
    392             pix.SetAbsTimeMean     ( pixlo.GetAbsTimeMean());
    393             pix.SetAbsTimeRms      ( pixlo.GetAbsTimeRms() );
    394         }           
    395 
    396         pix.SetLoGainOscillating   ( !pixlo.IsFourierSpectrumOK() );
    397         pix.SetLoGainNumPickup     (  pixlo.GetPickup()           );
    398 
    399     }
     480        MHCalibrationChargeLoGainPix &histlo = (*this)(i);
     481        MCalibrationChargePix        &pix    = (*fCam)[i];
     482
     483        FinalizeLoGainHists(histlo,pix);
     484    }
     485
     486    FinalizeHiGainHists(*fAverageHiGainInnerPix,*fCam->GetAverageInnerPix());
     487    FinalizeLoGainHists(*fAverageLoGainInnerPix,*fCam->GetAverageInnerPix());
     488    FinalizeHiGainHists(*fAverageHiGainOuterPix,*fCam->GetAverageOuterPix());
     489    FinalizeLoGainHists(*fAverageLoGainOuterPix,*fCam->GetAverageOuterPix());
    400490
    401491    return kTRUE;
    402492}
    403493
     494void MHCalibrationChargeCam::FinalizeHiGainHists(MHCalibrationChargeHiGainPix &hist, MCalibrationChargePix &pix)
     495{
     496
     497    if (hist.IsEmpty())
     498        return;
     499   
     500    if (hist.GetSaturated() > fNumHiGainSaturationLimit*hist.GetHGausHist()->GetEntries())
     501    {
     502        pix.SetHiGainSaturation();
     503        return;
     504    }
     505   
     506    //
     507    // 2) Fit the Hi Gain histograms with a Gaussian
     508    //
     509    if (hist.FitGaus())
     510        pix.SetHiGainFitted();
     511    //
     512    // 3) In case of failure set the bit kFitted to false and take histogram means and RMS
     513    //
     514    else if (hist.RepeatFit())
     515        pix.SetHiGainFitted();
     516    else
     517        hist.BypassFit();
     518   
     519    //
     520    // 4) Check for pickup
     521    //
     522    hist.CountPickup();
     523   
     524    //
     525    // 5) Check for oscillations
     526    //
     527    hist.CreateFourierSpectrum();
     528   
     529    //
     530    // 6) Retrieve the results and store them in this class
     531    //
     532    pix.SetHiGainMeanCharge(     hist.GetMean()     );
     533    pix.SetHiGainMeanChargeErr(  hist.GetMeanErr()  );
     534    pix.SetHiGainSigmaCharge(    hist.GetSigma()    );
     535    pix.SetHiGainSigmaChargeErr( hist.GetSigmaErr() );
     536    pix.SetHiGainChargeProb    ( hist.GetProb()     );
     537   
     538    pix.SetAbsTimeMean         ( hist.GetAbsTimeMean());
     539    pix.SetAbsTimeRms          ( hist.GetAbsTimeRms() );
     540   
     541    pix.SetHiGainOscillating   ( !hist.IsFourierSpectrumOK() );
     542    pix.SetHiGainNumPickup     (  hist.GetPickup()           );
     543   
     544}
     545
     546
     547void MHCalibrationChargeCam::FinalizeLoGainHists(MHCalibrationChargeLoGainPix &hist, MCalibrationChargePix &pix)
     548{
     549
     550
     551    if (hist.IsEmpty())
     552            return;
     553
     554    if (hist.GetSaturated() > fNumLoGainSaturationLimit*hist.GetHGausHist()->GetEntries())
     555    {
     556        pix.SetLoGainSaturation();
     557        return;
     558    }
     559    //
     560    // 2) Fit the Lo Gain histograms with a Gaussian
     561    //
     562    if (hist.FitGaus())
     563        pix.SetLoGainFitted();
     564    //
     565    // 3) In case of failure set the bit kFitted to false and take histogram means and RMS
     566    //
     567    else if (hist.RepeatFit())
     568        pix.SetLoGainFitted();
     569    else
     570        hist.BypassFit();
     571   
     572    //
     573    // 4) Check for pickup
     574    //
     575    hist.CountPickup();
     576   
     577    //
     578    // 5) Check for oscillations
     579    //
     580    hist.CreateFourierSpectrum();
     581   
     582    //
     583    // 6) Retrieve the results and store them in this class
     584    //
     585    pix.SetLoGainMeanCharge(     hist.GetMean()     );
     586    pix.SetLoGainMeanChargeErr(  hist.GetMeanErr()  );
     587    pix.SetLoGainSigmaCharge(    hist.GetSigma()    );
     588    pix.SetLoGainSigmaChargeErr( hist.GetSigmaErr() );
     589    pix.SetLoGainChargeProb    ( hist.GetProb()     );
     590   
     591    if (pix.IsHiGainSaturation())
     592    {
     593        pix.SetAbsTimeMean     ( hist.GetAbsTimeMean());
     594        pix.SetAbsTimeRms      ( hist.GetAbsTimeRms() );
     595    }       
     596   
     597    pix.SetLoGainOscillating   ( !hist.IsFourierSpectrumOK() );
     598    pix.SetLoGainNumPickup     (  hist.GetPickup()           );
     599   
     600}   
     601
    404602Bool_t MHCalibrationChargeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
    405603{
     
    413611void MHCalibrationChargeCam::DrawPixelContent(Int_t idx) const
    414612{
    415   (*this)[idx].DrawClone();
    416 }
    417 
     613
     614    if (idx == -1)
     615        fAverageHiGainInnerPix->DrawClone();
     616    if (idx == -2)
     617        fAverageHiGainOuterPix->DrawClone();
     618    if (idx == -3)
     619        fAverageLoGainInnerPix->DrawClone();
     620    if (idx == -4)
     621        fAverageLoGainOuterPix->DrawClone();
     622    (*this)[idx].DrawClone();
     623
     624}
     625
     626
     627void MHCalibrationChargeCam::Draw(const Option_t *opt)
     628{
     629
     630  TVirtualPad *pad = gPad ? gPad : MH::MakeDefCanvas(this); 
     631  pad->SetBorderMode(0);
     632
     633  pad->Divide(2,2);
     634
     635  pad->cd(1);
     636
     637  if (!fAverageHiGainInnerPix->IsEmpty())
     638    gPad->SetLogy();
     639  fAverageHiGainInnerPix->Draw(opt);
     640
     641  pad->cd(2);
     642
     643  if (!fAverageLoGainInnerPix->IsEmpty())
     644    gPad->SetLogy();
     645  fAverageLoGainInnerPix->Draw(opt);
     646
     647  pad->cd(3);
     648
     649  if (!fAverageHiGainOuterPix->IsEmpty())
     650    gPad->SetLogy();
     651  fAverageHiGainOuterPix->Draw(opt);
     652
     653  pad->cd(4);
     654
     655  if (!fAverageLoGainOuterPix->IsEmpty())
     656    gPad->SetLogy();
     657  fAverageLoGainOuterPix->Draw(opt);
     658
     659}
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.h

    r3283 r3352  
    1414
    1515class MRawEvtData;
     16class MGeomCam;
    1617class MCalibrationChargeCam;
     18class MCalibrationChargePix;
    1719class MHCalibrationChargeHiGainPix;
    1820class MHCalibrationChargeLoGainPix;
     
    2123private:
    2224
    23   static const Float_t fgNumHiGainSaturationLimit; // The default number of fNumHiGainSaturationLimit
    24   static const Float_t fgNumLoGainSaturationLimit; // The default number of fNumLoGainSaturationLimit
     25  static const Float_t fgNumHiGainSaturationLimit;   // The default number of fNumHiGainSaturationLimit
     26  static const Float_t fgNumLoGainSaturationLimit;   // The default number of fNumLoGainSaturationLimit
    2527
    2628  Float_t fNumHiGainSaturationLimit;      // The rel. number of saturated higain FADC slices in the whole run upon which the pixel is called saturated
    2729  Float_t fNumLoGainSaturationLimit;      // The rel. number of saturated logain FADC slices in the whole run upon which the pixel is called saturated
    2830 
    29   TObjArray *fHiGainArray;                //-> Array of MHCalibrationChargePix with hists
    30   TObjArray *fLoGainArray;                //-> Array of MHCalibrationChargePix with hists
    31  
    32   MCalibrationChargeCam  *fCam;           //!  Class holding the results
    33   MRawEvtData            *fRawEvt;        //!  Raw event data (time slices)
     31  TObjArray *fHiGainArray;                           //-> Array of MHCalibrationChargePix with hists
     32  TObjArray *fLoGainArray;                           //-> Array of MHCalibrationChargePix with hists
     33  MHCalibrationChargeHiGainPix *fAverageHiGainInnerPix;   //-> One MHCalibrationChargeHiGainPix with the average of all inner pixels
     34  MHCalibrationChargeLoGainPix *fAverageLoGainInnerPix;   //-> One MHCalibrationChargeLoGainPix with the average of all inner pixels
     35  MHCalibrationChargeHiGainPix *fAverageHiGainOuterPix;   //-> One MHCalibrationChargeHiGainPix with the average of all outer pixels
     36  MHCalibrationChargeLoGainPix *fAverageLoGainOuterPix;   //-> One MHCalibrationChargeLoGainPix with the average of all outer pixels
    3437
     38  MCalibrationChargeCam  *fCam;                      //!  Class holding the results
     39  MRawEvtData            *fRawEvt;                   //!  Raw event data (time slices)
     40  MGeomCam               *fGeom;                     //!  MAGIC geometry
     41
     42  void FinalizeHiGainHists(MHCalibrationChargeHiGainPix &hist, MCalibrationChargePix &pix);
     43  void FinalizeLoGainHists(MHCalibrationChargeLoGainPix &hist, MCalibrationChargePix &pix);
    3544
    3645public:
     
    4251  void SetNumLoGainSaturationLimit( const Float_t lim=fgNumLoGainSaturationLimit) { fNumLoGainSaturationLimit = lim; }
    4352
    44   Float_t GetNumHiGainSaturationLimit()                             const  { return fNumHiGainSaturationLimit; }
    45   Float_t GetNumLoGainSaturationLimit()                             const  { return fNumLoGainSaturationLimit; }
     53  Float_t GetNumHiGainSaturationLimit()                       const  { return fNumHiGainSaturationLimit; }
     54  Float_t GetNumLoGainSaturationLimit()                       const  { return fNumLoGainSaturationLimit; }
    4655
    47  
    48   MHCalibrationChargeHiGainPix &operator[](UInt_t i);
    49   const MHCalibrationChargeHiGainPix &operator[](UInt_t i) const;
     56        MHCalibrationChargeHiGainPix &operator[](UInt_t i);
     57  const MHCalibrationChargeHiGainPix &operator[](UInt_t i)    const;
    5058
    51   MHCalibrationChargeLoGainPix &operator()(UInt_t i);
    52   const MHCalibrationChargeLoGainPix &operator()(UInt_t i) const;
     59        MHCalibrationChargeLoGainPix &operator()(UInt_t i);
     60  const MHCalibrationChargeLoGainPix &operator()(UInt_t i)    const;
     61
     62        MHCalibrationChargeHiGainPix  &GetAverageHiGainInnerPix()        { return *fAverageHiGainInnerPix; }
     63  const MHCalibrationChargeHiGainPix  &GetAverageHiGainInnerPix()  const { return *fAverageHiGainInnerPix; }
     64
     65        MHCalibrationChargeLoGainPix  &GetAverageLoGainInnerPix()        { return *fAverageLoGainInnerPix; }
     66  const MHCalibrationChargeLoGainPix  &GetAverageLoGainInnerPix()  const { return *fAverageLoGainInnerPix; }
     67
     68        MHCalibrationChargeHiGainPix  &GetAverageHiGainOuterPix()        { return *fAverageHiGainOuterPix; }
     69  const MHCalibrationChargeHiGainPix  &GetAverageHiGainOuterPix()  const { return *fAverageHiGainOuterPix; }
     70
     71        MHCalibrationChargeLoGainPix  &GetAverageLoGainOuterPix()        { return *fAverageLoGainOuterPix; }
     72  const MHCalibrationChargeLoGainPix  &GetAverageLoGainOuterPix()  const { return *fAverageLoGainOuterPix; }
    5373
    5474  Bool_t SetupFill(const MParList *pList);
     
    5878 
    5979  TObject *Clone(const char *) const;
     80
     81  // Draw
     82  void Draw(const Option_t *opt);
    6083
    6184  Bool_t GetPixelContent ( Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
Note: See TracChangeset for help on using the changeset viewer.