Changeset 4903


Ignore:
Timestamp:
09/09/04 17:37:26 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4902 r4903  
    6262     - derive from MHCalibrationPix
    6363     - new functions Reset()
     64
     65   * mcalib/MHCalibrationChargeCam.cc
     66   * mcalib/MHCalibrationRelTimeCam.cc
     67   * mcalib/MHCalibrationTestCam.cc
     68   * mcalib/MHCalibrationTestTimeCam.cc
     69     - able to recognize an *Intensity*Cam if in MParList
    6470
    6571   * msignal/MExtractor.cc
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.cc

    r4885 r4903  
    260260  }
    261261
    262   MHGausEvents::Clear();
     262  MHCalibrationPix::Clear();
    263263  return;
    264264}
     
    266266// --------------------------------------------------------------------------
    267267//
    268 // Empty function to overload MHGausEvents::Reset()
     268// Empty function to overload MHCalibrationChargePix::Reset()
    269269//
    270270void MHCalibrationChargeBlindPix::Reset()
     
    385385    }
    386386
    387   MHGausEvents::InitBins();
     387  MHCalibrationPix::InitBins();
    388388 
    389389  return kTRUE;
     
    11641164
    11651165  oldpad->cd(2);
    1166   MHGausEvents::Draw("fourierevents");
    1167 }
    1168 
    1169 
    1170 
    1171 
    1172 
    1173 
    1174 
    1175 
    1176 
    1177 
    1178 
     1166  MHCalibrationPix::Draw("fourierevents");
     1167}
     1168
     1169
     1170
     1171
     1172
     1173
     1174
     1175
     1176
     1177
     1178
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc

    r4884 r4903  
    2626// MHCalibrationChargeCam                                               
    2727//
    28 // Fills the extracted signals of MExtractedSignalCam into the MHGausEvents-classes
     28// Fills the extracted signals of MExtractedSignalCam into the MHCalibrationPix-classes
    2929// MHCalibrationChargeHiGainPix and MHCalibrationChargeLoGainPix for every:
    3030//
     
    5454// the fit is declared valid.
    5555// Otherwise, the fit is repeated within ranges of the previous mean
    56 // +- MHGausEvents::fPickupLimit (default: 5) sigma (see MHGausEvents::RepeatFit())
     56// +- MHCalibrationPix::fPickupLimit (default: 5) sigma (see MHCalibrationPix::RepeatFit())
    5757// In case this does not make the fit valid, the histogram means and RMS's are
    58 // taken directly (see MHGausEvents::BypassFit()) and the following flags are set:
     58// taken directly (see MHCalibrationPix::BypassFit()) and the following flags are set:
    5959// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainNotFitted ) or 
    6060// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainNotFitted ) and
    6161// - MBadPixelsPix::SetUnsuitable(   MBadPixelsPix::kUnreliableRun   )
    6262//
    63 // Outliers of more than MHGausEvents::fPickupLimit (default: 5) sigmas
    64 // from the mean are counted as Pickup events (stored in MHGausEvents::fPickup)
     63// Outliers of more than MHCalibrationPix::fPickupLimit (default: 5) sigmas
     64// from the mean are counted as Pickup events (stored in MHCalibrationPix::fPickup)
    6565//
    6666// Unless more than fNumHiGainSaturationLimit (default: 1%) of the overall FADC
     
    120120#include "MHCalibrationChargeLoGainPix.h"
    121121#include "MHCalibrationChargePix.h"
    122 
    123 #include "MCalibrationCam.h"
    124 
     122#include "MHCalibrationPix.h"
     123
     124#include "MCalibrationIntensityCam.h"
    125125#include "MCalibrationChargeCam.h"
    126126#include "MCalibrationChargePix.h"
     
    128128#include "MGeomCam.h"
    129129#include "MGeomPix.h"
    130 
    131 #include "MHGausEvents.h"
    132130
    133131#include "MBadPixelsCam.h"
     
    260258  }
    261259
    262   fCam = (MCalibrationCam*)pList->FindObject(AddSerialNumber("MCalibrationChargeCam"));
    263   if (!fCam)
    264     {
    265       fCam = (MCalibrationCam*)pList->FindCreateObj(AddSerialNumber("MCalibrationChargeCam"));
     260  fIntensCam = (MCalibrationIntensityCam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityChargeCam"));
     261  if (fIntensCam)
     262    *fLog << inf << "Found MCalibrationIntensityChargeCam ... " << endl;
     263  else
     264    {
     265      fCam = (MCalibrationCam*)pList->FindObject(AddSerialNumber("MCalibrationChargeCam"));
    266266      if (!fCam)
    267267        {
    268           gLog << err << "Cannot find nor create MCalibrationChargeCam ... abort." << endl;
    269           return kFALSE;
     268          fCam = (MCalibrationCam*)pList->FindCreateObj(AddSerialNumber("MCalibrationChargeCam"));
     269          if (!fCam)
     270            {
     271              *fLog << err << "Cannot find nor create MCalibrationChargeCam ... abort." << endl;
     272              return kFALSE;
     273            }
     274          fCam->Init(*fGeom);
    270275        }
    271       else
    272         fCam->Init(*fGeom);
    273276    }
    274277
     
    278281  fLastLoGain  = signal->GetLastUsedSliceLoGain();
    279282
     283  /*
    280284  const Float_t numhigain = signal->GetNumUsedHiGainFADCSlices();
    281285  const Float_t numlogain = signal->GetNumUsedLoGainFADCSlices(); 
    282286
    283   if (fCam->GetNumHiGainFADCSlices() == 0.)
    284     fCam->SetNumHiGainFADCSlices ( numhigain );
    285   else if (fCam->GetNumHiGainFADCSlices() != numhigain)
    286     {
    287       *fLog << err << GetDescriptor()
    288             << ": Number of High Gain FADC extraction slices has changed, abort..." << endl;
    289       return kFALSE;
    290     }
    291 
    292   if (fCam->GetNumLoGainFADCSlices() == 0.)
    293     fCam->SetNumLoGainFADCSlices ( numlogain );
    294   else if (fCam->GetNumLoGainFADCSlices() != numlogain)
    295     {
    296       *fLog << err << GetDescriptor()
    297             << ": Number of Low Gain FADC extraction slices has changes, abort..." << endl;
    298       return kFALSE;
    299     }
    300 
     287
     288  if (fCam)
     289    {
     290      if (fCam->GetNumHiGainFADCSlices() == 0.)
     291        fCam->SetNumHiGainFADCSlices ( numhigain );
     292      else if (fCam->GetNumHiGainFADCSlices() != numhigain)
     293        {
     294          *fLog << err << GetDescriptor()
     295                << ": Number of High Gain FADC extraction slices has changed, abort..." << endl;
     296          return kFALSE;
     297        }
     298     
     299      if (fCam->GetNumLoGainFADCSlices() == 0.)
     300        fCam->SetNumLoGainFADCSlices ( numlogain );
     301      else if (fCam->GetNumLoGainFADCSlices() != numlogain)
     302        {
     303          *fLog << err << GetDescriptor()
     304                << ": Number of Low Gain FADC extraction slices has changes, abort..." << endl;
     305          return kFALSE;
     306        }
     307    }
     308  */
     309
     310 
    301311  const Int_t npixels  = fGeom->GetNumPixels();
    302312  const Int_t nsectors = fGeom->GetNumSectors();
     
    311321      for (Int_t i=0; i<npixels; i++)
    312322      {
    313         (*fHiGainArray)[i] = new MHCalibrationChargeHiGainPix;
     323        (*fHiGainArray)[i] = new MHCalibrationChargeHiGainPix("ChargeHiGainPix");
    314324        MHCalibrationChargePix &pix = (MHCalibrationChargePix&)(*this)[i];
    315325        pix.SetAbsTimeNbins(higainsamples);
     
    317327        InitHists((*this)[i],(*fBadPixels)[i],i);
    318328      }
    319       fHiGainOverFlow.Set(npixels);
    320329  }
    321330
     
    326335      for (Int_t i=0; i<npixels; i++)
    327336        {
    328           (*fLoGainArray)[i] = new MHCalibrationChargeLoGainPix;
    329           MHGausEvents &lopix = (*this)(i);
     337          (*fLoGainArray)[i] = new MHCalibrationChargeLoGainPix("ChargeLoGainPix");
     338          MHCalibrationPix &lopix = (*this)(i);
    330339          //
    331340          // Adapt the range for the case, the intense blue is used:
     
    345354          InitHists(lopix,(*fBadPixels)[i],i);
    346355      }
    347       fLoGainOverFlow.Set(npixels); 
    348356  }
    349357
     
    355363      {
    356364        (*fAverageHiGainAreas)[j] =
    357           new MHCalibrationChargeHiGainPix("AverageHiGainArea",
     365          new MHCalibrationChargeHiGainPix("ChargeAverageHiGainArea",
    358366                                           "Average HiGain FADC sums area idx ");
    359367
     
    373381          {
    374382            hist.GetHGausHist()->SetTitle("Signal averaged on event-by-event basis High Gain Area Idx ");
    375             InitHists(hist,fCam->GetAverageBadArea(j),j);
     383            InitHists(hist,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
    376384          }
    377385      }
     
    386394        {
    387395          (*fAverageLoGainAreas)[j] =
    388             new MHCalibrationChargeLoGainPix("AverageLoGainArea",
     396            new MHCalibrationChargeLoGainPix("ChargeAverageLoGainArea",
    389397                                             "Average LoGain FADC sums of pixel area idx ");
    390398
     
    418426        else
    419427          {
    420             hist.GetHGausHist()->SetTitle("Signal averaged on event-by-event basis High Gain Area Idx ");
    421             InitHists(hist,fCam->GetAverageBadArea(j),j);
     428            hist.GetHGausHist()->SetTitle("Signal averaged on event-by-event basis Low Gain Area Idx ");
     429            InitHists(hist,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
    422430          }
    423431        }
     
    431439      {
    432440          (*fAverageHiGainSectors)[j] =
    433             new MHCalibrationChargeHiGainPix("AverageHiGainSector",
    434                                              "Average HiGain FADC sums of pixel sector ");
     441            new MHCalibrationChargeHiGainPix("ChargeAverageHiGainSector",
     442                                             "Averaged HiGain Signals Sector ");
    435443
    436444          MHCalibrationChargePix &hist = (MHCalibrationChargePix&)GetAverageHiGainSector(j);
    437445
    438           hist.GetHGausHist()->SetTitle("Summed FADC slices average HiGain Sector ");
     446          hist.GetHGausHist()->SetTitle("Signals averaged on event-by-event basis HiGain Sector ");
    439447          hist.SetNbins(fAverageNbins);
    440448          hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average HiGain Sector ");
    441449
    442           InitHists(hist,fCam->GetAverageBadSector(j),j);
    443 
     450          InitHists(hist,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
    444451      }
    445452  }
     
    452459      {
    453460          (*fAverageLoGainSectors)[j] =
    454             new MHCalibrationChargeLoGainPix("AverageLoGainSector",
    455                                              "Average LoGain FADC sums of pixel sector ");
     461            new MHCalibrationChargeLoGainPix("ChargeAverageLoGainSector",
     462                                             "Average LoGain Signals Sector ");
    456463
    457464          MHCalibrationChargePix &hist = (MHCalibrationChargePix&)GetAverageLoGainSector(j);
    458465
    459           hist.GetHGausHist()->SetTitle("Summed FADC slices average LoGain Sector ");
     466          hist.GetHGausHist()->SetTitle("Signals averaged on event-by-event basis LoGain Sector ");
    460467          hist.SetNbins(fgAverageNbinsLoGain);
    461468         
     
    477484          hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average LoGain Sector ");
    478485
    479           InitHists(hist,fCam->GetAverageBadSector(j),j);
     486          InitHists(hist,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
    480487      }
    481488  }
     
    565572      const Int_t   sathi = (Int_t)pix.GetNumHiGainSaturated();
    566573
    567       if (!histhi.FillHistAndArray(sumhi))
    568         fHiGainOverFlow[i]++;
    569 
     574      histhi.FillHistAndArray(sumhi);
    570575      histhi.SetSaturated(sathi);
    571576
     
    585590          const Int_t   satlo = (Int_t)pix.GetNumLoGainSaturated();
    586591         
    587           if (!histlo.FillHistAndArray(sumlo))
    588             fLoGainOverFlow[i]++;
    589 
     592          histlo.FillHistAndArray(sumlo);
    590593          histlo.SetSaturated(satlo);
    591594         
     
    706709     
    707710      MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)(*this)[i];
    708       MCalibrationChargePix  &pix    = (MCalibrationChargePix&)(*fCam)[i];
    709       MBadPixelsPix          &bad    = (*fBadPixels)[i];
    710711     
    711712      if (histhi.IsExcluded())
    712713        continue;
    713714     
     715      MCalibrationChargePix  &pix    = fIntensCam
     716        ? (MCalibrationChargePix&)(*fIntensCam)[i]
     717        : (MCalibrationChargePix&)(*fCam)[i];
     718
    714719      if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
    715720        {
     
    719724        }
    720725
    721       if (fHiGainOverFlow[i])
     726      MBadPixelsPix          &bad    = (*fBadPixels)[i];
     727
     728      Stat_t overflow = histhi.GetHGausHist()->GetBinContent(histhi.GetHGausHist()->GetNbinsX()+1);
     729      if (overflow > 0.1)
    722730        {
    723731          *fLog << warn << GetDescriptor()
    724                 << ": Hi-Gain Histogram Overflow occurred " << fHiGainOverFlow[i]
     732                << ": HiGain Histogram Overflow occurred " << overflow
     733                << " times in pixel: " << i << " (without saturation!) " << endl;
     734          bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow );
     735        }
     736
     737      overflow = histhi.GetHGausHist()->GetBinContent(0);
     738      if (overflow > 0.1)
     739        {
     740          *fLog << warn << GetDescriptor()
     741                << ": HiGain Histogram Underflow occurred " << overflow
    725742                << " times in pixel: " << i << " (without saturation!) " << endl;
    726743          bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow );
     
    748765          }
    749766       
    750         if (fLoGainOverFlow[i] > 1)
     767        Stat_t overflow = histlo.GetHGausHist()->GetBinContent(histlo.GetHGausHist()->GetNbinsX()+1);
     768        if (overflow > 0.1)
    751769          {
    752770            *fLog << warn << GetDescriptor()
    753                   << ": Lo-Gain Histogram Overflow occurred " << fLoGainOverFlow[i]
     771                  << ": Lo-Gain Histogram Overflow occurred " << overflow
     772                  << " times in pixel: " << i << " (without saturation!) " << endl;
     773            bad.SetUncalibrated( MBadPixelsPix::kLoGainOverFlow );
     774          }
     775
     776        overflow = histlo.GetHGausHist()->GetBinContent(0);
     777        if (overflow > 0.1)
     778          {
     779            *fLog << warn << GetDescriptor()
     780                  << ": Lo-Gain Histogram Underflow occurred " << overflow
    754781                  << " times in pixel: " << i << " (without saturation!) " << endl;
    755782            bad.SetUncalibrated( MBadPixelsPix::kLoGainOverFlow );
    756783          }
    757784       
    758         MCalibrationChargePix &pix    = (MCalibrationChargePix&)(*fCam)[i];
     785        MCalibrationChargePix &pix = fIntensCam
     786          ? (MCalibrationChargePix&)(*fIntensCam)[i]
     787          : (MCalibrationChargePix&)(*fCam)[i];
    759788       
    760789        if (pix.IsHiGainSaturation())
     
    766795     
    767796      MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)GetAverageHiGainArea(j);     
    768       MCalibrationChargePix  &pix    = (MCalibrationChargePix&)fCam->GetAverageArea(j);
    769       MBadPixelsPix          &bad    = fCam->GetAverageBadArea(j);
    770      
     797      MCalibrationChargePix  &pix    = fIntensCam
     798        ? (MCalibrationChargePix&)fIntensCam->GetAverageArea(j)
     799        : (MCalibrationChargePix&)fCam->GetAverageArea(j);
     800
    771801      if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
    772802        {
     
    775805          continue;
    776806        }
     807
     808      MBadPixelsPix          &bad    = fIntensCam
     809        ? fIntensCam->GetAverageBadArea(j)
     810        : fCam->GetAverageBadArea(j);
    777811
    778812      FinalizeAbsTimes(histhi, pix, bad, fFirstHiGain, fLastHiGain);
     
    784818       
    785819        MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)GetAverageLoGainArea(j);     
    786         MCalibrationChargePix  &pix    = (MCalibrationChargePix&)fCam->GetAverageArea(j);
    787         MBadPixelsPix          &bad    = fCam->GetAverageBadArea(j);     
    788        
     820
    789821        if (histlo.GetSaturated() > fNumLoGainSaturationLimit*histlo.GetHGausHist()->GetEntries())
    790822          {
     
    794826          }
    795827       
     828        MCalibrationChargePix  &pix    = fIntensCam
     829          ? (MCalibrationChargePix&)fIntensCam->GetAverageArea(j)
     830          : (MCalibrationChargePix&)fCam->GetAverageArea(j) ;
     831
    796832        if (pix.IsHiGainSaturation())
    797           FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain);
     833          {
     834            MBadPixelsPix          &bad    = fIntensCam
     835              ? fIntensCam->GetAverageBadArea(j) 
     836              : fCam->GetAverageBadArea(j);     
     837            FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain);
     838          }
     839       
    798840      }
    799841 
     
    802844     
    803845      MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)GetAverageHiGainSector(j);     
    804       MCalibrationChargePix  &pix    = (MCalibrationChargePix&)fCam->GetAverageSector(j);
    805       MBadPixelsPix          &bad    = fCam->GetAverageBadSector(j);     
     846      MCalibrationChargePix  &pix    = fIntensCam
     847        ? (MCalibrationChargePix&)fIntensCam->GetAverageSector(j) 
     848        : (MCalibrationChargePix&)fCam->GetAverageSector(j);
    806849
    807850      if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
     
    811854          continue;
    812855        }
     856
     857      MBadPixelsPix          &bad    = fIntensCam
     858        ? fIntensCam->GetAverageBadSector(j)
     859        : fCam->GetAverageBadSector(j);     
    813860
    814861      FinalizeAbsTimes(histhi, pix, bad, fFirstHiGain, fLastHiGain);
     
    820867       
    821868        MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)GetAverageLoGainSector(j);     
    822         MCalibrationChargePix  &pix    = (MCalibrationChargePix&)fCam->GetAverageSector(j);
    823         MBadPixelsPix          &bad    = fCam->GetAverageBadSector(j);       
     869        MBadPixelsPix          &bad    = fIntensCam
     870          ? fIntensCam->GetAverageBadSector(j)
     871          : fCam->GetAverageBadSector(j);       
    824872       
    825873        if (histlo.GetSaturated() > fNumLoGainSaturationLimit*histlo.GetHGausHist()->GetEntries())
     
    831879          }
    832880       
     881        MCalibrationChargePix  &pix    = fIntensCam
     882          ? (MCalibrationChargePix&)fIntensCam->GetAverageSector(j)
     883          : (MCalibrationChargePix&)fCam->GetAverageSector(j);
     884
    833885        if (pix.IsHiGainSaturation())
    834886          FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain);
     
    838890  // Perform the fitting for the High Gain (done in MHCalibrationCam)
    839891  //
    840   FitHiGainArrays((MCalibrationCam&)(*fCam),(*fBadPixels),
     892  FitHiGainArrays(fIntensCam ? (MCalibrationCam&)(*fIntensCam->GetCam()) : (MCalibrationCam&)(*fCam),
     893                  *fBadPixels,
    841894                  MBadPixelsPix::kHiGainNotFitted,
    842895                  MBadPixelsPix::kHiGainOscillating);
     896 
    843897  //
    844898  // Perform the fitting for the Low Gain (done in MHCalibrationCam)
    845899  //
    846900  if (fLoGain)
    847     FitLoGainArrays((MCalibrationCam&)(*fCam),(*fBadPixels),
     901    FitLoGainArrays(fIntensCam ? (MCalibrationCam&)(*fIntensCam->GetCam()) : (MCalibrationCam&)(*fCam),
     902                    *fBadPixels,
    848903                    MBadPixelsPix::kLoGainNotFitted,
    849904                    MBadPixelsPix::kLoGainOscillating);
    850      
     905
    851906  return kTRUE;
    852907}
     
    908963     
    909964      MBadPixelsPix    &bad    = (*fBadPixels)[i];
    910       MCalibrationPix  &pix    = (*fCam)[i];
     965      MCalibrationPix  &pix    = fIntensCam ? (*fIntensCam)[i] : (*fCam)[i];
    911966
    912967      if (bad.IsUncalibrated( MBadPixelsPix::kHiGainNotFitted ))
     
    941996// --------------------------------------------------------------------------
    942997//
    943 // Calls MHGausEvents::DrawClone() for pixel idx
     998// Calls MHCalibrationPix::DrawClone() for pixel idx
    944999//
    9451000void MHCalibrationChargeCam::DrawPixelContent(Int_t idx) const
     
    10771132  null->SetDirectory(NULL);
    10781133  null->SetBit(kCanDelete);
     1134  null->SetStats(kFALSE);
    10791135  //
    10801136  // set the labels bigger
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePINDiode.cc

    r4885 r4903  
    154154{
    155155
    156   MHGausEvents::InitBins();
     156  MHCalibrationPix::InitBins();
    157157
    158158  fHAbsTime.  SetBins(fAbsTimeNbins,  fAbsTimeFirst,  fAbsTimeLast);
     
    339339//
    340340// "": displays the fHGausHist with fits and fHRmsCharge
    341 // "all": executes additionally MHGausEvents::Draw(), with option "fourierevents"
     341// "all": executes additionally MHCalibrationPix::Draw(), with option "fourierevents"
    342342//
    343343void MHCalibrationChargePINDiode::Draw(const Option_t *opt)
     
    391391
    392392  oldpad->cd(2);
    393   MHGausEvents::Draw("fourierevents");
    394 }
    395 
    396 
    397 
    398 
     393  MHCalibrationPix::Draw("fourierevents");
     394}
     395
     396
     397
     398
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePINDiode.h

    r4882 r4903  
    1010class MExtractedSignalPINDiode;
    1111class MCalibrationChargePINDiode;
    12 
    1312class MHCalibrationChargePINDiode : public MHCalibrationChargePix
    1413{
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationRelTimeCam.cc

    r4885 r4903  
    2727//                                                                       
    2828// Fills the extracted relative arrival times of MArrivalTimeCam into
    29 // the MHGausEvents-classes MHCalibrationRelTimePix for every:
     29// the MHCalibrationPix-classes MHCalibrationRelTimePix for every:
    3030//
    3131// - Pixel, stored in the TObjArray's MHCalibrationCam::fHiGainArray 
     
    5252// the fit is declared valid.
    5353// Otherwise, the fit is repeated within ranges of the previous mean
    54 // +- MHGausEvents::fPickupLimit (default: 5) sigma (see MHGausEvents::RepeatFit())
     54// +- MHCalibrationPix::fPickupLimit (default: 5) sigma (see MHCalibrationPix::RepeatFit())
    5555// In case this does not make the fit valid, the histogram means and RMS's are
    56 // taken directly (see MHGausEvents::BypassFit()) and the following flags are set:
     56// taken directly (see MHCalibrationPix::BypassFit()) and the following flags are set:
    5757// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kRelTimeNotFitted ) and
    5858// - MBadPixelsPix::SetUnsuitable(   MBadPixelsPix::kUnreliableRun    )
    5959//
    60 // Outliers of more than MHGausEvents::fPickupLimit (default: 5) sigmas
    61 // from the mean are counted as Pickup events (stored in MHGausEvents::fPickup)
     60// Outliers of more than MHCalibrationPix::fPickupLimit (default: 5) sigmas
     61// from the mean are counted as Pickup events (stored in MHCalibrationPix::fPickup)
    6262//
    6363// The class also fills arrays with the signal vs. event number, creates a fourier
     
    8888#include "MHCalibrationRelTimePix.h"
    8989
     90#include "MHCalibrationPix.h"
     91
    9092#include "MLog.h"
    9193#include "MLogManip.h"
     
    9395#include "MParList.h"
    9496
     97#include "MCalibrationIntensityRelTimeCam.h"
     98
    9599#include "MCalibrationRelTimeCam.h"
     100#include "MCalibrationRelTimePix.h"
    96101#include "MCalibrationPix.h"
    97102
     
    104109#include "MBadPixelsCam.h"
    105110#include "MBadPixelsPix.h"
    106 
    107 #include "MHGausEvents.h"
    108111
    109112ClassImp(MHCalibrationRelTimeCam);
     
    163166{
    164167
    165  
    166   fCam = (MCalibrationCam*)pList->FindObject("MCalibrationRelTimeCam");
    167   if (!fCam)
    168     {
    169       fCam = (MCalibrationCam*)pList->FindCreateObj(AddSerialNumber("MCalibrationRelTimeCam"));
     168  fIntensCam = (MCalibrationIntensityCam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityRelTimeCam"));
     169  if (fIntensCam)
     170    *fLog << inf << "Found MCalibrationIntensityRelTimeCam ... " << endl;
     171  else
     172    {
     173      fCam = (MCalibrationCam*)pList->FindObject(AddSerialNumber("MCalibrationRelTimeCam"));
    170174      if (!fCam)
    171175        {
    172           gLog << err << "Cannot find nor create MCalibrationRelTimeCam ... abort." << endl;
    173           return kFALSE;
    174         }
    175       else
    176         fCam->Init(*fGeom);
    177     }
    178  
     176          fCam = (MCalibrationCam*)pList->FindCreateObj(AddSerialNumber("MCalibrationRelTimeCam"));
     177          if (!fCam)
     178            {
     179              *fLog << err << "Cannot find nor create MCalibrationRelTimeCam ... abort." << endl;
     180              return kFALSE;
     181            }
     182          fCam->Init(*fGeom);
     183        }
     184    }
    179185
    180186  MArrivalTimeCam *signal = (MArrivalTimeCam*)pList->FindObject("MArrivalTimeCam");
     
    219225      {
    220226        (*fAverageHiGainAreas)[j] =
    221           new MHCalibrationRelTimePix("MHCalibrationRelTimeAverageAreaHiGain",
     227          new MHCalibrationRelTimePix("RelTimeAverageHiGainArea",
    222228                                      "Average Rel. Arr. Times Hi-Gain Area Idx ");
    223229
    224         GetAverageHiGainArea(j).GetHGausHist()->SetTitle("Rel. Arr. Times HiGain Area Idx ");
    225         GetAverageHiGainArea(j).SetNbins(fAverageNbins);
    226 
    227         InitHists(GetAverageHiGainArea(j),fCam->GetAverageBadArea(j),j);
     230        MHCalibrationRelTimePix &hist = (MHCalibrationRelTimePix&)GetAverageHiGainArea(j);
     231
     232        hist.SetNbins(fAverageNbins);
     233        hist.GetHGausHist()->SetTitle("Rel. Arr. Times average HiGain Area Idx ");
     234
     235        if (fGeom->InheritsFrom("MGeomCamMagic"))
     236          {
     237            hist.GetHGausHist()->SetTitle(Form("%s%s%s","Signal averaged on event-by-event basis ",
     238                                               j==0 ? "Inner Pixels " : "Outer Pixels ","High Gain Runs: "));
     239            hist.InitBins();
     240            hist.SetEventFrequency(fPulserFrequency);
     241          }
     242        else
     243          {
     244            hist.GetHGausHist()->SetTitle("Signal averaged on event-by-event basis High Gain Area Idx ");
     245            InitHists(hist,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
     246          }
    228247      }
    229248  }
     
    236255      {
    237256        (*fAverageLoGainAreas)[j] =
    238           new MHCalibrationRelTimePix("MHCalibrationRelTimeAverageAreaLoGain",
     257          new MHCalibrationRelTimePix("RelTimeAverageAreaLoGain",
    239258                                      "Average Rel. Arr. Times Lo-Gain Area Idx ");
    240259
    241         GetAverageLoGainArea(j).GetHGausHist()->SetTitle("Rel. Arr. Times LoGain Area Idx ");
    242         GetAverageLoGainArea(j).SetNbins(fAverageNbins);
    243 
    244         InitHists(GetAverageLoGainArea(j),fCam->GetAverageBadArea(j),j);
     260        MHCalibrationRelTimePix &hist = (MHCalibrationRelTimePix&)GetAverageLoGainArea(j);
     261        hist.SetNbins(fAverageNbins);
     262
     263        if (fGeom->InheritsFrom("MGeomCamMagic"))
     264          {
     265            hist.GetHGausHist()->SetTitle(Form("%s%s%s","Rel. Arr. Times averaged on event-by-event basis ",
     266                                               j==0 ? "Inner Pixels " : "Outer Pixels ","Low Gain Runs: "));
     267            hist.InitBins();
     268            hist.SetEventFrequency(fPulserFrequency);
     269          }
     270        else
     271          {
     272            hist.GetHGausHist()->SetTitle("Rel. Arr. Times averaged on event-by-event basis Low Gain Area Idx ");
     273            InitHists(hist,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
     274          }
    245275      }
    246276  }
     
    253283        {
    254284          (*fAverageHiGainSectors)[j] =
    255             new MHCalibrationRelTimePix("MHCalibrationRelTimeAverageSectorHiGain",
    256                                         "Average Rel. Arr. Times Hi-Gain Sector ");
     285            new MHCalibrationRelTimePix("RelTimeAverageSectorHiGain",
     286                                        "Average HiGain Rel. Arr. Times Sector ");
    257287         
    258           GetAverageHiGainSector(j).GetHGausHist()->SetTitle("Rel. Arr. Times HiGain Sector ");
    259           GetAverageHiGainSector(j).SetNbins(fAverageNbins);
     288          MHCalibrationRelTimePix &hist = (MHCalibrationRelTimePix&)GetAverageHiGainSector(j);
     289
     290          hist.GetHGausHist()->SetTitle("Rel. Arr. Times averaged on event-by-event basis HiGain Sector ");
     291          hist.SetNbins(fAverageNbins);
    260292         
    261           InitHists(GetAverageHiGainSector(j),fCam->GetAverageBadSector(j),j);
     293          InitHists(hist,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
    262294      }
    263295  }
     
    270302        {
    271303          (*fAverageLoGainSectors)[j] =
    272             new MHCalibrationRelTimePix("MHCalibrationRelTimeAverageSectorLoGain",
    273                                         "Average Rel. Arr. Times Lo-Gain Sector ");
     304            new MHCalibrationRelTimePix("RelTimeAverageSectorLoGain",
     305                                        "Average LoGain Rel. Arr. Times Sector ");
    274306         
    275           GetAverageLoGainSector(j).GetHGausHist()->SetTitle("Rel. Arr. Times LoGain Sector ");
    276           GetAverageLoGainSector(j).SetNbins(fAverageNbins);
     307          MHCalibrationRelTimePix &hist = (MHCalibrationRelTimePix&)GetAverageLoGainSector(j);
     308
     309          hist.GetHGausHist()->SetTitle("Rel. Arr. Times averaged on event-by-event basis LoGain Sector ");
     310          hist.SetNbins(fAverageNbins);
    277311         
    278           InitHists(GetAverageLoGainSector(j),fCam->GetAverageBadSector(j),j);
    279          
     312          InitHists(hist,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
    280313        }
    281314    }
     
    338371    {
    339372
    340       MHGausEvents &histhi = (*this)[i];
    341       MHGausEvents &histlo = (*this)(i);
     373      MHCalibrationPix &histhi = (*this)[i];
     374      MHCalibrationPix &histlo = (*this)(i);
    342375
    343376      if (histhi.IsExcluded())
     
    372405  for (Int_t j=0; j<nareas; j++)
    373406    {
    374       MHGausEvents &histhi = GetAverageHiGainArea(j);
     407      MHCalibrationPix &histhi = GetAverageHiGainArea(j);
    375408      histhi.FillHistAndArray(fNumareahi[j] == 0 ? 0. : fSumareahi[j]/fNumareahi[j]);
    376409
    377410      if (fLoGain)
    378411        {
    379           MHGausEvents &histlo = GetAverageLoGainArea(j);
     412          MHCalibrationPix &histlo = GetAverageLoGainArea(j);
    380413          histlo.FillHistAndArray(fNumarealo[j] == 0 ? 0. : fSumarealo[j]/fNumarealo[j]);
    381414        }
     
    384417  for (Int_t j=0; j<nsectors; j++)
    385418    {
    386       MHGausEvents &histhi = GetAverageHiGainSector(j);
     419      MHCalibrationPix &histhi = GetAverageHiGainSector(j);
    387420      histhi.FillHistAndArray(fNumsectorhi[j] == 0 ? 0. : fSumsectorhi[j]/fNumsectorhi[j]);
    388421
    389422      if (fLoGain)
    390423        {
    391           MHGausEvents &histlo = GetAverageLoGainSector(j);
     424          MHCalibrationPix &histlo = GetAverageLoGainSector(j);
    392425          histlo.FillHistAndArray(fNumsectorlo[j] == 0 ? 0. : fSumsectorlo[j]/fNumsectorlo[j]);
    393426        }
     
    415448        continue;
    416449     
     450      MCalibrationRelTimePix  &pix    = fIntensCam
     451        ? (MCalibrationRelTimePix&)(*fIntensCam)[i]
     452        : (MCalibrationRelTimePix&)(*fCam)[i];
     453
    417454      if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
    418455        {
    419           (*fCam)[i].SetHiGainSaturation();
     456          pix.SetHiGainSaturation();
    420457          histhi.SetExcluded();
    421458        }
     
    423460        if (fLoGain)
    424461          (*this)(i).SetExcluded();
    425      
    426     }
    427 
     462
     463      Stat_t overflow = histhi.GetHGausHist()->GetBinContent(histhi.GetHGausHist()->GetNbinsX()+1);
     464      if (overflow > 0.1)
     465        {
     466          *fLog << warn << GetDescriptor()
     467                << ": HiGain Histogram Overflow occurred " << overflow
     468                << " times in pixel: " << i << " (without saturation!) " << endl;
     469          //          bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow );
     470        }
     471
     472      overflow = histhi.GetHGausHist()->GetBinContent(0);
     473      if (overflow > 0.1)
     474        {
     475          *fLog << warn << GetDescriptor()
     476                << ": HiGain Histogram Underflow occurred " << overflow
     477                << " times in pixel: " << i << " (without saturation!) " << endl;
     478          //          bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow );
     479        }
     480    }
    428481
    429482  for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++)
     
    434487      if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
    435488        {
    436           fCam->GetAverageArea(j).SetHiGainSaturation();
     489          MCalibrationRelTimePix  &pix    = fIntensCam
     490            ? (MCalibrationRelTimePix&)fIntensCam->GetAverageArea(j)
     491            : (MCalibrationRelTimePix&)fCam->GetAverageArea(j);
     492          pix.SetHiGainSaturation();
    437493          histhi.SetExcluded();
    438494        }
     
    447503     
    448504      MHCalibrationRelTimePix &histhi = (MHCalibrationRelTimePix&)GetAverageHiGainSector(j);     
     505      MCalibrationRelTimePix  &pix    = fIntensCam
     506        ? (MCalibrationRelTimePix&)fIntensCam->GetAverageSector(j) 
     507        : (MCalibrationRelTimePix&)fCam->GetAverageSector(j);
    449508
    450509      if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
    451510        {
    452           fCam->GetAverageSector(j).SetHiGainSaturation();
     511          pix.SetHiGainSaturation();
    453512          histhi.SetExcluded();
    454513        }
     
    458517    }
    459518
    460   FitHiGainArrays((*fCam),*fBadPixels,
     519  FitHiGainArrays(fIntensCam ? (MCalibrationCam&)(*fIntensCam->GetCam()) : (MCalibrationCam&)(*fCam),
     520                  *fBadPixels,
    461521                  MBadPixelsPix::kRelTimeNotFitted,
    462522                  MBadPixelsPix::kRelTimeOscillating);
    463523 
    464524  if (fLoGain)       
    465     FitLoGainArrays((*fCam),*fBadPixels,
     525    FitLoGainArrays(fIntensCam ? (MCalibrationCam&)(*fIntensCam->GetCam()) : (MCalibrationCam&)(*fCam),
     526                    *fBadPixels,
    466527                    MBadPixelsPix::kRelTimeNotFitted,
    467528                    MBadPixelsPix::kRelTimeOscillating);
     
    557618// --------------------------------------------------------------------------
    558619//
    559 // Calls MHGausEvents::DrawClone() for pixel idx
     620// Calls MHCalibrationPix::DrawClone() for pixel idx
    560621//
    561622void MHCalibrationRelTimeCam::DrawPixelContent(Int_t idx) const
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationTestCam.cc

    r4809 r4903  
    4949// the fit is declared valid.
    5050// Otherwise, the fit is repeated within ranges of the previous mean
    51 // +- MHGausEvents::fPickupLimit (default: 5) sigma (see MHGausEvents::RepeatFit())
     51// +- MHCalibrationPix::fPickupLimit (default: 5) sigma (see MHCalibrationPix::RepeatFit())
    5252// In case this does not make the fit valid, the histogram means and RMS's are
    53 // taken directly (see MHGausEvents::BypassFit()) and the following flags are set:
     53// taken directly (see MHCalibrationPix::BypassFit()) and the following flags are set:
    5454// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainNotFitted ) and
    5555// - MBadPixelsPix::SetUnsuitable(   MBadPixelsPix::kUnreliableRun    )
    5656//
    57 // Outliers of more than MHGausEvents::fPickupLimit (default: 5) sigmas
    58 // from the mean are counted as Pickup events (stored in MHGausEvents::fPickup)
     57// Outliers of more than MHCalibrationPix::fPickupLimit (default: 5) sigmas
     58// from the mean are counted as Pickup events (stored in MHCalibrationPix::fPickup)
    5959//
    6060// The class also fills arrays with the signal vs. event number, creates a fourier
     
    8585#include "MHCalibrationTestPix.h"
    8686
     87#include "MHCalibrationPix.h"
     88
    8789#include "MLog.h"
    8890#include "MLogManip.h"
     
    130132//
    131133// Initializes, if empty to MGeomCam::GetNumAreas() for:
    132 // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
     134// - MHCalibrationCam::fAverageHiGainAreas
    133135//
    134136// Initializes, if empty to MGeomCam::GetNumSectors() for:
    135 // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
     137// - MHCalibrationCam::fAverageHiGainSectors
    136138//
    137139// Calls MHCalibrationCam::InitHists() for every entry in:
     
    174176  }
    175177
    176   if (fLoGainArray->GetEntries()==0)
    177   {
    178       fLoGainArray->Expand(npixels);
    179       for (Int_t i=0; i<npixels; i++)
    180       {
    181           (*fLoGainArray)[i] = new MHCalibrationTestPix("Calibrated Events",
    182                                                 "Test Calibration Pixel");
    183           InitHists((*this)(i),(*fBadPixels)[i],i);
    184       }
    185   }
    186 
    187178
    188179  if (fAverageHiGainAreas->GetEntries()==0)
     
    207198  }
    208199
    209   if (fAverageLoGainAreas->GetEntries()==0)
    210   {
    211     fAverageLoGainAreas->Expand(nareas);
    212    
    213     for (Int_t j=0; j<nareas; j++)
    214       {
    215         (*fAverageLoGainAreas)[j] =
    216           new MHCalibrationTestPix("MHCalibrationTestAverageArea",
    217                            "Average Test Calibrations Area Idx ");
    218 
    219         GetAverageLoGainArea(j).GetHGausHist()->SetTitle("Test Calibrations Area Idx ");
    220         GetAverageLoGainArea(j).SetNbins(fAverageNbins);
    221         GetAverageLoGainArea(j).InitBins();
    222         GetAverageLoGainArea(j).ChangeHistId(j);
    223         GetAverageLoGainArea(j).SetEventFrequency(fPulserFrequency);
    224 
    225       }
    226   }
    227 
    228200
    229201  if (fAverageHiGainSectors->GetEntries()==0)
     
    250222
    251223
    252   if (fAverageLoGainSectors->GetEntries()==0)
    253   {
    254       fAverageLoGainSectors->Expand(nsectors);
    255 
    256       for (Int_t j=0; j<nsectors; j++)
    257       {
    258           (*fAverageLoGainSectors)[j] =
    259             new MHCalibrationTestPix("MHCalibrationTestAverageSector",
    260                              "Average Test Calibrations Sector ");
    261 
    262           GetAverageLoGainSector(j).GetHGausHist()->SetTitle("Test Calibrations Sector ");
    263           GetAverageLoGainSector(j).SetNbins(fAverageNbins);
    264           GetAverageLoGainSector(j).InitBins();
    265           GetAverageLoGainSector(j).ChangeHistId(j);
    266           GetAverageLoGainSector(j).SetEventFrequency(fPulserFrequency);
    267       }
    268   }
    269 
    270 
    271224  fMeanMeanPhotPerArea.Set(nareas);   
    272225  fRmsMeanPhotPerArea .Set(nareas);
    273226  fMeanSigmaPhotPerArea.Set(nareas); 
    274227  fRmsSigmaPhotPerArea.Set(nareas);
     228
     229  fLoGain = kFALSE;
    275230 
    276231  return kTRUE;
     
    287242// - number of sectors
    288243//
    289 // Fills HiGain or LoGain histograms (MHGausEvents::FillHistAndArray()), respectively
    290 // depending on MCerPhotPix::IsLoGainUsed(), with:
    291 // - MCerPhotPix::GetArrivalTime(pixid) - MCerPhotPix::GetArrivalTime(1);
    292 //   (i.e. the time difference between pixel i and pixel 1 (hardware number: 2) )
     244// Fills HiGain histograms (MHGausEvents::FillHistAndArray())
     245// with:
     246// - MCerPhotPix::GetNumPhotons(pixid);
    293247//
    294248Bool_t MHCalibrationTestCam::FillHists(const MParContainer *par, const Stat_t w)
     
    298252  if (!calibration)
    299253    {
    300       gLog << err << "No argument in MHCalibrationRelTimeCam::Fill... abort." << endl;
     254      gLog << err << "No argument in MHCalibrationTestCam::Fill... abort." << endl;
    301255      return kFALSE;
    302256    }
     
    314268    {
    315269
    316       MHGausEvents &histhi = (*this)[i];
     270      MHCalibrationPix &histhi = (*this)[i];
    317271
    318272      const MCerPhotPix *pix = calibration->GetPixById(i);
     
    339293  for (Int_t j=0; j<nareas; j++)
    340294    {
    341       MHGausEvents &histhi = GetAverageHiGainArea(j);
     295      MHCalibrationPix &histhi = GetAverageHiGainArea(j);
    342296      histhi.FillHistAndArray(numareahi[j] == 0 ? 0. : sumareahi[j]/numareahi[j]);
    343297    }
     
    345299  for (Int_t j=0; j<nsectors; j++)
    346300    {
    347       MHGausEvents &histhi = GetAverageHiGainSector(j);
     301      MHCalibrationPix &histhi = GetAverageHiGainSector(j);
    348302      histhi.FillHistAndArray(numsectorhi[j] == 0 ? 0. : sumsectorhi[j]/numsectorhi[j]);
    349303
     
    358312// - MHCalibrationCam::FitHiGainArrays() with flags:
    359313//   MBadPixelsPix::kTestNotFitted and MBadPixelsPix::kTestOscillating
    360 // - MHCalibrationCam::FitLoGainArrays() with flags:
    361 //   MBadPixelsPix::kTestNotFitted and MBadPixelsPix::kTestOscillating
    362314//
    363315Bool_t MHCalibrationTestCam::FinalizeHists()
     
    372324    {
    373325     
    374       MHGausEvents &hist = (*this)[i];
     326      MHCalibrationPix &hist = (*this)[i];
    375327     
    376328      if (hist.IsEmpty())
     
    397349    {
    398350     
    399       MHGausEvents     &hist = GetAverageHiGainArea(j);     
     351      MHCalibrationPix     &hist = GetAverageHiGainArea(j);     
    400352      if (hist.IsEmpty())
    401353        continue;
     
    424376    {
    425377     
    426       MHGausEvents     &hist = GetAverageHiGainSector(j);     
     378      MHCalibrationPix     &hist = GetAverageHiGainSector(j);     
    427379      if (hist.IsEmpty())
    428380        continue;
     
    476428    return kFALSE;
    477429
    478   const MHGausEvents &pix = (*this)[idx];
     430  const MHCalibrationPix &pix = (*this)[idx];
    479431
    480432  if (pix.IsEmpty())
     
    526478// --------------------------------------------------------------------------
    527479//
    528 // Calls MHGausEvents::DrawClone() for pixel idx
     480// Calls MHCalibrationPix::DrawClone() for pixel idx
    529481//
    530482void MHCalibrationTestCam::DrawPixelContent(Int_t idx) const
     
    545497    {
    546498 
    547       MHGausEvents &hist    = GetAverageHiGainArea(j);
     499      MHCalibrationPix &hist    = GetAverageHiGainArea(j);
    548500
    549501      const Float_t numsqr    = TMath::Sqrt((Float_t)fAverageAreaNum[j]);
Note: See TracChangeset for help on using the changeset viewer.