Go to the documentation of this file.00001 #ifndef CSCCalibration_CSCConditions_h
00002 #define CSCCalibration_CSCConditions_h
00003
00004 #include "FWCore/Framework/interface/ESWatcher.h"
00005 #include "FWCore/Framework/interface/ESHandle.h"
00006 #include "FWCore/Framework/interface/Frameworkfwd.h"
00007 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00008 #include "CondFormats/CSCObjects/interface/CSCDBNoiseMatrix.h"
00009 #include "CondFormats/DataRecord/interface/CSCDBGainsRcd.h"
00010 #include "CondFormats/DataRecord/interface/CSCBadStripsRcd.h"
00011 #include "CondFormats/DataRecord/interface/CSCBadWiresRcd.h"
00012 #include "CondFormats/DataRecord/interface/CSCBadChambersRcd.h"
00013 #include "CondFormats/DataRecord/interface/CSCDBChipSpeedCorrectionRcd.h"
00014 #include "CondFormats/DataRecord/interface/CSCChamberTimeCorrectionsRcd.h"
00015 #include "CondFormats/DataRecord/interface/CSCDBGasGainCorrectionRcd.h"
00016 #include <vector>
00017 #include <bitset>
00018
00019 class CSCDBGains;
00020 class CSCDBPedestals;
00021 class CSCDBCrosstalk;
00022 class CSCBadStrips;
00023 class CSCBadWires;
00024 class CSCBadChambers;
00025 class CSCDBChipSpeedCorrection;
00026 class CSCChamberTimeCorrections;
00027 class CSCDBGasGainCorrection;
00028
00035 class CSCConditions
00036 {
00037 public:
00038 explicit CSCConditions( const edm::ParameterSet& ps );
00039 ~CSCConditions();
00040
00042 void initializeEvent(const edm::EventSetup & es);
00043
00045 float gain(const CSCDetId & detId, int channel) const;
00047 float gainSigma(const CSCDetId & detId, int channel) const {return 0.005;}
00048
00050 float pedestal(const CSCDetId & detId, int channel) const;
00051 float pedestalSigma(const CSCDetId & detId, int channel) const;
00052
00053 float crosstalkSlope(const CSCDetId & detId, int channel, bool leftRight) const;
00054 float crosstalkIntercept(const CSCDetId & detId, int channel, bool leftRight) const;
00055
00057 const CSCDBNoiseMatrix::Item & noiseMatrix(const CSCDetId & detId, int channel) const;
00058
00060 void noiseMatrixElements( const CSCDetId& id, int channel, std::vector<float>& me ) const;
00061
00063 void crossTalk( const CSCDetId& id, int channel, std::vector<float>& ct ) const;
00064
00065
00066 float chipCorrection( const CSCDetId & detId, int channel ) const;
00067
00068
00069 float chamberTimingCorrection( const CSCDetId & detId) const;
00070
00071
00072 float anodeBXoffset( const CSCDetId & detId) const;
00073
00075 const std::bitset<80>& badStripWord( const CSCDetId& id ) const;
00076 const std::bitset<112>& badWireWord( const CSCDetId& id ) const;
00077
00078 void print() const;
00079
00081 bool isInBadChamber( const CSCDetId& id ) const;
00082
00084 bool readBadChannels() const { return readBadChannels_; }
00085
00087 bool readBadChambers() const { return readBadChambers_; }
00088
00090 bool useTimingCorrections() const { return useTimingCorrections_; }
00091
00093 void fillBadStripWords();
00094 void fillBadWireWords();
00095
00097 float averageGain() const;
00098
00100 float gasGainCorrection( const CSCDetId & detId, int strip, int wire ) const;
00101
00103 bool useGasGainCorrections() const { return useGasGainCorrections_; }
00104
00105 private:
00106
00107 edm::ESHandle<CSCDBGains> theGains;
00108 edm::ESHandle<CSCDBCrosstalk> theCrosstalk;
00109 edm::ESHandle<CSCDBPedestals> thePedestals;
00110 edm::ESHandle<CSCDBNoiseMatrix> theNoiseMatrix;
00111 edm::ESHandle<CSCBadStrips> theBadStrips;
00112 edm::ESHandle<CSCBadWires> theBadWires;
00113 edm::ESHandle<CSCBadChambers> theBadChambers;
00114 edm::ESHandle<CSCDBChipSpeedCorrection> theChipCorrections;
00115 edm::ESHandle<CSCChamberTimeCorrections> theChamberTimingCorrections;
00116 edm::ESHandle<CSCDBGasGainCorrection> theGasGainCorrections;
00117
00118 bool readBadChannels_;
00119 bool readBadChambers_;
00120 bool useTimingCorrections_;
00121 bool useGasGainCorrections_;
00122
00123
00124 std::vector< std::bitset<80> > badStripWords;
00125 std::vector< std::bitset<112> > badWireWords;
00126
00127 mutable float theAverageGain;
00128
00129 edm::ESWatcher<CSCDBGainsRcd> gainsWatcher_;
00130
00131
00132
00133
00134
00135 enum elayers{ MAX_LAYERS = 3240 };
00136 };
00137
00138 #endif
00139
00140