Ignore:
Timestamp:
08/07/02 14:32:26 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/manalysis
Files:
6 edited

Legend:

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