Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DIGIHCAL_CASTORDATAFRAME_H
0002 #define DIGIHCAL_CASTORDATAFRAME_H
0003 
0004 #include "DataFormats/HcalDetId/interface/HcalCastorDetId.h"
0005 #include "DataFormats/HcalDetId/interface/HcalElectronicsId.h"
0006 #include "DataFormats/HcalDigi/interface/HcalQIESample.h"
0007 #include <vector>
0008 #include <ostream>
0009 
0010 /** \class CastorDataFrame
0011        
0012 Precision readout digi for Castor
0013 
0014 */
0015 class CastorDataFrame {
0016 public:
0017   typedef HcalCastorDetId key_type;  ///< For the sorted collection
0018 
0019   CastorDataFrame();  // for persistence
0020   explicit CastorDataFrame(const HcalCastorDetId& id);
0021 
0022   const HcalCastorDetId& id() const { return id_; }
0023   // ElecId not yet specified 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   /// 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)
0041   int fiberIdleOffset() const;
0042 
0043   /// validate appropriate DV and ER bits as well as capid rotation for the specified samples (default is all)
0044   bool validate(int firstSample = 0, int nSamples = 100) const;
0045 
0046   void setSize(int size);
0047   void setPresamples(int ps);
0048   void setZSInfo(bool unsuppressed, bool markAndPass, uint32_t crossingMask = 0);
0049   void setSample(int i, const HcalQIESample& sam) { data_[i] = sam; }
0050   void setFiberIdleOffset(int offset);
0051 
0052   // ElecId not yet specified  void setReadoutIds(const HcalElectronicsId& eid);
0053 
0054   static const int MAXSAMPLES = 10;
0055 
0056 private:
0057   HcalCastorDetId id_;
0058   // ElecId not yet specified  HcalElectronicsId electronicsId_;
0059   int size_;
0060   int hcalPresamples_;
0061   HcalQIESample data_[MAXSAMPLES];
0062 };
0063 
0064 std::ostream& operator<<(std::ostream&, const CastorDataFrame&);
0065 
0066 #endif