Changeset 8892


Ignore:
Timestamp:
05/19/08 15:04:36 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 added
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r8891 r8892  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20
     21 2008/05/19 Thomas Bretz
     22
     23   * Makefile.conf.general, Makefile.conf.linux:
     24     - distinguish between := (eval once) and = (eval every access)
     25
     26   * mbase/BaseLinkDef.h, mbase/Makefile:
     27     - added MObjLookup
     28
     29   * mbase/MobjLookup.[h,cc]:
     30     - added
     31
     32   * mbase/MEvtLoop.cc:
     33     - set progress bar position to 0 before PreProcessing
     34
     35   * mdata/MDataMember.[h,cc]:
     36     - added a member function to get a string
     37
     38   * mfilter/MFCosmics.cc:
     39     - fixed a typo in a comment
     40
     41   * mhbase/MH.[h,cc]:
     42     - improved SetBinning for newer root-versions
     43     - improved SetBinning to correctly support axis with labels
     44       (keeps the binning unchanged)
     45
     46   * mjobs/MJPedestal.cc:
     47     - deny level1 and level2 triggers choosing pedestal events
     48
     49   * mraw/MRawRunHeader.h:
     50     - added a member function returning the RunLength (stop-start)
     51
     52   * mtrigger/MTriggerPattern.[h,cc]:
     53     - wrapped some comments
     54     - improved comments
     55
     56
    2057
    2158 2008/05/15 Thomas Bretz
  • trunk/MagicSoft/Mars/Makefile.conf.general

    r8734 r8892  
    33#
    44
    5 ROOTLIBS   =  `root-config --libs` -lASImage -lMinuit -lHistPainter -lThread
    6 ROOTGLIBS  =  `root-config --glibs` -lASImage -lMinuit -lHistPainter -lThread
    7 ROOTCFLAGS =  `root-config --cflags`
     5ROOTLIBS   := $(shell root-config --libs) -lASImage -lMinuit -lHistPainter -lThread
     6ROOTGLIBS  := $(shell root-config --glibs) -lASImage -lMinuit -lHistPainter -lThread
     7ROOTCFLAGS := $(shell root-config --cflags)
    88
    99#
     
    1717#   export MARSLIBS="-lX11 -lXpm -L/usr/X11R6/lib"
    1818#
    19 DEFINES  = -DMARSVER=\"\<cvs\>\" -D__MARS__ $(ARCHDEF) $(MARSDEFINES)
     19DEFINES  := -DMARSVER=\"\<cvs\>\" -D__MARS__ $(ARCHDEF) $(MARSDEFINES)
    2020
    2121CXXFLAGS = $(ROOTCFLAGS) $(INCLUDES) $(OPTIM) $(DEBUG) $(DEFINES)
  • trunk/MagicSoft/Mars/Makefile.conf.linux

    r7780 r8892  
    99# compilers
    1010
    11 CC       = gcc
    12 CXX      = g++
    13 F77      = f77
    14 AR       = ar -rc
     11CC       := gcc
     12CXX      := g++
     13F77      := f77
     14AR       := ar -rc
    1515
    1616#
    1717#  ----->>>   settings for compilation
    1818#
    19 OPTIM    = -O5 -Wall -fno-exceptions -fPIC -Wpointer-arith -Wcast-align -Wconversion -Woverloaded-virtual
     19OPTIM    := -O5 -Wall -fno-exceptions -fPIC -Wpointer-arith -Wcast-align -Wconversion -Woverloaded-virtual
    2020# ggc 3.2: removed -fnonnull-objects -Wtraditional -Wnested-externs
    21 DEBUG    =
    22 ARCHDEF  = -D__LINUX__
    23 SOFLAG   = -shared
     21DEBUG    :=
     22ARCHDEF  := -D__LINUX__
     23SOFLAG   := -shared
    2424
    2525# For debugging information use '-g'
     
    2727
    2828#MARS_LIB = -Llib $(SUBDIRS:%=-l%) $(MARSLIBS)
    29 MARS_LIB = -Llib $(MARSLIBS)
    30 INCLUDES = -I. $(SUBDIRS:%=-I%)
     29MARS_LIB := -Llib $(MARSLIBS)
     30INCLUDES  = -I. $(SUBDIRS:%=-I%)
    3131
    3232# uncomment this for quiet compilation
  • trunk/MagicSoft/Mars/NEWS

    r8891 r8892  
    3737   * the histogram classes MH3 and MHn now support profile histograms
    3838
     39   * the histogram classes MH3 and MHn now support labels at the axis
     40
    3941   * the Random Forest Train-classes (MJTRain*) now store the used datasets
    4042     in the output file
     
    7274      in the run-header disagrees now an error is raised (this can
    7375      happen in not well simulated Monte Carlo files)
     76
     77    * In the case of MUX-data pedestal events with the lvl1 trigger flag
     78      could survive into the pedestal calculation -- fixed.
     79
     80    * Tab "TrigPat" added showing the distribution of the trigger pattern
     81      as found in the run-files (normalized with the run length)
    7482
    7583 ;star
     
    104112    * the Monte Carlo events after cuts are now written to the output file
    105113      if an output file given
     114
    106115
    107116
  • trunk/MagicSoft/Mars/mbase/BaseLinkDef.h

    r8842 r8892  
    2626#pragma link C++ namespace MARS;
    2727#pragma link C++ namespace MMath;
     28//#pragma link C++ namespace UTF8;
    2829#pragma link C++ class MString+;
    2930#pragma link C++ class MEnv+;
     
    7071#pragma link C++ class MArrayI;
    7172
     73#pragma link C++ class MObjLookup+;
     74
    7275#pragma link C++ class MTime+;
    7376#pragma link C++ function operator<<(ostream&, const MTime&);
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r8746 r8892  
    249249    }
    250250#endif
     251
     252    if (fProgress)
     253        fProgress->SetPosition(0);
    251254
    252255    //
  • trunk/MagicSoft/Mars/mbase/Makefile

    r8842 r8892  
    6262           MPrint.cc \
    6363           MZlib.cc \
    64            MThread.cc
     64           MThread.cc \
     65           MObjLookup.cc
    6566
    6667############################################################
  • trunk/MagicSoft/Mars/mdata/MDataMember.cc

    r8720 r8892  
    9393// --------------------------------------------------------------------------
    9494//
     95// Check if accessing fCall is safe
     96//
     97Bool_t MDataMember::CheckGet() const
     98{
     99    if (!fObject)
     100    {
     101        *fLog << err << "ERROR - MDataMember::Get: fObject not initialized ";
     102        *fLog << "(not PreProcessed)... returning 0." << endl;
     103        return kFALSE;
     104    }
     105
     106    if (!fCall)
     107    {
     108        *fLog << err << "ERROR - MDataMemberGet: No TMethodCall for " << fDataMember << " of ";
     109        *fLog << fObject->GetName() << " available... returning 0." << endl;
     110        return kFALSE;
     111    }
     112
     113    return kTRUE;
     114}
     115
     116// --------------------------------------------------------------------------
     117//
    95118// Returns the value you requested
    96119//
    97120Double_t MDataMember::GetValue() const
    98121{
    99     if (!fObject)
    100     {
    101         *fLog << err << "ERROR - MDataMember::GetValue: fObject not initialized ";
    102         *fLog << "(not PreProcessed)... returning 0." << endl;
     122    if (!CheckGet())
    103123        return 0;
    104     }
    105 
    106     if (!fCall)
    107     {
    108         *fLog << err << "No TMethodCall for " << fDataMember << " of ";
    109         *fLog << fObject->GetName() << " available... returning 0." << endl;
    110         return 0;
    111     }
    112124
    113125    switch (fCall->ReturnType())
     
    127139        *fLog << fObject->GetName() << " neither int nor float... returning 0." << endl;
    128140        return 0;
     141    }
     142}
     143
     144// --------------------------------------------------------------------------
     145//
     146// Returns the string you requested
     147//
     148const char *MDataMember::GetString() const
     149{
     150    if (!CheckGet())
     151        return NULL;
     152
     153    switch (fCall->ReturnType())
     154    {
     155    case TMethodCall::kString:
     156        {
     157            char *c=NULL;
     158            fCall->Execute(fObject, &c);
     159            return c;
     160        }
     161
     162    default:
     163        *fLog << err << "DataMember " << fDataMember << " of ";
     164        *fLog << fObject->GetName() << " not a char*... returning NULL." << endl;
     165        return NULL;
    129166    }
    130167}
  • trunk/MagicSoft/Mars/mdata/MDataMember.h

    r3572 r8892  
    2222    enum { kIsInt = BIT(14) };
    2323
     24    Bool_t CheckGet() const;
     25
    2426public:
    2527    MDataMember(const char *member=NULL) : fObject(NULL), fCall(NULL)
     
    3234
    3335    Double_t GetValue() const;
     36    const char *GetString() const;
    3437    Bool_t PreProcess(const MParList *plist);
    3538
  • trunk/MagicSoft/Mars/mfilter/MFCosmics.cc

    r8211 r8892  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MFCosmics.cc,v 1.16 2006-11-02 20:00:02 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MFCosmics.cc,v 1.17 2008-05-19 14:04:11 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    216216    //
    217217    // If the camera contains more than fMaxEmptyPixels
    218     // presumed pixels due to cosmics, then the event is discarted.
     218    // presumed pixels due to cosmics, then the event is discarded.
    219219    //
    220220    return cosmicpix > fMaxEmptyPixels*allpix;
  • trunk/MagicSoft/Mars/mhbase/MH.cc

    r8709 r8892  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MH.cc,v 1.36 2007-08-25 15:30:24 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MH.cc,v 1.37 2008-05-19 14:04:12 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    212212// --------------------------------------------------------------------------
    213213//
    214 // Applies a given binning to a 1D-histogram
     214// If labels are set for this axis the correct MBinning corresponding
     215// to the existing label range is returned (this is necessary to
     216// maintain the correct number of bins in the histogram)
     217// otherwise the given binning is returned.
     218//
     219MBinning MH::GetBinningForLabels(TAxis &x, const MBinning *bins)
     220{
     221    if (!x.GetLabels())
     222        return *bins;
     223
     224    const Int_t n = TMath::Max(x.GetLabels()->GetEntries(), 1);
     225    return MBinning(n, 0, n);
     226}
     227
     228// --------------------------------------------------------------------------
     229//
     230// If Labels are set this function deletes the fXbins Array from
     231// the axis (which makes the axis a variable bin-size axis)
     232// and sets the Nbins, Xmin and Xmax according to the number of labels.
     233//
     234void MH::RestoreBinningForLabels(TAxis &x)
     235{
     236    if (!x.GetLabels())
     237        return;
     238
     239    const Int_t n = TMath::Max(x.GetLabels()->GetEntries(), 1);
     240    x.Set(n, 0, n);
     241
     242    const_cast<TArrayD*>(x.GetXbins())->Set(0);
     243}
     244
     245// --------------------------------------------------------------------------
     246//
     247// Applies a given binning to a 1D-histogram. In case the axis has labels
     248// (e.g. GetXaxis()->GetLabels()) the binning is set according to the
     249// labels.
    215250//
    216251void MH::SetBinning(TH1 *h, const MBinning *binsx)
     
    225260#endif
    226261
     262#if ROOT_VERSION_CODE < ROOT_VERSION(5,12,00)
    227263    // All this is reset by TAxis::Set
    228264    const TAttAxis att(x);
     
    247283    x.SetTimeDisplay(tm);
    248284    x.SetTimeFormat(tf);
     285#else
     286    if (!x.GetLabels())
     287        h->SetBins(binsx->GetNumBins(), binsx->GetEdges());
     288#endif
     289
    249290
    250291#if ROOT_VERSION_CODE < ROOT_VERSION(3,03,03)
     
    255296// --------------------------------------------------------------------------
    256297//
    257 // Applies given binnings to the two axis of a 2D-histogram
     298// Applies given binnings to the two axis of a 2D-histogram.
     299// In case the axis has labels (e.g. GetXaxis()->GetLabels())
     300// the binning is set according to the labels.
    258301//
    259302void MH::SetBinning(TH2 *h, const MBinning *binsx, const MBinning *binsy)
     
    261304    TAxis &x = *h->GetXaxis();
    262305    TAxis &y = *h->GetYaxis();
     306
     307    const MBinning bx(GetBinningForLabels(x, binsx));
     308    const MBinning by(GetBinningForLabels(y, binsy));
    263309
    264310    //
     
    270316#endif
    271317
     318#if ROOT_VERSION_CODE < ROOT_VERSION(5,12,00)
    272319    // All this is reset by TAxis::Set
    273320    const TAttAxis attx(x);
     
    283330    // TH1D::fNcells must be set correctly.
    284331    //
    285     h->SetBins(binsx->GetNumBins(), 0, 1,
    286                binsy->GetNumBins(), 0, 1);
     332    h->SetBins(bx.GetNumBins(), 0, 1,
     333               by.GetNumBins(), 0, 1);
    287334
    288335    //
     
    290337    // in one of the two given histograms
    291338    //
    292     x.Set(binsx->GetNumBins(), binsx->GetEdges());
    293     y.Set(binsy->GetNumBins(), binsy->GetEdges());
     339    x.Set(bx.GetNumBins(), bx.GetEdges());
     340    y.Set(by.GetNumBins(), by.GetEdges());
    294341
    295342    // All this is reset by TAxis::Set
     
    300347    x.SetTimeFormat(tfx);
    301348    y.SetTimeFormat(tfy);
     349#else
     350    h->SetBins(bx.GetNumBins(), bx.GetEdges(),
     351               by.GetNumBins(), by.GetEdges());
     352#endif
     353
     354    RestoreBinningForLabels(x);
     355    RestoreBinningForLabels(y);
    302356
    303357#if ROOT_VERSION_CODE < ROOT_VERSION(3,03,03)
     
    310364//
    311365// Applies given binnings to the three axis of a 3D-histogram
     366// In case the axis has labels (e.g. GetXaxis()->GetLabels())
     367// the binning is set according to the labels.
    312368//
    313369void MH::SetBinning(TH3 *h, const MBinning *binsx, const MBinning *binsy, const MBinning *binsz)
     
    319375    TAxis &y = *h->GetYaxis();
    320376    TAxis &z = *h->GetZaxis();
     377
     378    const MBinning bx(GetBinningForLabels(x, binsx));
     379    const MBinning by(GetBinningForLabels(y, binsy));
     380    const MBinning bz(GetBinningForLabels(z, binsz));
    321381
    322382#if ROOT_VERSION_CODE < ROOT_VERSION(3,03,03)
     
    326386#endif
    327387
     388#if ROOT_VERSION_CODE < ROOT_VERSION(5,12,00)
    328389    // All this is reset by TAxis::Set
    329390    const TAttAxis attx(x);
     
    336397    const TString  tfy(y.GetTimeFormat());
    337398    const TString  tfz(z.GetTimeFormat());
     399#endif
    338400
    339401    //
     
    342404    // TH1D::fNcells must be set correctly.
    343405    //
    344     h->SetBins(binsx->GetNumBins(), 0, 1,
    345                binsy->GetNumBins(), 0, 1,
    346                binsz->GetNumBins(), 0, 1);
     406    h->SetBins(bx.GetNumBins(), 0, 1,
     407               by.GetNumBins(), 0, 1,
     408               bz.GetNumBins(), 0, 1);
    347409
    348410    //
     
    350412    // in one of the two given histograms
    351413    //
    352     x.Set(binsx->GetNumBins(), binsx->GetEdges());
    353     y.Set(binsy->GetNumBins(), binsy->GetEdges());
    354     z.Set(binsz->GetNumBins(), binsz->GetEdges());
    355 
     414    x.Set(bx.GetNumBins(), bx.GetEdges());
     415    y.Set(by.GetNumBins(), by.GetEdges());
     416    z.Set(bz.GetNumBins(), bz.GetEdges());
     417
     418    RestoreBinningForLabels(x);
     419    RestoreBinningForLabels(y);
     420    RestoreBinningForLabels(z);
     421
     422#if ROOT_VERSION_CODE < ROOT_VERSION(5,12,00)
    356423    // All this is reset by TAxis::Set
    357424    attx.Copy(x);
     
    364431    y.SetTimeFormat(tfy);
    365432    z.SetTimeFormat(tfz);
     433#endif
    366434
    367435#if ROOT_VERSION_CODE < ROOT_VERSION(3,03,03)
  • trunk/MagicSoft/Mars/mhbase/MH.h

    r8696 r8892  
    2626    Byte_t fSerialNumber;   // Serial number (eg of telecope)
    2727    UInt_t fNumExecutions;  // Number of calls to Fill function
     28
     29    static MBinning GetBinningForLabels(TAxis &x, const MBinning *bins);
     30    static void RestoreBinningForLabels(TAxis &x);
    2831
    2932public:
  • trunk/MagicSoft/Mars/mjobs/MJPedestal.cc

    r8795 r8892  
    11321132    MFTriggerPattern ftp2("PedestalFilter");
    11331133    ftp2.SetDefault(kTRUE);
     1134    ftp2.RequirePedestal();
    11341135    ftp2.DenyCalibration();
    1135     ftp2.RequirePedestal();
     1136
     1137    // NEW!
     1138    ftp2.DenyTriggerLvl1();
     1139    ftp2.DenyTriggerLvl2();
    11361140
    11371141    if (!fSequence.IsMonteCarlo() && (!fExtractor || !fExtractor->HasLoGain()))
  • trunk/MagicSoft/Mars/mraw/MRawRunHeader.h

    r8704 r8892  
    111111    const MTime &GetRunStart() const      { return fRunStart; }
    112112    const MTime &GetRunEnd() const        { return fRunStop; }
     113    Double_t GetRunLength() const         { return fRunStop-fRunStart; }
    113114    Short_t GetPixAssignment(UShort_t i) const;
    114115    UShort_t GetMaxPixId() const;
  • trunk/MagicSoft/Mars/mtrigger/MTriggerPattern.cc

    r8787 r8892  
    9696// otherway you will have it.
    9797//
    98 // To select events by the trigger pattern you should use MFTriggerPattern filter.
    99 // This filter uses Require- and Deny- methods to select your trigger pattern.
    100 // Require- methods requires that your trigger bit is ON, otherway the event
    101 // is kicked out. Deny- methods requires that your trigger bit is OFF, otherway
    102 // your event is kicked out. Other bits not selected by your Require- or Deny- call
    103 // are ignored. Let's give an example. You want to select all events that have
    104 // both LT1 and LT2 trigger but which are not calibration neither Pin Diode events.
    105 // You should look at unprescaled bits to be sure
    106 // about which were the initial triggers. Then you can implement in your macro
    107 // something like:
     98// To select events by the trigger pattern you should use MFTriggerPattern
     99// filter. This filter uses Require- and Deny- methods to select your
     100// trigger pattern. Require- methods requires that your trigger bit is ON,
     101// otherway the event is kicked out. Deny- methods requires that your
     102// trigger bit is OFF, otherway your event is kicked out. Other bits not
     103// selected by your Require- or Deny- call are ignored. Let's give an
     104// example. You want to select all events that have both LT1 and LT2
     105// trigger but which are not calibration neither Pin Diode events. You
     106// should look at unprescaled bits to be sure about which were the initial
     107// triggers. Then you can implement in your macro something like:
    108108//
    109109//      MFTriggerPattern ftrigpatt;
  • trunk/MagicSoft/Mars/mtrigger/MTriggerPattern.h

    r8787 r8892  
    1212public:
    1313    enum Pattern_t {
    14         kTriggerLvl1 = BIT(0),
    15         kCalibration = BIT(1), // Pulse Trigger
    16         kTriggerLvl2 = BIT(2), // LUT Pseudo Size selection
    17         kPedestal    = BIT(3),
    18         kPinDiode    = BIT(4),
    19         kSumTrigger  = BIT(5)  // Flag for an event taken with sum trigger
     14        kTriggerLvl1 = BIT(0), //  1:
     15        kCalibration = BIT(1), //  2: Pulse Trigger
     16        kTriggerLvl2 = BIT(2), //  4: LUT Pseudo Size selection
     17        kPedestal    = BIT(3), //  8:
     18        kPinDiode    = BIT(4), // 16:
     19        kSumTrigger  = BIT(5)  // 32: Flag for an event taken with sum trigger
    2020        //kUnused      = BIT(6)
    2121        //kUnused      = BIT(7)
Note: See TracChangeset for help on using the changeset viewer.