Changeset 5381 for trunk


Ignore:
Timestamp:
11/11/04 10:32:21 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r5380 r5381  
    5959     - automatically get correct range for pedestal extraction
    6060       (MPedCalcFromLoGain) from Signal Extractor
     61
     62   * mjobs/MJPedestal.cc:
     63     - simplified a complicated if-else-construction towards a
     64       correct setting of ranges also for the calibration of the signal.
    6165
    6266
  • trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc

    r5324 r5381  
    332332        apply.SetGeometry(geom);
    333333    MBadPixelsMerge        merge(&badpix);
     334
    334335    MPedCalcFromLoGain     pedlo;
     336    pedlo.SetPedestalUpdate(kTRUE);
     337    // FIXME: How to get the fixed value 15 automatically?
     338    pedlo.SetExtractWindow(15, (Int_t)static_cast<MExtractor*>(extractor1)->GetNumHiGainSamples());
     339
    335340    MMcPedestalCopy        pcopy;
    336341    MTaskEnv taskenv1("ExtractSignal");
  • trunk/MagicSoft/Mars/mjobs/MJPedestal.cc

    r5361 r5381  
    503503Bool_t MJPedestal::CheckEnvLocal()
    504504{
    505 
    506   SetDataCheck(GetEnv("DataCheck", fDataCheck));
    507  
    508   if (HasEnv("DataCheckDisplay"))
    509     fDisplayType = GetEnv("DataCheckDisplay", kFALSE) ? kDataCheckDisplay : kNormalDisplay;
    510 
    511   if (HasEnv("UseData"))
    512     fExtractType = GetEnv("UseData",kFALSE) ? kUseData : kUsePedRun;
    513  
    514   if (HasEnv("UseExtractor"))
    515     if (GetEnv("UseExtractor",kFALSE))
    516       fExtractType = kUseExtractor;
    517 
    518   SetNoStorage   ( GetEnv("DisableOutput", IsNoStorage()   ));
    519  
    520   return kTRUE;
     505    SetDataCheck(GetEnv("DataCheck", fDataCheck));
     506
     507    if (HasEnv("DataCheckDisplay"))
     508        fDisplayType = GetEnv("DataCheckDisplay", kFALSE) ? kDataCheckDisplay : kNormalDisplay;
     509
     510    if (HasEnv("UseData"))
     511        fExtractType = GetEnv("UseData",kFALSE) ? kUseData : kUsePedRun;
     512
     513    if (HasEnv("UseExtractor"))
     514        if (GetEnv("UseExtractor",kFALSE))
     515            fExtractType = kUseExtractor;
     516
     517    SetNoStorage(GetEnv("DisableOutput", IsNoStorage()));
     518
     519    return kTRUE;
    521520}
    522521
     
    666665
    667666    MTaskEnv taskenv("ExtractPedestal");
    668     if (IsUseData())
    669       taskenv.SetDefault(&pedlogain);
    670     else if (IsUseExtractor())
    671       taskenv.SetDefault(fExtractor);
    672     else
    673       taskenv.SetDefault(&pedcalc);
    674 
    675     if (fExtractor)
    676     {
    677       if (IsUseData())
    678         pedlogain.SetExtractWindow(15,(Int_t)fExtractor->GetNumHiGainSamples());         
    679       else if (IsUsePedRun())
     667    switch (fExtractType)
     668    {
     669    case kUseData:
     670        taskenv.SetDefault(&pedlogain);
     671        if (!fExtractor)
     672            break;
     673        pedlogain.SetExtractWindow(15,(Int_t)fExtractor->GetNumHiGainSamples());
     674        break;
     675
     676    case kUsePedRun:
     677        if (!fExtractor)
     678            break;
     679        taskenv.SetDefault(&pedcalc);
     680        pedcalc.SetWindowSize((Int_t)fExtractor->GetNumHiGainSamples());
     681        pedcalc.SetRange(fExtractor->GetHiGainFirst(), fExtractor->GetHiGainLast());
     682        break;
     683
     684    case kUseExtractor:
     685        if (!fExtractor)
    680686        {
    681           pedcalc.SetWindowSize((Int_t)fExtractor->GetNumHiGainSamples());
    682           pedcalc.SetRange(fExtractor->GetHiGainFirst(), fExtractor->GetHiGainLast());
     687            *fLog << err << GetDescriptor();
     688            *fLog << "Extraction Type kUseExtractor is chosen, but no extractor has been handed over" << endl;
     689            return kFALSE;
    683690        }
    684       else if (IsUseExtractor())
    685         if (!fExtractor->IsNoiseCalculation())
    686           {
    687             *fLog << err << GetDescriptor()
    688                   << "Extraction Type kUseExtractor is chosen, but the extractor has no flag kNoiseCalculation set! " << endl;
    689             return kFALSE;
    690           }
    691     }
    692     else if (IsUseExtractor())
    693       {
    694         *fLog << err << GetDescriptor()
    695               << "Extraction Type kUseExtractor is chosen, but no extractor has been handed over" << endl;
    696         return kFALSE;
    697       }
    698    
    699   /*
    700     else
    701     {
     691        taskenv.SetDefault(fExtractor);
     692        if (fExtractor->IsNoiseCalculation())
     693            break;
     694
    702695        *fLog << warn << GetDescriptor();
    703         *fLog << ": No extractor has been chosen, take default number of FADC samples " << endl;
    704     }
    705     */
     696        *fLog <<"Extraction type is kUseExtractor, but extractor has kNoiseCalculation not set... set." << endl;
     697        fExtractor->SetNoiseCalculation();
     698        return kFALSE;
     699    }
    706700
    707701    tlist.AddToList(&geomapl);
  • trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc

    r5378 r5381  
    576576//
    577577//  The following resources are available:
    578 //    FirstCheckWindowSlice: 0
    579 //    LastCheckWindowSlice: 29
    580 //    ExtractWindowFirst:   15
    581 //    ExtractWindowSize:     6
    582 //    NumEventsDump:
     578//    FirstCheckWindowSlice:  0
     579//    LastCheckWindowSlice:  29
     580//    ExtractWindowFirst:    15
     581//    ExtractWindowSize:      6
     582//    NumEventsDump:        500
     583//    MaxSignalVar:          40
     584//    PedestalUpdate:       yes
    583585//
    584586Int_t MPedCalcFromLoGain::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
    585587{
    586     if (MExtractor::ReadEnv(env, prefix, print)==kERROR)
    587         return kERROR;
    588 
    589588    Bool_t rc=kFALSE;
    590589
     
    653652    *fLog << "Max allowed signal variation: " << fMaxSignalVar << endl;
    654653    *fLog << "Pedestal Update is " << (fPedestalUpdate?"on":"off") << endl;
    655     MExtractor::Print(o);
    656 }
     654}
  • trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.h

    r5378 r5381  
    22#define MARS_MPedCalcFromLoGain
    33
    4 #ifndef MARS_MExtractor
    5 #include "MExtractor.h"
     4#ifndef MARS_MTask
     5#include "MTask.h"
    66#endif
    77
     
    1515
    1616class MGeomCam;
    17 class MBadPixelsCam;
     17class MPedestalCam;
     18class MRawEvtData;
    1819class MRawEvtPixelIter;
     20class MRawRunHeader;
    1921
    20 class MPedCalcFromLoGain : public MExtractor
     22class MPedCalcFromLoGain : public MTask
    2123{
    2224    static const UShort_t fgCheckWinFirst;    // First FADC slice to check for signal (currently set to: 0)
     
    2628    static const UShort_t fgMaxSignalVar;     // The maximum difference between the highest and lowest slice
    2729
    28     MGeomCam *fGeom;                          // Camera geometry
     30    MGeomCam      *fGeom;        //! Camera geometry
     31    MPedestalCam  *fPedestals;   //! Pedestals of all pixels in the camera
     32    MRawEvtData   *fRawEvt;      //! Raw event data (time slices)
     33    MRawRunHeader *fRunHeader;   //! RunHeader information
    2934
    30     UInt_t   fNumEventsDump;                  // Number of event after which MPedestalCam gets updated
     35    UInt_t   fNumEventsDump;     // Number of event after which MPedestalCam gets updated
    3136
    3237    UShort_t fMaxSignalVar;
    3338    UShort_t fCheckWinFirst;
    3439    UShort_t fCheckWinLast;
    35     UShort_t fExtractWinSize;                 // Number of slices to calculate the pedestal from
     40    UShort_t fExtractWinSize;    // Number of slices to calculate the pedestal from
    3641    UShort_t fExtractWinFirst;
    3742    UShort_t fExtractWinLast;
  • trunk/MagicSoft/Mars/msignal/MExtractor.cc

    r5368 r5381  
    403403    }
    404404
     405    // Be carefull: Returning kERROR is not forseen in derived classes
    405406    return rc;
    406407}
  • trunk/MagicSoft/Mars/msignal/MExtractor.h

    r5362 r5381  
    7878  Bool_t  IsNoiseCalculation () const { return fNoiseCalculation; }
    7979 
    80   virtual void SetRange    ( Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0 );
     80  virtual void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0);
    8181
    82   void SetOffsetLoGain ( const Float_t f=fgOffsetLoGain) { fOffsetLoGain = f; }
    83   void SetSaturationLimit  ( Byte_t       lim=fgSaturationLimit        ) { fSaturationLimit  = lim; }
    84   void SetNamePedestalCam ( const char *name=fgNamePedestalCam.Data()) { fNamePedestalCam = name; }
    85   void SetNoiseCalculation( const Bool_t b=kFALSE )   {   fNoiseCalculation = b;  }
     82  void SetOffsetLoGain(const Float_t f=fgOffsetLoGain) { fOffsetLoGain = f; }
     83  void SetSaturationLimit(Byte_t lim=fgSaturationLimit) { fSaturationLimit  = lim; }
     84  void SetNamePedestalCam(const char *name=fgNamePedestalCam.Data()) { fNamePedestalCam = name; }
     85  void SetNoiseCalculation(const Bool_t b=kTRUE)        { fNoiseCalculation = b; }
    8686
    8787  void Print(Option_t *o="") const;
Note: See TracChangeset for help on using the changeset viewer.