00001 #ifndef CSCObjects_CSCConditions_h
00002 #define CSCObjects_CSCConditions_h
00003
00004 #include "FWCore/Framework/interface/EventSetup.h"
00005 #include "FWCore/Framework/interface/ESWatcher.h"
00006 #include "FWCore/ParameterSet/interface/ParameterSet.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 <vector>
00014 #include <bitset>
00015
00016 class CSCDBGains;
00017 class CSCDBPedestals;
00018 class CSCDBCrosstalk;
00019 class CSCBadStrips;
00020 class CSCBadWires;
00021 class CSCBadChambers;
00022
00029 class CSCConditions
00030 {
00031 public:
00032 CSCConditions( const edm::ParameterSet& ps );
00033 ~CSCConditions();
00034
00036 void initializeEvent(const edm::EventSetup & es);
00037
00039 float gain(const CSCDetId & detId, int channel) const;
00041 float gainSigma(const CSCDetId & detId, int channel) const {return 0.005;}
00042
00044 float pedestal(const CSCDetId & detId, int channel) const;
00045 float pedestalSigma(const CSCDetId & detId, int channel) const;
00046
00047 float crosstalkSlope(const CSCDetId & detId, int channel, bool leftRight) const;
00048 float crosstalkIntercept(const CSCDetId & detId, int channel, bool leftRight) const;
00049
00051 const CSCDBNoiseMatrix::Item & noiseMatrix(const CSCDetId & detId, int channel) const;
00052
00054 void noiseMatrixElements( const CSCDetId& id, int channel, std::vector<float>& me ) const;
00055
00057 void crossTalk( const CSCDetId& id, int channel, std::vector<float>& ct ) const;
00058
00060 const std::bitset<80>& badStripWord( const CSCDetId& id ) const;
00061 const std::bitset<112>& badWireWord( const CSCDetId& id ) const;
00062
00064 bool isInBadChamber( const CSCDetId& id ) const;
00065
00066 void print() const;
00067
00069 bool readBadChannels() const { return readBadChannels_; }
00070
00072 bool readBadChambers() const { return readBadChambers_; }
00073
00075 void fillBadStripWords();
00076 void fillBadWireWords();
00077
00079 float averageGain() const;
00080
00081 private:
00082
00083 const CSCDBNoiseMatrix * theNoiseMatrix;
00084 const CSCDBGains * theGains;
00085 const CSCDBPedestals * thePedestals;
00086 const CSCDBCrosstalk * theCrosstalk;
00087
00088 const CSCBadStrips* theBadStrips;
00089 const CSCBadWires* theBadWires;
00090 const CSCBadChambers* theBadChambers;
00091 bool readBadChannels_;
00092 bool readBadChambers_;
00093
00094
00095 std::vector< std::bitset<80> > badStripWords;
00096 std::vector< std::bitset<112> > badWireWords;
00097
00098 mutable float theAverageGain;
00099
00100 edm::ESWatcher<CSCDBGainsRcd> gainsWatcher_;
00101
00102
00103
00104 };
00105
00106 #endif
00107
00108