Ignore:
Timestamp:
08/24/04 18:15:29 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.