Changeset 716


Ignore:
Timestamp:
04/02/01 15:08:48 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r715 r716  
    22
    33 2000/04/02: Thomas Bretz
     4 
     5   * mraw/MRawEvtHeader.h, mraw/MRawFileWrite.cc:
     6     - added constants (kTT*) for trigger type
     7   
     8   * manalysis/MImgCleanStd.[h,cc]:
     9     - added changeable cleaning levels
     10 
     11   * manalysis/MHillas.cc:
     12     - added some more sanity checks to the calculation
     13     
     14   * manalysis/MCT1ReadAscii.[h,cc]:
     15     - added some kind of chain feature (AddFile) to process more than one file
    416 
    517   * mgui/MGeomPix.[h,c]:
  • trunk/MagicSoft/Mars/Makefile.conf.general

    r574 r716  
    33#
    44
     5ROOTVER    =  `root-config --version`
    56ROOTLIBS   =  `root-config --libs`
    67ROOTGLIBS  =  `root-config --glibs`
     
    1112#
    1213
    13 DEFINES   = -D__MARS__
     14DEFINES   = -D__MARS__ -DROOTVER=\"$(ROOTVER)\"
    1415
    1516CXXFLAGS  = $(ROOTCFLAGS) $(INCLUDES) $(OPTIM) $(DEBUG) $(DEFINES)
  • trunk/MagicSoft/Mars/macros/CT1Hillas.C

    r710 r716  
    4040    //  4) fill the hillas into the histograms
    4141    //
    42     MCT1ReadAscii read("CT1_97_on1.dat") ;
     42    MCT1ReadAscii read;
     43    read.AddFile("CT1_99_off1.dat");
     44    read.AddFile("CT1_99_off2.dat");
     45
    4346    MImgCleanStd  clean;
    4447    MHillasCalc   hcalc;
  • trunk/MagicSoft/Mars/macros/readCT1.C

    r710 r716  
    4242
    4343        clean.Process();
    44         hcalc.Process();
     44
     45        if (hcalc.Process()==kCONTINUE)
     46        {
     47            cout << "skipped." << endl;
     48            continue;
     49        }
    4550
    4651        hillas.Print();
  • trunk/MagicSoft/Mars/manalysis/MCT1ReadAscii.cc

    r705 r716  
    99#include <fstream.h>
    1010
     11#include <TArrayC.h>
     12
    1113#include "MLog.h"
    1214#include "MLogManip.h"
     
    2830    // remember file name for opening the file in the preprocessor
    2931    //
    30     fFileName = fname;
     32    fFileNames = new TArrayC;
     33    if (fname)
     34        AddFile(fname);
     35}
     36
     37MCT1ReadAscii::~MCT1ReadAscii()
     38{
     39    delete fFileNames;
     40    if (fIn)
     41        delete fIn;
     42}
     43
     44void MCT1ReadAscii::AddFile(const char *txt)
     45{
     46    //
     47    // Add this file as the last entry in the chain
     48    //
     49    const int   sz  = fFileNames->GetSize();
     50    const int   tsz = strlen(txt)+1;
     51
     52    fFileNames->Set(sz+tsz);
     53
     54    memcpy(fFileNames->GetArray()+sz, txt, tsz);
     55}
     56
     57Bool_t MCT1ReadAscii::OpenNextFile()
     58{
     59    //
     60    // open the input stream and check if it is really open (file exists?)
     61    //
     62    if (fIn)
     63        delete fIn;
     64    fIn = NULL;
     65
     66    const int arrsz = fFileNames->GetSize();
     67
     68    if (arrsz<1)
     69        return kFALSE;
     70
     71    //
     72    // open the file which is the first one in the chain
     73    //
     74    const char *name = fFileNames->GetArray();
     75
     76    fIn = new ifstream(name);
     77    if (!(*fIn))
     78    {
     79        *fLog << dbginf << "Cannot open file '" << name << "'" << endl;
     80        return kFALSE;
     81    }
     82
     83    //
     84    // remove the first entry from the chain
     85    //
     86    *fLog << "Open file: '" << name << "'" << endl;
     87
     88    //
     89    // create the new char array containing the filenames to process
     90    //
     91    const int sz  = strlen(name)+1;
     92
     93    char *dummy = new char[arrsz-sz];
     94    memcpy(dummy, name+sz, arrsz-sz);
     95
     96    //
     97    // dummy will be deleted by the destructor of fFileNames
     98    //
     99    fFileNames->Adopt(arrsz-sz, dummy);
     100
     101    return kTRUE;
     102
    31103}
    32104
     
    38110
    39111    //
    40     // open the input stream and check if it is really open (file exists?)
    41     //
    42     fIn = new ifstream(fFileName);
    43     if (!(*fIn))
    44     {
    45         *fLog << dbginf << "Cannot open file." << endl;
    46         return kFALSE;
    47     }
     112    // Try to open at least one (the first) file
     113    //
     114    if (!OpenNextFile())
     115        return kFALSE;
    48116
    49117    //
     
    141209
    142210    //
    143     // check if we are done
     211    // check if we are done. Try to open the next file in chain.
     212    // If it was possible start reading. If not break the event loop
    144213    //
    145214    if (fIn->eof())
    146         return kFALSE;
     215        return OpenNextFile() ? kCONTINUE : kFALSE;
    147216
    148217    //
     
    163232}
    164233
    165 Bool_t MCT1ReadAscii::PostProcess()
    166 {
    167     //
    168     // close and delete the input stream
    169     //
    170     delete fIn;
    171 
    172     return kTRUE;
    173 }
    174 
  • trunk/MagicSoft/Mars/manalysis/MCT1ReadAscii.h

    r705 r716  
    66#endif
    77
     8class TArrayC;
    89class MCerPhotEvt;
    910class MPedestalCam;
     
    1213{
    1314private:
    14     TString       fFileName;    //! the file name of the string
    15     ifstream     *fIn;          //! the inputfile
    16     MCerPhotEvt  *fNphot;       //! the data container for all data.
    17     MPedestalCam *fPedest;      //! ct1 pedestals
     15    TString       fFileName;    // the file name of the string
     16    ifstream     *fIn;          // the inputfile
     17    MCerPhotEvt  *fNphot;       // the data container for all data.
     18    MPedestalCam *fPedest;      // ct1 pedestals
     19    TArrayC      *fFileNames;   // Array which stores the \0-terminated filenames
     20
     21    Bool_t OpenNextFile();
    1822
    1923    void ReadPedestals();
     
    2125
    2226public:
    23     MCT1ReadAscii(const char *filename,
     27    MCT1ReadAscii(const char *filename=NULL,
    2428                  const char *name=NULL,
    2529                  const char *title=NULL);
    2630
     31    ~MCT1ReadAscii();
     32
     33    void AddFile(const char *fname);
     34
    2735    Bool_t PreProcess(MParList *pList);
    2836    Bool_t Process();
    29     Bool_t PostProcess();
    3037
    3138    ClassDef(MCT1ReadAscii, 0)  // Reads the CT1 data file
  • trunk/MagicSoft/Mars/manalysis/MHillas.cc

    r713 r716  
    9999Bool_t MHillas::Calc(MGeomCam &geom, MCerPhotEvt &evt)
    100100{
     101    //
     102    // Calculate the Hillas parameters from a cerenkov photon event
     103    // (The calcualtion is some kind of two dimentional statistics)
     104    //
     105
    101106    const UInt_t nevt = evt.GetNumPixels();
    102107
     
    104109    // sanity check
    105110    //
    106     if (nevt<2)
     111    if (nevt <= 2)
    107112        return kFALSE;
    108113
     
    115120    fSize = 0;
    116121
     122    //
     123    // FIXME! npix should be retrieved from MCerPhotEvt
     124    //
     125    UShort_t npix=0;
    117126    for (UInt_t i=0; i<nevt; i++)
    118127    {
     
    129138        xmean += nphot * gpix.GetX(); // [mm]
    130139        ymean += nphot * gpix.GetY(); // [mm]
     140
     141        npix++;
    131142    }
     143
     144    //
     145    // sanity check
     146    //
     147    if (fSize==0 || npix<=2)
     148        return kFALSE;
    132149
    133150    xmean /= fSize; // [mm]
  • trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc

    r715 r716  
    1111ClassImp(MImgCleanStd)
    1212
    13 MImgCleanStd::MImgCleanStd(const char *name, const char *title)
     13MImgCleanStd::MImgCleanStd(const Float_t lvl1, const Float_t lvl2,
     14                           const char *name, const char *title)
     15    : fCleanLvl1(lvl1), fCleanLvl2(lvl2)
    1416{
    1517    //
     
    1820 
    1921    *fName  = name  ? name  : "MImgCleanStd";
    20     *fTitle = name  ? name : "Task which does a standard image cleaning";
    21 }
    22 
    23 void MImgCleanStd::CleanLevel1()
     22    *fTitle = title ? title : "Task which does a standard image cleaning";
     23}
     24
     25void MImgCleanStd::CleanStep1()
    2426{
    2527    //
    2628    //  This method looks for all pixels with an entry (photons)
    2729    //  that is three times bigger than the noise of the pixel
     30    //  (std: 3 sigma, clean level 1)
    2831    //
    2932
     
    4144        const Float_t noise = pix.GetErrorPhot();
    4245
    43         if (entry < 3 * noise )
     46        if (entry < fCleanLvl1 * noise )
    4447            pix.SetPixelUnused();
    4548    }
    4649}
    4750
    48 void MImgCleanStd::CleanLevel2()
     51void MImgCleanStd::CleanStep2()
    4952{
    5053    //
     
    113116}
    114117
    115 void MImgCleanStd::CleanLevel3()
     118void MImgCleanStd::CleanStep3()
    116119{
    117120    //
    118121    //   Look for the boundary pixels around the core pixels
    119     //   if a pixel has more than 2.5 sigma, and a core neigbor
    120     //   it is declared as used.
     122    //   if a pixel has more than 2.5 (clean level 2) sigma, and
     123    //   a core neigbor it is declared as used.
    121124    //
    122125    const Int_t entries = fEvt->GetNumPixels();
     
    141144        const Float_t noise = pix.GetErrorPhot();
    142145
    143         if (entry <= 2.5 * noise )
     146        if (entry <= fCleanLvl2 * noise )
    144147            continue;
    145148
     
    198201Bool_t MImgCleanStd::Process()
    199202{
    200     CleanLevel1();
    201     CleanLevel2();
    202     CleanLevel3();
     203    CleanStep1();
     204    CleanStep2();
     205    CleanStep3();
    203206
    204207    return kTRUE;
  • trunk/MagicSoft/Mars/manalysis/MImgCleanStd.h

    r715 r716  
    1818    MCerPhotEvt *fEvt;
    1919
     20    Float_t fCleanLvl1;
     21    Float_t fCleanLvl2;
     22
    2023public:
    21     MImgCleanStd(const char *name=NULL, const char *title=NULL) ;
     24    MImgCleanStd(const Float_t lvl1=3.0, const Float_t lvl2=2.5,
     25                 const char *name=NULL, const char *title=NULL);
    2226
    23     void CleanLevel1();
    24     void CleanLevel2();
    25     void CleanLevel3();
     27    void CleanStep1();
     28    void CleanStep2();
     29    void CleanStep3();
    2630
    2731    Bool_t PreProcess (MParList *pList);
  • trunk/MagicSoft/Mars/merpp.cc

    r654 r716  
    3737    gLog << "      MARS Merging and Preprocessing Program" << endl ;
    3838    gLog << "            Compiled on <" << __DATE__ << ">" << endl ;
     39    gLog << "               Using ROOT v" << ROOTVER << endl ;
    3940    gLog << "==================================================" << endl ;
    4041    gLog << endl;
  • trunk/MagicSoft/Mars/mraw/MRawEvtHeader.h

    r654 r716  
    1010class MArrayB;
    1111class MRawRunHeader;
     12
     13//
     14// Trigger Typed (TT)
     15//
     16enum {
     17    kTTEvent       = 0,
     18    kTTPedestal    = 1,
     19    kTTCalibration = 2
     20};
    1221
    1322class MRawEvtHeader : public MParContainer
     
    2736
    2837    //
    29     // Informations only needed to read the raw file
     38    // Informations only needed to read the raw file correctly
    3039    //
    3140    UShort_t fTrigType;        //! Trigger Type of this event
  • trunk/MagicSoft/Mars/mraw/MRawFileWrite.cc

    r609 r716  
    1515
    1616#include "MLog.h"
     17#include "MLogManip.h"
     18
    1719#include "MParList.h"
    1820#include "MRawRunHeader.h"
     
    142144    switch (type)
    143145    {
    144     case 0:
     146    case kTTEvent:
    145147        fTData->Fill();
    146         break;
    147     case 1:
     148        return kTRUE;
     149
     150    case kTTPedestal:
    148151        fTPedestal->Fill();
    149         break;
    150     case 2:
     152        return kTRUE;
     153
     154    case kTTCalibration:
    151155        fTCalibration->Fill();
    152         break;
     156        return kTRUE;
    153157    }
    154158
    155     return kTRUE;
     159    *fLog << dbginf << "Got wrong number for the trigger type: " << type;
     160    *fLog << "  - skipping" << endl;
     161
     162    return kCONTINUE;
    156163}
    157164
Note: See TracChangeset for help on using the changeset viewer.