Ignore:
Timestamp:
05/10/05 12:13:12 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mcalib
Files:
9 edited

Legend:

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

    r6963 r7005  
    7979      fIntensCharge(NULL), fIntensBlind(NULL), fIntensRelTime(NULL), fIntensBad(NULL),
    8080      fChargeCalc(NULL), fRelTimeCalc(NULL), fCalibrate(NULL),
    81       fNumEvents(0), fNumCam(0)
     81      fNumEvents(0), fNumCam(0), fUpdateWithFFactorMethod(kFALSE)
    8282{
    8383
     
    249249    fRelTimeCalc->Finalize();
    250250  if (fCalibrate)
    251     fCalibrate->UpdateConversionFactors((MCalibrationChargeCam*)fIntensCharge->GetCam());
     251      fCalibrate->UpdateConversionFactors(fUpdateWithFFactorMethod ? NULL :
     252                                          (MCalibrationChargeCam*)fIntensCharge->GetCam());
    252253
    253254  ReInitialize();
     
    324325Int_t MCalibCalcFromPast::PostProcess()
    325326{
    326   *fLog << "Number of Calibration Cams: " << fNumCam << endl;
     327  *fLog << inf << "Number of Calibration Cams: " << fNumCam << endl;
    327328  return kTRUE;
    328329 
    329330}
    330331
     332// --------------------------------------------------------------------------
     333//
     334// Read the setup from a TEnv, eg:
     335//   MCalibCalcFromPast.UpdateWithFFactorMethod: Off, On
     336//
     337Int_t MCalibCalcFromPast::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     338{
     339    Bool_t rc = kFALSE;
     340    if (IsEnvDefined(env, prefix, "UpdateWithFFactorMethod", print))
     341    {
     342        rc = kTRUE;
     343        SetUpdateWithFFactorMethod(GetEnvValue(env, prefix, "UpdateWithFFactorMethod", fUpdateWithFFactorMethod));
     344    }
     345
     346    return rc;
     347}
  • trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.h

    r6963 r7005  
    4141  UInt_t fNumEvents;           //! Event counter only for calibration events
    4242  UInt_t fNumCam;              //! Number of currently used Calibration Cam
    43  
     43
     44  Bool_t fUpdateWithFFactorMethod; // Update the interlaced calib events with the full F-Factor method
     45
    4446  Int_t  PreProcess(MParList *pList);
    4547  Int_t  Process();
     
    4850  Bool_t ReInitialize();
    4951  Bool_t Finalize(const char* name);
     52
     53  Int_t  ReadEnv(const TEnv &env, TString prefix, Bool_t print);
    5054
    5155public:
     
    6165  void SetChargeCalc   ( MCalibrationChargeCalc  *c )  { fChargeCalc  = c; }
    6266  void SetRelTimeCalc  ( MCalibrationRelTimeCalc *c )  { fRelTimeCalc = c; }
     67
     68  void SetUpdateWithFFactorMethod(const Bool_t b=kTRUE){ fUpdateWithFFactorMethod = b; }
    6369 
    6470  ClassDef(MCalibCalcFromPast, 1) // Task to steer the processing of interlace calibration events
  • trunk/MagicSoft/Mars/mcalib/MCalibColorSteer.cc

    r6963 r7005  
    2222!
    2323\* ======================================================================== */
     24
    2425//////////////////////////////////////////////////////////////////////////////
    2526//
     
    8182    : fCalibPattern(NULL), fGeom(NULL), fParList(NULL),
    8283      fIntensCharge(NULL), fIntensRelTime(NULL), fIntensBad(NULL),
    83       fBad(NULL), fChargeCalc(NULL), fRelTimeCalc(NULL)
     84      fBad(NULL), fChargeCalc(NULL), fRelTimeCalc(NULL), fHistCopy(kFALSE)
    8485{
    8586
     
    285286}
    286287
     288// --------------------------------------------------------------------------
     289//
     290// Reads the pattern from MCalibrationPattern and initializes new containers in the
     291// Intensity Cams, if the pattern has changed. Executes Finalize of the
     292// MCalibration*Calc classes in that case.
     293//
     294Int_t MCalibColorSteer::PostProcess()
     295{
     296    //
     297    // Finalize Possible calibration histogram classes...
     298    //
     299    *fLog << inf << "Finalize calibration histograms..." << flush;
     300    if (Finalize("MHCalibrationChargeCam"))      *fLog << inf << "MHCalibrationChargeCam..." << flush;
     301    if (Finalize("MHCalibrationChargeBlindCam")) *fLog << inf << "MHCalibrationChargeBlindCam..." << flush;
     302    if (Finalize("MHCalibrationRelTimeCam"))     *fLog << inf << "MHCalibrationRelTimeCam..." << flush;
     303    if (Finalize("MHCalibrationTestCam"))        *fLog << inf << "MHCalibrationChargeCam..." << flush;
     304    if (Finalize("MHCalibrationTestTimeCam"))    *fLog << inf << "MHCalibrationChargeCam..." << flush;
     305    *fLog << inf << "done." << endl;
     306
     307    return kTRUE;
     308}
    287309
    288310// --------------------------------------------------------------------------
     
    300322
    301323  hist->Finalize();
     324  CopyHist(name);
    302325  hist->ResetHists();
    303326  hist->SetColor( fCalibPattern->GetPulserColor());
     
    331354      MCalibrationChargeCam *cam    = (MCalibrationChargeCam*)fIntensCharge->GetCam();
    332355      cam->SetPulserColor(fCalibPattern->GetPulserColor());
    333       if (!cam->CopyHiLoConversionFactors(*oldcam))
    334         return kFALSE;
     356      if (!cam->MergeHiLoConversionFactors(*oldcam))
     357          return kFALSE;
    335358      *fLog << inf << "New MCalibrationChargeCam with name: " << cam->GetName() << endl;
    336359    }
     
    388411  return result;
    389412}
     413
     414// --------------------------------------------------------------------------
     415//
     416// Copies the histogram classes into the intensity cams
     417//
     418void MCalibColorSteer::CopyHist(const char* name)
     419{
     420  MHCalibrationCam *hcam = (MHCalibrationCam*)fParList->FindObject(name);
     421  TString n(name);
     422  if (n.Contains("ChargeCam"))
     423    {
     424      if (fIntensCharge)
     425          fIntensCharge->AddHist((MHCalibrationCam*)hcam->Clone());
     426    }
     427  if (n.Contains("Blind"))
     428    if (fIntensBlind)
     429          fIntensBlind->AddHist((MHCalibrationCam*)hcam->Clone());
     430
     431  if (n.Contains("RelTime"))
     432    if (fIntensRelTime)
     433          fIntensRelTime->AddHist((MHCalibrationCam*)hcam->Clone());
     434}
     435
     436// --------------------------------------------------------------------------
  • trunk/MagicSoft/Mars/mcalib/MCalibColorSteer.h

    r6963 r7005  
    2727{
    2828private:
    29 
    30 
    3129  MCalibrationPattern             *fCalibPattern;    //!
    3230  MRawRunHeader                   *fRunHeader;       //!
     
    4543  MCalibrationCam::PulserColor_t   fColor;
    4644  Float_t                          fStrength;
     45
     46  Bool_t                           fHistCopy;        // Decide whether MHCalibrationCams will get copied
    4747 
    4848  Int_t  PreProcess(MParList *pList);
    4949  Int_t  Process();
     50  Int_t  PostProcess();
    5051 
    5152  Bool_t ReInitialize();
    5253  Bool_t Finalize(const char* name);
     54
     55  void    CopyHist(const char* name);
    5356  TString GetNamePattern();
    5457 
    5558public:
     59    MCalibColorSteer(const char *name=NULL, const char *title=NULL);
    5660
    57     MCalibColorSteer(const char *name=NULL, const char *title=NULL);
    58     ~MCalibColorSteer() {}
     61    void SetHistCopy(const Bool_t b=kTRUE) { fHistCopy = b; }
    5962
    6063    ClassDef(MCalibColorSteer, 1) // Task to steer the processing of multiple calibration colours
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc

    r6963 r7005  
    252252// Copy High-gain vs. low-gain conversion factors from cam to this.
    253253//
    254 Bool_t MCalibrationChargeCam::CopyHiLoConversionFactors(const MCalibrationChargeCam &cam) const
     254Bool_t MCalibrationChargeCam::MergeHiLoConversionFactors(const MCalibrationChargeCam &cam) const
    255255{
    256256
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h

    r6963 r7005  
    5959                                              const UInt_t sec=0, MBadPixelsCam *bad=NULL);
    6060
    61   Bool_t CopyHiLoConversionFactors(const MCalibrationChargeCam &cam) const;
     61  Bool_t MergeHiLoConversionFactors(const MCalibrationChargeCam &cam) const;
    6262 
    6363  // Prints
  • trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityCam.cc

    r5651 r7005  
    3030// Contains TOrdCollections for the following objects:
    3131// - fCams:  Array of classes derived from MCalibrationCam, one entry
    32 //           per calibration camera result. Has to be created
     32//           per calibration camera result.
     33// - fHists: Array of classes derived from MHCalibrationPix, one entry
     34//           per calibration camera result and area index
    3335//
    3436// See also: MCalibrationIntensityChargeCam, MCalibrationIntensityQECam,
     
    3941//           MCalibrationChargeBlindPix, MCalibrationChargePINDiode
    4042//
     43// ClassVersion 2:
     44//  + fHists
    4145//
    4246/////////////////////////////////////////////////////////////////////////////
     
    4549#include <TOrdCollection.h>
    4650
     51#include "MLog.h"
     52#include "MLogManip.h"
     53
    4754#include "MGeomCam.h"
     55#include "MHCalibrationCam.h"
    4856
    4957ClassImp(MCalibrationIntensityCam);
     
    5765// Set the following pointer to NULL:
    5866// - fCams
     67// - fHists
    5968//
    6069MCalibrationIntensityCam::MCalibrationIntensityCam(const char *name, const char *title)
     
    6675  fCams = new TOrdCollection;
    6776  fCams->SetOwner();
    68  
     77
     78  fHists = new TOrdCollection;
     79  fHists->SetOwner();
    6980}
    7081
     
    7687MCalibrationIntensityCam::~MCalibrationIntensityCam()
    7788{
    78   if (fCams)
    7989    delete fCams;
     90    delete fHists;
     91}
     92
     93// --------------------------------------------------------------------------
     94//
     95// Add a new MHCalibrationCam to fHists
     96//
     97void MCalibrationIntensityCam::AddHist( const MHCalibrationCam *cam)
     98{
     99    const Int_t size = fHists->GetSize();
     100    fHists->AddAt((TObject*)cam,size);
     101
     102    if (size != GetSize()-1)
     103        *fLog << warn << "Histogram Cams and Calibration Cams size mismatch! " << endl;
    80104}
    81105
     
    100124void MCalibrationIntensityCam::Copy(TObject& object) const
    101125{
    102  
    103   MCalibrationIntensityCam &calib = (MCalibrationIntensityCam&)object;
    104  
    105   MParContainer::Copy(calib);
    106  
    107   calib.fOffsets = fOffsets;
    108   calib.fSlopes  = fSlopes;
    109  
    110   const UInt_t n = GetSize();
    111   if (n != 0)
     126    MCalibrationIntensityCam &calib = (MCalibrationIntensityCam&)object;
     127
     128    MParContainer::Copy(calib);
     129
     130    calib.fOffsets = fOffsets;
     131    calib.fSlopes  = fSlopes;
     132
     133    const UInt_t n = GetSize();
     134    if (n != 0)
    112135    {
    113       calib.InitSize(n);
    114       for (UInt_t i=0; i<n; i++)
    115         GetCam(i)->Copy(*(calib.GetCam(i)));
     136        calib.InitSize(n);
     137        for (UInt_t i=0; i<n; i++)
     138        {
     139            GetCam(i)->Copy(*(calib.GetCam(i)));
     140            GetHist(i)->Copy(*(calib.GetHist(i)));
     141        }
    116142    }
    117  
    118143}
    119144
     
    124149void MCalibrationIntensityCam::Clear(Option_t *o)
    125150{
    126 
    127   fCams->ForEach(MCalibrationCam, Clear)();
    128 
    129   return;
     151    fCams->ForEach(MCalibrationCam, Clear)();
     152    fHists->ForEach(MHCalibrationCam, Clear)();
    130153}
    131154
     
    136159void MCalibrationIntensityCam::Print(Option_t *o) const
    137160{
    138   fCams->ForEach(MCalibrationCam, Print)(o);
     161    fCams->ForEach(MCalibrationCam, Print)(o);
     162    fHists->ForEach(MHCalibrationCam, Print)(o);
    139163}
    140164
     
    424448  return size;
    425449}
     450
     451// --------------------------------------------------------------------------
     452//
     453// Get i-th histogram class
     454//
     455MHCalibrationCam *MCalibrationIntensityCam::GetHist(Int_t i)
     456{
     457    return static_cast<MHCalibrationCam*>(i==-1 ? fHists->Last() : fHists->At(i));
     458}
     459
     460// --------------------------------------------------------------------------
     461//
     462// Get i-th histogram class
     463//
     464const MHCalibrationCam *MCalibrationIntensityCam::GetHist(Int_t i) const
     465{
     466    return static_cast<MHCalibrationCam*>(i==-1 ? fHists->Last() : fHists->At(i));
     467}
     468
     469// --------------------------------------------------------------------------
     470//
     471// Get histogram class with name 'name'
     472//
     473MHCalibrationCam *MCalibrationIntensityCam::GetHist(const char *name )
     474{
     475    return static_cast<MHCalibrationCam*>(fHists->FindObject(name));
     476}
     477
     478// --------------------------------------------------------------------------
     479//
     480// Get histogram class with name 'name'
     481//
     482const MHCalibrationCam *MCalibrationIntensityCam::GetHist(const char *name ) const
     483{
     484    return static_cast<MHCalibrationCam*>(fHists->FindObject(name));
     485}
  • trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityCam.h

    r5651 r7005  
    1818class MBadPixelsPix;
    1919class MGeomCam;
     20class MHCalibrationCam;
     21
    2022class MCalibrationIntensityCam : public MParContainer, public MCamEvent
    2123{
    2224private:
    23  
    24   MArrayD fOffsets;           //! Arrays of Higain-vs-LoGain fit result Offsets
    25   MArrayD fSlopes;            //! Arrays of Higain-vs-LoGain fit result Slopes
     25  MArrayD fOffsets;        //! Arrays of Higain-vs-LoGain fit result Offsets
     26  MArrayD fSlopes;         //! Arrays of Higain-vs-LoGain fit result Slopes
    2627
    2728protected: 
    28 
    29   TOrdCollection *fCams;        // Array of MCalibrationCams, one per pulse colour and intensity
     29  TOrdCollection *fCams;   // Array of MCalibrationCams, one per pulse colour and intensity
     30  TOrdCollection *fHists;  // Array of MHCalibrationCam's, containing the mean charges per area histograms
    3031
    3132  virtual void Add(const UInt_t from, const UInt_t to);
     
    3334 
    3435public:
    35 
    3636  MCalibrationIntensityCam(const char *name=NULL, const char *title=NULL);
    3737  ~MCalibrationIntensityCam();
     
    4040  void  Copy(TObject& object) const; 
    4141 
    42   void AddToList( const char* name, const MGeomCam &geom );
     42  void AddToList(const char* name, const MGeomCam &geom);
     43  void AddHist(const MHCalibrationCam *cam);
    4344
    4445  Int_t CountNumEntries(const MCalibrationCam::PulserColor_t col) const; 
     
    6970  const MCalibrationCam *GetCam              ( const char *name ) const;
    7071
     72        MHCalibrationCam *GetHist            ( Int_t i=-1);
     73  const MHCalibrationCam *GetHist            ( Int_t i=-1) const;
     74
     75        MHCalibrationCam *GetHist            ( const char *name );
     76  const MHCalibrationCam *GetHist            ( const char *name ) const;
     77
    7178        MCalibrationPix &operator[]          ( UInt_t i );
    7279  const MCalibrationPix &operator[]          ( UInt_t i )  const;
     
    9198                                                                GetCam()->SetPulserColor(col);            }
    9299
    93   ClassDef(MCalibrationIntensityCam, 1) // Base Container Intensity Calibration Results
     100  ClassDef(MCalibrationIntensityCam, 2) // Base Container Intensity Calibration Results
    94101};
    95102
  • trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.cc

    r4710 r7005  
    242242{
    243243    //
    244     // Exclude events with some saturated pixel
     244    // Exclude events with some high-gain saturated pixel
    245245    //
    246246    if (fPar->GetNumSatPixelsHG()>0)
     
    266266    //
    267267 
    268     const Float_t inner_photel = (Float_t) fMcEvt->GetPhotElfromShower() * innersize / size;
    269     const Float_t outer_photel = (Float_t) fMcEvt->GetPhotElfromShower() - inner_photel;
    270 
    271     const Float_t corrected_photel = inner_photel + outer_photel / fOuterPixelsLightCollection;
    272 
    273 
    274     //    fHistADC2PhotEl->Fill(TMath::Log10(fMcEvt->GetPhotElfromShower()/size));
     268    const Float_t corrected_photel = (Float_t) fMcEvt->GetPhotElfromShower() /
     269      (fOuterPixelsLightCollection + innersize / size * (1. - fOuterPixelsLightCollection));
    275270
    276271    fHistADC2PhotEl->Fill(TMath::Log10(corrected_photel/size));
Note: See TracChangeset for help on using the changeset viewer.