Changeset 1487 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
08/07/02 14:32:26 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1486 r1487  
    11                                                                  -*-*- END -*-*-
     2
     3 2002/08/07: Thomas Bretz
     4
     5   * macros/dohtml.C:
     6     - added missing paths
     7
     8   * manalysis/MBlindPixelCalc.[h,cc]:
     9     - replaced booleans by fFlags
     10     - added StreamPrimitive
     11     - changed version number to 1
     12
     13   * manalysis/MHillasSrcCalc.[h,cc]:
     14     - added correct initializations for the pointers
     15     - made the pointers persistent
     16
     17   * manalysis/MImgCleanStd.cc, manalysis/MSrcPosCam.cc,
     18     mfileio/MWriteRootFile.cc:
     19     - don't stream name and title if not necessary
     20
     21   * mbase/MEvtLoop.[h,cc]:
     22     - added some output
     23     - added print function
     24     - added gListOfPrimitives to delete BIT(15) of streamed containers
     25     - Added default argument for Read and Write
     26
     27   * mbase/MParContainer.cc:
     28     - added usage of gListOfPrimitives
     29
     30   * mbase/MParList.cc, mbase/MTaskList.cc, mhist/MBinning.cc:
     31     - fixed a bug when only the title is different from the default
     32
     33   * mhist/MHHillas.cc:
     34     - fixed the wrong usage of ApplyBinning for the 2D-Hist fCenter
     35
     36
    237
    338 2002/08/06: Thomas Bretz
  • trunk/MagicSoft/Mars/macros/dohtml.C

    r1337 r1487  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 (tbretz@uni-sw.gwdg.de)
     18!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2001
     20!   Copyright: MAGIC Software Development, 2000-2002
    2121!
    2222!
     
    3636
    3737    html.SetOutputDir("htmldoc");
    38     html.SetSourceDir(".:mbase:mraw:mgui:manalysis:mdatacheck:mmain:meventdisp:mmc:mmontecarlo:mhist:mfilter");
     38    html.SetSourceDir(".:mbase:mdata:mdatacheck:meventdisp:mfileio:mfilter:mgeom:mgui:mhist:mmain:mmc:mmontecarlo:mraw:mtools");
    3939
    4040    html.MakeAll(kTRUE);
  • trunk/MagicSoft/Mars/manalysis/MBlindPixelCalc.cc

    r1469 r1487  
    5353#include "MBlindPixelCalc.h"
    5454
     55#include <fstream.h>
     56
    5557#include "MLog.h"
    5658#include "MLogManip.h"
     
    6870ClassImp(MBlindPixelCalc);
    6971
     72static const TString gsDefName  = "MBlindPixelCalc";
     73static const TString gsDefTitle = "Task to deal with hot spots (star, broken pixels, etc)";
     74
    7075// --------------------------------------------------------------------------
    7176//
     
    7378//
    7479MBlindPixelCalc::MBlindPixelCalc(const char *name, const char *title)
    75     : fUseInterpolation(kFALSE), fUseCentralPixel(kFALSE)
    76 {
    77     fName  = name  ? name  : "MBlindPixelCalc";
    78     fTitle = title ? title : "Task which removes a list of pixel from analysis";
     80    : fFlags(0)
     81{
     82    fName  = name  ? name  : gsDefName.Data();
     83    fTitle = title ? title : gsDefTitle.Data();
    7984}
    8085
     
    129134//
    130135//  Replaces each pixel by the average of its surrounding pixels.
    131 //  If fUseCentralPixel is set the central pixel is also included.
     136//  If TESTBIT(fFlags, kUseCentralPixel) is set the central pixel is also included.
    132137//
    133138void MBlindPixelCalc::Interpolate() const
     
    155160        const Int_t n = gpix.GetNumNeighbors();
    156161
    157         nphot[i] = fUseCentralPixel ? (*fEvt)[id].GetNumPhotons() : 0;
    158         perr[i]  = fUseCentralPixel ? (*fEvt)[id].GetErrorPhot()  : 0;
     162        nphot[i] = TESTBIT(fFlags, kUseCentralPixel) ? (*fEvt)[id].GetNumPhotons() : 0;
     163        perr[i]  = TESTBIT(fFlags, kUseCentralPixel) ? (*fEvt)[id].GetErrorPhot()  : 0;
    159164        for (int j=0; j<n; j++)
    160165        {
     
    165170        }
    166171
    167         nphot[i] /= fUseCentralPixel ? n+1 : n;
    168         perr[i]  /= fUseCentralPixel ? n+1 : n;
    169     }
    170 
    171     if (fUseInterpolation && fGeomCam)
     172        nphot[i] /= TESTBIT(fFlags, kUseCentralPixel) ? n+1 : n;
     173        perr[i]  /= TESTBIT(fFlags, kUseCentralPixel) ? n+1 : n;
     174    }
     175
     176    if (TESTBIT(fFlags, kUseInterpolation) && fGeomCam)
    172177        for (UShort_t i=0; i<entries; i++)
    173178        {
     
    211216Bool_t MBlindPixelCalc::Process()
    212217{
    213     if (fUseInterpolation && fGeomCam)
     218    if (TESTBIT(fFlags, kUseInterpolation) && fGeomCam)
    214219        Interpolate();
    215220    else
     
    289294}
    290295
    291 
     296void MBlindPixelCalc::StreamPrimitive(ofstream &out) const
     297{
     298    out << "   MBlindPixelCalc " << GetUniqueName();
     299    if (fName!=gsDefName || fTitle!=gsDefTitle)
     300    {
     301        out << "(\"" << fName << "\"";
     302        if (fTitle!=gsDefTitle)
     303            out << ", \"" << fTitle << "\"";
     304        out <<")";
     305    }
     306    out << ";" << endl;
     307
     308    if (TESTBIT(fFlags, kUseInterpolation))
     309        out << "   " << GetUniqueName() << ".SetUseInterpolation();" << endl;
     310    if (TESTBIT(fFlags, kUseCentralPixel))
     311        out << "   " << GetUniqueName() << ".SetUseCentralPixel();" << endl;
     312
     313    if (fPixelsID.GetSize()==0)
     314        return;
     315
     316    out << "   {" << endl;
     317    out << "      TArrayS dummy;" << endl;
     318    for (int i=0; i<fPixelsID.GetSize(); i++)
     319        out << "      dummy[" << i << "]=" << ((TArrayS)fPixelsID)[i] << ";" << endl;
     320    out << "      " << GetUniqueName() << ".SetPixels(dummy);" << endl;
     321    out << "   }" << endl;
     322}
  • trunk/MagicSoft/Mars/manalysis/MBlindPixelCalc.h

    r1466 r1487  
    2323    TArrayS fPixelsID;  // Pixel IDs for blind pixels, which are entered by the user.
    2424
    25     Bool_t fUseInterpolation;
    26     Bool_t fUseCentralPixel;
     25    Byte_t fFlags;      // flag for the method which is used
     26
     27    enum
     28    {
     29        kUseInterpolation = 1,
     30        kUseCentralPixel  = 2
     31    };
    2732
    2833    void Interpolate() const;
    2934    void Unmap() const;
     35    void StreamPrimitive(ofstream &out) const;
    3036
    3137public:
    3238    MBlindPixelCalc(const char *name=NULL, const char *title=NULL);
    3339
    34     void SetUseInterpolation(Bool_t b=kTRUE) { fUseInterpolation=kTRUE; }
    35     void SetUseCetralPixel(Bool_t b=kTRUE)   { fUseCentralPixel=kTRUE; }
     40    void SetUseInterpolation(Bool_t b=kTRUE)
     41    {
     42        b ? SETBIT(fFlags, kUseInterpolation) : CLRBIT(fFlags, kUseInterpolation);
     43    }
     44    void SetUseCetralPixel(Bool_t b=kTRUE)
     45    {
     46        b ? SETBIT(fFlags, kUseCentralPixel) : CLRBIT(fFlags, kUseCentralPixel);
     47    }
    3648
    3749    Bool_t PreProcess(MParList *pList);
     
    3951
    4052    void SetPixels(Int_t num, Short_t *ids);
     53    void SetPixels(const TArrayS pix) { SetPixels(pix.GetSize(), pix.GetArray()); }
    4154    virtual Bool_t ReInit(MParList *pList);
    4255
    43     ClassDef(MBlindPixelCalc, 0) // task to disable given pixels for analysis
     56    ClassDef(MBlindPixelCalc, 1) // task to deal with hot spots (star, broken pixels, etc)
    4457};
    4558
  • trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.cc

    r1483 r1487  
    4545ClassImp(MHillasSrcCalc);
    4646
     47static const TString gsDefName  = "MHillasSrcCalc";
     48static const TString gsDefTitle = "Calculate position dependant image parameters";
     49
    4750// -------------------------------------------------------------------------
    4851//
     
    5558MHillasSrcCalc::MHillasSrcCalc(const char *src, const char *hil,
    5659                               const char *name, const char *title)
     60    : fHillas(NULL), fSrcPos(NULL), fHillasSrc(NULL)
    5761{
    58     fName  = name  ? name  : "MHillasSrcCalc";
    59     fTitle = title ? title : "add parameters dependent on source position (MHillasSrc)";
     62    fName  = name  ? name  : gsDefName.Data();
     63    fTitle = title ? title : gsDefTitle.Data();
    6064
    6165    fSrcName    = src;
     
    122126        out << "\"" << fSrcName << "\"";
    123127
     128    out << ", ";
     129
    124130    if (fHillasSrc)
    125131        out << "&" << fHillasSrc->GetUniqueName();
     
    127133        out << "\"" << fHillasName << "\"";
    128134
    129     out << ", \"" << fName << "\", \"" << fTitle << "\");" << endl;
     135    if (fName!=gsDefName || fTitle!=gsDefTitle)
     136    {
     137        out << ", \"" << fName << "\"";
     138        if (fTitle!=gsDefTitle)
     139            out << ", \"" << fTitle << "\"";
     140    }
     141    out << ");" << endl;
    130142}
  • trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.h

    r1477 r1487  
    1313{
    1414private:
    15     MHillas    *fHillas;     // Pointer to the source independant hillas parameters
    16     MSrcPosCam *fSrcPos;     // Pointer to the source position
    17     MHillasSrc *fHillasSrc;  // Pointer to the output container for the source dependant parameters
     15    MHillas    *fHillas;     //! Pointer to the source independant hillas parameters
     16    MSrcPosCam *fSrcPos;     //! Pointer to the source position
     17    MHillasSrc *fHillasSrc;  //! Pointer to the output container for the source dependant parameters
    1818
    1919    TString     fSrcName;
  • trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc

    r1483 r1487  
    6868};
    6969
     70static const TString gsDefName  = "MImgCleanStd";
     71static const TString gsDefTitle = "Task to perform a standard image cleaning";
     72
    7073// --------------------------------------------------------------------------
    7174//
     
    7881    : fCleanLvl1(lvl1), fCleanLvl2(lvl2)
    7982{
    80     fName  = name  ? name  : "MImgCleanStd";
    81     fTitle = title ? title : "Task which does a standard image cleaning";
     83    fName  = name  ? name  : gsDefName.Data();
     84    fTitle = title ? title : gsDefTitle.Data();
    8285
    8386    Print();
     
    417420{
    418421    out << "   MImgCleanStd " << GetUniqueName() << "(";
    419     out << fCleanLvl1 << ", " << fCleanLvl2 << ", \"";
    420     out << fName << "\", \"" << fTitle << "\");" << endl;
    421 }
     422    out << fCleanLvl1 << ", " << fCleanLvl2;
     423
     424    if (fName!=gsDefName || fTitle!=gsDefTitle)
     425    {
     426        out << ", \"" << fName << "\"";
     427        if (fTitle!=gsDefTitle)
     428            out << ", \"" << fTitle << "\"";
     429    }
     430    out << ");" << endl;
     431}
  • trunk/MagicSoft/Mars/manalysis/MSrcPosCam.cc

    r1483 r1487  
    4141ClassImp(MSrcPosCam);
    4242
     43static const TString gsDefName  = "MSrcPosCam";
     44static const TString gsDefTitle = "Virtual source position in the camera";
     45
    4346// --------------------------------------------------------------------------
    4447//
     
    4750MSrcPosCam::MSrcPosCam(const char *name, const char *title) : fX(0), fY(0)
    4851{
    49     fName  = name  ? name  : "MSrcPosCam";
    50     fTitle = title ? title : "Source position in the camera";
     52    fName  = name  ? name  : gsDefName.Data();
     53    fTitle = title ? title : gsDefTitle.Data();
    5154}
    5255
     
    9093void MSrcPosCam::StreamPrimitive(ofstream &out) const
    9194{
    92     out << "   MSrcPosCam " << GetUniqueName() << "(\"";
    93     out << fName << "\", \"" << fTitle << "\");" << endl;
     95    out << "   MSrcPosCam " << GetUniqueName();
     96    if (fName!=gsDefName)
     97    {
     98        out << "(\"" << fName << "\"";
     99        if (fTitle!=gsDefTitle)
     100            out << ", \"" << fTitle << "\"";
     101        out <<")";
     102    }
     103    out << ";" << endl;
    94104
    95105    out << "   " << GetUniqueName() << ".SetXY(" << fX << ", " << fY << ");" << endl;}
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r1483 r1487  
    9292//! Also we can derive MEvtLoop from MTaskList to have a static tasklist, too
    9393//!
     94
     95TList *gListOfPrimitives; // forard declaration in MParContainer.h
    9496
    9597// --------------------------------------------------------------------------
     
    346348
    347349    fout << "}" << endl;
     350
     351    *fLog << inf << "Macro '" << name << "' written." << endl;
    348352}
    349353
     
    365369        out << endl;
    366370    }
     371
     372    gListOfPrimitives = new TList;
    367373
    368374    if (fParList)
     
    376382    out << "   if (!evtloop.Eventloop())" << endl;
    377383    out << "      return;" << endl;
     384
     385    gListOfPrimitives->ForEach(TObject, ResetBit)(BIT(15));
     386    delete gListOfPrimitives;
     387    gListOfPrimitives = 0;
     388
     389    // remove all objects with BIT(15) set from gObjectTable
    378390}
    379391
     
    477489    HasDuplicateNames(list, "MEvtLoop::Read");
    478490
     491    *fLog << inf << "Eventloop '" << name << "' read from file." << endl;
     492
    479493    return n;
     494}
     495
     496// --------------------------------------------------------------------------
     497//
     498// If available print the contents of the parameter list.
     499//
     500void MEvtLoop::Print(Option_t *opt="") const
     501{
     502    if (fParList)
     503        fParList->Print();
     504    else
     505        *fLog << all << "MEvtloop: No Parameter List available." << endl;
    480506}
    481507
     
    530556    HasDuplicateNames(list, "MEvtLoop::Write");
    531557
     558    *fLog << inf << "Eventloop written to file as " << name << "." << endl;
     559
    532560    return n;
    533561}
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.h

    r1481 r1487  
    5353    void SavePrimitive(ofstream &out, Option_t *o="");
    5454
    55     Int_t Read(const char *name);
    56     Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0);
     55    Int_t Read(const char *name="Evtloop");
     56    Int_t Write(const char *name="Evtloop", Int_t option=0, Int_t bufsize=0);
     57
     58    void Print(Option_t *opt="") const;
    5759
    5860    ClassDef(MEvtLoop, 1) // Class to execute the tasks in a tasklist
    5961};
    6062
     63R__EXTERN TList *gListOfPrimitives; // instantiation in MEvtLoop
     64
    6165#endif
  • trunk/MagicSoft/Mars/mbase/MParContainer.cc

    r1483 r1487  
    5151#include "MLogManip.h"
    5252
     53#include "MEvtLoop.h"    // gListOfPrimitives
     54
    5355ClassImp(MParContainer);
    5456
     
    383385        return;
    384386
    385     SetUniqueID(uid++/*gRandom->Uniform(kMaxInt)*/);
     387    SetUniqueID(uid++);
     388    SetBit(kIsSavedAsPrimitive);
     389
     390    if (gListOfPrimitives && !gListOfPrimitives->FindObject(this))
     391        gListOfPrimitives->Add(this);
     392
    386393    StreamPrimitive(out);
    387     SetBit(kIsSavedAsPrimitive);
    388394}
    389395
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r1483 r1487  
    672672{
    673673    out << "   MParList " << GetUniqueName();
    674     if (fName!=gsDefName)
     674    if (fName!=gsDefName || fTitle!=gsDefTitle)
    675675    {
    676676        out << "(\"" << fName << "\"";
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r1483 r1487  
    525525{
    526526    out << "   MTaskList " << GetUniqueName();
    527     if (fName!=gsDefName)
     527    if (fName!=gsDefName || fTitle!=gsDefTitle)
    528528    {
    529529        out << "(\"" << fName << "\"";
  • trunk/MagicSoft/Mars/mhist/MBinning.cc

    r1484 r1487  
    120120{
    121121    out << "   MBinning " << GetUniqueName();
    122     if (fName!=gsDefName)
     122    if (fName!=gsDefName || fTitle!=gsDefTitle)
    123123    {
    124124        out << "(\"" << fName << "\"";
  • trunk/MagicSoft/Mars/mhist/MHHillas.cc

    r1465 r1487  
    148148    ApplyBinning(*plist, "Length", fLength);
    149149    ApplyBinning(*plist, "Dist",   fDistC);
    150     ApplyBinning(*plist, "Camera", fCenter);
    151150    ApplyBinning(*plist, "Delta",  fDelta);
    152151    ApplyBinning(*plist, "Size",   fSize);
     152
     153    const MBinning *bins = (MBinning*)plist->FindObject("BinningCamera");
     154    if (!bins)
     155        *fLog << warn << "Object 'BinningCamera' [MBinning] not found... no binning applied." << endl;
     156    else
     157        SetBinning(fCenter, bins, bins);
    153158
    154159    return kTRUE;
Note: See TracChangeset for help on using the changeset viewer.