Changeset 2135 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
05/23/03 17:30:31 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 added
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2133 r2135  
    11                                                 -*-*- END OF LINE -*-*-
     2 2003/05/23: Thomas Bretz
     3
     4   * Makefile:
     5     - added mreflector
     6     
     7   * manalysis/MCerPhotAnal.cc, manalysis/MCerPhotCalc.cc:
     8     - use FixSize instead of InitSize
     9     
     10   * manalysis/MCerPhotEvt.[h,cc]:
     11     - replaced InitSize by FixSize (seems to be more logical)
     12     
     13   * manalysis/MMcPedestalNSBAdd.cc:
     14     - replaced GetR by GetPixRatio
     15
     16   * manalysis/MPedestalCam.cc:
     17     - replaced GetEntries by GetEntriesFast
     18     
     19   * mfileio/FileIOLinkDef.h, mfileio/Makefile:
     20     - added MReadRflFile
     21
     22   * mgeom/MGeomCam.[h,cc], mgeom/MGeomPix.[h,cc],
     23     mgeom/MGeomCamMagic.[h,cc]:
     24     - replaced R by D
     25
     26   * mgui/MCamDisplay.[h,cc]:
     27     - added TClonesArray to display reflector events
     28     - added FillRflEvent
     29     - added ShowRflEvent
     30     - adapted Paint function
     31     
     32   * mgui/MHexagon.[h,cc]:
     33     - replaced GetR by GetD
     34     - added DistanceToPrimitive (capital T)
     35     
     36   * mgui/Makefile:
     37     - added mreflector
     38
     39   * mfileio/MReadRflFile.[h,cc]:
     40     - added
     41
     42   * mreflector, mreflector/Makefile, mreflector/ReflectorLinkDef.h,
     43     mreflector/MRflEvtData.[h,cc], mreflector/MRflSinglePhoton.[h,cc]:
     44     - added
     45
     46
    247
    348 2003/05/22: Abelardo Moralejo
     
    1257       as well (in theta, phi or whatever).
    1358
     59
     60
    1461 2003/05/22: Wolfgang Wittek
    1562
     
    2067       original Theta is stored in the container "ThetaOrig"
    2168       the discretized Theta is stored in MMcEvt.fTelescopeTheta
     69
    2270
    2371
  • trunk/MagicSoft/Mars/Makefile

    r2071 r2135  
    3939          meventdisp \
    4040          mfileio \
     41          mreflector \
    4142          mhist \
    4243          mdatacheck \
  • trunk/MagicSoft/Mars/NEWS

    r2109 r2135  
    6565       + MHillasExt now derives from MParContainer instead of MHillas
    6666     --> Files written with the old definition are more or less unreadable
     67
     68   - implemented reading of reflector files
     69
     70   - implemented displaying data from reflectro files in the camera
    6771
    6872
  • trunk/MagicSoft/Mars/manalysis/MCerPhotAnal.cc

    r1557 r2135  
    118118Bool_t MCerPhotAnal::Process()
    119119{
    120     fCerPhotEvt->InitSize(fRawEvt->GetNumPixels());
     120    //fCerPhotEvt->InitSize(fRawEvt->GetNumPixels());
    121121
    122122    MRawEvtPixelIter pixel(fRawEvt);
     
    201201    }
    202202
     203    fCerPhotEvt->FixSize();
    203204    fCerPhotEvt->SetReadyToSave();
    204205
  • trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc

    r1965 r2135  
    164164Bool_t MCerPhotCalc::Process()
    165165{
    166     fCerPhotEvt->InitSize(fRawEvt->GetNumPixels());
     166    //fCerPhotEvt->InitSize(fRawEvt->GetNumPixels());
    167167
    168168    MRawEvtPixelIter pixel(fRawEvt);
     
    212212    }
    213213
     214    fCerPhotEvt->FixSize();
    214215    fCerPhotEvt->SetReadyToSave();
    215216
  • trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc

    r2052 r2135  
    7575{
    7676    fNumPixels = 0;
    77     fPixels->Delete();
     77    //fPixels->Delete();
     78}
     79
     80void MCerPhotEvt::FixSize()
     81{
     82    if (fPixels->GetEntriesFast() == (Int_t)fNumPixels)
     83        return;
     84
     85    fPixels->ExpandCreateFast(fNumPixels);
    7886}
    7987
  • trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h

    r2052 r2135  
    2323
    2424    UInt_t GetNumPixels() const { return fNumPixels; }
    25     void   InitSize(UInt_t num) { fPixels->Expand(num); }
     25    //void   InitSize(UInt_t num) { fPixels->Expand(num); }
    2626
    2727    void   AddPixel(Int_t id, Float_t nph, Float_t er)
     
    2929        new ((*fPixels)[fNumPixels++]) MCerPhotPix(id, nph, er);
    3030    }
     31
     32    void FixSize();
    3133
    3234    //Bool_t  AddEvent(const MCerPhotEvt &evt);
  • trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc

    r1965 r2135  
    209209    fPedCam->InitSize(num);
    210210
    211     const Float_t size0 = (*fGeom)[0].GetR() * (*fGeom)[0].GetR();
    212 
    213211    for (int i=0; i<num; i++)
    214212    {
    215         MPedestalPix   &pix     = (*fPedCam)[i];
    216         const MGeomPix &pixgeom = (*fGeom)[i];
     213        MPedestalPix &pix    = (*fPedCam)[i];
    217214
    218215        const Float_t pedrms = pix.GetSigma();
    219         const Float_t size   = pixgeom.GetR()*pixgeom.GetR()/size0;
    220 
     216        const Float_t ratio  = fGeom->GetPixRatio(i);
    221217        const Float_t ampl   = fFadc->GetAmplitud();
    222218
    223         pix.SetSigma(sqrt(pedrms*pedrms + dnsbpix*ampl*ampl*size));
     219        pix.SetSigma(sqrt(pedrms*pedrms + dnsbpix*ampl*ampl*ratio));
    224220    }
    225221
  • trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc

    r1544 r2135  
    8282Int_t MPedestalCam::GetSize() const
    8383{
    84     return fArray->GetEntries();
     84    return fArray->GetEntriesFast();
    8585}
    8686
  • trunk/MagicSoft/Mars/mgeom/MGeomCam.cc

    r2037 r2135  
    102102        const Float_t x = pix.GetX();
    103103        const Float_t y = pix.GetY();
    104         const Float_t r = pix.GetR();
     104        const Float_t d = pix.GetD();
    105105
    106         const Float_t maxr = sqrt(x*x+y*y) + r;
     106        const Float_t maxr = sqrt(x*x+y*y) + d;
    107107
    108108        if (maxr>fMaxRadius)
  • trunk/MagicSoft/Mars/mgeom/MGeomCam.h

    r1965 r2135  
    4242    MGeomPix &operator[](Int_t i) const { return *(MGeomPix*)fPixels->UncheckedAt(i); }
    4343
    44 
    45 
    4644    virtual void Print(Option_t *opt=NULL) const;
    4745
  • trunk/MagicSoft/Mars/mgeom/MGeomCamMagic.cc

    r2037 r2135  
    222222    };
    223223
    224     const Float_t rtemp[577] = {
     224    const Float_t dtemp[577] = {
    225225        30.00, 30.00, 30.00, 30.00, 30.00, 30.00, 30.00, 30.00,  //   0
    226226        30.00, 30.00, 30.00, 30.00, 30.00, 30.00, 30.00, 30.00,  //   8
     
    302302
    303303    for (UInt_t i=0; i<GetNumPixels(); i++)
    304         (*this)[i].Set(xtemp[i], ytemp[i], rtemp[i]) ;
     304        (*this)[i].Set(xtemp[i], ytemp[i], dtemp[i]) ;
    305305}
    306306
     
    892892    };
    893893
    894   for (Int_t i=0; i<577; i++)
    895       (*this)[i].SetNeighbors(nn[i][0], nn[i][1], nn[i][2],
    896                               nn[i][3], nn[i][4], nn[i][5]);
    897 
    898   InitOuterRing();
     894    for (Int_t i=0; i<577; i++)
     895        (*this)[i].SetNeighbors(nn[i][0], nn[i][1], nn[i][2],
     896                                nn[i][3], nn[i][4], nn[i][5]);
     897
     898    InitOuterRing();
    899899}
  • trunk/MagicSoft/Mars/mgeom/MGeomPix.cc

    r1640 r2135  
    5252// Initializes one pixel
    5353//
    54 MGeomPix::MGeomPix(Float_t x, Float_t y, Float_t r) : fX(x), fY(y), fR(r)
     54MGeomPix::MGeomPix(Float_t x, Float_t y, Float_t r) : fX(x), fY(y), fD(r)
    5555{
    5656    //  default constructor
     
    6363Float_t MGeomPix::GetA() const
    6464{
    65     return fR*fR*tan(60/kRad2Deg);
     65    return fD*fD*tan(60/kRad2Deg);
    6666}
    6767
     
    121121    *fLog << all << "MPixGeom:  x= " << fX
    122122        << "  y= " << fY
    123         << "  r= " << fR
     123        << "  d= " << fD
    124124        << endl ;
    125125}
  • trunk/MagicSoft/Mars/mgeom/MGeomPix.h

    r1459 r2135  
    2020    Float_t fX;  // [mm] the x coordinate of the center
    2121    Float_t fY;  // [mm] the y coordinate of the center
    22     Float_t fR;  // [mm] the r coordinate of the pixel (dist between two parallel sides)
     22    Float_t fD;  // [mm] the d coordinate of the pixel (dist between two parallel sides)
    2323
    2424    Byte_t  fNumNeighbors; // number of valid neighbors
     
    2626
    2727public:
    28     MGeomPix(Float_t x=0, Float_t y=0, Float_t r=0);
     28    MGeomPix(Float_t x=0, Float_t y=0, Float_t d=0);
    2929
    3030    void Print(Option_t *opt=NULL) const;
    3131
    32     void Set(Float_t x, Float_t y, Float_t r) { fX=x; fY=y; fR=r; }
     32    void Set(Float_t x, Float_t y, Float_t d) { fX=x; fY=y; fD=d; }
    3333
    3434    void SetNeighbors(Short_t i0=-1, Short_t i1=-1, Short_t i2=-1,
     
    3939    void SetX(Float_t x) { fX = x; }
    4040    void SetY(Float_t y) { fY = y; }
    41     void SetR(Float_t r) { fR = r; }
     41    void SetD(Float_t d) { fD = d; }
    4242
    4343    Float_t GetX() const  { return fX; }
    4444    Float_t GetY() const  { return fY; }
    45     Float_t GetR() const  { return fR; }
     45    Float_t GetD() const  { return fD; }
    4646
    4747    Float_t GetA() const;
  • trunk/MagicSoft/Mars/mgui/MCamDisplay.cc

    r2122 r2135  
    4141#include <TLatex.h>
    4242#include <TStyle.h>
     43#include <TMarker.h>
    4344#include <TCanvas.h>
     45#include <TArrayF.h>
    4446#include <TClonesArray.h>
    4547
     
    4850
    4951#include "MGeomCam.h"
     52
     53#include "MRflEvtData.h"
    5054
    5155#include "MCerPhotPix.h"
     
    99103    //    register BIT(8) as kNoContextMenu. If an object has this bit set it will
    100104    //    not get an automatic context menu when clicked with the right mouse button.
     105
     106    fPhotons = new TClonesArray("TMarker", 0);
    101107
    102108    //
     
    180186    fLegend->Delete();
    181187    fLegText->Delete();
     188    fPhotons->Delete();
    182189
    183190    delete fPixels;
    184191    delete fLegend;
    185192    delete fLegText;
     193    delete fPhotons;
    186194
    187195    delete fArrowX;
     
    322330
    323331    //
    324     // Paint primitives
    325     //
    326     for (UInt_t i=0; i<fNumPixels; i++)
    327         (*this)[i].Paint();
    328 
    329     for (Int_t i=0; i<kItemsLegend; i++)
    330     {
    331         GetBox(i)->Paint();
    332         GetText(i)->Paint();
    333     }
    334 
     332    // Paint Legend
     333    //
    335334    fArrowX->Paint(">");
    336335    fArrowY->Paint(">");
     
    338337    fLegRadius->Paint();
    339338    fLegDegree->Paint();
     339
     340    //
     341    // Paint primitives (pixels, color legend, photons, ...)
     342    //
     343    { fPixels->ForEach(TObject, Paint)(); }
     344    { fLegend->ForEach(TObject, Paint)(); }
     345    { fLegText->ForEach(TObject, Paint)(); }
     346    { fPhotons->ForEach(TObject, Paint)(); }
    340347}
    341348
     
    671678// ------------------------------------------------------------------------
    672679//
     680// Show a reflector event. EMarkerStyle is defined in root/include/Gtypes.h
     681// To remove the photons from the display call FillRflEvent(NULL)
     682//
     683void MCamDisplay::ShowRflEvent(const MRflEvtData *event, EMarkerStyle ms)
     684{
     685    const Int_t num = event ? event->GetNumPhotons() : 0;
     686
     687    fPhotons->ExpandCreate(num);
     688    if (num < 1)
     689        return;
     690
     691    Int_t i=num-1;
     692    do
     693    {
     694        const MRflSinglePhoton &ph = event->GetPhoton(i);
     695        TMarker &m = (TMarker&)*fPhotons->UncheckedAt(i);
     696        m.SetX(ph.GetX());
     697        m.SetY(ph.GetY());
     698        m.SetMarkerStyle(ms);
     699    } while (i--);
     700}
     701
     702// ------------------------------------------------------------------------
     703//
     704// Fill a reflector event. Sums all pixels in each pixel as the
     705// pixel contents.
     706//
     707// WARNING: Due to the estimation in DistanceToPrimitive and the
     708//          calculation in pixels instead of x, y this is only a
     709//          rough estimate.
     710//
     711void MCamDisplay::FillRflEvent(const MRflEvtData &event)
     712{
     713    //
     714    // reset pixel colors to background color
     715    //
     716    Reset();
     717
     718    //
     719    // sum the photons content in each pixel
     720    //
     721    const Int_t entries = event.GetNumPhotons();
     722
     723    TArrayF arr(fNumPixels);
     724    for (Int_t i=0; i<entries; i++)
     725    {
     726        const MRflSinglePhoton &ph = event.GetPhoton(i);
     727
     728        UInt_t id;
     729        for (id=0; id<fNumPixels; id++)
     730        {
     731            if ((*this)[id].DistanceToPrimitive(ph.GetX(), ph.GetY())<0)
     732                break;
     733        }
     734        if (id==fNumPixels)
     735            continue;
     736
     737        arr[id] += 1;
     738    }
     739
     740    //
     741    // Scale with the area and determin maximum
     742    //
     743    Float_t max = 0;
     744    for (UInt_t id=0; id<fNumPixels; id++)
     745    {
     746        arr[id] *= fGeomCam->GetPixRatio(id);
     747        if (arr[id]>max)
     748            max = arr[id];
     749    }
     750
     751    //
     752    // Update legend
     753    //
     754    if (fAutoScale)
     755        UpdateLegend(0, max==0 ? 1 : max);
     756
     757    //
     758    // Set color of pixels
     759    //
     760    for (UInt_t id=0; id<fNumPixels; id++)
     761        if (arr[id]>0)
     762            (*this)[id].SetFillColor(GetColor(arr[id], 0, max));
     763}
     764
     765// ------------------------------------------------------------------------
     766//
    673767// Reset the all pixel colors to a default value
    674768//
  • trunk/MagicSoft/Mars/mgui/MCamDisplay.h

    r2109 r2135  
    44#ifndef MARS_MAGIC
    55#include "MAGIC.h"
     6#endif
     7#ifndef ROOT_Gtypes
     8#include <Gtypes.h>
    69#endif
    710#ifndef ROOT_TClonesArray
     
    1518class MGeomCam;
    1619class MHexagon;
     20class MRflEvtData;
    1721class MCerPhotEvt;
    1822class MCerPhotPix;
     
    4246    TClonesArray  *fLegend;      // array of all color bars
    4347    TClonesArray  *fLegText;     // array of all texts
    44 
     48    TClonesArray  *fPhotons;     // array of reflector photons
     49 
    4550    UInt_t         fW;           // Width of canvas
    4651    UInt_t         fH;           // Height of canvas
     
    7479    void FillLevels(const MCerPhotEvt &event, const MImgCleanStd &clean);
    7580    void FillPedestals(const MPedestalCam &event);
     81    void FillRflEvent(const MRflEvtData &event);
     82    void ShowRflEvent(const MRflEvtData *event=NULL, EMarkerStyle m=kFullDotMedium);
    7683
    7784    void DrawPixelNumbers();
  • trunk/MagicSoft/Mars/mgui/MHexagon.cc

    r1965 r2135  
    6767    fX = pix.GetX();
    6868    fY = pix.GetY();
    69     fD = pix.GetR();
     69    fD = pix.GetD();
    7070}
    7171
     
    139139    // comput the distance of hexagon center to pixel border
    140140    //
    141     const Double_t dx = fD * cosa / 2;
    142     const Double_t dy = fD * sina / 2;
     141    const Double_t dx = fD/2 * cosa;
     142    const Double_t dy = fD/2 * sina;
    143143
    144144    const Int_t pxborder = gPad->XtoAbsPixel(fX + dx);
     
    155155    //
    156156    return distborder < disthex ? (int)(disthex-distborder+1) : 0;
     157}
     158
     159// ------------------------------------------------------------------------
     160//
     161// compute the distance of a point (px,py) to the Hexagon in world
     162// coordinates. Return -1 if inside.
     163//
     164Float_t MHexagon::DistanceToPrimitive(Float_t px, Float_t py)
     165{
     166    //
     167    //  compute the distance of the Point to the center of the Hexagon
     168    //
     169    const Double_t dx = px-fX;
     170    const Double_t dy = py-fY;
     171
     172    const Double_t disthex = TMath::Sqrt(dx*dx + dy*dy);
     173
     174    //
     175    //  compute the distance from the border of Pixel
     176    //  here in the first implementation is just circle inside
     177    //
     178    return fD*0.5772 < disthex ? disthex-fD*0.5772 : -1;
    157179}
    158180
  • trunk/MagicSoft/Mars/mgui/MHexagon.h

    r1880 r2135  
    5050        ;
    5151
    52     virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
     52    virtual Int_t   DistancetoPrimitive(Int_t px, Int_t py);
     53    virtual Float_t DistanceToPrimitive(Float_t px, Float_t py);
    5354    virtual void  DrawHexagon(Float_t x, Float_t y, Float_t d);
    5455
  • trunk/MagicSoft/Mars/mgui/Makefile

    r1965 r2135  
    2222#  connect the include files defined in the config.mk file
    2323#
    24 INCLUDES = -I. -I../mbase -I../mgeom -I../manalysis -I../mimage -I../mhist
     24INCLUDES = -I. -I../mbase -I../mgeom -I../manalysis -I../mimage -I../mhist \
     25           -I../mreflector
    2526
    2627#------------------------------------------------------------------------------
  • trunk/MagicSoft/Mars/mreflector/MRflEvtData.cc

    r2134 r2135  
     1/* ======================================================================== *\
     2!
     3! *
     4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
     5! * Software. It is distributed to you in the hope that it can be a useful
     6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
     7! * It is distributed WITHOUT ANY WARRANTY.
     8! *
     9! * Permission to use, copy, modify and distribute this software and its
     10! * documentation for any purpose is hereby granted without fee,
     11! * provided that the above copyright notice appear in all copies and
     12! * that both that copyright notice and this permission notice appear
     13! * in supporting documentation. It is provided "as is" without express
     14! * or implied warranty.
     15! *
     16!
     17!
     18!   Author(s): Thomas Bretz, 5/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2003
     21!
     22!
     23\* ======================================================================== */
     24
     25/////////////////////////////////////////////////////////////////////////////
     26//
     27// MRflEvtData
     28//
     29// All Photons of a event from the reflector program
     30//
     31// Should be filled like this:
     32//   MRflEvtData evt;
     33//   evt.Reset();
     34//   for (int i=0; i<10; i++)
     35//      MRflSinglePhoton &ph = evt.GetNewPhoton();
     36//   evt.FixSize();
     37//
     38/////////////////////////////////////////////////////////////////////////////
    139#include "MRflEvtData.h"
    240
     
    1755}
    1856
     57// --------------------------------------------------------------------------
     58//
     59// Dump informations off all photons
     60//
    1961void MRflEvtData::Print(Option_t *o="") const
    2062{
     
    2365}
    2466
     67// --------------------------------------------------------------------------
     68//
     69// Add a new photon to the list
     70//
    2571MRflSinglePhoton &MRflEvtData::GetNewPhoton()
    2672{
     
    3177}
    3278
     79// --------------------------------------------------------------------------
     80//
     81// If you have added all photon fix the size of the container.
     82//
    3383void MRflEvtData::FixSize()
    3484{
  • trunk/MagicSoft/Mars/mreflector/MRflEvtData.h

    r2134 r2135  
    2828
    2929    void Print(Option_t *o="") const;
    30     ClassDef(MRflEvtData, 0)
     30
     31    ClassDef(MRflEvtData, 0) // All Photons of a event from the reflector program
    3132};
    3233
  • trunk/MagicSoft/Mars/mreflector/MRflSinglePhoton.cc

    r2134 r2135  
     1/* ======================================================================== *\
     2!
     3! *
     4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
     5! * Software. It is distributed to you in the hope that it can be a useful
     6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
     7! * It is distributed WITHOUT ANY WARRANTY.
     8! *
     9! * Permission to use, copy, modify and distribute this software and its
     10! * documentation for any purpose is hereby granted without fee,
     11! * provided that the above copyright notice appear in all copies and
     12! * that both that copyright notice and this permission notice appear
     13! * in supporting documentation. It is provided "as is" without express
     14! * or implied warranty.
     15! *
     16!
     17!
     18!   Author(s): Thomas Bretz, 5/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2003
     21!
     22!
     23\* ======================================================================== */
     24
     25/////////////////////////////////////////////////////////////////////////////
     26//
     27// MRflSinglePhoton
     28//
     29// Single Photon of a event from the reflector program
     30//
     31/////////////////////////////////////////////////////////////////////////////
    132#include "MRflSinglePhoton.h"
    233
     
    637ClassImp(MRflSinglePhoton);
    738
     39// --------------------------------------------------------------------------
     40//
     41// Dump all photon information
     42//
    843void MRflSinglePhoton::Print(Option_t *o="") const
    944{
  • trunk/MagicSoft/Mars/mreflector/MRflSinglePhoton.h

    r2134 r2135  
    2828    void Print(Option_t *o="") const;
    2929
    30     ClassDef(MRflSinglePhoton, 0)
     30    ClassDef(MRflSinglePhoton, 0) // Single Photon of a event from the reflector program
     31
    3132};
    3233
Note: See TracChangeset for help on using the changeset viewer.