Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef EventFilter_CSCRawToDigi_CSCGEMData_h
0002 #define EventFilter_CSCRawToDigi_CSCGEMData_h
0003 
0004 #include <vector>
0005 #ifndef LOCAL_UNPACK
0006 #include <atomic>
0007 #endif
0008 
0009 class GEMPadDigiCluster;
0010 
0011 class CSCGEMData {
0012 public:
0013   /// default constructor
0014   CSCGEMData(int ntbins = 12, int gem_fibers_mask = 0xf);
0015   // length is in 16-bit words
0016   CSCGEMData(const unsigned short *c04buf, int length, int gem_fibers_mask = 0xf);
0017 
0018   // std::vector<int> BXN() const;
0019   std::vector<GEMPadDigiCluster> digis(int gem_chamber) const;
0020   std::vector<GEMPadDigiCluster> etaDigis(int gem_chamber, int eta, int correctionToALCTbx) const;
0021   int sizeInWords() const { return size_; }
0022   int numGEMs() const {
0023     return 2;  // !!! TODO actual number of GEM chambers in readout
0024   }
0025   int gemFibersMask() const { return gems_enabled_; }
0026   int numGEMEnabledFibers() const { return ngems_; }
0027   int nTbins() const { return ntbins_; }
0028   void print() const;
0029   bool check() const { return ((theData[0] == 0x6C04) && (theData[size_ - 1] == 0x6D04)); }
0030 
0031   /// turns on the debug flag for this class
0032   static void setDebug(bool debugValue) { debug = debugValue; }
0033 
0034   /// Add and pack GEMPadDigiCluster digis
0035   void addEtaPadCluster(const GEMPadDigiCluster &digi, int gem_chamber, int eta_roll);
0036 
0037   unsigned short *data() { return theData; }
0038 
0039 private:
0040   int getPartitionNumber(int address, int nPads) const;
0041   int getPartitionStripNumber(int address, int nPads, int etaPart) const;
0042 
0043 #ifdef LOCAL_UNPACK
0044   static bool debug;
0045 #else
0046   static std::atomic<bool> debug;
0047 #endif
0048 
0049   int ntbins_;
0050   int gems_enabled_;
0051   int ngems_;
0052   int size_;
0053   unsigned short theData[8 * 2 * 32 + 2];
0054 };
0055 
0056 #endif