fdhwlib  2.0.25
/home/kopmann/git-mirror/fdhwlib/fdhwlib/FEdata/tscampaign.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     tscampaign.h  -  description
00003 
00004     begin                : Sat Jun 2 2001
00005     copyright            : (C) 2001 by A Kopmann
00006     email                : kopmann@hpe.fzk.de
00007     status               :
00008     test                 :
00009     history              :
00010  ***************************************************************************/
00011 
00012 
00013 #ifndef TSCAMPAIGN_H
00014 #define TSCAMPAIGN_H
00015 
00016 
00017 #include <cstdio>
00018 
00019 #include <FEdata/tsdef.h>
00020 
00021 
00022 // HJMs DAQ data structure
00023 #ifdef USE_DAQ_FORMAT
00024 class TMirrorEvent;
00025 class TMirrorEventFile;
00026 class TEyeEvent;
00027 class TEyeEventFile;
00028 #endif
00029 
00030 #include <FEdata/tsevent.h>
00031 //class TsEvent;
00032 
00033 class Subrack;
00034 
00112 class TsCampaign {
00113 public: 
00114         TsCampaign();
00115         virtual ~TsCampaign();
00116 
00122    void setNextPageDelay(int delay);
00123 
00129    void setEyeNumber(int nr);
00130 
00137    void setMirrorNumber(int nr);
00138   
00139    int getMirrorNumber();
00140 
00141    bool isMirrorPresent(int nr);
00142 
00143    void setNumEvents(int nr);
00144 
00145    void setChannelsToRead(int nr);
00146 
00150    int getNumEvents();
00151 
00154    int getEventNumber();
00155 
00157    int getChannelsToRead();
00158 
00160    virtual TsEvent *getEvent();
00161 
00164    bool isFileOpen();
00165 
00167    bool isHwFormat();
00168 
00174    int openFile(const char *file, const char *mode=0);
00175 
00177    int openFile(Subrack *s);
00178 
00180    int loadEvent(char *file = 0, int nr = -1);
00181 
00182    void saveEvent();
00183 
00185    void closeFile();
00186 
00188    void readHeader();
00189 
00191    void saveHeader();
00192 
00193 
00195    void displayVersion(FILE *fout);
00196 
00197 
00201    void displayRunHeader(FILE *fout);
00202 
00203 
00217    void display(FILE *fout, int iFirst=0, int nEv=0, int firstBin=0, int nBins=1000, int mode=0);
00218 
00219 
00224    void dump(FILE *fout = stdout, int n = 0);
00225 
00232    int openAMFile(const char *fname, const char *mode=0);
00233 
00236    void closeAMFile();
00237 
00245    void readAMHeader();
00246 
00248    void saveAMHeader();
00249 
00261    int loadAMEvent(char *fname=0);
00262 
00265    int saveAMEvent();
00266 
00267 
00268 
00269 #ifdef USE_DAQ_FORMAT
00270 
00274    int saveDaqFile(char *fname);
00275 
00285    int openDaqFile(const char *fname, const char *mode=0);
00286  
00292    int openDaqOutFile(char *fname);
00293 
00296    void closeDaqFile();
00297 
00300    void closeDaqOutFile();
00301 
00305    int saveDaqEvent();
00306 
00310    int saveDaqEventToOutFile();
00311 
00312 
00315    void saveDaqHeader();
00316 
00319    void readDaqHeader();
00320 
00323    int loadDaqEvent(char *fname=0, int nr=-1);
00324 #endif
00325 
00327    int loadEvent(Subrack *s, int page);
00328 
00329 
00331    int openHwConnection(const char *file);
00332 
00333 
00336    void readHwHeader();
00337 
00338 
00341    int loadHwEvent(Subrack *s, int page);
00342 
00343 
00348    int loadPixelData();
00349 
00350 //private:
00351 
00360    int m_iInputFileFormat;
00361 
00369    int m_iOutputFileFormat;
00370 
00371 
00373    char *inputFileName;
00374 
00375    // File pointers for AM format
00376    FILE *m_DataRunFile;
00377 
00378    bool m_bFileIsOpened;
00379    //bool m_bNewFileFormat;
00380 
00381    // File pointer for DAQ format
00382 #ifdef USE_DAQ_FORMAT
00383 #ifdef USE_DAQ_MIRRORFORMAT
00384    TMirrorEventFile *daqFile; // Input
00385    TMirrorEventFile *daqOutFile;
00386    TMirrorEvent *daqEv;
00387 #endif   
00388 #ifdef USE_DAQ_EYEFORMAT
00389    TEyeEventFile *daqFile;
00390    TEyeEventFile *daqOutFile;
00391    TEyeEvent *daqEv;
00392 #endif
00393    bool daqFileIsOpened; // Input
00394    bool daqOutFileIsOpened;
00395 #endif
00396 
00398    Subrack *s;
00399 
00406    int m_iVersion;
00407 
00409    int station;
00410 
00411    int bay;
00412 
00415    unsigned long runNo;
00416 
00418    time_t tStart;
00419 
00421    char comment[256];
00422 
00423 
00425    int m_iNumEvents;
00426 
00427 
00430    int m_iChannelsToRead;
00431 
00432 
00435    int m_iEventNr;
00436 
00437 
00441    TsEvent ev;
00442 
00443 
00444 };
00445 
00446 #endif