CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/EventFilter/DTRawToDigi/interface/DTControlData.h

Go to the documentation of this file.
00001 #ifndef DTRawToDigi_DTControlData_h
00002 #define DTRawToDigi_DTControlData_h
00003 
00013 #include <EventFilter/DTRawToDigi/interface/DTDDUWords.h>
00014 #include <DataFormats/FEDRawData/interface/FEDHeader.h>
00015 #include <DataFormats/FEDRawData/interface/FEDTrailer.h>
00016 #include <DataFormats/FEDRawData/src/fed_trailer.h>
00017 
00018 #include <vector>
00019 
00020 typedef std::pair<int, DTROBHeaderWord> DTROBHeader;   
00021 typedef std::pair<int, DTTDCMeasurementWord> DTTDCData;
00022 typedef std::pair<int, DTTDCErrorWord> DTTDCError;
00023 typedef std::pair<DTLocalTriggerDataWord, int> DTSectorCollectorData;
00024 
00025 class DTROS25Data {
00026 
00027 public:
00028 
00030  DTROS25Data(int ROSId = 0): theROSId(ROSId) {}
00031 
00032 
00034  virtual ~DTROS25Data() {}
00035 
00037  inline void setROSId(const int & ID) { theROSId = ID; }
00038   
00039  inline void addROSHeader( const DTROSHeaderWord & word)  { theROSHeader = DTROSHeaderWord(word) ; }
00040  inline void addROSTrailer( const DTROSTrailerWord & word)  { theROSTrailer = DTROSTrailerWord(word) ; }
00041  inline void addROSError( const DTROSErrorWord & word)  { theROSErrors.push_back(word); }
00042  inline void addROSDebug( const DTROSDebugWord & word)  { theROSDebugs.push_back(word); }
00043  inline void addROBHeader( const DTROBHeader & robHeader)  { theROBHeaders.push_back(robHeader); }   // IJ
00044  inline void addROBTrailer( const DTROBTrailerWord & word)  { theROBTrailers.push_back(word); }
00045  inline void addTDCMeasurement( const DTTDCMeasurementWord & word)  { theTDCMeasurements.push_back(word); }
00046  inline void addTDCData( const DTTDCData & tdcData)  { theTDCData.push_back(tdcData); }
00047  inline void addTDCError( const DTTDCError & tdcError)  { theTDCError.push_back(tdcError); }
00048  inline void addSCData ( const DTSectorCollectorData & scData) { theSCData.push_back(scData); }
00049  inline void addSCHeader( const DTLocalTriggerHeaderWord &scHeader) { theSCHeader = scHeader; }
00050  inline void addSCPrivHeader( const DTLocalTriggerSectorCollectorHeaderWord& scPrivHeader) { theSCPrivateHeader = scPrivHeader; }
00051   inline void addSCPrivSubHeader( const DTLocalTriggerSectorCollectorSubHeaderWord& scPrivSubHeader) { theSCPrivateSubHeader = scPrivSubHeader; }
00052  inline void addSCTrailer( const DTLocalTriggerTrailerWord& scTrailer) { theSCTrailer = scTrailer; }
00053 
00055  inline int getROSID() const { return theROSId; }
00056 
00057  inline const DTROSTrailerWord & getROSTrailer() const {return theROSTrailer;}
00058  inline const DTROSHeaderWord & getROSHeader() const {return theROSHeader;}
00059  inline const std::vector<DTROSErrorWord>& getROSErrors() const {return theROSErrors;}
00060  inline const std::vector<DTROSDebugWord>& getROSDebugs() const {return theROSDebugs;}
00061  inline const std::vector<DTROBHeader>& getROBHeaders() const {return theROBHeaders;}
00062  inline const std::vector<DTROBTrailerWord>& getROBTrailers() const {return theROBTrailers;}
00063  inline const std::vector<DTTDCMeasurementWord>& getTDCMeasurements() const {return theTDCMeasurements;}
00064  inline const std::vector<DTTDCData>& getTDCData() const {return theTDCData;}
00065  inline const std::vector<DTTDCError>& getTDCError() const {return theTDCError;}
00066  inline const std::vector<DTSectorCollectorData>& getSCData() const {return theSCData;}
00067  inline const DTLocalTriggerHeaderWord& getSCHeader() const {return theSCHeader;}
00068  inline const DTLocalTriggerSectorCollectorHeaderWord& getSCPrivHeader() const {return theSCPrivateHeader;}
00069  inline const DTLocalTriggerTrailerWord& getSCTrailer() const {return theSCTrailer;}
00070  inline const DTLocalTriggerSectorCollectorSubHeaderWord& getSCPrivSubHeader() const { return theSCPrivateSubHeader;}
00071 
00072  inline void clean() {
00073    theROSHeader = 0; 
00074    theROSTrailer = 0;
00075    theROSErrors.clear(); 
00076    theROSDebugs.clear(); 
00077    theROBHeaders.clear(); 
00078    theROBTrailers.clear(); 
00079    theTDCMeasurements.clear(); 
00080    theTDCData.clear(); 
00081    theTDCError.clear(); 
00082    theSCData.clear(); 
00083  }
00084  
00085 
00086 private:
00087 
00088  int theROSId;
00089 
00090  DTROSHeaderWord theROSHeader;
00091  DTROSTrailerWord theROSTrailer;
00092  std::vector<DTROSErrorWord> theROSErrors;
00093  std::vector<DTROSDebugWord> theROSDebugs;
00094  std::vector<DTROBHeader> theROBHeaders;    
00095  std::vector<DTROBTrailerWord> theROBTrailers;
00096  std::vector<DTTDCMeasurementWord> theTDCMeasurements;
00097  std::vector<DTTDCData> theTDCData;
00098  std::vector<DTTDCError> theTDCError;
00099  std::vector<DTSectorCollectorData> theSCData;
00100  DTLocalTriggerHeaderWord theSCHeader;
00101  DTLocalTriggerSectorCollectorHeaderWord theSCPrivateHeader;
00102  DTLocalTriggerTrailerWord theSCTrailer;
00103  DTLocalTriggerSectorCollectorSubHeaderWord theSCPrivateSubHeader;
00104 
00105 
00106 
00107 };
00108 
00109 
00110 class DTDDUData {
00111 
00112 public:
00113 
00115  DTDDUData(const FEDHeader & dduHeader, const FEDTrailer & dduTrailer):
00116    theDDUHeader(dduHeader),
00117    theDDUTrailer(dduTrailer),
00118    crcErrorBitSet(false)
00119  {}
00120 
00121 
00123  virtual ~DTDDUData() {}
00124 
00126  inline void addDDUHeader( const FEDHeader & word)  { theDDUHeader = word; }
00127  inline void addDDUTrailer( const FEDTrailer & word)  { theDDUTrailer = word; }
00128  inline void addROSStatusWord( const DTDDUFirstStatusWord & word) {
00129    theROSStatusWords.push_back(word);
00130  }
00131  inline void addDDUStatusWord( const DTDDUSecondStatusWord & word) {
00132    theDDUStatusWord = word;
00133  }
00134  inline void checkCRCBit(const unsigned char* trailer) {
00135    const fedt_struct* theTrailer(reinterpret_cast<const fedt_t*>(trailer));
00136    if(((theTrailer->conscheck & 0x00000004) >> 2) == 1) {
00137      crcErrorBitSet = true;
00138    }
00139    crcErrorBitSet = false;
00140  }
00141 
00143  inline const FEDHeader & getDDUHeader() const {return theDDUHeader;}
00144  inline const FEDTrailer & getDDUTrailer() const {return theDDUTrailer;}
00145  inline const std::vector<DTDDUFirstStatusWord> & getFirstStatusWord() const {
00146    return theROSStatusWords;}
00147  inline const DTDDUSecondStatusWord & getSecondStatusWord() const {
00148    return theDDUStatusWord;}
00149  inline bool crcErrorBit() const {
00150    return crcErrorBitSet;
00151  }
00152   
00153 private:
00154 
00155  FEDHeader theDDUHeader;
00156  FEDTrailer theDDUTrailer;
00157  std::vector<DTDDUFirstStatusWord> theROSStatusWords;
00158  DTDDUSecondStatusWord theDDUStatusWord;
00159  bool crcErrorBitSet;
00160 
00161 };
00162 
00163 
00164 #endif