Ignore:
Timestamp:
09/09/04 17:37:26 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
File:
1 edited

Legend:

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