Changeset 1466 for trunk/MagicSoft


Ignore:
Timestamp:
08/01/02 10:27:39 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1465 r1466  
    2525     - some changes to the layout
    2626     - added support for the sign in MHHillasExt
     27
     28   * manalysis/MBlindPixelCalc.[h,cc]:
     29     - added the possibility to use the interpolation of the
     30       surrounding pixels
     31     - clean the array with the blind pixel IDs at any ReInit
     32
     33   * manalysis/MBlindPixels.h:
     34     - IsBlind now checks also for the validity of the array
     35
     36   * manalysis/MCerPhotPix.h:
     37     - added Set-function
     38
     39   * manalysis/MHillas.cc:
     40     - Don't ouput a warning if fSize==0 or fNumUsedPixels<0
     41       (happens too often)
     42
     43   * manalysis/MCameraSmooth.[h,cc]:
     44     - added
     45
     46   * manalysis/Makefile, manalysis/AnalysisLinkDef.h:
     47     - added MCameraSmooth
    2748
    2849
  • trunk/MagicSoft/Mars/NEWS

    r1460 r1466  
    5959     MHillasExt are now scaled with the pixel size, so that one get
    6060     a four times smaller value for the bigger pixels in the outer ring.
     61
     62   - added new task to smooth the camera (MCameraSmooth)
     63
     64   - added possibility to use interpolated pixel values for blind pixels
     65     instead of removing it completely from the analysis
    6166
    6267
  • trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h

    r1426 r1466  
    77#pragma link C++ class MCerPhotPix+;
    88#pragma link C++ class MCerPhotEvt+;
     9#pragma link C++ class MCerPhotAnal+;
    910#pragma link C++ class MCerPhotCalc+;
    10 #pragma link C++ class MCerPhotAnal+;
    1111#pragma link C++ class MCerPhotCalc2+;
    1212
    1313#pragma link C++ class MImgCleanStd+;
     14#pragma link C++ class MCameraSmooth+;
    1415
    1516#pragma link C++ class MBlindPixels+;
  • trunk/MagicSoft/Mars/manalysis/MBlindPixelCalc.cc

    r1179 r1466  
    5151
    5252#include "MParList.h"
     53
     54#include "MGeomPix.h"
     55#include "MGeomCam.h"
    5356#include "MCerPhotPix.h"
    5457#include "MCerPhotEvt.h"
    5558#include "MBlindPixels.h"
     59
    5660#include "MMcRunHeader.hxx"
    5761
     
    6367//
    6468MBlindPixelCalc::MBlindPixelCalc(const char *name, const char *title)
    65 
     69    : fUseInterpolation(kFALSE), fUseCentralPixel(kFALSE)
    6670{
    6771    fName  = name  ? name  : "MBlindPixelCalc";
     
    8589    if (!fEvt)
    8690    {
    87         *fLog << dbginf << "MCerPhotEvt not found... aborting." << endl;
     91        *fLog << err << dbginf << "MCerPhotEvt not found... aborting." << endl;
    8892        return kFALSE;
    8993    }
     94
     95    fGeomCam = (MGeomCam*)pList->FindObject("MGeomCam");
     96    if (!fGeomCam)
     97        *fLog << warn << dbginf << "No camera geometry available... can't ude interpolation." << endl;
    9098
    9199    const UShort_t size = fPixelsID.GetSize();
     
    112120}
    113121
    114 
    115 // --------------------------------------------------------------------------
    116 //
    117 // Remove the pixels.
    118 //
    119 Bool_t MBlindPixelCalc::Process()
     122void MBlindPixelCalc::Interpolate() const
    120123{
    121124    const UShort_t entries = fEvt->GetNumPixels();
     125
     126    Double_t *nphot = new Double_t[entries];
     127    Double_t *perr  = new Double_t[entries];
    122128
    123129    //
     
    129135        MCerPhotPix &pix = (*fEvt)[i];
    130136
    131         if (fPixels->IsBlind(pix.GetPixId()))
     137        const Int_t id = pix.GetPixId();
     138
     139        if (!fPixels->IsBlind(id))
     140            continue;
     141
     142        const MGeomPix &gpix = (*fGeomCam)[id];
     143
     144        const Int_t n = gpix.GetNumNeighbors();
     145
     146        nphot[i] = fUseCentralPixel ? (*fEvt)[id].GetNumPhotons() : 0;
     147        perr[i]  = fUseCentralPixel ? (*fEvt)[id].GetErrorPhot()  : 0;
     148        for (int j=0; j<n; j++)
     149        {
     150            const UShort_t nid = gpix.GetNeighbor(j);
     151
     152            nphot[i] += (*fEvt)[nid].GetNumPhotons();
     153            perr[i]  += (*fEvt)[nid].GetErrorPhot();
     154        }
     155
     156        nphot[i] /= fUseCentralPixel ? n+1 : n;
     157        perr[i]  /= fUseCentralPixel ? n+1 : n;
     158    }
     159
     160    if (fUseInterpolation && fGeomCam)
     161        for (UShort_t i=0; i<entries; i++)
     162        {
     163            MCerPhotPix &pix = (*fEvt)[i];
     164
     165            if (fPixels->IsBlind(pix.GetPixId()))
     166                pix.Set(nphot[i], perr[i]);
     167        }
     168
     169    delete nphot;
     170    delete perr;
     171}
     172
     173void MBlindPixelCalc::Unmap() const
     174{
     175    const UShort_t entries = fEvt->GetNumPixels();
     176
     177    //
     178    // remove the pixels in fPixelsID if they are set to be used,
     179    // (set them to 'unused' state)
     180    //
     181    for (UShort_t i=0; i<entries; i++)
     182    {
     183        MCerPhotPix &pix = (*fEvt)[i];
     184
     185        if (fPixels->IsBlind(pix.GetPixId()))
    132186            pix.SetPixelUnused();
    133     }
     187
     188    }
     189}
     190
     191// --------------------------------------------------------------------------
     192//
     193// Remove the pixels.
     194//
     195Bool_t MBlindPixelCalc::Process()
     196{
     197    if (fUseInterpolation && fGeomCam)
     198        Interpolate();
     199    else
     200        Unmap();
    134201
    135202    return kTRUE;
     
    165232
    166233    //
     234    // Delete the old array holding the blind pixels for the last file
     235    //
     236    fPixels->Clear();
     237
     238    //
    167239    // Set as blind some particular pixels because of a particular
    168240    // Star Field of View.
     
    180252    {
    181253        *fLog << warn << "Warning - Detected Starfield unknown..." << endl;
    182         return kSKIP;
     254        return kTRUE;
    183255    }
    184256
     
    186258    // Case for Crab Nebula FOV
    187259    //
    188     fPixels->Clear();
    189260    fPixels->SetPixelBlind(400);
    190261    fPixels->SetPixelBlind(401);
  • trunk/MagicSoft/Mars/manalysis/MBlindPixelCalc.h

    r1179 r1466  
    1010#endif
    1111
     12class MGeomCam;
    1213class MCerPhotEvt;
    1314class MBlindPixels;
     
    1819    MCerPhotEvt  *fEvt;     //!
    1920    MBlindPixels *fPixels;  //!
     21    MGeomCam     *fGeomCam; //!
    2022
    2123    TArrayS fPixelsID;  // Pixel IDs for blind pixels, which are entered by the user.
    2224
     25    Bool_t fUseInterpolation;
     26    Bool_t fUseCentralPixel;
     27
     28    void Interpolate() const;
     29    void Unmap() const;
     30
    2331public:
    2432    MBlindPixelCalc(const char *name=NULL, const char *title=NULL);
     33
     34    void SetUseInterpolation(Bool_t b=kTRUE) { fUseInterpolation=kTRUE; }
     35    void SetUseCetralPixel(Bool_t b=kTRUE)   { fUseCentralPixel=kTRUE; }
    2536
    2637    Bool_t PreProcess(MParList *pList);
  • trunk/MagicSoft/Mars/manalysis/MBlindPixels.h

    r1180 r1466  
    2323    void Clear(Option_t *o="")  { fPixels.Reset(); }
    2424
    25     Bool_t IsBlind(UShort_t id) { return (Bool_t)fPixels[id]; }
     25    Bool_t IsBlind(UShort_t id) { return fPixels.GetSize() && fPixels[id]; }
    2626
    2727    ClassDef(MBlindPixels, 1) // container to store blind pixels
  • trunk/MagicSoft/Mars/manalysis/MCerPhotPix.h

    r1394 r1466  
    3737    Bool_t  IsPixelCore() const      { return fIsCore;  }
    3838
    39     void    SetNumPhotons(Float_t f) { fPhot    = f; }
    40     void    SetErrorPhot(Float_t f)  { fErrPhot = f; }
     39    void    SetNumPhotons(Float_t f)    { fPhot    = f; }
     40    void    SetErrorPhot(Float_t f)     { fErrPhot = f; }
     41    void    Set(Float_t np, Float_t ep) { fPhot = np; fErrPhot = ep; }
    4142
    4243    void    Print(Option_t *opt = NULL) const;
  • trunk/MagicSoft/Mars/manalysis/MHillas.cc

    r1465 r1466  
    279279    if (fSize==0)
    280280    {
    281         *fLog << warn << GetDescriptor() << ": Event has zero cerenkov photons... skipped." << endl;
     281        //*fLog << inf << GetDescriptor() << ": Event has zero cerenkov photons... skipped." << endl;
    282282        return kFALSE;
    283283    }
     
    285285    if (fNumUsedPixels<3)
    286286    {
    287         *fLog << warn << GetDescriptor() << ": Event has less than 3 used pixels... skipped." << endl;
     287        //*fLog << inf << GetDescriptor() << ": Event has less than 3 used pixels... skipped." << endl;
    288288        return kFALSE;
    289289    }
     
    327327    // If corrxy=0 (which should never happen, because fSize>0) we
    328328    // cannot calculate Length and Width. The calculation failed
    329     // and returnes kFALSE
     329    // and returns kFALSE
     330    // In reallity it is almost impossible to have a distribution
     331    // of cerenkov photons in the used pixels which is exactly symmetric
     332    // along one of the axis.
    330333    //
    331334    if (corrxy==0)
    332335    {
    333         *fLog << warn << GetDescriptor() << ": Event has CorrXY==0... skipped." << endl;
     336        *fLog << inf << GetDescriptor() << ": Event has CorrXY==0... skipped." << endl;
    334337        return kFALSE;
    335338    }
  • trunk/MagicSoft/Mars/manalysis/Makefile

    r1439 r1466  
    3737           MEnergyEstimate.cc \
    3838           MSrcPosCam.cc \
     39           MCameraSmooth.cc \
    3940           MHadroness.cc \
    4041           MCompProbCalc.cc \
Note: See TracChangeset for help on using the changeset viewer.