Changeset 5715


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

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MLog.h

    r4722 r5715  
    190190    void WriteEnv(TEnv &env, TString prefix="", Bool_t print=kFALSE) const;
    191191
    192     void Separator(TString str="", int outlvl=0)
     192    MLog &Separator(TString str="", int outlvl=0)
    193193    {
    194194        if (!str.IsNull())
     
    207207        (*this) << str << std::endl;
    208208        fOutputLevel = save;
     209
     210        return *this;
    209211    }
    210212
  • trunk/MagicSoft/Mars/mbase/MPrint.cc

    r3142 r5715  
    6565{
    6666    Init(0, 0);
    67     SetBit(kSeperator);
     67    SetBit(kSeparator);
    6868}
    6969
     
    118118    // The pointer is already given by the user.
    119119    //
    120     if (fObject || TestBit(kSeperator))
     120    if (fObject || TestBit(kSeparator))
    121121        return kTRUE;
    122122
     
    149149Int_t MPrint::Process()
    150150{
    151     if (TestBit(kSeperator))
    152         gLog << endl << setfill('-') << setw(72) << "-" << endl << endl;
     151    if (TestBit(kSeparator))
     152        gLog.Separator() << endl;
    153153    else
    154154        fObject->Print(fOption);
  • trunk/MagicSoft/Mars/mbase/MPrint.h

    r2580 r5715  
    1515    TString fOption;         // Print option
    1616
    17     enum { kSkip = BIT(14), kSeperator = BIT(15) };
     17    enum { kSkip = BIT(14), kSeparator = BIT(15) };
    1818
    1919    void Init(const char *name, const char *title);
  • trunk/MagicSoft/Mars/mfileio/MReadTree.cc

    r5692 r5715  
    287287//  via AddNotify.
    288288//
     289//  For unknown reasons root stores the SetAutoDelete-Flag in
     290//  a branch having a custom streamer (eg. MRawEvtData).
     291//  It is not allowed that a container which is in the parameter
     292//  list gets a new address. Therefor we reset all the autodel flags.
     293//
     294//  MAKE SURE THAT ALL YOPUR CUSTOM STREAMERS TAKE CARE OF ALL MEMORY
     295//
    289296Bool_t MReadTree::Notify()
    290297{
     
    299306    *fLog << GetNumEntry()-1 << ")" << endl;
    300307
     308    //
     309    // For unknown reasons root stores the SetAutoDelete-Flag in
     310    // a branch having a custom streamer (eg. MRawEvtData).
     311    // It is not allowed that a container which is in the parameter
     312    // list gets a new address. Therefor we reset all the autodel flags.
     313    //
     314    // MAKE SURE THAT ALL YOPUR CUSTOM STREAMERS TAKE CARE OF ALL MEMORY
     315    //
     316    TIter NextB(fTree->GetListOfBranches());
     317    TBranch *b=0;
     318    while ((b=(TBranch*)NextB()))
     319        if (b->IsAutoDelete())
     320        {
     321            *fLog << warn << "Branch " << b->GetName() << "->IsAutoDelete() set... resetting." << endl;
     322            b->SetAutoDelete(kFALSE);
     323        }
     324
    301325    if (!fNotify)
    302326        return kTRUE;
    303327
    304     TIter Next(fNotify);
     328    TIter NextN(fNotify);
    305329    TObject *o=NULL;
    306     while ((o=Next()))
     330    while ((o=NextN()))
    307331        if (!o->Notify())
    308332        {
  • 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.