Changeset 2679 for trunk/MagicSoft


Ignore:
Timestamp:
12/15/03 19:01:14 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2678 r2679  
    44
    55                                                 -*-*- END OF LINE -*-*-
     6
     7 2003/12/12: Markus Gaug / Michele Doro
     8
     9   * manalysis/MCalibrationCam.[h,cc]
     10   * manalysis/MCalibrationPix.[h,cc]
     11   * manalysis/MCalibrationBlindPix.[h,cc]
     12   * manalysis/MCalibrationConfig.[h,cc]
     13     - bug found transforming the number of photons from the blind pixel
     14        to the inner pixel. The previous results were wrong by a factor 2
     15     - PIN Diode formally included
     16     - Code better documented in MCalibrationCam
     17
    618
    719 2003/12/15: Thomas Bretz
  • trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.cc

    r2666 r2679  
    413413    {
    414414      if (blindpixel.FitCharge())
    415         {
    416           if (!fCalibrations->CalcNrPhotInnerPixel())
    417             *fLog << err << dbginf << "Could not calculate Number of photons from the blind pixel " << endl;
    418         }
     415            *fLog << err << dbginf << "Could not fit the blind pixel " << endl;
    419416      else
    420         {
    421417          *fLog << err << dbginf << "Could not fit the blind pixel " << endl;
    422         }
    423418
    424419      if (!blindpixel.FitTime())
     
    426421
    427422      blindpixel.Draw();
    428 
    429423    }
    430 
     424 
    431425  *fLog << GetDescriptor() << " Fitting the Normal Pixels" << endl;
    432426
     
    450444     
    451445    }
     446
     447  if (!fCalibrations->CalcNumPhotInsidePlexiglass())
     448    *fLog << err << dbginf << "Could not calculate the number of photons from the blind pixel " << endl;
    452449
    453450  fCalibrations->SetReadyToSave();
  • trunk/MagicSoft/Mars/manalysis/MCalibrationCam.cc

    r2673 r2679  
    2525
    2626/////////////////////////////////////////////////////////////////////////////
    27 //                                                                         //
    28 // MCalibrationCam                                                         //
    29 //                                                                         //
    30 // Hold the Calibration information for all pixels in the camera           //
    31 //                                                                         //
    32 // The Classes MCalibrationPix's are stored in a TClonesArray              //
    33 // The Class MCalibrationBlindPix and the MCalibrationPINDiode             //
    34 //           are stored in separate pointers                               //
    35 //                                                                         //
     27//                                                               
     28// MCalibrationCam                                               
     29//                                                               
     30// Hold the whole Calibration results of the camera:
     31//                                                               
     32// 1) MCalibrationCam initializes a TClonesArray whose elements are
     33//    pointers to MCalibrationPix Containers
     34// 2) It initializes a pointer to an MCalibrationBlindPix container
     35// 3) It initializes a pointer to an MCalibrationPINDiode container
     36//
     37// 4) 
     38//
    3639/////////////////////////////////////////////////////////////////////////////
    3740#include "MCalibrationCam.h"
     
    5659//
    5760// Default constructor.
    58 // Creates a TClonesArray of MHCalibrationPix objects, initialized to 0 entries
    59 // Creates an MCalibrationBlindPix and an MCalibrationPINDiode
     61//
     62// Creates a TClonesArray of MCalibrationPix containers, initialized to 1 entry
     63// Later, a call to MCalibrationCam::InitSize(Int_t size) has to be performed
     64//
     65// Creates an MCalibrationBlindPix container
     66// Creates an MCalibrationPINDiode container
    6067//
    6168MCalibrationCam::MCalibrationCam(const char *name, const char *title)
    62     : fMeanNrPhotAvailable(kFALSE),
    63       fMeanNrPhotInnerPix(-1.),
    64       fMeanNrPhotInnerPixErr(-1.),
     69    : fNumPhotInsidePlexiglassAvailable(kFALSE),
     70      fMeanPhotInsidePlexiglass(-1.),
     71      fMeanPhotErrInsidePlexiglass(-1.),
     72      fNumPhotOutsidePlexiglassAvailable(kFALSE),
     73      fMeanPhotOutsidePlexiglass(-1.),
     74      fMeanPhotErrOutsidePlexiglass(-1.),
    6575      fOffsets(NULL),
    6676      fSlopes(NULL),
     
    7787// --------------------------------------------------------------------------
    7888//
    79 // Delete the TClonesArray or MCalibrationPix's
     89// Delete the TClonesArray of MCalibrationPix containers
    8090// Delete the MCalibrationPINDiode and the MCalibrationBlindPix
     91//
     92// Delete the histograms if they exist
    8193//
    8294MCalibrationCam::~MCalibrationCam()
     
    99111}
    100112
    101 void MCalibrationCam::DrawHiLoFits()
    102 {
    103 
    104   if (!fOffsets)
    105     fOffsets = new TH1D("pp","Offsets of the HiGain LoGain Fit",100,-600.,400.);
    106   if (!fSlopes)
    107     fSlopes  = new TH1D("mm","Slopes of the HiGain LoGain Fit",100,-2.,2.);
    108   if (!fOffvsSlope)
    109     fOffvsSlope = new TH2D("aa","Slopes vs Offsets of the HiGain LoGain Fit",100,-600.,400.,100,-2.,2.);
    110 
    111   TIter Next(fPixels);
    112   MCalibrationPix *pix;
    113   MHCalibrationPixel *hist;
    114   while ((pix=(MCalibrationPix*)Next()))
    115     {
    116       hist = pix->GetHist();
    117       hist->FitHiGainvsLoGain();
    118       fOffsets->Fill(hist->GetOffset(),1.);
    119       fSlopes->Fill(hist->GetSlope(),1.);
    120       fOffvsSlope->Fill(hist->GetOffset(),hist->GetSlope(),1.);
    121     }
    122 
    123    TCanvas *c1 = new TCanvas();
    124 
    125    c1->Divide(1,3);
    126    c1->cd(1);
    127    fOffsets->Draw();
    128    gPad->Modified();
    129    gPad->Update();
    130 
    131    c1->cd(2);
    132   fSlopes->Draw();
    133   gPad->Modified();
    134   gPad->Update();
    135 
    136   c1->cd(3);
    137   fOffvsSlope->Draw("col1");
    138   gPad->Modified();
    139   gPad->Update();
    140 }
    141 
    142 
    143 // --------------------------------------------------------------------------
    144 //
    145 // This function return the size of the FILLED MCalibrationCam
    146 // It is NOT the size of the array fPixels !!!
    147 // Note that with every call to AddPixels, GetSize() might change
    148 //
    149 Int_t MCalibrationCam::GetSize() const
    150 {
    151 
    152   //
    153   // Here we get the number of "filled" fPixels!!
    154   //
    155   return fPixels->GetEntriesFast();
    156 }
    157 
    158 // --------------------------------------------------------------------------
    159 //
    160 // Get i-th pixel (pixel number)
    161 //
    162 MCalibrationPix &MCalibrationCam::operator[](Int_t i)
    163 {
    164     return *static_cast<MCalibrationPix*>(fPixels->UncheckedAt(i));
    165 }
    166 
    167 // --------------------------------------------------------------------------
    168 //
    169 // Get i-th pixel (pixel number)
    170 //
    171 MCalibrationPix &MCalibrationCam::operator[](Int_t i) const
    172 {
    173     return *static_cast<MCalibrationPix*>(fPixels->UncheckedAt(i));
    174 }
    175 
    176 // --------------------------------------------------------------------------
    177 //
    178 // Return a pointer to the pixel with the requested idx.
    179 // NULL if it doesn't exist.
    180 //
    181 MCalibrationPix *MCalibrationCam::GetCalibrationPix(Int_t idx) const
    182 {
    183    if (idx<0)
    184      return NULL;
    185 
    186   if (!CheckBounds(idx))
    187     return NULL;
    188  
    189   return (MCalibrationPix*)fPixels->At(idx);
    190 }
    191 
    192 
    193 
    194 // --------------------------------------------------------------------------
    195 //
    196 // Check if position i is inside bounds
    197 //
    198 Bool_t MCalibrationCam::CheckBounds(Int_t i) const
    199 {
    200     return i < fPixels->GetEntriesFast();
    201 }
    202 
    203 Bool_t MCalibrationCam::IsPixelUsed(Int_t idx) const
    204 {
    205   if (!CheckBounds(idx))
    206     return kFALSE;
    207 
    208   return kTRUE;
    209 }
    210 
    211 Bool_t MCalibrationCam::IsPixelFitted(Int_t idx) const
    212 {
    213   return ((*this)[idx].GetCharge() > 0. && (*this)[idx].GetErrCharge() > 0.);
    214 }
    215 
    216 
    217 
    218 void MCalibrationCam::Clear(Option_t *o)
    219 {
    220     fPixels->ForEach(TObject, Clear)();
    221 }
    222 
    223 //
    224 // Perform the fits of the charges
    225 // If i=-1, then all pixels will be fitted
    226 // Otherwise only the one with index i
    227 //
    228 // The number of succesful fits is returned
    229 //
    230 UShort_t MCalibrationCam::FitCharge(Int_t i)
    231 {
    232 
    233   UShort_t nsuccess = 0;
    234 
    235   // invalidate i if it exceeds the number of entries in fPixels
    236   if (i > fPixels->GetEntriesFast())     
    237     {
    238       *fLog << warn << "Tried to fit pixel out of allowed range " << endl;
    239       return 0;
    240     }
    241  
    242   if (i == -1)    // loop over all events
    243     {
    244 
    245       TIter Next(fPixels);
    246       MCalibrationPix *pix;
    247       while ((pix=(MCalibrationPix*)Next()))
    248         {
    249           if (pix->FitCharge())
    250             nsuccess++;
    251         }
    252     }
    253   else                  // fit only the pixel with index i
    254     {
    255       if((*this)[i].FitCharge())
    256         nsuccess++;
    257     }
    258  
    259   return nsuccess;
    260  
    261 }
    262 
    263 //
    264 // Perform the fits of the charges of all pixels
    265 // plus the blind pixel and the PIN Diode
    266 //
    267 // The number of succesful fits is returned
    268 //
    269 UShort_t MCalibrationCam::FitAllCharge()
    270 {
    271 
    272   // FIXME: Once the blind pixel is fully working,
    273   //        there must be some penalty in case the
    274   //        fit does not succeed
    275   //
    276   UShort_t nsuccess = 0;
    277 
    278   TIter Next(fPixels);
    279   MCalibrationPix *pix;
    280   while ((pix=(MCalibrationPix*)Next()))
    281     {
    282       if (pix->FitCharge())
    283         nsuccess++;
    284     }
    285  
    286   if (fBlindPixel->FitCharge())
    287         nsuccess++;
    288 
    289   if (fPINDiode->FitCharge())
    290         nsuccess++;
    291 
    292   return nsuccess;
    293 
    294 }
    295 
    296 
    297 
    298 //
    299 // Perform the fits of the arrival times
    300 // If i=-1, then all pixels will be fitted
    301 // Otherwise only the one with index i
    302 //
    303 // The number of succesful fits is returned
    304 //
    305 UShort_t MCalibrationCam::FitTime(Int_t i)
    306 {
    307 
    308   UShort_t nsuccess = 0;
    309 
    310   // invalidate i if it exceeds the number of entries in fPixels
    311   if (i > fPixels->GetEntriesFast())     
    312     {
    313       *fLog << warn << "Tried to fit pixel out of allowed range " << endl;
    314       return 0;
    315     }
    316  
    317   if (i == -1)                // loop over all events
    318     {
    319 
    320       TIter Next(fPixels);
    321       MCalibrationPix *pix;
    322       while ((pix=(MCalibrationPix*)Next()))
    323         {
    324          if (pix->FitTime())
    325             nsuccess++;
    326         }
    327     }
    328   else                     // fit only the pixel with index i
    329     {
    330       if((*this)[i].FitTime())
    331         nsuccess++;
    332     }
    333  
    334   return nsuccess;
    335 
    336 }
    337 
    338 
    339 //
    340 // Perform the fits of the times of all pixels
    341 // plus the blind pixel and the PIN Diode
    342 //
    343 // The number of succesful fits is returned
    344 //
    345 UShort_t MCalibrationCam::FitAllTime()
    346 {
    347 
    348   // FIXME: Once the blind pixel is fully working,
    349   //        there must be some penalty in case the
    350   //        fit does not succeed
    351   //
    352   UShort_t nsuccess = 0;
    353 
    354   TIter Next(fPixels);
    355   MCalibrationPix *pix;
    356   while ((pix=(MCalibrationPix*)Next()))
    357     {
    358       if (pix->FitTime())
    359         nsuccess++;
    360     }
    361  
    362   if (fBlindPixel->FitTime())
    363         nsuccess++;
    364 
    365   if (fPINDiode->FitTime())
    366        nsuccess++;
    367 
    368   return nsuccess;
    369 
    370 }
    371 
    372 
    373 
    374 void MCalibrationCam::CutEdges()
    375 {
    376 
    377   fBlindPixel->GetHist()->CutAllEdges();
    378 
    379   TIter Next(fPixels);
    380   MCalibrationPix *pix;
    381   while ((pix=(MCalibrationPix*)Next()))
    382     {
    383       pix->GetHist()->CutAllEdges();
    384     }
    385 
    386   return;
    387 }
    388 
    389 // ---------------------------------------------------------------------
     113// -------------------------------------------------------------------
    390114//
    391115// This function simply allocates memory via the ROOT command:
    392116// (TObject**) TStorage::ReAlloc(fCont, newSize * sizeof(TObject*),
    393 //                                       fSize * sizeof(TObject*));
     117//                                      fSize * sizeof(TObject*));
    394118// newSize corresponds to size in our case
    395 // fSize is the old size (in most cases: 0)
     119// fSize is the old size (in most cases: 1)
    396120//
    397121void MCalibrationCam::InitSize(Int_t size)
     
    404128    return;
    405129 
    406   //
    407   // It is important to use Expand and NOT ExpandCreate, because
    408   // we want to keep all pixel not used with a NULL pointer.
    409   //
    410130  fPixels->ExpandCreate(size);
    411131
     132}
     133
     134// --------------------------------------------------------------------------
     135//
     136// This function returns the current size of the TClonesArray
     137// independently if the MCalibrationPix is filled with values or not.
     138//
     139// It is the size of the array fPixels.
     140//
     141Int_t MCalibrationCam::GetSize() const
     142{
     143  return fPixels->GetEntriesFast();
     144}
     145
     146// --------------------------------------------------------------------------
     147//
     148// Check if position i is inside the current bounds of the TClonesArray
     149//
     150Bool_t MCalibrationCam::CheckBounds(Int_t i) const
     151{
     152    return i < fPixels->GetEntriesFast();
     153}
     154
     155
     156// --------------------------------------------------------------------------
     157//
     158// Get i-th pixel (pixel number)
     159//
     160MCalibrationPix &MCalibrationCam::operator[](Int_t i)
     161{
     162
     163  if (!CheckBounds(i))
     164    return *static_cast<MCalibrationPix*>(NULL);
     165
     166  return *static_cast<MCalibrationPix*>(fPixels->UncheckedAt(i));
     167}
     168
     169// --------------------------------------------------------------------------
     170//
     171// Get i-th pixel (pixel number)
     172//
     173MCalibrationPix &MCalibrationCam::operator[](Int_t i) const
     174{
     175    return *static_cast<MCalibrationPix*>(fPixels->UncheckedAt(i));
     176}
     177
     178// --------------------------------------------------------------------------
     179//
     180// Return a pointer to the pixel with the requested idx.
     181// NULL if it doesn't exist.
     182//
     183MCalibrationPix *MCalibrationCam::GetCalibrationPix(Int_t idx) const
     184{
     185   if (idx<0)
     186     return NULL;
     187
     188  if (!CheckBounds(idx))
     189    return NULL;
     190 
     191  return (MCalibrationPix*)fPixels->At(idx);
     192}
     193
     194
     195
     196
     197Bool_t MCalibrationCam::IsPixelUsed(Int_t idx) const
     198{
     199  if (!CheckBounds(idx))
     200    return kFALSE;
     201
     202  return kTRUE;
     203}
     204
     205Bool_t MCalibrationCam::IsPixelFitted(Int_t idx) const
     206{
     207  return ((*this)[idx].GetCharge() > 0. && (*this)[idx].GetErrCharge() > 0.);
     208}
     209
     210
     211
     212void MCalibrationCam::Clear(Option_t *o)
     213{
     214    fPixels->ForEach(TObject, Clear)();
     215}
     216
     217void MCalibrationCam::CutEdges()
     218{
     219
     220  fBlindPixel->GetHist()->CutAllEdges();
     221
     222  TIter Next(fPixels);
     223  MCalibrationPix *pix;
     224  while ((pix=(MCalibrationPix*)Next()))
     225    {
     226      pix->GetHist()->CutAllEdges();
     227    }
     228
     229  return;
    412230}
    413231 
     
    514332    case 13:
    515333      if (idx < 397)
    516         val = (double)fMeanNrPhotInnerPix;
     334        val = (double)fMeanPhotInsidePlexiglass;
    517335      else
    518         val = (double)fMeanNrPhotInnerPix*gkCalibrationOuterPixelArea;
     336        val = (double)fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelArea;
    519337      break;
    520338    case 14:
    521       if ((fMeanNrPhotInnerPix > 0. ) && ((*this)[idx].GetCharge() != -1.))
     339      if ((fMeanPhotInsidePlexiglass > 0. ) && ((*this)[idx].GetCharge() != -1.))
    522340        {
    523341          if (idx < 397)
    524             val = fMeanNrPhotInnerPix / (*this)[idx].GetCharge();
     342            val = fMeanPhotInsidePlexiglass / (*this)[idx].GetCharge();
    525343          else
    526             val = fMeanNrPhotInnerPix*gkCalibrationOuterPixelArea / (*this)[idx].GetCharge();
     344            val = fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelArea / (*this)[idx].GetCharge();
    527345        }
    528346      else
     
    544362}
    545363
    546 Bool_t MCalibrationCam::CalcNrPhotInnerPixel()
     364Bool_t MCalibrationCam::CalcNumPhotInsidePlexiglass()
    547365{
    548366
     
    556374    {
    557375    case kECGreen:
    558       fMeanNrPhotInnerPix = (mean / gkCalibrationBlindPixelQEGreen) // real photons
     376      fMeanPhotInsidePlexiglass = (mean / gkCalibrationBlindPixelQEGreen)    // real photons
    559377                            *TMath::Power(10,gkCalibrationBlindPixelAttGreen) // correct for absorption
    560                             / gkCalibrationBlindPixelArea;          // correct for area
     378                            * gkCalibrationInnerPixelArea;                    // correct for area
    561379      break;
    562380    case kECBlue:
    563       fMeanNrPhotInnerPix = (mean / gkCalibrationBlindPixelQEBlue )
     381      fMeanPhotInsidePlexiglass = (mean / gkCalibrationBlindPixelQEBlue )
    564382                            *TMath::Power(10,gkCalibrationBlindPixelAttBlue)
    565                             / gkCalibrationBlindPixelArea;
     383                            * gkCalibrationInnerPixelArea;
    566384      break;
    567385    case kECUV:
    568       fMeanNrPhotInnerPix = (mean / gkCalibrationBlindPixelQEUV )
     386      fMeanPhotInsidePlexiglass = (mean / gkCalibrationBlindPixelQEUV )
    569387                            *TMath::Power(10,gkCalibrationBlindPixelAttUV)
    570                             / gkCalibrationBlindPixelArea;
     388                            * gkCalibrationInnerPixelArea;
    571389      break;
    572390    case kECCT1:
    573391    default:
    574       fMeanNrPhotInnerPix = (mean / gkCalibrationBlindPixelQECT1 )
     392      fMeanPhotInsidePlexiglass = (mean / gkCalibrationBlindPixelQECT1 )
    575393                            *TMath::Power(10,gkCalibrationBlindPixelAttCT1)
    576                             / gkCalibrationBlindPixelArea;
    577       break;
    578     }
    579 
    580   fMeanNrPhotAvailable = kTRUE;
     394                            * gkCalibrationInnerPixelArea;
     395      break;
     396    }
     397
     398  fNumPhotInsidePlexiglassAvailable = kTRUE;
    581399
    582400  TIter Next(fPixels);
     
    585403    {
    586404     
    587       if((pix->GetCharge() > 0.) && (fMeanNrPhotInnerPix > 0.))
    588         pix->SetConversionBlindPixelMethod(fMeanNrPhotInnerPix/pix->GetCharge(), 0., 0.);
     405      if((pix->GetCharge() > 0.) && (fMeanPhotInsidePlexiglass > 0.))
     406        pix->SetConversionBlindPixelMethod(fMeanPhotInsidePlexiglass/pix->GetCharge(), 0., 0.);
    589407    }
    590408  return kTRUE;
     
    592410
    593411
     412Bool_t MCalibrationCam::CalcNumPhotOutsidePlexiglass()
     413{
     414
     415  if (!fPINDiode->IsFitOK())
     416    return kFALSE;
     417 
     418  const Float_t mean = fPINDiode->GetMean();
     419  const Float_t merr = fPINDiode->GetMeanError();
     420 
     421  switch (fColor)
     422    {
     423    case kECGreen:
     424      fMeanPhotOutsidePlexiglass = (mean / gkCalibrationPINDiodeQEGreen)   // real photons
     425                            * gkCalibrationInnerPixelvsPINDiodeArea;        // correct for area
     426      break;
     427    case kECBlue:
     428      fMeanPhotOutsidePlexiglass = (mean / gkCalibrationPINDiodeQEBlue )
     429                            * gkCalibrationInnerPixelvsPINDiodeArea;
     430      break;
     431    case kECUV:
     432      fMeanPhotOutsidePlexiglass = (mean / gkCalibrationPINDiodeQEUV )
     433                            * gkCalibrationInnerPixelvsPINDiodeArea;
     434      break;
     435    case kECCT1:
     436    default:
     437      fMeanPhotOutsidePlexiglass = (mean / gkCalibrationPINDiodeQECT1 )
     438                            * gkCalibrationInnerPixelvsPINDiodeArea;
     439      break;
     440    }
     441
     442  fNumPhotOutsidePlexiglassAvailable = kTRUE;
     443
     444  TIter Next(fPixels);
     445  MCalibrationPix *pix;
     446  while ((pix=(MCalibrationPix*)Next()))
     447    {
     448     
     449      if((pix->GetCharge() > 0.) && (fMeanPhotInsidePlexiglass > 0.))
     450        pix->SetConversionPINDiodeMethod(fMeanPhotOutsidePlexiglass/pix->GetCharge(), 0., 0.);
     451    }
     452  return kTRUE;
     453}
     454
     455
     456
    594457Bool_t MCalibrationCam::GetConversionFactorBlindPixel(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
    595458{
     
    598461    return kFALSE;
    599462
    600   if (!fMeanNrPhotAvailable)
    601     if (!CalcNrPhotInnerPixel())
     463  if (!fNumPhotInsidePlexiglassAvailable)
     464    if (!CalcNumPhotInsidePlexiglass())
    602465      return kFALSE;
    603466
     
    666529
    667530}
     531
     532
     533void MCalibrationCam::DrawHiLoFits()
     534{
     535
     536  if (!fOffsets)
     537    fOffsets = new TH1D("pp","Offsets of the HiGain LoGain Fit",100,-600.,400.);
     538  if (!fSlopes)
     539    fSlopes  = new TH1D("mm","Slopes of the HiGain LoGain Fit",100,-2.,2.);
     540  if (!fOffvsSlope)
     541    fOffvsSlope = new TH2D("aa","Slopes vs Offsets of the HiGain LoGain Fit",100,-600.,400.,100,-2.,2.);
     542
     543  TIter Next(fPixels);
     544  MCalibrationPix *pix;
     545  MHCalibrationPixel *hist;
     546  while ((pix=(MCalibrationPix*)Next()))
     547    {
     548      hist = pix->GetHist();
     549      hist->FitHiGainvsLoGain();
     550      fOffsets->Fill(hist->GetOffset(),1.);
     551      fSlopes->Fill(hist->GetSlope(),1.);
     552      fOffvsSlope->Fill(hist->GetOffset(),hist->GetSlope(),1.);
     553    }
     554
     555   TCanvas *c1 = new TCanvas();
     556
     557   c1->Divide(1,3);
     558   c1->cd(1);
     559   fOffsets->Draw();
     560   gPad->Modified();
     561   gPad->Update();
     562
     563   c1->cd(2);
     564  fSlopes->Draw();
     565  gPad->Modified();
     566  gPad->Update();
     567
     568  c1->cd(3);
     569  fOffvsSlope->Draw("col1");
     570  gPad->Modified();
     571  gPad->Update();
     572}
     573
  • trunk/MagicSoft/Mars/manalysis/MCalibrationCam.h

    r2665 r2679  
    4444 
    4545  Int_t fNumPixels;
    46   TClonesArray *fPixels;             //! FIXME: Change TClonesArray away from a pointer?
     46  TClonesArray *fPixels;                      // Array of MCalibrationPix with fit results
    4747 
    48   MCalibrationBlindPix *fBlindPixel; //! containing blind pixel data with fitresults
    49   MCalibrationPINDiode *fPINDiode;   //! containing PIN Diode data with fit results   
     48  MCalibrationBlindPix *fBlindPixel;          // Pointer to the Blind Pixel with fit results
     49  MCalibrationPINDiode *fPINDiode;            // Pointer to the PIN Diode with fit results   
    5050
    51   Bool_t  fMeanNrPhotAvailable;
    52   Float_t fMeanNrPhotInnerPix;       // The mean number of photons in an inner pixel 
    53   Float_t fMeanNrPhotInnerPixErr;    // The uncertainty about the number of photons in an inner pixel 
     51  Bool_t  fNumPhotInsidePlexiglassAvailable;  // TRUE: Blind Pixel could have been fitted well
     52  Float_t fMeanPhotInsidePlexiglass;          //  The mean number of photons in an INNER PIXEL inside the plexiglass
     53  Float_t fMeanPhotErrInsidePlexiglass;       //  The uncertainty about the number of photons in an INNER PIXEL 
    5454
    55   TH1F* fHChargeAllPixels;
    56   TH1F* fHChargeErrAllPixels;
    57   TH1F* fHChargeSigmaAllPixels;
    58   TH1F* fHChargeProbAllPixels;
     55  Bool_t  fNumPhotOutsidePlexiglassAvailable; // TRUE: PIN Diode could have been fitted well
     56  Float_t fMeanPhotOutsidePlexiglass;         //  The mean number of photons in an INNER PIXEL outside the plexiglass
     57  Float_t fMeanPhotErrOutsidePlexiglass;      //  The uncertainty about the number of photons in an INNER PIXEL 
    5958
    60   TH1F* fHTimeAllPixels;
    61   TH1F* fHTimeSigmaAllPixels;
    62   TH1F* fHTimeProbAllPixels;
     59  TH1F* fHChargeAllPixels;                     //!
     60  TH1F* fHChargeErrAllPixels;                  //!
     61  TH1F* fHChargeSigmaAllPixels;                //!
     62  TH1F* fHChargeProbAllPixels;                 //!
    6363
    64   TH1F* fHPedAllPixels;
    65   TH1F* fHPedRMSAllPixels;
     64  TH1F* fHTimeAllPixels;                       //!
     65  TH1F* fHTimeSigmaAllPixels;                  //!
     66  TH1F* fHTimeProbAllPixels;                   //!
    6667
    67   TH1F* fHSigmaPerChargeAllPixels;
    68   TH1F* fHPhEAllPixels;
     68  TH1F* fHPedAllPixels;                        //!
     69  TH1F* fHPedRMSAllPixels;                     //!
     70  TH1F* fHSigmaPerChargeAllPixels;             //!
     71  TH1F* fHPhEAllPixels;                        //!
    6972
    70   TH1F* fHConvPhEperFADCAllPixels;
    71   TH1F* fHConvPhperFADCAllPixels;
     73  TH1F* fHConvPhEperFADCAllPixels;             //!
     74  TH1F* fHConvPhperFADCAllPixels;              //!
    7275
    73   TH1D* fOffsets;
    74   TH1D* fSlopes;
     76  TH1D* fOffsets;                              //!
     77  TH1D* fSlopes;                               //!
    7578 
    76   TH2D* fOffvsSlope;
     79  TH2D* fOffvsSlope;                           //!
    7780
    7881public:
     
    102105  MCalibrationPix &operator[](Int_t i) const;
    103106 
    104   UShort_t FitCharge(Int_t i=-1);
    105   UShort_t FitAllCharge();
    106   UShort_t FitTime(Int_t i=-1);
    107   UShort_t FitAllTime();
    108  
    109107  Bool_t CheckBounds(Int_t i) const;
    110108
     
    113111  void CutEdges();
    114112 
    115   Bool_t CalcNrPhotInnerPixel();
    116113  Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
    117114  void   DrawPixelContent(Int_t num) const;   
     
    127124  Bool_t GetConversionFactorPINDiode(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma);
    128125  Bool_t GetConversionFactorCombined(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma);
    129  
     126
     127  Bool_t CalcNumPhotInsidePlexiglass();
     128  Bool_t CalcNumPhotOutsidePlexiglass();
     129
    130130  void DrawHiLoFits();
    131131
  • trunk/MagicSoft/Mars/manalysis/MCalibrationConfig.h

    r2627 r2679  
    33
    44/////////////////////////////////////////////////////////////////////////////
    5 //                                                                         //
    6 // MCalibrationConfig                                                      //
    7 //                                                                         //
    8 // Contains all configuration data of the Calibration                      //
    9 //                                                                         //
     5//                                                                         
     6// MCalibrationConfig                                                     
     7//
     8// Contains all configuration data of the Calibration         
     9//                                                             
     10// This file is only TEMPORARY. It values will go into the DATABASE
     11//
    1012/////////////////////////////////////////////////////////////////////////////
    1113
     
    3739const Float_t gkCalibrationBlindPixelAttCT1   = 1.95;
    3840
    39 // Area of Blind Pixel w.r.t. Inner Pixel
    40 const Float_t gkCalibrationBlindPixelArea     = 0.25;
    41 
     41//
     42// Area of Inner Pixel w.r.t. Blind Pixel (which is 1 cm²)
     43//
     44// Hexagone of diagonal axis b = 3.5 cm
     45//             straight axis a = 3.0 cm +- 2%
     46// Area =  sqrt(3)*a²/2 = 7.79 cm² +- 4% = 7.8 +- 0.3 cm²
     47//
     48const Float_t gkCalibrationInnerPixelArea      = 7.8;
     49const Float_t gkCalibrationInnerPixelAreaError = 0.3;
     50//
    4251// Area of Outer Pixel w.r.t. Inner Pixel
    43 const Float_t gkCalibrationOuterPixelArea     = 4.00;
     52//
     53// Hexagone of diagonal axis b = 7.0 cm
     54//             straight axis a = 6.0 cm +- 1%
     55// Area = sqrt(3)*a²/2 =
     56//
     57const Float_t gkCalibrationOutervsInnerPixelArea      = 4.00;
     58const Float_t gkCalibrationOutervsInnerPixelAreaError = 0.00;
    4459
    4560// ----- PIN DIODE ------------------------//
     
    4863const UShort_t gkCalibrationPINDiodeId = 9999;
    4964
    50 #endif /* MARS_MCalibrationBlindPixelConfig */
     65//
     66// Area of Inner Pixel w.r.t. PIN Diode (which is 1 cm²)
     67//
     68// Hexagone of diagonal axis b = 3.5 cm
     69//             straight axis a = 3.0 cm +- 2%
     70// Area =  sqrt(3)*a²/2 = 7.79 cm² +- 4% = 7.8 +- 0.3 cm²
     71//
     72// Distance of PIN Diode to pulser D1:   1.5  +- 0.3 m
     73// Distance of Inner Pixel to pulser D2: 18.0 +- 0.5 m
     74//
     75//
     76//                A(Inner Pixel)    D1²
     77// conversion C = -------------- * ----- = 0.054
     78//                A(PIN Diode)      D2²
     79//
     80// Delta C / C  = sqrt((Delta A(IP)/A(IP))² + 4 * ( (Delta D1/D1)² + (Delta D2/D2)² )
     81// Delta C / C  = 0.4
     82//
     83// C = 0.05 +- 0.02
     84//
     85const Float_t gkCalibrationInnerPixelvsPINDiodeArea      = 0.05;
     86const Float_t gkCalibrationInnerPixelvsPINDiodeAreaError = 0.02;
     87
     88// Average QE of the PIN Diode
     89const Float_t gkCalibrationPINDiodeQEGreen = -1.0;
     90const Float_t gkCalibrationPINDiodeQEBlue  = -1.0;
     91const Float_t gkCalibrationPINDiodeQEUV    = -1.0;
     92const Float_t gkCalibrationPINDiodeQECT1   = -1.0;
     93
     94
     95#endif /* MARS_MCalibrationConfig */
  • trunk/MagicSoft/Mars/manalysis/MCalibrationPINDiode.h

    r2627 r2679  
    2323  Float_t fErrTime;             // The error of the mean arrival time after the fit
    2424 
    25   Float_t fRCharge;               // The reduced mean charge after the fit
    26   Float_t fErrRCharge;            // The error of the reduced mean charge after the fit 
    27  
    2825public:
    2926
     
    3633  void SetPedRms(Float_t pedrms)    { fPedRms   = pedrms; }
    3734
    38   Bool_t IsValid() const { return fRCharge >=0 || fErrRCharge >= 0; }
     35  Float_t GetMean()           const { return fCharge; }
     36  Float_t GetMeanError()      const { return fErrCharge; }
     37
     38  Bool_t IsFitOK() const            { return fCharge > 0 && fErrCharge > 0; }
    3939
    4040  Bool_t FillCharge(Float_t q)      { return fHist->FillChargeHiGain(q); }
  • trunk/MagicSoft/Mars/manalysis/MCalibrationPix.cc

    r2666 r2679  
    111111  if (fPed && fPedRms)
    112112    fHist->SetLowerFitRange(1.5*fPedRms);
    113 
    114113  else
    115114    *fLog << warn << "Cannot set lower fit range to suppress cosmics: Pedestals not available" << endl;
    116 
    117115
    118116  if (fHist->UseLoGain())
  • trunk/MagicSoft/Mars/manalysis/MCalibrationPix.h

    r2666 r2679  
    6868  Float_t GetTimeChiSquare()  const    { return fTimeChiSquare;  }   
    6969 
    70   Float_t GetPed()            const    { return fPed;            }
     70 Float_t GetPed()            const    { return fPed;            }
    7171  Float_t GetPedRms()         const    { return fPedRms;         }   
    7272
     
    127127  void Draw(Option_t *opt="")           { fHist->Draw(opt); }
    128128 
    129  
    130129  ClassDef(MCalibrationPix, 1)  // Storage Container for Calibration information of one pixel
    131130};
Note: See TracChangeset for help on using the changeset viewer.