Changeset 1291


Ignore:
Timestamp:
04/24/02 09:23:07 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc

    r1180 r1291  
    4444#include "MLog.h"
    4545#include "MLogManip.h"
     46
     47#include "MMcRunHeader.hxx"
    4648
    4749#include "MRawRunHeader.h"
     
    113115// --------------------------------------------------------------------------
    114116//
     117// Check for the run type and camera version.
     118// If the file is a MC file and the used camera version is <= 40
     119// we enable a fix for truncated pedestal means in this version.
     120//
     121Bool_t MCerPhotCalc::ReInit(MParList *pList)
     122{
     123    const MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
     124    if (!runheader)
     125    {
     126        *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl;
     127        return kTRUE;
     128    }
     129
     130    if (runheader->GetRunType() != kRTMonteCarlo)
     131        return kTRUE;
     132
     133    MMcRunHeader *mcrunheader = (MMcRunHeader*)pList->FindObject("MMcRunHeader");
     134    if (!mcrunheader)
     135    {
     136        *fLog << warn << dbginf << "Warning - cannot check for camera version, MC run header not found." << endl;
     137        return kTRUE;
     138    }
     139
     140    if (mcrunheader->GetCamVersion() <= 40)
     141        fEnableFix = kTRUE;
     142
     143    return kTRUE;
     144}
     145
     146// --------------------------------------------------------------------------
     147//
    115148// Calculate the integral of the FADC time slices and store them as a new
    116149// pixel in the MCerPhotEvt container.
     
    144177        // 0 signal in all the slices.
    145178        //
     179        const Double_t mean = fEnableFix ? ped.GetMean()-0.5 : ped.GetMean();
    146180        if (nphot!=0)
    147             nphot -= fRunHeader->GetNumSamplesHiGain()*ped.GetMean();
     181            nphot -= fRunHeader->GetNumSamplesHiGain()*mean;
    148182
    149183        fCerPhotEvt->AddPixel(pixid, nphot, sqrt(fRunHeader->GetNumSamplesHiGain())*ped.GetSigma());
  • trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.h

    r1144 r1291  
    2626    MCerPhotEvt   *fCerPhotEvt; // Cerenkov Photon Event used for calculation
    2727    MRawRunHeader *fRunHeader;  //  RunHeader information
    28  
     28
     29    Bool_t         fEnableFix;  // fix for a bug in files from older camera versions (<=40)
     30
    2931public:
    3032    MCerPhotCalc(const char *name=NULL, const char *title=NULL);
     
    3335    Bool_t Process();
    3436
     37    Bool_t ReInit(MParList *pList);
     38
    3539    ClassDef(MCerPhotCalc, 0)   // Task to calculate cerenkov photons from raw data
    3640};
  • trunk/MagicSoft/include-Classes/MMcFormat/MMcRunHeader.hxx

    r1241 r1291  
    135135  void GetStarFieldRa(Int_t *hour, Int_t *minute, Int_t *second) const;
    136136  void GetStarFieldDec(Int_t *degree, Int_t *minute, Int_t *second) const;
    137  
     137
     138  UShort_t GetCamVersion() const { return fCamVersion; }
     139
    138140  ClassDef(MMcRunHeader, 2)     // storage container for general info
    139141};
Note: See TracChangeset for help on using the changeset viewer.