Changeset 2675 for trunk


Ignore:
Timestamp:
12/15/03 16:27:25 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2674 r2675  
    44
    55                                                 -*-*- END OF LINE -*-*-
     6
     7 2003/12/15: Thomas Bretz
     8
     9   * mraw/MRawRead.[h,cc]:
     10     - added
     11
     12   * mraw/Makefile, mraw/RawLinkDef.h:
     13     - added MRawRead
     14
     15   * mraw/MRawSocketRead.[h,cc], mraw/MRawFileRead.[h,cc]:
     16     - changed such, that it derives from MRawRead now
     17
     18
    619
    720 2003/12/15: Abelardo Moralejo
     
    1629       initialized.
    1730
     31
     32
    1833 2003/12/12: Markus Gaug / Michele Doro
    1934
     
    2136     - did not compile because of a wrong command to MCalibrationPix,
    2237       now corrected
     38
    2339
    2440
  • trunk/MagicSoft/Mars/mraw/MRawFileRead.cc

    r2645 r2675  
    142142    }
    143143
    144     //
    145     //  check if all necessary containers exist in the Parameter list.
    146     //  if not create one and add them to the list
    147     //
    148     fRawRunHeader = (MRawRunHeader*)pList->FindCreateObj("MRawRunHeader");
    149     if (!fRawRunHeader)
     144    if (!MRawRead::PreProcess(pList))
    150145        return kFALSE;
    151 
    152     fRawEvtHeader = (MRawEvtHeader*)pList->FindCreateObj("MRawEvtHeader");
    153     if (!fRawEvtHeader)
    154         return kFALSE;
    155 
    156     fRawEvtData = (MRawEvtData*)pList->FindCreateObj("MRawEvtData");
    157     if (!fRawEvtData)
    158         return kFALSE;
    159 
    160     fRawCrateArray = (MRawCrateArray*)pList->FindCreateObj("MRawCrateArray");
    161     if (!fRawCrateArray)
    162         return kFALSE;
    163 
    164     fRawEvtTime = (MTime*)pList->FindCreateObj("MTime");
    165     if (!fRawEvtTime)
    166         return kTRUE;
    167146
    168147    //
     
    172151    fRawRunHeader->Print();
    173152
    174     if (fRawRunHeader->GetMagicNumber()!=kMagicNumber)
    175         return kFALSE;
    176 
    177     //
    178     // Give the run header information to the 'sub-classes'
    179     //
    180     fRawEvtHeader->Init(fRawRunHeader, fRawEvtTime);
    181     fRawEvtData  ->Init(fRawRunHeader, fRawCrateArray);
    182 
    183     return kTRUE;
     153    return fRawRunHeader->GetMagicNumber()==kMagicNumber;
    184154}
    185155
     
    194164Int_t MRawFileRead::Process()
    195165{
    196     //
    197     //  Read in the next EVENT HEADER (see specification),
    198     // if there is no next event anymore stop eventloop
    199     //
    200     if (!fRawEvtHeader->ReadEvt(*fIn))
    201         return kFALSE;
    202 
    203     //
    204     //  Get number of crates from the run header
    205     //
    206     const UShort_t nc = fRawRunHeader->GetNumCrates();
    207 
    208     //
    209     // Delete arrays which stores the pixel information (time slices)
    210     //
    211     fRawEvtData->ResetPixels();
    212 
    213     //
    214     // clear the TClonesArray which stores the Crate Information
    215     // and create a new array of the correct size
    216     //
    217     fRawCrateArray->SetSize(nc);
    218 
    219     //
    220     //  Get file format version
    221     //
    222     const UShort_t ver = fRawRunHeader->GetFormatVersion();
    223 
    224     //
    225     // read the CRATE DATA (see specification) from file
    226     //
    227     for (int i=0; i<nc; i++)
    228     {
    229         fRawCrateArray->GetEntry(i)->ReadEvt(*fIn, ver);
    230         if (!*fIn)
    231             return kFALSE;
    232 
    233         fRawEvtData->ReadEvt(*fIn);
    234         if (!*fIn)
    235             return kFALSE;
    236     }
    237 
    238     {
    239         // FIXME This is a stupid workaround for the missing time stamp!
    240         //       Might be used depending on the run number in the future
    241         static Double_t tm = 0; // Range of roughly 8min
    242         const UInt_t ct = (*fRawCrateArray)[0]->GetFADCClockTick();
    243 
    244         tm = ct<tm ? fmod(tm, (UInt_t)(-1))+(UInt_t)(-1)+ct : ct;
    245 
    246         const Double_t mhz = 9.375;                        // [1e6 ticks/s]
    247         const Double_t t   = tm/mhz;                       // [us]
    248         const UInt_t ns    = (UInt_t)fmod(t*1e3, 1e6);
    249         const UShort_t ms  = (UShort_t)fmod(t/1e3, 1e3);
    250         const Byte_t s     = (Byte_t)fmod(t/1e6, 60);
    251 
    252         // Create an artificial time stamp!
    253         UInt_t m = (Byte_t)fmod(t/60e6, 60);
    254         //const Byte_t h     = (Byte_t)(t/3600e6);
    255         m += fRawRunHeader->GetRunNumber()*10;
    256         m %= 360; // 6h
    257 
    258         fRawEvtTime->Set(fRawRunHeader->GetRunStart().Year(),
    259                          fRawRunHeader->GetRunStart().Month(),
    260                          fRawRunHeader->GetRunStart().Day(),
    261                          m/60, m%60, s, ms, ns);
    262     }
    263 
    264     return kTRUE;
     166    return ReadEvent(*fIn);
    265167}
    266168
  • trunk/MagicSoft/Mars/mraw/MRawFileRead.h

    r2636 r2675  
    22#define MARS_MRawFileRead
    33
    4 #ifndef MARS_MTask
    5 #include "MTask.h"
     4#ifndef MARS_MRawRead
     5#include "MRawRead.h"
    66#endif
    77
    8 // gcc 3.2
    9 //class ifstream;
    10 #include <iosfwd>
    11 
    12 class MTime;
    13 class MParList;
    14 class MRawRunHeader;
    15 class MRawEvtHeader;
    16 class MRawEvtData;
    17 class MRawCrateArray;
    18 
    19 class MRawFileRead : public MTask
     8class MRawFileRead : public MRawRead
    209{
    2110private:
    22     MRawRunHeader  *fRawRunHeader;  // run header information container to fill from file
    23     MRawEvtHeader  *fRawEvtHeader;  // event header information container to fill from file
    24     MRawEvtData    *fRawEvtData;    // raw evt header infomation container to fill from file
    25     MRawCrateArray *fRawCrateArray; // crate information array container to fill from file
    26     MTime          *fRawEvtTime;    // raw evt time information container to fill from file
    27 
    28     TString         fFileName;
    29     ifstream       *fIn;            //! buffered input stream (file to read from)
     11    TString   fFileName;
     12    ifstream *fIn;        //! buffered input stream (file to read from)
    3013
    3114    Int_t PreProcess(MParList *pList);
  • trunk/MagicSoft/Mars/mraw/MRawSocketRead.cc

    r2645 r2675  
    160160        return kFALSE;
    161161
    162     //
    163     //  check if all necessary containers exist in the Parameter list.
    164     //  if not create one and add them to the list
    165     //
    166     fRawRunHeader = (MRawRunHeader*)pList->FindCreateObj("MRawRunHeader");
    167     if (!fRawRunHeader)
    168         return kFALSE;
    169 
    170     fRawEvtHeader = (MRawEvtHeader*)pList->FindCreateObj("MRawEvtHeader");
    171     if (!fRawEvtHeader)
    172         return kFALSE;
    173 
    174     fRawEvtData = (MRawEvtData*)pList->FindCreateObj("MRawEvtData");
    175     if (!fRawEvtData)
    176         return kFALSE;
    177 
    178     fRawCrateArray = (MRawCrateArray*)pList->FindCreateObj("MRawCrateArray");
    179     if (!fRawCrateArray)
    180         return kFALSE;
    181 
    182     fTime = (MTime*)pList->FindCreateObj("MTime");
    183     if (!fTime)
    184         return kTRUE;
     162    if (!MRawRead::PreProcess(pList))
     163        return kFALSE;
    185164
    186165    fParList = pList;
     
    273252    }
    274253
    275     //
    276     // Give the run header information to the 'sub-classes'
    277     //
    278     fRawEvtHeader->Init(fRawRunHeader, fTime);
    279     fRawEvtData  ->Init(fRawRunHeader, fRawCrateArray);
    280 
    281     //
    282     //  Read in the next EVENT HEADER (see specification),
    283     // if there is no next event anymore stop eventloop
    284     //
    285     if (!fRawEvtHeader->ReadEvt(*fIn))
    286         return kFALSE;
    287 
    288     //
    289     //  Get number of crates from the run header
    290     //
    291     const UShort_t nc = fRawRunHeader->GetNumCrates();
    292 
    293     //
    294     // Delete arrays which stores the pixel information (time slices)
    295     //
    296     fRawEvtData->ResetPixels();
    297 
    298     //
    299     // clear the TClonesArray which stores the Crate Information
    300     // and create a new array of the correct size
    301     //
    302     fRawCrateArray->SetSize(nc);
    303 
    304     //
    305     //  Get file format version
    306     //
    307     const UShort_t ver = fRawRunHeader->GetFormatVersion();
    308 
    309     //
    310     // read the CRATE DATA (see specification) from file
    311     //
    312     for (int i=0; i<nc; i++)
    313     {
    314         fRawCrateArray->GetEntry(i)->ReadEvt(*fIn, ver);
    315         if (!*fIn)
    316             return kFALSE;
    317 
    318         fRawEvtData->ReadEvt(*fIn);
    319         if (!*fIn)
    320             return kFALSE;
    321     }
     254    if (!ReadEvent(*fIn))
     255        return kFALSE;
    322256
    323257    //
  • trunk/MagicSoft/Mars/mraw/MRawSocketRead.h

    r2563 r2675  
    22#define MARS_MRawSocketRead
    33
    4 #ifndef MARS_MTask
    5 #include "MTask.h"
     4#ifndef MARS_MRawRead
     5#include "MRawRead.h"
    66#endif
    77
    8 class MTime;
    9 class MParList;
    108class MReadSocket;
    11 class MRawEvtData;
    12 class MRawEvtHeader;
    13 class MRawRunHeader;
    14 class MRawCrateArray;
    159
    16 class MRawSocketRead : public MTask
     10class MRawSocketRead : public MRawRead
    1711{
    1812private:
    19     MRawRunHeader  *fRawRunHeader;  // run header information container to fill from file
    20     MRawEvtHeader  *fRawEvtHeader;  // event header information container to fill from file
    21     MRawEvtData    *fRawEvtData;    // raw evt header infomation container to fill from file
    22     MRawCrateArray *fRawCrateArray; // crate information array container to fill from file
    23     MTime          *fTime;          // raw evt time information container to fill from file
     13    MReadSocket *fIn;         //! buffered input stream (file to read from)
     14    MParList    *fParList;    //!
    2415
    25     MReadSocket    *fIn;            //! buffered input stream (file to read from)
    26     MParList       *fParList;       //!
     16    UInt_t       fRunNumber;  //!
     17    UInt_t       fEvtNumber;  //!
    2718
    28     UInt_t          fRunNumber;     //!
    29     UInt_t          fEvtNumber;     //!
    30 
    31     Int_t           fPort;          // Port on which we wait for the connection
     19    Int_t        fPort;       // Port on which we wait for the connection
    3220
    3321    Bool_t OpenSocket();
    3422
    35     Int_t  PreProcess(MParList *pList);
    36     Int_t  Process();
    37     Int_t  PostProcess();
     23    Int_t PreProcess(MParList *pList);
     24    Int_t Process();
     25    Int_t PostProcess();
    3826
    3927public:
  • trunk/MagicSoft/Mars/mraw/Makefile

    r2636 r2675  
    3535           MRawCrateArray.cc \
    3636           MRawCrateData.cc \
     37           MRawRead.cc \
    3738           MRawFileWrite.cc \
    3839           MRawFileRead.cc \
  • trunk/MagicSoft/Mars/mraw/RawLinkDef.h

    r2386 r2675  
    1414#pragma link C++ class MRawCrateData+;
    1515
     16#pragma link C++ class MRawRead+;
    1617#pragma link C++ class MRawSocketRead+;
    1718#pragma link C++ class MRawFileRead+;
Note: See TracChangeset for help on using the changeset viewer.