CMS 3D CMS Logo

CSCConditions.h
Go to the documentation of this file.
1 #ifndef CSCCalibration_CSCConditions_h
2 #define CSCCalibration_CSCConditions_h
3 
12 
13 #include <vector>
14 #include <bitset>
15 
16 class CSCDBGains;
17 class CSCDBPedestals;
18 class CSCDBCrosstalk;
19 class CSCBadStrips;
20 class CSCBadWires;
21 class CSCBadChambers;
25 class CSCIndexerBase;
27 
47 {
48 public:
49  explicit CSCConditions( const edm::ParameterSet& ps );
51 
53  void initializeEvent(const edm::EventSetup & es);
54 
56  float gain(const CSCDetId & detId, int channel) const;
58  float gainSigma(const CSCDetId & detId, int channel) const {return 0.005;}
59 
61  float pedestal(const CSCDetId & detId, int channel) const;
63  float pedestalSigma(const CSCDetId & detId, int channel) const;
64 
66  float crosstalkSlope(const CSCDetId & detId, int channel, bool leftRight) const;
68  float crosstalkIntercept(const CSCDetId & detId, int channel, bool leftRight) const;
69 
71  const CSCDBNoiseMatrix::Item & noiseMatrix(const CSCDetId & detId, int channel) const;
72 
74  void noiseMatrixElements( const CSCDetId& id, int channel, std::vector<float>& me ) const;
75 
77  void crossTalk( const CSCDetId& id, int channel, std::vector<float>& ct ) const;
78 
80  float chipCorrection( const CSCDetId & detId, int channel ) const;
81 
83  float chamberTimingCorrection( const CSCDetId & detId) const;
84 
86  float anodeBXoffset( const CSCDetId & detId) const;
87 
89  const std::bitset<112>& badStripWord() const {
90  return badStripWord_;
91  }
92 
94  const std::bitset<112>& badWireWord() const {
95  return badWireWord_;
96  }
97 
99  const CSCDetId& idOfBadChannelWords() const{
100  return idOfBadChannelWords_;
101  }
102 
103  void print() const;
104 
106  bool isInBadChamber( const CSCDetId& id ) const;
107 
109  bool readBadChannels() const { return readBadChannels_; }
110 
112  bool readBadChambers() const { return readBadChambers_; }
113 
116 
118  void fillBadChannelWords( const CSCDetId& id );
119 
121  float averageGain() const;
122 
124  float gasGainCorrection( const CSCDetId & detId, int strip, int wire ) const;
125 
128 
130  int channelFromStrip(const CSCDetId& id, int geomStrip) const;
131  int rawStripChannel( const CSCDetId& id, int geomChannel) const;
132 
133 private:
134 
136  void fillBadStripWord( const CSCDetId& id );
137  void fillBadWireWord( const CSCDetId& id );
139  void setIdOfBadChannelWords ( const CSCDetId& id ){
141  }
142 
143 // handles to conditions data
144 
155 
156 // handles to algorithm versions
157 
160 
161 // logical flags controlling some conditions data usage
162 
163  bool readBadChannels_; // flag whether or not to even attempt reading bad channel info from db
164  bool readBadChambers_; // flag whether or not to even attempt reading bad chamber info from db
165  bool useTimingCorrections_; // flag whether or not to even attempt reading timing correction info from db
166  bool useGasGainCorrections_; // flag whether or not to even attempt reading gas-gain correction info from db
167 
168  // Cache bad channel content for current CSC layer
170  std::bitset<112> badStripWord_;
171  std::bitset<112> badWireWord_;
172 
173  mutable float theAverageGain; // average over entire system, subject to some constraints!
174 
176  //@@ remove until we have real information to use
177  // edm::ESWatcher<CSCBadStripsRcd> badStripsWatcher_;
178  // edm::ESWatcher<CSCBadWiresRcd> badWiresWatcher_;
179 
180  // Total number of CSC layers in the system, with full ME42 installed.
181  enum elayers{ MAX_LAYERS = 3240 };
182 };
183 
184 #endif
185 
186 
edm::ESHandle< CSCDBGasGainCorrection > theGasGainCorrections
edm::ESHandle< CSCDBNoiseMatrix > theNoiseMatrix
edm::ESHandle< CSCBadWires > theBadWires
float pedestalSigma(const CSCDetId &detId, int channel) const
static ped rms in ADC counts
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 fillBadChannelWords(const CSCDetId &id)
Fill bad channel words - one for strips, one for wires, for an offline CSCDetId.
edm::ESHandle< CSCChamberTimeCorrections > theChamberTimingCorrections
float gainSigma(const CSCDetId &detId, int channel) const
overall calibration precision
Definition: CSCConditions.h:58
bool useTimingCorrections() const
did we request reading timing correction info from db?
const CSCDBNoiseMatrix::Item & noiseMatrix(const CSCDetId &detId, int channel) const
raw noise matrix (unscaled short int elements)
void print() const
edm::ESHandle< CSCBadStrips > theBadStrips
float chipCorrection(const CSCDetId &detId, int channel) const
chip speed correction in ns given detId (w/layer) and strip channel
float chamberTimingCorrection(const CSCDetId &detId) const
chamber timing correction in ns given detId of chamber
edm::ESHandle< CSCIndexerBase > indexer_
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
float anodeBXoffset(const CSCDetId &detId) const
anode bx offset in bx given detId of chamber
void fillBadWireWord(const CSCDetId &id)
bool useTimingCorrections_
std::bitset< 112 > badWireWord_
float pedestal(const CSCDetId &detId, int channel) const
static ped in ADC counts
edm::ESHandle< CSCChannelMapperBase > mapper_
bool readBadChannels() const
did we request reading bad channel info from db?
bool useGasGainCorrections_
const std::bitset< 112 > & badWireWord() const
bad wiregroup channel word for a CSCLayer - 1 bit per channel
Definition: CSCConditions.h:94
int rawStripChannel(const CSCDetId &id, int geomChannel) const
edm::ESHandle< CSCBadChambers > theBadChambers
int channelFromStrip(const CSCDetId &id, int geomStrip) const
feedthrough for external access
edm::ESHandle< CSCDBGains > theGains
void initializeEvent(const edm::EventSetup &es)
fetch database content via EventSetup
void fillBadStripWord(const CSCDetId &id)
fill bad channel words for offline id
float crosstalkSlope(const CSCDetId &detId, int channel, bool leftRight) const
crosstalk slope for left and right
float crosstalkIntercept(const CSCDetId &detId, int channel, bool leftRight) const
crosstalk intercept for left and right
bool isInBadChamber(const CSCDetId &id) const
Is the gven chamber flagged as bad?
float gain(const CSCDetId &detId, int channel) const
gain per channel
CSCConditions(const edm::ParameterSet &ps)
edm::ESHandle< CSCDBChipSpeedCorrection > theChipCorrections
edm::ESHandle< CSCDBCrosstalk > theCrosstalk
bool readBadChambers() const
did we request reading bad chamber info from db?
void setIdOfBadChannelWords(const CSCDetId &id)
Set id for current content of bad channel words - this is offline id i.e. separate for ME11A & ME11B...
const CSCDetId & idOfBadChannelWords() const
the offline CSCDetId of current bad channel words
Definition: CSCConditions.h:99
float gasGainCorrection(const CSCDetId &detId, int strip, int wire) const
gas gain correction as a function of detId (w/layer), strip, and wire channels
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
std::bitset< 112 > badStripWord_
CSCDetId idOfBadChannelWords_
const std::bitset< 112 > & badStripWord() const
bad strip channel word for a CSCLayer - 1 bit per channel
Definition: CSCConditions.h:89