Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:24

0001 #ifndef DQM_GEM_GEMDQMEfficiencySourceBase_h
0002 #define DQM_GEM_GEMDQMEfficiencySourceBase_h
0003 
0004 /** \class GEMDQMEfficiencySourceBase
0005  * 
0006  * \author Seungjin Yang <seungjin.yang@cern.ch>
0007  */
0008 
0009 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0010 #include "DQMServices/Core/interface/DQMStore.h"
0011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0012 #include "CondFormats/GEMObjects/interface/GEMeMap.h"
0013 #include "DataFormats/GEMDigi/interface/GEMVFATStatusCollection.h"
0014 #include "DataFormats/GEMDigi/interface/GEMOHStatusCollection.h"
0015 #include "DataFormats/MuonDetId/interface/GEMDetId.h"
0016 #include "Geometry/GEMGeometry/interface/GEMGeometry.h"
0017 
0018 class GEMDQMEfficiencySourceBase : public DQMEDAnalyzer {
0019 public:
0020   using MEMap = std::map<GEMDetId, MonitorElement*>;
0021 
0022   explicit GEMDQMEfficiencySourceBase(const edm::ParameterSet&);
0023 
0024   // Re: region / St: station, La: layer, Ch: chamber parity, Et: eta partition
0025   inline GEMDetId getReStKey(const int, const int);
0026   inline GEMDetId getReStKey(const GEMDetId&);
0027   inline GEMDetId getReStLaKey(const GEMDetId&);
0028   inline GEMDetId getReStEtKey(const GEMDetId&);
0029   inline GEMDetId getReStLaChKey(const GEMDetId&);
0030   inline GEMDetId getKey(const GEMDetId&);  // == getReStLaChEtKey
0031 
0032   std::string nameNumerator(const std::string&);
0033 
0034   MonitorElement* bookNumerator1D(DQMStore::IBooker&, MonitorElement*);
0035   MonitorElement* bookNumerator2D(DQMStore::IBooker&, MonitorElement*);
0036 
0037   std::tuple<bool, int, int> getChamberRange(const GEMStation*);
0038   std::tuple<bool, int, int> getEtaPartitionRange(const GEMStation*);
0039 
0040   MonitorElement* bookChamber(DQMStore::IBooker&, const TString&, const TString&, const GEMStation*);
0041   MonitorElement* bookChamberEtaPartition(DQMStore::IBooker&, const TString&, const TString&, const GEMStation*);
0042 
0043   bool skipGEMStation(const int);
0044 
0045   bool maskChamberWithError(const GEMDetId& chamber_id, const GEMOHStatusCollection*, const GEMVFATStatusCollection*);
0046 
0047   bool hasMEKey(const MEMap&, const GEMDetId&);
0048   void fillME(MEMap&, const GEMDetId&, const double);
0049   void fillME(MEMap&, const GEMDetId&, const double, const double);
0050 
0051   double clampWithAxis(const double, const TAxis* axis);
0052   void fillMEWithinLimits(MonitorElement*, const double);
0053   void fillMEWithinLimits(MonitorElement*, const double, const double);
0054   void fillMEWithinLimits(MEMap&, const GEMDetId&, const double);
0055   void fillMEWithinLimits(MEMap&, const GEMDetId&, const double, const double);
0056 
0057   template <typename T>
0058   bool checkRefs(const std::vector<T*>&);
0059 
0060   const edm::EDGetTokenT<GEMOHStatusCollection> kGEMOHStatusCollectionToken_;
0061   const edm::EDGetTokenT<GEMVFATStatusCollection> kGEMVFATStatusCollectionToken_;
0062 
0063   const bool kMonitorGE11_;
0064   const bool kMonitorGE21_;
0065   const bool kMonitorGE0_;
0066   const bool kMaskChamberWithError_;
0067   const std::string kLogCategory_;
0068 };
0069 
0070 template <typename T>
0071 bool GEMDQMEfficiencySourceBase::checkRefs(const std::vector<T*>& refs) {
0072   if (refs.empty())
0073     return false;
0074   for (T* each : refs) {
0075     if (each == nullptr) {
0076       return false;
0077     }
0078   }
0079   return true;
0080 }
0081 
0082 inline GEMDetId GEMDQMEfficiencySourceBase::getReStKey(const int region, const int station) {
0083   // region, ring, station, layer, chamber, ieta
0084   return GEMDetId{region, 1, station, 0, 0, 0};
0085 }
0086 
0087 inline GEMDetId GEMDQMEfficiencySourceBase::getReStKey(const GEMDetId& id) {
0088   return getReStKey(id.region(), id.station());
0089 }
0090 
0091 inline GEMDetId GEMDQMEfficiencySourceBase::getReStLaKey(const GEMDetId& id) {
0092   return GEMDetId{id.region(), 1, id.station(), id.layer(), 0, 0};
0093 }
0094 
0095 inline GEMDetId GEMDQMEfficiencySourceBase::getReStEtKey(const GEMDetId& id) {
0096   return GEMDetId{id.region(), 1, id.station(), 0, 0, id.ieta()};
0097 }
0098 
0099 inline GEMDetId GEMDQMEfficiencySourceBase::getReStLaChKey(const GEMDetId& id) {
0100   return GEMDetId{id.region(), 1, id.station(), id.layer(), id.chamber() % 2, 0};
0101 }
0102 
0103 inline GEMDetId GEMDQMEfficiencySourceBase::getKey(const GEMDetId& id) {
0104   return GEMDetId{id.region(), 1, id.station(), id.layer(), id.chamber() % 2, id.ieta()};
0105 }
0106 
0107 #endif  // DQM_GEM_GEMDQMEfficiencySourceBase_h