Changeset 2728


Ignore:
Timestamp:
12/20/03 13:46:17 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2727 r2728  
    55                                                 -*-*- END OF LINE -*-*-
    66
     7 2003/12/20: Thomas Bretz
     8
     9   * Makefile:
     10     - added an option to statically link the programs (for
     11       debugging)
     12       
     13   * merpp.cc, readdaq.cc, readraw.cc:
     14     - small changes to the command line options
     15       (the aim is a generalization)
     16
     17   * manalysis/MCalibrate.[h,cc]:
     18     - removed leading '//' from class description
     19     - removed usage of MGeomCam (it is obsolete here)
     20     - small changes to make the output fit the 'standard'
     21     - take the number of pixels from the containers, added a
     22       consistency check
     23     - added many small comment about future development
     24     - added some const-qualifiers
     25     - removed the 'unused/empty' pixels. They are obsolete and not
     26       wanted at all.
     27     - changed pixid to pixidx
     28
     29   * manalysis/MCalibrationPix.h:
     30     - sorted member functions
     31     - added some const qualifiers
     32     - added many small comment about future development
     33
     34   * manalysis/MExtractSignal.cc:
     35     - removed arguments from constructor
     36     - added corresponding member functions
     37       + the convetion is to have only vital arguments in the
     38         construtor and member functions to change the default
     39     - removed obsolete PostProcess
     40     
     41   * manalysis/MExtractedSignalCam.h, manalysis/MExtractedSignalPix.h:
     42     - added corresponding member functions
     43   
     44   * mbase/MArgs.[h,cc]:
     45     - added some comments
     46     - added options/arguments to Print
     47     - added GetNumOptions
     48     - added GetNumEntries
     49     - added HasOnly
     50     - added HasOnlyAndRemove
     51     
     52   * mbase/MEvtLoop.[h,cc]:
     53     - removed leading '//' from class description
     54     - replaced INT_MAX by kMaxUInt
     55     - changed meaning of eventloop argument:
     56       now 0 means all-events instead of -1
     57     - forward tlist-name from Eventloop to PreProcess
     58   
     59   * mbase/MTime.[h,cc]:
     60     - added UpdMagicTime
     61
     62   * mfilter/MFEventSelector2.cc:
     63     - replaced INT_MAX by kMaxUInt
     64     
     65   * mmain/MEventDisplay.[h,cc]:
     66     - make use of MEvtLoop::GetTaskList()
     67     - removed GetReader
     68     
     69   * mmontecarlo/MMcEnergyEst.cc:
     70     - removed leading '//' from class description
     71     
     72   * mranforest/MRanTree.cc:
     73     - removed leading '//' from class description
     74     - replaced 1e20 by FLT_MAX
     75   
     76   * mraw/MRawEvtHeader.[h,cc], mraw/MRawFileRead.cc,
     77     mraw/MRawRead.[h,cc], mraw/MRawRunHeader.cc,
     78     mraw/MRawSocketRead.cc:
     79     - added decoding of time from event header - UNTESTED!
     80     
     81   * mreport/MReportRun.h:
     82     - set class verseion to 0 -- not ment for writing at the
     83       moment
     84
     85
     86
    787 2003/12/19: Markus Gaug, Michele Doro
    888
    9    * manalysis/MExtractSignal.[h,cc]
    10    * manalysis/MCalibrate.[h,cc]
    11    * manalysis/MCalibrationCalc.[h,cc]
    12    * manalysis/MCalibrationPix.[h,cc]
     89   * manalysis/MExtractSignal.[h,cc], manalysis/MCalibrate.[h,cc],
     90     manalysis/MCalibrationCalc.[h,cc], manalysis/MCalibrationPix.[h,cc]:
    1391     - Treatment of the conversion factors between HI Gain and Lo Gain
    1492       is now done in the MCalibrationPix.
  • trunk/MagicSoft/Mars/Makefile

    r2704 r2728  
    2121
    2222#PROGRAMS = readraw merpp mars test mona status
    23 PROGRAMS = readraw readdaq merpp star status mars mona
     23PROGRAMS = readdaq readraw merpp star status mars mona
    2424SOLIB    = libmars.so
    2525CINT     = M
     
    6363MRPROPERS = $(SUBDIRS:=.mrproper)
    6464CLEANERS  = $(SUBDIRS:=.clean)
     65LIBS      = $(SOLIB)
    6566
    6667#------------------------------------------------------------------------------
     
    7273SRCS    = $(SRCFILES)
    7374HEADERS = $(SRCFILES:.cc=.h)
    74 OBJS    = $(SRCFILES:.cc=.o)
     75OBJS    = $(SRCFILES:.cc=.o) MCint.o
    7576
    7677############################################################
     78all: rmlib $(SOLIB) $(PROGRAMS)
     79        @echo " Done. "
     80        @echo " "
    7781
    78 all: rmlib $(PROGRAMS) $(SOLIB)
     82static: LIBS=$(SUBDIRS:=/*.o) $(OBJS)
     83static: rmlib $(LIBRARIES) $(PROGRAMS)
    7984        @echo " Done. "
    8085        @echo " "
     
    8388include Makefile.depend
    8489
     90#
    8591# Use $(CXX) -v ... for a more verbose output
    8692#
    87 #
    88 #$(MARS_LIB)
    89 $(SOLIB): $(LIBRARIES) $(OBJS) $(HEADERS) MCint.o
     93# ROOTGLIBS must be there - why? How can I link the libraries?
     94$(SOLIB): $(LIBRARIES) $(OBJS) $(HEADERS)
    9095        @echo " Linking $(SOLIB) ..."
    91         $(CXX) $(DYNLIB) $(CXXFLAGS) $(OBJS) MCint.o $(SUBDIRS:=/*.o) $(ROOTGLIBS) -o $@
     96        $(CXX) $(CXXFLAGS) $(DYNLIB) $(OBJS) $(SUBDIRS:=/*.o) $(ROOTGLIBS) -o $@
     97#       $(CXX) $(CXXFLAGS) $(DYNLIB) $(OBJS) -Wl,--export-dynamic -Llib $(LIBRARIES:%.a=-l%) -o $@
    9298
    93 $(PROGRAMS): $(SOLIB) $(PROGRAMS:=.o)
     99$(PROGRAMS): $(LIBS) $(PROGRAMS:=.o)
    94100        @echo " Linking $@ ..."
    95         $(CXX) $(CXXFLAGS) $(ROOTGLIBS) $(SOLIB) $@.o $(MARS_LIB) -o $@
    96 
    97 #
    98 # We could link mars.so instead of all libraries. This would need
    99 # some MBs less space on the HD. But this means, that the Shared
    100 # Library Path in your system must be set properly to be able to start
    101 # 'mars'
    102 #
    103 #$(PROGRAMS): $(LIBRARIES) $(OBJS) $(HEADERS) $(SOLIB) MCint.o $(PROGRAMS:=.o)
    104 #       @echo " Linking $@ ..."
    105 #       $(CXX) $(CXXFLAGS) $@.o $(OBJS) lib/$(SOLIB)  MCint.o $(ROOTGLIBS) -o $@
    106 
    107 #
    108 # For later use
    109 #
    110 #$(PROGRAMS): $(LIBRARIES) $(OBJS) $(HEADERS) MCint.o $(PROGRAMS:=.o)
    111 #       @echo " Linking $@ ..."
    112 #       $(CXX) $(CXXFLAGS) $@.o $(OBJS) $(MARS_LIB) -L/usr/X11R6/lib -lX11 -lXpm MCint.o $(ROOTGLIBS) -o $@
    113 #
    114 #$(SOLIB): $(LIBRARIES) $(OBJS) $(HEADERS) MCint.o
    115 #       @echo " Linking $(SOLIB) ..."
    116 #       $(CXX) -shared $(CXXFLAGS) $(SUBDIRS:=/*.o) $(ROOTGLIBS) -o $@
    117 #       mv mars.so lib
     101        $(CXX) $(CXXFLAGS) $(ROOTGLIBS) $(LIBS) $@.o $(MARS_LIB) -o $@
    118102
    119103$(LIBRARIES):
    120104        @echo " Creating lib$@:"
    121105        (cd $*; make; cd ..; mv $*/$@ lib/lib$@)
    122 #       (cd $(@:lib/lib%.a=%); make; cd ..; mv $(@:lib/lib%.a=%)/$(@:lib/lib%=%) $@)
    123106
    124107$(MRPROPERS):
  • trunk/MagicSoft/Mars/manalysis/MCalibrate.cc

    r2726 r2728  
    2424
    2525//////////////////////////////////////////////////////////////////////////////
    26 //                                                                          //
    27 //   MCalibrate                                                             //
    28 //                                                                          //
    29 //   This task takes the integrated charge from MExtractedSignal and apply  //
    30 //   the calibration constants from MCalibraitionCam to the charge. Then    //
    31 //   stores number of photons obtained in MCerPhotEvt.                      //
    32 //                                                                          //
    33 //   Input Containers:                                                      //
    34 //                                                                          //     
    35 //   MGeomCam                                                               //
    36 //   MExtractedSingal                                                       //
    37 //   MCalibrationCam                                                        //
    38 //                                                                          //
    39 //   Output Containers:                                                     //
    40 //                                                                          //
    41 //   MCerPhotEvt                                                            //
    42 //                                                                          //
     26//
     27//   MCalibrate
     28//
     29//   This task takes the integrated charge from MExtractedSignal and apply
     30//   the calibration constants from MCalibraitionCam to the charge. Then
     31//   stores number of photons obtained in MCerPhotEvt.
     32//
     33//   Input Containers:
     34//    MExtractedSingal
     35//    MCalibrationCam
     36//
     37//   Output Containers:
     38//    MCerPhotEvt
     39//
    4340//////////////////////////////////////////////////////////////////////////////
    44 
    4541#include "MCalibrate.h"
    4642#include "MCalibrationConfig.h"
     
    7470MCalibrate::MCalibrate(const char *name, const char *title)
    7571{
    76 
    7772    fName  = name  ? name  : "MCalibrate";
    7873    fTitle = title ? title : "Task to calculate the number of photons in one event";
    79 
    8074}
    8175
     
    9488Int_t MCalibrate::PreProcess(MParList *pList)
    9589{
    96 
    97     fGeomCam = (MGeomCam*)pList->FindObject("MGeomCam");
    98     if (!fGeomCam)
    99       {
    100         *fLog << err << dbginf << "MGeomCam not found ... aborting." << endl;       
    101         return kFALSE;
    102       }
    103 
    10490    fSignals = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam");
    10591    if (!fSignals)
    106       {
    107         *fLog << err << dbginf << "MExtractedSignalCam not found ... aborting" << endl;
     92    {
     93        *fLog << err << "MExtractedSignalCam not found ... aborting" << endl;
    10894        return kFALSE;
    109       }
     95    }
    11096
    11197    fCalibrations = (MCalibrationCam*)pList->FindObject("MCalibrationCam");
    11298    if (!fCalibrations)
    113       {
    114         *fLog << err << dbginf << "MCalibrationCam not found ... aborting." << endl;       
     99    {
     100        *fLog << err << "MCalibrationCam not found ... aborting." << endl;
    115101        return kFALSE;
    116       }
     102    }
    117103
    118104    fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt");
    119105    if (!fCerPhotEvt)
    120       {
    121         *fLog << err << dbginf << "Cannot create MCerPhotEvt ... aborting" << endl;
    122106        return kFALSE;
    123       }
    124107   
    125108    return kTRUE;
    126109}
    127 
    128110
    129111// --------------------------------------------------------------------------
     
    132114Int_t MCalibrate::Process()
    133115{
    134     UInt_t imaxnumpix = fGeomCam->GetNumPixels();
     116    if (fCalibrations->GetNumPixels() != (UInt_t)fSignals->GetSize())
     117    {
     118        // FIXME: MExtractedSignal must be of variable size -
     119        //        like MCerPhotEvt - because we must be able
     120        //        to reduce size by zero supression
     121        //        For the moment this check could be done in ReInit...
     122        *fLog << err << "MExtractedSignal and MCalibrationCam have different sizes... abort." << endl;
     123        return kFALSE;
     124    }
     125
     126    const UInt_t imaxnumpix = fSignals->GetSize();
    135127   
    136     for (UInt_t pixid = 0; pixid < imaxnumpix; pixid++)
     128    for (UInt_t pixidx=0; pixidx<imaxnumpix; pixidx++)
    137129    {
    138         MCalibrationPix &pix = (*fCalibrations)[pixid];
     130        const MCalibrationPix &pix = (*fCalibrations)[pixidx];
    139131
     132        if (!pix.IsBlindPixelMethodValid())
     133            continue;
    140134
    141         if (pix.IsBlindPixelMethodValid())
    142         {
    143             MExtractedSignalPix &sig =  (*fSignals)[pixid];
     135        MExtractedSignalPix &sig =  (*fSignals)[pixidx];
    144136
    145             Float_t signal;
    146             Float_t signalErr = 0.;
     137        Float_t signal;
     138        Float_t signalErr = 0.;
    147139
    148             if (sig.IsLoGainUsed())
    149               {
    150                 signal    = sig.GetExtractedSignalLoGain()*pix.GetConversionHiLo();
    151                 signalErr = signal*pix.GetConversionHiLoError();
    152               }
    153             else
    154               {
    155                 signal = sig.GetExtractedSignalHiGain();
    156               }
    157            
    158             //      Float_t calibrationConvertionFactor = pix.GetMeanConversionFFactorMethod();
    159             Float_t calibrationConversionFactor      = pix.GetMeanConversionBlindPixelMethod();
    160             Float_t calibrationConversionFactorError = pix.GetErrorConversionBlindPixelMethod();
     140        if (sig.IsLoGainUsed())
     141        {
     142            signal    = sig.GetExtractedSignalLoGain()*pix.GetConversionHiLo();
     143            signalErr = signal*pix.GetConversionHiLoError();
     144        }
     145        else
     146        {
     147            signal = sig.GetExtractedSignalHiGain();
     148        }
    161149
    162             Float_t nphot    = signal*calibrationConversionFactor;
    163             Float_t nphotErr = signal*calibrationConversionFactorError
    164                               *signal*calibrationConversionFactorError;
    165             nphotErr        += signalErr*calibrationConversionFactor
    166                               *signalErr*calibrationConversionFactor;
     150        //      Float_t calibrationConvertionFactor = pix.GetMeanConversionFFactorMethod();
     151        const Float_t calibrationConversionFactor      = pix.GetMeanConversionBlindPixelMethod();
     152        const Float_t calibrationConversionFactorError = pix.GetErrorConversionBlindPixelMethod();
    167153
    168             nphotErr  = TMath::Sqrt(nphotErr);
     154        const Float_t nphot = signal*calibrationConversionFactor;
     155        Float_t nphotErr    = signal*calibrationConversionFactorError
     156                             *signal*calibrationConversionFactorError;
     157        nphotErr += signalErr*calibrationConversionFactor
     158                   *signalErr*calibrationConversionFactor;
    169159
    170             fCerPhotEvt->AddPixel(pixid, nphot, nphotErr);
    171         }
    172         else
    173           {
    174             fCerPhotEvt->AddPixel(pixid, 0., 0.);
    175             (*fCerPhotEvt)[pixid].SetPixelUnused();
    176           }
     160        nphotErr  = TMath::Sqrt(nphotErr);
     161
     162        fCerPhotEvt->AddPixel(pixidx, nphot, nphotErr);
    177163    }
    178164
     
    182168    return kTRUE;
    183169}
    184 
  • trunk/MagicSoft/Mars/manalysis/MCalibrate.h

    r2725 r2728  
    2525class MCalibrate : public MTask
    2626{
    27 
    28     MGeomCam            *fGeomCam;      // Geometry of the camera
     27private:
    2928    MCalibrationCam     *fCalibrations; // Calibration constants
    3029    MExtractedSignalCam *fSignals;      // Integrated charge in FADCs counts
     
    4039    MCalibrate(const char *name=NULL, const char *title=NULL);
    4140
    42     void SetConversionHiLo(Float_t conv)         { fConversionHiLo = conv; }
     41    void SetConversionHiLo(Float_t conv) { fConversionHiLo = conv; }
    4342   
    4443    ClassDef(MCalibrate, 0)   // Task to calculate cerenkov photons using calibration constants
  • trunk/MagicSoft/Mars/manalysis/MCalibrationPix.h

    r2725 r2728  
    6868  void Clear(Option_t *o="");
    6969
    70   Float_t GetCharge()         const    { return fCharge;         }
    71   Float_t GetRSigmaSquare()   const    { return fRSigmaSquare;   }
     70  // Getter
     71  Bool_t IsFitValid()              const { return fFitValid;  }
     72  Bool_t IsFitted()                const { return fFitted;  }
     73  Bool_t IsBlindPixelMethodValid() const { return fBlindPixelMethodValid;  }
     74  Bool_t IsFFactorMethodValid()    const { return fFFactorMethodValid;  }
     75  Bool_t IsPINDiodeMethodValid()   const { return fPINDiodeMethodValid;  }
     76
     77  Float_t GetCharge()              const { return fCharge;         }
     78  Float_t GetRSigmaSquare()        const { return fRSigmaSquare;   }
    7279   
    73   Float_t GetErrCharge()      const    { return fErrCharge;      }
    74   Float_t GetChargeProb()     const    { return fChargeProb;     }   
     80  Float_t GetErrCharge()           const { return fErrCharge;      }
     81  Float_t GetChargeProb()          const { return fChargeProb;     }   
    7582 
    76   Float_t GetSigmaCharge()    const    { return fSigmaCharge;    }
    77   Float_t GetErrSigmaCharge() const    { return fErrSigmaCharge; }
    78   Float_t GetTime()           const    { return fTime;           }
    79   Float_t GetSigmaTime()      const    { return fSigmaTime;      }
    80   Float_t GetTimeChiSquare()  const    { return fTimeChiSquare;  }   
    81  
    82   Float_t GetPed()            const    { return fPed;            }
    83   Float_t GetPedRms()         const    { return fPedRms;         }   
     83  Float_t GetSigmaCharge()         const { return fSigmaCharge;    }
     84  Float_t GetErrSigmaCharge()      const { return fErrSigmaCharge; }
     85  Float_t GetTime()                const { return fTime;           }
     86  Float_t GetSigmaTime()           const { return fSigmaTime;      }
     87  Float_t GetTimeChiSquare()       const { return fTimeChiSquare;  }   
    8488
     89  Float_t GetConversionHiLo()                 const  { return fConversionHiLo;        }
     90  Float_t GetConversionHiLoError()            const  { return fConversionHiLoError;   }
     91
     92  Float_t GetMeanConversionBlindPixelMethod()  const { return fConversionBlindPixelMethod ; }
     93  Float_t GetErrorConversionBlindPixelMethod() const { return fConversionErrorBlindPixelMethod ; }
     94  Float_t GetSigmaConversionBlindPixelMethod() const { return fConversionSigmaBlindPixelMethod ; }
     95
     96  Float_t GetMeanConversionFFactorMethod()     const { return fConversionFFactorMethod ;       }
     97  Float_t GetErrorConversionFFactorMethod()    const { return fConversionErrorFFactorMethod ;  }
     98  Float_t GetSigmaConversionFFactorMethod()    const { return fConversionSigmaFFactorMethod ;  }
     99
     100  Float_t GetPheFFactorMethod()                const { return fPheFFactorMethod;               }
     101  Float_t GetPheFFactorMethodError()           const { return fPheFFactorMethodError;          }
     102
     103  Float_t GetMeanConversionPINDiodeMethod()    const { return fConversionPINDiodeMethod ;      }
     104  Float_t GetErrorConversionPINDiodeMethod()   const { return fConversionErrorPINDiodeMethod ; }
     105  Float_t GetSigmaConversionPINDiodeMethod()   const { return fConversionSigmaPINDiodeMethod ; }
     106
     107  // FIXME: Remove this from stored data members
     108  Float_t GetPed()    const { return fPed;    }
     109  Float_t GetPedRms() const { return fPedRms; }
     110
     111  // Setter
    85112  void SetPedestal(Float_t ped, Float_t pedrms);
    86   void SetHiGainSaturation()                               { fHiGainSaturation = kTRUE; fHist->SetUseLoGain(); }
     113  void SetHiGainSaturation()             { fHiGainSaturation = kTRUE; fHist->SetUseLoGain(); }
    87114
    88   void ApplyLoGainConversion();
     115  void SetConversionHiLo(Float_t c)      { fConversionHiLo      = c;    }
     116  void SetConversionHiLoError(Float_t e) { fConversionHiLoError = e;    }
    89117
    90   void SetConversionHiLo(Float_t c)                       { fConversionHiLo      = c;    }
    91   void SetConversionHiLoError(Float_t e)                    { fConversionHiLoError = e;    }
    92 
    93   Float_t GetConversionHiLo()                       { return fConversionHiLo;        }
    94   Float_t GetConversionHiLoError()                  { return fConversionHiLoError;   }
    95  
    96   void SetConversionFFactorMethod(Float_t c, Float_t err, Float_t sig)     
    97                                                     {
    98                                                       fConversionFFactorMethod = c;
    99                                                       fConversionErrorFFactorMethod = err;
    100                                                       fConversionSigmaFFactorMethod = sig;
    101                                                     }
    102   void SetConversionBlindPixelMethod(Float_t c, Float_t err, Float_t sig)     
    103                                                     {
    104                                                       fConversionBlindPixelMethod = c;
    105                                                       fConversionErrorBlindPixelMethod = err;
    106                                                       fConversionSigmaBlindPixelMethod = sig;
    107                                                     }
     118  void SetConversionFFactorMethod(Float_t c, Float_t err, Float_t sig)
     119  {
     120      fConversionFFactorMethod = c;
     121      fConversionErrorFFactorMethod = err;
     122      fConversionSigmaFFactorMethod = sig;
     123  }
     124  void SetConversionBlindPixelMethod(Float_t c, Float_t err, Float_t sig)
     125  {
     126      fConversionBlindPixelMethod = c;
     127      fConversionErrorBlindPixelMethod = err;
     128      fConversionSigmaBlindPixelMethod = sig;
     129  }
    108130
    109131  void SetConversionPINDiodeMethod(Float_t c, Float_t err, Float_t sig)
    110                                                     {
    111                                                       fConversionPINDiodeMethod = c ;
    112                                                       fConversionErrorPINDiodeMethod = err;
    113                                                       fConversionSigmaPINDiodeMethod = sig;
    114                                                     }
     132  {
     133      fConversionPINDiodeMethod = c ;
     134      fConversionErrorPINDiodeMethod = err;
     135      fConversionSigmaPINDiodeMethod = sig;
     136  }
    115137
    116   Float_t GetMeanConversionBlindPixelMethod()   const  { return fConversionBlindPixelMethod ; }
    117   Float_t GetErrorConversionBlindPixelMethod()  const  { return fConversionErrorBlindPixelMethod ; }
    118   Float_t GetSigmaConversionBlindPixelMethod()  const  { return fConversionSigmaBlindPixelMethod ; }
     138  void SetFitValid()                            { fFitValid = kTRUE;  }
     139  void SetFitted()                              { fFitted = kTRUE;  }
     140  void SetBlindPixelMethodValid(Bool_t b=kTRUE) { fBlindPixelMethodValid = b;  }
     141  void SetFFactorMethodValid(Bool_t b=kTRUE)    { fFFactorMethodValid = b;  }
     142  void SetPINDiodeMethodValid(Bool_t b=kTRUE)   { fPINDiodeMethodValid = b;  }
    119143
    120   Float_t GetMeanConversionFFactorMethod()      const  { return fConversionFFactorMethod ;       }
    121   Float_t GetErrorConversionFFactorMethod()     const  { return fConversionErrorFFactorMethod ;  }
    122   Float_t GetSigmaConversionFFactorMethod()     const  { return fConversionSigmaFFactorMethod ;  }
    123 
    124   Float_t GetPheFFactorMethod()                 const  { return fPheFFactorMethod;               }
    125   Float_t GetPheFFactorMethodError()            const  { return fPheFFactorMethodError;          }   
    126  
    127   Float_t GetMeanConversionPINDiodeMethod()     const  { return fConversionPINDiodeMethod ;      }
    128   Float_t GetErrorConversionPINDiodeMethod()    const  { return fConversionErrorPINDiodeMethod ; }
    129   Float_t GetSigmaConversionPINDiodeMethod()    const  { return fConversionSigmaPINDiodeMethod ; }
     144  // Unknown
     145  void   ApplyLoGainConversion();
    130146
    131147  void   SetChargesInGraph(Float_t qhi,Float_t qlo) { fHist->SetPointInGraph(qhi,qlo); }
     
    139155  Bool_t FillRChargevsTimeLoGain(Float_t rq, Int_t t)  { return fHist->FillChargevsNLoGain(rq,t); }   
    140156 
    141   Bool_t IsFitValid()                                  { return fFitValid;  }
    142   Bool_t IsFitted()                                    { return fFitted;  }
    143   Bool_t IsBlindPixelMethodValid()                     { return fBlindPixelMethodValid;  }
    144   Bool_t IsFFactorMethodValid()                        { return fFFactorMethodValid;  }
    145   Bool_t IsPINDiodeMethodValid()                       { return fPINDiodeMethodValid;  }
    146  
    147   void   SetFitValid()                                     { fFitValid = kTRUE;  }
    148   void   SetFitted()                                      { fFitted = kTRUE;  }
    149   void   SetBlindPixelMethodValid(Bool_t b=kTRUE)               { fBlindPixelMethodValid = b;  }
    150   void   SetFFactorMethodValid(Bool_t b=kTRUE)                 { fFFactorMethodValid = b;  }
    151   void   SetPINDiodeMethodValid(Bool_t b=kTRUE)                { fPINDiodeMethodValid = b;  }
    152  
     157  // FIXME: Not necessary -> pixidx (not id anyhow!) == index in array!
     158  //        Only needed n histograms which have to move to an MH-class anyhow!
    153159  Int_t  GetPixId()                              const  { return fPixId;   }
    154160  void   DefinePixId(Int_t i);
  • trunk/MagicSoft/Mars/manalysis/MExtractSignal.cc

    r2725 r2728  
    5656// Default constructor.
    5757//
    58 MExtractSignal::MExtractSignal(const Byte_t first, const Byte_t last, const Byte_t logainshift,
     58MExtractSignal::MExtractSignal(/*const Byte_t first, const Byte_t last, const Byte_t logainshift,*/
    5959                    const char *name, const char *title)
    60   : fNumHiGainSamples(last-first+1), fNumLoGainSamples(last-first+1),
     60  : /*fNumHiGainSamples(last-first+1), fNumLoGainSamples(last-first+1),*/
    6161    fSaturationLimit(254)
    6262{
     
    6767    AddToBranchList("MRawEvtData.*");
    6868
     69    SetRange();
     70    /*
     71     fFirst       = first;
     72     fLoGainFirst = first+logainshift;
     73
     74     fSqrtHiGainSamples = TMath::Sqrt((Float_t)fNumHiGainSamples);
     75     fSqrtLoGainSamples = TMath::Sqrt((Float_t)fNumLoGainSamples);
     76     */
     77}
     78
     79void MExtractSignal::SetRange(Byte_t first, Byte_t last, Byte_t logainshift)
     80{
     81    fNumHiGainSamples = last-first+1;
     82    fNumLoGainSamples = last-first+1;
     83
    6984    fFirst       = first;
    7085    fLoGainFirst = first+logainshift;
    7186
    72     fSqrtHiGainSamples = TMath::Sqrt((Float_t)fNumHiGainSamples); 
    73     fSqrtLoGainSamples = TMath::Sqrt((Float_t)fNumLoGainSamples); 
     87    fSqrtHiGainSamples = TMath::Sqrt((Float_t)fNumHiGainSamples);
     88    fSqrtLoGainSamples = TMath::Sqrt((Float_t)fNumLoGainSamples);
    7489}
    7590
     
    87102Int_t MExtractSignal::PreProcess(MParList *pList)
    88103{
    89 
    90104    fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
    91105    if (!fRawEvt)
    92106    {
    93         *fLog << dbginf << "MRawEvtData not found... aborting." << endl;
     107        *fLog << err << "MRawEvtData not found... aborting." << endl;
    94108        return kFALSE;
    95109    }
     
    103117    if (!fPedestals)
    104118      {
    105         *fLog << err << dbginf << "Cannot find MPedestalCam ... aborting" << endl;
     119        *fLog << err << "MPedestalCam not found... aborting" << endl;
    106120        return kFALSE;
    107121      }
     
    118132Bool_t MExtractSignal::ReInit(MParList *pList )
    119133{
    120  
    121 
    122134    MGeomCam *cam = (MGeomCam*)pList->FindObject(AddSerialNumber("MGeomCam"));
    123135    if (!cam)
     
    127139    }
    128140
     141    // FIXME: This solution may change in the future, MExtractedSignal
     142    //        must be similar to MCerPhotEvt not to MPedestalCam
     143    //        (Have to think about the mean size of both solutions)
    129144    fSignals->InitSize(cam->GetNumPixels());   
    130145
    131 
    132     fSignals->SetNumUsedFADCSlices(fNumHiGainSamples,fFirst,fFirst+fNumHiGainSamples-1,
    133                                    fNumLoGainSamples,fFirst,fFirst+fNumLoGainSamples-1);
     146    fSignals->SetNumUsedFADCSlices(fNumHiGainSamples, fFirst, fFirst+fNumHiGainSamples-1,
     147                                   fNumLoGainSamples, fFirst, fFirst+fNumLoGainSamples-1);
    134148
    135149    return kTRUE;
     
    144158Int_t MExtractSignal::Process()
    145159{
    146 
    147160    MRawEvtPixelIter pixel(fRawEvt);
    148161    fSignals->Clear();
    149162
    150163    while (pixel.Next())
    151       {
    152 
     164    {
    153165        UShort_t satHi = 0;
    154166        UShort_t satLo = 0;
     
    219231                               );
    220232
    221         pix.SetGainSaturation((satHi),satHi,satLo);
    222 
     233        pix.SetGainSaturation(satHi, satHi, satLo);
     234
     235        // FIXME: Arrival time has to be stored in MArrivalTime!
    223236        if (satHi)
    224237          pix.SetArrivalTimes((Float_t)(midlo+fFirst),0.,0.);
     
    233246    return kTRUE;
    234247}
    235 
    236 Int_t MExtractSignal::PostProcess()
    237 {
    238 
    239   return kTRUE;
    240 
    241 }
  • trunk/MagicSoft/Mars/manalysis/MExtractedSignalCam.h

    r2699 r2728  
    77
    88class TClonesArray;
    9 
    10 class MGeomCam;
    119class MExtractedSignalPix;
    1210
     
    1614    TClonesArray *fArray; // FIXME: Change TClonesArray away from a pointer?
    1715
     16    // FIXME: Is it necessary to store this information for each event?
    1817    Byte_t fNumUsedHiGainFADCSlices;
    1918    Byte_t fNumUsedLoGainFADCSlices;
     
    2423    Byte_t fLastUsedSliceHiGain;
    2524    Byte_t fLastUsedSliceLoGain;
    26 
    2725
    2826public:
     
    4745
    4846    void   SetNumUsedFADCSlices(Byte_t numh, Byte_t firsth, Byte_t lasth,
    49                         Byte_t numl, Byte_t firstl, Byte_t lastl)   
    50                                            {
    51                                              fNumUsedHiGainFADCSlices = numh;
    52                                              fFirstUsedSliceHiGain    = firsth;
    53                                              fLastUsedSliceHiGain     = lasth;
    54                                              fNumUsedLoGainFADCSlices = numl; 
    55                                              fFirstUsedSliceLoGain    = firstl;
    56                                              fLastUsedSliceLoGain     = lastl;
    57                                            }
     47                                Byte_t numl, Byte_t firstl, Byte_t lastl)
     48    {
     49        // FIXME: Calculate the number of used slices from first/last
     50        //        to make sure, that the stored values are always
     51        //        consistent!
     52        fNumUsedHiGainFADCSlices = numh;
     53        fFirstUsedSliceHiGain    = firsth;
     54        fLastUsedSliceHiGain     = lasth;
     55        fNumUsedLoGainFADCSlices = numl;
     56        fFirstUsedSliceLoGain    = firstl;
     57        fLastUsedSliceLoGain     = lastl;
     58    }
    5859
    5960    MExtractedSignalPix &operator[](Int_t i);
  • trunk/MagicSoft/Mars/manalysis/MExtractedSignalPix.h

    r2706 r2728  
    99{
    1010private:
    11 
     11    // FIXME: We can only store ONE signal. Everything else takes
     12    //        too much storage space - will change in the future.
    1213    Float_t fExtractedSignalHiGain;      // mean value of the extracted signal
    1314    Float_t fExtractedSignalHiGainError; // error of the mean value of the extracted signal
    1415    Float_t fExtractedSignalLoGain;      // mean value of the extracted signal
    1516    Float_t fExtractedSignalLoGainError; // error of the mean value of the extracted signal
     17
    1618    Bool_t fIsLoGainUsed;
    1719    Byte_t fNumHiGainSaturated;
    1820    Byte_t fNumLoGainSaturated;
    1921
     22    // FIXME: Will be removed. Must be stored in MArrivalTime
    2023    Float_t fMeanArrivalTime;
    2124    Float_t fWidthArrivalTime;
  • trunk/MagicSoft/Mars/mbase/MArgs.cc

    r2529 r2728  
    3030// This is a helper class for executables to parse command line arguments
    3131//
     32// Arguments beginning with a trailing '-' are called 'options'.
     33// Arguments without a trailing '-' are considered 'arguments'
     34//
    3235//////////////////////////////////////////////////////////////////////////////
    3336#include "MArgs.h"
     
    8285// --------------------------------------------------------------------------
    8386//
    84 // Print all arguments parsed.
     87// Print everything parsed.
     88// Using 'options' as option only 'options' are printed.
     89// Using 'arguments' as option only 'arguments' are printed.
    8590//
    8691void MArgs::Print(const Option_t *o) const
    8792{
    8893    gLog << all << underline << fName << ":" << endl;
     94
     95    const TString str(o);
     96
     97    if (!str.CompareTo("options", TString::kIgnoreCase))
     98    {
     99        TIter Next(fArgv);
     100        TString *s = NULL;
     101        while ((s=dynamic_cast<TString*>(Next())))
     102            if (s->BeginsWith("-"))
     103                gLog << *s << endl;
     104        return;
     105    }
     106
     107    if (!str.CompareTo("arguments", TString::kIgnoreCase))
     108    {
     109        TIter Next(fArgv);
     110        TString *s = NULL;
     111        while ((s=dynamic_cast<TString*>(Next())))
     112            if (!s->BeginsWith("-"))
     113                gLog << *s << endl;
     114        return;
     115    }
     116
    89117    fArgv->Print();
    90118}
     
    246274// --------------------------------------------------------------------------
    247275//
     276// return the number of arguments with a trainling '-'
     277//
     278Int_t MArgs::GetNumOptions() const
     279{
     280    Int_t num = 0;
     281
     282    TIter Next(fArgv);
     283    TString *s = NULL;
     284    while ((s=dynamic_cast<TString*>(Next())))
     285        if (s->BeginsWith("-"))
     286            num++;
     287
     288    return num;
     289}
     290
     291// --------------------------------------------------------------------------
     292//
     293// return the total number of entries
     294//
     295Int_t MArgs::GetNumEntries() const
     296{
     297    return fArgv->GetSize();
     298}
     299
     300// --------------------------------------------------------------------------
     301//
    248302// Checks whether an argument beginning with 'n' is existing, eg:
    249303//  executable -value5
     
    259313    while ((s=dynamic_cast<TString*>(Next())))
    260314        if (s->BeginsWith(name))
     315            return kTRUE;
     316    return kFALSE;
     317}
     318
     319// --------------------------------------------------------------------------
     320//
     321// Checks whether an argument beginning with 'n' is existing, eg:
     322//  executable -value5
     323//   HasOption("-value") will return false
     324//  executable -value
     325//   HasOption("-value") will return true
     326//
     327Bool_t MArgs::HasOnly(const TString n) const
     328{
     329    const TString name = n.Strip(TString::kBoth);
     330
     331    TIter Next(fArgv);
     332    TString *s = NULL;
     333    while ((s=dynamic_cast<TString*>(Next())))
     334        if (*s==name)
    261335            return kTRUE;
    262336    return kFALSE;
     
    284358    return kFALSE;
    285359}
     360
     361// --------------------------------------------------------------------------
     362//
     363// Checks whether an argument beginning with 'n' is exists and a
     364// corresponding option is available, eg.
     365//  executable -value5
     366//  HasOption("-value") will return false
     367// but:
     368//  executable -value
     369//  HasOption("-value") will return true
     370//
     371// The argument is removed from the internal list.
     372//
     373Bool_t MArgs::HasOnlyAndRemove(const TString n)
     374{
     375    const TString name = n.Strip(TString::kBoth);
     376
     377    TIter Next(fArgv);
     378    TString *s = NULL;
     379    while ((s=dynamic_cast<TString*>(Next())))
     380        if (*s==name)
     381        {
     382            delete fArgv->Remove(dynamic_cast<TObject*>(s));
     383            return kTRUE;
     384        }
     385
     386    return kFALSE;
     387}
  • trunk/MagicSoft/Mars/mbase/MArgs.h

    r2529 r2728  
    4747    TString  GetStringAndRemove(const TString name);
    4848
    49     Bool_t Has(const TString name) const;
    50     Bool_t HasOption(const TString name) const;
     49    Bool_t   Has(const TString name) const;
     50    Bool_t   HasOnly(const TString name) const;
     51    Bool_t   HasOption(const TString name) const;
     52    Bool_t   HasOnlyAndRemove(const TString name);
    5153
    52     TString GetArgumentStr(Int_t i) const;
    53     Int_t   GetArgumentInt(Int_t i) const;
    54     Float_t GetArgumentFloat(Int_t i) const;
    55     Int_t   GetNumArguments() const;
     54    TString  GetArgumentStr(Int_t i) const;
     55    Int_t    GetArgumentInt(Int_t i) const;
     56    Float_t  GetArgumentFloat(Int_t i) const;
     57    Int_t    GetNumArguments() const;
     58    Int_t    GetNumOptions() const;
     59    Int_t    GetNumEntries() const;
    5660
    5761    ClassDef(MArgs, 0)  //Class to parse command line arguments
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r2490 r2728  
    2525
    2626//////////////////////////////////////////////////////////////////////////////
    27 //                                                                          //
    28 // MEvtLoop                                                                 //
    29 //                                                                          //
    30 // This class is the core of each event processing.                         //
    31 // First you must set the parameter list to use. The parameter list         //
    32 // must contain the task list (MTaskList) to use. The name of the task      //
    33 // list can be specified if you call Eventloop. The standard name is        //
    34 // "MTaskList". The name you specify must match the name of the MTaskList   //
    35 // object.                                                                  //
    36 //                                                                          //
    37 // If you call Eventloop() first all PreProcess functions - with the        //
    38 // parameter list as an argument - of the tasks in the task list are        //
    39 // executed. If one of them returns kFALSE then the execution is stopped.   //
    40 // If the preprocessing was ok, The Process function of the tasks are       //
    41 // executed as long as one function returns kSTOP. Only the tasks which     //
    42 // are marked as "All" or with a string which matches the MInputStreamID    //
    43 // of MTaskList are executed. If one tasks returns kCONTINUE the pending    //
    44 // tasks in the list are skipped and the execution in continued with        //
    45 // the first one in the list.                                               //
    46 // Afterwards the PostProcess functions are executed.                       //
    47 //                                                                          //
    48 // If you want to display the progress in a gui you can use SetProgressBar  //
    49 // and a TGProgressBar or a MProgressBar. If you set a MStatusDisplay       //
    50 // using SetDisplay, the Progress bar from this display is used.            //
    51 //                                                                          //
    52 // You can create a macro from a completely setup eventloop by:             //
    53 //   evtloop.MakeMacro("mymacro.C");                                        //
    54 //                                                                          //
    55 // You will always need to check the macro, it will not run, but it         //
    56 // should have al important information.                                    //
    57 //                                                                          //
    58 //                                                                          //
    59 // You can also write all this information to a root file:                  //
    60 //   TFile file("myfile.root");                                             //
    61 //   evtloop.Write("MyEvtloopKey");                                         //
    62 //                                                                          //
    63 // You can afterwards read the information from an open file by:            //
    64 //   evtloop.Read("MyEvtloopKey");                                          //
    65 //                                                                          //
    66 // To lookup the information write it to a file using MakeMacro             //
    67 //                                                                          //
     27//
     28// MEvtLoop
     29//
     30// This class is the core of each event processing.
     31// First you must set the parameter list to use. The parameter list
     32// must contain the task list (MTaskList) to use. The name of the task
     33// list can be specified if you call Eventloop. The standard name is
     34// "MTaskList". The name you specify must match the name of the MTaskList
     35// object.
     36//
     37// If you call Eventloop() first all PreProcess functions - with the
     38// parameter list as an argument - of the tasks in the task list are
     39// executed. If one of them returns kFALSE then the execution is stopped.
     40// If the preprocessing was ok, The Process function of the tasks are
     41// executed as long as one function returns kSTOP. Only the tasks which
     42// are marked as "All" or with a string which matches the MInputStreamID
     43// of MTaskList are executed. If one tasks returns kCONTINUE the pending
     44// tasks in the list are skipped and the execution in continued with
     45// the first one in the list.
     46// Afterwards the PostProcess functions are executed.
     47//
     48// If you want to display the progress in a gui you can use SetProgressBar
     49// and a TGProgressBar or a MProgressBar. If you set a MStatusDisplay
     50// using SetDisplay, the Progress bar from this display is used.
     51//
     52// You can create a macro from a completely setup eventloop by:
     53//   evtloop.MakeMacro("mymacro.C");
     54//
     55// You will always need to check the macro, it will not run, but it
     56// should have al important information.
     57//
     58//
     59// You can also write all this information to a root file:
     60//   TFile file("myfile.root");
     61//   evtloop.Write("MyEvtloopKey");
     62//
     63// You can afterwards read the information from an open file by:
     64//   evtloop.Read("MyEvtloopKey");
     65//
     66// To lookup the information write it to a file using MakeMacro
     67//
    6868//////////////////////////////////////////////////////////////////////////////
    6969#include "MEvtLoop.h"
     
    393393// for developers or use in special jobs only!
    394394//
    395 Int_t MEvtLoop::Process(Int_t maxcnt)
     395Int_t MEvtLoop::Process(UInt_t maxcnt)
    396396{
    397397    if (!fTaskList)
     
    404404    *fLog << all <<"Eventloop running (";
    405405
    406     if (maxcnt<0)
     406    if (maxcnt==0)
    407407        *fLog << "all";
    408408    else
     
    411411    *fLog << " events)..." << flush;
    412412
    413     Int_t entries = INT_MAX;
     413    UInt_t entries = kMaxUInt;
    414414    fNumEvents = 0;
    415415
     
    420420
    421421#ifdef __MARS__
    422         // limits.h
    423422        MRead *read = (MRead*)fTaskList->FindObject("MRead");
    424423        if (read && read->GetEntries()>0)
     
    429428            fNumEvents = TMath::Min(maxcnt, entries);
    430429        else
    431             if (entries!=INT_MAX)
     430            if (entries!=kMaxUInt)
    432431                fNumEvents = entries;
    433432    }
     
    439438    }
    440439
    441     Int_t dummy = maxcnt<0 ? 0 : maxcnt;
    442 
    443440    //
    444441    // start a stopwatch
     
    449446    //
    450447    // This is the MAIN EVENTLOOP which processes the data
    451     // if maxcnt<0 the number of processed events is counted
     448    // if maxcnt==0 the number of processed events is counted
    452449    // else only maxcnt events are processed
    453450    //
    454     Int_t numcnts = 0;
     451    UInt_t numcnts = 0;
     452    UInt_t dummy   = maxcnt;
    455453
    456454    Int_t rc = kTRUE;
    457     if (maxcnt<0)
     455    if (maxcnt==0)
    458456        // process first and increment if sucessfull
    459457        while ((rc=fTaskList->Process())==kTRUE)
     
    529527// See class description above. Returns kTRUE if PreProcessing,
    530528// Processing and PostProcessing was successfull, otherwise kFALSE.
    531 //
    532 Bool_t MEvtLoop::Eventloop(Int_t maxcnt, const char *tlist)
     529// maxcnt==0 means: all events
     530// tlist is the name of the task-list to be used. Be carefull, this
     531// feature is not finally implemented - it will only work if no
     532// task will access the tasklist.
     533//
     534Bool_t MEvtLoop::Eventloop(UInt_t maxcnt, const char *tlist)
    533535{
    534536    TDatime d;
    535537    *fLog << inf << underline << "Eventloop: " << fName << " started at " << d.AsString() << endl;
    536538
    537     Bool_t rc = PreProcess();
     539    Bool_t rc = PreProcess(tlist);
    538540
    539541    //
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.h

    r2490 r2728  
    6363
    6464    Bool_t PreProcess(const char *tlist="MTaskList");
    65     Int_t  Process(Int_t maxcnt);
     65    Int_t  Process(UInt_t maxcnt);
    6666    Bool_t PostProcess() const;
    6767
    68     Bool_t Eventloop(Int_t maxcnt=-1, const char *tlist="MTaskList");
     68    Bool_t Eventloop(UInt_t maxcnt=0, const char *tlist="MTaskList");
    6969
    7070    void MakeMacro(const char *filename="evtloop.C");
  • trunk/MagicSoft/Mars/mbase/MTime.cc

    r2678 r2728  
    2727// MTime
    2828//
    29 // A generalized MARS time stamp
     29// A generalized MARS time stamp.
    3030//
    3131// WARNING: Be carefull changing this class. It is also used in the
    3232//          MAGIC drive software cosy!
     33//
     34// Remarke: If you encounter strange behaviour, check the casting.
     35//          Note, that on Linux machines ULong_t and UInt_t is the same.
    3336//
    3437// Version 1:
     
    206209
    207210    fMjd = mjd+1;
     211}
     212
     213// --------------------------------------------------------------------------
     214//
     215// Update the magic time. Make sure, that the MJD is set correctly.
     216// It must be the MJD of the corresponding night. You can set it
     217// by Set(2003, 12, 24);
     218//
     219// It is highly important, that the time correspoding to the night is
     220// between 13:00:00.0 (day of dawning) and 12:59:59.999 (day of sunrise)
     221//
     222Bool_t MTime::UpdMagicTime(Byte_t h, Byte_t m, Byte_t s, UShort_t ms)
     223{
     224    if (h>23 || m>59 || s>59 || ms>999)
     225         return kFALSE;
     226
     227    const ULong_t tm = ((((h*60+m)*60)+s)*1000)+ms;
     228
     229    fTime = (Long_t)(tm < kHour*13 ? tm  : tm-kDay); // day of sunrise?
     230    //fNanoSec = ns;
     231
     232    return kTRUE;
     233
    208234}
    209235
  • trunk/MagicSoft/Mars/mbase/MTime.h

    r2636 r2728  
    2626class MTime : public MParContainer
    2727{
    28 private:
     28public:
    2929    static const UInt_t kHour; // [ms] one hour
    3030    static const UInt_t kDay;  // [ms] one day
    3131
     32private:
    3233    UInt_t fMjd;     // [d]  Day in the century        (Day of sun rise)
    3334    TTime  fTime;    // [ms] Time of Day               (-11h<=x<13h)
     
    7475
    7576    Bool_t   Set(UInt_t mjd, ULong_t ms, UInt_t ns=0);
    76     Bool_t   Set(UShort_t y, Byte_t m, Byte_t d, Byte_t h, Byte_t min, Byte_t s, UShort_t ms, UInt_t ns=0);
     77    Bool_t   Set(UShort_t y, Byte_t m, Byte_t d, Byte_t h=13, Byte_t min=0, Byte_t s=0, UShort_t ms=0, UInt_t ns=0);
    7778    void     Set(const struct timeval &tv);
    7879    void     SetCT1Time(UInt_t mjd, UInt_t t1, UInt_t t0);
     80    Bool_t   UpdMagicTime(Byte_t h, Byte_t m, Byte_t s, UShort_t ms);
    7981    void     SetMjd(Double_t m);
    8082    Double_t GetMjd() const;
  • trunk/MagicSoft/Mars/merpp.cc

    r2711 r2728  
    6666    gLog << "     inputfile.txt:  Magic DC currents file." << endl;
    6767    gLog << "     ouputfile.root: Merpped root file." << endl;
    68     gLog << "     -a0: Do not use Ansii codes." << endl;
    69     gLog << "     -u1: Update file." << endl;
    70     gLog << "     -cn: Compression level n=1..9 [default=2]" << endl;
    71     gLog << "     -vn: Verbosity level n [default=2]" << endl;
     68    gLog << "     -c#:                             Compression level #=1..9 [default=2]" << endl;
     69    gLog << "     -v#:                             Verbosity level # [default=2]" << endl;
     70    gLog << "     -u, --update:                    Update file" << endl;
     71    gLog << "     -a, --no-colors:                 Do not use Ansii color codes" << endl;
    7272    gLog << "     --start=yyyy-mm-dd/hh:mm:ss.mmm: Start event time for merpping report files" << endl;
    7373    gLog << "     --stop=yyyy-mm-dd/hh:mm:ss.mmm:  Stop  event time for merpping report files" << endl;
    7474    gLog << "     --run=#:                         Only merpp data corresponding to this run number" << endl;
    75     gLog << "     -?/-h: This help" << endl << endl;
     75    gLog << "     -?, -h, --help:                  This help" << endl << endl;
    7676    gLog << "   REMARK: At the moment you can process a .raw _or_ a .rep file, only!" << endl << endl;
    7777}
     
    9999    MArgs arg(argc, argv);
    100100
    101     if (arg.HasOption("-?") || arg.HasOption("-h"))
     101    if (arg.HasOnly("-?") || arg.HasOnly("-h") || arg.HasOnly("--help"))
    102102    {
    103103        Usage();
     
    105105    }
    106106
    107     if (arg.HasOption("-a") && arg.GetIntAndRemove("-a")==0)
     107    if (arg.HasOnlyAndRemove("--no-colors") || arg.HasOnlyAndRemove("-a"))
    108108        gLog.SetNoColors();
    109109
    110110    const Int_t kComprlvl = arg.HasOption("-c") ? arg.GetIntAndRemove("-c") : 1;
    111     Bool_t kUpdate = arg.HasOption("-u") && arg.GetIntAndRemove("-u")==1;
     111    Bool_t kUpdate = arg.HasOnlyAndRemove("--update") || arg.HasOnlyAndRemove("-u");
    112112
    113113    gLog.SetDebugLevel(arg.HasOption("-v") ? arg.GetIntAndRemove("-v") : 2);
  • trunk/MagicSoft/Mars/mfilter/MFEventSelector2.cc

    r2693 r2728  
    9494/////////////////////////////////////////////////////////////////////////////
    9595#include "MFEventSelector2.h"
    96 
    97 #include <limits.h>         // INT_MAX
    9896
    9997#include <TRandom.h>        // gRandom
     
    190188Bool_t MFEventSelector2::ReadDistribution(MRead &read)
    191189{
    192     if (read.GetEntries() > INT_MAX) // FIXME: LONG_MAX ???
    193     {
    194         *fLog << err << "INT_MAX exceeded." << endl;
     190    if (read.GetEntries() > kMaxUInt) // FIXME: LONG_MAX ???
     191    {
     192        *fLog << err << "kIntMax exceeded." << endl;
    195193        return kFALSE;
    196194    }
  • trunk/MagicSoft/Mars/mmain/MEventDisplay.cc

    r2659 r2728  
    128128// --------------------------------------------------------------------------
    129129//
    130 //  Return reading task
    131 //
    132 MReadTree *MEventDisplay::GetReader() const
    133 {
    134     MParList  *plist  = (MParList*)fEvtLoop->GetParList();
    135     MTaskList *tlist  = (MTaskList*)plist->FindObject("MTaskList");
    136     MReadTree *reader = (MReadTree*)tlist->FindObject("MRead");
    137     return reader;
    138 }
    139 
    140 // --------------------------------------------------------------------------
    141 //
    142130//  Setup Task and parameter list for hillas calculation,
    143131//  preprocess tasks and read in first event (process)
     
    389377void MEventDisplay::ReadinEvent(Int_t dir)
    390378{
    391     MParList    *plist = (MParList*)fEvtLoop->GetParList();
    392     MGeomCam    *geom  = (MGeomCam*) plist->FindObject("MGeomCam");
    393     MTaskList   *tlist = (MTaskList*)plist->FindObject("MTaskList");
    394     MRawEvtData *raw = (MRawEvtData*)plist->FindObject("MRawEvtData");
     379    MParList    *plist = (MParList*)   fEvtLoop->GetParList();
     380    MTaskList   *tlist = (MTaskList*)  fEvtLoop->GetTaskList();
     381    MGeomCam    *geom  = (MGeomCam*)   plist->FindObject("MGeomCam");
     382    MRawEvtData *raw   = (MRawEvtData*)plist->FindObject("MRawEvtData");
    395383    if (!raw)
    396384        return;
     
    399387    // Read first event.
    400388    //
    401     MReadTree *reader = GetReader();
     389    MReadTree *reader = (MReadTree*)fEvtLoop->FindTask("MRead");
    402390
    403391    const Int_t num = reader->GetNumEntry();
     
    472460    ReadinEvent();
    473461
    474     TGString *txt = new TGString(Form("of %d", GetReader()->GetEntries()));
     462    MReadTree *reader = (MReadTree*)fEvtLoop->FindTask("MRead");
     463    TGString *txt = new TGString(Form("of %d", reader->GetEntries()));
    475464    fNumOfEvts->SetText(txt);
    476465
     
    540529                {
    541530                    TGTextEntry *entry = (TGTextEntry*)fList->FindWidget(kEvtNumber);
    542                     if (GetReader()->SetEventNum(atoi(entry->GetText())-1))
     531                    MReadTree *reader  = (MReadTree*)fEvtLoop->FindTask("MRead");
     532                    if (reader->SetEventNum(atoi(entry->GetText())-1))
    543533                        ReadinEvent();
    544534                }
  • trunk/MagicSoft/Mars/mmain/MEventDisplay.h

    r2559 r2728  
    4343    void ReadinEvent(Int_t dir=0);
    4444
    45     MReadTree *GetReader() const;
    46 
    4745    Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
    4846
  • trunk/MagicSoft/Mars/mmontecarlo/MMcEnergyEst.cc

    r2357 r2728  
    2626
    2727/////////////////////////////////////////////////////////////////////////////
    28 //                                                                         //
    29 // MMcEnergyEst                                                            //
    30 //                                                                         //
    31 // Class for otimizing the parameters of the energy estimator              //
    32 //                                                                         //
    33 // FIXME: the class must be made more flexible, allowing for different     //
    34 // parametrizations to be used. Also a new class is needed, a container    //
    35 // for the parameters of the energy estimator.                             //
    36 // FIXME: the starting values of the parameters are now fixed.             //
    37 //                                                                         //
    38 //                                                                         //
     28//
     29// MMcEnergyEst
     30//
     31// Class for otimizing the parameters of the energy estimator
     32//
     33// FIXME: the class must be made more flexible, allowing for different
     34// parametrizations to be used. Also a new class is needed, a container
     35// for the parameters of the energy estimator.
     36// FIXME: the starting values of the parameters are now fixed.
     37//
    3938/////////////////////////////////////////////////////////////////////////////
    4039#include "MMcEnergyEst.h"
  • trunk/MagicSoft/Mars/mranforest/MRanTree.cc

    r2307 r2728  
    2424
    2525/////////////////////////////////////////////////////////////////////////////
    26 //                                                                         //
    27 // MRanTree                                                                //
    28 //                                                                         //
    29 // ParameterContainer for Tree structure                                   //
    30 //                                                                         //
    31 //                                                                         //
     26//
     27// MRanTree
     28//
     29// ParameterContainer for Tree structure
     30//
    3231/////////////////////////////////////////////////////////////////////////////
    3332#include "MRanTree.h"
     
    159158    Double_t pno=0;
    160159    Double_t pdo=0;
    161     for (Int_t j=0;j<2;j++)
     160    for (Int_t j=0; j<2; j++)
    162161    {
    163162        pno+=tclasspop[j]*tclasspop[j];
     
    171170    // (Gini-index as criterium crit)
    172171
    173     Double_t critmax=-1.0e20;  // FIXME: Replace by a constant from limits.h
     172    Double_t critmax=-FLT_MAX;
    174173
    175174    // random split selection, number of trials = fNumTry
    176     for(Int_t mt=0;mt<fNumTry;mt++)
     175    for (Int_t mt=0; mt<fNumTry; mt++)
    177176    {
    178177        const Int_t mvar=Int_t(gRandom->Rndm()*mdim);
  • trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc

    r2580 r2728  
    236236}
    237237
     238Bool_t MRawEvtHeader::DecodeTime(UInt_t abstime[2]) const
     239{
     240    // BADC|1032 --> DCBA|3210 (Byte swap - exchange MSB and LSB)
     241    abstime[0] = (abstime[0]<<16) | (abstime[0]>>16);
     242    abstime[1] = (abstime[1]<<16) | (abstime[1]>>16);
     243
     244    const Byte_t h = (abstime[0]>>18 & 0x30)*10 + (abstime[0]>>14 & 0x0f);
     245    const Byte_t m = (abstime[0]>>11 & 0x70)*10 + (abstime[0]>> 7 & 0x0f);
     246    const Byte_t s = (abstime[0]>> 4 & 0x70)*10 + (abstime[0]>> 0 & 0x0f);
     247    const Int_t ms =
     248        ((abstime[1]>>16)&0xf)*1000 +
     249        ((abstime[1]>> 8)&0xf)* 100 +
     250        ((abstime[1]>> 4)&0xf)*  10 +
     251        ((abstime[1]>> 0)&0xf)*   1;
     252
     253    // hms   =3210 -->  h=2:4 m=3:4 s=3:4
     254    // subsec=DCBA --> subsec?
     255    *fLog << dbg << dec;
     256    *fLog << (int)(abstime[0]>>18 & 0x30); // h
     257    *fLog << (int)(abstime[0]>>14 & 0x0f); // h
     258    *fLog << ":";
     259    *fLog << (int)(abstime[0]>>11 & 0x70); // m
     260    *fLog << (int)(abstime[0]>> 7 & 0x0f); // m
     261    *fLog << ":";
     262    *fLog << (int)(abstime[0]>> 4 & 0x70); // s
     263    *fLog << (int)(abstime[0]>> 0 & 0x0f); // s
     264    *fLog << " ";
     265    *fLog << (int)(abstime[1]>>16 & 0xf) << ".";
     266    *fLog << (int)(abstime[1]>> 8 & 0xf) << ".";
     267    *fLog << (int)(abstime[1]>> 4 & 0xf) << ".";
     268    *fLog << (int)(abstime[1]>> 0 & 0xf);
     269    *fLog << endl;
     270
     271    // Update the time stamp with the current event time.
     272    // Make sure, that the time stamp was initialized correctly
     273    // with the start-date/time of the run (after reading the run header)
     274    //
     275    // Here the nanosec precision is ignored... (FIXME!)
     276    return fTime->UpdMagicTime(h, m, s, ms);
     277}
     278
    238279// --------------------------------------------------------------------------
    239280//
     
    241282// return FALSE if there is now header anymore, else TRUE
    242283//
     284// Updates the time stamp with the current event time.
     285// Make sure, that the time stamp was initialized correctly
     286// with the start-date/time of the run (after reading the run header)
     287//
     288// Remark: This 'feature' disallows single runs of more than 11h!
     289//
    243290int MRawEvtHeader::ReadEvt(istream &fin)
    244291{
    245292    fin.read((char*)&fDAQEvtNumber, 4);  // Total=4
    246293
    247     UInt_t abstime[2];
     294    UInt_t abstime[2];                   // BADC|1032
    248295    fin.read((char*)abstime,        8);  // Total=12
    249 
    250     //
    251     // store the time of the event in the corresponding container
    252     //
    253     /*
    254      const Double_t mhz = 9.375;                        // [1e6 ticks/s]
    255      const Double_t t   = (Double_t)abstime[0]/mhz;     // [ns]
    256      const UShort_t ns  = (UShort_t)fmod(t*1e-3, 1e9);
    257      const Byte_t s     = (Byte_t)fmod(t/1e12, 60);
    258      const Byte_t m     = (Byte_t)fmod(t/60e12, 60);
    259      const Byte_t h     = (Byte_t)(t/3600e12);
    260      fTime->SetTime(h, m, s, ns);
    261      */
     296    if (!DecodeTime(abstime))
     297    {
     298        *fLog << err << "ERROR - Event time in event header invalid... abort." << endl;
     299        return kFALSE;
     300    }
    262301
    263302    Byte_t dummy[4];
  • trunk/MagicSoft/Mars/mraw/MRawEvtHeader.h

    r2173 r2728  
    4444    MArrayB *fPixLoGainOn;     //! Array which tell you which pixels have lo gain on
    4545
     46    Bool_t DecodeTime(UInt_t abstime[2]) const;
     47
    4648public:
    47 
    4849    MRawEvtHeader(const char *name=NULL, const char *title=NULL);
    4950    ~MRawEvtHeader();
  • trunk/MagicSoft/Mars/mraw/MRawFileRead.cc

    r2675 r2728  
    151151    fRawRunHeader->Print();
    152152
    153     return fRawRunHeader->GetMagicNumber()==kMagicNumber;
     153    if (fRawRunHeader->GetMagicNumber()!=kMagicNumber)
     154        return kFALSE;
     155
     156    *fRawEvtTime = fRawRunHeader->GetRunStart();
     157
     158    return kTRUE;
    154159}
    155160
  • trunk/MagicSoft/Mars/mraw/MRawRead.cc

    r2675 r2728  
    125125}
    126126
     127// --------------------------------------------------------------------------
     128//
     129// This is a workaround for the oldest runs (run-number<3490)
     130// for which no time stamp was available.
     131// For this runs a fake time stamp is created
     132//
     133// Be carefull: This is NOT thread safe!
     134//
     135void MRawRead::CreateFakeTime() const
     136{
     137    static Double_t tm = 0; // Range of roughly 8min
     138    const UInt_t ct = (*fRawCrateArray)[0]->GetFADCClockTick();
     139
     140    tm = ct<tm ? fmod(tm, (UInt_t)(-1))+(UInt_t)(-1)+ct : ct;
     141
     142    const Double_t mhz = 9.375;                        // [1e6 ticks/s]
     143    const Double_t t   = tm/mhz;                       // [us]
     144    const UInt_t ns    = (UInt_t)fmod(t*1e3, 1e6);
     145    const UShort_t ms  = (UShort_t)fmod(t/1e3, 1e3);
     146    const Byte_t s     = (Byte_t)fmod(t/1e6, 60);
     147
     148    // Create an artificial time stamp!
     149    UInt_t m = (Byte_t)fmod(t/60e6, 60);
     150    //const Byte_t h     = (Byte_t)(t/3600e6);
     151    m += fRawRunHeader->GetRunNumber()*10;
     152    m %= 360; // 6h
     153
     154    fRawEvtTime->Set(fRawRunHeader->GetRunStart().Year(),
     155                     fRawRunHeader->GetRunStart().Month(),
     156                     fRawRunHeader->GetRunStart().Day(),
     157                     m/60, m%60, s, ms, ns);
     158}
     159
     160// --------------------------------------------------------------------------
     161//
     162// Read a single event from the stream
     163//
    127164Bool_t MRawRead::ReadEvent(istream &fin)
    128165{
     
    169206    }
    170207
    171     {
    172         // FIXME This is a stupid workaround for the missing time stamp!
    173         //       Might be used depending on the run number in the future
    174         static Double_t tm = 0; // Range of roughly 8min
    175         const UInt_t ct = (*fRawCrateArray)[0]->GetFADCClockTick();
    176 
    177         tm = ct<tm ? fmod(tm, (UInt_t)(-1))+(UInt_t)(-1)+ct : ct;
    178 
    179         const Double_t mhz = 9.375;                        // [1e6 ticks/s]
    180         const Double_t t   = tm/mhz;                       // [us]
    181         const UInt_t ns    = (UInt_t)fmod(t*1e3, 1e6);
    182         const UShort_t ms  = (UShort_t)fmod(t/1e3, 1e3);
    183         const Byte_t s     = (Byte_t)fmod(t/1e6, 60);
    184 
    185         // Create an artificial time stamp!
    186         UInt_t m = (Byte_t)fmod(t/60e6, 60);
    187         //const Byte_t h     = (Byte_t)(t/3600e6);
    188         m += fRawRunHeader->GetRunNumber()*10;
    189         m %= 360; // 6h
    190 
    191         fRawEvtTime->Set(fRawRunHeader->GetRunStart().Year(),
    192                          fRawRunHeader->GetRunStart().Month(),
    193                          fRawRunHeader->GetRunStart().Day(),
    194                          m/60, m%60, s, ms, ns);
    195     }
     208    // This is a workaround for the oldest runs (run-number<3490)
     209    // for which no time stamp was available.
     210    // For this runs a fake time stamp is created
     211    if (fRawRunHeader->GetRunNumber()<3490)
     212        CreateFakeTime();
     213
     214    // FIXME: For all other runs we should enhance the precision
     215    //        of the time-stamp by using the FADCClockTick
     216
    196217    return kTRUE;
    197218}
  • trunk/MagicSoft/Mars/mraw/MRawRead.h

    r2677 r2728  
    2222    MTime          *fRawEvtTime;    // raw evt time information container to fill from file
    2323
     24    void CreateFakeTime() const;
     25
    2426    Bool_t ReadEvent(istream &fin);
    2527    Int_t  PreProcess(MParList *pList);
  • trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc

    r2645 r2728  
    2929// Root storage container for the RUN HEADER information
    3030//
    31 //
    32 //
    33 //  Version 2:
    34 //  ----------
     31//  Format Version 2:
     32//  -----------------
     33//   - removed mjd from data
     34//   - added start time
     35//   - added stop  time
     36//
     37//  Class Version 2:
     38//  ----------------
    3539//   - removed fMJD, fYear, fMonth, fDay
    3640//   - added fRunStart
    3741//   - added fRunStop
    3842//
    39 //  Version 1:
    40 //  ----------
     43//  Class Version 1:
     44//  ----------------
    4145//   - first implementation
    4246//
     
    212216    for (int i=0; i<GetNumPixel(); i++)
    213217        *fLog << setfill('0') << setw(3) << (*fPixAssignment)[i] << " ";
    214     *fLog << hex << endl;
    215218
    216219    *fLog << endl;
  • trunk/MagicSoft/Mars/mraw/MRawSocketRead.cc

    r2675 r2728  
    252252    }
    253253
     254    *fRawEvtTime = fRawRunHeader->GetRunStart();
     255
    254256    if (!ReadEvent(*fIn))
    255257        return kFALSE;
  • trunk/MagicSoft/Mars/mreport/MReportRun.h

    r2708 r2728  
    2222    Int_t GetRunNumber() const { return fRunNumber; }
    2323
    24     ClassDef(MReportRun, 1) // Class for RUN-REPORT information
     24    ClassDef(MReportRun, 0) // Class for RUN-REPORT information
    2525};
    2626
  • trunk/MagicSoft/Mars/readdaq.cc

    r2607 r2728  
    5555    gLog << "     -d1: print data in decimal values" << endl;
    5656    gLog << "     -c1: print MRawCrateArray data" << endl;
    57     gLog << "     -?/-h: This help" << endl << endl;
     57    gLog << "     -?, -h, --help: This help" << endl << endl;
    5858}
    5959
     
    6767    MArgs arg(argc, argv);
    6868
    69     if (arg.HasOption("-?") || arg.HasOption("-h"))
     69    if (arg.HasOnly("-?") || arg.HasOnly("-h") || arg.HasOnly("--help"))
    7070    {
    7171        Usage();
  • trunk/MagicSoft/Mars/readraw.cc

    r2580 r2728  
    5454    gLog << "   readraw [-h] [-?] [-vn] [-dec] [-a0] inputfile[.root]" << endl << endl;
    5555    gLog << "     input file:   Magic DAQ binary file." << endl;
    56     gLog << "     -a0: Do not use Ansii codes." << endl;
    5756    gLog << "     -vn: Verbosity level n [default=2]" << endl;
    58     gLog << "     -d1: print data in decimal values" << endl;
    59     gLog << "     -?/-h: This help" << endl << endl;
     57    gLog << "     -d, --dec: print data in decimal values" << endl;
     58    gLog << "     -a, --no-colors: Do not use Ansii color codes" << endl;
     59    gLog << "     -?,-h,--help: This help" << endl << endl;
    6060}
    6161
     
    7373    StartUpMessage();
    7474
    75     //
    7675    // Evaluate arguments
    77     //
    7876    MArgs arg(argc, argv);
    7977
    80     if (arg.HasOption("-?") || arg.HasOption("-h"))
     78    // check for the right usage of the program
     79    if (arg.HasOption("-?") || arg.HasOption("-h") || arg.HasOption("--help") ||
     80        arg.GetNumArguments()!=1)
    8181    {
    8282        Usage();
     
    8484    }
    8585
    86     //
    87     // Set verbosity to highest level.
    88     //
     86    // Set verbosity
    8987    gLog.SetDebugLevel(arg.HasOption("-v") ? arg.GetIntAndRemove("-v") : 2);
    9088
    91     if (arg.HasOption("-a") && arg.GetIntAndRemove("-a")==0)
     89    // Set color usage
     90    if (arg.HasOnlyAndRemove("--no-colors") || arg.HasOnlyAndRemove("-a"))
    9291        gLog.SetNoColors();
    9392
    94     const bool kDecimal = arg.HasOption("-d") && arg.GetIntAndRemove("-d")==1;
    95 
    96     //
    97     // check for the right usage of the program
    98     //
    99     if (arg.GetNumArguments()!=1)
    100     {
    101         Usage();
    102         return -1;
     93    // Set usage of decimal values
     94    const bool kDecimal = arg.HasOnlyAndRemove("-d") || arg.HasOnlyAndRemove("--dec");
     95
     96    //
     97    // check for unidentified options
     98    //
     99    if (arg.GetNumOptions()>0)
     100    {
     101        gLog << warn << "WARNING - unknown commandline options..." << endl;
     102        arg.Print("options");
     103        gLog << endl;
    103104    }
    104105
     
    128129    //  open the file
    129130    //
    130     gLog << " Open the file '" << kNamein << "'" << endl;
     131    gLog << inf << " Open the file '" << kNamein << "'" << endl;
    131132    TFile input(kNamein, "READ");
    132133
     
    137138    TTree *runtree = (TTree*)input.Get("RunHeaders");
    138139    if (!runtree)
    139         gLog << " WARNING: This file has NO Tree 'RunHeaders'" << endl << endl;
     140        gLog << warn << " WARNING - This file has no Tree 'RunHeaders'" << endl << endl;
    140141    else
    141142    {
     
    151152    // open the DataTree and read in
    152153    //
    153     gLog << " Check the Tree 'Events'" << endl ;
     154    gLog << inf << " Check the Tree 'Events'" << endl ;
    154155    TTree *evttree = (TTree*)input.Get("Events") ;
    155156    if (!evttree)
    156157    {
    157         gLog << "Tree 'Events' not found in file... exit!" << endl;
     158        gLog << err << "Tree 'Events' not found in file... exit!" << endl;
    158159        return -1;
    159160    }
     
    184185    const Int_t nent = (Int_t)evttree->GetEntries();
    185186
    186     gLog << endl;
    187187    gLog << " Entries in Tree Data: " << dec << nent << endl;
    188188    gLog << endl;
     
    190190    for (Int_t i = 0; i<nent; i++)
    191191    {
    192         gLog << "Entry: " << i << endl;
     192        gLog << all << "Entry: " << i << endl;
    193193
    194194        //
Note: See TracChangeset for help on using the changeset viewer.