File indexing completed on 2024-04-06 11:58:20
0001 #ifndef CSCCalibration_CSCConditions_h
0002 #define CSCCalibration_CSCConditions_h
0003
0004 #include "CondFormats/DataRecord/interface/CSCChamberTimeCorrectionsRcd.h"
0005 #include "CondFormats/DataRecord/interface/CSCDBChipSpeedCorrectionRcd.h"
0006 #include "CondFormats/DataRecord/interface/CSCDBCrosstalkRcd.h"
0007 #include "CondFormats/DataRecord/interface/CSCDBGasGainCorrectionRcd.h"
0008 #include "CondFormats/DataRecord/interface/CSCDBNoiseMatrixRcd.h"
0009 #include "CondFormats/DataRecord/interface/CSCDBPedestalsRcd.h"
0010 #include "CondFormats/CSCObjects/interface/CSCDBNoiseMatrix.h"
0011 #include "CondFormats/DataRecord/interface/CSCBadStripsRcd.h"
0012 #include "CondFormats/DataRecord/interface/CSCBadWiresRcd.h"
0013 #include "CondFormats/DataRecord/interface/CSCDBGainsRcd.h"
0014 #include "CalibMuon/CSCCalibration/interface/CSCChannelMapperRecord.h"
0015 #include "CalibMuon/CSCCalibration/interface/CSCIndexerRecord.h"
0016 #include "CondFormats/DataRecord/interface/CSCBadChambersRcd.h"
0017 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
0018 #include "FWCore/Framework/interface/ESHandle.h"
0019 #include "FWCore/Framework/interface/ESWatcher.h"
0020 #include "FWCore/Framework/interface/Frameworkfwd.h"
0021 #include "FWCore/Framework/interface/ConsumesCollector.h"
0022 #include "FWCore/Utilities/interface/ESGetToken.h"
0023 #include <bitset>
0024 #include <vector>
0025
0026 class CSCDBGains;
0027 class CSCDBPedestals;
0028 class CSCDBCrosstalk;
0029 class CSCBadStrips;
0030 class CSCBadWires;
0031 class CSCBadChambers;
0032 class CSCDBChipSpeedCorrection;
0033 class CSCChamberTimeCorrections;
0034 class CSCDBGasGainCorrection;
0035 class CSCIndexerBase;
0036 class CSCChannelMapperBase;
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058 class CSCConditions {
0059 public:
0060 explicit CSCConditions(const edm::ParameterSet &ps, edm::ConsumesCollector);
0061 ~CSCConditions();
0062
0063
0064 void initializeEvent(const edm::EventSetup &es);
0065
0066
0067 float gain(const CSCDetId &detId, int channel) const;
0068
0069 float gainSigma(const CSCDetId &detId, int channel) const { return 0.005; }
0070
0071
0072 float pedestal(const CSCDetId &detId, int channel) const;
0073
0074 float pedestalSigma(const CSCDetId &detId, int channel) const;
0075
0076
0077 float crosstalkSlope(const CSCDetId &detId, int channel, bool leftRight) const;
0078
0079 float crosstalkIntercept(const CSCDetId &detId, int channel, bool leftRight) const;
0080
0081
0082 const CSCDBNoiseMatrix::Item &noiseMatrix(const CSCDetId &detId, int channel) const;
0083
0084
0085
0086 void noiseMatrixElements(const CSCDetId &id, int channel, std::vector<float> &me) const;
0087
0088
0089
0090 void crossTalk(const CSCDetId &id, int channel, std::vector<float> &ct) const;
0091
0092
0093 float chipCorrection(const CSCDetId &detId, int channel) const;
0094
0095
0096 float chamberTimingCorrection(const CSCDetId &detId) const;
0097
0098
0099 float anodeBXoffset(const CSCDetId &detId) const;
0100
0101
0102 const std::bitset<112> &badStripWord() const { return badStripWord_; }
0103
0104
0105 const std::bitset<112> &badWireWord() const { return badWireWord_; }
0106
0107
0108 const CSCDetId &idOfBadChannelWords() const { return idOfBadChannelWords_; }
0109
0110 void print() const;
0111
0112
0113 bool isInBadChamber(const CSCDetId &id) const;
0114
0115
0116 bool readBadChannels() const { return readBadChannels_; }
0117
0118
0119 bool readBadChambers() const { return readBadChambers_; }
0120
0121
0122 bool useTimingCorrections() const { return useTimingCorrections_; }
0123
0124
0125
0126 void fillBadChannelWords(const CSCDetId &id);
0127
0128
0129
0130 float averageGain() const;
0131
0132
0133
0134 float gasGainCorrection(const CSCDetId &detId, int strip, int wire) const;
0135
0136
0137 bool useGasGainCorrections() const { return useGasGainCorrections_; }
0138
0139
0140 int channelFromStrip(const CSCDetId &id, int geomStrip) const;
0141 int rawStripChannel(const CSCDetId &id, int geomChannel) const;
0142
0143 private:
0144
0145 void fillBadStripWord(const CSCDetId &id);
0146 void fillBadWireWord(const CSCDetId &id);
0147
0148
0149 void setIdOfBadChannelWords(const CSCDetId &id) { idOfBadChannelWords_ = id; }
0150
0151
0152
0153 edm::ESHandle<CSCDBGains> theGains;
0154 edm::ESHandle<CSCDBCrosstalk> theCrosstalk;
0155 edm::ESHandle<CSCDBPedestals> thePedestals;
0156 edm::ESHandle<CSCDBNoiseMatrix> theNoiseMatrix;
0157 edm::ESHandle<CSCBadStrips> theBadStrips;
0158 edm::ESHandle<CSCBadWires> theBadWires;
0159 edm::ESHandle<CSCBadChambers> theBadChambers;
0160 edm::ESHandle<CSCDBChipSpeedCorrection> theChipCorrections;
0161 edm::ESHandle<CSCChamberTimeCorrections> theChamberTimingCorrections;
0162 edm::ESHandle<CSCDBGasGainCorrection> theGasGainCorrections;
0163
0164
0165
0166 edm::ESHandle<CSCIndexerBase> indexer_;
0167 edm::ESHandle<CSCChannelMapperBase> mapper_;
0168
0169
0170 edm::ESGetToken<CSCDBGains, CSCDBGainsRcd> gainsToken_;
0171 edm::ESGetToken<CSCDBCrosstalk, CSCDBCrosstalkRcd> crosstalkToken_;
0172 edm::ESGetToken<CSCDBPedestals, CSCDBPedestalsRcd> pedestalsToken_;
0173 edm::ESGetToken<CSCDBNoiseMatrix, CSCDBNoiseMatrixRcd> noiseMatrixToken_;
0174 edm::ESGetToken<CSCBadStrips, CSCBadStripsRcd> badStripsToken_;
0175 edm::ESGetToken<CSCBadWires, CSCBadWiresRcd> badWiresToken_;
0176 edm::ESGetToken<CSCBadChambers, CSCBadChambersRcd> badChambersToken_;
0177 edm::ESGetToken<CSCDBChipSpeedCorrection, CSCDBChipSpeedCorrectionRcd> chipCorrectionsToken_;
0178 edm::ESGetToken<CSCChamberTimeCorrections, CSCChamberTimeCorrectionsRcd> chamberTimingCorrectionsToken_;
0179 edm::ESGetToken<CSCDBGasGainCorrection, CSCDBGasGainCorrectionRcd> gasGainCorrectionsToken_;
0180 edm::ESGetToken<CSCIndexerBase, CSCIndexerRecord> indexerToken_;
0181 edm::ESGetToken<CSCChannelMapperBase, CSCChannelMapperRecord> mapperToken_;
0182
0183
0184
0185 bool readBadChannels_;
0186
0187 bool readBadChambers_;
0188
0189 bool useTimingCorrections_;
0190
0191 bool useGasGainCorrections_;
0192
0193
0194
0195 CSCDetId idOfBadChannelWords_;
0196 std::bitset<112> badStripWord_;
0197 std::bitset<112> badWireWord_;
0198
0199 mutable float theAverageGain;
0200
0201
0202 edm::ESWatcher<CSCDBGainsRcd> gainsWatcher_;
0203
0204
0205
0206
0207
0208 enum elayers { MAX_LAYERS = 3240 };
0209 };
0210
0211 #endif