Changeset 4723 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
08/24/04 18:15:29 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 added
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4722 r4723  
    2020                                                 -*-*- END OF LINE -*-*-
    2121
    22   2004/08/24 : Wolfgang Wittek
     22  2004/08/24 : Thomas Bretz
    2323
    2424   * Makefile:
     
    7474   * msignal/MExtractTimeHighestIntegral.[h,cc]:
    7575     - added ReadEnv
     76
     77   * mcalib/MCalibrationRelTimeCalc.cc:
     78     - do not write to a log file if logging is not enabled
     79     - replaced some arrays by TArrays
     80
     81   * mjobs/JobsLinkDef.h, mjobs/Makefile:
     82     - added MJCalibrateSignal
     83
     84   * mjobs/MJCalibrateSignal.[h,cc]:
     85     - added
     86
     87   * msignal/MExtractFixedWindow.[h,cc], msignal/MExtractFixedWindowPeakSearch.[h,cc],
     88     msignal/MExtractSlidingWindow.[h,cc], msignal/MExtractTime.[h,cc],
     89     msignal/MExtractTimeAndCharge.[h,cc], msignal/MExtractTimeHighestIntegral.[h,cc]
     90     msignal/MExtractor.[h,cc]:
     91     - added Print
     92     - added ReadEnv
     93     - changed version number to 1
    7694
    7795
  • trunk/MagicSoft/Mars/NEWS

    r4716 r4723  
    88     more): showlog
    99
     10   - added new program to display an MStatusArray of plots (stored with
     11     MStatusDisplay) from a file: showplot
     12
    1013   - Added support for Sequences (MSequence). Sequences are blocks of run
    1114     files containing the same calibration and belonging to the same
     
    3134   - added a cleaning which takes signal height _and_ arrival time into
    3235     account: probability cleaning (for more details see MImgCleanStd)
     36
     37   - added program doing the calibration and the signal extraction
     38     and signal calibration: callisto
    3339
    3440
  • trunk/MagicSoft/Mars/callisto.cc

    r4722 r4723  
    1616#include "MJPedestal.h"
    1717#include "MJCalibration.h"
     18#include "MJCalibrateSignal.h"
    1819
    1920using namespace std;
     
    4041    gLog << all << endl;
    4142    gLog << "Sorry the usage is:" << endl;
    42     gLog << " callisto [options] sequence.txt" << endl << endl;
     43    gLog << " callisto [-c] [-y] [options] sequence.txt" << endl << endl;
    4344    gLog << " Arguments:" << endl;
    4445    gLog << "   sequence.txt:             An ascii file defining a sequence of runs" << endl;
    4546    gLog << " Root Options:" << endl;
    4647    gLog << "   -b                        Batch mode (no graphical output to screen)" << endl<<endl;
     48    gLog << " Operation Modes:" << endl;
     49    gLog << "   -c                        Calculate the calibration constants" << endl;
     50    gLog << "   -y                        Extract and calibrate signal" << endl << endl;
    4751    gLog << " Options:" << endl;
    4852    gLog.Usage();
     
    5054    gLog << "   -f                        Force overwrite of existing files" << endl;
    5155    gLog << "   --in=path                 Path where to search for the data files" << endl;
    52     gLog << "   --out=path                Path where to write the result to" << endl;
     56    gLog << "                             [default=standard path in datacenter]" << endl;
     57    gLog << "   --iny=path                Path where to search for the calibration files" << endl;
     58    gLog << "                             [default=local path or output path of Mode-C]" << endl;
     59    gLog << "   --out=path                Path to write the all results to [def=local path]" << endl;
     60    gLog << "   --outc=path               Path to write Mode-C result to   [def=local path]" << endl;
     61    gLog << "   --outy=path               Path to write Mode-Y result to   [def=local path]" << endl;
    5362    gLog << "   --printseq                Print Sequence information" << endl;
    5463    gLog << "   --printfiles              Print Files taken from Sequence" << endl;
     
    92101    const Bool_t  kPrintOnly  = arg.HasOnlyAndRemove("--printonly");
    93102    const Bool_t  kOverwrite  = arg.HasOnlyAndRemove("-f");
     103    const TString kInpathY    = arg.GetStringAndRemove("--iny=",  "");
     104          TString kInpath     = arg.GetStringAndRemove("--in=",  "");
    94105    const TString kOutpath    = arg.GetStringAndRemove("--out=", "");
    95     const TString kInpath     = arg.GetStringAndRemove("--in=",  "");
    96 
     106          TString kOutpathC   = arg.GetStringAndRemove("--outc=", "");
     107          TString kOutpathY   = arg.GetStringAndRemove("--outy=", "");
     108
     109    const Bool_t  kModeC      = arg.HasOnlyAndRemove("-c");
     110    const Bool_t  kModeY      = arg.HasOnlyAndRemove("-y");
     111
     112    if (!kModeC && !kModeY)
     113    {
     114        gLog << err << "Neither calibration (-c) nor signal extraction (-y) mode specified!" << endl;
     115        return 0;
     116    }
     117
     118    if (!kOutpath.IsNull())
     119    {
     120        if (!kOutpathC.IsNull() || !kOutpathY.IsNull())
     121        {
     122            gLog << err << "You cannot use --out= and --outc= or --outy= together!" << endl;
     123            return 0;
     124        }
     125        if (kOutpathC.IsNull())
     126            kOutpathC = kOutpath;
     127        if (kOutpathY.IsNull())
     128            kOutpathY = kOutpath;
     129    }
    97130    if (arg.GetNumOptions()>0)
    98131    {
     
    116149    if (gROOT->IsBatch() || !gClient)
    117150    {
    118         gLog << "Bombing... maybe your DISPLAY variable is not set correctly!" << endl;
     151        gLog << err << "Bombing... maybe your DISPLAY variable is not set correctly!" << endl;
    119152        return 1;
    120153    }
     
    164197    d->SetTitle(kSequence);
    165198
    166     MJPedestal job1;
    167     job1.SetSequence(&seq);
    168     job1.SetEnv(kConfig);
    169     job1.SetDisplay(d);;
    170     job1.SetOutputPath(kOutpath);
    171 
    172     if (!job1.ProcessFile())
    173     {
    174         gLog << err << "Calculation of pedestal failed." << endl << endl;
    175         return -1;
    176     }
    177 
    178     if (!job1.GetDisplay())
    179     {
    180         gLog << warn << "Display closed by user... execution aborted." << endl << endl;
    181         return 1;
    182     }
    183 
    184     MJCalibration job2;
    185     job2.SetSequence(&seq);
    186     job2.SetEnv(kConfig);
    187     job2.SetDisplay(d);;
    188     job2.SetBadPixels(job1.GetBadPixels());
    189     job2.SetOutputPath(kOutpath);
    190     job2.SetOverwrite(kOverwrite);
    191 
    192     if (!job2.ProcessFile(job1.GetPedestalCam()))
    193     {
    194         gLog << err << "Calculation of calibration failed." << endl << endl;
    195         return -1;
    196     }
    197 
    198     if (!job2.GetDisplay())
    199     {
    200         gLog << warn << "Display closed by user... execution aborted." << endl << endl;
    201         return 1;
     199    if (kModeC)
     200    {
     201        MJPedestal job1("MJPedestal1");
     202        job1.SetSequence(&seq);
     203        job1.SetEnv(kConfig);
     204        job1.SetDisplay(d);;
     205        job1.SetInputPath(kInpath);
     206        job1.SetOutputPath(kOutpathC);
     207        job1.SetOverwrite(kOverwrite);
     208
     209        if (!job1.ProcessFile())
     210        {
     211            gLog << err << "Calculation of pedestal failed." << endl << endl;
     212            return -1;
     213        }
     214
     215        if (!job1.GetDisplay())
     216        {
     217            gLog << warn << "Display closed by user... execution aborted." << endl << endl;
     218            return 1;
     219        }
     220
     221        MJCalibration job2("MJCalibration");
     222        job2.SetSequence(&seq);
     223        job2.SetEnv(kConfig);
     224        job2.SetDisplay(d);;
     225        job2.SetBadPixels(job1.GetBadPixels());
     226        job2.SetInputPath(kInpath);
     227        job2.SetOutputPath(kOutpathC);
     228        job2.SetOverwrite(kOverwrite);
     229
     230        if (!job2.ProcessFile(job1.GetPedestalCam()))
     231        {
     232            gLog << err << "Calculation of calibration failed." << endl << endl;
     233            return -1;
     234        }
     235
     236        if (!job2.GetDisplay())
     237        {
     238            gLog << warn << "Display closed by user... execution aborted." << endl << endl;
     239            return 1;
     240        }
     241    }
     242
     243    if (kModeY)
     244    {
     245        d->Reset();
     246
     247        MJCalibrateSignal job("MJCalibrateSignal");
     248        job.SetDisplay(d);;
     249        job.SetInputPath(kInpath); // Where to search for data files
     250        job.SetOutputPath(kOutpathY);
     251        job.SetOverwrite(kOverwrite);
     252        // Where to search for calibration files
     253        if (!job.ProcessFile(seq, kConfig, kModeC ? kOutpathC : kInpathY))
     254            return -1;
     255
     256        if (!job.GetDisplay())
     257        {
     258            gLog << warn << "Display closed by user... execution aborted." << endl << endl;
     259            return 1;
     260        }
    202261    }
    203262
  • trunk/MagicSoft/Mars/callisto.rc

    r4722 r4723  
    1 #############################################################################
    2 #
     1# ==========================================================================
     2#############################################################################
     3# ==========================================================================
     4#                              General
     5# ==========================================================================
     6#############################################################################
     7# ==========================================================================
     8
     9# -------------------------------------------------------------------------
    310# Use this if you want to setup the logging stream for the jobs
    411# (overwrites command line options)
    5 #
    6 #############################################################################
     12# -------------------------------------------------------------------------
    713#MLog.VerbosityLevel: 2
    814#MLog.DebugLevel:     1
    915#MLog.NoColors:       yes
    1016
    11 #############################################################################
    12 #
     17# ==========================================================================
     18#############################################################################
     19# ==========================================================================
     20#                             Calibration
     21# ==========================================================================
     22#############################################################################
     23# ==========================================================================
     24
     25# -------------------------------------------------------------------------
    1326# Use this if you want to write the MJPedestal output somewhere
    1427# If you don't want it, it is written to the calibration output anyhow.
    15 #
    16 #############################################################################
    17 #MJPedestal.OutputPath: .
    18 
    19 #############################################################################
    20 #
     28# -------------------------------------------------------------------------
     29#MJPedestal1.OutputPath: .
     30
     31# -------------------------------------------------------------------------
    2132# Use this to define where the calibration output is stored. The filename
    2233# is created from the sequence number. If nothing is specified '.' is
    23 # assumed.
    24 # (overwrites command line options)
    25 #
    26 #############################################################################
     34# assumed. (overwrites command line options)
     35# -------------------------------------------------------------------------
    2736#MJCalibration.OutputPath: calped
    2837
    29 #############################################################################
    30 #
     38# -------------------------------------------------------------------------
    3139# Use this to define where the program should search for the pedestal
    3240# and calibration files defined in the sequence. To use the local
    3341# directory use '.' If nothing is specified the default path in the
    34 # datacenter is used.
    35 # (overwrites command line options)
    36 #
    37 #############################################################################
    38 #MJPedestal.InputPath:    calped
     42# datacenter is used. (overwrites command line options)
     43# -------------------------------------------------------------------------
     44#MJPedestal1.InputPath:    calped
    3945#MJCalibration.InputPath: calped
    4046
    41 #############################################################################
    42 #
    43 # You can choose the pedestal extraction algorithm/task. To use
    44 # MPedCalcPedRun use the lines below. Be carefull, a pedestal file
    45 # could be (if no pedestal file available) a data-file, too.
    46 #
    47 #############################################################################
    48 #ExtractPedestal: MPedCalcPedRun
    49 #ExtractPedestal.HiGainFirst:       0
    50 #ExtractPedestal.HiGainLast:       29
    51 #ExtractPedestal.LoGainFirst:       0
    52 #ExtractPedestal.LoGainLast:       14
    53 #ExtractPedestal.HiGainWindowSize: 14
    54 #ExtractPedestal.LoGainWindowSize:  0
    55 
    56 #############################################################################
    57 #
    58 # You can choose the pedestal extraction algorithm/task. To use
    59 # MPedCalcFromLoGain use the lines below. Be carefull, a pedestal file
    60 # could be (if no pedestal file available) a data-file, too.
    61 #
    62 #############################################################################
    63 ExtractPedestal: MPedCalcFromLoGain
    64 ExtractPedestal.PedestalUpdate:   no
    65 #ExtractPedestal.HiGainFirst:       0
    66 #ExtractPedestal.HiGainLast:       11
    67 #ExtractPedestal.LoGainFirst:       1
    68 #ExtractPedestal.LoGainLast:       14
    69 #ExtractPedestal.HiGainWindowSize: 12
    70 #ExtractPedestal.LoGainWindowSize: 14
    71 #ExtractPedestal.MaxHiGainVar:     40
    72 
    73 #############################################################################
    74 #
    75 # Configure MJPedestal
    76 #
    77 #############################################################################
    78 # Maximum number of event processed in the loop
    79 #MJPedestal.MaxEvents: 1000
    80 # Allow to overwrite existing files with the output file
    81 #MJPedestal.AllowOverwrite: No
    82 # Use data runs from the sequence instead of calibration runs
    83 #MJPedestal.UseData: No
    84 
    85 #############################################################################
    86 #
     47# -------------------------------------------------------------------------
    8748# Configure MJCalibration
    88 #
    89 #############################################################################
     49# -------------------------------------------------------------------------
    9050# Switch on relative time calibration
    9151MJCalibration.RelTimeCalibration: Yes
     
    10363#MJCalibration.UsePINDiode: No
    10464
    105 #############################################################################
    106 #
     65# -------------------------------------------------------------------------
     66# You can choose the pedestal extraction algorithm/task. To use
     67# MPedCalcPedRun use the lines below. Be carefull, a pedestal file
     68# could be (if no pedestal file available) a data-file, too.
     69# -------------------------------------------------------------------------
     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
     77
     78# -------------------------------------------------------------------------
     79# You can choose the pedestal extraction algorithm/task. To use
     80# MPedCalcFromLoGain use the lines below. Be carefull, a pedestal file
     81# could be (if no pedestal file available) a data-file, too.
     82# -------------------------------------------------------------------------
     83MJCalibration.ExtractPedestal: MPedCalcFromLoGain
     84MJCalibration.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
     92
     93# -------------------------------------------------------------------------
     94# Configure MJPedestal
     95# -------------------------------------------------------------------------
     96# Maximum number of event processed in the loop
     97#MJPedestal1.MaxEvents: 1000
     98# Allow to overwrite existing files with the output file
     99#MJPedestal1.AllowOverwrite: No
     100# Use data runs from the sequence instead of calibration runs
     101#MJPedestal1.UseData: No
     102
     103
     104# -------------------------------------------------------------------------
    107105# Use this if you want to change the signal extractor for the calibration
    108106# and automatically the data extraction
    109 #
    110 #############################################################################
    111 ExtractSignal: MExtractFixedWindowPeakSearch
    112 #ExtractSignal.HiGainFirst:       2
    113 #ExtractSignal.HiGainLast:       14
    114 #ExtractSignal.LoGainFirst:       2
    115 #ExtractSignal.LoGainLast:       14
    116 #ExtractSignal.HiGainWindowSize:  6
    117 #ExtractSignal.LoGainWindowSize:  6
    118 #ExtractSignal.PeakSearchWindow:  4
    119 #ExtractSignal.OffsetFromWindow:  1
    120 #ExtractSignal.LoGainPeakShift:   0
    121 
    122 #############################################################################
    123 #
     107# -------------------------------------------------------------------------
     108MJCalibration.ExtractSignal: MExtractFixedWindowPeakSearch
     109#MJCalibration.ExtractSignal.HiGainFirst:       2
     110#MJCalibration.ExtractSignal.HiGainLast:       14
     111#MJCalibration.ExtractSignal.LoGainFirst:       2
     112#MJCalibration.ExtractSignal.LoGainLast:       14
     113#MJCalibration.ExtractSignal.HiGainWindowSize:  6
     114#MJCalibration.ExtractSignal.LoGainWindowSize:  6
     115#MJCalibration.ExtractSignal.PeakSearchWindow:  4
     116#MJCalibration.ExtractSignal.OffsetFromWindow:  1
     117#MJCalibration.ExtractSignal.LoGainPeakShift:   0
     118
     119# -------------------------------------------------------------------------
    124120# Use this if you want to change the time extractor for the calibration
    125121# and automatically the data extraction
    126 #
    127 #############################################################################
    128 ExtractTime: MExtractTimeHighestIntegral
    129 #ExtractTime.HiGainFirst:       0
    130 #ExtractTime.HiGainLast:       14
    131 #ExtractTime.LoGainFirst:       3
    132 #ExtractTime.LoGainLast:       14
    133 #ExtractTime.WindowSizeHiGain:  6
    134 #ExtractTime.WindowSizeLoGain:  6
    135 
    136 #############################################################################
    137 #
     122# -------------------------------------------------------------------------
     123MJCalibration.ExtractTime: MExtractTimeHighestIntegral
     124#MJCalibration.ExtractTime.HiGainFirst:       0
     125#MJCalibration.ExtractTime.HiGainLast:       14
     126#MJCalibration.ExtractTime.LoGainFirst:       3
     127#MJCalibration.ExtractTime.LoGainLast:       14
     128#MJCalibration.ExtractTime.WindowSizeHiGain:  6
     129#MJCalibration.ExtractTime.WindowSizeLoGain:  6
     130#MJCalibration.ExtractTime.OffsetLoGain:    1.51
     131
     132# -------------------------------------------------------------------------
    138133# Use this to change the behaviour of the calibration
    139 #
    140 #############################################################################
    141 #MCalibrationChargeCalc.ChargeLimit:        2.5
    142 #MCalibrationChargeCalc.ChargeErrLimit:     0
    143 #MCalibrationChargeCalc.ChargeRelErrLimit:  1
    144 #MCalibrationChargeCalc.Debug:              no
    145 
    146 #MCalibrationChargeCalc.FFactorErrLimit:    4.5
    147 #MCalibrationChargeCalc.LambdaErrLimit:     0.2
    148 #MCalibrationChargeCalc.LambdaCheckLimit:   0.5
    149 #MCalibrationChargeCalc.PheErrLimit:        3.5
     134# -------------------------------------------------------------------------
     135#MJCalibration.MCalibrationChargeCalc.ChargeLimit:        2.5
     136#MJCalibration.MCalibrationChargeCalc.ChargeErrLimit:     0
     137#MJCalibration.MCalibrationChargeCalc.ChargeRelErrLimit:  1
     138#MJCalibration.MCalibrationChargeCalc.Debug:              no
     139
     140#MJCalibration.MCalibrationChargeCalc.FFactorErrLimit:    4.5
     141#MJCalibration.MCalibrationChargeCalc.LambdaErrLimit:     0.2
     142#MJCalibration.MCalibrationChargeCalc.LambdaCheckLimit:   0.5
     143#MJCalibration.MCalibrationChargeCalc.PheErrLimit:        3.5
    150144#//MCalibrationChargeCalc.PulserColor       ( const MCalibrationCam::PulserColor_t col ) { fPulserColor       = col;   }
    151145
    152 #############################################################################
    153 #
     146# -------------------------------------------------------------------------
    154147# Use this to change the behaviour of the calibration
    155 #
    156 #############################################################################
    157 #MHCalibrationChargeCam.Debug:        no
     148# -------------------------------------------------------------------------
     149#MJCalibration.MHCalibrationChargeCam.Debug:        no
     150
     151
     152 
     153# ==========================================================================
     154#############################################################################
     155# ==========================================================================
     156#                            Signal extraction
     157# ==========================================================================
     158#############################################################################
     159# ==========================================================================
     160
     161# -------------------------------------------------------------------------
     162# Use a OutputPath if you want to write the results to a file
     163# -------------------------------------------------------------------------
     164#MJCalibrateSignal.OutputPath: .
     165
     166MJPedestal2.UseData:   Yes
     167MJPedestal2.MaxEvents: 750
     168
     169MJPedestal2.ExtractPedestal: MPedCalcFromLoGain
     170MJPedestal2.ExtractPedestal.PedestalUpdate:   yes
     171MJPedestal2.ExtractPedestal.NumEventsDump:   500
     172
     173# -------------------------------------------------------------------------
     174# Setup pedestal extraktor for running through data
     175# -------------------------------------------------------------------------
     176MJCalibrateSignal.MPedCalcFromLoGain: MPedCalcFromLoGain
     177MJCalibrateSignal.MPedCalcFromLoGain.PedestalUpdate:   yes
     178MJCalibrateSignal.MPedCalcFromLoGain.NumEventsDump:   500
     179#MJCalibrateSignal.ExtractPedestal.HiGainFirst:       0
     180#MJCalibrateSignal.ExtractPedestal.HiGainLast:       11
     181#MJCalibrateSignal.ExtractPedestal.LoGainFirst:       1
     182#MJCalibrateSignal.ExtractPedestal.LoGainLast:       14
     183#MJCalibrateSignal.ExtractPedestal.HiGainWindowSize: 12
     184#MJCalibrateSignal.ExtractPedestal.LoGainWindowSize: 14
     185#MJCalibrateSignal.ExtractPedestal.MaxHiGainVar:     40
     186
     187# -------------------------------------------------------------------------
     188# Setup calibration of data
     189# -------------------------------------------------------------------------
     190MJCalibrateSignal.MCalibrateData.PedestalFlag: Event
     191MJCalibrateSignal.MCalibrateData.CalibrationMode: Default
     192
     193# -------------------------------------------------------------------------
     194# Setup level for determining of bad pixels
     195# -------------------------------------------------------------------------
     196# MJCalibrateSignal.MBadPixelsCalc.PedestalLevel: 3.0
     197MJCalibrateSignal.MBadPixelsTreat.NumMinNeighbors:  2
     198MJCalibrateSignal.MBadPixelsTreat.UseInterpolation: yes
     199MJCalibrateSignal.MBadPixelsTreat.ProcessPedestal:  yes
     200#MJCalibrateSignal.MBadPixelsTreat.UseCentralPixel:  no
     201#MJCalibrateSignal.MBadPixelsTreat.HardTreatment:    no
  • trunk/MagicSoft/Mars/mbase/MTaskEnv.cc

    r4609 r4723  
    165165Bool_t MTaskEnv::ReInit(MParList *list)
    166166{
     167    *fLog << fTask->ClassName() << " - " << flush;
    167168    return fTask->ReInit(list);
    168169}
     
    187188Int_t MTaskEnv::PostProcess()
    188189{
     190    *fLog << fTask->ClassName() << " - " << flush;
    189191    return fTask->CallPostProcess();
    190192}
  • trunk/MagicSoft/Mars/mbase/MTaskEnv.h

    r4601 r4723  
    3636    void SetDefault(const char *def);
    3737
     38    MTask *GetTask() { return fTask; }
     39
    3840    ClassDef(MTaskEnv, 0) // Task which can be setup from an environment file
    3941};
  • trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc

    r4133 r4723  
    9696  SetRelTimeResolutionLimit();
    9797  SetOutputPath();
    98   SetOutputFile();
     98  SetOutputFile("");
    9999 
    100100  Clear();
     
    233233  // Re-direct the output to an ascii-file from now on:
    234234  //
    235   MLog asciilog;
    236   asciilog.SetOutputFile(GetOutputFile(),kTRUE);
    237   SetLogStream(&asciilog);
     235  MLog *asciilog = fOutputFile.IsNull() ? 0 : new MLog;
     236  if (asciilog)
     237  {
     238      asciilog->SetOutputFile(GetOutputFile(),kTRUE);
     239      SetLogStream(asciilog);
     240  }
     241
    238242  //
    239243  // Finalize calibration statistics
     
    254258                    "Pixels with unsuccesful Gauss fit to the times:   ");
    255259
    256   SetLogStream(&gLog);
     260  if (asciilog)
     261  {
     262      SetLogStream(&gLog);
     263      delete asciilog;
     264  }
    257265
    258266  return kTRUE;
     
    277285  const UInt_t nareas   = fGeom->GetNumAreas();
    278286
    279   Float_t lowlim       [nareas];
    280   Float_t upplim       [nareas];
    281   Float_t areasum      [nareas];
     287  TArrayF lowlim       (nareas);
     288  TArrayF upplim       (nareas);
     289  TArrayF areasum      (nareas);
    282290  //  Float_t areasum2     [nareas];
    283   Int_t   numareavalid [nareas];
    284   Int_t   useunreliable[nareas];
    285 
    286   memset(lowlim        ,0, nareas   * sizeof(Float_t));
    287   memset(upplim        ,0, nareas   * sizeof(Float_t));
    288   memset(areasum       ,0, nareas   * sizeof(Float_t));
    289   //  memset(areasum2      ,0, nareas   * sizeof(Float_t));
    290   memset(numareavalid  ,0, nareas   * sizeof(Int_t  ));
    291   memset(useunreliable ,0, nareas   * sizeof(Int_t  ));
     291  TArrayI numareavalid (nareas);
     292  TArrayI useunreliable(nareas);
    292293
    293294  //
     
    312313      useunreliable[aidx] = 1;
    313314
    314   memset(numareavalid  ,0, nareas   * sizeof(Int_t  ));
     315  numareavalid.Reset();
    315316  //
    316317  // First loop: Get mean time resolution the RMS
  • trunk/MagicSoft/Mars/merpp.cc

    r4578 r4723  
    5858static void Usage()
    5959{
     60    //                1         2         3         4         5         6         7         8
     61    //       12345678901234567890123456789012345678901234567890123456789012345678901234567890
    6062    gLog << all << endl;
    6163    gLog << "Sorry the usage is:" << endl;
    62     gLog << " merpp [-h] [-?] [-a] [-vn] [-cn] [-u, -f]" << endl;
    63     gLog << "       inputfile[.rep,[.raw],[.txt]] [outputfile[.root]]" << endl << endl;
     64    gLog << " merpp [options] inputfile[.rep,[.raw],[.txt]] [outputfile[.root]]" << endl << endl;
    6465    gLog << " Arguments:" << endl;
    65     gLog << "   inputfile.raw:  Magic DAQ binary file." << endl;
    66     gLog << "   inputfile.rep:  Magic Central Control report file." << endl;
    67     gLog << "   inputfile.txt:  Magic DC currents file." << endl;
    68     gLog << "   ouputfile.root: Merpped root file." << endl << endl;
     66    gLog << "   inputfile.raw             Magic DAQ binary file." << endl;
     67    gLog << "   inputfile.rep             Magic Central Control report file." << endl;
     68    gLog << "   inputfile.txt             Magic DC currents file." << endl;
     69    gLog << "   ouputfile.root            Merpped root file." << endl << endl;
    6970    gLog << " Options:" << endl;
    70     gLog << "   -c#                Compression level #=1..9 [default=2]" << endl;
    71     gLog << "   -v#                Verbosity level # [default=2]" << endl;
    72     gLog << "   -u, --update       Update file" << endl;
    73     gLog << "   -a, --no-colors    Do not use Ansii color codes" << endl;
    74     gLog << "   -f                 Force overwrite of an existing file" << endl;
    75     gLog << "   --debug[=n]        Enable root debugging (Default: gDebug=1)" << endl;
    76     gLog << "   -?, -h, --help     This help" << endl << endl;
     71    gLog.Usage();
     72    gLog << "   -?, -h, --help            This help" << endl << endl;
     73    gLog << " File Options:" << endl;
     74    gLog << "   -c#                       Compression level #=1..9 [default=2]" << endl;
     75    gLog << "   -f                        Force overwrite of an existing file" << endl << endl;
    7776    gLog << " Raw Data Options:" << endl;
    78     gLog << "   -ff                Force merpp to ignore broken events" << endl;
    79     gLog << "   --interleave=#     Process only each i-th event [default=1]" << endl << endl;
     77    gLog << "   -ff                       Force merpp to ignore broken events" << endl;
     78    gLog << "   --interleave=#            Process only each i-th event [default=1]" << endl << endl;
    8079//    gLog << "   --sql=mysql://user:password@url  Insert run into database" << endl << endl;
    8180    gLog << " Report File Options:" << endl;
    82     gLog << "   --start=date/time  Start event time" << endl;
    83     gLog << "   --stop=date/time   Stop  event time" << endl;
    84     gLog << "   --run=#            Only data corresponding to this run number" << endl;
    85     gLog << "                      (from RUN-REPORT)" << endl;
    86     gLog << "   --runfile=#        Allow only run-control files" << endl;
    87     gLog << "                      (from .rep header)" << endl;
    88     gLog << "   --sumfile          Check for an all night summary file" << endl;
    89     gLog << "                      (from .rep header)" << endl;
    90     gLog << "   --allfiles         Don't check file type <default>" << endl << endl;
     81    gLog << "   --start=date/time         Start event time" << endl;
     82    gLog << "   --stop=date/time          Stop  event time" << endl;
     83    gLog << "   --run=#                   Only data corresponding to this run number" << endl;
     84    gLog << "                             (from RUN-REPORT)" << endl;
     85    gLog << "   --runfile=#               Allow only run-control files" << endl;
     86    gLog << "                             (from .rep header)" << endl;
     87    gLog << "   --sumfile                 Check for an all night summary file" << endl;
     88    gLog << "                             (from .rep header)" << endl;
     89    gLog << "   --allfiles                Don't check file type <default>" << endl << endl;
    9190    gLog << " REMARK: - At the moment you can process a .raw _or_ a .rep file, only!" << endl;
    9291    gLog << "         - 'date/time' has the format 'yyyy-mm-dd/hh:mm:ss.mmm'" << endl << endl;
     
    128127    gLog.Setup(arg);
    129128
    130     const Int_t kComprlvl = arg.HasOption("-c") ? arg.GetIntAndRemove("-c") : 2;
    131     Bool_t kUpdate = arg.HasOnlyAndRemove("--update") || arg.HasOnlyAndRemove("-u");
    132     const Bool_t kInterleave = arg.HasOption("--interleave=") ? arg.GetIntAndRemove("--interleave=") : 1;
    133     const Bool_t kForce = arg.HasOnlyAndRemove("-f");
    134     const Bool_t kForceProc = arg.HasOnlyAndRemove("-ff");
     129    const Int_t  kComprlvl   = arg.GetIntAndRemove("-c", 2);
     130    const Bool_t kInterleave = arg.GetIntAndRemove("--interleave=", 1);
     131    const Bool_t kForce      = arg.HasOnlyAndRemove("-f");
     132    const Bool_t kForceProc  = arg.HasOnlyAndRemove("-ff");
     133    const Int_t  kRunNumber  = arg.GetIntAndRemove("--run=", -1);
     134          Int_t  kRunFile    = arg.GetIntAndRemove("--runfile=", -1);
     135          Bool_t kUpdate     = arg.HasOnlyAndRemove("--update") || arg.HasOnlyAndRemove("-u");
    135136
    136137    MTime kTimeStart;
     
    141142        kTimeStop = AnalyseTime(arg.GetStringAndRemove("--stop="));
    142143
    143     const Int_t   kRunNumber   = arg.HasOption("--run=") ? arg.GetIntAndRemove("--run=") : -1;
    144144//    const TString kSqlDataBase(arg.GetStringAndRemove("--sql="));
    145145
    146     Int_t kRunFile = arg.HasOption("--runfile=") ? arg.GetIntAndRemove("--runfile=") : -1;
    147146    if (arg.HasOnlyAndRemove("--sumfile"))
    148147        kRunFile = 0;
  • trunk/MagicSoft/Mars/mjobs/JobsLinkDef.h

    r4718 r4723  
    99#pragma link C++ class MJPedestal+;
    1010#pragma link C++ class MJCalibration+;
    11 //#pragma link C++ class MJCalibrateSignal+;
     11#pragma link C++ class MJCalibrateSignal+;
    1212#pragma link C++ class MJExtractSignal+;
    1313#pragma link C++ class MJExtractCalibTest+;
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.cc

    r4722 r4723  
    12661266        return;
    12671267
    1268     TString e1 = fEnv->GetValue("MJCalibration.OutputPath", "");
     1268    TString e1 = fEnv->GetValue(Form("%s.OutputPath", fName.Data()), "");
    12691269    if (!e1.IsNull())
    12701270    {
     
    12731273    }
    12741274
    1275     TString col = fEnv->GetValue("MJCalibration.Color", "");
     1275    TString col = fEnv->GetValue(Form("%s.Color", fName.Data()), "");
    12761276    if (!col.IsNull())
    12771277    {
    12781278    }
    12791279
    1280     TString dis = fEnv->GetValue("MJCalibration.Display", "");
     1280    TString dis = fEnv->GetValue(Form("%s.Display", fName.Data()), "");
    12811281    if (dis.BeginsWith("Full", TString::kIgnoreCase))
    12821282        SetFullDisplay();
     
    12861286        SetNormalDisplay();
    12871287
    1288     SetRelTimeCalibration(fEnv->GetValue("MJCalibration.RelTimeCalibration", fRelTimes));
    1289     SetDataCheck(fEnv->GetValue("MJCalibration.Datacheck", fDataCheck));
    1290     SetDebug(fEnv->GetValue("MJCalibration.Debug", fDebug));
    1291     SetUseBlindPixel(fEnv->GetValue("MJCalibration.UseBlindPixel", IsUseBlindPixel()));
    1292     SetUsePINDiode(fEnv->GetValue("MJCalibration.UsePINDiode", IsUsePINDiode()));
    1293 
    1294     SetOverwrite(fEnv->GetValue("MJPedestal.AllowOverwrite", fOverwrite));
    1295     SetInputPath(fEnv->GetValue("MJPedestal.InputPath", fInputPath));
     1288    SetRelTimeCalibration(fEnv->GetValue(Form("%s.RelTimeCalibration", fName.Data()), fRelTimes));
     1289    SetDataCheck(fEnv->GetValue(Form("%s.Datacheck", fName.Data()), fDataCheck));
     1290    SetDebug(fEnv->GetValue(Form("%s.Debug", fName.Data()), fDebug));
     1291    SetUseBlindPixel(fEnv->GetValue(Form("%s.UseBlindPixel", fName.Data()), IsUseBlindPixel()));
     1292    SetUsePINDiode(fEnv->GetValue(Form("%s.UsePINDiode", fName.Data()), IsUsePINDiode()));
     1293
     1294    SetOverwrite(fEnv->GetValue(Form("%s.AllowOverwrite", fName.Data()), fOverwrite));
     1295    SetInputPath(fEnv->GetValue(Form("%s.InputPath", fName.Data()), fInputPath));
    12961296}
    12971297
     
    14261426    MTaskList tlist;
    14271427    plist.AddToList(&tlist);
     1428    plist.AddToList(this); // take care of fDisplay!
    14281429
    14291430    MReadMarsFile read("Events");
     
    14951496    calcalc.SetPulserColor(fColor);
    14961497
    1497     MFillH fillpin("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode");
    1498     MFillH fillbnd("MHCalibrationChargeBlindCam", "MExtractedSignalBlindPixel");
    1499     MFillH fillcam("MHCalibrationChargeCam",      "MExtractedSignalCam");
    1500     MFillH filltme("MHCalibrationRelTimeCam",     "MArrivalTimeCam");
     1498    MFillH fillpin("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode",   "FillPINDiode");
     1499    MFillH fillbnd("MHCalibrationChargeBlindCam", "MExtractedSignalBlindPixel", "FillBlindCam");
     1500    MFillH fillcam("MHCalibrationChargeCam",      "MExtractedSignalCam",        "FillChargeCam");
     1501    MFillH filltme("MHCalibrationRelTimeCam",     "MArrivalTimeCam",            "FillRelTime");
    15011502    fillpin.SetNameTab("PINDiode");
    15021503    fillbnd.SetNameTab("BlindPix");
     
    15661567        evtloop.ReadEnv(*fEnv);
    15671568
     1569    //if (!WriteEventloop(evtloop))
     1570    //    return kFALSE;
     1571
     1572    if (!WriteTasks(taskenv.GetTask(), taskenv2.GetTask()))
     1573        return kFALSE;
     1574
    15681575    // Execute first analysis
    15691576    if (!evtloop.Eventloop())
     
    15801587    // the display. No idea where this comes from...
    15811588    //
     1589    // FIND THE REASON! THE NEXT CHANGE SOMEBODY DOES MIGHT RESULT
     1590    // IN __YOUR__ WORKAROUN NOT WORKING IF IT IS NOT CLEANLY DONE!
     1591    /*
    15821592    if (fDisplay)
    15831593    {
     
    16071617        }
    16081618    }
    1609    
     1619*/
    16101620    DisplayResult(plist);
    16111621
     
    16131623        return kFALSE;
    16141624
    1615     *fLog << inf << GetDescriptor() << ": Done." << endl;
     1625    *fLog << all << GetDescriptor() << ": Done." << endl;
    16161626
    16171627    return kTRUE;
     
    17161726}
    17171727
     1728Bool_t MJCalibration::WriteEventloop(MEvtLoop &evtloop) const
     1729{
     1730    if (fOutputPath.IsNull())
     1731        return kTRUE;
     1732
     1733    const TString oname(GetOutputFile());
     1734
     1735    *fLog << inf << "Writing to file: " << oname << endl;
     1736
     1737    TFile file(oname, fOverwrite?"RECREATE":"NEW", "File created by MJCalibration", 9);
     1738    if (!file.IsOpen())
     1739    {
     1740        *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;
     1741        return kFALSE;
     1742    }
     1743
     1744    if (evtloop.Write(fName)<=0)
     1745    {
     1746        *fLog << err << "Unable to write MEvtloop to " << oname << endl;
     1747        return kFALSE;
     1748    }
     1749
     1750    return kTRUE;
     1751}
     1752
     1753Bool_t MJCalibration::WriteTasks(MTask *t1, MTask *t2) const
     1754{
     1755    if (fOutputPath.IsNull())
     1756        return kTRUE;
     1757
     1758    const TString oname(GetOutputFile());
     1759
     1760    *fLog << inf << "Writing to file: " << oname << endl;
     1761
     1762    TFile file(oname, fOverwrite?"RECREATE":"NEW", "File created by MJCalibration", 9);
     1763    if (!file.IsOpen())
     1764    {
     1765        *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;
     1766        return kFALSE;
     1767    }
     1768
     1769    if (t1->Write()<=0)
     1770    {
     1771        *fLog << err << "Unable to write " << t1->GetName() << " to " << oname << endl;
     1772        return kFALSE;
     1773    }
     1774    if (t2->Write()<=0)
     1775    {
     1776        *fLog << err << "Unable to write " << t2->GetName() << " to " << oname << endl;
     1777        return kFALSE;
     1778    }
     1779
     1780    return kTRUE;
     1781}
     1782
    17181783// --------------------------------------------------------------------------
    17191784//
     
    17361801    *fLog << inf << "Writing to file: " << oname << endl;
    17371802
    1738     TFile file(oname, fOverwrite?"RECREATE":"NEW", "File created by MJCalibration", 9);
     1803    TFile file(oname, "UPDATE", "File created by MJCalibration", 9);
    17391804    if (!file.IsOpen())
    17401805    {
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.h

    r4645 r4723  
    2222
    2323class TEnv;
     24class MTask;
    2425class MRunIter;
    2526class MSequence;
     
    2829class MExtractor;
    2930class MExtractTime;
     31class MEvtLoop;
    3032
    3133class MExtractBlindPixel;
     
    5658
    5759  TString fOutputPath;                                 // Path to the output files
     60  TString fInputPath;                                  // Path to get the data files from
    5861 
    5962  TEnv           *fEnv;                                // Input setup-file
     
    8992 
    9093  Byte_t fDevices;                                     // Bit-field for used devices for calibration
    91  
     94
     95  // Combine these options into a single bit-files (TestBit/SetBit, etc)
    9296  Bool_t fRelTimes;                                    // Flag if relative times have to be calibrated
    9397  Bool_t fDataCheck;                                   // Flag if the data check is run on raw data
    9498  Bool_t fDebug;                                       // Flag if debug option is passed onto cal. classes
     99  Bool_t fOverwrite;                                   // Allow to overwite existing files
    95100 
    96101  void   DisplayResult        ( MParList &plist );
     
    102107 
    103108  Bool_t WriteResult();
     109  Bool_t WriteEventloop(MEvtLoop &evtloop) const;
     110  Bool_t WriteTasks(MTask *t1, MTask *t2) const;
    104111  void   CheckEnv();
    105112 
     
    134141  void SetSequence(MSequence *seq) { fSequence=seq; }
    135142  void SetOutputPath(const char *path=".");
     143  void SetInputPath(const char *path=".");
     144  void SetOverwrite(Bool_t b=kTRUE) { fOverwrite=b; }
    136145 
    137146  // Displays
     
    156165  Bool_t ProcessFile(MPedestalCam &pedcam);
    157166  Bool_t Process(MPedestalCam &pedcam);
     167
     168  MStatusDisplay *GetDisplay() { return fDisplay; }
    158169 
    159170  ClassDef(MJCalibration, 0) // Tool to run a calibration per pulser colour and intensity
  • trunk/MagicSoft/Mars/mjobs/MJPedestal.cc

    r4722 r4723  
    440440
    441441}
    442 
    443 
    444 Bool_t MJPedestal::WriteResult()
     442/*
     443Bool_t MJPedestal::WriteEventloop(MEvtLoop &evtloop) const
    445444{
    446445    if (fOutputPath.IsNull())
     
    452451
    453452    TFile file(oname, fOverwrite?"RECREATE":"NEW", "File created by MJPedestal", 9);
     453    if (!file.IsOpen())
     454    {
     455        *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;
     456        return kFALSE;
     457    }
     458
     459    if (evtloop.Write(fName)<=0)
     460    {
     461        *fLog << err << "Unable to write MEvtloop to " << oname << endl;
     462        return kFALSE;
     463    }
     464
     465    return kTRUE;
     466}
     467*/
     468Bool_t MJPedestal::WriteResult()
     469{
     470    if (fOutputPath.IsNull())
     471        return kTRUE;
     472
     473    const TString oname(GetOutputFile());
     474
     475    *fLog << inf << "Writing to file: " << oname << endl;
     476
     477    TFile file(oname, "UPDATE", "File created by MJPedestal", 9);
    454478    if (!file.IsOpen())
    455479    {
     
    527551        return;
    528552
    529     TString e1 = fEnv->GetValue("MJPedestal.OutputPath", "");
     553    TString e1 = fEnv->GetValue(Form("%s.OutputPath", fName.Data()), "");
    530554    if (!e1.IsNull())
    531555    {
     
    534558    }
    535559
    536     SetMaxEvents(fEnv->GetValue("MJPedestal.MaxEvents", fMaxEvents));
    537     SetOverwrite(fEnv->GetValue("MJPedestal.AllowOverwrite", fOverwrite));
    538 
    539     fUseData = fEnv->GetValue("MJPedestal.UseData", fUseData);
     560    SetMaxEvents(fEnv->GetValue(Form("%s.MaxEvents", fName.Data()), fMaxEvents));
     561    SetOverwrite(fEnv->GetValue(Form("%s.AllowOverwrite", fName.Data()), fOverwrite));
     562
     563    fUseData = fEnv->GetValue(Form("%s.UseData", fName.Data()), fUseData);
    540564}
    541565
     
    570594    MTaskList tlist;
    571595    plist.AddToList(&tlist);
     596    plist.AddToList(this); // take care of fDisplay!
    572597
    573598    MReadMarsFile read("Events");
     
    640665        evtloop.ReadEnv(*fEnv);
    641666
     667    //    if (!WriteEventloop(evtloop))
     668    //        return kFALSE;
     669
    642670    // Execute first analysis
    643671    if (!evtloop.Eventloop(fMaxEvents))
     
    654682        return kFALSE;
    655683
    656     *fLog << inf << GetDescriptor() << ": Done." << endl;
     684    *fLog << all << GetDescriptor() << ": Done." << endl;
    657685
    658686    return kTRUE;
  • trunk/MagicSoft/Mars/mjobs/MJPedestal.h

    r4695 r4723  
    1717class TH1D;
    1818class MExtractor;
     19class MEvtLoop;
    1920
    2021class MJPedestal : public MParContainer
     
    3940   
    4041    TString fOutputPath;        // Directory where the F0-files get stored
     42    TString fInputPath;         // Directory from which to read the data files
    4143
    4244    TEnv       *fEnv;           // Input setup-file
     
    5557    Bool_t fDataCheck;          // Flag if the data check is run on raw data
    5658    Bool_t fUseData;            // Use data-runs from sequence instead of pedestal runs
     59    Bool_t fOverwrite;          // Allow to overwite existing files
    5760
    5861    Int_t fMaxEvents;           // Maximum number of events
     
    6063    Bool_t ReadPedestalCam();
    6164    Bool_t WriteResult();
     65    //Bool_t WriteEventloop(MEvtLoop &evtloop) const;
    6266
    6367    void   DisplayResult(MParList &plist);
     
    8690    void SetSequence(const MSequence *seq, Bool_t usedata=kFALSE) { fSequence = seq; }
    8791    void SetOutputPath(const char *path=".");
     92    void SetInputPath(const char *path=".");
    8893    void SetEnv(const char *env);
     94    void SetOverwrite(Bool_t b=kTRUE) { fOverwrite=b; }
    8995    void SetMaxEvents(Int_t max) { fMaxEvents = max; }
    9096
     
    94100    void SetNormalDisplay()    { fDisplayType = kNormalDisplay;    }
    95101
     102    MStatusDisplay *GetDisplay() { return fDisplay; }
     103
    96104    ClassDef(MJPedestal, 0) // Tool to create a pedestal file (MPedestalCam)
    97105};
  • trunk/MagicSoft/Mars/mjobs/Makefile

    r4718 r4723  
    2828           MJPedestal.cc \
    2929           MJCalibration.cc \
     30           MJCalibrateSignal.cc \
    3031           MJExtractSignal.cc \
    3132           MJExtractCalibTest.cc
  • trunk/MagicSoft/Mars/msignal/MExtractFixedWindow.cc

    r4340 r4723  
    282282  out << ");" << endl;
    283283}
     284
     285void MExtractFixedWindow::Print(Option_t *o) const
     286{
     287    *fLog << all;
     288    *fLog << GetDescriptor() << ":" << endl;
     289    MExtractor::Print(o);
     290}
  • trunk/MagicSoft/Mars/msignal/MExtractFixedWindow.h

    r4340 r4723  
    3333
    3434  void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0);
     35
     36  void Print(Option_t *o="") const;
    3537 
    36   ClassDef(MExtractFixedWindow, 0) // Signal Extractor for a fixed extraction window
     38  ClassDef(MExtractFixedWindow, 1) // Signal Extractor for a fixed extraction window
    3739};
    3840
  • trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.cc

    r4722 r4723  
    520520    return rc;
    521521}
     522
     523void MExtractFixedWindowPeakSearch::Print(Option_t *o) const
     524{
     525    *fLog << all;
     526    *fLog << GetDescriptor() << ":" << endl;
     527    *fLog << " Windows: Hi-Gain=" << (int)fHiGainWindowSize << "  Lo-Gain=" << (int)fLoGainWindowSize;
     528    *fLog << "  Peak-Search=" << (int)fPeakSearchWindowSize << endl;
     529    *fLog << " Offset From Window: " << (int)fOffsetFromWindow << endl;
     530    *fLog << " Lo-Gain peak Shift: " << (int)fLoGainPeakShift << endl;
     531    MExtractor::Print(o);
     532}
  • trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.h

    r4722 r4723  
    4545
    4646    void SetLoGainPeakShift(Byte_t shift=fgLoGainPeakShift) { fLoGainPeakShift = shift; }
    47    
    48     ClassDef(MExtractFixedWindowPeakSearch, 0) // Signal Extractor for fixed size trigger-corrected extraction window
     47
     48    void Print(Option_t *o="") const;
     49
     50    ClassDef(MExtractFixedWindowPeakSearch, 1) // Signal Extractor for fixed size trigger-corrected extraction window
    4951};
    5052
  • trunk/MagicSoft/Mars/msignal/MExtractSlidingWindow.h

    r4340 r4723  
    3232                     Byte_t windowl=fgLoGainWindowSize);
    3333
    34   ClassDef(MExtractSlidingWindow, 0) // Signal Extractor for sliding extraction window
     34  ClassDef(MExtractSlidingWindow, 1) // Signal Extractor for sliding extraction window
    3535};
    3636
  • trunk/MagicSoft/Mars/msignal/MExtractTime.cc

    r4608 r4723  
    6969
    7070using namespace std;
     71
    7172const Float_t MExtractTime::fgOffsetLoGain = 1.51;   // 5 ns
     73
    7274// --------------------------------------------------------------------------
    7375//
     
    8385//
    8486MExtractTime::MExtractTime(const char *name, const char *title)
    85   : fArrTime(NULL), fNamePedContainer("MPedestalCam")
     87  : fArrTime(NULL)
    8688{
    8789
     
    108110Int_t MExtractTime::PreProcess(MParList *pList)
    109111{
    110 
    111112  fRawEvt = (MRawEvtData*)pList->FindObject(AddSerialNumber("MRawEvtData"));
    112113  if (!fRawEvt)
     
    129130 
    130131
    131   fPedestals = (MPedestalCam*)pList->FindObject( AddSerialNumber(fNamePedContainer), "MPedestalCam");
     132  fPedestals = (MPedestalCam*)pList->FindObject( AddSerialNumber(fNamePedestalCam), "MPedestalCam");
    132133  if (!fPedestals)
    133134    {
     
    214215}
    215216
     217// --------------------------------------------------------------------------
     218//
     219// In addition to the resources of the base-class MExtractor:
     220//   MJPedestal.MExtractor.OffsetLoGain: 1.51
     221//
     222Int_t MExtractTime::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     223{
     224    Bool_t rc = kFALSE;
     225
     226    if (IsEnvDefined(env, prefix, "OffsetLoGain", print))
     227    {
     228        fOffsetLoGain = GetEnvValue(env, prefix, "OffsetLoGain", fOffsetLoGain);
     229        rc = kTRUE;
     230    }
     231
     232    rc = MExtractor::ReadEnv(env, prefix, print) ? kTRUE : rc;
     233
     234    return rc;
     235}
     236
     237void MExtractTime::Print(Option_t *o) const
     238{
     239    *fLog << all;
     240    if (IsA()==MExtractTime::Class())
     241        *fLog << GetDescriptor() << ":" << endl;
     242    *fLog << " Offset Lo-Gain=" << fOffsetLoGain << endl;
     243    MExtractor::Print(o);
     244}
  • trunk/MagicSoft/Mars/msignal/MExtractTime.h

    r4586 r4723  
    88class MPedestalPix;
    99class MArrivalTimeCam;
     10
    1011class MExtractTime : public MExtractor
    1112{
    12  
     13private:
    1314  static const Float_t fgOffsetLoGain;  // Default for fOffsetLoGain (now set to 1.51 (= 5ns)
    1415
     16  Int_t  PreProcess(MParList *pList);
     17  Bool_t ReInit(MParList *pList);
     18  Int_t  Process();
     19
    1520protected:
     21  Float_t fOffsetLoGain;     // Offset of the low-gain signal w.r.t. the High-Gain slices
    1622
    17   Float_t fOffsetLoGain;                // Offset of the low-gain signal w.r.t. the High-Gain slices
    18 
    19   MArrivalTimeCam *fArrTime;            // Container with the photons arrival times
    20   TString fNamePedContainer; // name of the 'MPedestalCam' container
     23  MArrivalTimeCam *fArrTime; //! Container with the photons arrival times
    2124 
    22 
    23   virtual Int_t PreProcess(MParList *pList);
    24   virtual Bool_t ReInit(MParList *pList);
    25   virtual Int_t Process();
    26 
    2725  virtual void FindTimeHiGain(Byte_t *firstused, Float_t &time, Float_t &dtime,
    2826                              Byte_t &sat, const MPedestalPix &ped) const;
     
    3028                              Byte_t &sat, const MPedestalPix &ped) const;
    3129
     30  Int_t  ReadEnv(const TEnv &env, TString prefix, Bool_t print);
     31
    3232public:
    33 
    3433  MExtractTime(const char *name=NULL, const char *title=NULL);
    3534
    3635  void SetOffsetLoGain( const Float_t f=fgOffsetLoGain) { fOffsetLoGain = f; }
    37   void SetNamePedContainer(const char *name)    { fNamePedContainer = name; }
    3836
    39  
    40   ClassDef(MExtractTime, 0)   // Arrival Time Extractor Base Class
     37  void Print(Option_t *o) const;
     38
     39  ClassDef(MExtractTime, 1)   // Arrival Time Extractor Base Class
    4140};
    4241
    4342#endif
    44 
    45 
    46 
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndCharge.h

    r4260 r4723  
    99class MExtractTimeAndCharge : public MExtractTime
    1010{
     11private:
     12  Int_t  PreProcess(MParList *pList);
     13  Bool_t ReInit(MParList *pList);
     14  Int_t  Process();
     15
    1116protected:
    12 
    13   virtual Int_t PreProcess(MParList *pList);
    14   virtual Bool_t ReInit(MParList *pList);
    15   virtual Int_t Process();
    16 
    1717  virtual void FindTimeAndChargeHiGain(Byte_t *firstused, Byte_t *logain, Float_t &sum, Float_t &dsum,
    1818                                       Float_t &time, Float_t &dtime,
  • trunk/MagicSoft/Mars/msignal/MExtractTimeFastSpline.h

    r4284 r4723  
    77
    88class MPedestalPix;
     9
    910class MExtractTimeFastSpline : public MExtractTime
    1011{
    11 
     12private:
    1213  static const Byte_t  fgHiGainFirst;    // Default for fHiGainFirst  (now set to: 2)
    1314  static const Byte_t  fgHiGainLast;     // Default for fHiGainLast   (now set to: 14)
  • trunk/MagicSoft/Mars/msignal/MExtractTimeHighestIntegral.cc

    r4722 r4723  
    324324        SetWindowSize(hw, lw);
    325325
    326     rc = MExtractor::ReadEnv(env, prefix, print) ? kTRUE : rc;
     326    rc = MExtractTime::ReadEnv(env, prefix, print) ? kTRUE : rc;
    327327
    328328    return rc;
    329329}
     330
     331void MExtractTimeHighestIntegral::Print(Option_t *o) const
     332{
     333    *fLog << all;
     334    *fLog << GetDescriptor() << ":" << endl;
     335    *fLog << " Windows: Hi-Gain=" << (int)fHiGainWindowSize << "  Lo-Gain=" << (int)fLoGainWindowSize << endl;
     336    MExtractTime::Print(o);
     337}
  • trunk/MagicSoft/Mars/msignal/MExtractTimeHighestIntegral.h

    r4722 r4723  
    99{
    1010private:
    11 
    1211  static const Byte_t fgHiGainFirst;
    1312  static const Byte_t fgHiGainLast;
     
    3433                     Byte_t windowl=fgLoGainWindowSize);
    3534
    36   ClassDef(MExtractTimeHighestIntegral, 0) // Task to Extract the Arrival Times As the mean time of the fWindowSize time slices
     35  void Print(Option_t *o="") const;
     36
     37  ClassDef(MExtractTimeHighestIntegral, 1) // Task to Extract the Arrival Times As the mean time of the fWindowSize time slices
    3738};
    3839
  • trunk/MagicSoft/Mars/msignal/MExtractTimeSpline.h

    r3943 r4723  
    77
    88class MPedestalPix;
     9
    910class MExtractTimeSpline : public MExtractTime
    1011{
    11 
     12private:
    1213  static const Byte_t fgHiGainFirst;
    1314  static const Byte_t fgHiGainLast;
  • trunk/MagicSoft/Mars/msignal/MExtractor.cc

    r4615 r4723  
    4242//   setup file. For more information see ReadEnv and MEvtLoop::ReadEnv
    4343//
     44//
     45// IMPORTANT: For all classes you derive from MExtractor make sure that:
     46//    - Print() is correctly implemented
     47//    - Clone() works
     48//    - Class Version number != 0 and the I/O works PERFECTLY
     49//    - only data members which are necessary for the setup (not the ones
     50//      created in PreProcess and Process) are written
     51//    - the version number is maintained!
     52//
     53//
    4454// Input Containers:
    4555//   MRawEvtData
     
    7585
    7686const Byte_t  MExtractor::fgSaturationLimit  = 254;
    77 const TString MExtractor::fgNamePedContainer = "MPedestalCam";
     87const TString MExtractor::fgNamePedestalCam = "MPedestalCam";
     88
    7889// --------------------------------------------------------------------------
    7990//
     
    8495// - all variables to 0
    8596// - fSaturationLimit to fgSaturationLimit
    86 // - fNamePedContainer to fgNamePedContainer
     97// - fNamePedestalCam to fgNamePedestalCam
    8798//
    8899// Call:
     
    98109    AddToBranchList("MRawEvtData.*");
    99110
    100     SetNamePedContainer();
     111    SetNamePedestalCam();
    101112    SetRange();
    102113    SetSaturationLimit();
     
    141152   
    142153
     154    fPedestals = (MPedestalCam*)pList->FindObject(AddSerialNumber(fNamePedestalCam), "MPedestalCam");
     155    if (!fPedestals)
     156    {
     157        *fLog << err << AddSerialNumber("MPedestalCam") << " not found... aborting" << endl;
     158        return kFALSE;
     159    }
     160
    143161    fSignals = (MExtractedSignalCam*)pList->FindCreateObj(AddSerialNumber("MExtractedSignalCam"));
    144162    if (!fSignals)
    145163        return kFALSE;
    146 
    147     fPedestals = (MPedestalCam*)pList->FindObject(AddSerialNumber(fNamePedContainer), "MPedestalCam");
    148     if (!fPedestals)
    149     {
    150         *fLog << err << AddSerialNumber("MPedestalCam") << " not found... aborting" << endl;
    151         return kFALSE;
    152     }
    153164
    154165    return kTRUE;
     
    363374    return rc;
    364375}
     376
     377void MExtractor::Print(Option_t *o) const
     378{
     379    *fLog << all;
     380
     381    if (IsA()==MExtractor::Class())
     382        *fLog << GetDescriptor() << ":" << endl;
     383
     384    *fLog << " Hi Gain Range:  " << (int)fHiGainFirst << " " << (int)fHiGainLast << endl;
     385    *fLog << " Lo Gain Range:  " << (int)fLoGainFirst << " " << (int)fLoGainLast << endl;
     386    *fLog << " Saturation Lim: " << (int)fSaturationLimit << endl;
     387}
  • trunk/MagicSoft/Mars/msignal/MExtractor.h

    r4615 r4723  
    2525
    2626  static const Byte_t  fgSaturationLimit;  //! Default for fSaturationLimit (now set to: 254)
    27   static const TString fgNamePedContainer; //! "MPedestalCam"
     27  static const TString fgNamePedestalCam; //! "MPedestalCam"
    2828 
    2929  MPedestalCam        *fPedestals;         //! Pedestals of all pixels in the camera
    30   MExtractedSignalCam *fSignals;           //  Extracted signal of all pixels in the camera
     30  MExtractedSignalCam *fSignals;           //! Extracted signal of all pixels in the camera
    3131                                       
    3232  MRawEvtData         *fRawEvt;            //! Raw event data (time slices)
     
    4747                                           
    4848  Byte_t   fSaturationLimit;               // Highest FADC slice value until being declared saturated
    49   TString  fNamePedContainer;              // Name of the 'MPedestalCam' container
     49  TString  fNamePedestalCam;              // Name of the 'MPedestalCam' container
    5050 
    5151  virtual void FindSignalHiGain(Byte_t *firstused, Byte_t *lowgain, Float_t &sum, Byte_t &sat) const { }
     
    5959
    6060public:
    61 
    6261  MExtractor(const char *name=NULL, const char *title=NULL);
    6362 
     
    7271
    7372  void SetSaturationLimit  ( Byte_t       lim=fgSaturationLimit        ) { fSaturationLimit  = lim;  }
    74   void SetNamePedContainer ( const char *name=fgNamePedContainer.Data()) { fNamePedContainer = name; }
    75  
    76   ClassDef(MExtractor, 0) // Signal Extractor Base Class
     73  void SetNamePedestalCam ( const char *name=fgNamePedestalCam.Data()) { fNamePedestalCam = name; }
     74
     75  void Print(Option_t *o="") const;
     76
     77  ClassDef(MExtractor, 1) // Signal Extractor Base Class
    7778};
    7879
Note: See TracChangeset for help on using the changeset viewer.