CSCDCCHeader

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
/* CSCDCCHeader 9/24/04 A.Tumanov
 * documented at  http://www.physics.ohio-state.edu/~cms/ddu/ddu2.html
 */

#ifndef EventFilter_CSCRawToDigi_CSCDCCHeader_h
#define EventFilter_CSCRawToDigi_CSCDCCHeader_h

#include <cstdint>
#include <cstring>
#include <string>  //for bzero
#include "DataFormats/CSCDigi/interface/CSCDCCStatusDigi.h"

class CSCDCCHeader {
public:
  CSCDCCHeader(int bx, int l1a, int sourceId, int version = 0);
  CSCDCCHeader();
  CSCDCCHeader(const CSCDCCStatusDigi& digi);

  void setFromBuffer(uint16_t const* buf) { memcpy(this, buf, sizeInWords() * 2); }

  int getCDFEventNumber() const;
  int getCDFSourceId() const;
  int getCDFFOV() const;
  int getCDFEventType() const;
  int getCDFBunchCounter() const;
  void setDAV(int dduSlot);
  bool check() const { return true /*dcc_code1==0xD9 && dcc_code2==0x97*/; }
  unsigned short* data() { return (short unsigned*)word; }
  static unsigned sizeInWords() { return 8; }

  // gets some data filled by the event data
  friend class CSCDDUEventData;

private:
  unsigned long long word[2];

  /*
  //first line of DCC header definded by CDF (common data format)
  ///http://cmsdoc.cern.ch/cms/TRIDAS/horizontal/
  unsigned BOE_1       : 4;
  unsigned Evt_ty      : 4;
  unsigned LV1_id      : 24;
  unsigned BX_id       : 12;
  unsigned Source_id   : 12;
  unsigned FOV         : 4;
  unsigned Hx          : 3;
  unsigned dollardollar: 1;

  /// code1 should be D9
  /// http://www.physics.ohio-state.edu/%7Ecms/dcc/outdatafmt.html
  unsigned dcc_code1     : 8;
  unsigned orbit_counter : 32;
  unsigned fifo_status   : 16;
  ///code2 should be 97
  unsigned dcc_code2     : 8;
  
  */
};
#endif