00001 /* @version $Revision: 1328 $ * @modifiedby $Author: jacquem $ * @lastmodified $Date: 2011-10-03 17:04:17 +0200 (Mon, 03 Oct 2011) $ */ 00002 00003 #ifndef CROSSDAQHR1_HH 00004 #define CROSSDAQHR1_HH 00005 00006 ////////////////////////////////////////////////////////////////////////// 00007 // // 00008 // Hardroc1Reader for MICROMEGAS READOUT // 00009 // // 00010 ////////////////////////////////////////////////////////////////////////// 00011 00012 #include "mTypes.h" 00013 #include "DifReader.hh" 00014 00015 #define CROSSDAQHR1 "crossdaqHR1" 00016 00017 class Run; 00018 class Event; 00019 class Detector; 00020 00021 #include <set> 00022 00023 ////////////////////////////////////////////////////////////////////////// 00024 /// CLASS DATAREADER // 00025 ////////////////////////////////////////////////////////////////////////// 00026 class Hardroc1Reader : public DifReader { 00027 public: 00028 Hardroc1Reader(Run& aRun, FILE *aFile, ui32 lastEventId); 00029 ~Hardroc1Reader(); 00030 static const char *type(const int subtype = 0) { return CROSSDAQHR1; }; 00031 int getNextEvent(Event& eventToFill); 00032 00033 private: 00034 void reset(); 00035 int getScData(); 00036 int getAcqData(Event& event); 00037 int storeEvent(Event& event); 00038 int newHit(Event& event, const Detector& detector, int data, const int chNum, const int chipId, const int difId); 00039 00040 // ------ data members -------// 00041 protected: 00042 00043 // file header : data format 00044 // int dataFormat; // current data format in the first hexadecimal character of the file 00045 unsigned short CRC; // current CRC for the whole file 00046 00047 // global header data 00048 int difId; // Id of the current DIF board 00049 ui32 difTriggerCounter; // trigger counter 00050 ui32 acqTriggerCounter; // trigger counter version >= 4 00051 ui32 globalTriggerCounter; // global trigger counter 00052 ui32 bcPeriod; // the BC period in nanoseconds, unless otherwise specified 00053 i64 bcId_Abs; // absolute bc Id for current DIF, in bcPeriods 00054 i64 bcId_AbsOrg; // the bcId origin, in bcPeriods, for the whole file 00055 i64 bcId_Dif; // current bcId for current DIF 00056 i64 bcId_Hit; // bcId du hit 00057 i64 eventTime; // event time in milliseconds 00058 00059 typedef std::set<int> SkippedChipSet_t; 00060 SkippedChipSet_t skippedChips; // the list of Chip and Dif Ids for which first line has been skipped 00061 int SkippedBcId; // the number of data skipped because of wrong bcId_Hit 00062 }; // class Hardroc1Reader 00063 00064 #endif 00065