Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef MESetBinningUtils_H
0002 #define MESetBinningUtils_H
0003 
0004 #include "DQMServices/Core/interface/DQMStore.h"
0005 #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h"
0006 
0007 #include <string>
0008 
0009 class DetId;
0010 class EcalElectronicsId;
0011 namespace edm {
0012   class ParameterSet;
0013   class ParameterSetDescription;
0014 }  // namespace edm
0015 
0016 namespace ecaldqm {
0017   namespace binning {
0018     enum ObjectType {
0019       kEB,
0020       kEE,
0021       kEEm,
0022       kEEp,
0023       kSM,
0024       kEBSM,
0025       kEESM,
0026       kSMMEM,
0027       kEBSMMEM,
0028       kEESMMEM,
0029       kEcal,
0030       kMEM,
0031       kEBMEM,
0032       kEEMEM,
0033       kEcal2P,
0034       kEcal3P,
0035       kEE2P,
0036       kMEM2P,
0037       kChannel,
0038       nObjType
0039     };
0040 
0041     enum BinningType {
0042       kCrystal,
0043       kTriggerTower,
0044       kSuperCrystal,
0045       kPseudoStrip,
0046       kTCC,
0047       kDCC,
0048       kProjEta,
0049       kProjPhi,
0050       kRCT,
0051       kUser,
0052       kReport,
0053       kTrend,
0054       nBinType
0055     };
0056 
0057     typedef int Constants;
0058     static constexpr int nPresetBinnings = kRCT + 1, nEBSMEta = 85, nEBSMPhi = 20, nEESMX = 40;
0059     static constexpr int nEESMXRed = 30;  // for EE+-01&05&09
0060     static constexpr int nEESMXExt = 45;  //for EE+-02&08
0061     static constexpr int nEESMY = 40;
0062     static constexpr int nEESMYRed = 35;  // for EE+-03&07
0063     static constexpr int nEBEtaBins = 34, nEEEtaBins = 20, nPhiBins = 36;
0064 
0065     struct AxisSpecs {
0066       int nbins;
0067       float low, high;
0068       std::vector<float> edges;
0069       std::vector<std::string> labels;
0070       std::string title;
0071       AxisSpecs() : nbins(0), low(0.), high(0.), edges(0), labels(0), title("") { ; };
0072     };
0073 
0074     AxisSpecs getBinning(EcalElectronicsMapping const *, ObjectType, BinningType, bool, int, unsigned);
0075 
0076     int findBin1D(EcalElectronicsMapping const *, ObjectType, BinningType, DetId const &);
0077     int findBin1D(EcalElectronicsMapping const *, ObjectType, BinningType, EcalElectronicsId const &);
0078     int findBin1D(EcalElectronicsMapping const *, ObjectType, BinningType, int);
0079 
0080     int findBin2D(EcalElectronicsMapping const *, ObjectType, BinningType, DetId const &);
0081     int findBin2D(EcalElectronicsMapping const *, ObjectType, BinningType, EcalElectronicsId const &);
0082     int findBin2D(EcalElectronicsMapping const *, ObjectType, BinningType, int);
0083 
0084     unsigned findPlotIndex(EcalElectronicsMapping const *, ObjectType, DetId const &);
0085     unsigned findPlotIndex(EcalElectronicsMapping const *, ObjectType, EcalElectronicsId const &);
0086     unsigned findPlotIndex(EcalElectronicsMapping const *, ObjectType, int, BinningType _btype = kDCC);
0087 
0088     ObjectType getObject(ObjectType, unsigned);
0089 
0090     unsigned getNObjects(ObjectType);
0091 
0092     bool isValidIdBin(EcalElectronicsMapping const *, ObjectType, BinningType, unsigned, int);
0093 
0094     std::string channelName(EcalElectronicsMapping const *, uint32_t, BinningType _btype = kDCC);
0095 
0096     uint32_t idFromName(std::string const &);
0097     uint32_t idFromBin(ObjectType, BinningType, unsigned, int);
0098 
0099     AxisSpecs formAxis(edm::ParameterSet const &);
0100     void fillAxisDescriptions(edm::ParameterSetDescription &);
0101 
0102     ObjectType translateObjectType(std::string const &);
0103     BinningType translateBinningType(std::string const &);
0104     dqm::legacy::MonitorElement::Kind translateKind(std::string const &);
0105 
0106     /* Functions used only internally within binning namespace */
0107 
0108     // used for SM binnings
0109     int xlow_(int);
0110     int ylow_(int);
0111 
0112     AxisSpecs getBinningEB_(BinningType, bool, int);
0113     AxisSpecs getBinningEE_(BinningType, bool, int, int);
0114     AxisSpecs getBinningSM_(BinningType, bool, unsigned, int, EcalElectronicsMapping const *);
0115     AxisSpecs getBinningSMMEM_(BinningType, bool, unsigned, int);
0116     AxisSpecs getBinningEcal_(BinningType, bool, int);
0117     AxisSpecs getBinningMEM_(BinningType, bool, int, int);
0118 
0119     int findBinCrystal_(EcalElectronicsMapping const *, ObjectType, DetId const &, int = -1);
0120     int findBinCrystal_(EcalElectronicsMapping const *, ObjectType, EcalElectronicsId const &);
0121     int findBinTriggerTower_(EcalElectronicsMapping const *, ObjectType, DetId const &);
0122     int findBinPseudoStrip_(EcalElectronicsMapping const *, ObjectType, DetId const &);
0123     int findBinRCT_(ObjectType, DetId const &);
0124     int findBinSuperCrystal_(EcalElectronicsMapping const *, ObjectType, DetId const &, int = -1);
0125     int findBinSuperCrystal_(EcalElectronicsMapping const *, ObjectType, EcalElectronicsId const &);
0126   }  // namespace binning
0127 }  // namespace ecaldqm
0128 
0129 #endif