Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:36:08

0001 #ifndef DCCDATABLOCKPROTOTYPE_HH
0002 #define DCCDATABLOCKPROTOTYPE_HH
0003 
0004 /*
0005  * \class DCCDataBlockPrototype
0006  * Prototype for ECAL data block unpacking
0007  * \file DCCDataBlockPrototype.h
0008  *
0009  * \author N. Almeida
0010  *
0011 */
0012 
0013 #include <iostream>
0014 #include <string>
0015 #include <vector>
0016 #include <map>
0017 #include <utility>
0018 #include <cstdio>
0019 
0020 #include <FWCore/MessageLogger/interface/MessageLogger.h>
0021 #include "DCCRawDataDefinitions.h"
0022 #include <cstdint>
0023 
0024 class EcalElectronicsMapper;
0025 class DCCDataUnpacker;
0026 class DCCEventBlock;
0027 
0028 class DCCDataBlockPrototype {
0029 public:
0030   /**
0031       Class constructor
0032     */
0033   DCCDataBlockPrototype(DCCDataUnpacker* unpacker,
0034                         EcalElectronicsMapper* mapper,
0035                         DCCEventBlock* event,
0036                         bool unpack = true);
0037 
0038   virtual ~DCCDataBlockPrototype() {}
0039 
0040   virtual int unpack(const uint64_t** data, unsigned int* dwToEnd) { return BLOCK_UNPACKED; }
0041 
0042   virtual void updateCollectors() {}
0043 
0044   virtual void display(std::ostream& o) {}
0045 
0046   void enableSyncChecks() { sync_ = true; }
0047 
0048   /**
0049      Updates data pointer and dw to end of event
0050     */
0051   virtual void updateEventPointers() {
0052     //cout<<"\n block Length "<<blockLength_;
0053     //cout<<"\n dwToEne...   "<<*dwToEnd_;
0054 
0055     *datap_ += blockLength_;
0056 
0057     // preventing pointers from navigating wildly outside of fedBlock
0058     if ((*dwToEnd_) >= blockLength_)
0059       *dwToEnd_ -= blockLength_;
0060     else
0061       *dwToEnd_ = 0;
0062   }
0063 
0064   virtual unsigned int getLength() { return blockLength_; }
0065 
0066 protected:
0067   DCCDataUnpacker* unpacker_;
0068   bool error_;
0069   EcalElectronicsMapper* mapper_;
0070   DCCEventBlock* event_;
0071 
0072   const uint64_t** datap_;
0073   const uint64_t* data_;
0074   unsigned int* dwToEnd_;
0075 
0076   unsigned int blockLength_;
0077   bool unpackInternalData_;
0078   bool sync_;
0079 };
0080 
0081 #endif