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 
15 #include <vector>
16 #include <bitset>
17 
18 class CSCDBGains;
19 class CSCDBPedestals;
20 class CSCDBCrosstalk;
21 class CSCBadStrips;
22 class CSCBadWires;
23 class CSCBadChambers;
26 
34 {
35 public:
36  explicit CSCConditions( const edm::ParameterSet& ps );
38 
40  void initializeEvent(const edm::EventSetup & es);
41 
43  float gain(const CSCDetId & detId, int channel) const;
45  float gainSigma(const CSCDetId & detId, int channel) const {return 0.005;}
46 
48  float pedestal(const CSCDetId & detId, int channel) const;
49  float pedestalSigma(const CSCDetId & detId, int channel) const;
50 
51  float crosstalkSlope(const CSCDetId & detId, int channel, bool leftRight) const;
52  float crosstalkIntercept(const CSCDetId & detId, int channel, bool leftRight) const;
53 
55  const CSCDBNoiseMatrix::Item & noiseMatrix(const CSCDetId & detId, int channel) const;
56 
58  void noiseMatrixElements( const CSCDetId& id, int channel, std::vector<float>& me ) const;
59 
61  void crossTalk( const CSCDetId& id, int channel, std::vector<float>& ct ) const;
62 
63  // returns chip speed correction in ns given detId (w/layer) and strip channel
64  float chipCorrection( const CSCDetId & detId, int channel ) const;
65 
66  //return chamber timing correction in ns given detId of chamber
67  float chamberTimingCorrection( const CSCDetId & detId) const;
68 
69  //return anode bx offset in bx given detId of chamber
70  float anodeBXoffset( const CSCDetId & detId) const;
71 
73  const std::bitset<80>& badStripWord( const CSCDetId& id ) const;
74  const std::bitset<112>& badWireWord( const CSCDetId& id ) const;
75 
76  void print() const;
77 
79  bool isInBadChamber( const CSCDetId& id ) const;
80 
82  bool readBadChannels() const { return readBadChannels_; }
83 
85  bool readBadChambers() const { return readBadChambers_; }
86 
89 
91  void fillBadStripWords();
92  void fillBadWireWords();
93 
95  float averageGain() const;
96 
97 private:
98 
108 
109  bool readBadChannels_; // flag whether or not to even attempt reading bad channel info from db
110  bool readBadChambers_; // flag whether or not to even attempt reading bad chamber info from db
111  bool useTimingCorrections_; // flag whether or not to even attempt reading timing correction info from db
112 
113  // cache bad channel words once created
114  std::vector< std::bitset<80> > badStripWords;
115  std::vector< std::bitset<112> > badWireWords;
116 
117  mutable float theAverageGain; // average over entire system, subject to some constraints!
118 
120  //@@ remove until we have real information to use
121  // edm::ESWatcher<CSCBadStripsRcd> badStripsWatcher_;
122  // edm::ESWatcher<CSCBadWiresRcd> badWiresWatcher_;
123 
124  // Total number of CSC layers in the system, with full ME42 installed.
125  enum elayers{ MAX_LAYERS = 3240 };
126 };
127 
128 #endif
129 
130 
const std::bitset< 80 > & badStripWord(const CSCDetId &id) const
return bad channel words per CSCLayer - 1 bit per channel
edm::ESHandle< CSCDBNoiseMatrix > theNoiseMatrix
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:45
bool useTimingCorrections() const
did we request reading timing correction info from db?
Definition: CSCConditions.h:88
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:82
edm::ESHandle< CSCBadChambers > theBadChambers
edm::ESHandle< CSCDBGains > theGains
Definition: CSCConditions.h:99
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:85
float averageGain() const
average gain over entire CSC system (logically const although must be cached here).
float theAverageGain
edm::ESHandle< CSCDBPedestals > thePedestals