Changeset 4986 for trunk/MagicSoft


Ignore:
Timestamp:
09/14/04 00:11:10 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
10 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4983 r4986  
    3232
    3333 2004/09/13: Markus Gaug
    34  
     34 
     35   * mjobs/MJCalibration.[h,cc]
     36     - added MCalibrationIntensityBlindCam
     37     - replaced MCalibrationChargeBlindCam by MCalibrationBlindCam
     38
     39   * mcalib/MCalibrationPix.[h,cc]
     40     - added Copy function
     41
     42   * mcalib/MCalibrationIntensityBlindCam.[h,cc]
     43     - new class for Intensity calibration
     44
     45   * mcalib/MCalibrationBlindCam.[h,cc]
     46   * mcalib/MCalibrationBlindPix.[h,cc]
     47     - new containers based on MCalibrationCam and MCalibrationPix.
     48     - similiar to MCalibrationChargePix and MCalibrationChargeCam, but
     49       slightly different data members. In order not to get confused with
     50       already stored data, this is for the moment a second, equivalent
     51       class.
     52 
     53   * mcalib/MCalibrationChargeCalc.[h,cc]
     54     - added Intenisty Calibration for blind pixel
     55     - take new MCalibrationBlindCam instead of MCalibrationChargeBlindCam
     56
     57   * mcalib/MCalibrationCam.cc
     58   * mcalib/MCalibrationChargeCam.cc
     59   * mcalib/MCalibrationQECam.cc
     60   * mcalib/MCalibrationRelTimeCam.cc
     61     - initialize fAverageBadPixels in derived classes
     62
     63   * mhcalib/MHCalibrationChargeBlindCam.[h,cc]
     64   * mhcalib/MHCalibrationChargeBlindPix.[h,cc]
     65     - derive class from MHCalibrationCam now and treat pointers
     66       like done in MHCalibrationChargeCam
     67     - implement Intensity Calibration
     68     - write results to MCalibrationBlindCam instead of
     69       MCalibrationChargeBlindCam
     70
     71
    3572   * mhcalib/MHCalibrationCam.h
    3673     - took out the "->" for all pointers
     
    3875       kLoGain, kOscillations, kAverageing, kSizeCheck
    3976
    40    * mhcalib/MHCalibrationBlindCam.h
    41      - took out the "->" for all pointers
    42              
    4377   * mhcalib/MHCalibrationChargeCam.[h,cc]
    4478     - wrote a ReadEnv function
  • trunk/MagicSoft/Mars/mcalib/CalibLinkDef.h

    r4933 r4986  
    1414#pragma link C++ class MCalibrationIntensityCam+;
    1515#pragma link C++ class MCalibrationIntensityChargeCam+;
     16#pragma link C++ class MCalibrationIntensityBlindCam+;
    1617#pragma link C++ class MCalibrationIntensityQECam+;
    1718#pragma link C++ class MCalibrationIntensityRelTimeCam+;
     
    3132#pragma link C++ class MCalibrationChargeCam+;
    3233#pragma link C++ class MCalibrationChargePix+;
     34#pragma link C++ class MCalibrationBlindCam+;
     35#pragma link C++ class MCalibrationBlindPix+;
     36#pragma link C++ class MCalibrationBlindCamOneOldStyle+;
     37#pragma link C++ class MCalibrationBlindCamTwoNewStyle+;
    3338#pragma link C++ class MCalibrationChargeBlindCamOneOldStyle+;
    3439#pragma link C++ class MCalibrationChargeBlindCamTwoNewStyle+;
  • trunk/MagicSoft/Mars/mcalib/MCalibrationCam.cc

    r4967 r4986  
    8989MCalibrationCam::MCalibrationCam(const char *name, const char *title)
    9090    : fPulserColor(kNONE),
    91       fPixels(NULL), fAverageAreas(NULL), fAverageSectors(NULL)
    92 {
    93 
    94   fAverageBadAreas    = new TClonesArray("MBadPixelsPix",1);
    95   fAverageBadSectors  = new TClonesArray("MBadPixelsPix",1);
     91      fPixels(NULL), fAverageAreas(NULL), fAverageSectors(NULL),
     92      fAverageBadAreas(NULL), fAverageBadSectors(NULL)
     93{
    9694
    9795  fNumHiGainFADCSlices.Set(1);
     
    125123    delete fAverageSectors;
    126124
    127   delete fAverageBadAreas;
    128   delete fAverageBadSectors;
     125  if (fAverageBadAreas)
     126    delete fAverageBadAreas;
     127
     128  if (fAverageBadSectors)
     129    delete fAverageBadSectors;
    129130 
    130131}
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc

    r4967 r4986  
    1 /* ======================================================================== *\
     1 /* ======================================================================== *\
    22!
    33! *
     
    208208#include "MCalibrationChargePix.h"
    209209#include "MCalibrationChargePINDiode.h"
    210 #include "MCalibrationChargeBlindPix.h"
    211 #include "MCalibrationChargeBlindCam.h"
     210#include "MCalibrationBlindPix.h"
     211#include "MCalibrationBlindCam.h"
    212212
    213213#include "MExtractedSignalCam.h"
     
    317317    fCam        = NULL;
    318318    fIntensCam  = NULL;
    319     fBlindPixel = NULL;
    320319    fBlindCam   = NULL;
    321320    fPINDiode   = NULL;
     
    404403//
    405404// Search for the following input containers and give a warning if not existing:
    406 //  - MCalibrationChargeBlindPix
     405//  - MCalibrationBlindPix
    407406//  - MCalibrationChargePINDiode
    408407//
     
    426425//
    427426// - MCalibrationChargeCam
    428 // - MCalibrationChargeBlindPix (if existing)
     427// - MCalibrationBlindPix (if existing)
    429428// - MCalibrationChargePINDiode (if existing)
    430429//
     
    456455  // Optional Containers
    457456  //
    458   fBlindPixel = (MCalibrationChargeBlindPix*)pList->FindObject("MCalibrationChargeBlindPix");
    459   if (!fBlindPixel)
    460     {
    461       fBlindCam = (MCalibrationChargeBlindCam*)pList->FindObject("MCalibrationChargeBlindCam");
    462       if (!fBlindCam)
    463         {
     457  fBlindCam = (MCalibrationBlindCam*)pList->FindObject("MCalibrationBlindCam");
     458  if (!fBlindCam)
     459    {
    464460      *fLog << endl;
    465461      *fLog << warn << GetDescriptor()
    466             << ": MCalibrationChargeBlindPix nor MCalibrationChargeBlindCam "
     462            << ": MCalibrationBlindPix nor MCalibrationBlindCam "
    467463            << " found... no Blind Pixel method! " << endl;
    468         }
    469     }
    470  
     464    }
     465
    471466  fPINDiode = (MCalibrationChargePINDiode*)pList->FindObject("MCalibrationChargePINDiode");
    472467  if (!fPINDiode)
     
    603598    fCam->SetPulserColor( fPulserColor );
    604599 
    605   if (fBlindPixel)
    606     fBlindPixel->SetColor( fPulserColor );
    607  
    608600  if (fBlindCam)
    609     fBlindCam->SetColor( fPulserColor );
     601    fBlindCam->SetPulserColor( fPulserColor );
    610602 
    611603  if (fPINDiode)
     
    640632// 
    641633// Call MParContainer::SetReadyToSave() for fIntensCam, fCam, fQECam, fBadPixels and
    642 //                                          fBlindPixel and fPINDiode if they exist
     634//                                          fBlindCam and fPINDiode if they exist
    643635//
    644636// Print out some statistics
     
    658650              << ": MCalibrationChargePINDiode is declared not valid... no PIN Diode method! " << endl;
    659651        fPINDiode = NULL;
    660       }
    661 
    662   if (fBlindPixel)
    663     if (!fBlindPixel->IsValid())
    664       {
    665         *fLog << warn << GetDescriptor()
    666               << ": MCalibrationChargeBlindPix is declared not valid... no Blind Pixel method! " << endl;
    667         fBlindPixel = NULL;
    668652      }
    669653
     
    766750  // Finalize Blind Pixel
    767751  //
    768   if (fBlindPixel)
    769     if (FinalizeBlindPixel())
    770       fQECam->SetBlindPixelMethodValid(kTRUE);
    771     else
    772       fQECam->SetBlindPixelMethodValid(kFALSE);
    773   else
    774     if (FinalizeBlindCam())
    775       fQECam->SetBlindPixelMethodValid(kTRUE);
    776     else
    777       fQECam->SetBlindPixelMethodValid(kFALSE);
     752  if (FinalizeBlindCam())
     753    fQECam->SetBlindPixelMethodValid(kTRUE);
     754  else
     755    fQECam->SetBlindPixelMethodValid(kFALSE);
    778756
    779757  //
     
    812790  fBadPixels->SetReadyToSave();
    813791
    814   if (fBlindPixel)
    815     fBlindPixel->SetReadyToSave();
    816792  if (fBlindCam)
    817793    fBlindCam->SetReadyToSave();
     
    14071383
    14081384
     1385
    14091386// ------------------------------------------------------------------------
    14101387//
    1411 // Returns kFALSE if pointer to MCalibrationChargeBlindPix is NULL
     1388// Returns kFALSE if pointer to MCalibrationBlindCam is NULL
    14121389//
    14131390// The check returns kFALSE if:
     
    14171394//
    14181395// Calls:
    1419 // - MCalibrationChargeBlindPix::CalcFluxInsidePlexiglass()
    1420 //
    1421 Bool_t MCalibrationChargeCalc::FinalizeBlindPixel()
    1422 {
    1423 
    1424   if (!fBlindPixel)
    1425     return kFALSE; 
    1426 
    1427   const Float_t lambda      = fBlindPixel->GetLambda();
    1428   const Float_t lambdaerr   = fBlindPixel->GetLambdaErr();
    1429   const Float_t lambdacheck = fBlindPixel->GetLambdaCheck();
    1430 
    1431   if (2.*(lambdacheck-lambda)/(lambdacheck+lambda) > fLambdaCheckLimit)
    1432     {
    1433       *fLog << warn << GetDescriptor()
    1434             << Form("%s%4.2f%s%4.2f%s%4.2f%s",": Lambda: ",lambda," and Lambda-Check: ",
    1435                     lambdacheck," differ by more than ",fLambdaCheckLimit," in the Blind Pixel ")
    1436             << endl;
    1437       return kFALSE;
    1438     }
    1439  
    1440   if (lambdaerr > fLambdaErrLimit)
    1441     {
    1442       *fLog << warn << GetDescriptor()
    1443             << Form("%s%4.2f%s%4.2f%s",": Error of Fitted Lambda: ",lambdaerr," is greater than ",
    1444                     fLambdaErrLimit," in Blind Pixel ") << endl;
    1445       return kFALSE;
    1446     }
    1447      
    1448   if (!fBlindPixel->CalcFluxInsidePlexiglass())
    1449     {
    1450       *fLog << warn << "Could not calculate the flux of photons from the Blind Pixel, "
    1451             << "will skip Blind Pixel Calibration " << endl;
    1452       return kFALSE;
    1453     }
    1454  
    1455   return kTRUE;
    1456 }
    1457 
    1458 // ------------------------------------------------------------------------
    1459 //
    1460 // Returns kFALSE if pointer to MCalibrationChargeBlindCam is NULL
    1461 //
    1462 // The check returns kFALSE if:
    1463 //
    1464 // 1) fLambda and fLambdaCheck are separated relatively to each other by more than fLambdaCheckLimit
    1465 // 2) BlindPixel has an fLambdaErr greater than fLambdaErrLimit
    1466 //
    1467 // Calls:
    1468 // - MCalibrationChargeBlindPix::CalcFluxInsidePlexiglass()
     1396// - MCalibrationBlindPix::CalcFluxInsidePlexiglass()
    14691397//
    14701398Bool_t MCalibrationChargeCalc::FinalizeBlindCam()
     
    14781406  Int_t   nvalid  = 0;
    14791407
    1480   for (UInt_t i=0; i<fBlindCam->GetNumBlindPixels(); i++)
    1481     {
    1482      
    1483       MCalibrationChargeBlindPix &blindpix = (*fBlindCam)[i];
     1408  for (Int_t i=0; i<fBlindCam->GetSize(); i++)
     1409    {
     1410     
     1411      MCalibrationBlindPix &blindpix = (MCalibrationBlindPix&)(*fBlindCam)[i];
    14841412
    14851413      if (!blindpix.IsValid())
     
    18581786// Loop over pixels:
    18591787//
    1860 // - Continue, if not MCalibrationChargeBlindPix::IsFluxInsidePlexiglassAvailable() and set:
     1788// - Continue, if not MCalibrationBlindPix::IsFluxInsidePlexiglassAvailable() and set:
    18611789//                    MCalibrationQEPix::SetBlindPixelMethodValid(kFALSE,fPulserColor)
    18621790//
    18631791// - Calculate the quantum efficiency with the formula:
    18641792//
    1865 //   QE =  Num.Phes / MCalibrationChargeBlindPix::GetFluxInsidePlexiglass()
     1793//   QE =  Num.Phes / MCalibrationBlindPix::GetFluxInsidePlexiglass()
    18661794//        / MGeomPix::GetA() * MCalibrationQECam::GetPlexiglassQE()
    18671795//
     
    18801808  // Set the results in the MCalibrationChargeCam
    18811809  //
     1810  /*
    18821811  if (fBlindPixel)
    18831812    {
     
    19011830        }
    19021831    }
     1832  */
    19031833  //
    19041834  //  With the knowledge of the overall photon flux, calculate the
     
    19101840      MCalibrationQEPix   &qepix = (MCalibrationQEPix&)  (*fQECam)[i];
    19111841
    1912       if (!fBlindPixel)
     1842      if (!fBlindCam)
    19131843        {
    19141844          qepix.SetBlindPixelMethodValid(kFALSE, fPulserColor);
     
    19161846        }
    19171847
     1848      /*
    19181849      if (!fBlindPixel->IsFluxInsidePlexiglassAvailable())
    19191850        {
     
    19211852          continue;
    19221853        }
    1923      
     1854      */     
     1855
    19241856      MBadPixelsPix &bad = (*fBadPixels)[i];
    19251857      if (bad.IsUnsuitable (MBadPixelsPix::kUnsuitableRun))
     
    19351867     
    19361868      const Float_t qe        = pix.GetPheFFactorMethod()
    1937                              / fBlindPixel->GetFluxInsidePlexiglass()
     1869        //                             / fBlindPixel->GetFluxInsidePlexiglass()
    19381870                             / geo.GetA()
    19391871                             * fQECam->GetPlexiglassQE();
    19401872
    1941       const Float_t qerelvar = fBlindPixel->GetFluxInsidePlexiglassRelVar()
    1942                                + fQECam->GetPlexiglassQERelVar()
     1873      const Float_t qerelvar = /* fBlindPixel->GetFluxInsidePlexiglassRelVar()
     1874                                  + */ fQECam->GetPlexiglassQERelVar()
    19431875                               + pix.GetPheFFactorMethodRelVar();
    19441876
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h

    r4947 r4986  
    3131class MPedestalPix;
    3232class MCalibrationChargePINDiode;
    33 class MCalibrationChargeBlindCam;
    34 class MCalibrationChargeBlindPix;
     33class MCalibrationBlindCam;
    3534class MCalibrationChargePix;
    3635class MCalibrationChargeCam;
     
    8483  MCalibrationIntensityChargeCam *fIntensCam;  //  Calibrated Charges of all pixels   
    8584  MCalibrationChargeCam      *fCam;            //  Calibrated Charges of all pixels
    86   MCalibrationChargeBlindPix *fBlindPixel;     //  Calibrated Charges of the Blind Pixel
    87   MCalibrationChargeBlindCam *fBlindCam;       //  Calibrated Charges of the Blind Pixels
     85  MCalibrationBlindCam       *fBlindCam;       //  Calibrated Charges of the Blind Pixels
    8886  MCalibrationChargePINDiode *fPINDiode;       //  Calibrated Charges of the PIN Diode
    8987  MCalibrationQECam          *fQECam;          //  Calibrated Quantum Efficiencies of all pixels
     
    112110  Bool_t FinalizeCharges         ( MCalibrationChargePix &cal, MBadPixelsPix &bad, const char* what);
    113111  Bool_t FinalizePINDiode        ();
    114   Bool_t FinalizeBlindPixel      ();
    115112  Bool_t FinalizeBlindCam        (); 
    116113  Bool_t FinalizeFFactorMethod   ();
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc

    r4967 r4986  
    129129  fTitle = title ? title : "Storage container for the Calibration Information in the camera";
    130130 
    131   fPixels           = new TClonesArray("MCalibrationChargePix",1);
    132   fAverageAreas     = new TClonesArray("MCalibrationChargePix",1);
    133   fAverageSectors   = new TClonesArray("MCalibrationChargePix",1);
     131  fPixels            = new TClonesArray("MCalibrationChargePix",1);
     132  fAverageAreas      = new TClonesArray("MCalibrationChargePix",1);
     133  fAverageSectors    = new TClonesArray("MCalibrationChargePix",1);
     134  fAverageBadAreas   = new TClonesArray("MBadPixelsPix",1);
     135  fAverageBadSectors = new TClonesArray("MBadPixelsPix",1);
    134136
    135137  Clear();
  • trunk/MagicSoft/Mars/mcalib/MCalibrationPix.cc

    r4333 r4986  
    102102}
    103103
     104
     105// -----------------------------------------------------
     106//
     107// copy 'constructor'
     108//
     109void MCalibrationPix::Copy(TObject& object) const
     110{
     111
     112  MCalibrationPix &pix = (MCalibrationPix&)object;
     113
     114  //
     115  // Copy the data members
     116  //
     117  pix.fPixId             = fPixId;
     118  pix.fFlags             = fFlags;
     119  pix.fHiGainMean        = fHiGainMean;
     120  pix.fHiGainMeanVar     = fHiGainMeanVar;
     121  pix.fHiGainNumBlackout = fHiGainNumBlackout;
     122  pix.fHiGainNumPickup   = fHiGainNumPickup;
     123  pix.fHiGainSigma       = fHiGainSigma;
     124  pix.fHiGainSigmaVar    = fHiGainSigmaVar;
     125  pix.fHiGainProb        = fHiGainProb;
     126  pix.fLoGainMean        = fLoGainMean;
     127  pix.fLoGainMeanVar     = fLoGainMeanVar;
     128  pix.fLoGainNumBlackout = fLoGainNumBlackout;
     129  pix.fLoGainNumPickup   = fLoGainNumPickup;
     130  pix.fLoGainSigma       = fLoGainSigma;
     131  pix.fLoGainSigmaVar    = fLoGainSigmaVar;
     132  pix.fLoGainProb        = fLoGainProb;
     133 
     134}
     135
     136
    104137// --------------------------------------------------------------------------
    105138//
  • trunk/MagicSoft/Mars/mcalib/MCalibrationPix.h

    r4333 r4986  
    3434  ~MCalibrationPix() {}
    3535 
    36   virtual void Clear(Option_t *o="");
    37 
     36  void Clear(Option_t *o="");
     37  void Copy(TObject& object) const;
     38 
    3839  // Setter
    3940  void SetPixId( const Int_t i )   { fPixId = i; }
  • trunk/MagicSoft/Mars/mcalib/MCalibrationQECam.cc

    r4882 r4986  
    110110    fTitle = title ? title : "Storage container for the calibrated Quantum Efficiency of the camera";
    111111
    112     fPixels           = new TClonesArray("MCalibrationQEPix",1);
    113     fAverageAreas     = new TClonesArray("MCalibrationQEPix",1);
    114     fAverageSectors   = new TClonesArray("MCalibrationQEPix",1);
     112    fPixels             = new TClonesArray("MCalibrationQEPix",1);
     113    fAverageAreas       = new TClonesArray("MCalibrationQEPix",1);
     114    fAverageSectors     = new TClonesArray("MCalibrationQEPix",1);
     115    fAverageBadAreas    = new TClonesArray("MBadPixelsPix",1);
     116    fAverageBadSectors  = new TClonesArray("MBadPixelsPix",1);
    115117
    116118    fFlags.Set(MCalibrationCam::gkNumPulserColors);
  • trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCam.cc

    r4269 r4986  
    112112  fTitle = title ? title : "Container for Relative Time Calibration Information";
    113113 
    114   fPixels           = new TClonesArray("MCalibrationRelTimePix",1);
    115   fAverageAreas     = new TClonesArray("MCalibrationRelTimePix",1);
    116   fAverageSectors   = new TClonesArray("MCalibrationRelTimePix",1);
     114  fPixels             = new TClonesArray("MCalibrationRelTimePix",1);
     115  fAverageAreas       = new TClonesArray("MCalibrationRelTimePix",1);
     116  fAverageSectors     = new TClonesArray("MCalibrationRelTimePix",1);
     117  fAverageBadAreas    = new TClonesArray("MBadPixelsPix",1);
     118  fAverageBadSectors  = new TClonesArray("MBadPixelsPix",1);
    117119 
    118120}
  • trunk/MagicSoft/Mars/mcalib/MCalibrationTestCam.cc

    r4649 r4986  
    8989  fTitle = title ? title : "Storage container for the Calibration Test Information in the camera";
    9090 
    91   fPixels           = new TClonesArray("MCalibrationTestPix",1);
    92   fAverageAreas     = new TClonesArray("MCalibrationTestPix",1);
    93   fAverageSectors   = new TClonesArray("MCalibrationTestPix",1);
     91  fPixels            = new TClonesArray("MCalibrationTestPix",1);
     92  fAverageAreas      = new TClonesArray("MCalibrationTestPix",1);
     93  fAverageSectors    = new TClonesArray("MCalibrationTestPix",1);
    9494
    9595  Clear();
  • trunk/MagicSoft/Mars/mcalib/Makefile

    r4934 r4986  
    3838           MCalibrationIntensityCam.cc \
    3939           MCalibrationIntensityChargeCam.cc \
     40           MCalibrationIntensityBlindCam.cc \
    4041           MCalibrationIntensityQECam.cc \
    4142           MCalibrationIntensityRelTimeCam.cc \
     
    5556           MCalibrationChargeCam.cc \
    5657           MCalibrationChargePix.cc  \
     58           MCalibrationBlindCam.cc  \
     59           MCalibrationBlindPix.cc  \
     60           MCalibrationBlindCamOneOldStyle.cc  \
     61           MCalibrationBlindCamTwoNewStyle.cc  \
    5762           MCalibrationChargeBlindCamOneOldStyle.cc  \
    5863           MCalibrationChargeBlindCamTwoNewStyle.cc  \
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeBlindCam.cc

    r4964 r4986  
    4040#include "MLogManip.h"
    4141
    42 #include "MCalibrationChargeBlindPix.h"
    43 #include "MCalibrationChargeBlindCam.h"
     42#include "MRawEvtData.h"
     43#include "MRawEvtPixelIter.h"
    4444
    4545#include "MExtractedSignalBlindPixel.h"
    4646
     47#include "MCalibrationBlindPix.h"
     48#include "MCalibrationIntensityBlindCam.h"
     49
    4750#include "MParList.h"
    4851
     
    5255
    5356using namespace std;
    54 
     57const Int_t     MHCalibrationChargeBlindCam::fgNbins    =  128;
     58const Axis_t    MHCalibrationChargeBlindCam::fgFirst    = -0.5;
     59const Axis_t    MHCalibrationChargeBlindCam::fgLast     =  511.5;
     60const Axis_t    MHCalibrationChargeBlindCam::fgSPheCut  =  20.;
     61const TString   MHCalibrationChargeBlindCam::gsHistName   = "ChargeBlind";
     62const TString   MHCalibrationChargeBlindCam::gsHistTitle  = "Signals Blind ";
     63const TString   MHCalibrationChargeBlindCam::gsHistXTitle = "Signal [FADC counts]";
     64const TString   MHCalibrationChargeBlindCam::gsHistYTitle = "Nr. events";
    5565// --------------------------------------------------------------------------
    5666//
     
    6070// - all pointers to NULL
    6171//
    62 // Initializes and sets owner of:
    63 // - fBlindPixelsArray
     72// - fFitFunc to kEPoisson4
     73// - fNbins   to fgNbins
     74// - fFirst   to fgFirst
     75// - fLast    to fgLast
     76// - fSPheCut to fgSPheCut
    6477//
    65 // Sets fFitFunc to kEPoisson4
     78// - fHistName   to gsHistName 
     79// - fHistTitle  to gsHistTitle
     80// - fHistXTitle to gsHistXTitle
     81// - fHistYTitle to gsHistYTitle
     82//
     83// - SetAverageing  (kFALSE);
     84// - SetLoGain      (kFALSE);
     85// - SetOscillations(kFALSE);
     86// - SetSizeCheck   (kFALSE);
    6687//
    6788MHCalibrationChargeBlindCam::MHCalibrationChargeBlindCam(const char *name, const char *title)
    68     :  fCam(NULL), fRunHeader(NULL)
     89    : fRawEvt(NULL)
    6990{
    7091
     
    7293  fTitle = title ? title : "Class to fille the blind pixel histograms";
    7394
    74   fBlindPixelsArray = new TObjArray;
    75   fBlindPixelsArray->SetOwner();
    76 
    77   fFitFunc = MHCalibrationChargeBlindPix::kEPoisson4;
    78 
    79 }
    80 
    81 // --------------------------------------------------------------------------
    82 //
    83 // Deletes the TClonesArray of:
    84 // - fBlindPixelsArray
    85 //
    86 MHCalibrationChargeBlindCam::~MHCalibrationChargeBlindCam()
    87 {
    88   delete fBlindPixelsArray;
    89 }
    90 
    91 // --------------------------------------------------------------------------
    92 //
    93 // Get i-th High Gain pixel (pixel number)
    94 //
    95 MHCalibrationChargeBlindPix &MHCalibrationChargeBlindCam::operator[](UInt_t i)
    96 {
    97   return *static_cast<MHCalibrationChargeBlindPix*>(fBlindPixelsArray->UncheckedAt(i));
    98 }
    99 
    100 // --------------------------------------------------------------------------
    101 //
    102 // Get i-th High Gain pixel (pixel number)
    103 //
    104 const MHCalibrationChargeBlindPix &MHCalibrationChargeBlindCam::operator[](UInt_t i) const
    105 {
    106   return *static_cast<MHCalibrationChargeBlindPix*>(fBlindPixelsArray->UncheckedAt(i));
    107 }
     95  SetFitFunc();
     96  SetSPheCut();
     97
     98  SetNbins(fgNbins);
     99  SetFirst(fgFirst);
     100  SetLast (fgLast );
     101
     102  SetHistName  (gsHistName  .Data());
     103  SetHistTitle (gsHistTitle .Data());
     104  SetHistXTitle(gsHistXTitle.Data());
     105  SetHistYTitle(gsHistYTitle.Data());
     106
     107  SetAverageing  (kFALSE);
     108  SetLoGain      (kFALSE);
     109  SetOscillations(kFALSE);
     110  SetSizeCheck   (kFALSE);
     111}
     112
     113// --------------------------------------------------------------------------
     114//
     115// Gets the pointers to:
     116// - MRawEvtData
     117//
     118Bool_t MHCalibrationChargeBlindCam::SetupHists(const MParList *pList)
     119{
     120
     121  fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
     122  if (!fRawEvt)
     123  {
     124      *fLog << err << dbginf << "MRawEvtData not found... aborting." << endl;
     125      return kFALSE;
     126  }
     127
     128  return kTRUE;
     129}
     130
     131// --------------------------------------------------------------------------
     132//
     133// Gets or creates the pointers to:
     134// - MExtractedSignalBlindPixel
     135// - MCalibrationChargeCam or MCalibrationIntensityBlindCam
     136//
     137// Initializes the number of used FADC slices from MExtractedSignalCam
     138// into MCalibrationChargeCam and test for changes in that variable
     139//
     140// Retrieve:
     141// - fRunHeader->GetNumSamplesHiGain();
     142//
     143// Initializes the High Gain Arrays:
     144//
     145// - Expand fHiGainArrays to nblindpixels
     146//
     147// - For every entry in the expanded arrays:
     148//   * Initialize an MHCalibrationPix
     149//   * Set Binning from  fNbins, fFirst and fLast
     150//   * Set Histgram names and titles from fHistName and fHistTitle
     151//   * Set X-axis and Y-axis titles from fHistXTitle and fHistYTitle
     152//   * Call InitHists
     153//
     154Bool_t MHCalibrationChargeBlindCam::ReInitHists(MParList *pList)
     155{
     156
     157  MExtractedSignalBlindPixel *signal =
     158    (MExtractedSignalBlindPixel*)pList->FindObject(AddSerialNumber("MExtractedSignalBlindPixel"));
     159  if (!signal)
     160  {
     161      *fLog << err << "MExtractedSignalBlindPixel not found... abort." << endl;
     162      return kFALSE;
     163  }
     164
     165  fIntensCam = (MCalibrationIntensityCam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityBlindCam"));
     166  if (fIntensCam)
     167    *fLog << inf << "Found MCalibrationIntensityBlindCam ... " << endl;
     168  else
     169    {
     170      fCam = (MCalibrationCam*)pList->FindObject(AddSerialNumber("MCalibrationBlindCam"));
     171      if (!fCam)
     172        {
     173          fCam = (MCalibrationCam*)pList->FindCreateObj(AddSerialNumber("MCalibrationBlindCam"));
     174          if (!fCam)
     175            {
     176              *fLog << err << "Cannot find nor create MCalibrationBlindCam ... abort." << endl;
     177              return kFALSE;
     178            }
     179        }
     180    }
     181
     182  const Int_t nblindpixels = signal->GetNumBlindPixels();
     183  const Int_t samples      = signal->GetNumFADCSamples();
     184  const Int_t integ        = signal->IsExtractionType( MExtractBlindPixel::kIntegral );
     185 
     186  TH1F *h;
     187
     188  if (fHiGainArray->GetEntries()==0)
     189  {
     190      fHiGainArray->Expand(nblindpixels);
     191      for (Int_t i=0; i<nblindpixels; i++)
     192      {
     193        (*fHiGainArray)[i] = new MHCalibrationChargeBlindPix(Form("%s%s",fHistName.Data(),"Pix"),
     194                                                  Form("%s%s",fHistTitle.Data()," Pixel "));
     195
     196        MHCalibrationChargeBlindPix &pix = (MHCalibrationChargeBlindPix&)(*this)[i];
     197
     198        pix.SetNbins        ( fNbins );
     199        pix.SetFirst        ( fFirst );
     200        pix.SetLast         ( integ ? ((fLast+0.5)*samples)-0.5 : fLast    );
     201        pix.SetSinglePheCut ( integ ? fSPheCut * samples        : fSPheCut );
     202        pix.SetFitFunc      ( integ ? kEPoisson5                : fFitFunc );
     203
     204        h = pix.GetHGausHist();
     205
     206        h->SetName (Form("%s%s%s","H",fHistName.Data(),"Pix"));
     207        h->SetTitle(Form("%s%s",fHistTitle.Data()," Pixel ")); 
     208        h->SetXTitle(fHistXTitle.Data());
     209        h->SetYTitle(fHistYTitle.Data());
     210
     211        pix.ChangeHistId(i);
     212        pix.InitBins();
     213
     214        h->SetTitle( Form("%s%s", h->GetTitle()," Runs: "));
     215      }
     216  }
     217  return kTRUE;
     218}
     219
     220// --------------------------------------------------------------------------
     221//
     222// Retrieves from MExtractedSignalBlindPixel:
     223// - number of blind pixels
     224//
     225// Retrieves from MExtractedSignalBlindPixel:
     226// - number of FADC samples
     227// - extracted signal
     228// - blind Pixel ID
     229//
     230// Resizes (if necessary):
     231// - fASinglePheFADCSlices to sum of HiGain and LoGain samples
     232// - fAPedestalFADCSlices to sum of HiGain and LoGain samples
     233//
     234// Fills the following histograms:
     235// - MHGausEvents::FillHistAndArray(signal)
     236//
     237// Creates MRawEvtPixelIter, jumps to blind pixel ID,
     238// fills the vectors fASinglePheFADCSlices and fAPedestalFADCSlices
     239// with the full FADC slices, depending on the size of the signal w.r.t. fSinglePheCut
     240//
     241Bool_t MHCalibrationChargeBlindCam::FillHists(const MParContainer *par, const Stat_t w)
     242{
     243
     244  MExtractedSignalBlindPixel *signal = (MExtractedSignalBlindPixel*)par;
     245  if (!signal)
     246    {
     247      *fLog << err << "No argument in MExtractedSignalBlindCam::Fill... abort." << endl;
     248      return kFALSE;
     249    }
     250 
     251  const Int_t nblindpixels  = signal->GetNumBlindPixels();
     252 
     253  if (GetSize() != nblindpixels)
     254    {
     255      gLog << err << "ERROR - Size mismatch... abort." << endl;
     256      return kFALSE;
     257    }
     258
     259  Float_t slices = (Float_t)signal->GetNumFADCSamples();
     260 
     261  if (slices == 0.)
     262    {
     263      *fLog << err << dbginf
     264            << "Number of used signal slices in MExtractedSignalBlindPix "
     265            << "is zero  ... abort."
     266            << endl;
     267      return kFALSE;
     268    }
     269 
     270  for (Int_t i=0; i<nblindpixels; i++)
     271    {
     272
     273      //
     274      // Signal extraction and histogram filling
     275      // If filter has been applied, sig has been set to -1.
     276      //
     277      const Float_t sig = signal->GetExtractedSignal(i);
     278     
     279      if (sig < -0.5)
     280        continue;
     281
     282      MHCalibrationChargeBlindPix &hist = (MHCalibrationChargeBlindPix&)(*this)[i];
     283
     284      hist.FillHist(sig);
     285      //
     286      // In order to study the single-phe posistion, we extract the slices
     287      //
     288      const Int_t blindpixIdx = signal->GetBlindPixelIdx(i);
     289     
     290      MRawEvtPixelIter pixel(fRawEvt);
     291      pixel.Jump(blindpixIdx);
     292     
     293      if (sig > fSPheCut)
     294        hist.FillSinglePheFADCSlices(pixel);
     295      else
     296        hist.FillPedestalFADCSlices(pixel);
     297
     298    }
     299
     300  return kTRUE;
     301}
     302
     303// --------------------------------------------------------------------------
     304//
     305// For all TObjArray's (including the averaged ones), the following steps are performed:
     306//
     307// 1) Returns if the pixel is excluded.
     308// 2) Tests saturation. In case yes, set the flag: MCalibrationPix::SetHiGainSaturation()
     309//    or the flag: MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainSaturated )
     310// 3) Store the absolute arrival times in the MCalibrationChargePix's. If flag
     311//    MCalibrationPix::IsHiGainSaturation() is set, the Low-Gain arrival times are stored,
     312//    otherwise the Hi-Gain ones.
     313// 4) Calls to MHCalibrationCam::FitHiGainArrays() and MCalibrationCam::FitLoGainArrays()
     314//    with the flags:
     315//    - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainNotFitted )
     316//    - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainNotFitted )
     317//    - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainOscillating )
     318//    - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainOscillating )
     319//
     320Bool_t MHCalibrationChargeBlindCam::FinalizeHists()
     321{
     322
     323  *fLog << endl;
     324
     325  for (Int_t i=0; i<fHiGainArray->GetSize(); i++)
     326    {
     327     
     328      MHCalibrationChargeBlindPix &hist = (MHCalibrationChargeBlindPix&)(*this)[i];
     329     
     330      TH1F *h = hist.GetHGausHist();
     331
     332      Stat_t overflow = h->GetBinContent(h->GetNbinsX()+1);
     333      if (overflow > 0.1)
     334        {
     335          *fLog << warn << GetDescriptor()
     336                << ": Histogram Overflow occurred " << overflow
     337                << " times in blind pixel: " << i << endl;
     338        }
     339
     340      overflow = h->GetBinContent(0);
     341      if (overflow > 0.1)
     342        {
     343          *fLog << warn << GetDescriptor()
     344                << ": Histogram Underflow occurred " << overflow
     345                << " times in blind pixel: " << i << endl;
     346        }
     347
     348      MCalibrationBlindPix  &pix    = fIntensCam
     349        ? (MCalibrationBlindPix&)(*fIntensCam)[i]
     350        : (MCalibrationBlindPix&)(*fCam)[i];
     351
     352      FitBlindPixel(hist,pix);
     353    }
     354
     355  return kTRUE;
     356}
     357
     358
     359// --------------------------------------------------------------------------
     360//
     361// Returns kFALSE, if empty
     362//
     363// - Creates the fourier spectrum and sets bit MHGausEvents::IsFourierSpectrumOK()
     364// - Retrieves the pedestals from MExtractedSignalBlindPixel
     365// - Normalizes fASinglePheFADCSlices and fAPedestalFADCSlices
     366// - Executes FitPedestal()
     367// - Executes FitSinglePhe()
     368// - Retrieves fit results and stores them in MCalibrationBlindPix
     369//
     370void MHCalibrationChargeBlindCam::FitBlindPixel(MHCalibrationChargeBlindPix &hist, MCalibrationBlindPix &pix)
     371{
     372
     373  if (hist.IsEmpty())
     374  {
     375    *fLog << err << GetDescriptor() << " ID: " << hist.GetPixId()
     376          << " My histogram has not been filled !! " << endl;
     377      return;
     378  }
     379
     380  hist.FinalizeSinglePheSpectrum();
     381 
     382  hist.FitPedestal();
     383
     384  pix.SetValid(kTRUE);
     385
     386  if (hist.FitSinglePhe())
     387    pix.SetSinglePheFitOK();
     388  else
     389    pix.SetValid(hist.IsPedestalFitOK());
     390
     391  pix.SetLambda      ( hist.GetLambda   () );
     392  pix.SetLambdaVar   ( hist.GetLambdaErr()*hist.GetLambdaErr() );
     393  pix.SetMu0         ( hist.GetMu0      () );
     394  pix.SetMu0Err      ( hist.GetMu0Err   () );
     395  pix.SetMu1         ( hist.GetMu1      () );
     396  pix.SetMu1Err      ( hist.GetMu1Err   () );
     397  pix.SetSigma0      ( hist.GetSigma0   () );
     398  pix.SetSigma0Err   ( hist.GetSigma0Err() );
     399  pix.SetSigma1      ( hist.GetSigma1   () );
     400  pix.SetSigma1Err   ( hist.GetSigma1Err() );
     401  pix.SetProb        ( hist.GetProb     () );
     402
     403  pix.SetLambdaCheck    ( hist.GetLambdaCheck()    );
     404  pix.SetLambdaCheckErr ( hist.GetLambdaCheckErr() );
     405}
     406
    108407
    109408// --------------------------------------------------------------------------
     
    118417{
    119418
    120   const Int_t nhi   = fBlindPixelsArray->GetEntries();
    121  
    122419  //
    123420  // FIXME, this might be done faster and more elegant, by direct copy.
     
    125422  MHCalibrationChargeBlindCam *cam = new MHCalibrationChargeBlindCam();
    126423
    127   cam->fBlindPixelsArray->Expand(nhi);
     424  //
     425  // Copy the data members
     426  //
     427  cam->fRunNumbers             = fRunNumbers;
     428  cam->fPulserFrequency        = fPulserFrequency;
     429  cam->fFlags                  = fFlags;
     430  cam->fNbins                  = fNbins;
     431  cam->fFirst                  = fFirst;
     432  cam->fLast                   = fLast;
     433  cam->fFitFunc                = fFitFunc;
     434
     435  const Int_t nhi = fHiGainArray->GetEntries();
     436 
     437  cam->fHiGainArray->Expand(nhi);
    128438
    129439  for (int i=0; i<nhi; i++)
    130     (*cam->fBlindPixelsArray)[i] = (*fBlindPixelsArray)[i]->Clone();
     440    (*cam->fHiGainArray)[i] = (*fHiGainArray)[i]->Clone();
    131441
    132442  return cam;
    133443}
    134 
    135 // --------------------------------------------------------------------------
    136 //
    137 // Gets the pointers to:
    138 // - MRunHeader
    139 // - MExtractedSignalBlindPix
    140 //
    141 // Calls Delete-Function of:
    142 // - MHCalibrationChargeBlindCam::fBlindPixelsArray
    143 //
    144 Bool_t MHCalibrationChargeBlindCam::SetupFill(const MParList *pList)
    145 {
    146  
    147   fRunHeader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
    148   if (!fRunHeader)
    149   {
    150     *fLog << warn << GetDescriptor()
    151           << ": MRawRunHeader not found... will not store run numbers." << endl;
    152     return kFALSE;
    153   }
    154 
    155   fSignal  = (MExtractedSignalBlindPixel*)pList->FindObject("MExtractedSignalBlindPixel");
    156   if (!fSignal)
    157     {
    158       *fLog << err << "MExtractedSignalBlindPixel not found... aborting " << endl;
    159       return kFALSE;
    160     }
    161 
    162   return kTRUE;
    163 }
    164 
    165 
    166 // --------------------------------------------------------------------------
    167 //
    168 // Initializes, if empty to MExtractedSignalCam::GetSize() for:
    169 // - MHCalibrationChargeBlindCam::fBlindPixelsArray
    170 //
    171 // Calls InitializeHists() for every entry in:
    172 // - MHCalibrationChargeBlindCam::fBlindPixelsArray
    173 //
    174 // Retrieves the run numbers from MRawRunHeader and stores them in fRunNumbers
    175 //
    176 Bool_t MHCalibrationChargeBlindCam::ReInit(MParList *pList)
    177 {
    178 
    179   const UInt_t nblindpixels  = fSignal->GetNumBlindPixels();
    180 
    181   Int_t runnr = 0;
    182 
    183   if (fRunHeader)
    184     runnr = fRunHeader->GetRunNumber();
    185 
    186   fCam = (MCalibrationChargeBlindCam*)pList->FindCreateObj("MCalibrationChargeBlindCam");
    187   if (!fCam)
    188     {
    189       *fLog << err << "Cannot find nor create MCalibrationChargeBlindCam ... abort." << endl;
    190       return kFALSE;
    191     }
    192 
    193   if (fCam->GetNumBlindPixels() != nblindpixels)
    194     {
    195         *fLog << err;
    196         *fLog << "Size mismatch in MCalibrationChargeBlindCam ... abort." << endl;
    197         *fLog << "  Size of MCalibrationChargeBlindCam: " << fCam->GetNumBlindPixels() << endl;
    198         *fLog << "  Size of MExtractedSignalBlindPixel: " << nblindpixels << endl;
    199       return kFALSE;
    200     }
    201  
    202 
    203   const Int_t samples = fSignal->GetNumFADCSamples();
    204   const Int_t integ   = fSignal->IsExtractionType( MExtractBlindPixel::kIntegral );
    205 
    206   if (fBlindPixelsArray->GetEntries()==0)
    207   {
    208 
    209       fBlindPixelsArray->Expand(nblindpixels);
    210 
    211       for (UInt_t i=0; i<nblindpixels; i++)
    212         {
    213           (*fBlindPixelsArray)[i] = new MHCalibrationChargeBlindPix;
    214           (*this)[i].ChangeHistId(i);
    215           if (integ)
    216             {
    217               (*this)[i].SetLast( samples * integ *
    218                                   ((*this)[i].GetLast()+0.5) - 0.5 );
    219               (*this)[i].SetSinglePheCut( samples * integ *
    220                                           (*this)[i].GetSinglePheCut() );
    221             }
    222           (*this)[i].InitBins();
    223           TH1F *h = (*this)[i].GetHGausHist();
    224           h->SetTitle( Form("%s%s", h->GetTitle()," Runs: "));
    225           (*this)[i].ChangeFitFunc(fFitFunc);
    226           (*this)[i].SetupFill(pList);
    227           (*this)[i].SetCalibrationChargeBlindPix(&(*fCam)[i]);
    228       }
    229   }
    230 
    231   for (UInt_t i=0; i<nblindpixels; i++)
    232     {
    233       TH1F *h = (*this)[i].GetHGausHist();
    234       h->SetTitle( Form("%s%i%s", h->GetTitle(),runnr," "));
    235     }
    236 
    237   return kTRUE;
    238 }
    239 
    240 
    241 //--------------------------------------------------------------------------------
    242 //
    243 // Retrieves from MExtractedSignalBlindPixel:
    244 // - number of blind pixels
    245 //
    246 // For all TObjArray's, the following steps are performed:
    247 //
    248 // 1) Test size and return kFALSE if not matching
    249 // 2)
    250 //
    251 Bool_t MHCalibrationChargeBlindCam::Fill(const MParContainer *par, const Stat_t w)
    252 {
    253 
    254   const Int_t nblindpixels  = fSignal->GetNumBlindPixels();
    255  
    256   if (GetSize() != nblindpixels)
    257     {
    258       gLog << err << "ERROR - Size mismatch... abort." << endl;
    259       return kFALSE;
    260     }
    261  
    262   for (Int_t i=0; i<nblindpixels; i++)
    263     (*this)[i].Fill(par,w);
    264 
    265   return kTRUE;
    266 }
    267 
    268 // --------------------------------------------------------------------------
    269 //
    270 // Calls the Finalize() function of the blind pixels
    271 //
    272 Bool_t MHCalibrationChargeBlindCam::Finalize()
    273 {
    274 
    275   for (Int_t i=0; i<GetSize(); i++)
    276     if (!(*this)[i].Finalize())
    277       return kFALSE;
    278 
    279   return kTRUE;
    280 }
    281 
    282 
    283444
    284445// -----------------------------------------------------------------------------
     
    293454{
    294455
    295   const Int_t size = fBlindPixelsArray->GetEntries();
     456  const Int_t size = fHiGainArray->GetEntries();
    296457
    297458  if (size == 0)
     
    330491
    331492}
     493
     494Int_t MHCalibrationChargeBlindCam::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     495{
     496
     497  Bool_t rc = kFALSE;
     498
     499  if (MHCalibrationCam::ReadEnv(env,prefix,print))
     500    rc = kTRUE;
     501 
     502  if (IsEnvDefined(env, prefix, "SPheCut", print))
     503    {
     504      SetSPheCut(GetEnvValue(env, prefix, "SPheCut", fSPheCut));
     505      rc = kTRUE;
     506    }
     507 
     508  // FIXME: GetEnvValue does not work with enums yet
     509  /*
     510  if (IsEnvDefined(env, prefix, "FitFunc", print))
     511    {
     512      SetFitFunc((Int_t)GetEnvValue(env, prefix, "FitFunc", fFitFunc));
     513      rc = kTRUE;
     514  }
     515  */
     516  return rc;
     517}
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeBlindCam.h

    r4970 r4986  
    22#define MARS_MHCalibrationChargeBlindCam
    33
    4 #ifndef MARS_MH
    5 #include "MH.h"
    6 #endif
    7 #ifndef MARS_MHCalibrationChargeBlindPix
    8 #include "MHCalibrationChargeBlindPix.h"
     4#ifndef MARS_MHCalibrationCam
     5#include "MHCalibrationCam.h"
    96#endif
    107
    11 class TObjArray;
    12 class MRawRunHeader;
    13 class MExtractedSignalBlindPixel;
    14 class MCalibrationChargeBlindCam;
     8class MRawEvtData;
     9class MCalibrationBlindPix;
    1510class MHCalibrationChargeBlindPix;
    16 class MHCalibrationChargeBlindCam : public MH
     11class MHCalibrationChargeBlindCam : public MHCalibrationCam
    1712{
    1813private:
    1914
    20   MExtractedSignalBlindPixel *fSignal;     //!  Extracted Signal class
    21   MCalibrationChargeBlindCam *fCam;        //!  Calibration Cam with the results
    22   MRawRunHeader              *fRunHeader;  //!  Run Header
     15  static const Int_t   fgNbins;        //! Default for fNBins new style blind pixel (now set to:  128   )
     16  static const Axis_t  fgFirst;        //! Default for fFirst new style blind pixel (now set to: - 0.5 )
     17  static const Axis_t  fgLast;         //! Default for fLast  new style blind pixel (now set to: 511.5 )
     18
     19  static const Axis_t  fgSPheCut;      //! Default for fSinglePheCut new style blind pixel (now set to: 20)
    2320 
    24   TObjArray *fBlindPixelsArray;            // Array of calibration pixels, one per pixel
     21  static const TString gsHistName;     //! Default Histogram names
     22  static const TString gsHistTitle;    //! Default Histogram titles
     23  static const TString gsHistXTitle;   //! Default Histogram x-axis titles
     24  static const TString gsHistYTitle;   //! Default Histogram y-axis titles
     25 
     26  Axis_t fSPheCut;                    // Signal value upon which event considered as single-phe
     27 
     28  MRawEvtData *fRawEvt;                 //!  Raw event data
    2529
    26   MHCalibrationChargeBlindPix::FitFunc_t fFitFunc;
     30public:
     31
     32  enum FitFunc_t { kEPoisson4, kEPoisson5,
     33                   kEPoisson6, kEPoisson7,
     34                   kEPolya, kEMichele }; // Possible fit functions types (see MHCalibrationChargeBlindPix)
     35 
     36  static const FitFunc_t fgFitFunc = kEPoisson4;    //! Default for fFitFunc
     37
     38private:
     39
     40  FitFunc_t fFitFunc;                 // The actual fit function type
     41 
     42  Bool_t SetupHists   (const MParList *pList );
     43  Bool_t ReInitHists  (      MParList *pList );
     44  Bool_t FillHists    (const MParContainer *par, const Stat_t w=1 );
     45  Bool_t FinalizeHists();
     46
     47  void   FitBlindPixel( MHCalibrationChargeBlindPix &hist, MCalibrationBlindPix &pix);
     48
     49  Int_t ReadEnv        ( const TEnv &env, TString prefix, Bool_t print); 
    2750 
    2851public:
    2952
    3053  MHCalibrationChargeBlindCam(const char *name=NULL, const char *title=NULL);
    31   ~MHCalibrationChargeBlindCam();
    32 
    33   Bool_t SetupFill( const MParList *pList);
    34   Bool_t ReInit   (       MParList *pList);
    35   Bool_t Fill     ( const MParContainer *par, const Stat_t w=1);
    36   Bool_t Finalize ( );
    3754
    3855  // Clone
     
    4057 
    4158  // Draw
    42   void   Draw(Option_t *opt="");
    43  
    44   const Int_t GetSize() const  { return fBlindPixelsArray->GetSize(); }
    45  
    46         MHCalibrationChargeBlindPix &operator[] (UInt_t i);
    47   const MHCalibrationChargeBlindPix &operator[] (UInt_t i)  const;
    48 
    49   void   SetFitFunc(const MHCalibrationChargeBlindPix::FitFunc_t func)  { fFitFunc = func;  } 
     59  void  Draw(Option_t *opt="");
     60  void  SetFitFunc( const FitFunc_t func=fgFitFunc)  { fFitFunc = func;  }
     61  void  SetSPheCut( const Axis_t a=fgSPheCut )  { fSPheCut = a;  }   
    5062 
    5163  ClassDef(MHCalibrationChargeBlindCam, 1)      // Histogram class for Blind Pixel Calibration
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeBlindPix.cc

    r4963 r4986  
    3232//  Performs the Single Photo-electron fit to extract the Poisson mean and its errors.
    3333//
    34 //  Different fits can be chosen with the function ChangeFitFunc().
     34//  Different fits can be chosen with the function SetFitFunc().
    3535//
    3636//  The fit result is accepted under the condition that:
     
    6969//////////////////////////////////////////////////////////////////////////////
    7070#include "MHCalibrationChargeBlindPix.h"
    71 #include "MExtractBlindPixel.h"
     71#include "MHCalibrationChargeBlindCam.h"
    7272
    7373#include <TStyle.h>
     
    8888#include "MParList.h"
    8989
    90 #include "MRawEvtData.h"
    9190#include "MRawEvtPixelIter.h"
    92 
    93 #include "MExtractedSignalBlindPixel.h"
    94 #include "MCalibrationChargeBlindPix.h"
    9591
    9692ClassImp(MHCalibrationChargeBlindPix);
     
    10197const Double_t MHCalibrationChargeBlindPix::gkElectronicAmpErr   = 0.002;
    10298const Float_t  MHCalibrationChargeBlindPix::gkSignalInitializer  = -9999.;
    103 
    104 const Int_t    MHCalibrationChargeBlindPix::fgChargeNbins        = 128;
    105 const Axis_t   MHCalibrationChargeBlindPix::fgChargeFirst        = -0.5;
    106 const Axis_t   MHCalibrationChargeBlindPix::fgChargeLast         = 511.5;
    107 const Float_t  MHCalibrationChargeBlindPix::fgSinglePheCut       =  20.;
    10899const Float_t  MHCalibrationChargeBlindPix::fgNumSinglePheLimit  =  50.;
    109100// --------------------------------------------------------------------------
     
    112103//
    113104// Sets:
    114 // - the default number for fNbins        (fgChargeNbins)
    115 // - the default number for fFirst        (fgChargeFirst)
    116 // - the default number for fLast         (fgChargeLast)
    117 // - the default number for fSinglePheCut (fgSingePheCut)
    118105// - the default number for fNumSinglePheLimit (fgNumSinglePheLimit)
    119106// - the default number of bins after stripping (30)
    120 //
    121 // - the default name of the  fHGausHist ("HCalibrationChargeBlindPix")
    122 // - the default title of the fHGausHist ("Distribution of Summed FADC slices Blind Pixel ")
    123 // - the default x-axis title for fHGausHist ("Sum FADC Slices")
    124 // - the default y-axis title for fHGausHist ("Nr. of events")
    125107//
    126108// Initializes:
     
    128110// - fASinglePheFADCSlices(0);
    129111// - fAPedestalFADCSlices(0);
    130 // - fPixId to 0
    131112//
    132113// Calls:
     
    134115//
    135116MHCalibrationChargeBlindPix::MHCalibrationChargeBlindPix(const char *name, const char *title)
    136     :  fBlindPix(NULL), fSignal(NULL), fRawEvt(NULL),
    137        fSinglePheFit(NULL),
     117    :  fSinglePheFit(NULL),
    138118       fFitLegend(NULL),
    139119       fHSinglePheFADCSlices(NULL), fHPedestalFADCSlices(NULL)
     
    143123    fTitle = title ? title : "Statistics of the FADC sums of Blind Pixel calibration events";
    144124
    145     SetNbins( fgChargeNbins );
    146     SetFirst( fgChargeFirst );
    147     SetLast ( fgChargeLast  );
    148    
    149125    fASinglePheFADCSlices.ResizeTo(1);
    150126    fAPedestalFADCSlices.ResizeTo(1);
    151127
    152     SetSinglePheCut();
    153128    SetNumSinglePheLimit();
    154129    SetProbLimit(0.001);
    155130    SetBinsAfterStripping(0);
    156 
    157     fHGausHist.SetName("HCalibrationChargeBlindPix");
    158     fHGausHist.SetTitle("Distribution of Summed FADC slices Blind Pixel"); 
    159     fHGausHist.SetXTitle("Signal Amplitude");
    160     fHGausHist.SetYTitle("Nr. of events");
    161 
    162     fPixId     = 0;
    163131
    164132    Clear();
     
    224192  fLambdaCheckErr = gkSignalInitializer;
    225193 
    226   //  fFitFunc = kEMichele;
    227   fFitFunc = kEPoisson5;
     194  fFitFunc = MHCalibrationChargeBlindCam::kEPoisson5;
    228195
    229196  fNumSinglePhes    = 0;
     
    356323  pix.fNDF            = fNDF;             
    357324  pix.fProb           = fProb;             
    358   pix.fMeanPedestal   = fMeanPedestal;     
    359   pix.fSigmaPedestal  = fSigmaPedestal;   
    360   pix.fMeanPedestalErr  = fMeanPedestalErr; 
    361   pix.fSigmaPedestalErr = fSigmaPedestalErr;
    362325
    363326  return &pix;
     
    427390// --------------------------------------------------------------------------
    428391//
    429 // Gets the pointers to:
    430 // - MRawEvtData
    431 // - MExtractedSignalBlindPixel
     392// Normalizes fASinglePheFADCSlices and fAPedestalFADCSlices
    432393//
    433 Bool_t MHCalibrationChargeBlindPix::SetupFill(const MParList *pList)
    434 {
    435 
    436   fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
    437   if (!fRawEvt)
    438     {
    439       *fLog << err << "MRawEvtData not found... aborting." << endl;
    440       return kFALSE;
    441     }
    442  
    443   fSignal  = (MExtractedSignalBlindPixel*)pList->FindObject("MExtractedSignalBlindPixel");
    444   if (!fSignal)
    445     {
    446       *fLog << err << "MExtractedSignalBlindPixel not found... aborting " << endl;
    447       return kFALSE;
    448     }
    449  
    450   return kTRUE;
    451 }
    452 
    453 // --------------------------------------------------------------------------
    454 //
    455 // Gets or creates the pointers to:
    456 // - MCalibrationChargeBlindPix
    457 //
    458 // Calls:
    459 // - MHGausHist::InitBins()
    460 //
    461 Bool_t MHCalibrationChargeBlindPix::ReInit(MParList *pList)
    462 {
    463 
    464   fBlindPix = (MCalibrationChargeBlindPix*)pList->FindCreateObj("MCalibrationChargeBlindPix");
    465   if (!fBlindPix)
    466       return kFALSE;
    467 
    468   const Int_t samples = fSignal->GetNumFADCSamples();
    469   const Int_t integ   = fSignal->IsExtractionType( MExtractBlindPixel::kIntegral );
    470 
    471   //
    472   // Modify the histogram size in case, integrals have been used
    473   //
    474   if ( fLast < samples*integ*fgChargeLast )
    475     {
    476       SetLast        ( samples * (fgChargeLast+0.5) - 0.5 );
    477       SetSinglePheCut( samples * fgSinglePheCut );
    478     }
    479 
    480   MHCalibrationPix::InitBins();
    481  
    482   return kTRUE;
    483 }
    484 
    485 // --------------------------------------------------------------------------
    486 //
    487 // Retrieves from MExtractedSignalBlindPixel:
    488 // - number of FADC samples
    489 // - extracted signal
    490 // - blind Pixel ID
    491 //
    492 // Resizes (if necessary):
    493 // - fASinglePheFADCSlices to sum of HiGain and LoGain samples
    494 // - fAPedestalFADCSlices to sum of HiGain and LoGain samples
    495 //
    496 // Fills the following histograms:
    497 // - MHGausEvents::FillHistAndArray(signal)
    498 //
    499 // Creates MRawEvtPixelIter, jumps to blind pixel ID,
    500 // fills the vectors fASinglePheFADCSlices and fAPedestalFADCSlices
    501 // with the full FADC slices, depending on the size of the signal w.r.t. fSinglePheCut
    502 //
    503 Bool_t MHCalibrationChargeBlindPix::Fill(const MParContainer *par, const Stat_t w)
    504 {
    505 
    506   const Int_t samples = (Int_t)fRawEvt->GetNumHiGainSamples()
    507                       +(Int_t)fRawEvt->GetNumLoGainSamples();
    508 
    509   if (!fASinglePheFADCSlices.IsValid())
    510     {
    511       fASinglePheFADCSlices.ResizeTo(samples);
    512       fAPedestalFADCSlices.ResizeTo(samples);
    513     }
    514 
    515   if (fASinglePheFADCSlices.GetNrows() != samples)
    516     {
    517       fASinglePheFADCSlices.ResizeTo(samples);
    518       fAPedestalFADCSlices.ResizeTo(samples);
    519     }
    520 
    521   Float_t slices = (Float_t)fSignal->GetNumFADCSamples();
    522  
    523   if (slices == 0.)
    524     {
    525       *fLog << err
    526             << "Number of used signal slices in MExtractedSignalBlindPix "
    527             << "is zero  ... abort."
    528             << endl;
    529       return kFALSE;
    530     }
    531  
    532   //
    533   // Signal extraction and histogram filling
    534   //
    535   const Float_t signal = fSignal->GetExtractedSignal(fPixId);
    536 
    537   if (signal > -0.5)
    538     FillHist(signal);
    539   else
    540     return kTRUE;
    541 
    542   //
    543   // In order to study the single-phe posistion, we extract the slices
    544   //
    545   const Int_t blindpixIdx = fSignal->GetBlindPixelIdx(fPixId);
    546 
    547   MRawEvtPixelIter pixel(fRawEvt);
    548   pixel.Jump(blindpixIdx);
    549 
    550   if (signal > fSinglePheCut)
    551       FillSinglePheFADCSlices(pixel);
    552   else
    553       FillPedestalFADCSlices(pixel);
    554 
    555   return kTRUE;
    556 }
    557 
    558 // --------------------------------------------------------------------------
    559 //
    560 // Returns kFALSE, if empty
    561 //
    562 // - Creates the fourier spectrum and sets bit MHGausEvents::IsFourierSpectrumOK()
    563 // - Retrieves the pedestals from MExtractedSignalBlindPixel
    564 // - Normalizes fASinglePheFADCSlices and fAPedestalFADCSlices
    565 // - Executes FitPedestal()
    566 // - Executes FitSinglePhe()
    567 // - Retrieves fit results and stores them in MCalibrationChargeBlindPix
    568 //
    569 Bool_t MHCalibrationChargeBlindPix::Finalize()
    570 {
    571  
    572   if (IsEmpty())
    573   {
    574     *fLog << err << GetDescriptor() << " ID: " << fPixId
    575           << " My histogram has not been filled !! " << endl;
    576       return kFALSE;
    577   }
    578 
    579   fMeanPedestal     = fSignal->GetPed();
    580   fMeanPedestalErr  = fSignal->GetPedErr();
    581   fSigmaPedestal    = fSignal->GetPedRms();
    582   fSigmaPedestalErr = fSignal->GetPedRmsErr();
    583 
     394void MHCalibrationChargeBlindPix::FinalizeSinglePheSpectrum()
     395{
     396 
    584397  if (fNumSinglePhes > 1)
    585398      for (Int_t i=0;i<fASinglePheFADCSlices.GetNrows();i++)
     
    587400  if (fNumPedestals > 1)
    588401      for (Int_t i=0;i<fAPedestalFADCSlices.GetNrows();i++)
    589           fAPedestalFADCSlices[i]  = fAPedestalFADCSlices[i]/fNumPedestals;
    590 
    591   FitPedestal();
    592 
    593   fBlindPix->SetValid(kTRUE);
    594 
    595   if (FitSinglePhe())
    596     fBlindPix->SetSinglePheFitOK();
    597   else
    598     fBlindPix->SetValid(IsPedestalFitOK());
    599 
    600   fBlindPix->SetLambda      (    fLambda               );
    601   fBlindPix->SetLambdaVar   (    fLambdaErr*fLambdaErr );
    602   fBlindPix->SetMu0         (    fMu0                  );
    603   fBlindPix->SetMu0Err      (    fMu0Err               );
    604   fBlindPix->SetMu1         (    fMu1                  );
    605   fBlindPix->SetMu1Err      (    fMu1Err               );
    606   fBlindPix->SetSigma0      (    fSigma0               );
    607   fBlindPix->SetSigma0Err   (    fSigma0Err            );
    608   fBlindPix->SetSigma1      (    fSigma1               );
    609   fBlindPix->SetSigma1Err   (    fSigma1Err            );
    610   fBlindPix->SetProb        (    fProb                 );
    611 
    612   fBlindPix->SetLambdaCheck    ( fLambdaCheck          );
    613   fBlindPix->SetLambdaCheckErr ( fLambdaCheckErr       );
    614 
    615   return kTRUE;
    616 }
    617 
     402        fAPedestalFADCSlices[i]  = fAPedestalFADCSlices[i]/fNumPedestals;
     403}
    618404
    619405// --------------------------------------------------------------------------
     
    733519  switch (fFitFunc)
    734520    {
    735     case kEPoisson4:
     521    case MHCalibrationChargeBlindCam::kEPoisson4:
    736522      fSinglePheFit = new TF1("SinglePheFit",&fPoissonKto4,rmin,rmax,6);
    737523      rmin += 6.5;
    738524      break;
    739     case kEPoisson5:
     525    case MHCalibrationChargeBlindCam::kEPoisson5:
    740526      fSinglePheFit = new TF1("SinglePheFit",&fPoissonKto5,rmin,rmax,6);
    741527      rmin = 0.;
    742528      break;
    743     case kEPoisson6:
     529    case MHCalibrationChargeBlindCam::kEPoisson6:
    744530      fSinglePheFit = new TF1("SinglePheFit",&fPoissonKto6,rmin,rmax,6);
    745531      break;
    746     case kEPolya:
     532    case MHCalibrationChargeBlindCam::kEPolya:
    747533      fSinglePheFit = new TF1("SinglePheFit",&fPolya,rmin,rmax,8);
    748534      break;
    749     case kEMichele:
     535    case MHCalibrationChargeBlindCam::kEMichele:
    750536      fSinglePheFit = new TF1("SinglePheFit",&fFitFuncMichele,rmin,rmax,9);
    751537      break;
     
    786572    {
    787573     
    788     case kEPoisson4:
     574    case MHCalibrationChargeBlindCam::kEPoisson4:
    789575        fSinglePheFit->SetParNames(  "#lambda",   "#mu_{0}",    "#mu_{1}", "#sigma_{0}",  "#sigma_{1}","Area");
    790576        fSinglePheFit->SetParameters(lambda_guess,mu_0_guess,mu_1_guess,si_0_guess,si_1_guess,norm);
     
    796582        fSinglePheFit->SetParLimits(5,norm-(0.5*norm),norm+(0.7*norm));
    797583        break;
    798     case kEPoisson5:
    799     case kEPoisson6:
     584    case MHCalibrationChargeBlindCam::kEPoisson5:
     585    case MHCalibrationChargeBlindCam::kEPoisson6:
    800586      fSinglePheFit->SetParNames("#lambda","#mu_{0}","#mu_{1}","#sigma_{0}","#sigma_{1}","Area");
    801587      fSinglePheFit->SetParameters(lambda_guess,mu_0_guess,800.,si_0_guess,500.,norm);
     
    808594      break;
    809595
    810     case kEPolya:
     596    case MHCalibrationChargeBlindCam::kEPolya:
    811597        fSinglePheFit->SetParameters(lambda_guess, excessPoisson_guess,
    812598                                     delta1_guess,delta2_guess,
    813599                                     electronicAmp_guess,
    814                                      fSigmaPedestal,
     600                                     10.,
    815601                                     norm,
    816                                      fMeanPedestal);
     602                                     0.);
    817603      fSinglePheFit->SetParNames("#lambda","b_{tot}",
    818604                                 "#delta_{1}","#delta_{2}",
     
    825611      fSinglePheFit->SetParLimits(4,electronicAmp_guess-electronicAmp_limit,
    826612                                    electronicAmp_guess+electronicAmp_limit);   
    827       fSinglePheFit->SetParLimits(5,
    828                                     fSigmaPedestal-3.*fSigmaPedestalErr,
    829                                     fSigmaPedestal+3.*fSigmaPedestalErr);
     613      fSinglePheFit->SetParLimits(5,0.,40.);
    830614      fSinglePheFit->SetParLimits(6,norm-0.1,norm+0.1);
    831       fSinglePheFit->SetParLimits(7,
    832                                     fMeanPedestal-3.*fMeanPedestalErr,
    833                                     fMeanPedestal+3.*fMeanPedestalErr);
    834       break;
    835     case kEMichele:
     615      fSinglePheFit->SetParLimits(7,-10.,10.);
     616      break;
     617    case MHCalibrationChargeBlindCam::kEMichele:
    836618      fSinglePheFit->SetParNames("#lambda_{cat}","#lambda_{dyn}",
    837619                                 "#mu_{0}","#mu_{1cat}","#mu_{1dyn}",
     
    879661    {
    880662     
    881     case kEPoisson4:
    882     case kEPoisson5:
    883     case kEPoisson6:
    884     case kEPoisson7:
     663    case MHCalibrationChargeBlindCam::kEPoisson4:
     664    case MHCalibrationChargeBlindCam::kEPoisson5:
     665    case MHCalibrationChargeBlindCam::kEPoisson6:
     666    case MHCalibrationChargeBlindCam::kEPoisson7:
    885667      fLambda = fSinglePheFit->GetParameter(0);
    886668      fMu0    = fSinglePheFit->GetParameter(1);
     
    895677      fSigma1Err = fSinglePheFit->GetParError(4);
    896678      break;
    897     case kEPolya:
     679    case MHCalibrationChargeBlindCam::kEPolya:
    898680      fLambda =  fSinglePheFit->GetParameter(0);
    899681      fMu0    =  fSinglePheFit->GetParameter(7);
     
    907689      fSigma0Err = fSinglePheFit->GetParError(5);
    908690      fSigma1Err = 0.;
    909     case kEMichele:
     691    case MHCalibrationChargeBlindCam::kEMichele:
    910692      fLambda =  fSinglePheFit->GetParameter(0);
    911693      fMu0    =  fSinglePheFit->GetParameter(2);
     
    1037819      fFitLegend = new TPaveText(0.05,0.05,0.95,0.95);
    1038820      fFitLegend->SetLabel(Form("%s%s", "Results of the single PhE Fit (",
    1039                                 (fFitFunc ==  kEPoisson4) ? "Poisson(k=4))" :
    1040                                 (fFitFunc ==  kEPoisson5) ? "Poisson(k=5))" :
    1041                                 (fFitFunc ==  kEPoisson6) ? "Poisson(k=6))" :
    1042                                 (fFitFunc ==  kEPolya   ) ? "Polya(k=4))"   :
    1043                                 (fFitFunc ==  kEMichele ) ?  "Michele)"     : " none )" ));
     821                                (fFitFunc ==  MHCalibrationChargeBlindCam::kEPoisson4) ? "Poisson(k=4))" :
     822                                (fFitFunc ==  MHCalibrationChargeBlindCam::kEPoisson5) ? "Poisson(k=5))" :
     823                                (fFitFunc ==  MHCalibrationChargeBlindCam::kEPoisson6) ? "Poisson(k=6))" :
     824                                (fFitFunc ==  MHCalibrationChargeBlindCam::kEPolya   ) ? "Polya(k=4))"   :
     825                                (fFitFunc ==  MHCalibrationChargeBlindCam::kEMichele ) ?  "Michele)"     
     826                                                                                       : " none )" ));
    1044827      fFitLegend->SetTextSize(0.05);
    1045828  }
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeBlindPix.h

    r4963 r4986  
    77#endif
    88
     9#ifndef MARS_MHCalibrationChargeBlindCam
     10#include "MHCalibrationChargeBlindCam.h"
     11#endif
     12
    913#ifndef ROOT_TF1
    1014#include <TF1.h>
     
    1822class TPaveText;
    1923class TText;
    20 class MRawEvtData;
     24class MExtractedSignalBlindPixel;
    2125class MRawEvtPixelIter;
    22 class MCalibrationChargeBlindPix;
    23 class MExtractBlindPixel;
    24 class MExtractedSignalBlindPixel;
    2526
    2627class MHCalibrationChargeBlindPix : public MHCalibrationPix
     
    2829private:
    2930
    30   static const Int_t    fgChargeNbins;       //! Default for fNBins        (now set to: 5300   )
    31   static const Axis_t   fgChargeFirst;       //! Default for fFirst        (now set to: -100.5 )
    32   static const Axis_t   fgChargeLast;        //! Default for fLast         (now set to: 5199.5 )
    33   static const Float_t  fgSinglePheCut;      //! Default for fSinglePheCut (now set to: 200    )
    3431  static const Float_t  fgNumSinglePheLimit; //! Default for fNumSinglePheLimit (now set to: 50)
    3532  static const Float_t  gkSignalInitializer; //! Signal initializer (-9999.)
     
    4138  Float_t fNumSinglePheLimit;                // Minimum number of single-phe events
    4239
    43   MCalibrationChargeBlindPix *fBlindPix;     //! Storage container results 
    44   MExtractedSignalBlindPixel *fSignal;       //! Storage container extracted signal
    45   MRawEvtData                *fRawEvt;       //! Storage container raw data
    46  
    4740  TVector fASinglePheFADCSlices;             // Averaged FADC slice entries supposed single-phe events
    4841  TVector fAPedestalFADCSlices;              // Averaged FADC slice entries supposed pedestal   events
     
    6861  Int_t     fNDF;                            // Ndof of single-phe fit
    6962  Double_t  fProb;                           // Probability of singleo-phe fit
    70   Double_t  fMeanPedestal;                   // Mean pedestal from pedestal run
    71   Double_t  fSigmaPedestal;                  // Sigma pedestal from pedestal run
    72   Double_t  fMeanPedestalErr;                // Error of Mean pedestal from pedestal run
    73   Double_t  fSigmaPedestalErr;               // Error of Sigma pedestal from pedestal run
    7463                                     
    7564  Byte_t    fFlags;                          // Bit-field for the flags
    7665  enum { kSinglePheFitOK, kPedestalFitOK };  // Possible bits to be set
    7766
     67  MHCalibrationChargeBlindCam::FitFunc_t fFitFunc;
     68
    7869  TPaveText *fFitLegend;                     //! Some legend to display the fit results
    7970  TH1F      *fHSinglePheFADCSlices;          //! A histogram created and deleted only in Draw()
    8071  TH1F      *fHPedestalFADCSlices;           //! A histogram created and deleted only in Draw()
    8172
    82   // Fill histos
    83   void  FillSinglePheFADCSlices(const MRawEvtPixelIter &iter);
    84   void  FillPedestalFADCSlices( const MRawEvtPixelIter &iter);
    85 
    8673  // Fit
    8774  Bool_t InitFit();
    8875  void   ExitFit(); 
    8976 
     77  void DrawLegend(Option_t *opt="");
     78 
    9079public:
    9180
     
    9887  //  TObject *Clone(const char *) const;
    9988
    100   Bool_t SetupFill(const MParList *pList);
    101   Bool_t ReInit   (      MParList *pList);
    102   Bool_t Fill     (const MParContainer *par, const Stat_t w=1);
    103   Bool_t Finalize();
    104  
    10589  // Getters
    10690  const Double_t GetLambda        ()  const { return fLambda;         }
     
    128112 
    129113  // Setters
    130   void SetCalibrationChargeBlindPix ( MCalibrationChargeBlindPix *pix)    { fBlindPix          = pix;  }
    131   void SetSinglePheCut      ( const Float_t cut =fgSinglePheCut      )    { fSinglePheCut      = cut;  }
     114  void SetFitFunc(const MHCalibrationChargeBlindCam::FitFunc_t func)  { fFitFunc = func;  }
     115  void SetSinglePheCut      ( const Float_t cut = 0.               )    { fSinglePheCut      = cut;  }
    132116  void SetNumSinglePheLimit ( const Float_t lim =fgNumSinglePheLimit )    { fNumSinglePheLimit = lim;  }
    133 
    134   void SetMeanPedestal      ( const Float_t f )   { fMeanPedestal     = f;  }
    135   void SetMeanPedestalErr   ( const Float_t f )   { fMeanPedestalErr  = f;  }
    136   void SetSigmaPedestal     ( const Float_t f )   { fSigmaPedestal    = f;  }
    137   void SetSigmaPedestalErr  ( const Float_t f )   { fSigmaPedestalErr = f;  }
    138117
    139118  void SetSinglePheFitOK    ( const Bool_t b=kTRUE);
    140119  void SetPedestalFitOK     ( const Bool_t b=kTRUE);
    141120 
     121  // Fill histos
     122  void  FillSinglePheFADCSlices(const MRawEvtPixelIter &iter);
     123  void  FillPedestalFADCSlices( const MRawEvtPixelIter &iter);
     124  void  FinalizeSinglePheSpectrum();
     125 
    142126  // Draws
    143127  void Draw(Option_t *opt="");
    144128
    145 private:
    146   void DrawLegend(Option_t *opt="");
    147  
    148129  // Fits
    149 public:
    150   enum FitFunc_t { kEPoisson4, kEPoisson5, kEPoisson6, kEPoisson7, kEPolya, kEMichele }; // The possible fit functions
    151 
    152 private:
    153   FitFunc_t fFitFunc;
    154 
    155 public:
    156130  Bool_t FitSinglePhe (Option_t *opt="RL0+Q");
    157131  void   FitPedestal  (Option_t *opt="RL0+Q");
    158132
    159   void   ChangeFitFunc(const FitFunc_t func)  { fFitFunc = func;  }
    160  
    161133  // Simulation
    162134  Bool_t SimulateSinglePhe(const Double_t lambda,
  • trunk/MagicSoft/Mars/mhcalib/Makefile

    r4940 r4986  
    3232# mimage     MHillas
    3333
    34 SRCFILES = MHCalibrationChargeBlindPix.cc \
    35            MHCalibrationChargeBlindCam.cc \
    36            MHCalibrationChargePix.cc \
    37            MHCalibrationCam.cc \
     34SRCFILES = MHCalibrationCam.cc \
    3835           MHCalibrationPix.cc \
    3936           MHCalibrationChargeCam.cc \
     37           MHCalibrationChargePix.cc \
     38           MHCalibrationChargeBlindCam.cc \
     39           MHCalibrationChargeBlindPix.cc \
    4040           MHCalibrationChargePINDiode.cc \
    4141           MHCalibrationRelTimeCam.cc \
Note: See TracChangeset for help on using the changeset viewer.