CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/EventFilter/EcalRawToDigi/interface/DCCEventBlock.h

Go to the documentation of this file.
00001 #ifndef DCCEVENTBLOCK_HH
00002 #define DCCEVENTBLOCK_HH
00003 
00004 
00005 /*
00006  *\ Class DCCEventBlock
00007  *
00008  * Class responsible for managing the raw data unpacking.
00009  * The class instantes the DCCMemBlock 
00010  *
00011  * \file DCCEventBlock.h
00012  *
00013  * $Date: 2012/08/22 01:11:31 $
00014  * $Revision: 1.8 $
00015  *
00016  * \author N. Almeida
00017  * \author G. Franzoni
00018  *
00019 */
00020 
00021 #include <DataFormats/EcalRawData/interface/EcalRawDataCollections.h>
00022 #include <DataFormats/EcalDigi/interface/EcalDigiCollections.h>
00023 #include "DCCRawDataDefinitions.h"
00024 
00025 class DCCFEBlock;
00026 class DCCTCCBlock;
00027 class DCCSRPBlock;
00028 class DCCDataUnpacker;
00029 class DCCMemBlock;
00030 class EcalElectronicsMapper;
00031 
00032 
00033 class DCCEventBlock {
00034         
00035   public :
00036 
00037    DCCEventBlock( DCCDataUnpacker * u, EcalElectronicsMapper * m, bool hU, bool srpU, bool tccU, bool feU, bool memU, bool forceToKeepFRdata);
00038         
00039    virtual ~DCCEventBlock();  
00040  
00041    virtual void unpack(const uint64_t * buffer, size_t bufferSize, unsigned int expFedId){};
00042    
00043    void reset();
00044         
00045    void enableSyncChecks();
00046         
00047    void enableFeIdChecks();
00048 
00049    void updateCollectors();
00050         
00051    void display(std::ostream & o);
00052                 
00053    unsigned int smId()                  { return smId_;     }
00054    unsigned int fov()                   { return fov_;      }
00055    unsigned int mem()                   { return mem_;      }
00056    unsigned int l1A()                   { return l1_;       }
00057    unsigned int bx()                    { return bx_;       }
00058    DCCDataUnpacker  * unpacker(){ return unpacker_; }
00059    
00060    void setSRPSyncNumbers(short l1, short bx){ srpLv1_=l1; srpBx_=bx; }
00061    void setFESyncNumbers(short l1, short bx, short id){ feLv1_[id]= l1; feBx_[id]=bx;}
00062    void setTCCSyncNumbers(short l1, short bx, short id){ tccLv1_[id]= l1; tccBx_[id]=bx;}
00063    void setHLTChannel( int channel, short value ){ hlt_[channel-1] = value; }   
00064    short getHLTChannel(int channel){ return hlt_[channel-1];}
00065 
00066         
00067   protected :
00068      
00069     void addHeaderToCollection();
00070          
00071     int virtual unpackTCCBlocks(){ return BLOCK_UNPACKED;}
00072  
00073     DCCDataUnpacker  *  unpacker_;
00074     const uint64_t       *  data_; 
00075     unsigned int eventSize_;
00076     unsigned int dwToEnd_;
00077     
00078     unsigned int next_tower_search(const unsigned int current_tower_id);
00079     
00080     std::vector<short> feChStatus_;
00081     std::vector<short> tccChStatus_;
00082     std::vector<short> hlt_;
00083 
00084     std::vector<short> feLv1_; std::vector<short> feBx_;  
00085     std::vector<short> tccLv1_; std::vector<short> tccBx_;    
00086     short srpLv1_; short srpBx_; 
00087 
00088     
00089     unsigned int srChStatus_;
00090 
00091     unsigned int fov_;
00092     unsigned int fedId_;
00093     unsigned int bx_;
00094     unsigned int l1_;
00095     unsigned int triggerType_;
00096     unsigned int smId_;
00097     unsigned int blockLength_;  
00098     unsigned int dccErrors_;
00099     unsigned int runNumber_;
00100     unsigned int runType_;
00101     unsigned int detailedTriggerType_;
00102     
00103     unsigned int orbitCounter_;
00104     unsigned int mem_;
00105     unsigned int sr_;
00106     unsigned int zs_;
00107     unsigned int tzs_;
00108     
00109     DCCFEBlock             * towerBlock_;
00110     DCCTCCBlock            * tccBlock_;
00111     DCCMemBlock            * memBlock_;
00112     DCCSRPBlock            * srpBlock_;
00113     EcalElectronicsMapper  * mapper_;
00114          
00115     bool headerUnpacking_;
00116     bool srpUnpacking_;
00117     bool tccUnpacking_;
00118     bool feUnpacking_;
00119     bool memUnpacking_;
00120     bool forceToKeepFRdata_;
00121 
00122     std::auto_ptr<EcalRawDataCollection> *  dccHeaders_;
00123          
00124 
00125 };
00126 
00127 
00128 // this code intended for sync checking in files:
00129 //   DCC(FE|Mem|TCC|SRP)Block.cc
00130 
00131 enum BlockType {FE_MEM = 1, TCC_SRP = 2};
00132 
00133 bool isSynced(const unsigned int dccBx,
00134               const unsigned int bx,
00135               const unsigned int dccL1,
00136               const unsigned int l1,
00137               const BlockType type,
00138               const unsigned int fov);
00139 
00140 #endif