Ignore:
Timestamp:
01/07/05 12:58:11 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mpedestal
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.cc

    r5570 r5715  
    189189//
    190190MExtractPedestal::MExtractPedestal(const char *name, const char *title)
    191     : fGeom(NULL), fPedestalsIn(NULL), fPedestalsOut(NULL), fExtractor(NULL),
    192       fExtractWinFirst(0), fExtractWinSize(0)
     191    : fRandomCalculation(kTRUE), fGeom(NULL), fPedestalsIn(NULL), fPedestalsOut(NULL),
     192      fExtractor(NULL), fExtractWinFirst(0), fExtractWinSize(0)
    193193{
    194194    fName  = name  ? name  : "MExtractPedestal";
     
    204204    SetNamePedestalCamIn();
    205205    SetNamePedestalCamOut();
    206     SetNumEventsDump();
    207     SetNumAreasDump();
    208     SetNumSectorsDump();
     206    SetNumDump();
    209207
    210208    Clear();
     
    361359  Print();
    362360
     361  // FIMXE: MUST call fExtractor->PreProcess()???
    363362  return kTRUE;
     363}
     364
     365Int_t MExtractPedestal::Process()
     366{
     367    if (fExtractor)
     368        fExtractor->SetNoiseCalculation(fRandomCalculation);
     369
     370    const Int_t rc = Calc();
     371
     372    if (fExtractor)
     373        fExtractor->SetNoiseCalculation(kFALSE);
     374
     375    return rc;
    364376}
    365377
     
    447459//    NumEventsDump:        500
    448460//    PedestalUpdate:       yes
     461//    RandomCalculation:    yes
    449462//
    450463Int_t MExtractPedestal::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     
    477490    {
    478491        SetPedestalUpdate(GetEnvValue(env, prefix, "PedestalUpdate", fPedestalUpdate));
     492        rc = kTRUE;
     493    }
     494
     495    // find resource for random calculation
     496    if (IsEnvDefined(env, prefix, "RandomCalculation", print))
     497    {
     498        SetRandomCalculation(GetEnvValue(env, prefix, "RandomCalculation", fRandomCalculation));
    479499        rc = kTRUE;
    480500    }
     
    640660    }
    641661    if (fExtractor)
    642         *fLog << "Extractor used:               " << fExtractor->ClassName() << endl;
     662    {
     663        *fLog << "Extractor used:               " << fExtractor->ClassName() << " (";
     664        *fLog << (fRandomCalculation?"":"non-") << "random)" << endl;
     665    }
    643666    *fLog << "ExtractWindow from slice " << fExtractWinFirst << " to " << fExtractWinLast << " incl." << endl;
    644667}
  • trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.h

    r5570 r5715  
    2626  static const TString  fgNamePedestalCam;  //! "MPedestalCam"
    2727
     28  TString fNamePedestalCamIn;   // name of the incoming 'MPedestalCam' container
     29  TString fNamePedestalCamOut;  // name of the outgoing 'MPedestalCam' container 
     30
     31  Bool_t  fRandomCalculation;  // Is pedestalextraction by extractor random?
     32
    2833protected:
    2934 
     
    3944  UShort_t fExtractWinSize;     // Number of slices to calculate the pedestal from
    4045  UShort_t fExtractWinLast;     // Last FADC slice to extract pedestal from
    41 
    42   TString fNamePedestalCamIn;   // name of the incoming 'MPedestalCam' container
    43   TString fNamePedestalCamOut;  // name of the outgoing 'MPedestalCam' container 
    4446
    4547  UInt_t  fNumEventsDump;       // Number of event after which MPedestalCam gets updated
     
    6668  MArrayI fSectorValid;        // number of valid pixels within sector idx
    6769
     70  // MTask virtual functions
    6871  Int_t  PreProcess(MParList *pList);
     72  Int_t  Process();
    6973  Int_t  PostProcess();
    7074  Bool_t ReInit(MParList *pList);
    7175  Int_t  ReadEnv(const TEnv &env, TString prefix, Bool_t print);
    7276
    73   virtual void ResetArrays();
     77  // Interface to be overwritten by a new class
     78  virtual void  ResetArrays();
     79  virtual Int_t Calc() = 0;
    7480
     81  // Helper functions
    7582  void CalcPixResults   (const UInt_t nevts, const UInt_t pixid);
    7683  void CalcAreaResults  (const UInt_t nevts, const UInt_t napix, const UInt_t aidx);
     
    8592  Bool_t SetExtractWindow(UShort_t first, UShort_t size);
    8693
    87   void SetNumEventsDump  (UInt_t dumpevents=500)  { fNumEventsDump  = dumpevents; }
    88   void SetNumAreasDump   (UInt_t dumpevents=500)  { fNumAreasDump   = dumpevents; }
    89   void SetNumSectorsDump (UInt_t dumpevents=500)  { fNumSectorsDump = dumpevents; }
     94  void SetNumEventsDump(UInt_t dumpevents=500)  { fNumEventsDump  = dumpevents; }
     95  void SetNumAreasDump(UInt_t dumpevents=500)  { fNumAreasDump   = dumpevents; }
     96  void SetNumSectorsDump(UInt_t dumpevents=500)  { fNumSectorsDump = dumpevents; }
     97  void SetNumDump(UInt_t n=500) { fNumEventsDump=n; fNumAreasDump=n; fNumSectorsDump=n; }
    9098  void SetPedestalUpdate (Bool_t pedupdate=kTRUE) { fPedestalUpdate = pedupdate;  }
    9199
     
    97105
    98106  void SetExtractor(MExtractTimeAndCharge *e) { fExtractor = e; }
     107  void SetRandomCalculation(Bool_t b=kTRUE) { fRandomCalculation = b; }
    99108
    100109  ClassDef(MExtractPedestal, 0)   // Base class for pedestal extractors
  • trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc

    r5570 r5715  
    280280// calculate the overall mean and rms in the PostProcess()
    281281//
    282 Int_t MPedCalcFromLoGain::Process()
     282Int_t MPedCalcFromLoGain::Calc()
    283283{
    284284    // This is the workaround to put hi- and lo-gains together
     
    422422
    423423    Float_t dummy;
    424     fExtractor->SetNoiseCalculation(kTRUE);
    425424    fExtractor->FindTimeAndChargeHiGain(logain,logain,sum,dummy,dummy,dummy,sat,ped,logainabflag);
    426     fExtractor->SetNoiseCalculation(kFALSE);
    427425}
    428426
     
    500498    MExtractPedestal::Print(o);
    501499
    502     *fLog << "CheckWindow   from slice  " << fCheckWinFirst   << " to " << fCheckWinLast << " incl." << endl;
    503     *fLog << "Max. allowed signal variation:             " << fMaxSignalVar << endl;
    504     *fLog << endl;
    505 }
     500    *fLog << "Max.allowed signal variation: " << fMaxSignalVar << endl;
     501    *fLog << "CheckWindow from slice " << fCheckWinFirst   << " to " << fCheckWinLast << " incl." << endl;
     502}
  • trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.h

    r5558 r5715  
    3535    MArrayB fSlices;             //! workaround to put hi- and lo-gain slices together
    3636
     37    Bool_t fRandomCalculation;
     38
    3739    Bool_t ReInit(MParList *pList);
    38     Int_t  Process();
     40    Int_t  Calc();
    3941    Int_t  PostProcess();
    4042
     
    4951
    5052public:
    51 
    5253    MPedCalcFromLoGain(const char *name=NULL, const char *title=NULL);
    5354
     
    5657    // Setters
    5758    Bool_t SetCheckRange(UShort_t checkfirst=fgCheckWinFirst, UShort_t checklast=fgCheckWinLast);
    58     void SetMaxSignalVar(UShort_t maxvar=40)       { fMaxSignalVar = maxvar;    }
     59    void SetMaxSignalVar(UShort_t maxvar=40)  { fMaxSignalVar = maxvar;    }
    5960
    6061    // Getters
  • trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc

    r5570 r5715  
    251251// calculate the overall mean and rms in the PostProcess()
    252252//
    253 Int_t MPedCalcPedRun::Process()
     253Int_t MPedCalcPedRun::Calc()
    254254{
    255255    if (!IsPedBitSet())
     
    316316
    317317    Float_t dummy;
    318     fExtractor->SetNoiseCalculation(kTRUE);
    319318    fExtractor->FindTimeAndChargeHiGain(first,logain,sum,dummy,dummy,dummy,sat,ped,abflag);
    320     fExtractor->SetNoiseCalculation(kFALSE);
    321319}
    322320
     
    433431void MPedCalcPedRun::Print(Option_t *o) const
    434432{
    435     *fLog << GetDescriptor() << ":" << endl;
    436     *fLog << "Name of input  MPedestalCam:   " << (fPedestalsIn?fPedestalsIn->GetName():fNamePedestalCamIn.Data()) << " (" << fPedestalsIn << ")" << endl;
    437     *fLog << "Name of output MPedestalCam:   " << (fPedestalsOut?fPedestalsOut->GetName():fNamePedestalCamOut.Data()) << " (" << fPedestalsOut << ")" << endl;
    438     *fLog << "ExtractWindow from slice       " << fExtractWinFirst << " to " << fExtractWinLast << " incl." << endl;
    439     *fLog << "Number overlap lo-gain slices: " << fOverlap << endl;
    440     *fLog << "First ped run out of sequence: " << (fIsFirstPedRun?"yes":"no") << endl;
    441     *fLog << "Number of used events so far:  " << fUsedEvents << endl;
    442 
    443     if (fExtractor)
    444         *fLog << "Extractor used:                " << fExtractor->ClassName() << endl;
    445 
    446     *fLog << endl;
    447 }
     433    MExtractPedestal::Print(o);
     434
     435    *fLog << "ExtractWindow from slice      " << fExtractWinFirst << " to " << fExtractWinLast << " incl." << endl;
     436    *fLog << "Num overlap lo-gain slices:   " << fOverlap << endl;
     437    *fLog << "First pedrun out of sequence: " << (fIsFirstPedRun?"yes":"no") << endl;
     438    *fLog << "Number of used events so far: " << fUsedEvents << endl;
     439}
  • trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.h

    r5558 r5715  
    2525    Bool_t ReInit(MParList *pList);
    2626    Int_t  PreProcess(MParList *pList);
    27     Int_t  Process();
     27    Int_t  Calc();
    2828    Int_t  PostProcess();
    2929
Note: See TracChangeset for help on using the changeset viewer.