Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:36

0001 #ifndef DIGIHCAL_ZDCDATAFRAME_H
0002 #define DIGIHCAL_ZDCDATAFRAME_H
0003 
0004 #include "DataFormats/HcalDetId/interface/HcalZDCDetId.h"
0005 #include "DataFormats/HcalDetId/interface/HcalElectronicsId.h"
0006 #include "DataFormats/HcalDigi/interface/HcalQIESample.h"
0007 #include <vector>
0008 #include <ostream>
0009 
0010 /** \class ZDCDataFrame
0011        
0012 Precision readout digi for ZDC
0013 
0014 */
0015 class ZDCDataFrame {
0016 public:
0017   typedef HcalZDCDetId key_type;  ///< For the sorted collection
0018 
0019   ZDCDataFrame();  // for persistence
0020   explicit ZDCDataFrame(const HcalZDCDetId& id);
0021 
0022   const HcalZDCDetId& id() const { return id_; }
0023   const HcalElectronicsId& elecId() const { return electronicsId_; }
0024 
0025   /// total number of samples in the digi
0026   int size() const { return size_ & 0xF; }
0027   /// number of samples before the sample from the triggered beam crossing (according to the hardware)
0028   int presamples() const { return hcalPresamples_ & 0xF; }
0029   /// was ZS MarkAndPass?
0030   bool zsMarkAndPass() const { return (hcalPresamples_ & 0x10); }
0031   /// was ZS unsuppressed?
0032   bool zsUnsuppressed() const { return (hcalPresamples_ & 0x20); }
0033   /// zs crossing mask (which sums considered)
0034   uint32_t zsCrossingMask() const { return (hcalPresamples_ & 0x3FF000) >> 12; }
0035 
0036   /// access a sample
0037   const HcalQIESample& operator[](int i) const { return data_[i]; }
0038   /// access a sample
0039   const HcalQIESample& sample(int i) const { return data_[i]; }
0040 
0041   /// offset of bunch number for this channel relative to nominal set in the unpacker (range is +7->-7.  -1000 indicates the data is invalid/unavailable)
0042   int fiberIdleOffset() const;
0043 
0044   /// validate appropriate DV and ER bits as well as capid rotation for the specified samples (default is all)
0045   bool validate(int firstSample = 0, int nSamples = 100) const;
0046 
0047   void setSize(int size);
0048   void setPresamples(int ps);
0049   void setZSInfo(bool unsuppressed, bool markAndPass, uint32_t crossingMask = 0);
0050   void setSample(int i, const HcalQIESample& sam) { data_[i] = sam; }
0051   void setReadoutIds(const HcalElectronicsId& eid);
0052   void setFiberIdleOffset(int offset);
0053 
0054   static const int MAXSAMPLES = 10;
0055 
0056 private:
0057   HcalZDCDetId id_;
0058   HcalElectronicsId electronicsId_;
0059   int size_;
0060   int hcalPresamples_;  // also contains information about ZS MarkAndPass
0061   HcalQIESample data_[MAXSAMPLES];
0062 };
0063 
0064 std::ostream& operator<<(std::ostream&, const ZDCDataFrame&);
0065 
0066 #endif