00001
00002 #ifndef CALIBMICRORC_HH
00003 #define CALIBMICRORC_HH
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "AcquisitionParser.hh"
00014 #include "CrcCheck.hh"
00015
00016 #include <stdlib.h>
00017 #include "mTypes.h"
00018 #include <string>
00019
00020
00021 #define CALIBMICRORC "calibMicroroc"
00022 #define MOTIFNB 64
00023
00024
00025 class Event;
00026 class Detector;
00027 class MicrorocSCReader;
00028
00029
00030
00031
00032 class CalibMicrorocParser : public AcquisitionParser {
00033
00034
00035 public:
00036 CalibMicrorocParser(Run& aRun, FILE *aFile,ui32 firstEventId, bool _testMicroroc = false);
00037 virtual ~CalibMicrorocParser() ;
00038 static const char *type() { return CALIBMICRORC; }
00039 int getNextEvent(Event& eventToFill);
00040
00041
00042
00043
00044
00045 private:
00046 unsigned int getData(FILE* inputFile, const int nBytes,bool computeCRC=true);
00047 unsigned int getDecimalData(FILE* inputFile, const int nBytes) ;
00048 unsigned int checkData(FILE* inputFile, const int nBytes) ;
00049 int getDacValue(std::string line);
00050 void setMotifValue(std::string line);
00051 void setChargeValue(std::string line);
00052 unsigned int grayToBinary(unsigned int gray) ;
00053 int newHit(Event& event, const Detector &detector, int data, const int chNum, const int chipId, const int difId);
00054 std::string binaire(unsigned int nombre);
00055 void reset();
00056 void initParsing(FILE* inputFile);
00057 bool checkNextLine(FILE* inputFile, std::string target );
00058 virtual std::string getCtestString(void) {return "motif Ctest";} ;
00059
00060
00061
00062 MicrorocSCReader *scReader;
00063 bool init ;
00064 bool motif[MOTIFNB];
00065 float charge;
00066 bool newCalibration ;
00067 bool newDif;
00068 bool newHR;
00069 int difId ;
00070 int dac[3];
00071 char shaper[2];
00072 bool testMicroroc ;
00073
00074
00075 protected:
00076 int getLine ( FILE*file, std::string &line );
00077 };
00078
00079 #endif
00080
00081