Changeset 3624 for trunk/MagicSoft


Ignore:
Timestamp:
04/01/04 14:52:32 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3622 r3624  
    1919                                                 -*-*- END OF LINE -*-*-
    2020
     21
     22 2004/04/01: Markus Gaug
     23
     24   * mcalib/MHCalibrationChargeCam.[h,cc]
     25   * mcalib/MCalibrationChargeCam.[h,cc]
     26   * mcalib/MCalibrationChargeCalc.cc
     27   * manalysis/MGeomApply.cc
     28     - add average pixels per sector
    2129
    2230 2004/03/31: Markus Gaug
  • trunk/MagicSoft/Mars/macros/calibration.C

    r3606 r3624  
    2727{
    2828
    29   const TString inpath = "/home/rootdata/BlindPixel/";
     29  //  const TString inpath = "/mnt/Data/rootdata/CrabNebula/2004_01_27/";
     30  const TString inpath = "/mnt/Data/rootdata/Miscellaneous/2004_03_03/";
     31  //  const TString inpath = "/home/rootdata/BlindPixel/";
    3032
    3133  MRunIter pruns;
    3234  MRunIter cruns;
    3335
    34   pruns.AddRun(22007,inpath);
    35   cruns.AddRun(22006,inpath);
     36  pruns.AddRun(20132,inpath);
     37  cruns.AddRun(20134,inpath);
     38  //  cruns.AddRun(16774,inpath);
    3639
    3740  gStyle->SetOptStat(1111);
     
    204207  //
    205208  //  histblind.DrawClone("all");
    206   //  histcharge[555].DrawClone("all");
     209  //  histcharge[400].DrawClone("all");
    207210  //  histcharge(5).DrawClone("all");
    208211  //  histtime[5].DrawClone("fourierevents");
    209  
     212  for (Int_t aidx=0;aidx<2;aidx++)
     213    {
     214      histcharge.GetAverageHiGainArea(aidx).DrawClone("all");
     215      histcharge.GetAverageLoGainArea(aidx).DrawClone("all");
     216    }
     217 
     218  for (Int_t sector=1;sector<7;sector++)
     219    {
     220      histcharge.GetAverageHiGainSector(sector).DrawClone("all");
     221      histcharge.GetAverageLoGainSector(sector).DrawClone("all");
     222    }
     223 
     224
    210225  // Create histograms to display
    211226  MHCamera disp1  (geomcam, "Cal;Charge",               "Fitted Mean Charges");
  • trunk/MagicSoft/Mars/manalysis/MGeomApply.cc

    r3622 r3624  
    138138      {
    139139        cal->InitSize(cam->GetNumPixels());
    140         cal->InitAverageSize(cam->GetNumAreas());
     140        cal->InitAverageAreas(cam->GetNumAreas());
     141        cal->InitAverageSectors(cam->GetNumSectors());
    141142      }
    142143   
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc

    r3622 r3624  
    642642    {
    643643
    644       FinalizeAvPedestals(fCam->GetAveragePix(aidx), avinnerped, avinnerprms,avinnernum);
    645       FinalizeCharges(fCam->GetAveragePix(aidx),fCam->GetAverageBadPix(aidx));
     644      FinalizeAvPedestals(fCam->GetAverageArea(aidx), avinnerped, avinnerprms,avinnernum);
     645      FinalizeCharges(fCam->GetAverageArea(aidx),fCam->GetAverageBadArea(aidx));
     646    }
     647 
     648  for (UInt_t sector=0; sector<fGeom->GetNumSectors(); sector++)
     649    {
     650
     651      FinalizeAvPedestals(fCam->GetAverageSector(sector), avinnerped, avinnerprms,avinnernum);
     652      FinalizeCharges(fCam->GetAverageSector(sector),fCam->GetAverageBadSector(sector));
    646653    }
    647654 
     
    709716
    710717  fCam->SetReadyToSave();
     718 
     719  *fLog << err << "Sectors: " << fGeom->GetNumSectors() << endl;
    711720
    712721  *fLog << inf << endl;
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc

    r3622 r3624  
    151151
    152152    fPixels           = new TClonesArray("MCalibrationChargePix",1);
    153     fAveragePixels    = new TClonesArray("MCalibrationChargePix",1);
    154     fAverageBadPixels = new TClonesArray("MBadPixelsPix",1);
     153    fAverageAreas     = new TClonesArray("MCalibrationChargePix",1);
     154    fAverageBadAreas  = new TClonesArray("MBadPixelsPix",1);
     155    fAverageSectors     = new TClonesArray("MCalibrationChargePix",1);
     156    fAverageBadSectors  = new TClonesArray("MBadPixelsPix",1);
    155157
    156158    Clear();
     
    175177  //
    176178  delete fPixels;
    177   delete fAveragePixels;
    178   delete fAverageBadPixels;
     179  delete fAverageAreas;
     180  delete fAverageBadAreas;
     181  delete fAverageSectors;
     182  delete fAverageBadSectors;
     183 
    179184 
    180185  if (fOffsets)
     
    200205}
    201206
    202 void MCalibrationChargeCam::InitAverageSize(const UInt_t i)
    203 {
    204   fAveragePixels->ExpandCreate(i);
    205   fAverageBadPixels->ExpandCreate(i);
     207void MCalibrationChargeCam::InitAverageAreas(const UInt_t i)
     208{
     209  fAverageAreas->ExpandCreate(i);
     210  fAverageBadAreas->ExpandCreate(i);
     211}
     212
     213void MCalibrationChargeCam::InitAverageSectors(const UInt_t i)
     214{
     215  fAverageSectors->ExpandCreate(i);
     216  fAverageBadSectors->ExpandCreate(i);
    206217}
    207218
     
    220231}
    221232
    222 Int_t MCalibrationChargeCam::GetAverageSize() const
    223 {
    224   return fAveragePixels->GetEntriesFast();
     233Int_t MCalibrationChargeCam::GetAverageAreas() const
     234{
     235  return fAverageAreas->GetEntriesFast();
     236}
     237
     238Int_t MCalibrationChargeCam::GetAverageSectors() const
     239{
     240  return fAverageSectors->GetEntriesFast();
    225241}
    226242
     
    248264// Get i-th average pixel (area number)
    249265//
    250 MCalibrationChargePix &MCalibrationChargeCam::GetAveragePix(UInt_t i)
    251 {
    252   return *static_cast<MCalibrationChargePix*>(fAveragePixels->UncheckedAt(i));
     266MCalibrationChargePix &MCalibrationChargeCam::GetAverageArea(UInt_t i)
     267{
     268  return *static_cast<MCalibrationChargePix*>(fAverageAreas->UncheckedAt(i));
    253269}
    254270
     
    257273// Get i-th average pixel (area number)
    258274//
    259 const MCalibrationChargePix &MCalibrationChargeCam::GetAveragePix(UInt_t i) const
    260 {
    261   return *static_cast<MCalibrationChargePix*>(fAveragePixels->UncheckedAt(i));
     275const MCalibrationChargePix &MCalibrationChargeCam::GetAverageArea(UInt_t i) const
     276{
     277  return *static_cast<MCalibrationChargePix*>(fAverageAreas->UncheckedAt(i));
     278}
     279
     280// --------------------------------------------------------------------------
     281//
     282// Get i-th average pixel (sector number)
     283//
     284MCalibrationChargePix &MCalibrationChargeCam::GetAverageSector(UInt_t i)
     285{
     286  return *static_cast<MCalibrationChargePix*>(fAverageSectors->UncheckedAt(i));
     287}
     288
     289// --------------------------------------------------------------------------
     290//
     291// Get i-th average pixel (sector number)
     292//
     293const MCalibrationChargePix &MCalibrationChargeCam::GetAverageSector(UInt_t i) const
     294{
     295  return *static_cast<MCalibrationChargePix*>(fAverageSectors->UncheckedAt(i));
    262296}
    263297
     
    266300// Get i-th average pixel (area number)
    267301//
    268 MBadPixelsPix &MCalibrationChargeCam::GetAverageBadPix(UInt_t i)
    269 {
    270   return *static_cast<MBadPixelsPix*>(fAverageBadPixels->UncheckedAt(i));
     302MBadPixelsPix &MCalibrationChargeCam::GetAverageBadArea(UInt_t i)
     303{
     304  return *static_cast<MBadPixelsPix*>(fAverageBadAreas->UncheckedAt(i));
    271305}
    272306
     
    275309// Get i-th average pixel (area number)
    276310//
    277 const MBadPixelsPix &MCalibrationChargeCam::GetAverageBadPix(UInt_t i) const
    278 {
    279   return *static_cast<MBadPixelsPix*>(fAverageBadPixels->UncheckedAt(i));
     311const MBadPixelsPix &MCalibrationChargeCam::GetAverageBadArea(UInt_t i) const
     312{
     313  return *static_cast<MBadPixelsPix*>(fAverageBadAreas->UncheckedAt(i));
     314}
     315
     316// --------------------------------------------------------------------------
     317//
     318// Get i-th average pixel (sector number)
     319//
     320MBadPixelsPix &MCalibrationChargeCam::GetAverageBadSector(UInt_t i)
     321{
     322  return *static_cast<MBadPixelsPix*>(fAverageBadSectors->UncheckedAt(i));
     323}
     324
     325// --------------------------------------------------------------------------
     326//
     327// Get i-th average pixel (sector number)
     328//
     329const MBadPixelsPix &MCalibrationChargeCam::GetAverageBadSector(UInt_t i) const
     330{
     331  return *static_cast<MBadPixelsPix*>(fAverageBadSectors->UncheckedAt(i));
    280332}
    281333
     
    291343  // another ForEach does not compile, thus have to do the loop ourselves:
    292344  //
    293   for (Int_t i=0;i<GetAverageSize();i++)
    294     {
    295       fAveragePixels[i].Clear();
    296       fAverageBadPixels[i].Clear();
     345  for (Int_t i=0;i<GetAverageAreas();i++)
     346    {
     347      fAverageAreas[i].Clear();
     348      fAverageBadAreas[i].Clear();
     349    }
     350
     351  //
     352  // another ForEach does not compile, thus have to do the loop ourselves:
     353  //
     354  for (Int_t i=0;i<GetAverageSectors();i++)
     355    {
     356      fAverageSectors[i].Clear();
     357      fAverageBadSectors[i].Clear();
    297358    }
    298359 
     
    418479  *fLog << endl;
    419480
    420   TIter Next5(fAveragePixels);
     481  TIter Next5(fAverageAreas);
    421482  while ((pix=(MCalibrationChargePix*)Next5()))
    422483  {
    423     *fLog << all << "Average Pix:"
     484    *fLog << all << "Average Area:"
    424485          << "   Ped.  Rms: "            << pix->GetPedRms()        << " +- " << pix->GetPedRmsErr()
    425486          << "   Mean signal: "          << pix->GetMeanCharge()    << " +- " << pix->GetMeanChargeErr()
     
    429490          << endl;
    430491  }
     492
     493  TIter Next6(fAverageSectors);
     494  while ((pix=(MCalibrationChargePix*)Next5()))
     495  {
     496    *fLog << all << "Average Sector:"
     497          << "   Ped.  Rms: "            << pix->GetPedRms()        << " +- " << pix->GetPedRmsErr()
     498          << "   Mean signal: "          << pix->GetMeanCharge()    << " +- " << pix->GetMeanChargeErr()
     499          << "   Sigma signal: "         << pix->GetSigmaCharge()    << " +- "<< pix->GetSigmaChargeErr()
     500          << "   Reduced Sigma: "        << pix->GetRSigmaCharge()
     501          << "   Nr Phe's: "             << pix->GetPheFFactorMethod()
     502          << endl;
     503  }
     504
    431505}
    432506
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h

    r3623 r3624  
    3333 
    3434  TClonesArray *fPixels;             //-> Array of MCalibrationChargePix, one per pixel
    35   TClonesArray *fAveragePixels;      //-> Array of MCalibrationChargePix, one per pixel area
    36   TClonesArray *fAverageBadPixels;   //-> Array of MBadPixelsPix, one per pixel area
     35  TClonesArray *fAverageAreas;       //-> Array of MCalibrationChargePix, one per pixel area
     36  TClonesArray *fAverageSectors;     //-> Array of MCalibrationChargePix, one per camera sector
     37  TClonesArray *fAverageBadAreas;    //-> Array of MBadPixelsPix, one per pixel area
     38  TClonesArray *fAverageBadSectors;  //-> Array of MBadPixelsPix, one per camera sector
    3739 
    3840  TH1D* fOffsets;                    //!
     
    6264  void Clear(    Option_t *o="" );
    6365  void InitSize( const UInt_t i );
    64   void InitAverageSize( const UInt_t i );
     66  void InitAverageAreas(  const UInt_t i );
     67  void InitAverageSectors( const UInt_t i );
    6568
    6669  // Setters   
     
    7780  // Getters
    7881  Int_t   GetSize()               const;
    79   Int_t   GetAverageSize()        const; 
     82  Int_t   GetAverageAreas()       const;
     83  Int_t   GetAverageSectors()     const; 
    8084
    8185  Bool_t  GetConversionFactorFFactor(    Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma );
     
    101105  const MCalibrationChargePix &operator[](UInt_t i) const;
    102106
    103   MCalibrationChargePix &GetAveragePix(UInt_t i);
    104   const MCalibrationChargePix &GetAveragePix(UInt_t i) const;
     107  MCalibrationChargePix &GetAverageArea(UInt_t i);
     108  const MCalibrationChargePix &GetAverageArea(UInt_t i) const;
    105109
    106   MBadPixelsPix &GetAverageBadPix(UInt_t i);
    107   const MBadPixelsPix &GetAverageBadPix(UInt_t i) const;
     110  MBadPixelsPix &GetAverageBadArea(UInt_t i);
     111  const MBadPixelsPix &GetAverageBadArea(UInt_t i) const;
     112
     113  MCalibrationChargePix &GetAverageSector(UInt_t i);
     114  const MCalibrationChargePix &GetAverageSector(UInt_t i) const;
     115
     116  MBadPixelsPix &GetAverageBadSector(UInt_t i);
     117  const MBadPixelsPix &GetAverageBadSector(UInt_t i) const;
    108118
    109119  // Prints
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc

    r3622 r3624  
    112112    fLoGainArray->SetOwner();
    113113
    114     fAverageHiGainArray = new TObjArray;
    115     fAverageHiGainArray->SetOwner();
    116 
    117     fAverageLoGainArray = new TObjArray;
    118     fAverageLoGainArray->SetOwner();
     114    fAverageHiGainAreas = new TObjArray;
     115    fAverageHiGainAreas->SetOwner();
     116
     117    fAverageLoGainAreas = new TObjArray;
     118    fAverageLoGainAreas->SetOwner();
     119
     120    fAverageHiGainSectors = new TObjArray;
     121    fAverageHiGainSectors->SetOwner();
     122
     123    fAverageLoGainSectors = new TObjArray;
     124    fAverageLoGainSectors->SetOwner();
    119125
    120126    SetNumHiGainSaturationLimit();
     
    133139  delete fLoGainArray;
    134140
    135   delete fAverageHiGainArray;
    136   delete fAverageLoGainArray;
     141  delete fAverageHiGainAreas;
     142  delete fAverageLoGainAreas;
     143
     144  delete fAverageHiGainSectors;
     145  delete fAverageLoGainSectors;
    137146}
    138147
     
    177186// Get i-th pixel (pixel number)
    178187//
    179 MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainPix(UInt_t i)
    180 {
    181   return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainArray->UncheckedAt(i));
    182 }
    183 
    184 // --------------------------------------------------------------------------
    185 //
    186 // Get i-th pixel (pixel number)
    187 //
    188 const MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainPix(UInt_t i) const
    189 {
    190   return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainArray->UncheckedAt(i));
    191 }
    192 
    193 // --------------------------------------------------------------------------
    194 //
    195 // Get i-th pixel (pixel number)
    196 //
    197 MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainPix(UInt_t i)
    198 {
    199   return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainArray->UncheckedAt(i));
    200 }
    201 
    202 // --------------------------------------------------------------------------
    203 //
    204 // Get i-th pixel (pixel number)
    205 //
    206 const MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainPix(UInt_t i) const
    207 {
    208   return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainArray->UncheckedAt(i));
     188MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainArea(UInt_t i)
     189{
     190  return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainAreas->UncheckedAt(i));
     191}
     192
     193// --------------------------------------------------------------------------
     194//
     195// Get i-th pixel (pixel number)
     196//
     197const MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainArea(UInt_t i) const
     198{
     199  return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainAreas->UncheckedAt(i));
     200}
     201
     202// --------------------------------------------------------------------------
     203//
     204// Get i-th pixel (pixel number)
     205//
     206MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainArea(UInt_t i)
     207{
     208  return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainAreas->UncheckedAt(i));
     209}
     210
     211// --------------------------------------------------------------------------
     212//
     213// Get i-th pixel (pixel number)
     214//
     215const MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainArea(UInt_t i) const
     216{
     217  return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainAreas->UncheckedAt(i));
     218}
     219
     220// --------------------------------------------------------------------------
     221//
     222// Get i-th pixel (pixel number)
     223//
     224MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainSector(UInt_t i)
     225{
     226  return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainSectors->UncheckedAt(i));
     227}
     228
     229// --------------------------------------------------------------------------
     230//
     231// Get i-th pixel (pixel number)
     232//
     233const MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainSector(UInt_t i) const
     234{
     235  return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainSectors->UncheckedAt(i));
     236}
     237
     238// --------------------------------------------------------------------------
     239//
     240// Get i-th pixel (pixel number)
     241//
     242MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainSector(UInt_t i)
     243{
     244  return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainSectors->UncheckedAt(i));
     245}
     246
     247// --------------------------------------------------------------------------
     248//
     249// Get i-th pixel (pixel number)
     250//
     251const MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainSector(UInt_t i) const
     252{
     253  return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainSectors->UncheckedAt(i));
    209254}
    210255
     
    219264  const Int_t nhi   = fHiGainArray->GetEntries();
    220265  const Int_t nlo   = fLoGainArray->GetEntries();
    221   const Int_t navhi = fAverageHiGainArray->GetEntries();
    222   const Int_t navlo = fAverageLoGainArray->GetEntries();
    223  
    224   *fLog << err << nhi << "  " << nlo << "  " << navhi << "  " << navlo << endl;
    225 
     266  const Int_t navhi = fAverageHiGainAreas->GetEntries();
     267  const Int_t navlo = fAverageLoGainAreas->GetEntries();
     268  const Int_t nsehi = fAverageHiGainSectors->GetEntries();
     269  const Int_t nselo = fAverageLoGainSectors->GetEntries();
     270 
    226271  //
    227272  // FIXME, this might be done faster and more elegant, by direct copy.
     
    231276  cam->fHiGainArray->Expand(nhi);
    232277  cam->fLoGainArray->Expand(nlo);
    233   cam->fAverageHiGainArray->Expand(navhi);
    234   cam->fAverageLoGainArray->Expand(navlo);
     278  cam->fAverageHiGainAreas->Expand(navhi);
     279  cam->fAverageLoGainAreas->Expand(navlo);
     280  cam->fAverageHiGainSectors->Expand(nsehi);
     281  cam->fAverageLoGainSectors->Expand(nselo);
    235282
    236283  for (int i=0; i<nhi; i++)
     
    246293  for (int i=0; i<navhi; i++)
    247294    {
    248       delete (*cam->fAverageHiGainArray)[i];
    249       (*cam->fAverageHiGainArray)[i] = (MHCalibrationChargeHiGainPix*)(*fAverageHiGainArray)[i]->Clone();
     295      delete (*cam->fAverageHiGainAreas)[i];
     296      (*cam->fAverageHiGainAreas)[i] = (MHCalibrationChargeHiGainPix*)(*fAverageHiGainAreas)[i]->Clone();
    250297    }
    251298  for (int i=0; i<navlo; i++)
    252299    {
    253       delete (*cam->fAverageLoGainArray)[i];
    254       (*cam->fAverageLoGainArray)[i] = (MHCalibrationChargeLoGainPix*)(*fAverageLoGainArray)[i]->Clone();
    255     }
    256 
    257   cam->fAverageNum            = fAverageNum;           
    258   cam->fAverageSat            = fAverageSat;           
    259   cam->fAveragePixSigma       = fAveragePixSigma;     
    260   cam->fAveragePixSigmaErr    = fAveragePixSigmaErr;   
    261   cam->fAveragePixRelSigma    = fAveragePixRelSigma;
    262   cam->fAveragePixRelSigmaErr = fAveragePixRelSigmaErr;   
     300      delete (*cam->fAverageLoGainAreas)[i];
     301      (*cam->fAverageLoGainAreas)[i] = (MHCalibrationChargeLoGainPix*)(*fAverageLoGainAreas)[i]->Clone();
     302    }
     303  for (int i=0; i<nsehi; i++)
     304    {
     305      delete (*cam->fAverageHiGainSectors)[i];
     306      (*cam->fAverageHiGainSectors)[i] = (MHCalibrationChargeHiGainPix*)(*fAverageHiGainSectors)[i]->Clone();
     307    }
     308  for (int i=0; i<nselo; i++)
     309    {
     310      delete (*cam->fAverageLoGainSectors)[i];
     311      (*cam->fAverageLoGainSectors)[i] = (MHCalibrationChargeLoGainPix*)(*fAverageLoGainSectors)[i]->Clone();
     312    }
     313
     314  cam->fAverageAreaSat         = fAverageAreaSat;           
     315  cam->fAverageAreaSigma       = fAverageAreaSigma;     
     316  cam->fAverageAreaSigmaErr    = fAverageAreaSigmaErr;   
     317  cam->fAverageAreaRelSigma    = fAverageAreaRelSigma;
     318  cam->fAverageAreaRelSigmaErr = fAverageAreaRelSigmaErr;   
    263319
    264320  return cam;
     
    290346  fLoGainArray->Delete();
    291347
    292   fAverageHiGainArray->Delete();
    293   fAverageLoGainArray->Delete();
     348  fAverageHiGainAreas->Delete();
     349  fAverageLoGainAreas->Delete();
     350
     351  fAverageHiGainSectors->Delete();
     352  fAverageLoGainSectors->Delete();
    294353
    295354  return kTRUE;
     
    364423  const Int_t nareas = fGeom->GetNumAreas();
    365424
    366   if (fAverageHiGainArray->GetEntries()==0)
     425  if (fAverageHiGainAreas->GetEntries()==0)
    367426  {
    368       fAverageHiGainArray->Expand(nareas);
     427      fAverageHiGainAreas->Expand(nareas);
    369428
    370429      for (Int_t j=0; j<nareas; j++)
     
    373432          // Oscillating pixels
    374433          //
    375           (*fAverageHiGainArray)[j] =
    376             new MHCalibrationChargeHiGainPix("AverageHiGainPix",
     434          (*fAverageHiGainAreas)[j] =
     435            new MHCalibrationChargeHiGainPix("AverageHiGainArea",
    377436                                             "Average HiGain FADC sums of pixel area idx ");
    378           MHCalibrationChargeHiGainPix &hist = GetAverageHiGainPix(j);
     437          MHCalibrationChargeHiGainPix &hist = GetAverageHiGainArea(j);
    379438
    380439          hist.GetHGausHist()->SetTitle("Summed FADC slices average Hi Gain pixels Area Idx ");
     
    389448  }
    390449
    391   if (fAverageLoGainArray->GetEntries()==0)
     450  if (fAverageLoGainAreas->GetEntries()==0)
    392451  {
    393       fAverageLoGainArray->Expand(nareas);
     452      fAverageLoGainAreas->Expand(nareas);
    394453 
    395454      for (Int_t j=0; j<nareas; j++)
     
    398457          // Oscillating pixels
    399458          //
    400           (*fAverageLoGainArray)[j] =
    401             new MHCalibrationChargeLoGainPix("AverageLoGainPix",
     459          (*fAverageLoGainAreas)[j] =
     460            new MHCalibrationChargeLoGainPix("AverageLoGainArea",
    402461                                             "Average LoGain FADC sums of pixel area idx ");
    403           MHCalibrationChargeLoGainPix &hist = GetAverageLoGainPix(j);
     462          MHCalibrationChargeLoGainPix &hist = GetAverageLoGainArea(j);
    404463
    405464          hist.GetHGausHist()->SetTitle("Summed FADC slices average Lo Gain pixels Area Idx ");
     
    414473  }
    415474
    416   fAverageNum.           Set(nareas);
    417   fAverageSat.           Set(nareas);           
    418   fAveragePixSigma.      Set(nareas);     
    419   fAveragePixSigmaErr.   Set(nareas);   
    420   fAveragePixRelSigma.   Set(nareas);   
    421   fAveragePixRelSigmaErr.Set(nareas);
     475  fAverageAreaNum.        Set(nareas);
     476  fAverageAreaSat.        Set(nareas);           
     477  fAverageAreaSigma.      Set(nareas);     
     478  fAverageAreaSigmaErr.   Set(nareas);   
     479  fAverageAreaRelSigma.   Set(nareas);   
     480  fAverageAreaRelSigmaErr.Set(nareas);
    422481   
    423482  for (Int_t i=0; i<n; i++)
     
    427486
    428487      const Int_t aidx  = (*fGeom)[i].GetAidx();
    429       fAverageNum[aidx]++;
    430     }
     488      fAverageAreaNum[aidx]++;
     489    }
     490
     491
     492  const Int_t nsectors = fGeom->GetNumSectors();
     493
     494  if (fAverageHiGainSectors->GetEntries()==0)
     495  {
     496      fAverageHiGainSectors->Expand(nsectors);
     497
     498      for (Int_t j=0; j<nsectors; j++)
     499      {
     500          //
     501          // Oscillating pixels
     502          //
     503          (*fAverageHiGainSectors)[j] =
     504            new MHCalibrationChargeHiGainPix("AverageHiGainSector",
     505                                             "Average HiGain FADC sums of pixel sector ");
     506          MHCalibrationChargeHiGainPix &hist = GetAverageHiGainSector(j);
     507
     508          hist.GetHGausHist()->SetTitle("Summed FADC slices average Hi Gain pixels Sector ");
     509          hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average Hi Gain pixels Sector ");
     510          hist.SetChargeFirst(-1000.);
     511          hist.SetChargeLast(4000.);
     512          hist.SetChargeNbins(4000);
     513          hist.Init();
     514          hist.ChangeHistId(j);
     515          hist.SetEventFrequency(fPulserFrequency);
     516      }
     517  }
     518
     519  if (fAverageLoGainSectors->GetEntries()==0)
     520  {
     521      fAverageLoGainSectors->Expand(nsectors);
     522 
     523      for (Int_t j=0; j<nsectors; j++)
     524      {
     525          //
     526          // Oscillating pixels
     527          //
     528          (*fAverageLoGainSectors)[j] =
     529            new MHCalibrationChargeLoGainPix("AverageLoGainSector",
     530                                             "Average LoGain FADC sums of pixel sector ");
     531          MHCalibrationChargeLoGainPix &hist = GetAverageLoGainSector(j);
     532
     533          hist.GetHGausHist()->SetTitle("Summed FADC slices average Lo Gain pixels Sector ");
     534          hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average Lo Gain pixels Sector ");
     535          hist.SetChargeFirst(-1000.);
     536          hist.SetChargeLast(4000.);
     537          hist.SetChargeNbins(4000);
     538          hist.Init();
     539          hist.ChangeHistId(j);
     540          hist.SetEventFrequency(fPulserFrequency);
     541      }
     542  }
     543
     544  fAverageSectorNum.        Set(nsectors);
     545
     546  for (Int_t i=0; i<n; i++)
     547    {
     548      if ((*this)[i].IsExcluded())
     549        continue;
     550
     551      const Int_t sector  = (*fGeom)[i].GetSector();
     552      fAverageSectorNum[sector]++;
     553    }
     554
    431555 
    432556  return kTRUE;
     
    445569    }
    446570 
    447   const Int_t npixels = signal->GetSize();
    448   const Int_t lofirst = signal->GetFirstUsedSliceLoGain();
    449   const Int_t nareas  = fGeom->GetNumAreas();
     571  const Int_t npixels  = signal->GetSize();
     572  const Int_t lofirst  = signal->GetFirstUsedSliceLoGain();
     573  const Int_t nareas   = fGeom->GetNumAreas();
     574  const Int_t nsectors = fGeom->GetNumSectors();
    450575
    451576  if (fHiGainArray->GetEntries() != npixels)
     
    461586    }
    462587
    463   if (fAverageHiGainArray->GetEntries() != nareas)
     588  if (fAverageHiGainAreas->GetEntries() != nareas)
    464589    {
    465590      *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl;
     
    467592    }
    468593
    469   if (fAverageLoGainArray->GetEntries() != nareas)
     594  if (fAverageLoGainAreas->GetEntries() != nareas)
    470595    {
    471596      *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl;
     
    473598    }
    474599
    475 
    476   //
    477   // First the extracted signal
    478   //
    479   Float_t sumhitot [nareas];
    480   Float_t sumlotot [nareas];
    481   Int_t   sumhisat [nareas];
    482   Int_t   sumlosat [nareas];
    483   Float_t timehitot[nareas];
    484   Float_t timelotot[nareas];
     600  if (fAverageHiGainSectors->GetEntries() != nsectors)
     601    {
     602      *fLog << err << "ERROR - Size mismatch in number of sectors ... abort." << endl;
     603      return kFALSE;
     604    }
     605
     606  if (fAverageLoGainSectors->GetEntries() != nsectors)
     607    {
     608      *fLog << err << "ERROR - Size mismatch in number of sectors ... abort." << endl;
     609      return kFALSE;
     610    }
     611
     612  Float_t sumhiarea  [nareas],   sumloarea  [nareas],   timehiarea  [nareas],   timeloarea  [nareas];
     613  Float_t sumhisector[nsectors], sumlosector[nsectors], timehisector[nsectors], timelosector[nsectors];
     614  Int_t   sathiarea  [nareas],   satloarea  [nareas];
     615  Int_t   sathisector[nsectors], satlosector[nsectors];
    485616
    486617  for (UInt_t j=0; j<nareas; j++)
    487618    {
    488 
    489       sumhitot[j]  =  sumlotot[j] = 0.;
    490       sumhisat[j]  =  sumlosat[j] = 0;
    491       timehitot[j] =  timelotot[j] = 0.;     
     619      sumhiarea  [j] = sumloarea  [j] = timehiarea  [j] =  timeloarea  [j] = 0.;
     620      sumhisector[j] = sumlosector[j] = timehisector[j] =  timelosector[j] = 0.;
     621      sathiarea  [j] = satloarea  [j] = 0;
     622      sathisector[j] = satlosector[j] = 0;
    492623    }
    493624 
     
    512643      (*this)(i).SetSaturated(satlo);
    513644
    514       const Int_t aidx  = (*fGeom)[i].GetAidx();
    515 
    516       sumhitot[aidx]  += sumhi;
    517       sumlotot[aidx]  += sumlo;
    518       sumhisat[aidx]  += sathi;
    519       sumlosat[aidx]  += satlo;
     645      const Int_t aidx   = (*fGeom)[i].GetAidx();
     646      const Int_t sector = (*fGeom)[i].GetSector();
     647
     648      sumhiarea[aidx]  += sumhi;
     649      sumloarea[aidx]  += sumlo;
     650      sathiarea[aidx]  += sathi;
     651      satloarea[aidx]  += satlo;
     652
     653      sumhisector[sector]  += sumhi;
     654      sumlosector[sector]  += sumlo;
     655      sathisector[sector]  += sathi;
     656      satlosector[sector]  += satlo;
    520657    }
    521658
     
    534671      (*this)(pixid).FillAbsTime(timelo);
    535672
    536       const Int_t aidx  = (*fGeom)[pixid].GetAidx();
    537 
    538       timehitot[aidx] += timehi;
    539       timelotot[aidx] += timelo;
     673      const Int_t aidx   = (*fGeom)[pixid].GetAidx();
     674      const Int_t sector = (*fGeom)[pixid].GetSector();
     675
     676      timehiarea[aidx] += timehi;
     677      timeloarea[aidx] += timelo;
     678
     679      timehisector[sector] += timehi;
     680      timelosector[sector] += timelo;
    540681    }
    541682 
     
    544685    {
    545686
    546       const Int_t npix = fAverageNum[j];
    547 
    548       MHCalibrationChargeHiGainPix &hipix = GetAverageHiGainPix(j);
    549       MHCalibrationChargeLoGainPix &lopix = GetAverageLoGainPix(j);
    550 
    551       hipix.FillHistAndArray(sumhitot[j]/npix);
    552       lopix.FillHistAndArray(sumlotot[j]/npix);
    553 
    554       hipix.SetSaturated((Float_t)sumhisat[j]/npix);
    555       lopix.SetSaturated((Float_t)sumlosat[j]/npix);
    556 
    557       hipix.FillAbsTime(timehitot[j]/npix);
    558       lopix.FillAbsTime(timelotot[j]/npix);
     687      const Int_t npix = fAverageAreaNum[j];
     688
     689      MHCalibrationChargeHiGainPix &hipix = GetAverageHiGainArea(j);
     690      MHCalibrationChargeLoGainPix &lopix = GetAverageLoGainArea(j);
     691
     692      hipix.FillHistAndArray(sumhiarea[j]/npix);
     693      lopix.FillHistAndArray(sumloarea[j]/npix);
     694
     695      hipix.SetSaturated((Float_t)sathiarea[j]/npix);
     696      lopix.SetSaturated((Float_t)satloarea[j]/npix);
     697
     698      hipix.FillAbsTime(timehiarea[j]/npix);
     699      lopix.FillAbsTime(timeloarea[j]/npix);
     700
     701    }
     702
     703  for (UInt_t j=0; j<nsectors; j++)
     704    {
     705
     706      const Int_t npix = fAverageSectorNum[j];
     707
     708      MHCalibrationChargeHiGainPix &hipix = GetAverageHiGainSector(j);
     709      MHCalibrationChargeLoGainPix &lopix = GetAverageLoGainSector(j);
     710
     711      hipix.FillHistAndArray(sumhisector[j]/npix);
     712      lopix.FillHistAndArray(sumlosector[j]/npix);
     713
     714      hipix.SetSaturated((Float_t)sathisector[j]/npix);
     715      lopix.SetSaturated((Float_t)satlosector[j]/npix);
     716
     717      hipix.FillAbsTime(timehisector[j]/npix);
     718      lopix.FillAbsTime(timelosector[j]/npix);
    559719
    560720    }
     
    604764    }
    605765 
    606   for (Int_t j=0; j<fAverageHiGainArray->GetSize(); j++)
    607     {
    608      
    609       MHCalibrationChargeHiGainPix &histhi = GetAverageHiGainPix(j);     
    610       MCalibrationChargePix        &pix    = fCam->GetAveragePix(j);
    611       MBadPixelsPix                &bad    = fCam->GetAverageBadPix(j);       
     766  for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++)
     767    {
     768     
     769      MHCalibrationChargeHiGainPix &histhi = GetAverageHiGainArea(j);     
     770      MCalibrationChargePix        &pix    = fCam->GetAverageArea(j);
     771      MBadPixelsPix                &bad    = fCam->GetAverageBadArea(j);       
    612772     
    613773      FinalizeHiGainHists(histhi,pix,bad);
    614774    }
    615775 
    616   for (Int_t j=0; j<fAverageLoGainArray->GetSize(); j++)
    617     {
    618      
    619       MHCalibrationChargeLoGainPix &histlo = GetAverageLoGainPix(j);     
    620       MCalibrationChargePix        &pix    = fCam->GetAveragePix(j);
    621       MBadPixelsPix                &bad    = fCam->GetAverageBadPix(j);       
     776  for (Int_t j=0; j<fAverageLoGainAreas->GetSize(); j++)
     777    {
     778     
     779      MHCalibrationChargeLoGainPix &histlo = GetAverageLoGainArea(j);     
     780      MCalibrationChargePix        &pix    = fCam->GetAverageArea(j);
     781      MBadPixelsPix                &bad    = fCam->GetAverageBadArea(j);       
    622782     
    623783      FinalizeLoGainHists(histlo,pix,bad);
    624784    }
     785
     786  for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++)
     787    {
     788     
     789      MHCalibrationChargeHiGainPix &histhi = GetAverageHiGainSector(j);     
     790      MCalibrationChargePix        &pix    = fCam->GetAverageSector(j);
     791      MBadPixelsPix                &bad    = fCam->GetAverageBadSector(j);       
     792     
     793      FinalizeHiGainHists(histhi,pix,bad);
     794    }
     795 
     796  for (Int_t j=0; j<fAverageLoGainSectors->GetSize(); j++)
     797    {
     798     
     799      MHCalibrationChargeLoGainPix &histlo = GetAverageLoGainSector(j);     
     800      MCalibrationChargePix        &pix    = fCam->GetAverageSector(j);
     801      MBadPixelsPix                &bad    = fCam->GetAverageBadSector(j);       
     802     
     803      FinalizeLoGainHists(histlo,pix,bad);
     804    }
    625805 
    626806  for (Int_t j=0; j<fGeom->GetNumAreas();j++)
    627807    {
    628808     
    629       MCalibrationChargePix &pix = fCam->GetAveragePix(j);
     809      MCalibrationChargePix &pix = fCam->GetAverageArea(j);
    630810
    631811      if (pix.IsHiGainSaturation())
    632         fAverageSat[j]++;
    633 
    634       fAveragePixSigma[j]    = pix.GetSigmaCharge    () * TMath::Sqrt((Float_t)fAverageNum[j]);
    635       fAveragePixSigmaErr[j] = pix.GetSigmaChargeErr () * TMath::Sqrt((Float_t)fAverageNum[j]);
    636 
    637       pix.SetSigmaCharge   (fAveragePixSigma[j]);
    638       pix.SetSigmaChargeErr(fAveragePixSigmaErr[j]);
    639 
    640       fAveragePixRelSigma[j]   = fAveragePixSigma[j] / pix.GetMeanCharge();
    641      
    642       Float_t relsigmaerr      =  fAveragePixSigmaErr[j]*fAveragePixSigmaErr[j]
    643                                / (fAveragePixSigma[j]   *fAveragePixSigma[j]   );
    644       relsigmaerr              += pix.GetMeanChargeErr()*pix.GetMeanChargeErr()
    645                                / (pix.GetMeanCharge()   *pix.GetMeanCharge()   );
    646       relsigmaerr              *= fAveragePixRelSigma[j];
    647       fAveragePixRelSigmaErr[j] = TMath::Sqrt(relsigmaerr);
     812        fAverageAreaSat[j]++;
     813
     814      fAverageAreaSigma[j]    = pix.GetSigmaCharge    () * TMath::Sqrt((Float_t)fAverageAreaNum[j]);
     815      fAverageAreaSigmaErr[j] = pix.GetSigmaChargeErr () * TMath::Sqrt((Float_t)fAverageAreaNum[j]);
     816
     817      pix.SetSigmaCharge   (fAverageAreaSigma[j]);
     818      pix.SetSigmaChargeErr(fAverageAreaSigmaErr[j]);
     819
     820      fAverageAreaRelSigma[j]   = fAverageAreaSigma[j] / pix.GetMeanCharge();
     821     
     822      Float_t relsigmaerr       =  fAverageAreaSigmaErr[j]*fAverageAreaSigmaErr[j]
     823                                / (fAverageAreaSigma[j]   *fAverageAreaSigma[j]   );
     824      relsigmaerr               += pix.GetMeanChargeErr()*pix.GetMeanChargeErr()
     825                                / (pix.GetMeanCharge()   *pix.GetMeanCharge()   );
     826      relsigmaerr               *= fAverageAreaRelSigma[j];
     827      fAverageAreaRelSigmaErr[j] = TMath::Sqrt(relsigmaerr);
    648828
    649829    }
     
    668848      *fLog << warn << "Saturated Hi Gain histogram in pixel: " << pix.GetPixId() << endl;
    669849      pix.SetHiGainSaturation();
    670       return;
     850      //      return;
    671851    }
    672852   
     
    737917      bad.SetUncalibrated( MBadPixelsPix::kLoGainSaturation );
    738918      bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun    );
    739       return;
     919      //      return;
    740920    }
    741921
     
    810990{
    811991
    812   const Int_t nareas = fAverageHiGainArray->GetEntries();
     992  const Int_t nareas = fAverageHiGainAreas->GetEntries();
    813993  if (nareas == 0)
    814994    return;
     
    8221002    {
    8231003      pad->cd(2*(i+1)-1);
    824       GetAverageHiGainPix(i).Draw(opt);
    825 
    826       if (!fAverageSat[i])
    827         DrawAverageSigma(fAverageSat[i], i,
    828                          fAveragePixSigma[i],    fAveragePixSigmaErr[i],
    829                          fAveragePixRelSigma[i], fAveragePixRelSigmaErr[i]);
     1004      GetAverageHiGainArea(i).Draw(opt);
     1005
     1006      if (!fAverageAreaSat[i])
     1007        DrawAverageSigma(fAverageAreaSat[i], i,
     1008                         fAverageAreaSigma[i],    fAverageAreaSigmaErr[i],
     1009                         fAverageAreaRelSigma[i], fAverageAreaRelSigmaErr[i]);
    8301010
    8311011      pad->cd(2*(i+1));
    832       GetAverageLoGainPix(i).Draw(opt);
    833      
    834       if (fAverageSat[i])
    835         DrawAverageSigma(fAverageSat[i], i,
    836                          fAveragePixSigma[i], fAveragePixSigmaErr[i],
    837                          fAveragePixRelSigma[i], fAveragePixRelSigmaErr[i]);
     1012      GetAverageLoGainArea(i).Draw(opt);
     1013     
     1014      if (fAverageAreaSat[i])
     1015        DrawAverageSigma(fAverageAreaSat[i], i,
     1016                         fAverageAreaSigma[i], fAverageAreaSigmaErr[i],
     1017                         fAverageAreaRelSigma[i], fAverageAreaRelSigmaErr[i]);
    8381018    }
    8391019}
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.h

    r3622 r3624  
    4747  TObjArray *fHiGainArray;            //-> Array of MHCalibrationChargeHiGainPix, one per pixel
    4848  TObjArray *fLoGainArray;            //-> Array of MHCalibrationChargeLoGainPix, one per pixel
    49   TObjArray *fAverageHiGainArray;     //-> Array of MHCalibrationChargeHiGainPix, one per pixel area
    50   TObjArray *fAverageLoGainArray;     //-> Array of MHCalibrationChargeLoGainPix, one per pixel area
    51  
     49  TObjArray *fAverageHiGainAreas;     //-> Array of MHCalibrationChargeHiGainPix, one per pixel area
     50  TObjArray *fAverageLoGainAreas;     //-> Array of MHCalibrationChargeLoGainPix, one per pixel area
     51  TObjArray *fAverageHiGainSectors;   //-> Array of MHCalibrationChargeHiGainPix, one per camera sector
     52  TObjArray *fAverageLoGainSectors;   //-> Array of MHCalibrationChargeLoGainPix, one per camera sector
     53
    5254  MCalibrationChargeCam  *fCam;       //!  Calibration Cam with the results
    5355  MRawEvtData            *fRawEvt;    //!  Raw event data
     
    5557  MBadPixelsCam          *fBadPixels; //!  Bad Pixels storage container
    5658
    57   TArrayI fAverageNum;                // Number of pixels in average pixels
    58   TArrayI fAverageSat;                // Number of saturated slices in average pixels
    59   TArrayF fAveragePixSigma;           // Re-normalized sigmas in average pixels
    60   TArrayF fAveragePixSigmaErr;        // Errors of Re-normalized sigmas in average pixels
    61   TArrayF fAveragePixRelSigma;        // Re-normalized relative sigmas in average pixels
    62   TArrayF fAveragePixRelSigmaErr;     // Errors of Re-normalized relative sigmas in average pixels
     59  TArrayI fAverageAreaNum;            // Number of pixels in average pixels per area
     60  TArrayI fAverageAreaSat;            // Number of saturated slices in average pixels per area
     61  TArrayF fAverageAreaSigma;          // Re-normalized sigmas in average pixels per area
     62  TArrayF fAverageAreaSigmaErr;       // Errors of Re-normalized sigmas in average pixels per area
     63  TArrayF fAverageAreaRelSigma;       // Re-normalized relative sigmas in average pixels per area
     64  TArrayF fAverageAreaRelSigmaErr;    // Errors of Re-normalized relative sigmas in average pixels per area
     65
     66  TArrayI fAverageSectorNum;          // Number of pixels in average pixels per sector
    6367
    6468  void FinalizeHiGainHists(MHCalibrationChargeHiGainPix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad);
     
    8690  const MHCalibrationChargeLoGainPix &operator()(UInt_t i)    const;
    8791
    88         MHCalibrationChargeHiGainPix  &GetAverageHiGainPix(UInt_t i);
    89   const MHCalibrationChargeHiGainPix  &GetAverageHiGainPix(UInt_t i)  const;
     92        MHCalibrationChargeHiGainPix  &GetAverageHiGainArea(UInt_t i);
     93  const MHCalibrationChargeHiGainPix  &GetAverageHiGainArea(UInt_t i)  const;
    9094
    91         MHCalibrationChargeLoGainPix  &GetAverageLoGainPix(UInt_t i);
    92   const MHCalibrationChargeLoGainPix  &GetAverageLoGainPix(UInt_t i)  const;
     95        MHCalibrationChargeLoGainPix  &GetAverageLoGainArea(UInt_t i);
     96  const MHCalibrationChargeLoGainPix  &GetAverageLoGainArea(UInt_t i)  const;
     97
     98        MHCalibrationChargeHiGainPix  &GetAverageHiGainSector(UInt_t i);
     99  const MHCalibrationChargeHiGainPix  &GetAverageHiGainSector(UInt_t i)  const;
     100
     101        MHCalibrationChargeLoGainPix  &GetAverageLoGainSector(UInt_t i);
     102  const MHCalibrationChargeLoGainPix  &GetAverageLoGainSector(UInt_t i)  const;
    93103
    94104  Bool_t SetupFill(const MParList *pList);
     
    106116  void   DrawPixelContent( Int_t num )  const;   
    107117
    108   ClassDef(MHCalibrationChargeCam, 1)   // Container for calibration information of the camera
     118  ClassDef(MHCalibrationChargeCam, 1)   // Histogram class for camera calibration
    109119};
    110120
Note: See TracChangeset for help on using the changeset viewer.