Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DCCEVENTBLOCK_HH
0002 #define DCCEVENTBLOCK_HH
0003 
0004 /*
0005  *\ Class DCCEventBlock
0006  *
0007  * Class responsible for managing the raw data unpacking.
0008  * The class instantes the DCCMemBlock 
0009  *
0010  * \file DCCEventBlock.h
0011  *
0012  *
0013  * \author N. Almeida
0014  * \author G. Franzoni
0015  *
0016 */
0017 
0018 #include <DataFormats/EcalRawData/interface/EcalRawDataCollections.h>
0019 #include <DataFormats/EcalDigi/interface/EcalDigiCollections.h>
0020 #include "DCCRawDataDefinitions.h"
0021 
0022 class DCCFEBlock;
0023 class DCCTCCBlock;
0024 class DCCSRPBlock;
0025 class DCCDataUnpacker;
0026 class DCCMemBlock;
0027 class EcalElectronicsMapper;
0028 
0029 class DCCEventBlock {
0030 public:
0031   DCCEventBlock(DCCDataUnpacker* u,
0032                 EcalElectronicsMapper* m,
0033                 bool hU,
0034                 bool srpU,
0035                 bool tccU,
0036                 bool feU,
0037                 bool memU,
0038                 bool forceToKeepFRdata);
0039 
0040   virtual ~DCCEventBlock();
0041 
0042   virtual void unpack(const uint64_t* buffer, size_t bufferSize, unsigned int expFedId){};
0043 
0044   void reset();
0045 
0046   void enableSyncChecks();
0047 
0048   void enableFeIdChecks();
0049 
0050   void updateCollectors();
0051 
0052   void display(std::ostream& o);
0053 
0054   unsigned int smId() { return smId_; }
0055   unsigned int fov() { return fov_; }
0056   unsigned int mem() { return mem_; }
0057   unsigned int l1A() { return l1_; }
0058   unsigned int bx() { return bx_; }
0059   DCCDataUnpacker* unpacker() { return unpacker_; }
0060 
0061   void setSRPSyncNumbers(short l1, short bx) {
0062     srpLv1_ = l1;
0063     srpBx_ = bx;
0064   }
0065   void setFESyncNumbers(short l1, short bx, short id) {
0066     feLv1_[id] = l1;
0067     feBx_[id] = bx;
0068   }
0069   void setTCCSyncNumbers(short l1, short bx, short id) {
0070     tccLv1_[id] = l1;
0071     tccBx_[id] = bx;
0072   }
0073   void setHLTChannel(int channel, short value) { hlt_[channel - 1] = value; }
0074   short getHLTChannel(int channel) { return hlt_[channel - 1]; }
0075 
0076 protected:
0077   void addHeaderToCollection();
0078 
0079   int virtual unpackTCCBlocks() { return BLOCK_UNPACKED; }
0080 
0081   DCCDataUnpacker* unpacker_;
0082   const uint64_t* data_;
0083   unsigned int eventSize_;
0084   unsigned int dwToEnd_;
0085 
0086   unsigned int next_tower_search(const unsigned int current_tower_id);
0087 
0088   std::vector<short> feChStatus_;
0089   std::vector<short> tccChStatus_;
0090   std::vector<short> hlt_;
0091 
0092   std::vector<short> feLv1_;
0093   std::vector<short> feBx_;
0094   std::vector<short> tccLv1_;
0095   std::vector<short> tccBx_;
0096   short srpLv1_;
0097   short srpBx_;
0098 
0099   unsigned int srChStatus_;
0100 
0101   unsigned int fov_;
0102   unsigned int fedId_;
0103   unsigned int bx_;
0104   unsigned int l1_;
0105   unsigned int triggerType_;
0106   unsigned int smId_;
0107   unsigned int blockLength_;
0108   unsigned int dccErrors_;
0109   unsigned int runNumber_;
0110   unsigned int runType_;
0111   unsigned int detailedTriggerType_;
0112 
0113   unsigned int orbitCounter_;
0114   unsigned int mem_;
0115   unsigned int sr_;
0116   unsigned int zs_;
0117   unsigned int tzs_;
0118 
0119   DCCFEBlock* towerBlock_;
0120   DCCTCCBlock* tccBlock_;
0121   DCCMemBlock* memBlock_;
0122   DCCSRPBlock* srpBlock_;
0123   EcalElectronicsMapper* mapper_;
0124 
0125   bool headerUnpacking_;
0126   bool srpUnpacking_;
0127   bool tccUnpacking_;
0128   bool feUnpacking_;
0129   bool memUnpacking_;
0130   bool forceToKeepFRdata_;
0131 
0132   std::unique_ptr<EcalRawDataCollection>* dccHeaders_;
0133 };
0134 
0135 // this code intended for sync checking in files:
0136 //   DCC(FE|Mem|TCC|SRP)Block.cc
0137 
0138 enum BlockType { FE_MEM = 1, TCC_SRP = 2 };
0139 
0140 bool isSynced(const unsigned int dccBx,
0141               const unsigned int bx,
0142               const unsigned int dccL1,
0143               const unsigned int l1,
0144               const BlockType type,
0145               const unsigned int fov);
0146 
0147 #endif