Ignore:
Timestamp:
03/22/01 12:24:47 (24 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/manalysis
Files:
6 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h

    r695 r698  
    77#pragma link C++ class MCerPhotPix;
    88#pragma link C++ class MCerPhotEvt;
     9#pragma link C++ class MCerPhotCalc;
     10
     11#pragma link C++ class MImgCleanStd;
    912
    1013#pragma link C++ class MCT1ReadAscii;
     
    1316#pragma link C++ class MPedestalPix;
    1417#pragma link C++ class MPedestalCam;
     18#pragma link C++ class MMcPedestalCopy;
    1519
    1620#pragma link C++ class MHillas;
  • trunk/MagicSoft/Mars/manalysis/MCT1Pedestals.cc

    r654 r698  
    3434    // skip the next 4 values
    3535    //
    36     fin >> dummyF;
    37     fin >> dummyF;
    38     fin >> dummyF;
    39     fin >> dummyF;
     36    fin >> dummyF; 
     37    fin >> dummyF; 
     38    fin >> dummyF; 
     39    fin >> dummyF; 
    4040
    4141    //
  • trunk/MagicSoft/Mars/manalysis/MCT1ReadAscii.cc

    r656 r698  
    1010
    1111#include "MLog.h"
     12#include "MLogManip.h"
     13
    1214#include "MParList.h"
    1315#include "MCerPhotEvt.h"
     
    4143    if (!(*fIn))
    4244    {
    43         *fLog << "Error: MCT1ReadAscii::PreProcess: Cannot open file." << endl;
     45        *fLog << dbginf << "Cannot open file." << endl;
    4446        return kFALSE;
    4547    }
     
    4850    //  look for the MCerPhotEvt class in the plist
    4951    //
    50     fNphot = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
     52    fNphot = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt");
    5153    if (!fNphot)
    52     {
    53         *fLog << "MRawCT1Ascii::PreProcess - WARNING: MCerPhotEvt not found... creating." << endl;
    54         fNphot = new MCerPhotEvt;
    55         pList->AddToList(fNphot);
    56     }
     54        return kFALSE;
    5755
    5856    //
    5957    //  look for the pedestal class in the plist
    6058    //
    61     fPedest = (MCT1Pedestals*)pList->FindObject("MCT1Pedestals");
     59    fPedest = (MCT1Pedestals*)pList->FindCreateObj("MCT1Pedestals");
    6260    if (!fPedest)
    63     {
    64         *fLog << "MRawCT1Ascii::PreProcess - WARNING: MCT1Pedestals not found... creating." << endl;
    65         fPedest = new MCT1Pedestals;
    66         pList->AddToList(fPedest);
    67     }
     61        return kFALSE;
    6862
    6963    return kTRUE;
     
    7367{
    7468    //
     69    // FIXME. This function should switch between reading pedestals and
     70    // reading event data by the 'switch entry'.
     71    // After reading it should set the InputStreamID correctly.
     72    // ( should use MPedestalCam )
     73    //
     74 
     75    //
    7576    // read in a dummy number (event number)
    7677    //
     
    7879    *fIn >> dummyI;
    7980
     81    //
     82    // check if we are done
     83    //
    8084    if (fIn->eof())
    81     {
    82         *fLog << "MRawCT1Ascii::Process - Error: EOF reached." << endl;
    8385        return kFALSE;
    84     }
    8586
    8687    //
     
    9495    // five unsused numbers
    9596    //
    96     *fIn >> dummyI;
    97     *fIn >> dummyI;
    98     *fIn >> dummyI;
    99     *fIn >> dummyI;
     97    *fIn >> dummyI;   // ener
     98    *fIn >> dummyI;   // zenang
     99    *fIn >> dummyI;   // sec1
     100    *fIn >> dummyI;   // sec2
    100101
    101102    //
     
    110111    for (Int_t i = 0; i<127; i++ )
    111112    {
    112         Float_t dummyF;
     113        Float_t nphot;
    113114
    114         *fIn >> dummyF;
     115        *fIn >> nphot;
    115116
    116         if (dummyF > 0.0)
    117             fNphot->AddPixel(i, dummyF, (*fPedest)[i]);
     117        if (nphot > 0.0)
     118            fNphot->AddPixel(i, nphot, (*fPedest)[i]);
    118119    }
    119120
  • trunk/MagicSoft/Mars/manalysis/MCT1ReadAscii.h

    r653 r698  
    2626    Bool_t PostProcess();
    2727
    28     ClassDef(MCT1ReadAscii, 1)  // Reads the CT1 data file
     28    ClassDef(MCT1ReadAscii, 0)  // Reads the CT1 data file
    2929};
    3030
  • trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc

    r695 r698  
    4747}
    4848
    49 Int_t MCerPhotEvt::GetNumPixels()
    50 {
    51     return fNumPixels;
    52 }
    53 
    5449void MCerPhotEvt::AddPixel(Int_t id, Float_t nph, Float_t err)
    5550{
     
    5853    // of valid pixels in the list by one
    5954    //
    60     (*fPixels)[fNumPixels++] = new MCerPhotPix( id, nph, err);
     55
     56    // TClonesArray -> 'operator new with placement' should be used
     57    new ((*fPixels)[fNumPixels++]) MCerPhotPix( id, nph, err);
    6158}
    6259
     
    8380}
    8481
     82/*
    8583void MCerPhotEvt::CleanLevel1()
    8684{
     
    228226    }
    229227}
    230 
     228*/
    231229
    232230Bool_t MCerPhotEvt::IsPixelExisting(Int_t id)
     
    293291
    294292    Float_t testval;
    295     for (Int_t i=1 ; i<fNumPixels; i++ )
     293    for (UInt_t i=1 ; i<fNumPixels; i++ )
    296294    {
    297295        testval = (*this)[i].GetNumPhotons();
     
    315313
    316314    Float_t testval;
    317     for (Int_t i=1; i<fNumPixels; i++)
     315    for (UInt_t i=1; i<fNumPixels; i++)
    318316    {
    319317        testval = (*this)[i].GetNumPhotons();
  • trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h

    r695 r698  
    66#endif
    77#ifndef ROOT_TClonesArray
    8 #include "TClonesArray.h"
     8#include <TClonesArray.h>
    99#endif
    1010#ifndef MPARCONTAINER_H
     
    2121private:
    2222
    23     Int_t         fNumPixels;
     23    UInt_t         fNumPixels;
    2424    TClonesArray *fPixels;
    2525
     
    2727
    2828public:
    29   MCerPhotEvt(const char *name=NULL, const char *title=NULL) ;
     29    MCerPhotEvt(const char *name=NULL, const char *title=NULL) ;
     30    ~MCerPhotEvt() { delete fPixels; }
    3031
    3132  void Draw(Option_t* option = "" ) ;
    3233
    33   Int_t    GetNumPixels() ;
     34  UInt_t GetNumPixels() const { return fNumPixels; }
    3435
    3536  void AddPixel(Int_t id, Float_t nph, Float_t err );
     
    3940  void Print(Option_t *opt=NULL) ;
    4041
    41   void CleanLevel1() ;
    42   void CleanLevel2() ;
    43   void CleanLevel3() ;
     42  //  void CleanLevel1() ;
     43  //  void CleanLevel2() ;
     44  //  void CleanLevel3() ;
    4445 
    45   Bool_t  IsPixelExisting( Int_t id ) ;
    46   Bool_t  IsPixelUsed    ( Int_t id ) ;
    47   Bool_t  IsPixelCore    ( Int_t id ) ;
     46  Bool_t  IsPixelExisting( Int_t id );
     47  Bool_t  IsPixelUsed    ( Int_t id );
     48  Bool_t  IsPixelCore    ( Int_t id );
    4849 
    4950  Float_t GetNumPhotonsMin();
  • trunk/MagicSoft/Mars/manalysis/MHillas.cc

    r695 r698  
    7979    // calculate mean valu of pixels
    8080    //
    81     float xav =0;
    82     float yav =0;
    83     float spix=0;
     81    float xmean =0;
     82    float ymean =0;
     83
     84    fSize = 0;
    8485
    8586    for (UInt_t i=0; i<nevt; i++)
     
    9495        const float nphot = pix.GetNumPhotons();
    9596
    96         spix += nphot;
    97         xav  += nphot * gpix.GetX();
    98         yav  += nphot * gpix.GetY();
     97        fSize += nphot;
     98        xmean += nphot * gpix.GetX(); // [mm]
     99        ymean += nphot * gpix.GetY(); // [mm]
    99100    }
    100101
    101     xav /= spix;
    102     yav /= spix;
     102    xmean /= fSize; // [mm]
     103    ymean /= fSize; // [mm]
    103104
    104105    //
    105106    // calculate sdev
    106107    //
    107     float dis11=0;
    108     float dis12=0;
    109     float dis22=0;
     108    float sigmaxx=0;
     109    float sigmaxy=0;
     110    float sigmayy=0;
    110111
    111112    for (UInt_t i=0; i<nevt; i++)
     
    118119        const MGeomPix &gpix = geom[pix.GetPixId()];
    119120
    120         const float dx = gpix.GetX() - xav;
    121         const float dy = gpix.GetY() - yav;
     121        const float dx = gpix.GetX() - xmean;
     122        const float dy = gpix.GetY() - ymean;
    122123
    123124        const float nphot = pix.GetNumPhotons();
    124125
    125         dis11 += nphot * dx*dx;
    126         dis12 += nphot * dx*dy;
    127         dis22 += nphot * dy*dy;
     126        sigmaxx += nphot * dx*dx; // [mm^2]
     127        sigmaxy += nphot * dx*dy; // [mm^2]
     128        sigmayy += nphot * dy*dy; // [mm^2]
    128129    }
    129130
     
    131132    // check for orientation
    132133    //
    133     const float theta = atan(dis12/(dis11-dis22)*2)/2;
     134    const float theta = atan(sigmaxy/(sigmaxx-sigmayy)*2)/2;
    134135
    135     float c = cos(theta);
    136     float s = sin(theta);
     136    float c = cos(theta); // [1]
     137    float s = sin(theta); // [1]
    137138
    138     const float direction = c*xav+s*yav;
     139    const float direction = c*xmean + s*ymean;
    139140
    140141    if (direction<0)
     
    144145    }
    145146
    146     float rot1 =  2.0*c*s*dis12 + c*c*dis11 + s*s*dis22;
    147     float rot2 = -2.0*c*s*dis12 + s*s*dis11 + c*c*dis22;
     147    float axis1 =  2.0*c*s*sigmaxy + c*c*sigmaxx + s*s*sigmayy; // [mm^2]
     148    float axis2 = -2.0*c*s*sigmaxy + s*s*sigmaxx + c*c*sigmayy; // [mm^2]
    148149
    149     rot1 /= spix;
    150     rot2 /= spix;
     150    axis1 /= fSize; // [mm^2]
     151    axis2 /= fSize; // [mm^2]
    151152
    152153    //
    153154    // check for numerical negatives
    154155    //
    155     if (rot1 < 0) rot1=0;
    156     if (rot2 < 0) rot2=0;
     156    if (axis1 < 0) axis1=0;
     157    if (axis2 < 0) axis2=0;
    157158
    158159    //
    159160    // check the rotation of the axis
    160161    //
    161     const int rotation = rot1<rot2;
     162    const int rotation = axis1<axis2;
    162163
    163     fLength = rotation ? sqrt(rot2) : sqrt(rot1);
    164     fWidth  = rotation ? sqrt(rot1) : sqrt(rot2);
     164    fLength = rotation ? sqrt(axis2) : sqrt(axis1);      // [mm]
     165    fWidth  = rotation ? sqrt(axis1) : sqrt(axis2);      // [mm]
    165166
    166     fAlpha = 180/kPI*atan((-xav*s+yav*c)/direction);
     167    fAlpha = 180/kPI*atan((-xmean*s+ymean*c)/direction); // [deg]
    167168
    168     fDist  = sqrt(xav*xav + yav*yav);
     169    fDist  = sqrt(xmean*xmean + ymean*ymean);            // [mm]
    169170
    170     fTheta = atan(yav/xav);
    171     if (xav<0) fTheta += kPI;
     171    fTheta = atan(ymean/xmean);                          // [rad]
     172    if (xmean<0) fTheta += kPI;                          // [deg]
    172173}
  • trunk/MagicSoft/Mars/manalysis/MHillas.h

    r695 r698  
    3434    void Clear(Option_t *opt=NULL);
    3535
     36    Float_t GetAlpha() const  { return fAlpha; }
     37    Float_t GetWidth() const  { return fWidth; }
     38    Float_t GetLength() const { return fLength; }
     39    Float_t GetDist() const   { return fDist; }
     40
    3641    ClassDef(MHillas, 1) // Storage Container for Hillas Parameter
    3742};
  • trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc

    r695 r698  
    1818
    1919    fArray = new TClonesArray("MPedestalPix", 577);
     20
     21    //
     22    // TClonesArray: The 'new operator with placement' must be used
     23    //
     24    for (int i=0; i<577; i++)
     25        new ((*fArray)[i]) MPedestalPix;
    2026}
    2127
  • trunk/MagicSoft/Mars/manalysis/MPedestalCam.h

    r695 r698  
    2323    ~MPedestalCam();
    2424
     25    void InitSize(const UInt_t i) { fArray->ExpandCreateFast(i); }
     26
    2527    MPedestalPix &operator[](Int_t i) { return *(MPedestalPix*)fArray->At(i); }
    2628
  • trunk/MagicSoft/Mars/manalysis/MPedestalPix.h

    r695 r698  
    1717    MPedestalPix();
    1818
    19     Float_t GetMean()     { return fMean;     }
    20     Float_t GetSigma()    { return fSigma;    }
    21     Float_t GetMeanRms() { return fMeanRms;  }
    22     Float_t GetSigmaRms() { return fSigmaRms; }
     19    Float_t GetMean() const     { return fMean;     }
     20    Float_t GetSigma() const    { return fSigma;    }
     21    Float_t GetMeanRms() const { return fMeanRms;  }
     22    Float_t GetSigmaRms() const { return fSigmaRms; }
    2323
    2424    void SetMean(Float_t f)     { fMean = f;     }
     
    2727    void SetSigmaRms(Float_t f) { fSigmaRms = f; }
    2828
     29    void SetPedestal(Float_t m, Float_t s) { fMean = m; fSigma = s; }
     30    void SetPedestalRms(Float_t m, Float_t s) { fMeanRms = m; fSigmaRms = s; }
     31
    2932    ClassDef(MPedestalPix, 1)   // Storage Container for Pedestal information of one pixel
    3033};
  • trunk/MagicSoft/Mars/manalysis/Makefile

    r695 r698  
    2222#  connect the include files defined in the config.mk file
    2323#
    24 INCLUDES = -I. -I../mbase -I../mgui
     24INCLUDES = -I. -I../mbase -I../mgui -I../mmc -I../mraw
    2525
    2626#------------------------------------------------------------------------------
     
    3232           MPedestalCam.cc \
    3333           MPedestalPix.cc \
     34           MMcPedestalCopy.cc \
     35           MImgCleanStd.cc \
    3436           MHillas.cc \
    3537           MHillasCalc.cc \
     38           MCerPhotCalc.cc \
    3639           MCerPhotEvt.cc \
    3740           MCerPhotPix.cc
Note: See TracChangeset for help on using the changeset viewer.