Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:10:36

0001 #ifndef CamacTBDataFormatter_H
0002 #define CamacTBDataFormatter_H
0003 /** \class CamacTBDataFormatter
0004  *
0005  *
0006  *  \author G. Franzoni
0007  */
0008 
0009 #include <vector>
0010 #include <iostream>
0011 
0012 #include "FWCore/ServiceRegistry/interface/Service.h"
0013 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0014 
0015 #include <TBDataFormats/EcalTBObjects/interface/EcalTBHodoscopePlaneRawHits.h>
0016 #include <TBDataFormats/EcalTBObjects/interface/EcalTBHodoscopeRawInfo.h>
0017 #include <TBDataFormats/EcalTBObjects/interface/EcalTBTDCRawInfo.h>
0018 #include <TBDataFormats/EcalTBObjects/interface/EcalTBEventHeader.h>
0019 #include <DataFormats/FEDRawData/interface/FEDRawData.h>
0020 
0021 #include "TBDataFormats/EcalTBObjects/interface/EcalTBTDCSample.h"
0022 
0023 class CamacTBDataFormatter {
0024 public:
0025   CamacTBDataFormatter();
0026   virtual ~CamacTBDataFormatter() {
0027     LogDebug("EcalTBRawToDigi") << "@SUB=CamacTBDataFormatter"
0028                                 << "\n";
0029   };
0030 
0031   void interpretRawData(const FEDRawData& data,
0032                         EcalTBEventHeader& tbEventHeader,
0033                         EcalTBHodoscopeRawInfo& hodoRaw,
0034                         EcalTBTDCRawInfo& tdcRawInfo);
0035 
0036   // for tests based on standalone file
0037   /*   void  interpretRawData(unsigned long * buffer, unsigned long bufferSize, */
0038   /*             EcalTBEventHeader& tbEventHeader,  */
0039   /*             EcalTBHodoscopeRawInfo & hodo, */
0040   /*             EcalTBTDCRawInfo & tdc); */
0041 
0042 private:
0043   bool checkStatus(unsigned long word, int wordNumber);
0044 
0045   int nWordsPerEvent;  // Number of fibers per hodoscope plane
0046 
0047   static const int nHodoFibers = 64;  // Number of fibers per hodoscope plane
0048   static const int nHodoscopes = 2;   // Number of different mappings between fiber and electronics
0049   static const int nHodoPlanes = 4;   // Number of hodoscopes along the beam
0050   static const int hodoRawLen = 4;    // The raw data is stored as 4 integers for each hodo plane
0051 
0052   int nHodoHits[nHodoPlanes];
0053   int hodoHits[nHodoPlanes][nHodoFibers];
0054   int hodoAll[nHodoPlanes * nHodoFibers];
0055   bool statusWords[148 + 4];
0056 
0057   std::vector<int> scalers_;
0058 };
0059 #endif