Changeset 4732


Ignore:
Timestamp:
08/25/04 17:30:31 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4731 r4732  
    2121
    2222
    23   2004/08/25 : Wolfgang Wittek
     23 2004/08/25: Thomas Bretz
     24
     25   * callisto.cc:
     26     - updated handling of command line parameters
     27     - added MJPedestal in second loop
     28     - changed MJ* to support new MJob base class
     29
     30   * mjobs/JobsLinkDef.h, mjobs/Makefile:
     31     - added MJob
     32
     33   * mjobs/MJob.[h,cc]:
     34     - added
     35
     36   * mjobs/MJCalibrateSignal.[h,cc], mjobs/MJCalibrateSignal.[h,cc],
     37     mjobs/MJCalibration.[h,cc], mjobs/MJPedestal.[h,cc]:
     38     - derived from MJob
     39     - removed obsolete code (which has been moved to MJob)
     40
     41   * mjobs/MSequence.[h,cc]:
     42     - use MDirIter::GetEntries in SetupRuns
     43     - implemented raw-file mode
     44     - added GetNum*Runs
     45
     46   * callisto.rc:
     47     - fixed
     48
     49   * showlog.cc, mbase/MTime.cc, mreport/MReportFileReadCC.cc:
     50     - some fixes for gcc 2.95.3
     51
     52   * mbase/MEvtLoop.cc:
     53     - allow prefix argument in ReadEnv
     54
     55   * mbase/MLog.cc:
     56     - added options for log-file and html-file
     57
     58   * mbase/MTaskEnv.[h,cc]:
     59     - added comment
     60     - implemented dummy/skip-mode
     61
     62   * mjobs/MJCalibrateSignal.cc:
     63     - removed non existance check from reading extractors (MTaskEnv dummy mode!)
     64     - small changed to output
     65
     66   * mjobs/MJCalibration.cc:
     67     - added a cast for gcc 2.95.3
     68     - allow dummy mode MTaskEnvs
     69
     70   * mjobs/MJPedestal.[h,cc]:
     71     - implemented CheckEnv
     72
     73   * msignal/MExtractTime.cc:
     74     - fixed Print()-output
     75
     76   * msignal/MExtractTimeFastSpline.[h,cc]:
     77     - added ReadEnv
     78     - added Print
     79
     80
     81
     82 2004/08/25: Wolfgang Wittek
    2483
    2584   * mpointing/MPointingPos.h
     
    2786
    2887
    29   2004/08/24 : Thomas Bretz
     88
     89 2004/08/24: Thomas Bretz
    3090
    3191   * Makefile:
     
    102162
    103163
    104   2004/08/23 : Wolfgang Wittek
     164 2004/08/23: Wolfgang Wittek
    105165
    106166    * mtemp/MTelAxisFromStars.[h,cc]
  • trunk/MagicSoft/Mars/callisto.cc

    r4729 r4732  
    5151    gLog << " Options:" << endl;
    5252    gLog.Usage();
     53    gLog << "   --debug-env               Debug setting resources from file" << endl << endl;
    5354    gLog << endl;
    5455    gLog << "   -f                        Force overwrite of existing files" << endl;
     
    6364    gLog << "   --path=path               Path to write the all results to [def=local path]" << endl;
    6465    gLog << "                             (overwrites --iny, --outc and --outy)" << endl;
    65     gLog << "   --printseq                Print Sequence information" << endl;
    66     gLog << "   --printfiles              Print Files taken from Sequence" << endl;
    67     gLog << "   --printonly               Do not excute anything except print" << endl;
     66    gLog << "   --print-seq               Print Sequence information" << endl;
     67    gLog << "   --print-files             Print Files taken from Sequence" << endl;
     68    gLog << "   --print-only              Do not excute anything except print" << endl;
    6869    gLog << "   --config=callisto.rc      Resource file [default=callistop.rc]" << endl;
    6970    gLog << endl;
     
    103104    const TString kConfig     = arg.GetStringAndRemove("--config=", "callisto.rc");
    104105
    105     const Bool_t  kPrintSeq   = arg.HasOnlyAndRemove("--printseq");
    106     const Bool_t  kPrintFiles = arg.HasOnlyAndRemove("--printfiles");
    107     const Bool_t  kPrintOnly  = arg.HasOnlyAndRemove("--printonly");
     106    const Bool_t  kPrintSeq   = arg.HasOnlyAndRemove("--print-seq");
     107    const Bool_t  kPrintFiles = arg.HasOnlyAndRemove("--print-files");
     108    const Bool_t  kPrintOnly  = arg.HasOnlyAndRemove("--print-only");
     109    const Bool_t  kDebugEnv   = arg.HasOnlyAndRemove("--debug-env");
    108110
    109111    const Bool_t  kOverwrite  = arg.HasOnlyAndRemove("-f");
     
    122124    {
    123125        gLog << err << "Neither calibration (-c) nor signal extraction (-y) mode specified!" << endl;
     126        Usage();
    124127        return 0;
    125128    }
     
    217220        job1.SetSequence(seq);
    218221        job1.SetEnv(kConfig);
     222        job1.SetEnvDebug(kDebugEnv);
    219223        job1.SetDisplay(d);;
    220224        job1.SetOverwrite(kOverwrite);
     
    238242        job2.SetSequence(seq);
    239243        job2.SetEnv(kConfig);
     244        job2.SetEnvDebug(kDebugEnv);
    240245        job2.SetDisplay(d);;
    241246        job2.SetBadPixels(job1.GetBadPixels());
     
    256261            return 1;
    257262        }
     263
     264        gLog << endl << endl;
    258265    }
    259266
     
    265272        job1.SetSequence(seq);
    266273        job1.SetEnv(kConfig);
     274        job1.SetEnvDebug(kDebugEnv);
    267275        job1.SetDisplay(d);;
    268276        //job1.SetPathIn(kInpathY);     // not yet needed
     
    287295        job2.SetDisplay(d);;
    288296        job2.SetEnv(kConfig);
     297        job2.SetEnvDebug(kDebugEnv);
    289298        job2.SetOverwrite(kOverwrite);
    290299        job2.SetPathIn(kInpathY);
     
    301310            return 1;
    302311        }
     312
     313        gLog << endl << endl;
    303314    }
    304315
  • trunk/MagicSoft/Mars/callisto.rc

    r4723 r4732  
    2727# If you don't want it, it is written to the calibration output anyhow.
    2828# -------------------------------------------------------------------------
    29 #MJPedestal1.OutputPath: .
     29#MJPedestalC.PathOut: .
    3030
    3131# -------------------------------------------------------------------------
     
    3434# assumed. (overwrites command line options)
    3535# -------------------------------------------------------------------------
    36 #MJCalibration.OutputPath: calped
     36#MJCalibration.PathOut: calped
    3737
    3838# -------------------------------------------------------------------------
     
    4242# datacenter is used. (overwrites command line options)
    4343# -------------------------------------------------------------------------
    44 #MJPedestal1.InputPath:    calped
    45 #MJCalibration.InputPath: calped
     44#MJPedestalC.PathData:   /data/MAGIC/Period016/
     45#MJCalibration.PathData: /data/MAGIC/Period016/
    4646
    4747# -------------------------------------------------------------------------
     
    6868# could be (if no pedestal file available) a data-file, too.
    6969# -------------------------------------------------------------------------
    70 #MJCalibration.ExtractPedestal: MPedCalcPedRun
    71 #MJCalibration.ExtractPedestal.HiGainFirst:       0
    72 #MJCalibration.ExtractPedestal.HiGainLast:       29
    73 #MJCalibration.ExtractPedestal.LoGainFirst:       0
    74 #MJCalibration.ExtractPedestal.LoGainLast:       14
    75 #MJCalibration.ExtractPedestal.HiGainWindowSize: 14
    76 #MJCalibration.ExtractPedestal.LoGainWindowSize:  0
     70#MJPedestalC.ExtractPedestal: MPedCalcPedRun
     71#MJPedestalC.ExtractPedestal.HiGainFirst:       0
     72#MJPedestalC.ExtractPedestal.HiGainLast:       29
     73#MJPedestalC.ExtractPedestal.LoGainFirst:       0
     74#MJPedestalC.ExtractPedestal.LoGainLast:       14
     75#MJPedestalC.ExtractPedestal.HiGainWindowSize: 14
     76#MJPedestalC.ExtractPedestal.LoGainWindowSize:  0
    7777
    7878# -------------------------------------------------------------------------
     
    8181# could be (if no pedestal file available) a data-file, too.
    8282# -------------------------------------------------------------------------
    83 MJCalibration.ExtractPedestal: MPedCalcFromLoGain
    84 MJCalibration.ExtractPedestal.PedestalUpdate:   no
    85 #MJCalibration.ExtractPedestal.HiGainFirst:       0
    86 #MJCalibration.ExtractPedestal.HiGainLast:       11
    87 #MJCalibration.ExtractPedestal.LoGainFirst:       1
    88 #MJCalibration.ExtractPedestal.LoGainLast:       14
    89 #MJCalibration.ExtractPedestal.HiGainWindowSize: 12
    90 #MJCalibration.ExtractPedestal.LoGainWindowSize: 14
    91 #MJCalibration.ExtractPedestal.MaxHiGainVar:     40
     83MJPedestalC.ExtractPedestal: MPedCalcFromLoGain
     84MJPedestalC.ExtractPedestal.PedestalUpdate:   no
     85#MJPedestalC.ExtractPedestal.HiGainFirst:       0
     86#MJPedestalC.ExtractPedestal.HiGainLast:       11
     87#MJPedestalC.ExtractPedestal.LoGainFirst:       1
     88#MJPedestalC.ExtractPedestal.LoGainLast:       14
     89#MJPedestalC.ExtractPedestal.HiGainWindowSize: 12
     90#MJPedestalC.ExtractPedestal.LoGainWindowSize: 14
     91#MJPedestalC.ExtractPedestal.MaxHiGainVar:     40
    9292
    9393# -------------------------------------------------------------------------
     
    9595# -------------------------------------------------------------------------
    9696# Maximum number of event processed in the loop
    97 #MJPedestal1.MaxEvents: 1000
     97#MJPedestalC.MaxEvents: 1000
    9898# Allow to overwrite existing files with the output file
    99 #MJPedestal1.AllowOverwrite: No
     99#MJPedestalC.AllowOverwrite: No
    100100# Use data runs from the sequence instead of calibration runs
    101 #MJPedestal1.UseData: No
     101#MJPedestalC.UseData: No
    102102
    103103
     
    106106# and automatically the data extraction
    107107# -------------------------------------------------------------------------
    108 MJCalibration.ExtractSignal: MExtractFixedWindowPeakSearch
    109 #MJCalibration.ExtractSignal.HiGainFirst:       2
    110 #MJCalibration.ExtractSignal.HiGainLast:       14
    111 #MJCalibration.ExtractSignal.LoGainFirst:       2
    112 #MJCalibration.ExtractSignal.LoGainLast:       14
     108MJCalibration.ExtractSignal: MExtractFixedWindow
     109MJCalibration.ExtractSignal.HiGainFirst:       3
     110MJCalibration.ExtractSignal.HiGainLast:       14
     111MJCalibration.ExtractSignal.LoGainFirst:       4
     112MJCalibration.ExtractSignal.LoGainLast:       13
    113113#MJCalibration.ExtractSignal.HiGainWindowSize:  6
    114114#MJCalibration.ExtractSignal.LoGainWindowSize:  6
     
    121121# and automatically the data extraction
    122122# -------------------------------------------------------------------------
    123 MJCalibration.ExtractTime: MExtractTimeHighestIntegral
    124 #MJCalibration.ExtractTime.HiGainFirst:       0
    125 #MJCalibration.ExtractTime.HiGainLast:       14
    126 #MJCalibration.ExtractTime.LoGainFirst:       3
    127 #MJCalibration.ExtractTime.LoGainLast:       14
     123MJCalibration.ExtractTime: MExtractTimeFastSpline
     124MJCalibration.ExtractTime.HiGainFirst:       0
     125MJCalibration.ExtractTime.HiGainLast:        7
     126MJCalibration.ExtractTime.LoGainFirst:       3
     127MJCalibration.ExtractTime.LoGainLast:        8
    128128#MJCalibration.ExtractTime.WindowSizeHiGain:  6
    129129#MJCalibration.ExtractTime.WindowSizeLoGain:  6
     
    162162# Use a OutputPath if you want to write the results to a file
    163163# -------------------------------------------------------------------------
    164 #MJCalibrateSignal.OutputPath: .
    165 
    166 MJPedestal2.UseData:   Yes
    167 MJPedestal2.MaxEvents: 750
    168 
    169 MJPedestal2.ExtractPedestal: MPedCalcFromLoGain
    170 MJPedestal2.ExtractPedestal.PedestalUpdate:   yes
    171 MJPedestal2.ExtractPedestal.NumEventsDump:   500
     164#MJCalibrateSignal.PathOut:  .
     165#MJPedestalY.PathOut:        .
     166#MJPedestalY.PathData:       /data/MAGIC/Period016/
     167#MJCalibrateSignal.PathData: /data/MAGIC/Period016/
     168#MJCalibrateSignal.PathIn:   .
     169
     170MJPedestalY.UseData:   Yes
     171MJPedestalY.MaxEvents: 750
     172
     173MJPedestalY.ExtractPedestal: MPedCalcFromLoGain
     174MJPedestalY.ExtractPedestal.PedestalUpdate:   yes
     175MJPedestalY.ExtractPedestal.NumEventsDump:   500
    172176
    173177# -------------------------------------------------------------------------
     
    175179# -------------------------------------------------------------------------
    176180MJCalibrateSignal.MPedCalcFromLoGain: MPedCalcFromLoGain
    177 MJCalibrateSignal.MPedCalcFromLoGain.PedestalUpdate:   yes
    178 MJCalibrateSignal.MPedCalcFromLoGain.NumEventsDump:   500
     181MJCalibrateSignal.ExtractPedestal.PedestalUpdate:   yes
     182MJCalibrateSignal.ExtractPedestal.NumEventsDump:   500
    179183#MJCalibrateSignal.ExtractPedestal.HiGainFirst:       0
    180184#MJCalibrateSignal.ExtractPedestal.HiGainLast:       11
  • trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h

    r4702 r4732  
    103103    operator TIterator*() const;
    104104
    105     ClassDef(MCerPhotEvt, 2)    // class for an event containing cerenkov photons
     105    ClassDef(MCerPhotEvt, 3)    // class for an event containing cerenkov photons
    106106};
    107107
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r4722 r4732  
    933933//      CleaningLevel1:  3.0
    934934//
     935//
     936// With the argument prefix you can overwrite the name of the MEvtLoop object
     937// as prefix - use with extreme care! The prifix argument must not end with
     938// a dot!
     939//
     940//
    935941// Warning: The programmer is responsible for the names to be unique in
    936942//          all Mars classes.
     
    938944Int_t MEvtLoop::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
    939945{
    940     if (!prefix.IsNull())
    941         *fLog << warn << "WARNING - Second argument in MEvtLoop::ReadEnv has no meaning... ignored." << endl;
    942 
    943     prefix = fName;
     946//    if (!prefix.IsNull())
     947//        *fLog << warn << "WARNING - Second argument in MEvtLoop::ReadEnv has no meaning... ignored." << endl;
     948
     949    if (prefix.IsNull())
     950        prefix = fName;
    944951    prefix += ".";
    945952
  • trunk/MagicSoft/Mars/mbase/MLog.cc

    r4722 r4732  
    107107#include <TGTextView.h>
    108108
    109 #include "MLogPlugin.h"
     109#include "MArgs.h"
    110110#include "MParContainer.h"
    111 #include "MArgs.h"
     111
     112#include "MLogHtml.h"
    112113
    113114ClassImp(MLog);
     
    520521    *this << "   -v#                       Verbosity level # [default=2]" << endl;
    521522    *this << "   -a, --no-colors           Do not use Ansii color codes" << endl;
     523    *this << "   --log[=file]              Write log-out to ascii-file [default: prgname.log]" << endl;
     524    *this << "   --html[=file]             Write log-out to html-file [default: prgname.html]" << endl;
    522525    *this << "   --debug[=n]               Enable root debugging [default: gDebug=1]" << endl;
     526    *this << "   --null                    Null output (supresses all output)" << endl;
    523527}
    524528
     
    527531// Setup MLog and global debug output from command line arguments.
    528532//
    529 //    gLog << "     -v#                              Verbosity level # [default=2]" << endl;
    530 //    gLog << "     -a, --no-colors                  Do not use Ansii color codes" << endl;
    531 //    gLog << "     --debug[=n]                      Enable root debugging (Default: gDebug=1)" << endl;
    532 //
    533533void MLog::Setup(MArgs &arg)
    534534{
    535     if (arg.HasOnlyAndRemove("--no-colors") || arg.HasOnlyAndRemove("-a"))
    536         SetNoColors();
    537 
    538     SetDebugLevel(arg.HasOption("-v") ? arg.GetIntAndRemove("-v") : 2);
    539 
     535    // FXIME: This is not really at a place where it belongs to!
    540536    gDebug = arg.HasOption("--debug=") ? arg.GetIntAndRemove("--debug=") : 0;
    541537    if (gDebug==0 && arg.HasOnlyAndRemove("--debug"))
    542538        gDebug=1;
     539
     540    TString f1 = arg.GetStringAndRemove("--log=", "");
     541    if (f1.IsNull() && arg.HasOnlyAndRemove("--log"))
     542        f1 = Form("%s.log", arg.GetName());
     543    if (!f1.IsNull())
     544    {
     545        SetOutputFile(f1);
     546        EnableOutputDevice(eFile);
     547    }
     548
     549    TString f2 = arg.GetStringAndRemove("--html=", "");
     550    if (f2.IsNull() && arg.HasOnlyAndRemove("--html"))
     551        f2 = Form("%s.html", arg.GetName());
     552    if (!f2.IsNull())
     553    {
     554        MLogHtml *html = new MLogHtml(f2);
     555        html->SetBit(kCanDelete);
     556        AddPlugin(html);
     557    }
     558
     559    const Bool_t null = arg.HasOnlyAndRemove("--null");
     560    if (null)
     561        SetNullOutput();
     562
     563    if (arg.HasOnlyAndRemove("--no-colors") || arg.HasOnlyAndRemove("-a"))
     564        SetNoColors();
     565
     566    SetDebugLevel(arg.GetIntAndRemove("-v", 2));
    543567}
    544568
     
    653677// is automatically removed from the list of active plugins.
    654678//
     679// If MLog should take the ownership cal plug->SetBit(kCanDelete);
     680//
    655681void MLog::AddPlugin(MLogPlugin *plug)
    656682{
    657683    fPlugins->Add(plug);
    658     plug->SetBit(kMustCleanup);
    659 }
     684}
  • trunk/MagicSoft/Mars/mbase/MTaskEnv.cc

    r4723 r4732  
    2727// MTaskEnv
    2828//
    29 // If you want to create a new task inside a macro you will have to compile
    30 // your macro using macro.C++, because the root interpreter cannot use
    31 // uncompiled classes. To workaround this problem you can write simple
    32 // funcions (which can be handled by CINT) and use MTaskEnv.
    33 //
    34 // This is a simple way to develop new code in a macro without need
    35 // to compile it.
    36 //
    37 // Example:
    38 //    Int_t Process()
    39 //    {
    40 //       gLog << "Processing..." << endl;
    41 //       return kTRUE;
    42 //    }
    43 //
    44 //    void main()
    45 //    {
    46 //       MTaskEnv task;
    47 //       task.SetProcess(Process);
    48 //       MTaskList list;
    49 //       list.AddToList(&task);
    50 //    }
     29// This class is used if a task - at runtime - should be replaced or setup
     30// from a resource file, eg.
     31//
     32//
     33// resources.rc:
     34//   MyTask: MThisIsMyClass
     35//   MyTask.Resource1: yes
     36//   MyTask.Resource2: 50
     37//
     38// macro.C:
     39//   MTaskList list;
     40//
     41//   MDefaultTask def;
     42//   MTaskEnv taskenv("MyTask");
     43//   taskenv.SetDefault(&def);
     44//
     45//   list.AddToList(&taskenv);
     46//   [...]
     47//   evtloop.ReadEnv("resource.rc");
     48//
     49// In this case MTaskEnv will act like MDefaultTask if nothing is found in the
     50// resource file. If the task is setup via the resource file like in the
     51// example above it will act like a MThisIsMyClass setup with Resource1 and
     52// Resource2.
     53//
     54//
     55// You can also skip the task completely if you setup (in lower case letters!)
     56//
     57// resources.rc:
     58//   MyTask: <dummy>
     59//
     60//
     61// A third option is to setup a MTaskEnv to be skipped except a task is
     62// initialized through the resource file:
     63//   MTaskEnv taskenv("MyTask");
     64//   taskenv.SetDefault(0);
    5165//
    5266//
     
    165179Bool_t MTaskEnv::ReInit(MParList *list)
    166180{
    167     *fLog << fTask->ClassName() << " - " << flush;
     181    *fLog << fTask->ClassName() << " <MTaskEnv>... " << flush;
    168182    return fTask->ReInit(list);
    169183}
     
    171185Int_t MTaskEnv::PreProcess(MParList *list)
    172186{
     187    if (TestBit(kIsDummy))
     188    {
     189        *fLog << inf << "Dummy Task... skipped." << endl;
     190        return kSKIP;
     191    }
     192
    173193    if (!fTask)
    174194    {
     
    177197    }
    178198
    179     *fLog << fTask->ClassName() << " - " << flush;
     199    *fLog << fTask->ClassName() << " <MTaskEnv>... " << flush;
    180200    return fTask->CallPreProcess(list);
    181201}
     
    188208Int_t MTaskEnv::PostProcess()
    189209{
    190     *fLog << fTask->ClassName() << " - " << flush;
     210    *fLog << fTask->ClassName() << " <MTaskEnv>... " << flush;
    191211    return fTask->CallPostProcess();
    192212}
     
    200220    task.ReplaceAll("\015", "");
    201221    task = task.Strip(TString::kBoth);
     222
     223    if (task=="<dummy>")
     224    {
     225        if (TestBit(kIsOwner) && fTask)
     226            delete fTask;
     227        fTask = 0;
     228        SetBit(kIsDummy);
     229        return kTRUE;
     230    }
     231
    202232    fTask = GetTask(task.Data());
    203233    if (!fTask)
  • trunk/MagicSoft/Mars/mbase/MTaskEnv.h

    r4723 r4732  
    1414    MTask *fTask;
    1515
    16     enum { kIsOwner = BIT(14) };
     16    enum { kIsOwner = BIT(14), kIsDummy = BIT(15) };
    1717
    1818    MTask *GetTask(const char *name) const;
     
    3333    void SetOwner(Bool_t b=kTRUE) { b ? SetBit(kIsOwner) : ResetBit(kIsOwner); }
    3434
    35     void SetDefault(MTask *task) { fTask = task; }
     35    void SetDefault(MTask *task) { fTask = task; if (!task) SetBit(kIsDummy); }
    3636    void SetDefault(const char *def);
    3737
  • trunk/MagicSoft/Mars/mbase/MTime.cc

    r4627 r4732  
    7070
    7171#include <iomanip>
     72
     73#ifndef __USE_XOPEN
     74#define __USE_XOPEN // on some systems needed for strptime
     75#endif
    7276
    7377#include <time.h>     // struct tm
  • trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc

    r4729 r4732  
    148148
    149149    TObject *o = file.Get("ExtractSignal");
    150     if (!o)
    151     {
    152         *fLog << err << dbginf << "ERROR - Unable to read ExtractSignal from file " << fname << endl;
    153         return kFALSE;
    154     }
    155     if (!o->InheritsFrom(MExtractor::Class()))
     150//    if (!o)
     151//    {
     152//        *fLog << err << dbginf << "ERROR - Unable to read ExtractSignal from file " << fname << endl;
     153//        return kFALSE;
     154//    }
     155    if (o && !o->InheritsFrom(MExtractor::Class()))
    156156    {
    157157        *fLog << err << dbginf << "ERROR - ExtractSignal read from " << fname << " doesn't inherit from MExtractor!" << endl;
    158158        return kFALSE;
    159159    }
    160     ext1 = (MTask*)o->Clone();
     160    ext1 = o ? (MTask*)o->Clone() : NULL;
    161161
    162162    o = file.Get("ExtractTime");
    163     if (!o)
    164     {
    165         *fLog << err << dbginf << "ERROR - Unable to read ExtractTime from file " << fname << endl;
    166         return kFALSE;
    167     }
    168     if (!o->InheritsFrom(MExtractor::Class()))
     163//    if (!o)
     164//    {
     165//        *fLog << err << dbginf << "ERROR - Unable to read ExtractTime from file " << fname << endl;
     166//        return kFALSE;
     167//    }
     168    if (o && !o->InheritsFrom(MExtractor::Class()))
    169169    {
    170170        *fLog << err << dbginf << "ERROR - ExtractTime read from " << fname << " doesn't inherit from MExtractor!" << endl;
    171171        return kFALSE;
    172172    }
    173     ext2 = (MTask*)o->Clone();
     173    ext2 = o ? (MTask*)o->Clone() : NULL;
     174
     175    if (!ext1 && !ext2)
     176    {
     177        *fLog << err << dbginf << "ERROR - Neither ExtractSignal nor ExrtractTime found in " << fname << "!" << endl;
     178        return kFALSE;
     179    }
    174180
    175181    return kTRUE;
     
    226232
    227233    *fLog << all;
    228     *fLog << "Extractors read from file" << endl;
    229     *fLog << "=========================" << endl;
    230     extractor1->Print();
    231     *fLog << endl;
    232     extractor2->Print();
    233     *fLog << endl;
     234    if (extractor1)
     235    {
     236        *fLog << underline << "Signal Extractor found in calibration file" << endl;
     237        extractor1->Print();
     238        *fLog << endl;
     239    }
     240    else
     241        *fLog << inf << "No Signal Extractor: ExtractSignal in file." << endl;
     242
     243    if (extractor2)
     244    {
     245        *fLog << underline << "Time Extractor found in calibration file" << endl;
     246        extractor2->Print();
     247        *fLog << endl;
     248    }
     249    else
     250        *fLog << inf << "No Time Extractor: ExtractTime in file." << endl;
    234251
    235252    // This is necessary for the case in which it is not in the files
     
    302319    tlist.AddToList(&pedlo);
    303320    tlist.AddToList(&fill0);
    304     tlist.AddToList(&taskenv1);
    305     tlist.AddToList(&taskenv2);
     321    if (extractor1)
     322        tlist.AddToList(&taskenv1);
     323    if (extractor2)
     324        tlist.AddToList(&taskenv2);
    306325    tlist.AddToList(&fill1);
    307326    tlist.AddToList(&calib);
     
    320339    evtloop.SetDisplay(fDisplay);
    321340    evtloop.SetLogStream(fLog);
    322     if (GetEnv())
    323         evtloop.ReadEnv(*GetEnv());
     341    if (!SetupEnv(evtloop))
     342        return kFALSE;
    324343
    325344    // Execute first analysis
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.cc

    r4729 r4732  
    248248    TString title = fDisplay->GetTitle();
    249249    title += "--  Calibration ";
    250     title += fSequence.IsValid() ? Form("calib%06d", fSequence.GetSequence()) : fRuns->GetRunsAsString();
     250    title += fSequence.IsValid() ? Form("calib%06d", fSequence.GetSequence()) : (const char*)fRuns->GetRunsAsString();
    251251    title += "  --";
    252252    fDisplay->SetTitle(title);
     
    12471247Bool_t MJCalibration::CheckEnv()
    12481248{
    1249     if (!MJob::CheckEnv())
    1250         return kFALSE;
    1251 
    12521249    TString col = GetEnv("Color", "");
    12531250    if (!col.IsNull())
     
    12691266    SetUsePINDiode(GetEnv("UsePINDiode", IsUsePINDiode()));
    12701267
    1271     return kTRUE;
     1268    return MJob::CheckEnv();
    12721269}
    12731270
     
    15571554    evtloop.SetDisplay(fDisplay);
    15581555    evtloop.SetLogStream(fLog);
    1559     if (GetEnv())
    1560         evtloop.ReadEnv(*GetEnv());
    1561 
    1562     //if (!WriteEventloop(evtloop))
    1563     //    return kFALSE;
     1556    if (!SetupEnv(evtloop))
     1557        return kFALSE;
     1558
     1559    if (!taskenv.GetTask() && !taskenv2.GetTask())
     1560    {
     1561        *fLog << err << "ERROR - Neither ExtractSignal nor ExtractTime initializedor both '<dummy>'." << endl;
     1562        return kFALSE;
     1563    }
    15641564
    15651565    if (!WriteTasks(taskenv.GetTask(), taskenv2.GetTask()))
     
    17381738    }
    17391739
    1740     if (t1->Write()<=0)
     1740    if (t1 && t1->Write()<=0)
    17411741    {
    17421742        *fLog << err << "Unable to write " << t1->GetName() << " to " << oname << endl;
    17431743        return kFALSE;
    17441744    }
    1745     if (t2->Write()<=0)
     1745    if (t2 && t2->Write()<=0)
    17461746    {
    17471747        *fLog << err << "Unable to write " << t2->GetName() << " to " << oname << endl;
  • trunk/MagicSoft/Mars/mjobs/MJPedestal.cc

    r4729 r4732  
    460460}
    461461*/
     462
     463Bool_t MJPedestal::CheckEnv()
     464{
     465    if (HasEnv("DataCheckDisplay"))
     466        fDisplayType = GetEnv("DataCheckDisplay", kFALSE) ? kDataCheckDisplay : kNormalDisplay;
     467
     468    SetDataCheck(GetEnv("DataCheck", fDataCheck));
     469    SetOverwrite(GetEnv("Overwrite", fOverwrite));
     470
     471    return MJob::CheckEnv();
     472}
     473
    462474Bool_t MJPedestal::WriteResult()
    463475{
     
    617629    evtloop.SetDisplay(fDisplay);
    618630    evtloop.SetLogStream(fLog);
    619     if (GetEnv())
    620         evtloop.ReadEnv(*GetEnv());
     631    if (!SetupEnv(evtloop))
     632        return kFALSE;
    621633
    622634    //    if (!WriteEventloop(evtloop))
  • trunk/MagicSoft/Mars/mjobs/MJPedestal.h

    r4729 r4732  
    6161    void   DisplayOutliers(TH1D *hist) const;
    6262    void   FixDataCheckHist(TH1D *hist) const;
     63
     64    Bool_t CheckEnv();
    6365   
    6466public:
     
    7880    void SetInput(MRunIter *iter) { fRuns = iter; }
    7981
    80     void SetDataCheck(const Bool_t b=kTRUE) { fDataCheck = b; SetDataCheckDisplay(); }
     82    void SetDataCheck(const Bool_t b=kTRUE) { fDataCheck = b; b ? SetDataCheckDisplay() : SetNormalDisplay(); }
    8183
    8284    void SetDataCheckDisplay() { fDisplayType = kDataCheckDisplay; }
  • trunk/MagicSoft/Mars/mjobs/MJob.cc

    r4729 r4732  
    3737#include "MLog.h"
    3838#include "MLogManip.h"
     39
     40#include "MEvtLoop.h"
    3941
    4042ClassImp(MJob);
     
    7779    fEnv = new TEnv(env);
    7880
    79     fPrefixEnv = prefix;
     81    fEnvPrefix = prefix;
    8082    if (!prefix)
    81         fPrefixEnv = fName.First(' ')>0 ? fName(0, fName.First(' ')) : fName;
     83        fEnvPrefix = fName.First(' ')>0 ? fName(0, fName.First(' ')) : fName;
    8284
    83     if (fPrefixEnv.EndsWith("."))
    84         fPrefixEnv.Remove(fPrefixEnv.Length()-1);
     85    if (fEnvPrefix.EndsWith("."))
     86        fEnvPrefix.Remove(fEnvPrefix.Length()-1);
    8587
    8688    return kTRUE;
     
    118120Int_t MJob::GetEnv(const char *name, Int_t dflt) const
    119121{
    120     return fEnv->GetValue(Form("%s%s", fPrefixEnv.Data(), name), dflt);
     122    return GetEnvValue(*fEnv, fEnvPrefix, name, dflt); //    return fEnv->GetValue(Form("%s%s", fEnvPrefix.Data(), name), dflt);
    121123}
    122124
    123125Double_t MJob::GetEnv(const char *name, Double_t dflt) const
    124126{
    125     return fEnv->GetValue(Form("%s%s", fPrefixEnv.Data(), name), dflt);
     127    return GetEnvValue(*fEnv, fEnvPrefix, name, dflt); //    return fEnv->GetValue(Form("%s%s", fEnvPrefix.Data(), name), dflt);
    126128}
    127129
    128130const char *MJob::GetEnv(const char *name, const char *dflt) const
    129131{
    130     return fEnv->GetValue(Form("%s%s", fPrefixEnv.Data(), name), dflt);
     132    return GetEnvValue(*fEnv, fEnvPrefix, name, dflt); //fEnv->GetValue(Form("%s%s", fEnvPrefix.Data(), name), dflt);
    131133}
    132134
    133135Bool_t MJob::HasEnv(const char *name) const
    134136{
    135     return fEnv->Lookup(Form("%s%s", fPrefixEnv.Data(), name));
     137    return IsEnvDefined(*fEnv, fEnvPrefix, name, fEnvDebug);//fEnv->Lookup(Form("%s%s", fEnvPrefix.Data(), name));
    136138}
    137139
    138140Bool_t MJob::CheckEnv()
    139141{
    140     if (!fEnv)
    141     {
    142         *fLog << warn << "WARNING - " << GetDescriptor() << " CheckEnv called without further SetEnv!" << endl;
    143         return kFALSE;
    144     }
    145 
    146142    TString p;
    147143    p = GetEnv("PathOut", "");
     
    162158    return kTRUE;
    163159}
     160
     161Bool_t MJob::SetupEnv(MEvtLoop &loop) const
     162{
     163    if (!fEnv)
     164        return kTRUE;
     165
     166    return loop.ReadEnv(*fEnv, fEnvPrefix, fEnvDebug) ? kTRUE : kFALSE;
     167}
  • trunk/MagicSoft/Mars/mjobs/MJob.h

    r4729 r4732  
    77
    88class TEnv;
     9class MEvtLoop;
    910
    1011class MJob : public MParContainer
     
    1415
    1516    TEnv     *fEnv;           // Resource file
    16     TString   fPrefixEnv;     // Prefix for resources
     17    TString   fEnvPrefix;     // Prefix for resources
     18    Bool_t    fEnvDebug;      // Debug setup of resources
    1719
    1820protected:
     
    2729    MSequence fSequence;      // Sequence
    2830
    29     virtual Bool_t CheckEnv();
    30 
    31     TEnv       *GetEnv() const { return fEnv; }
    3231    Int_t       GetEnv(const char *name, Int_t dflt) const;
    3332    Double_t    GetEnv(const char *name, Double_t dflt) const;
    3433    const char *GetEnv(const char *name, const char *dflt) const;
    3534    Bool_t      HasEnv(const char *name) const;
     35
     36    Bool_t SetupEnv(MEvtLoop &loop) const;
     37    virtual Bool_t CheckEnv();
    3638
    3739public:
     
    4547    void   SetOverwrite(Bool_t b=kTRUE) { fOverwrite=b; }
    4648    Bool_t SetEnv(const char *env, const char *prefix=0);
     49    void   SetEnvDebug(Bool_t b=kTRUE) { fEnvDebug=b; }
    4750
    4851    void   SetMaxEvents(Int_t max) { fMaxEvents = max; }
  • trunk/MagicSoft/Mars/mjobs/MSequence.cc

    r4729 r4732  
    7373}
    7474
    75 Int_t MSequence::SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path) const
     75Int_t MSequence::SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path, Bool_t raw) const
    7676{
    7777    TString d(path);
     
    8080    if (d.IsNull())
    8181    {
    82         d  = Form("/data/MAGIC/Period%03d/rootdata/", fPeriod);
     82        d  = Form("/data/MAGIC/Period%03d/", fPeriod);
     83        d += raw ? "rawdata/" : "rootdata/";
    8384        d += fNight.GetStringFmt("%Y_%m_%d");
    8485    }
     
    9091        // Create file name
    9192        n =  fNight.GetStringFmt("%Y%m%d_");
    92         n += Form("%05d_*_E.root", arr[i]);
     93        n += Form("%05d_*_E", arr[i]);
     94        n += raw ? ".raw" : ".root";
    9395
    9496        // Add Path/File to TIter
     
    182184// If path==0 the standard path of the data-center is assumed.
    183185// If you have the runs locally use path="."
    184 // Return the number of files added.
    185 //
    186 Int_t MSequence::SetupPedRuns(MDirIter &iter, const char *path) const
    187 {
    188     return SetupRuns(iter, fPedRuns, path);
     186// Using raw=kTRUE you get correspodning raw-files setup.
     187// Return the number of files added.
     188//
     189Int_t MSequence::SetupPedRuns(MDirIter &iter, const char *path, Bool_t raw) const
     190{
     191    return SetupRuns(iter, fPedRuns, path, raw);
    189192}
    190193
     
    194197// If path==0 the standard path of the data-center is assumed.
    195198// If you have the runs locally use path="."
    196 // Return the number of files added.
    197 //
    198 Int_t MSequence::SetupDatRuns(MDirIter &iter, const char *path) const
    199 {
    200     return SetupRuns(iter, fDatRuns, path);
     199// Using raw=kTRUE you get correspodning raw-files setup.
     200// Return the number of files added.
     201//
     202Int_t MSequence::SetupDatRuns(MDirIter &iter, const char *path, Bool_t raw) const
     203{
     204    return SetupRuns(iter, fDatRuns, path, raw);
    201205}
    202206
     
    206210// If path==0 the standard path of the data-center is assumed.
    207211// If you have the runs locally use path="."
    208 // Return the number of files added.
    209 //
    210 Int_t MSequence::SetupAllRuns(MDirIter &iter, const char *path) const
    211 {
    212     return SetupRuns(iter, fRuns, path);
     212// Using raw=kTRUE you get correspodning raw-files setup.
     213// Return the number of files added.
     214//
     215Int_t MSequence::SetupAllRuns(MDirIter &iter, const char *path, Bool_t raw) const
     216{
     217    return SetupRuns(iter, fRuns, path, raw);
    213218}
    214219
     
    218223// If path==0 the standard path of the data-center is assumed.
    219224// If you have the runs locally use path="."
    220 // Return the number of files added.
    221 //
    222 Int_t MSequence::SetupCalRuns(MDirIter &iter, const char *path) const
    223 {
    224     return SetupRuns(iter, fCalRuns, path);
    225 }
     225// Using raw=kTRUE you get correspodning raw-files setup.
     226// Return the number of files added.
     227//
     228Int_t MSequence::SetupCalRuns(MDirIter &iter, const char *path, Bool_t raw) const
     229{
     230    return SetupRuns(iter, fCalRuns, path, raw);
     231}
  • trunk/MagicSoft/Mars/mjobs/MSequence.h

    r4729 r4732  
    3636
    3737    void Split(TString &runs, TArrayI &data) const;
    38     Int_t SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path) const;
     38    Int_t SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path, Bool_t raw=kFALSE) const;
    3939
    4040public:
     
    5353    Bool_t IsValid() const { return fSequence!=(UInt_t)-1; }
    5454
    55     Int_t SetupPedRuns(MDirIter &iter, const char *path=0) const;
    56     Int_t SetupDatRuns(MDirIter &iter, const char *path=0) const;
    57     Int_t SetupAllRuns(MDirIter &iter, const char *path=0) const;
    58     Int_t SetupCalRuns(MDirIter &iter, const char *path=0) const;
     55    Int_t SetupPedRuns(MDirIter &iter, const char *path=0, Bool_t raw=kFALSE) const;
     56    Int_t SetupDatRuns(MDirIter &iter, const char *path=0, Bool_t raw=kFALSE) const;
     57    Int_t SetupAllRuns(MDirIter &iter, const char *path=0, Bool_t raw=kFALSE) const;
     58    Int_t SetupCalRuns(MDirIter &iter, const char *path=0, Bool_t raw=kFALSE) const;
    5959
    6060    Int_t GetNumAllRuns() const { return fRuns.GetSize(); }
  • trunk/MagicSoft/Mars/mreport/MReportFileReadCC.cc

    r4587 r4732  
    4444
    4545#include <fstream>
     46#include <stdlib.h> // atoi on gcc 2.95.3
    4647
    4748#include <TRegexp.h>
  • trunk/MagicSoft/Mars/msignal/MExtractTime.cc

    r4723 r4732  
    230230    }
    231231
    232     rc = MExtractor::ReadEnv(env, prefix, print) ? kTRUE : rc;
    233 
    234     return rc;
     232    return MExtractor::ReadEnv(env, prefix, print) ? kTRUE : rc;
    235233}
    236234
     
    240238    if (IsA()==MExtractTime::Class())
    241239        *fLog << GetDescriptor() << ":" << endl;
    242     *fLog << " Offset Lo-Gain=" << fOffsetLoGain << endl;
     240    *fLog << " Offset Lo-Gain: " << fOffsetLoGain << endl;
    243241    MExtractor::Print(o);
    244242}
  • trunk/MagicSoft/Mars/msignal/MExtractTimeFastSpline.cc

    r4284 r4732  
    5454const Float_t MExtractTimeFastSpline::fgResolution   = 0.003;
    5555const Float_t MExtractTimeFastSpline::fgRiseTime     = 1.5;
     56
    5657// --------------------------------------------------------------------------
    5758//
     
    672673}
    673674
    674 
     675// --------------------------------------------------------------------------
     676//
     677// In addition to the resources of the base-class MExtractor:
     678//   MJPedestal.MExtractor.Resolution: 0.003
     679//   MJPedestal.MExtractor.RiseTime:   1.5
     680//
     681Int_t MExtractTimeFastSpline::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     682{
     683    Bool_t rc = kFALSE;
     684
     685    if (IsEnvDefined(env, prefix, "HiGainWindowSize", print))
     686    {
     687        SetResolution(GetEnvValue(env, prefix, "Resolution", fResolution));
     688        rc = kTRUE;
     689    }
     690    if (IsEnvDefined(env, prefix, "LoGainWindowSize", print))
     691    {
     692        SetRiseTime(GetEnvValue(env, prefix, "RiseTime", fRiseTime));
     693        rc = kTRUE;
     694    }
     695
     696    return MExtractTime::ReadEnv(env, prefix, print) ? kTRUE : rc;
     697}
     698
     699void MExtractTimeFastSpline::Print(Option_t *o) const
     700{
     701    *fLog << all;
     702    *fLog << GetDescriptor() << ":" << endl;
     703    *fLog << " Resolution:     " << fResolution << endl;
     704    *fLog << " RiseTime:       " << fRiseTime << endl;
     705    MExtractTime::Print(o);
     706}
  • trunk/MagicSoft/Mars/msignal/MExtractTimeFastSpline.h

    r4723 r4732  
    1818  static const Float_t fgRiseTime  ;     // Default for fRiseTime     (now set to: 1.5  C 
    1919
    20   Float_t *fHiGainFirstDeriv;
    21   Float_t *fLoGainFirstDeriv; 
    22   Float_t *fHiGainSecondDeriv;
    23   Float_t *fLoGainSecondDeriv; 
     20  Float_t *fHiGainFirstDeriv;            //!
     21  Float_t *fLoGainFirstDeriv;            //!
     22  Float_t *fHiGainSecondDeriv;           //!
     23  Float_t *fLoGainSecondDeriv;           //!
    2424
    25   Float_t fResolution;                        // The time resolution in FADC units
    26   Float_t fRiseTime  ;                        // The rise time of the pulse
    27   Byte_t  fStartBeforeMax;                    // Slices to start searching for the halfmax before max
     25  Float_t fResolution;                   // The time resolution in FADC units
     26  Float_t fRiseTime  ;                   // The rise time of the pulse
     27  Byte_t  fStartBeforeMax;               // Slices to start searching for the halfmax before max
    2828 
    2929  void FindTimeHiGain(Byte_t *first, Float_t &time, Float_t &dtime, Byte_t &sat, const MPedestalPix &ped) const;
    3030  void FindTimeLoGain(Byte_t *first, Float_t &time, Float_t &dtime, Byte_t &sat, const MPedestalPix &ped) const;
     31
     32  Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
    3133 
    3234public:
     
    3840  void SetResolution(Float_t f=fgResolution)     { fResolution = f;  }
    3941  void SetRiseTime  (Float_t f=fgRiseTime  )     { fRiseTime   = f; fStartBeforeMax = (Int_t)(2*fRiseTime); } 
     42
     43  void Print(Option_t *o) const;
    4044 
    41   ClassDef(MExtractTimeFastSpline, 0)   // Task to Extract the Arrival Times using a Fast Spline
     45  ClassDef(MExtractTimeFastSpline, 1)   // Task to Extract the Arrival Times using a Fast Spline
    4246};
    4347
  • trunk/MagicSoft/Mars/msignal/MExtractTimeHighestIntegral.cc

    r4723 r4732  
    324324        SetWindowSize(hw, lw);
    325325
    326     rc = MExtractTime::ReadEnv(env, prefix, print) ? kTRUE : rc;
    327 
    328     return rc;
     326    return MExtractTime::ReadEnv(env, prefix, print) ? kTRUE : rc;
    329327}
    330328
  • trunk/MagicSoft/Mars/showlog.cc

    r4591 r4732  
    2828    }
    2929
    30     istream *in = argc==2 ? new ifstream(argv[1]) : &cin;
     30    // casts necessary for gcc 2.95.3
     31    istream *in = argc==2 ? (istream*)new ifstream(argv[1]) : (istream*)&cin;
    3132    if (!*in)
    3233    {
Note: See TracChangeset for help on using the changeset viewer.