Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:54:20

0001 #ifndef EcalDQMCommonUtils_H
0002 #define EcalDQMCommonUtils_H
0003 
0004 #include <algorithm>
0005 #include <cmath>
0006 #include <iomanip>
0007 
0008 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0009 #include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h"
0010 #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h"
0011 
0012 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0013 #include "DataFormats/EcalDetId/interface/EEDetId.h"
0014 #include "DataFormats/EcalDetId/interface/EcalElectronicsId.h"
0015 #include "DataFormats/EcalDetId/interface/EcalPnDiodeDetId.h"
0016 #include "DataFormats/EcalDetId/interface/EcalScDetId.h"
0017 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
0018 #include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h"
0019 #include "DataFormats/EcalDetId/interface/EcalTriggerElectronicsId.h"
0020 
0021 #include "FWCore/Utilities/interface/Exception.h"
0022 
0023 namespace ecaldqm {
0024 
0025   enum SMName {
0026     kEEm07,
0027     kEEm08,
0028     kEEm09,
0029     kEEm01,
0030     kEEm02,
0031     kEEm03,
0032     kEEm04,
0033     kEEm05,
0034     kEEm06,
0035     kEBm01,
0036     kEBm02,
0037     kEBm03,
0038     kEBm04,
0039     kEBm05,
0040     kEBm06,
0041     kEBm07,
0042     kEBm08,
0043     kEBm09,
0044     kEBm10,
0045     kEBm11,
0046     kEBm12,
0047     kEBm13,
0048     kEBm14,
0049     kEBm15,
0050     kEBm16,
0051     kEBm17,
0052     kEBm18,
0053     kEBp01,
0054     kEBp02,
0055     kEBp03,
0056     kEBp04,
0057     kEBp05,
0058     kEBp06,
0059     kEBp07,
0060     kEBp08,
0061     kEBp09,
0062     kEBp10,
0063     kEBp11,
0064     kEBp12,
0065     kEBp13,
0066     kEBp14,
0067     kEBp15,
0068     kEBp16,
0069     kEBp17,
0070     kEBp18,
0071     kEEp07,
0072     kEEp08,
0073     kEEp09,
0074     kEEp01,
0075     kEEp02,
0076     kEEp03,
0077     kEEp04,
0078     kEEp05,
0079     kEEp06,
0080     kEEmLow = kEEm07,
0081     kEEmHigh = kEEm06,
0082     kEEpLow = kEEp07,
0083     kEEpHigh = kEEp06,
0084     kEBmLow = kEBm01,
0085     kEBmHigh = kEBm18,
0086     kEBpLow = kEBp01,
0087     kEBpHigh = kEBp18
0088   };
0089 
0090   enum Constants {
0091     nDCC = 54,
0092     nEBDCC = 36,
0093     nEEDCC = 18,
0094     nDCCMEM = 44,
0095     nEEDCCMEM = 8,
0096 
0097     nTTOuter = 16,
0098     nTTInner = 28,
0099     // These lines set the number of TriggerTowers in "outer" and "inner" TCCs,
0100     // where "outer" := closer to the barrel. These constants are used in
0101     // setting the binning. There are 16 trigger towers per TCC for "outer" TCCs,
0102     // and 24 per TCC for "inner" TCCs (but the numbering is from 0 to 27, so
0103     // 28 bins are required).
0104 
0105     nTCC = 108,
0106     kEEmTCCLow = 0,
0107     kEEmTCCHigh = 35,
0108     kEEpTCCLow = 72,
0109     kEEpTCCHigh = 107,
0110     kEBTCCLow = 36,
0111     kEBTCCHigh = 71,
0112 
0113     nChannels = EBDetId::kSizeForDenseIndexing + EEDetId::kSizeForDenseIndexing,
0114     nTowers = EcalTrigTowerDetId::kEBTotalTowers + EcalScDetId::kSizeForDenseIndexing
0115   };
0116 
0117   extern std::vector<unsigned> const memDCC;
0118 
0119   extern double const etaBound;
0120 
0121   // returns DCC ID (1 - 54)
0122   unsigned dccId(DetId const &, EcalElectronicsMapping const *);
0123   unsigned dccId(EcalElectronicsId const &);
0124 
0125   unsigned memDCCId(unsigned);     // convert from dccId skipping DCCs without MEM
0126   unsigned memDCCIndex(unsigned);  // reverse conversion
0127 
0128   // returns TCC ID (1 - 108)
0129   unsigned tccId(DetId const &, EcalElectronicsMapping const *);
0130   unsigned tccId(EcalElectronicsId const &, EcalElectronicsMapping const *);
0131 
0132   // returns the data tower id - pass only
0133   unsigned towerId(DetId const &, EcalElectronicsMapping const *);
0134   unsigned towerId(EcalElectronicsId const &);
0135 
0136   unsigned ttId(DetId const &, EcalElectronicsMapping const *);
0137   unsigned ttId(EcalElectronicsId const &, EcalElectronicsMapping const *);
0138 
0139   unsigned rtHalf(DetId const &, EcalElectronicsMapping const *);
0140 
0141   std::pair<unsigned, unsigned> innerTCCs(unsigned);
0142   std::pair<unsigned, unsigned> outerTCCs(unsigned);
0143 
0144   std::vector<DetId> scConstituents(EcalScDetId const &);
0145 
0146   EcalPnDiodeDetId pnForCrystal(DetId const &, char, EcalElectronicsMapping const *);
0147 
0148   unsigned dccId(std::string const &);
0149   std::string smName(unsigned);
0150 
0151   int zside(DetId const &);
0152 
0153   double eta(EBDetId const &, CaloGeometry const *);
0154   double eta(EEDetId const &, CaloGeometry const *);
0155   double phi(EBDetId const &);
0156   double phi(EEDetId const &);
0157   double phi(EcalTrigTowerDetId const &);
0158   double phi(double);
0159 
0160   bool isForward(DetId const &);
0161 
0162   bool isCrystalId(DetId const &);
0163   bool isSingleChannelId(DetId const &);
0164   bool isEcalScDetId(DetId const &);
0165   bool isEndcapTTId(DetId const &);
0166 
0167   unsigned nCrystals(unsigned);
0168   unsigned nSuperCrystals(unsigned);
0169 
0170   bool ccuExists(unsigned, unsigned);
0171 }  // namespace ecaldqm
0172 
0173 #endif