00001 #ifndef GctRawToDigi_h 00002 #define GctRawToDigi_h 00003 00004 // -*- C++ -*- 00005 // 00006 // Package: GctRawToDigi 00007 // Class: GctRawToDigi 00008 // 00016 // 00017 // Original Author: Jim Brooke 00018 // Created: Wed Nov 1 11:57:10 CET 2006 00019 // $Id: GctRawToDigi.h,v 1.34 2010/02/11 00:11:41 wmtan Exp $ 00020 // 00021 // 00022 00023 // system include files 00024 #include <memory> 00025 #include <ostream> 00026 #include <string> 00027 00028 // user include files 00029 #include "FWCore/Framework/interface/Frameworkfwd.h" 00030 #include "FWCore/Framework/interface/EDProducer.h" 00031 #include "FWCore/Framework/interface/Event.h" 00032 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00033 #include "FWCore/Utilities/interface/InputTag.h" 00034 00035 #include "DataFormats/FEDRawData/interface/FEDRawData.h" 00036 00037 #include "EventFilter/GctRawToDigi/src/GctUnpackCollections.h" 00038 #include "EventFilter/GctRawToDigi/src/GctFormatTranslateBase.h" 00039 00040 00041 // ******************************************************************* 00042 // *** THE UNPACK PROCESS MUST NEVER THROW ANY KIND OF EXCEPTION! *** 00043 // ******************************************************************* 00044 00045 class GctRawToDigi : public edm::EDProducer 00046 { 00047 public: 00048 00049 explicit GctRawToDigi(const edm::ParameterSet&); 00050 ~GctRawToDigi(); 00051 00052 00053 private: // methods 00054 00055 virtual void beginJob(); 00056 virtual void produce(edm::Event&, const edm::EventSetup&); 00057 00059 00060 void unpack(const FEDRawData& d, edm::Event& e, GctUnpackCollections * const colls); 00061 00063 00064 bool autoDetectRequiredFormatTranslator(const unsigned char * data); 00065 00067 void checkHeaders(); 00068 00070 void doVerboseOutput(const GctBlockHeaderCollection& bHdrs, const GctUnpackCollections * const colls) const; 00071 00072 // add an error to the error collection 00073 void addError(const unsigned code); 00074 00076 virtual void endJob(); 00077 00078 00079 private: // members 00080 00082 static const unsigned MAX_BLOCKS = 256; 00083 00084 // unpacking options 00085 edm::InputTag inputLabel_; 00086 int fedId_; 00087 00088 const bool hltMode_; 00089 const unsigned numberOfGctSamplesToUnpack_; 00090 const unsigned numberOfRctSamplesToUnpack_; 00091 const bool unpackSharedRegions_; 00092 const unsigned formatVersion_; 00093 const bool checkHeaders_; 00094 const bool verbose_; 00095 00096 // format translator 00097 GctFormatTranslateBase * formatTranslator_; 00098 00099 // vector of unpacked block headers, for verbostity and/or sync checks 00100 GctBlockHeaderCollection blockHeaders_; 00101 00102 // error handling 00103 static const unsigned MAX_ERR_CODE = 6; 00104 L1TriggerErrorCollection * errors_; 00105 std::vector<unsigned> errorCounters_; 00106 unsigned unpackFailures_; 00107 00108 }; 00109 00110 #endif