Changeset 4722 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
08/24/04 14:51:17 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4721 r4722  
    7272     - for consistency renamed fWindowSize* to f*WindowSize
    7373
    74    * msignal/MExtractFixedWindowPeakSearch.[h,cc]:
     74   * msignal/MExtractTimeHighestIntegral.[h,cc]:
    7575     - added ReadEnv
    7676
  • trunk/MagicSoft/Mars/Makefile

    r4651 r4722  
    2121
    2222#PROGRAMS = readraw merpp mars test mona status
    23 PROGRAMS = readdaq readraw merpp star status mars mona showlog
     23PROGRAMS = readdaq readraw merpp mars mona showlog callisto showplot
    2424SOLIB    = libmars.so
    2525CINT     = M
  • trunk/MagicSoft/Mars/mbase/MArgs.cc

    r4452 r4722  
    231231// --------------------------------------------------------------------------
    232232//
     233// Returns GetIntAndRemove. If HasOption returns kFALSE def is returned.
     234//
     235Int_t MArgs::GetIntAndRemove(const TString name, Int_t def)
     236{
     237    if (!HasOption(name))
     238        return def;
     239    return GetIntAndRemove(name);
     240}
     241
     242// --------------------------------------------------------------------------
     243//
     244// Returns GetFloatAndRemove. If HasOption returns kFALSE def is returned.
     245//
     246Double_t MArgs::GetFloatAndRemove(const TString name, Double_t def)
     247{
     248    if (!HasOption(name))
     249        return def;
     250    return GetFloatAndRemove(name);
     251}
     252
     253// --------------------------------------------------------------------------
     254//
     255// Returns GetStringAndRemove. If HasOption returns kFALSE def is returned.
     256//
     257TString MArgs::GetStringAndRemove(const TString name, const TString def)
     258{
     259    if (!HasOption(name))
     260        return def;
     261    return GetStringAndRemove(name);
     262}
     263
     264// --------------------------------------------------------------------------
     265//
    233266// Return the TString corresponding to the i-th argument.
    234267// This is ment for enumerations like
  • trunk/MagicSoft/Mars/mbase/MArgs.h

    r3183 r4722  
    4343    TString  GetStringAndRemove(const TString name);
    4444
     45    Int_t    GetIntAndRemove(const TString name, Int_t def);
     46    Double_t GetFloatAndRemove(const TString name, Double_t def);
     47    TString  GetStringAndRemove(const TString name, const TString def);
     48
    4549    Bool_t   Has(const TString name) const;
    4650    Bool_t   HasOnly(const TString name) const;
  • trunk/MagicSoft/Mars/mbase/MDirIter.cc

    r4215 r4722  
    151151// --------------------------------------------------------------------------
    152152//
     153// Adds all entries from iter to this object
     154//
     155void MDirIter::Add(const MDirIter &iter)
     156{
     157    TIter Next(&iter.fList);
     158    TObject *o=0;
     159    while ((o=Next()))
     160        fList.Add(o->Clone());
     161}
     162
     163// --------------------------------------------------------------------------
     164//
    153165//  Return the pointer to the current directory. If the pointer is NULL
    154166//  a new directory is opened. If no new directory can be opened NULL is
  • trunk/MagicSoft/Mars/mbase/MDirIter.h

    r4219 r4722  
    4949
    5050    Int_t AddDirectory(const char *dir, const char *filter="", Int_t recursive=0);
     51    void  Add(const MDirIter &iter);
    5152    void  Reset();
    5253
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r4601 r4722  
    964964Bool_t MEvtLoop::ReadEnv(const char *config)
    965965{
    966     return config ? ReadEnv(TEnv(config)) : kTRUE;
     966    if (!config)
     967        return kTRUE;
     968
     969    const Bool_t fileexist = !gSystem->AccessPathName(config, kFileExists);
     970    if (!fileexist)
     971    {
     972        *fLog << warn << "WARNING - resource file '" << config << "' not found... no resources applied." << endl;
     973        return kFALSE;
     974    }
     975
     976    return ReadEnv(TEnv(config));
    967977}
    968978
  • trunk/MagicSoft/Mars/mbase/MLog.cc

    r4601 r4722  
    512512// --------------------------------------------------------------------------
    513513//
     514// Print usage information setup in Setup()
     515//
     516void MLog::Usage()
     517{
     518    //                 1         2         3         4         5         6         7         8
     519    //        12345678901234567890123456789012345678901234567890123456789012345678901234567890
     520    *this << "   -v#                       Verbosity level # [default=2]" << endl;
     521    *this << "   -a, --no-colors           Do not use Ansii color codes" << endl;
     522    *this << "   --debug[=n]               Enable root debugging [default: gDebug=1]" << endl;
     523}
     524
     525// --------------------------------------------------------------------------
     526//
    514527// Setup MLog and global debug output from command line arguments.
    515528//
  • trunk/MagicSoft/Mars/mbase/MLog.h

    r4452 r4722  
    185185
    186186    void Setup(MArgs &arg);
     187    void Usage();
    187188
    188189    void ReadEnv(const TEnv &env, TString prefix="", Bool_t print=kFALSE);
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.cc

    r4695 r4722  
    186186    : fEnv(0), fRuns(0), fSequence(0), fExtractor(NULL), fTimeExtractor(NULL),
    187187      fColor(MCalibrationCam::kNONE), fDisplayType(kNormalDisplay),
    188       fRelTimes(kFALSE), fDataCheck(kFALSE), fDebug(kFALSE)
     188      fRelTimes(kFALSE), fDataCheck(kFALSE), fDebug(kFALSE), fOverwrite(kFALSE)
    189189{
    190190
     
    12471247}
    12481248
     1249// --------------------------------------------------------------------------
     1250//
     1251// MJCalibration allows to setup several option by a resource file:
     1252//   MJCalibration.OutputPath: path
     1253//   MJCalibration.InputPath: path
     1254//   MJCalibration.Display: full, datacheck, normal
     1255//   MJCalibration.RelTimeCalibration: yes,no
     1256//   MJCalibration.Datacheck: yes,no
     1257//   MJCalibration.Debug: yes,no
     1258//   MJCalibration.UseBlindPixel: yes,no
     1259//   MJCalibration.UsePINDiode: yes,no
     1260//
     1261// For more details see the class description and the corresponding Getters
     1262//
    12491263void MJCalibration::CheckEnv()
    12501264{
     
    12771291    SetUseBlindPixel(fEnv->GetValue("MJCalibration.UseBlindPixel", IsUseBlindPixel()));
    12781292    SetUsePINDiode(fEnv->GetValue("MJCalibration.UsePINDiode", IsUsePINDiode()));
     1293
     1294    SetOverwrite(fEnv->GetValue("MJPedestal.AllowOverwrite", fOverwrite));
     1295    SetInputPath(fEnv->GetValue("MJPedestal.InputPath", fInputPath));
    12791296}
    12801297
     
    14151432    MDirIter iter;
    14161433    if (fSequence)
    1417         fSequence->SetupCalRuns(iter);
     1434    {
     1435        if (fSequence->SetupCalRuns(iter, fInputPath)==0)
     1436        {
     1437            *fLog << err << "ERROR - No input files of sequence found!" << endl;
     1438            return kFALSE;
     1439        }
     1440    }
    14181441
    14191442    if (fDataCheck)
     
    16661689// --------------------------------------------------------------------------
    16671690//
     1691// Set the path from which the sequence files are read
     1692//
     1693void MJCalibration::SetInputPath(const char *path)
     1694{
     1695    fInputPath = path;
     1696    if (fInputPath.EndsWith("/"))
     1697        fInputPath = fInputPath(0, fInputPath.Length()-1);
     1698}
     1699
     1700// --------------------------------------------------------------------------
     1701//
    16681702// Set the useage of the Blind Pixel device
    16691703//
     
    17021736    *fLog << inf << "Writing to file: " << oname << endl;
    17031737
    1704     TFile file(oname, "RECREATE");
     1738    TFile file(oname, fOverwrite?"RECREATE":"NEW", "File created by MJCalibration", 9);
     1739    if (!file.IsOpen())
     1740    {
     1741        *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;
     1742        return kFALSE;
     1743    }
    17051744
    17061745    *fLog << inf << " - MStatusDisplay..." << flush;
  • trunk/MagicSoft/Mars/mjobs/MJPedestal.cc

    r4695 r4722  
    9191MJPedestal::MJPedestal(const char *name, const char *title)
    9292    : fEnv(0), fRuns(0), fSequence(0), fExtractor(NULL), fDisplayType(kNormalDisplay),
    93       fDataCheck(kFALSE), fUseData(kFALSE), fMaxEvents(0)
     93      fDataCheck(kFALSE), fUseData(kFALSE), fOverwrite(kFALSE), fMaxEvents(0)
    9494{
    9595    fName  = name  ? name  : "MJPedestal";
     
    451451    *fLog << inf << "Writing to file: " << oname << endl;
    452452
    453     TFile file(oname, "RECREATE");
     453    TFile file(oname, fOverwrite?"RECREATE":"NEW", "File created by MJPedestal", 9);
     454    if (!file.IsOpen())
     455    {
     456        *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;
     457        return kFALSE;
     458    }
    454459
    455460    if (fDisplay && fDisplay->Write()<=0)
     
    481486}
    482487
     488// --------------------------------------------------------------------------
     489//
     490// Set the path from which the sequence files are read
     491//
     492void MJPedestal::SetInputPath(const char *path)
     493{
     494    fInputPath = path;
     495    if (fInputPath.EndsWith("/"))
     496        fInputPath = fInputPath(0, fInputPath.Length()-1);
     497}
     498
    483499void MJPedestal::SetEnv(const char *env)
    484500{
     
    496512}
    497513
     514// --------------------------------------------------------------------------
     515//
     516// MJPedestsl allows to setup several option by a resource file:
     517//   MJPedestal.OutputPath: path
     518//   MJPedestal.MaxEvents: 1000
     519//   MJPedestal.AllowOverwrite: yes, no
     520//   MJPedestal.UseData: yes, no (use DatRuns from sequence instead of PedRuns)
     521//
     522// For more details see the class description and the corresponding Getters
     523//
    498524void MJPedestal::CheckEnv()
    499525{
     
    508534    }
    509535
    510     fMaxEvents = fEnv->GetValue("MJPedestal.MaxEvents", fMaxEvents);
    511     fUseData   = fEnv->GetValue("MJPedestal.UseData",   fUseData);
     536    SetMaxEvents(fEnv->GetValue("MJPedestal.MaxEvents", fMaxEvents));
     537    SetOverwrite(fEnv->GetValue("MJPedestal.AllowOverwrite", fOverwrite));
     538
     539    fUseData = fEnv->GetValue("MJPedestal.UseData", fUseData);
    512540}
    513541
     
    548576    MDirIter iter;
    549577    if (fSequence)
    550         fUseData ? fSequence->SetupDatRuns(iter) : fSequence->SetupPedRuns(iter);
     578    {
     579        const Int_t n = fUseData ? fSequence->SetupDatRuns(iter, fInputPath) : fSequence->SetupPedRuns(iter, fInputPath);
     580        if (n==0)
     581        {
     582            *fLog << err << "ERROR - No input files of sequence found!" << endl;
     583            return kFALSE;
     584        }
     585    }
    551586
    552587    if (fDataCheck)
  • trunk/MagicSoft/Mars/mjobs/MSequence.cc

    r4695 r4722  
    2727//  MSequence
    2828//
     29//  This class describes a sequence. For sequences see:
     30//    http://magic.astro.uni-wuerzburg.de/mars/db/queryseq.html
     31//
     32//  A sequence is a collection of runs which should be used together.
     33//
    2934/////////////////////////////////////////////////////////////////////////////
    3035#include "MSequence.h"
     
    3439#include <TEnv.h>
    3540#include <TRegexp.h>
     41#include <TSystem.h> // TSystem::ExpandPath
    3642
    3743#include "MLog.h"
     
    4450using namespace std;
    4551
     52// --------------------------------------------------------------------------
     53//
     54// Copy the run numbers from the TString runs into the TArrayI data
     55//
    4656void MSequence::Split(TString &runs, TArrayI &data) const
    4757{
     
    6373}
    6474
    65 void MSequence::SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path) const
     75Int_t MSequence::SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path) const
    6676{
    6777    TString d(path);
    6878
    6979    // Setup path
    70     if (!path)
     80    if (d.IsNull())
    7181    {
    7282        d  = Form("/data/MAGIC/Period%03d/rootdata/", fPeriod);
    7383        d += fNight.GetStringFmt("%Y_%m_%d");
    7484    }
     85
     86    Int_t num = 0;
    7587
    7688    for (int i=0; i<arr.GetSize(); i++)
     
    8395
    8496        // Add Path/File to TIter
    85         iter.AddDirectory(d, n, 0);
    86     }
    87 }
    88 
     97        num += iter.AddDirectory(d, n, 0);
     98    }
     99    return num;
     100}
     101
     102// --------------------------------------------------------------------------
     103//
     104// Read the file fname as setup file for the sequence.
     105//
    89106MSequence::MSequence(const char *fname)
    90107{
     
    96113    TString str;
    97114
    98     fSequence  = env.GetValue("Sequence", -1);
    99     fLastRun   = env.GetValue("LastRun", -1);
     115    fSequence  = env.GetValue("Sequence",  -1);
     116    fLastRun   = env.GetValue("LastRun",   -1);
    100117    fNumEvents = env.GetValue("NumEvents", -1);
    101     fPeriod    = env.GetValue("Period", -1);
     118    fPeriod    = env.GetValue("Period",    -1);
    102119
    103120    str = env.GetValue("Start", "");
     
    122139}
    123140
     141// --------------------------------------------------------------------------
     142//
     143// Print the contents of the sequence
     144//
    124145void MSequence::Print(Option_t *o) const
    125146{
    126147    gLog << all;
     148    if (!IsValid())
     149    {
     150        gLog << "Sequence: " << fName << " <invalid>" << endl;
     151        return;
     152    }
    127153    gLog << "Sequence:     " << fSequence << endl;
    128154    gLog << "Period:       " << fPeriod << endl;
     
    153179}
    154180
    155 void MSequence::SetupPedRuns(MDirIter &iter, const char *path) const
    156 {
    157     SetupRuns(iter, fPedRuns, path);
    158 }
    159 
    160 void MSequence::SetupDatRuns(MDirIter &iter, const char *path) const
    161 {
    162     SetupRuns(iter, fDatRuns, path);
    163 }
    164 
    165 void MSequence::SetupAllRuns(MDirIter &iter, const char *path) const
    166 {
    167     SetupRuns(iter, fRuns, path);
    168 }
    169 
    170 void MSequence::SetupCalRuns(MDirIter &iter, const char *path) const
    171 {
    172     SetupRuns(iter, fCalRuns, path);
    173 }
     181// --------------------------------------------------------------------------
     182//
     183// Add all ped runs from the sequence to MDirIter.
     184// If path==0 the standard path of the data-center is assumed.
     185// If you have the runs locally use path="."
     186// Return the number of files added.
     187//
     188Int_t MSequence::SetupPedRuns(MDirIter &iter, const char *path) const
     189{
     190    return SetupRuns(iter, fPedRuns, path);
     191}
     192
     193// --------------------------------------------------------------------------
     194//
     195// Add all data runs from the sequence to MDirIter.
     196// If path==0 the standard path of the data-center is assumed.
     197// If you have the runs locally use path="."
     198// Return the number of files added.
     199//
     200Int_t MSequence::SetupDatRuns(MDirIter &iter, const char *path) const
     201{
     202    return SetupRuns(iter, fDatRuns, path);
     203}
     204
     205// --------------------------------------------------------------------------
     206//
     207// Add all runs from the sequence to MDirIter.
     208// If path==0 the standard path of the data-center is assumed.
     209// If you have the runs locally use path="."
     210// Return the number of files added.
     211//
     212Int_t MSequence::SetupAllRuns(MDirIter &iter, const char *path) const
     213{
     214    return SetupRuns(iter, fRuns, path);
     215}
     216
     217// --------------------------------------------------------------------------
     218//
     219// Add all calibration runs from the sequence to MDirIter.
     220// If path==0 the standard path of the data-center is assumed.
     221// If you have the runs locally use path="."
     222// Return the number of files added.
     223//
     224Int_t MSequence::SetupCalRuns(MDirIter &iter, const char *path) const
     225{
     226    return SetupRuns(iter, fCalRuns, path);
     227}
  • trunk/MagicSoft/Mars/mjobs/MSequence.h

    r4716 r4722  
    3636
    3737    void Split(TString &runs, TArrayI &data) const;
    38     void SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path) const;
     38    Int_t SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path) const;
    3939
    4040public:
     
    4545    Bool_t IsValid() const { return fSequence!=(UInt_t)-1; }
    4646
    47     void SetupPedRuns(MDirIter &iter, const char *path=0) const;
    48     void SetupDatRuns(MDirIter &iter, const char *path=0) const;
    49     void SetupAllRuns(MDirIter &iter, const char *path=0) const;
    50     void SetupCalRuns(MDirIter &iter, const char *path=0) const;
     47    Int_t SetupPedRuns(MDirIter &iter, const char *path=0) const;
     48    Int_t SetupDatRuns(MDirIter &iter, const char *path=0) const;
     49    Int_t SetupAllRuns(MDirIter &iter, const char *path=0) const;
     50    Int_t SetupCalRuns(MDirIter &iter, const char *path=0) const;
    5151
    5252    // Getter
  • trunk/MagicSoft/Mars/mmain/MEventDisplay.cc

    r4714 r4722  
    248248    fEvtLoop->SetOwner();
    249249    fEvtLoop->SetParList(plist);
     250    fEvtLoop->ReadEnv("mars.rc");
    250251
    251252    MHEvent *evt01 = new MHEvent(MHEvent::kEvtSignalRaw);
     
    254255    MHEvent *evt04 = new MHEvent(MHEvent::kEvtPedestalRMS);
    255256    MHEvent *evt05 = new MHEvent(MHEvent::kEvtRelativeSignal);
    256     MHEvent *evt06 = new MHEvent(MHEvent::kEvtCleaningLevels);
     257    MHEvent *evt06a= new MHEvent(MHEvent::kEvtCleaningData);
     258    MHEvent *evt06b= new MHEvent(MHEvent::kEvtCleaningLevels);
    257259    MHEvent *evt07 = new MHEvent(MHEvent::kEvtIdxMax);
    258260    MHEvent *evt08 = new MHEvent(MHEvent::kEvtArrTime);
     
    265267    evt04->SetName("PedRMS");
    266268    evt05->SetName("Signal/PedRMS");
    267     evt06->SetName("CleanLevels");
     269    evt06a->SetName("CleanData");
     270    evt06b->SetName("CleanLevels");
    268271    evt07->SetName("Max Slice Idx");
    269272    evt08->SetName("Arrival Time");
     
    277280    plist->AddToList(evt04);
    278281    plist->AddToList(evt05);
    279     plist->AddToList(evt06);
     282    plist->AddToList(evt06a);
     283    plist->AddToList(evt06b);
    280284    plist->AddToList(evt07);
    281285    plist->AddToList(evt08);
     
    290294    MFillH             *fill04 = new MFillH(evt04, "MPedPhotCam", "MFillH04");
    291295    MFillH             *fill05 = new MFillH(evt05, "MCameraData", "MFillH05");
    292     MFillH             *fill06 = new MFillH(evt06, "MCameraData", "MFillH06");
     296    MFillH             *fill06a= new MFillH(evt06a, "MCameraData", "MFillH06");
     297    MFillH             *fill06b= new MFillH(evt06b, "MCameraData", "MFillH06");
    293298//    MBlindPixelCalc   *blind = new MBlindPixelCalc;
    294299    MHillasCalc        *hcalc  = new MHillasCalc;
     
    357362    tlist->AddToList(fill04);
    358363    tlist->AddToList(fill05);
    359     tlist->AddToList(fill06);
     364    tlist->AddToList(fill06a);
     365    tlist->AddToList(fill06b);
    360366//    tlist->AddToList(blind);
    361367    tlist->AddToList(hcalc);
  • trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.cc

    r4340 r4722  
    11/* ======================================================================== *\
    2    !
    3    ! *
    4    ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
    5    ! * Software. It is distributed to you in the hope that it can be a useful
    6    ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
    7    ! * It is distributed WITHOUT ANY WARRANTY.
    8    ! *
    9    ! * Permission to use, copy, modify and distribute this software and its
    10    ! * documentation for any purpose is hereby granted without fee,
    11    ! * provided that the above copyright notice appear in all copies and
    12    ! * that both that copyright notice and this permission notice appear
    13    ! * in supporting documentation. It is provided "as is" without express
    14    ! * or implied warranty.
    15    ! *
    16    !
    17    !
    18    !   Author(s): Abelardo Moralejo,04/2004 <mailto:moralejo@pd.infn.it>
    19    !              Markus Gaug      ,04/2004 <mailto:markus@ifae.es>
    20    !   Copyright: MAGIC Software Development, 2000-2004
    21    !
    22    !
    23    \* ======================================================================== */
     2!
     3! *
     4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
     5! * Software. It is distributed to you in the hope that it can be a useful
     6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
     7! * It is distributed WITHOUT ANY WARRANTY.
     8! *
     9! * Permission to use, copy, modify and distribute this software and its
     10! * documentation for any purpose is hereby granted without fee,
     11! * provided that the above copyright notice appear in all copies and
     12! * that both that copyright notice and this permission notice appear
     13! * in supporting documentation. It is provided "as is" without express
     14! * or implied warranty.
     15! *
     16!
     17!
     18!   Author(s): Abelardo Moralejo, 04/2004 <mailto:moralejo@pd.infn.it>
     19!   Author(s): Markus Gaug, 04/2004 <mailto:markus@ifae.es>
     20!
     21!   Copyright: MAGIC Software Development, 2000-2004
     22!
     23!
     24\* ======================================================================== */
    2425
    2526//////////////////////////////////////////////////////////////////////////////
     
    5556//   fLoGainWindowSize     = fgLoGainWindowSize     = 6
    5657//   fPeakSearchWindowSize = fgPeakSearchWindowSize = 4
    57 //   fLowGainPeakShift     = fgLowGainPeakShift     = 0
     58//   fLoGainPeakShift      = fgLoGainPeakShift      = 0
    5859//
    5960//////////////////////////////////////////////////////////////////////////////
     
    8485const Byte_t MExtractFixedWindowPeakSearch::fgPeakSearchWindowSize = 4;
    8586const Byte_t MExtractFixedWindowPeakSearch::fgOffsetFromWindow     = 1;
    86 const Byte_t MExtractFixedWindowPeakSearch::fgLowGainPeakShift     = 0;
     87const Byte_t MExtractFixedWindowPeakSearch::fgLoGainPeakShift      = 0;
    8788// --------------------------------------------------------------------------
    8889//
     
    9091//
    9192// Sets:
    92 // - fWindowSizeHiGain to fgWindowSizeHiGain
    93 // - fWindowSizeLoGain to fgWindowSizeLoGain
     93// - fHiGainWindowSize to fgHiGainWindowSize
     94// - fLoGainWindowSize to fgLoGainWindowSize
    9495// - fPeakSearchWindowSize to fgPeakSearchWindowSize
    95 // - fLowGainPeakShift to fgLowGainPeakShift
     96// - fLoGainPeakShift to fgLoGainPeakShift
    9697//
    9798// Calls:
     
    100101//
    101102MExtractFixedWindowPeakSearch::MExtractFixedWindowPeakSearch(const char *name, const char *title)
    102     : fWindowSizeHiGain(fgHiGainWindowSize),
    103       fWindowSizeLoGain(fgLoGainWindowSize),
     103    : fHiGainWindowSize(fgHiGainWindowSize),
     104      fLoGainWindowSize(fgLoGainWindowSize),
    104105      fPeakSearchWindowSize(fgPeakSearchWindowSize),
    105       fLowGainPeakShift(fgLowGainPeakShift)
     106      fLoGainPeakShift(fgLoGainPeakShift)
    106107{
    107108
     
    119120// Calls:
    120121// - MExtractor::SetRange(hifirst,hilast,lofirst,lolast);
    121 // - SetWindows(fWindowSizeHiGain,fWindowSizeLoGain,fPeakSearchWindowSize);
     122// - SetWindows(fHiGainWindowSize,fLoGainWindowSize,fPeakSearchWindowSize);
    122123//
    123124void MExtractFixedWindowPeakSearch::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t lofirst, Byte_t lolast)
     
    129130  // Redo the checks if the window is still inside the ranges
    130131  //
    131   SetWindows(fWindowSizeHiGain,fWindowSizeLoGain,fPeakSearchWindowSize);
     132  SetWindows(fHiGainWindowSize,fLoGainWindowSize,fPeakSearchWindowSize);
    132133 
    133134}
     
    141142//
    142143// Sets:
    143 // - fNumHiGainSamples to: (Float_t)fWindowSizeHiGain
    144 // - fNumLoGainSamples to: (Float_t)fWindowSizeLoGain
     144// - fNumHiGainSamples to: (Float_t)fHiGainWindowSize
     145// - fNumLoGainSamples to: (Float_t)fLoGainWindowSize
    145146// - fSqrtHiGainSamples to: TMath::Sqrt(fNumHiGainSamples)
    146147// - fSqrtLoGainSamples to: TMath::Sqrt(fNumLoGainSamples) 
     
    149150{
    150151
    151   fWindowSizeHiGain     = windowh & ~1;
    152   fWindowSizeLoGain     = windowl & ~1;
     152  fHiGainWindowSize     = windowh & ~1;
     153  fLoGainWindowSize     = windowl & ~1;
    153154  fPeakSearchWindowSize = peaksearchwindow & ~1;
    154155
    155   if (fWindowSizeHiGain != windowh)
     156  if (fHiGainWindowSize != windowh)
    156157    *fLog << warn << GetDescriptor() << ": Hi Gain window size has to be even, set to: "
    157           << int(fWindowSizeHiGain) << " samples " << endl;
    158  
    159   if (fWindowSizeLoGain != windowl)
     158          << int(fHiGainWindowSize) << " samples " << endl;
     159 
     160  if (fLoGainWindowSize != windowl)
    160161    *fLog << warn << GetDescriptor() << ": Lo Gain window size has to be even, set to: "
    161           << int(fWindowSizeLoGain) << " samples " << endl;
     162          << int(fLoGainWindowSize) << " samples " << endl;
    162163   
    163164  if (fPeakSearchWindowSize != peaksearchwindow)
     
    168169  const Byte_t availlorange = (fLoGainLast-fLoGainFirst+1) & ~1;
    169170
    170   if (fWindowSizeHiGain > availhirange)
     171  if (fHiGainWindowSize > availhirange)
    171172    {
    172173      *fLog << warn << GetDescriptor()
    173             << Form("%s%2i%s%2i%s%2i%s",": Hi Gain window size: ",(int)fWindowSizeHiGain,
     174            << Form("%s%2i%s%2i%s%2i%s",": Hi Gain window size: ",(int)fHiGainWindowSize,
    174175                    " is bigger than available range: [",(int)fHiGainFirst,",",(int)fHiGainLast,"]") << endl;
    175176      *fLog << warn << GetDescriptor()
    176177            << ": Will set window size to: " << (int)availhirange << endl;
    177       fWindowSizeHiGain = availhirange;
    178     }
    179  
    180  
    181   if (fWindowSizeLoGain > availlorange)
     178      fHiGainWindowSize = availhirange;
     179    }
     180 
     181 
     182  if (fLoGainWindowSize > availlorange)
    182183    {
    183184      *fLog << warn << GetDescriptor()
    184             << Form("%s%2i%s%2i%s%2i%s",": Lo Gain window size: ",(int)fWindowSizeLoGain,
     185            << Form("%s%2i%s%2i%s%2i%s",": Lo Gain window size: ",(int)fLoGainWindowSize,
    185186                    " is bigger than available range: [",(int)fLoGainFirst,",",(int)fLoGainLast,"]") << endl;
    186187      *fLog << warn << GetDescriptor()
    187188            << ": Will set window size to: " << (int)availlorange << endl;
    188       fWindowSizeLoGain = availlorange;
    189     }
    190  
    191   if (fWindowSizeHiGain<2)
    192     {
    193       fWindowSizeHiGain = 2;
     189      fLoGainWindowSize = availlorange;
     190    }
     191 
     192  if (fHiGainWindowSize<2)
     193    {
     194      fHiGainWindowSize = 2;
    194195      *fLog << warn << GetDescriptor() << ": Hi Gain window size set to two samples" << endl;
    195196    }
    196197 
    197   if (fWindowSizeLoGain<2)
    198     {
    199       fWindowSizeLoGain = 2;
     198  if (fLoGainWindowSize<2)
     199    {
     200      fLoGainWindowSize = 2;
    200201      *fLog << warn << GetDescriptor() << ": Lo Gain window size set to two samples" << endl;
    201202    }
     
    208209    }
    209210
    210   fNumHiGainSamples = (Float_t)fWindowSizeHiGain;
    211   fNumLoGainSamples = (Float_t)fWindowSizeLoGain;
     211  fNumHiGainSamples = (Float_t)fHiGainWindowSize;
     212  fNumLoGainSamples = (Float_t)fLoGainWindowSize;
    212213
    213214  fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples);
     
    295296// FindSignalHiGain:
    296297//
    297 // - Loop from ptr to (ptr+fWindowSizeHiGain)
     298// - Loop from ptr to (ptr+fHiGainWindowSize)
    298299// - Sum up contents of *ptr
    299300// - If *ptr is greater than fSaturationLimit, raise sat by 1
     
    302303{
    303304
    304   Byte_t *end = ptr + fWindowSizeHiGain-fHiLoLast;
     305  Byte_t *end = ptr + fHiGainWindowSize-fHiLoLast;
    305306
    306307  Int_t summ = 0;
     
    316317
    317318  //
    318   // If part of the "low-Gain" slices are used,
     319  // If part of the "lo-Gain" slices are used,
    319320  // repeat steps one and two for the logain part until fHiLoLast
    320321  //
     
    337338// FindSignalLoGain:
    338339//
    339 // - Loop from ptr to (ptr+fWindowSizeLoGain)
     340// - Loop from ptr to (ptr+fLoGainWindowSize)
    340341// - Sum up contents of *ptr
    341342// - If *ptr is greater than fSaturationLimit, raise sat by 1
     
    349350  Int_t summ = 0;
    350351
    351   while (p<ptr+fWindowSizeLoGain)
     352  while (p<ptr+fLoGainWindowSize)
    352353    {
    353354      summ += *p;
     
    400401
    401402
    402   loGainFirst = ( hiGainFirst+fLowGainPeakShift > fLoGainFirst ) ?
    403       hiGainFirst+fLowGainPeakShift : fLoGainFirst;
     403  loGainFirst = ( hiGainFirst+fLoGainPeakShift > fLoGainFirst ) ?
     404      hiGainFirst+fLoGainPeakShift : fLoGainFirst;
    404405
    405406  // Make sure we will not integrate beyond the hi gain limit:
    406   if (hiGainFirst+fWindowSizeHiGain > pixel.GetNumHiGainSamples())
    407     fHiLoLast = hiGainFirst+fWindowSizeHiGain - pixel.GetNumHiGainSamples();
    408   //    hiGainFirst = pixel.GetNumHiGainSamples()-fWindowSizeHiGain;
     407  if (hiGainFirst+fHiGainWindowSize > pixel.GetNumHiGainSamples())
     408    fHiLoLast = hiGainFirst+fHiGainWindowSize - pixel.GetNumHiGainSamples();
     409  //    hiGainFirst = pixel.GetNumHiGainSamples()-fHiGainWindowSize;
    409410
    410411  // Make sure we will not integrate beyond the lo gain limit:
    411   if (loGainFirst+fWindowSizeLoGain > pixel.GetNumLoGainSamples())
    412     loGainFirst = pixel.GetNumLoGainSamples()-fWindowSizeLoGain;
     412  if (loGainFirst+fLoGainWindowSize > pixel.GetNumLoGainSamples())
     413    loGainFirst = pixel.GetNumLoGainSamples()-fLoGainWindowSize;
    413414
    414415  pixel.Reset();
     
    465466  return kTRUE;
    466467}
     468
     469// --------------------------------------------------------------------------
     470//
     471// In addition to the resources of the base-class MExtractor:
     472//   MJPedestal.MExtractor.WindowSizeHiGain: 6
     473//   MJPedestal.MExtractor.WindowSizeLoGain: 6
     474//   MJPedestal.MExtractor.PeakSearchWindow: 4
     475//   MJPedestal.MExtractor.OffsetFromWindow: 1
     476//   MJPedestal.MExtractor.LoGainPeakShift:  0
     477//
     478Int_t MExtractFixedWindowPeakSearch::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     479{
     480    Byte_t hw = fHiGainWindowSize;
     481    Byte_t lw = fLoGainWindowSize;
     482    Byte_t pw = fPeakSearchWindowSize;
     483
     484    Bool_t rc = kFALSE;
     485
     486    if (IsEnvDefined(env, prefix, "PeakSearchWindow", print))
     487    {
     488        pw = GetEnvValue(env, prefix, "PeakSearchWindow", pw);
     489        rc = kTRUE;
     490    }
     491    if (IsEnvDefined(env, prefix, "HiGainWindowSize", print))
     492    {
     493        hw = GetEnvValue(env, prefix, "HiGainWindowSize", hw);
     494        rc = kTRUE;
     495    }
     496    if (IsEnvDefined(env, prefix, "LoGainWindowSize", print))
     497    {
     498        lw = GetEnvValue(env, prefix, "LoGainWindowSize", lw);
     499        rc = kTRUE;
     500    }
     501
     502    if (rc)
     503        SetWindows(hw, lw, pw);
     504
     505
     506    if (IsEnvDefined(env, prefix, "OffsetFromWindow", print))
     507    {
     508        SetOffsetFromWindow(GetEnvValue(env, prefix, "OffsetFromWindow", fOffsetFromWindow));
     509        rc = kTRUE;
     510    }
     511
     512    if (IsEnvDefined(env, prefix, "LoGainPeakShift", print))
     513    {
     514        SetLoGainPeakShift(GetEnvValue(env, prefix, "LoGainPeakShift", fLoGainPeakShift));
     515        rc = kTRUE;
     516    }
     517
     518    rc = MExtractor::ReadEnv(env, prefix, print) ? kTRUE : rc;
     519
     520    return rc;
     521}
  • trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.h

    r4340 r4722  
    1818  static const Byte_t fgPeakSearchWindowSize; // Default for fPeakSearchWindowSize (now set to: 4)
    1919  static const Byte_t fgOffsetFromWindow;     // Default for fOffsetFromWindow (now set to: 1)
    20   static const Byte_t fgLowGainPeakShift;     // Default for fLowGainPeakShift (now set to: 0)
     20  static const Byte_t fgLoGainPeakShift;      // Default for fLowGainPeakShift (now set to: 0)
    2121
    22   Byte_t  fWindowSizeHiGain;     // Number of Hi Gain slices in window
    23   Byte_t  fWindowSizeLoGain;     // Number of Lo Gain slices in window
     22  Byte_t  fHiGainWindowSize;     // Number of Hi Gain slices in window
     23  Byte_t  fLoGainWindowSize;     // Number of Lo Gain slices in window
    2424  Byte_t  fPeakSearchWindowSize; // Size of FADC window in the search for the highest peak of all pixels.
    2525  Byte_t  fOffsetFromWindow;     // Number of slices to start extraction before search window
    26   Byte_t  fLowGainPeakShift;     // Shift of the low gain pulse with respect to the high gain pulse, in slices: it is 0 if the low gain is delayed with respect to HG by 15 slices.
     26  Byte_t  fLoGainPeakShift;      // Shift of the low gain pulse with respect to the high gain pulse, in slices: it is 0 if the low gain is delayed with respect to HG by 15 slices.
    2727
    2828  void   FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) const;
     
    3131  void   FindPeak(Byte_t *ptr, Byte_t window, Byte_t &startslice, Int_t &signal, Int_t &sat) const;
    3232
    33   Bool_t  ReInit(MParList *pList);
     33  Bool_t ReInit(MParList *pList);
    3434  Int_t  Process();
     35  Int_t  ReadEnv(const TEnv &env, TString prefix, Bool_t print);
    3536 
    3637public:
     
    4344    void SetOffsetFromWindow(Byte_t offset=fgOffsetFromWindow)  {  fOffsetFromWindow = offset; }
    4445
    45     void SetLowGainPeakShift(Byte_t shift=fgLowGainPeakShift) { fLowGainPeakShift = shift; }
     46    void SetLoGainPeakShift(Byte_t shift=fgLoGainPeakShift) { fLoGainPeakShift = shift; }
    4647   
    4748    ClassDef(MExtractFixedWindowPeakSearch, 0) // Signal Extractor for fixed size trigger-corrected extraction window
  • trunk/MagicSoft/Mars/msignal/MExtractTimeHighestIntegral.cc

    r4371 r4722  
    1717!
    1818!   Author(s): Thomas Bretz, 02/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
    19 !             Hendrik Bartko, 02/2004 <mailto:hbartko@mppmu.mpg.de>
     19!   Author(s): Hendrik Bartko, 02/2004 <mailto:hbartko@mppmu.mpg.de>
    2020!
    2121!   Copyright: MAGIC Software Development, 2000-2004
     
    297297}
    298298
     299// --------------------------------------------------------------------------
     300//
     301// In addition to the resources of the base-class MExtractor:
     302//   MJPedestal.MExtractor.WindowSizeHiGain: 6
     303//   MJPedestal.MExtractor.WindowSizeLoGain: 6
     304//
     305Int_t MExtractTimeHighestIntegral::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     306{
     307    Byte_t hw = fHiGainWindowSize;
     308    Byte_t lw = fLoGainWindowSize;
     309
     310    Bool_t rc = kFALSE;
     311
     312    if (IsEnvDefined(env, prefix, "HiGainWindowSize", print))
     313    {
     314        hw = GetEnvValue(env, prefix, "HiGainWindowSize", hw);
     315        rc = kTRUE;
     316    }
     317    if (IsEnvDefined(env, prefix, "LoGainWindowSize", print))
     318    {
     319        lw = GetEnvValue(env, prefix, "LoGainWindowSize", lw);
     320        rc = kTRUE;
     321    }
     322
     323    if (rc)
     324        SetWindowSize(hw, lw);
     325
     326    rc = MExtractor::ReadEnv(env, prefix, print) ? kTRUE : rc;
     327
     328    return rc;
     329}
  • trunk/MagicSoft/Mars/msignal/MExtractTimeHighestIntegral.h

    r3943 r4722  
    2424  void FindTimeHiGain(Byte_t *first, Float_t &time, Float_t &dtime, Byte_t &sat, const MPedestalPix &ped) const;
    2525  void FindTimeLoGain(Byte_t *first, Float_t &time, Float_t &dtime, Byte_t &sat, const MPedestalPix &ped) const;
     26
     27  Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
    2628 
    2729public:
Note: See TracChangeset for help on using the changeset viewer.