Changeset 5307


Ignore:
Timestamp:
10/22/04 15:59:02 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/callisto.cc

    r5160 r5307  
    113113
    114114    const Bool_t  kPrintSeq   = arg.HasOnlyAndRemove("--print-seq");
    115     const Bool_t  kPrintFiles = arg.HasOnlyAndRemove("--print-files");
    116     const Bool_t  kPrintOnly  = arg.HasOnlyAndRemove("--print-only");
     115    //const Bool_t  kPrintFiles = arg.HasOnlyAndRemove("--print-files");
     116    //const Bool_t  kPrintOnly  = arg.HasOnlyAndRemove("--print-only");
    117117    const Bool_t  kDebugEnv   = arg.HasOnlyAndRemove("--debug-env");
    118118
     
    120120    const Bool_t  kBatch      = arg.HasOnlyAndRemove("-b");
    121121    const Bool_t  kOverwrite  = arg.HasOnlyAndRemove("-f");
    122     const Bool_t  kForceExec  = arg.HasOnlyAndRemove("-ff");
     122    //const Bool_t  kForceExec  = arg.HasOnlyAndRemove("-ff");
    123123
    124124    const TString kInpathD    = arg.GetStringAndRemove("--ind=",  "");
     
    211211        return -1;
    212212    }
    213 
     213/*
    214214    //
    215215    // Process print options
     
    238238    //
    239239    MDirIter iter;
    240     const Int_t n0 = seq.SetupAllRuns(iter, kInpathD);
     240    const Int_t n0 = seq.SetupAllRuns(iter, kInpathD, "[DPC]");
    241241    const Int_t n1 = seq.GetNumAllRuns();
    242242    if (n0 != n1)
     
    254254    if (kPrintOnly)
    255255        return 0;
    256 
     256  */
    257257    //
    258258    // Initialize root
  • trunk/MagicSoft/Mars/mbase/MDirIter.cc

    r5299 r5307  
    202202// --------------------------------------------------------------------------
    203203//
     204// As the filter string may contain a + character, we have to replace
     205// this filter by a new filter contaning a \+ at all locations where a +
     206// was in the original filter.
     207//
     208// We replace:
     209//   .  by  \\.
     210//   +  by  \\+
     211//   *  by  [^\\/:]*
     212//   ?  by  .
     213//
     214// And surround the filter by ^ and $.
     215//
     216// For more details you can have a look at the template:
     217//  TRegexp::MakeWildcard
     218//
     219const TRegexp MDirIter::MakeRegexp(TString n) const
     220{
     221    n.Prepend("^");
     222    n.ReplaceAll(".", "\\.");
     223    n.ReplaceAll("+", "\\+");
     224    n.ReplaceAll("*", "[^\\/:]*");
     225    n.ReplaceAll("?", ".");
     226    n.Append("$");
     227
     228    return TRegexp(n, kFALSE);
     229}
     230
     231// --------------------------------------------------------------------------
     232//
    204233// Check whether the given name n matches the filter f.
    205234// Filters are of the form TRegexp(f, kTRUE)
     
    207236Bool_t MDirIter::MatchFilter(const TString &n, const TString &f) const
    208237{
    209     // As the filter string may contain a + character, we have to replace
    210     // this filter by a new filter contaning a \+ at all locations where a +
    211     // was in the original filter.
    212     TString nf(f);
    213     nf.ReplaceAll("+","\\+");
    214 
    215     return f.IsNull() || !n(TRegexp(nf, kTRUE)).IsNull();
     238
     239    return f.IsNull() || !n(MakeRegexp(f)).IsNull();
    216240}
    217241
  • trunk/MagicSoft/Mars/mbase/MDirIter.h

    r5144 r5307  
    2323    TString ConcatFileName(const char *dir, const char *name) const;
    2424    void    PrintEntry(const TObject &o) const;
     25    const   TRegexp MakeRegexp(TString n) const;
    2526
    2627public:
  • trunk/MagicSoft/Mars/mbase/MRunIter.cc

    r5141 r5307  
    5353
    5454    // R. DeLosReyes and T. Bretz
    55     // Changes to read the DAQ numbering format. Changes takes place 
     55    // Changes to read the DAQ numbering format. Changes takes place
    5656    // between runs 35487 and 00035488 (2004_08_30)
     57    const char *fmt = run>35487 ? "*_%08d_*_%s" : "*_%05d_*_%s";
    5758
    58       MDirIter Next;
    59       if(run<=35487)
    60         Next.AddDirectory(p, Form("*_%05d_*_%s", run,fIsRawFile?"*.raw":"*.root"), -1);
    61       else
    62         Next.AddDirectory(p, Form("*_%08d_*_%s", run,fIsRawFile?"*.raw":"*.root"), -1);
     59    MDirIter Next;
     60    Next.AddDirectory(p, Form(fmt, run,fIsRawFile?"*.raw":"*.root"), -1);
    6361
    6462    const TString name(Next());
  • trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc

    r4766 r5307  
    14831483    if (TestBit(kExitLoopOnExit) || TestBit(kExitLoopOnClose))
    14841484    {
    1485         gLog << dbg << "CloseWindow() calling ExitLoop." << endl;
     1485        //gLog << dbg << "CloseWindow() calling ExitLoop." << endl;
    14861486        gSystem->ExitLoop();
    14871487    }
     
    14911491        //gLog << dbg << "delete " << fName << ";" << endl;
    14921492        delete this;
    1493     }
    1494     fStatus = kFileExit;
    1495     //gLog << dbg << fName << ".fStatus=kFileExit;" << endl;
     1493        // DO NOT EXECUTE ANY COMMAND AFTER this!
     1494    }
     1495    else
     1496    {
     1497        fStatus = kFileExit;
     1498        //gLog << dbg << fName << ".fStatus=kFileExit;" << endl;
     1499    }
    14961500}
    14971501
  • trunk/MagicSoft/Mars/mbase/MTaskEnv.cc

    r4732 r5307  
    215215{
    216216    if (!IsEnvDefined(env, prefix, print))
    217         return kFALSE;
     217        return fTask ? fTask->ReadEnv(env, prefix, print) : kFALSE;
    218218
    219219    TString task = GetEnvValue(env, prefix, "");
  • trunk/MagicSoft/Mars/mcalib/MCalibrateRelTimes.cc

    r3841 r5307  
    138138Int_t MCalibrateRelTimes::Process()
    139139{
     140    /*
     141     if (fCalibrations->GetNumPixels() != (UInt_t)fSignals->GetSize())
     142     {
     143     // FIXME: MArrivalTime must be of variable size -
     144     //        like MCerPhotEvt - because we must be able
     145     //        to reduce size by zero supression
     146     //        For the moment this check could be done in ReInit...
     147     *fLog << err << "MArrivalTime and MCalibrationCam have different sizes... abort." << endl;
     148     return kFALSE;
     149     }
     150     */
    140151
    141   /*
    142     if (fCalibrations->GetNumPixels() != (UInt_t)fSignals->GetSize())
     152    const UInt_t npix = fSignals->GetSize();
     153
     154    for (UInt_t pixidx=0; pixidx<npix; pixidx++)
    143155    {
    144         // FIXME: MArrivalTime must be of variable size -
    145         //        like MCerPhotEvt - because we must be able
    146         //        to reduce size by zero supression
    147         //        For the moment this check could be done in ReInit...
    148         *fLog << err << "MArrivalTime and MCalibrationCam have different sizes... abort." << endl;
    149         return kFALSE;
    150     }
    151   */
     156        MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCalibrations)[pixidx];
    152157
    153   UInt_t npix = fSignals->GetSize();
     158        if (fBadPixels && (*fBadPixels)[pixidx].IsUnsuitable())
     159            continue;
    154160
    155   Float_t offset    = 0.;
    156   Float_t precision = 0.;
    157  
    158   for (UInt_t pixidx=0; pixidx<npix; pixidx++)
    159     {
     161        const Float_t offset    = pix.GetTimeOffset();
     162        const Float_t precision = pix.GetTimePrecision();
    160163
    161       MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCalibrations)[pixidx];
    162      
    163       if (fBadPixels)
     164        MArrivalTimePix &sig = (*fSignals)[pixidx];
     165
     166        Float_t signal;
     167        Float_t sigerr;
     168
     169        if (sig.IsLoGainUsed())
    164170        {
    165           MBadPixelsPix          &bad = (*fBadPixels)[pixidx];
    166           if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
    167             continue;
     171            signal = sig.GetArrivalTimeLoGain();
     172            sigerr = sig.GetArrivalTimeLoGainError();
    168173        }
    169      
    170       offset     = pix.GetTimeOffset();
    171       precision  = pix.GetTimePrecision();
    172      
    173       MArrivalTimePix &sig =  (*fSignals)[pixidx];
    174      
    175       Float_t signal;
    176       Float_t sigerr;
    177            
    178       if (sig.IsLoGainUsed())
     174        else
    179175        {
    180           signal = sig.GetArrivalTimeLoGain();
    181           sigerr = sig.GetArrivalTimeLoGainError();
     176            signal = sig.GetArrivalTimeHiGain();
     177            sigerr = sig.GetArrivalTimeHiGainError();
    182178        }
    183       else
    184         {
    185           signal = sig.GetArrivalTimeHiGain();
    186           sigerr = sig.GetArrivalTimeHiGainError();
    187         }
    188      
    189       const Float_t time = signal - offset;
    190       Float_t err        = sigerr*sigerr + precision*precision;
    191       if (err > 0)
    192         err = TMath::Sqrt(err);
    193179
    194       fArrivalTime->SetTime(pixidx,time);
    195       fArrivalTime->SetTimeErr(pixidx,err);
     180        const Float_t time = signal - offset;
     181        const Float_t err  = sigerr*sigerr + precision*precision;
     182
     183        fArrivalTime->SetTime(pixidx, time);
     184        fArrivalTime->SetTimeErr(pixidx, err>0 ? TMath::Sqrt(err) : 0);
    196185
    197186    } /* for (UInt_t pixidx=0; pixidx<npix; pixidx++) */
    198  
    199   fArrivalTime->SetReadyToSave();
    200  
    201   return kTRUE;
     187
     188    fArrivalTime->SetReadyToSave();
     189
     190    return kTRUE;
    202191}
  • trunk/MagicSoft/Mars/mhist/MHCamera.cc

    r5298 r5307  
    11591159        const Double_t error = fSumw2.fArray[bin]/GetEntries();
    11601160        const Double_t val   = fArray[bin]/GetEntries();
    1161         rc = TMath::Sqrt(error - val*val);
     1161        rc = val*val>error ? 0 : TMath::Sqrt(error - val*val);
    11621162    }
    11631163    else
    1164     {
    11651164        rc = TH1D::GetBinError(bin);
    1166     }
    11671165
    11681166    return Profile(rc);
  • trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc

    r5298 r5307  
    9494// Sets fRuns to 0, fExtractor to NULL, fDataCheck to kFALSE
    9595//
    96 MJCalibrateSignal::MJCalibrateSignal(const char *name, const char *title)
     96MJCalibrateSignal::MJCalibrateSignal(const char *name, const char *title)
     97    : fIsDataCheck(kFALSE)
    9798{
    9899    fName  = name  ? name  : "MJCalibrateSignal";
     
    170171    cont.Add(&cam);
    171172    return ReadContainer(cont);
     173}
     174
     175// --------------------------------------------------------------------------
     176//
     177// MJCalibration allows to setup several option by a resource file:
     178//   MJCalibration.Display: full, datacheck, normal
     179//   MJCalibration.RelTimeCalibration: yes,no
     180//   MJCalibration.DataCheck: yes,no
     181//   MJCalibration.Debug: yes,no
     182//   MJCalibration.Intensity: yes,no
     183//   MJCalibration.UseBlindPixel: yes,no
     184//   MJCalibration.UsePINDiode: yes,no
     185//   MJCalibration.Geometry: MGeomCamMagic, MGeomCamECO1000
     186//
     187// For more details see the class description and the corresponding Getters
     188//
     189Bool_t MJCalibrateSignal::CheckEnvLocal()
     190{
     191    SetDataCheck(GetEnv("DataCheck", IsDataCheck()));
     192    return kTRUE;
    172193}
    173194
     
    196217
    197218    MDirIter iter;
    198     const Int_t n0 = fSequence.SetupDatRuns(iter, fPathData);
     219    const Int_t n0 = fSequence.SetupDatRuns(iter, fPathData, "D", IsDataCheck());
    199220    const Int_t n1 = fSequence.GetNumDatRuns();
    200221    if (n0==0)
     
    300321    readreal.AddFiles(iter);
    301322
    302     MReadMarsFile readmc("Events");
    303     readmc.DisableAutoScheme();
    304     readmc.AddFiles(iter);
    305 
    306     MRawFileRead readraw(NULL);
    307     readraw.AddFiles(iter);
     323    MReadMarsFile read("Events");
     324    read.DisableAutoScheme();
     325    MRawFileRead rawread(NULL);
     326    if (IsDataCheck())
     327        rawread.AddFiles(iter);
     328    else
     329        read.AddFiles(iter);
    308330
    309331    MGeomApply             apply; // Only necessary to create geometry
     
    413435
    414436    // Now setup main tasklist
    415     switch (filetype)
    416     {
    417     case 1: tlist.AddToList(&readraw);  break;
    418     case 2: tlist.AddToList(&readreal); break;
    419     case 3: tlist.AddToList(&readmc);   break;
    420     }
    421 
    422     tlist.AddToList(&tlist2, "Events");
    423     tlist.AddToList(&pcalc,  "Drive");
     437    tlist.AddToList(IsDataCheck() ? (MTask*)&rawread : (MTask*)&read);
     438    tlist.AddToList(&tlist2, IsDataCheck()?"All":"Events");
     439    if (!IsDataCheck())
     440        tlist.AddToList(&pcalc, "Drive");
    424441    tlist.AddToList(&write);
    425442
  • trunk/MagicSoft/Mars/mmain/MEventDisplay.cc

    r5145 r5307  
    107107//  Constructor.
    108108//
    109 MEventDisplay::MEventDisplay(const char *fname, const char *pname, const char *cname) : MStatusDisplay()
     109MEventDisplay::MEventDisplay(const char *fname, const char *pname, const char *cname) : MStatusDisplay(), fEvtLoop(0)
    110110{
    111111    //
     
    130130    // Readin first event and display it
    131131    //
    132     ReadFirstEvent();
     132    if (fEvtLoop)
     133        ReadFirstEvent();
    133134
    134135    SetNoContextMenu(kFALSE);
     
    141142MEventDisplay::~MEventDisplay()
    142143{
    143     fEvtLoop->PostProcess();
    144     delete fEvtLoop;
     144    if (fEvtLoop)
     145    {
     146        fEvtLoop->PostProcess();
     147        delete fEvtLoop;
     148    }
    145149}
    146150
     
    249253        plist->AddToList(ccam);
    250254
     255    //MArrivalTime *atime = new MArrivalTime;
     256    //plist->AddToList(atime);
     257
    251258    MHEvent *evt01 = new MHEvent(MHEvent::kEvtSignalRaw);
    252259    MHEvent *evt02 = new MHEvent(MHEvent::kEvtSignalRaw);
  • trunk/MagicSoft/Mars/mraw/MRawFileRead.cc

    r5144 r5307  
    103103    : fFileNames(NULL), fNumFile(0), fIn(NULL), fParList(NULL), fInterleave(1)
    104104{
    105     fName  = name  ? name  : "MRawFileRead";
     105    fName  = name  ? name  : "MRead";
    106106    fTitle = title ? title : "Read task to read DAQ binary files";
    107107
     
    122122    if (fIn)
    123123        delete fIn;
     124}
     125
     126Byte_t MRawFileRead::IsFileValid(const char *name)
     127{
     128    ifstream fin(name);
     129    if (!fin)
     130        return 0;
     131
     132    Byte_t c[4];
     133    fin.read((char*)c, 4);
     134    if (!fin)
     135        return 0;
     136
     137    if (c[0]!=0xc0)
     138        return 0;
     139
     140    if (c[1]==0xc0)
     141        return 1;
     142
     143    if (c[1]==0xc1)
     144        return 2;
     145
     146    return 0;
    124147}
    125148
  • trunk/MagicSoft/Mars/mraw/MRawFileRead.h

    r4694 r5307  
    3232    ~MRawFileRead();
    3333
     34    static Byte_t IsFileValid(const char *name);
     35
    3436    void SetInterleave(UInt_t i) { fInterleave = i; }
    3537
  • trunk/MagicSoft/Mars/msignal/MExtractTime.cc

    r5280 r5307  
    148148Bool_t MExtractTime::ReInit(MParList *pList)
    149149{
    150  
    151   MExtractor::ReInit(pList);
    152 
    153   fArrTime->SetUsedFADCSlices(fHiGainFirst, fHiGainLast+fHiLoLast, fLoGainFirst, fLoGainLast);
    154 
    155   return kTRUE;
    156 }
    157 
    158 
     150    if (!MExtractor::ReInit(pList))
     151        return kFALSE;
     152
     153    fArrTime->SetUsedFADCSlices(fHiGainFirst, fHiGainLast+fHiLoLast, fLoGainFirst, fLoGainLast);
     154
     155    return kTRUE;
     156}
    159157
    160158void MExtractTime::FindTimeHiGain(Byte_t *firstused, Float_t &time, Float_t &dtime,
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndCharge.cc

    r5242 r5307  
    7474
    7575const Float_t MExtractTimeAndCharge::fgLoGainStartShift = -2.8;
     76
    7677// --------------------------------------------------------------------------
    7778//
     
    8384MExtractTimeAndCharge::MExtractTimeAndCharge(const char *name, const char *title)
    8485{
    85 
    86   fName  = name  ? name  : "MExtractTimeAndCharge";
    87   fTitle = title ? title : "Base class for signal and time extractors";
    88  
    89   SetLoGainStartShift();
     86    fName  = name  ? name  : "MExtractTimeAndCharge";
     87    fTitle = title ? title : "Base class for signal and time extractors";
     88
     89    SetLoGainStartShift();
    9090}
    9191
     
    105105Int_t MExtractTimeAndCharge::PreProcess(MParList *pList)
    106106{
    107 
    108   if (!MExtractTime::PreProcess(pList))
    109     return kFALSE;
    110  
    111   fSignals = (MExtractedSignalCam*)pList->FindCreateObj(AddSerialNumber("MExtractedSignalCam"));
    112   if (!fSignals)
    113     {
    114       *fLog << err << GetDescriptor()
    115             << ": Could not find nor create MExtractedSignalCam,... aborting." << endl;
    116       return kFALSE;
    117     }
    118  
    119  
    120   return kTRUE;
     107    if (!MExtractTime::PreProcess(pList))
     108        return kFALSE;
     109
     110    fSignals = (MExtractedSignalCam*)pList->FindCreateObj(AddSerialNumber("MExtractedSignalCam"));
     111    if (!fSignals)
     112        return kFALSE;
     113
     114    return kTRUE;
    121115}
    122116
     
    132126Bool_t MExtractTimeAndCharge::ReInit(MParList *pList)
    133127{
    134  
    135   MExtractTime::ReInit(pList);
    136 
    137   fSignals->SetUsedFADCSlices(fHiGainFirst, fHiGainLast+fHiLoLast, fNumHiGainSamples,
    138                               fLoGainFirst, fLoGainLast, fNumLoGainSamples);
    139 
    140   *fLog << dec << endl;
    141   *fLog << inf << GetDescriptor() << ": Taking " << fNumHiGainSamples
     128    if (!MExtractTime::ReInit(pList))
     129        return kFALSE;
     130
     131    fSignals->SetUsedFADCSlices(fHiGainFirst, fHiGainLast+fHiLoLast, fNumHiGainSamples,
     132                                fLoGainFirst, fLoGainLast, fNumLoGainSamples);
     133
     134    *fLog << dec << endl;
     135    *fLog << inf << "Taking " << fNumHiGainSamples
    142136        << " HiGain samples from slice " << (Int_t)fHiGainFirst
    143137        << " to " << (Int_t)(fHiGainLast+fHiLoLast) << " incl" << endl;
    144   *fLog << inf << GetDescriptor() << ": Taking " << fNumLoGainSamples
     138    *fLog << inf << "Taking " << fNumLoGainSamples
    145139        << " LoGain samples from slice " << (Int_t)fLoGainFirst
    146140        << " to " << (Int_t)fLoGainLast << " incl" << endl;
    147141
    148   return kTRUE;
     142    return kTRUE;
    149143}
    150144
     
    258252    return MExtractTime::ReadEnv(env, prefix, print) ? kTRUE : rc;
    259253}
     254
     255void MExtractTimeAndCharge::Print(Option_t *o) const
     256{
     257    *fLog << all;
     258    if (IsA()==MExtractTimeAndCharge::Class())
     259        *fLog << GetDescriptor() << ":" << endl;
     260
     261    *fLog << " LoGainStartShift: " << fLoGainStartShift << endl;
     262    MExtractTime::Print(o);
     263}
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndCharge.h

    r5242 r5307  
    1313  static const Float_t fgLoGainStartShift; // Default for fLoGainStartShift (now set to: -2.8)
    1414 
    15   Byte_t  fLoGainFirstSave;        // Temporary variable to store the original position of low-gain start slice
     15  Byte_t  fLoGainFirstSave;       //! Temporary variable to store the original position of low-gain start slice
    1616  Float_t fLoGainStartShift;      // Shift to start searching the low-gain signal obtained from the high-gain times.
    1717 
     
    3636 
    3737  void SetLoGainStartShift( const Float_t f=fgLoGainStartShift )  { fLoGainStartShift = f + fOffsetLoGain;  }
     38
     39  void Print(Option_t *o) const;
    3840 
    39   ClassDef(MExtractTimeAndCharge, 0)   // Time And Charge Extractor Base Class
     41  ClassDef(MExtractTimeAndCharge, 1)   // Time And Charge Extractor Base Class
    4042};
    4143
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.cc

    r5298 r5307  
    940940  return kTRUE;
    941941}
     942
     943void MExtractTimeAndChargeDigitalFilter::Print(Option_t *o) const
     944{
     945    *fLog << all;
     946    *fLog << GetDescriptor() << ":" << endl;
     947
     948    *fLog << " Time Shift HiGain:  " << fTimeShiftHiGain << endl;
     949    *fLog << " Time Shift LoGain:  " << fTimeShiftLoGain << endl;
     950    *fLog << " Window Size HiGain: " << fWindowSizeHiGain << endl;
     951    *fLog << " Window Size LoGain: " << fWindowSizeLoGain << endl;
     952    *fLog << " Binning Res HiGain: " << fBinningResolutionHiGain << endl;
     953    *fLog << " Binning Res LoGain: " << fBinningResolutionHiGain << endl;
     954 
     955    MExtractTimeAndCharge::Print(o);
     956}
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.h

    r5298 r5307  
    8686    fSignalStartBinLoGain = sl;
    8787  }
     88
     89  void Print(Option_t *o) const;
    8890 
    8991  ClassDef(MExtractTimeAndChargeDigitalFilter, 1)   // Hendrik's digital filter
Note: See TracChangeset for help on using the changeset viewer.