BlockType

DCCEventBlock

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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
#ifndef DCCEVENTBLOCK_HH
#define DCCEVENTBLOCK_HH

/*
 *\ Class DCCEventBlock
 *
 * Class responsible for managing the raw data unpacking.
 * The class instantes the DCCMemBlock 
 *
 * \file DCCEventBlock.h
 *
 *
 * \author N. Almeida
 * \author G. Franzoni
 *
*/

#include <DataFormats/EcalRawData/interface/EcalRawDataCollections.h>
#include <DataFormats/EcalDigi/interface/EcalDigiCollections.h>
#include "DCCRawDataDefinitions.h"

class DCCFEBlock;
class DCCTCCBlock;
class DCCSRPBlock;
class DCCDataUnpacker;
class DCCMemBlock;
class EcalElectronicsMapper;

class DCCEventBlock {
public:
  DCCEventBlock(DCCDataUnpacker* u,
                EcalElectronicsMapper* m,
                bool hU,
                bool srpU,
                bool tccU,
                bool feU,
                bool memU,
                bool forceToKeepFRdata);

  virtual ~DCCEventBlock();

  virtual void unpack(const uint64_t* buffer, size_t bufferSize, unsigned int expFedId) {}

  void reset();

  void enableSyncChecks();

  void enableFeIdChecks();

  void updateCollectors();

  void display(std::ostream& o);

  unsigned int smId() { return smId_; }
  unsigned int fov() { return fov_; }
  unsigned int mem() { return mem_; }
  unsigned int l1A() { return l1_; }
  unsigned int bx() { return bx_; }
  DCCDataUnpacker* unpacker() { return unpacker_; }

  void setSRPSyncNumbers(short l1, short bx) {
    srpLv1_ = l1;
    srpBx_ = bx;
  }
  void setFESyncNumbers(short l1, short bx, short id) {
    feLv1_[id] = l1;
    feBx_[id] = bx;
  }
  void setTCCSyncNumbers(short l1, short bx, short id) {
    tccLv1_[id] = l1;
    tccBx_[id] = bx;
  }
  void setHLTChannel(int channel, short value) { hlt_[channel - 1] = value; }
  short getHLTChannel(int channel) { return hlt_[channel - 1]; }

protected:
  void addHeaderToCollection();

  int virtual unpackTCCBlocks() { return BLOCK_UNPACKED; }

  DCCDataUnpacker* unpacker_;
  const uint64_t* data_;
  unsigned int eventSize_;
  unsigned int dwToEnd_;

  unsigned int next_tower_search(const unsigned int current_tower_id);

  std::vector<short> feChStatus_;
  std::vector<short> tccChStatus_;
  std::vector<short> hlt_;

  std::vector<short> feLv1_;
  std::vector<short> feBx_;
  std::vector<short> tccLv1_;
  std::vector<short> tccBx_;
  short srpLv1_;
  short srpBx_;

  unsigned int srChStatus_;

  unsigned int fov_;
  unsigned int fedId_;
  unsigned int bx_;
  unsigned int l1_;
  unsigned int triggerType_;
  unsigned int smId_;
  unsigned int blockLength_;
  unsigned int dccErrors_;
  unsigned int runNumber_;
  unsigned int runType_;
  unsigned int detailedTriggerType_;

  unsigned int orbitCounter_;
  unsigned int mem_;
  unsigned int sr_;
  unsigned int zs_;
  unsigned int tzs_;

  DCCFEBlock* towerBlock_;
  DCCTCCBlock* tccBlock_;
  DCCMemBlock* memBlock_;
  DCCSRPBlock* srpBlock_;
  EcalElectronicsMapper* mapper_;

  bool headerUnpacking_;
  bool srpUnpacking_;
  bool tccUnpacking_;
  bool feUnpacking_;
  bool memUnpacking_;
  bool forceToKeepFRdata_;

  std::unique_ptr<EcalRawDataCollection>* dccHeaders_;
};

// this code intended for sync checking in files:
//   DCC(FE|Mem|TCC|SRP)Block.cc

enum BlockType { FE_MEM = 1, TCC_SRP = 2 };

bool isSynced(const unsigned int dccBx,
              const unsigned int bx,
              const unsigned int dccL1,
              const unsigned int l1,
              const BlockType type,
              const unsigned int fov);

#endif