CamacTBDataFormatter

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
#ifndef CamacTBDataFormatter_H
#define CamacTBDataFormatter_H
/** \class CamacTBDataFormatter
 *
 *
 *  \author G. Franzoni
 */

#include <vector>
#include <iostream>

#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include <TBDataFormats/EcalTBObjects/interface/EcalTBHodoscopePlaneRawHits.h>
#include <TBDataFormats/EcalTBObjects/interface/EcalTBHodoscopeRawInfo.h>
#include <TBDataFormats/EcalTBObjects/interface/EcalTBTDCRawInfo.h>
#include <TBDataFormats/EcalTBObjects/interface/EcalTBEventHeader.h>
#include <DataFormats/FEDRawData/interface/FEDRawData.h>

#include "TBDataFormats/EcalTBObjects/interface/EcalTBTDCSample.h"

class CamacTBDataFormatter {
public:
  CamacTBDataFormatter();
  virtual ~CamacTBDataFormatter() {
    LogDebug("EcalTBRawToDigi") << "@SUB=CamacTBDataFormatter"
                                << "\n";
  };

  void interpretRawData(const FEDRawData& data,
                        EcalTBEventHeader& tbEventHeader,
                        EcalTBHodoscopeRawInfo& hodoRaw,
                        EcalTBTDCRawInfo& tdcRawInfo);

  // for tests based on standalone file
  /*   void  interpretRawData(unsigned long * buffer, unsigned long bufferSize, */
  /* 			 EcalTBEventHeader& tbEventHeader,  */
  /* 			 EcalTBHodoscopeRawInfo & hodo, */
  /* 			 EcalTBTDCRawInfo & tdc); */

private:
  bool checkStatus(unsigned long word, int wordNumber);

  int nWordsPerEvent;  // Number of fibers per hodoscope plane

  static const int nHodoFibers = 64;  // Number of fibers per hodoscope plane
  static const int nHodoscopes = 2;   // Number of different mappings between fiber and electronics
  static const int nHodoPlanes = 4;   // Number of hodoscopes along the beam
  static const int hodoRawLen = 4;    // The raw data is stored as 4 integers for each hodo plane

  int nHodoHits[nHodoPlanes];
  int hodoHits[nHodoPlanes][nHodoFibers];
  int hodoAll[nHodoPlanes * nHodoFibers];
  bool statusWords[148 + 4];

  std::vector<int> scalers_;
};
#endif