CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCConditions.h
Go to the documentation of this file.
1 #ifndef CSCCalibration_CSCConditions_h
2 #define CSCCalibration_CSCConditions_h
3 
16 #include <vector>
17 #include <bitset>
18 
19 class CSCDBGains;
20 class CSCDBPedestals;
21 class CSCDBCrosstalk;
22 class CSCBadStrips;
23 class CSCBadWires;
24 class CSCBadChambers;
28 
36 {
37 public:
38  explicit CSCConditions( const edm::ParameterSet& ps );
40 
42  void initializeEvent(const edm::EventSetup & es);
43 
45  float gain(const CSCDetId & detId, int channel) const;
47  float gainSigma(const CSCDetId & detId, int channel) const {return 0.005;}
48 
50  float pedestal(const CSCDetId & detId, int channel) const;
51  float pedestalSigma(const CSCDetId & detId, int channel) const;
52 
53  float crosstalkSlope(const CSCDetId & detId, int channel, bool leftRight) const;
54  float crosstalkIntercept(const CSCDetId & detId, int channel, bool leftRight) const;
55 
57  const CSCDBNoiseMatrix::Item & noiseMatrix(const CSCDetId & detId, int channel) const;
58 
60  void noiseMatrixElements( const CSCDetId& id, int channel, std::vector<float>& me ) const;
61 
63  void crossTalk( const CSCDetId& id, int channel, std::vector<float>& ct ) const;
64 
65  // returns chip speed correction in ns given detId (w/layer) and strip channel
66  float chipCorrection( const CSCDetId & detId, int channel ) const;
67 
68  //return chamber timing correction in ns given detId of chamber
69  float chamberTimingCorrection( const CSCDetId & detId) const;
70 
71  //return anode bx offset in bx given detId of chamber
72  float anodeBXoffset( const CSCDetId & detId) const;
73 
75  const std::bitset<80>& badStripWord( const CSCDetId& id ) const;
76  const std::bitset<112>& badWireWord( const CSCDetId& id ) const;
77 
78  void print() const;
79 
81  bool isInBadChamber( const CSCDetId& id ) const;
82 
84  bool readBadChannels() const { return readBadChannels_; }
85 
87  bool readBadChambers() const { return readBadChambers_; }
88 
91 
93  void fillBadStripWords();
94  void fillBadWireWords();
95 
97  float averageGain() const;
98 
100  float gasGainCorrection( const CSCDetId & detId, int strip, int wire ) const;
101 
104 
105 private:
106 
117 
118  bool readBadChannels_; // flag whether or not to even attempt reading bad channel info from db
119  bool readBadChambers_; // flag whether or not to even attempt reading bad chamber info from db
120  bool useTimingCorrections_; // flag whether or not to even attempt reading timing correction info from db
121  bool useGasGainCorrections_; // flag whether or not to even attempt reading gas-gain correction info from db
122 
123  // cache bad channel words once created
124  std::vector< std::bitset<80> > badStripWords;
125  std::vector< std::bitset<112> > badWireWords;
126 
127  mutable float theAverageGain; // average over entire system, subject to some constraints!
128 
130  //@@ remove until we have real information to use
131  // edm::ESWatcher<CSCBadStripsRcd> badStripsWatcher_;
132  // edm::ESWatcher<CSCBadWiresRcd> badWiresWatcher_;
133 
134  // Total number of CSC layers in the system, with full ME42 installed.
135  enum elayers{ MAX_LAYERS = 3240 };
136 };
137 
138 #endif
139 
140 
const std::bitset< 80 > & badStripWord(const CSCDetId &id) const
return bad channel words per CSCLayer - 1 bit per channel
edm::ESHandle< CSCDBGasGainCorrection > theGasGainCorrections
edm::ESHandle< CSCDBNoiseMatrix > theNoiseMatrix
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
edm::ESHandle< CSCBadWires > theBadWires
float pedestalSigma(const CSCDetId &detId, int channel) const
void noiseMatrixElements(const CSCDetId &id, int channel, std::vector< float > &me) const
fill vector (dim 12, must be allocated by caller) with noise matrix elements (scaled to float) ...
void fillBadStripWords()
fill bad channel words
edm::ESHandle< CSCChamberTimeCorrections > theChamberTimingCorrections
float gainSigma(const CSCDetId &detId, int channel) const
total calibration precision
Definition: CSCConditions.h:47
bool useTimingCorrections() const
did we request reading timing correction info from db?
Definition: CSCConditions.h:90
const CSCDBNoiseMatrix::Item & noiseMatrix(const CSCDetId &detId, int channel) const
return raw noise matrix (unscaled short int elements)
void print() const
edm::ESHandle< CSCBadStrips > theBadStrips
float chipCorrection(const CSCDetId &detId, int channel) const
std::vector< std::bitset< 112 > > badWireWords
float chamberTimingCorrection(const CSCDetId &detId) const
edm::ESWatcher< CSCDBGainsRcd > gainsWatcher_
void crossTalk(const CSCDetId &id, int channel, std::vector< float > &ct) const
fill vector (dim 4, must be allocated by caller) with crosstalk sl, il, sr, ir
std::vector< std::bitset< 80 > > badStripWords
float anodeBXoffset(const CSCDetId &detId) const
bool useTimingCorrections_
float pedestal(const CSCDetId &detId, int channel) const
in ADC counts
bool readBadChannels() const
did we request reading bad channel info from db?
Definition: CSCConditions.h:84
bool useGasGainCorrections_
edm::ESHandle< CSCBadChambers > theBadChambers
edm::ESHandle< CSCDBGains > theGains
void initializeEvent(const edm::EventSetup &es)
fetch the maps from the database
const std::bitset< 112 > & badWireWord(const CSCDetId &id) const
float crosstalkSlope(const CSCDetId &detId, int channel, bool leftRight) const
float crosstalkIntercept(const CSCDetId &detId, int channel, bool leftRight) const
bool isInBadChamber(const CSCDetId &id) const
Is the gven chamber flagged as bad?
float gain(const CSCDetId &detId, int channel) const
channels count from 1
CSCConditions(const edm::ParameterSet &ps)
void fillBadWireWords()
edm::ESHandle< CSCDBChipSpeedCorrection > theChipCorrections
edm::ESHandle< CSCDBCrosstalk > theCrosstalk
bool readBadChambers() const
did we request reading bad chamber info from db?
Definition: CSCConditions.h:87
float gasGainCorrection(const CSCDetId &detId, int strip, int wire) const
gas gain correction as a function of detId (w/layer), strip, and wire
float averageGain() const
average gain over entire CSC system (logically const although must be cached here).
bool useGasGainCorrections() const
did we request reading gas gain correction info from db?
float theAverageGain
edm::ESHandle< CSCDBPedestals > thePedestals