Changeset 5652


Ignore:
Timestamp:
12/21/04 10:27:42 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mcalib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityChargeCam.cc

    r5651 r5652  
    4646#include "MGeomPix.h"
    4747
     48#include "MLog.h"
     49
    4850#include <TOrdCollection.h>
    4951#include <TGraphErrors.h>
     
    147149// -------------------------------------------------------------------
    148150//
    149 // Returns a TGraphErrors with the number of photo-electrons vs.
    150 // the extracted signal of pixel "pixid".
    151 //
    152 TGraphErrors *MCalibrationIntensityChargeCam::GetPhePerCharge( const UInt_t pixid, const MCalibrationCam::PulserColor_t col)
    153 {
    154  
    155   Int_t size = 0;
    156  
    157   if (col == MCalibrationCam::kNONE)
    158     size = GetSize();
    159   else
    160     for (Int_t i=0;i<GetSize();i++)
    161       {
    162         MCalibrationChargeCam *cam = (MCalibrationChargeCam*)GetCam(i);
    163         if (cam->GetPulserColor() == col)
    164           size++;
    165       }
    166 
     151// Returns a TGraphErrors with the mean effective number of photo-electrons divided by
     152// the mean charge of that pixel vs. the mean number of photo-electrons.
     153//
     154TGraphErrors *MCalibrationIntensityChargeCam::GetPhePerCharge( const UInt_t pixid, const MGeomCam &geom, const MCalibrationCam::PulserColor_t col)
     155{
     156 
     157  Int_t size = CountNumValidEntries(pixid,col);
     158 
    167159  if (size == 0)
    168160    return NULL;
     
    173165  TArrayF sigerr(size);
    174166 
    175   for (Int_t i=0;i<size;i++)
     167  Int_t cnt = 0;
     168
     169  for (Int_t i=0;i<GetSize();i++)
    176170    {
    177171      //
     
    186180      // Get the calibration pix from the calibration cam
    187181      //
    188       MCalibrationChargePix &pix = (MCalibrationChargePix&)(*cam)[pixid];
     182      const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*cam)[pixid];
    189183      //
    190184      // Don't use bad pixels
     
    196190      // converted value!
    197191      //
    198       sig   [i] = pix.GetConvertedMean();
    199       sigerr[i] = pix.GetConvertedMeanErr();
    200       //
    201       const Float_t phe = pix.GetPheFFactorMethod();
    202       const Float_t err = pix.GetPheFFactorMethodErr();
     192      const Int_t aidx = geom[pixid].GetAidx();
     193      const MCalibrationChargePix &apix = (MCalibrationChargePix&)cam->GetAverageArea(aidx);
     194
     195      const Float_t q    = pix.GetConvertedMean();
     196      const Float_t qerr = pix.GetConvertedMeanErr();
     197      //
     198      const Float_t phe = apix.GetPheFFactorMethod();
     199      const Float_t err = apix.GetPheFFactorMethodErr();
     200
     201      sig[cnt]       = q;
     202      sigerr[cnt]    = qerr;
     203      phepersig[cnt] = q > 0.00001 ? phe/q : -1.;
     204
    203205      Float_t var = 0.;
    204      
    205       phepersig[i]    = sig[i] > 0. ? pix.GetPheFFactorMethod()/sig[i] : -1.;
    206       if (sig[i] > 0. && phe > 0.)
     206
     207      if (q > 0.00001 && phe > 0.00001)
    207208        {
    208           var = err * err / phe / phe + sigerr[i]*sigerr[i]/sig[i]/sig[i];
    209           if (var > 0.001)
    210             var = TMath::Sqrt(var)*phepersig[i];
     209          var = err * err / phe / phe + qerr*qerr/q/q;
     210          if (var > 0.00001)
     211            var = TMath::Sqrt(var)*phepersig[cnt];
    211212        }
    212       phepersigerr[i] = var;
     213      phepersigerr[cnt] = var;
     214      cnt++;
    213215    }
    214216 
     
    217219                                     sigerr.GetArray(),phepersigerr.GetArray());
    218220  gr->SetTitle(Form("%s%3i","Pixel ",pixid));
    219   gr->GetXaxis()->SetTitle("Q [FADC counts]");
    220   gr->GetYaxis()->SetTitle("photo-electrons / Q [FADC cts ^{-1}]");     
     221  gr->GetXaxis()->SetTitle("<photo-electrons> [1]");
     222  gr->GetYaxis()->SetTitle("<photo-electrons> / Q [FADC cts^{-1}]");     
    221223  return gr;
    222224}
     
    412414
    413415
    414 Int_t MCalibrationIntensityChargeCam::CountNumValidEntries(const UInt_t pixid, const MCalibrationCam::PulserColor_t col)
     416Int_t MCalibrationIntensityChargeCam::CountNumValidEntries(const UInt_t pixid, const MCalibrationCam::PulserColor_t col) const
    415417{
    416418
     
    420422    {
    421423      const MCalibrationChargeCam *cam = (MCalibrationChargeCam*)GetCam(i);
    422       const MCalibrationChargePix  &pix    = (MCalibrationChargePix&)(*cam)[pixid];
     424      const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*cam)[pixid];
    423425
    424426      if (col == MCalibrationCam::kNONE)
    425         if (pix.IsFFactorMethodValid())
    426           nvalid++;
    427       else
    428         if (cam->GetPulserColor() == col)
     427        {
    429428          if (pix.IsFFactorMethodValid())
    430429            nvalid++;
    431     }
     430        }
     431      else
     432        {
     433          if (cam->GetPulserColor() == col)
     434            {
     435              if (pix.IsFFactorMethodValid())
     436                nvalid++;
     437            }
     438        }
     439    }
     440 
    432441  return nvalid;
    433442}
  • trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityChargeCam.h

    r5651 r5652  
    4444    ((MCalibrationChargeCam*)GetCam())->SetNumPhotonsPINDiodeMethodErr(f); }   
    4545
    46   Int_t CountNumValidEntries(const UInt_t pixid, const MCalibrationCam::PulserColor_t col=MCalibrationCam::kNONE);
     46  Int_t CountNumValidEntries(const UInt_t pixid, const MCalibrationCam::PulserColor_t col=MCalibrationCam::kNONE) const;
    4747 
    4848  TGraphErrors *GetRazmikPlot( const UInt_t pixid );
    4949  TGraphErrors *GetPheVsCharge( const UInt_t pixid, const MCalibrationCam::PulserColor_t col=MCalibrationCam::kNONE);
    50   TGraphErrors *GetPhePerCharge( const UInt_t pixid, const MCalibrationCam::PulserColor_t col=MCalibrationCam::kNONE);
     50  TGraphErrors *GetPhePerCharge( const UInt_t pixid, const MGeomCam &geom, const MCalibrationCam::PulserColor_t col=MCalibrationCam::kNONE);
    5151  TGraphErrors *GetPheVsChargePerArea( const Int_t aidx, const MCalibrationCam::PulserColor_t col=MCalibrationCam::kNONE);
    5252  TH2F         *GetRazmikPlotResults( const Int_t aidx, const MGeomCam &geom );
Note: See TracChangeset for help on using the changeset viewer.