Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /* -*- C++ -*- */
0002 #ifndef HcalUnpacker_h_included
0003 #define HcalUnpacker_h_included 1
0004 
0005 #include "DataFormats/HcalDigi/interface/HBHEDataFrame.h"
0006 #include "DataFormats/HcalDigi/interface/HODataFrame.h"
0007 #include "DataFormats/HcalDigi/interface/HFDataFrame.h"
0008 #include "DataFormats/HcalDigi/interface/ZDCDataFrame.h"
0009 #include "DataFormats/HcalDigi/interface/HcalCalibDataFrame.h"
0010 #include "DataFormats/HcalDigi/interface/HcalTriggerPrimitiveDigi.h"
0011 #include "DataFormats/HcalDigi/interface/HOTriggerPrimitiveDigi.h"
0012 #include "DataFormats/HcalDigi/interface/HcalHistogramDigi.h"
0013 #include "DataFormats/HcalDigi/interface/HcalUnpackerReport.h"
0014 #include "DataFormats/FEDRawData/interface/FEDRawData.h"
0015 #include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h"
0016 #include "DataFormats/HcalDigi/interface/HcalTTPDigi.h"
0017 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
0018 #include "DataFormats/HcalDigi/interface/HcalUMNioDigi.h"
0019 #include <set>
0020 
0021 class HcalUnpacker {
0022 public:
0023   struct Collections {
0024     Collections();
0025     std::vector<HBHEDataFrame>* hbheCont;
0026     std::vector<HODataFrame>* hoCont;
0027     std::vector<HFDataFrame>* hfCont;
0028     std::vector<HcalCalibDataFrame>* calibCont;
0029     std::vector<ZDCDataFrame>* zdcCont;
0030     std::vector<HcalTriggerPrimitiveDigi>* tpCont;
0031     std::vector<HOTriggerPrimitiveDigi>* tphoCont;
0032     std::vector<HcalTTPDigi>* ttp;
0033     QIE10DigiCollection* qie10;
0034     QIE10DigiCollection* qie10ZDC;
0035     QIE10DigiCollection* qie10Lasermon;
0036     QIE11DigiCollection* qie11;
0037     // additional qie10 and qie11 data collections
0038     std::unordered_map<int, QIE10DigiCollection*> qie10Addtl;
0039     std::unordered_map<int, QIE11DigiCollection*> qie11Addtl;
0040     HcalUMNioDigi* umnio;
0041   };
0042 
0043   /// for normal data
0044   HcalUnpacker(int sourceIdOffset, int beg, int end)
0045       : sourceIdOffset_(sourceIdOffset),
0046         startSample_(beg),
0047         endSample_(end),
0048         expectedOrbitMessageTime_(-1),
0049         mode_(0),
0050         nPrinted_(0) {}
0051   /// For histograms, no begin and end
0052   HcalUnpacker(int sourceIdOffset)
0053       : sourceIdOffset_(sourceIdOffset),
0054         startSample_(-1),
0055         endSample_(-1),
0056         expectedOrbitMessageTime_(-1),
0057         mode_(0),
0058         nPrinted_(0) {}
0059   void setExpectedOrbitMessageTime(int time) { expectedOrbitMessageTime_ = time; }
0060   void unpack(const FEDRawData& raw, const HcalElectronicsMap& emap, std::vector<HcalHistogramDigi>& histoDigis);
0061   void unpack(const FEDRawData& raw,
0062               const HcalElectronicsMap& emap,
0063               Collections& conts,
0064               HcalUnpackerReport& report,
0065               bool silent = false);
0066   void setMode(int mode) { mode_ = mode; }
0067 
0068 private:
0069   void unpackVME(const FEDRawData& raw,
0070                  const HcalElectronicsMap& emap,
0071                  Collections& conts,
0072                  HcalUnpackerReport& report,
0073                  bool silent = false);
0074   void unpackUTCA(const FEDRawData& raw,
0075                   const HcalElectronicsMap& emap,
0076                   Collections& conts,
0077                   HcalUnpackerReport& report,
0078                   bool silent = false);
0079   void unpackUMNio(const FEDRawData& raw, int slot, Collections& colls);
0080 
0081   void printInvalidDataMessage(const std::string& coll_type, int default_ns, int conflict_ns, bool extended = false);
0082 
0083   int sourceIdOffset_;            ///< number to subtract from the source id to get the dcc id
0084   int startSample_;               ///< first sample from fed raw data to copy
0085   int endSample_;                 ///< last sample from fed raw data to copy (if present)
0086   int expectedOrbitMessageTime_;  ///< Expected orbit bunch time (needed to evaluate time differences)
0087   int mode_;
0088   std::set<HcalElectronicsId> unknownIds_,
0089       unknownIdsTrig_;  ///< Recorded to limit number of times a log message is generated
0090 
0091   int nPrinted_;
0092 };
0093 
0094 #endif  // HcalUnpacker_h_included