Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:54

0001 #ifndef CSCBadChambers_h
0002 #define CSCBadChambers_h
0003 
0004 #include "CondFormats/Serialization/interface/Serializable.h"
0005 
0006 #include <DataFormats/MuonDetId/interface/CSCDetId.h>
0007 #include <vector>
0008 
0009 class CSCBadChambers {
0010 public:
0011   typedef uint16_t IndexType;
0012 
0013   CSCBadChambers() : numberOfBadChambers(0), chambers(std::vector<int>()){};
0014   CSCBadChambers(int nch, const std::vector<int>& ch) : numberOfBadChambers(nch), chambers(ch){};
0015   ~CSCBadChambers(){};
0016 
0017   /// How many bad chambers are there>
0018   int numberOfChambers() const { return numberOfBadChambers; }
0019 
0020   /// Return the container of bad chambers
0021   std::vector<int> container() const { return chambers; }
0022 
0023   /// Is the chamber  with index 'ichamber' flagged as bad?
0024   bool isInBadChamber(IndexType ichamber) const;
0025 
0026   /// Is the chamber  with CSCDetId 'id' flagged as bad?
0027   bool isInBadChamber(const CSCDetId& id) const;
0028 
0029   IndexType startChamberIndexInEndcap(IndexType ie, IndexType is, IndexType ir) const {
0030     const IndexType nschin[32] = {1,   37,  73,  1,   109, 127, 0, 0, 163, 181, 0, 0, 217, 469, 0, 0,
0031                                   235, 271, 307, 235, 343, 361, 0, 0, 397, 415, 0, 0, 451, 505, 0, 0};
0032     return nschin[(ie - 1) * 16 + (is - 1) * 4 + ir - 1];
0033   }
0034 
0035   IndexType chamberIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic) const {
0036     return startChamberIndexInEndcap(ie, is, ir) + ic - 1;  // -1 so start index _is_ ic=1
0037   }
0038 
0039 private:
0040   int numberOfBadChambers;
0041   std::vector<int> chambers;
0042 
0043   COND_SERIALIZABLE;
0044 };
0045 
0046 #endif