CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Attributes
CSCConditions Class Reference

#include <CSCConditions.h>

Public Member Functions

float anodeBXoffset (const CSCDetId &detId) const
 anode bx offset in bx given detId of chamber More...
 
float averageGain () const
 average gain over entire CSC system (logically const although must be cached here). More...
 
const std::bitset< 80 > & badStripWord (const CSCDetId &id) const
 bad channel words per CSCLayer - 1 bit per channel More...
 
const std::bitset< 112 > & badWireWord (const CSCDetId &id) const
 
float chamberTimingCorrection (const CSCDetId &detId) const
 chamber timing correction in ns given detId of chamber More...
 
int channelFromStrip (const CSCDetId &id, int geomStrip) const
 feedthrough for external access More...
 
float chipCorrection (const CSCDetId &detId, int channel) const
 chip speed correction in ns given detId (w/layer) and strip channel More...
 
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 More...
 
float crosstalkIntercept (const CSCDetId &detId, int channel, bool leftRight) const
 crosstalk intercept for left and right More...
 
float crosstalkSlope (const CSCDetId &detId, int channel, bool leftRight) const
 crosstalk slope for left and right More...
 
 CSCConditions (const edm::ParameterSet &ps)
 
void fillBadStripWords ()
 fill bad channel words More...
 
void fillBadWireWords ()
 
float gain (const CSCDetId &detId, int channel) const
 gain per channel More...
 
float gainSigma (const CSCDetId &detId, int channel) const
 overall calibration precision More...
 
float gasGainCorrection (const CSCDetId &detId, int strip, int wire) const
 gas gain correction as a function of detId (w/layer), strip, and wire channels More...
 
void initializeEvent (const edm::EventSetup &es)
 fetch database content via EventSetup More...
 
bool isInBadChamber (const CSCDetId &id) const
 Is the gven chamber flagged as bad? More...
 
const CSCDBNoiseMatrix::ItemnoiseMatrix (const CSCDetId &detId, int channel) const
 raw noise matrix (unscaled short int elements) More...
 
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) More...
 
float pedestal (const CSCDetId &detId, int channel) const
 static ped in ADC counts More...
 
float pedestalSigma (const CSCDetId &detId, int channel) const
 static ped rms in ADC counts More...
 
void print () const
 
int rawStripChannel (const CSCDetId &id, int geomChannel) const
 
bool readBadChambers () const
 did we request reading bad chamber info from db? More...
 
bool readBadChannels () const
 did we request reading bad channel info from db? More...
 
bool useGasGainCorrections () const
 did we request reading gas gain correction info from db? More...
 
bool useTimingCorrections () const
 did we request reading timing correction info from db? More...
 
 ~CSCConditions ()
 

Private Types

enum  elayers { MAX_LAYERS = 3240 }
 

Private Attributes

std::vector< std::bitset< 80 > > badStripWords
 
std::vector< std::bitset< 112 > > badWireWords
 
edm::ESWatcher< CSCDBGainsRcdgainsWatcher_
 
edm::ESHandle< CSCIndexerBaseindexer_
 
edm::ESHandle
< CSCChannelMapperBase
mapper_
 
bool readBadChambers_
 
bool readBadChannels_
 
float theAverageGain
 
edm::ESHandle< CSCBadChamberstheBadChambers
 
edm::ESHandle< CSCBadStripstheBadStrips
 
edm::ESHandle< CSCBadWirestheBadWires
 
edm::ESHandle
< CSCChamberTimeCorrections
theChamberTimingCorrections
 
edm::ESHandle
< CSCDBChipSpeedCorrection
theChipCorrections
 
edm::ESHandle< CSCDBCrosstalktheCrosstalk
 
edm::ESHandle< CSCDBGainstheGains
 
edm::ESHandle
< CSCDBGasGainCorrection
theGasGainCorrections
 
edm::ESHandle< CSCDBNoiseMatrixtheNoiseMatrix
 
edm::ESHandle< CSCDBPedestalsthePedestals
 
bool useGasGainCorrections_
 
bool useTimingCorrections_
 

Detailed Description

Encapsulates a user interface into the CSC conditions

Author
Rick Wilkinson
Tim Cox

Interfaces generally use "channels" which count from 1 and are 'geometric' i.e. in the order matching local coordinates. This is the channel labelling in CSCStripDigi (and CSCWireDigi) after internal corrections within CSCRawToDigi.

The input CSCDetId is also 'geometric channel level' i.e. ME11A has its own CSCDetId even in the ganged case,

Ganged ME1a channels are 1-16 (and unganged, of course, 1-48)

From CMSSW 61X, this class also handles separate algorithm versions for indexing the conditions data and for mapping between online and offline channel labelling.

Definition at line 46 of file CSCConditions.h.

Member Enumeration Documentation

enum CSCConditions::elayers
private
Enumerator
MAX_LAYERS 

Definition at line 162 of file CSCConditions.h.

Constructor & Destructor Documentation

CSCConditions::CSCConditions ( const edm::ParameterSet ps)
explicit

Definition at line 36 of file CSCConditions.cc.

References badStripWords, badWireWords, edm::ParameterSet::getParameter(), MAX_LAYERS, readBadChambers_, readBadChannels_, useGasGainCorrections_, and useTimingCorrections_.

40  indexer_(0), mapper_(0),
41  readBadChannels_(false), readBadChambers_(false),
43 {
44  readBadChannels_ = ps.getParameter<bool>("readBadChannels");
45  readBadChambers_ = ps.getParameter<bool>("readBadChambers");
46  useTimingCorrections_ = ps.getParameter<bool>("CSCUseTimingCorrections");
47  useGasGainCorrections_ = ps.getParameter<bool>("CSCUseGasGainCorrections");
48 
49  // set size to hold all layers, using enum defined in .h
50  badStripWords.resize( MAX_LAYERS, 0 );
51  badWireWords.resize( MAX_LAYERS, 0 );
52 }
T getParameter(std::string const &) const
edm::ESHandle< CSCDBGasGainCorrection > theGasGainCorrections
edm::ESHandle< CSCDBNoiseMatrix > theNoiseMatrix
edm::ESHandle< CSCBadWires > theBadWires
edm::ESHandle< CSCChamberTimeCorrections > theChamberTimingCorrections
edm::ESHandle< CSCBadStrips > theBadStrips
std::vector< std::bitset< 112 > > badWireWords
edm::ESHandle< CSCIndexerBase > indexer_
std::vector< std::bitset< 80 > > badStripWords
bool useTimingCorrections_
edm::ESHandle< CSCChannelMapperBase > mapper_
bool useGasGainCorrections_
edm::ESHandle< CSCBadChambers > theBadChambers
edm::ESHandle< CSCDBGains > theGains
edm::ESHandle< CSCDBChipSpeedCorrection > theChipCorrections
edm::ESHandle< CSCDBCrosstalk > theCrosstalk
float theAverageGain
edm::ESHandle< CSCDBPedestals > thePedestals
CSCConditions::~CSCConditions ( )

Definition at line 55 of file CSCConditions.cc.

55 {}

Member Function Documentation

float CSCConditions::anodeBXoffset ( const CSCDetId detId) const

anode bx offset in bx given detId of chamber

Definition at line 304 of file CSCConditions.cc.

References getHLTprescales::index, indexer_, edm::ESHandleBase::isValid(), mapper_, theChamberTimingCorrections, and useTimingCorrections().

Referenced by CSCRecoConditions::anodeBXoffset().

305 {
306  if ( useTimingCorrections() ){
308  CSCDetId idraw = mapper_->rawCSCDetId( id );
309  int index = indexer_->chamberIndex(idraw) - 1; // NOTE THE MINUS ONE!
310  return float ( theChamberTimingCorrections->item(index).anode_bx_offset*1./theChamberTimingCorrections->precision() );
311  }
312  else
313  return 0;
314 }
edm::ESHandle< CSCChamberTimeCorrections > theChamberTimingCorrections
bool useTimingCorrections() const
did we request reading timing correction info from db?
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESHandle< CSCChannelMapperBase > mapper_
bool isValid() const
Definition: ESHandle.h:37
float CSCConditions::averageGain ( ) const

average gain over entire CSC system (logically const although must be cached here).

Return average strip gain for full CSC system. Lazy evaluation. Restrict averaging to gains between 5 and 10, and require average is between 6 or 9 otherwise fix it to 7.5. These values came from Dominique and Stan,

Definition at line 335 of file CSCConditions.cc.

References theAverageGain, and theGains.

Referenced by CSCRecoConditions::averageGain().

335  {
336 
337  const float loEdge = 5.0; // consider gains above this
338  const float hiEdge = 10.0; // consider gains below this
339  const float loLimit = 6.0; // lowest acceptable average gain
340  const float hiLimit = 9.0; // highest acceptable average gain
341  const float expectedAverage = 7.5; // default average gain
342 
343  if ( theAverageGain > 0. ) return theAverageGain; // only recalculate if necessary
344 
345  int n_strip = 0;
346  float gain_tot = 0.;
347 
348  CSCDBGains::GainContainer::const_iterator it;
349  for ( it=theGains->gains.begin(); it!=theGains->gains.end(); ++it ) {
350  float the_gain = float( it->gain_slope )/theGains->scale();
351  if (the_gain > loEdge && the_gain < hiEdge ) {
352  gain_tot += the_gain;
353  ++n_strip;
354  }
355  }
356 
357  // Average gain
358  if ( n_strip > 0 ) {
359  theAverageGain = gain_tot / n_strip;
360  }
361 
362  // Average gain has been around 7.5 in real data
363  if ( theAverageGain < loLimit || theAverageGain > hiLimit ) {
364  // LogTrace("CSC") << "Average CSC strip gain = "
365  // << theAverageGain << " is reset to expected value " << expectedAverage;
366  theAverageGain = expectedAverage;
367  }
368 
369  return theAverageGain;
370 }
edm::ESHandle< CSCDBGains > theGains
float theAverageGain
const std::bitset< 80 > & CSCConditions::badStripWord ( const CSCDetId id) const

bad channel words per CSCLayer - 1 bit per channel

Definition at line 316 of file CSCConditions.cc.

References badStripWords, indexer_, and mapper_.

Referenced by CSCRecoConditions::badStrip().

316  {
317  //@@ NOT YET THOUGHT THROUGH FOR UNGANGED ME11A
318 
319  CSCDetId idraw = mapper_->rawCSCDetId( id );
320  return badStripWords[indexer_->layerIndex(idraw) - 1];
321 }
edm::ESHandle< CSCIndexerBase > indexer_
std::vector< std::bitset< 80 > > badStripWords
edm::ESHandle< CSCChannelMapperBase > mapper_
const std::bitset< 112 > & CSCConditions::badWireWord ( const CSCDetId id) const

Definition at line 323 of file CSCConditions.cc.

References badWireWords, indexer_, and mapper_.

Referenced by CSCRecoConditions::badWireWord().

323  {
324  //@@ NEED TO THINK ABOUT THIS SINCE ME11A & ME11B SHARE A COMMON WIRE PLANE
325  //@@ SHOULD WE JUST USE ME11B?
326 
327  CSCDetId idraw = mapper_->rawCSCDetId( id );
328  return badWireWords[indexer_->layerIndex(idraw) - 1];
329 }
std::vector< std::bitset< 112 > > badWireWords
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESHandle< CSCChannelMapperBase > mapper_
float CSCConditions::chamberTimingCorrection ( const CSCDetId detId) const

chamber timing correction in ns given detId of chamber

Definition at line 289 of file CSCConditions.cc.

References getHLTprescales::index, indexer_, edm::ESHandleBase::isValid(), mapper_, theChamberTimingCorrections, and useTimingCorrections().

Referenced by CSCRecoConditions::chamberTimingCorrection().

290 {
291  if ( useTimingCorrections() ){
293  CSCDetId idraw = mapper_->rawCSCDetId( id );
294  int index = indexer_->chamberIndex(idraw) - 1; // NOTE THE MINUS ONE!
295  return float (
296  theChamberTimingCorrections->item(index).cfeb_tmb_skew_delay*1./theChamberTimingCorrections->precision()
297  + theChamberTimingCorrections->item(index).cfeb_timing_corr*1./theChamberTimingCorrections->precision()
298  + (theChamberTimingCorrections->item(index).cfeb_cable_delay*25. )
299 );
300  }
301  else
302  return 0;
303 }
edm::ESHandle< CSCChamberTimeCorrections > theChamberTimingCorrections
bool useTimingCorrections() const
did we request reading timing correction info from db?
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESHandle< CSCChannelMapperBase > mapper_
bool isValid() const
Definition: ESHandle.h:37
int CSCConditions::channelFromStrip ( const CSCDetId id,
int  geomStrip 
) const

feedthrough for external access

Definition at line 385 of file CSCConditions.cc.

References mapper_.

Referenced by CSCRecoConditions::badStrip(), CSCRecoConditions::chipCorrection(), CSCRecoConditions::crossTalk(), CSCRecoConditions::gasGainCorrection(), CSCRecoConditions::noiseMatrix(), and CSCRecoConditions::stripWeight().

386 { return mapper_->channelFromStrip(id, geomStrip); }
edm::ESHandle< CSCChannelMapperBase > mapper_
float CSCConditions::chipCorrection ( const CSCDetId detId,
int  channel 
) const

chip speed correction in ns given detId (w/layer) and strip channel

Definition at line 276 of file CSCConditions.cc.

References getHLTprescales::index, indexer_, edm::ESHandleBase::isValid(), mapper_, theChipCorrections, and useTimingCorrections().

Referenced by CSCRecoConditions::chipCorrection().

277 {
278  if ( useTimingCorrections() ){
279  assert(theChipCorrections.isValid());
280  CSCDetId idraw = mapper_->rawCSCDetId( id );
281  int iraw = mapper_->rawStripChannel( id, geomChannel);
282  int ichip = indexer_->chipIndex(iraw); // converts 1-80 to 1-5 (chip#, CFEB#)
283  int index = indexer_->chipIndex(idraw, ichip) - 1; // NOTE THE MINUS ONE!
284  return float ( theChipCorrections->value(index) )/theChipCorrections->scale();
285  }
286  else
287  return 0;
288 }
bool useTimingCorrections() const
did we request reading timing correction info from db?
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESHandle< CSCChannelMapperBase > mapper_
edm::ESHandle< CSCDBChipSpeedCorrection > theChipCorrections
bool isValid() const
Definition: ESHandle.h:37
void CSCConditions::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

Definition at line 264 of file CSCConditions.cc.

References getHLTprescales::index, indexer_, edm::ESHandleBase::isValid(), mapper_, and theCrosstalk.

Referenced by CSCRecoConditions::crossTalk().

264  {
265  assert(theCrosstalk.isValid());
266  CSCDetId idraw = mapper_->rawCSCDetId( id );
267  int iraw = mapper_->rawStripChannel( id, geomChannel );
268  int index = indexer_->stripChannelIndex( idraw, iraw ) - 1; // NOTE THE MINUS ONE!
269 
270  ct[0] = float ( theCrosstalk->lslope(index) )/theCrosstalk->sscale();
271  ct[1] = float ( theCrosstalk->linter(index) )/theCrosstalk->iscale();
272  ct[2] = float ( theCrosstalk->rslope(index) )/theCrosstalk->sscale();
273  ct[3] = float ( theCrosstalk->rinter(index) )/theCrosstalk->iscale();
274 }
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESHandle< CSCChannelMapperBase > mapper_
edm::ESHandle< CSCDBCrosstalk > theCrosstalk
bool isValid() const
Definition: ESHandle.h:37
float CSCConditions::crosstalkIntercept ( const CSCDetId detId,
int  channel,
bool  leftRight 
) const

crosstalk intercept for left and right

Definition at line 212 of file CSCConditions.cc.

References getHLTprescales::index, indexer_, edm::ESHandleBase::isValid(), mapper_, and theCrosstalk.

Referenced by CSCDbStripConditions::crosstalk().

213 {
214  assert(theCrosstalk.isValid());
215  CSCDetId idraw = mapper_->rawCSCDetId( id );
216  int iraw = mapper_->rawStripChannel( id, geomChannel );
217  int index = indexer_->stripChannelIndex( idraw, iraw ) - 1; // NOTE THE MINUS ONE!
218  // resistive fraction is at the peak, where t=0
219  return leftRight ? float ( theCrosstalk->rinter(index) )/theCrosstalk->iscale()
220  : float ( theCrosstalk->linter(index) )/theCrosstalk->iscale() ;
221 }
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESHandle< CSCChannelMapperBase > mapper_
edm::ESHandle< CSCDBCrosstalk > theCrosstalk
bool isValid() const
Definition: ESHandle.h:37
float CSCConditions::crosstalkSlope ( const CSCDetId detId,
int  channel,
bool  leftRight 
) const

crosstalk slope for left and right

Definition at line 224 of file CSCConditions.cc.

References getHLTprescales::index, indexer_, edm::ESHandleBase::isValid(), mapper_, and theCrosstalk.

Referenced by CSCDbStripConditions::crosstalk().

225 {
226  assert(theCrosstalk.isValid());
227  CSCDetId idraw = mapper_->rawCSCDetId( id );
228  int iraw = mapper_->rawStripChannel( id, geomChannel );
229  int index = indexer_->stripChannelIndex( idraw, iraw ) - 1; // NOTE THE MINUS ONE!
230  // resistive fraction is at the peak, where t=0
231  return leftRight ? float ( theCrosstalk->rslope(index) )/theCrosstalk->sscale()
232  : float ( theCrosstalk->lslope(index) )/theCrosstalk->sscale() ;
233 }
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESHandle< CSCChannelMapperBase > mapper_
edm::ESHandle< CSCDBCrosstalk > theCrosstalk
bool isValid() const
Definition: ESHandle.h:37
void CSCConditions::fillBadStripWords ( )

fill bad channel words

Definition at line 111 of file CSCConditions.cc.

References badStripWords, Reference_intrackfit_cff::endcap, i, indexer_, j, MAX_LAYERS, readBadChannels(), relativeConstraints::ring, dqm_diff::start, relativeConstraints::station, and theBadStrips.

Referenced by initializeEvent().

111  {
112  //@@ NOT YET THOUGHT THROUGH FOR UNGANGED ME11A
113 
114  // reset existing values
115  badStripWords.assign( MAX_LAYERS, 0 );
116  if ( readBadChannels() ) {
117  // unpack what we've read from theBadStrips
118 
119  // chambers is a vector<BadChamber>
120  // channels is a vector<BadChannel>
121  // Each BadChamber contains its index (1-468 or 540 w. ME42), the no. of bad channels,
122  // and the index within vector<BadChannel> where this chamber's bad channels start.
123 
124  for ( size_t i=0; i<theBadStrips->chambers.size(); ++i ) { // loop over bad chambers
125  int indexc = theBadStrips->chambers[i].chamber_index;
126  int start = theBadStrips->chambers[i].pointer; // where this chamber's bad channels start in vector<BadChannel>
127  int nbad = theBadStrips->chambers[i].bad_channels;
128 
129  CSCDetId id = indexer_->detIdFromChamberIndex( indexc ); // We need this to build layer index (1-2808)
130 
131  for ( int j=start-1; j<start-1+nbad; ++j ) { // bad channels in this chamber
132  short lay = theBadStrips->channels[j].layer; // value 1-6
133  short chan = theBadStrips->channels[j].channel; // value 1-80
134  // short f1 = theBadStrips->channels[j].flag1;
135  // short f2 = theBadStrips->channels[j].flag2;
136  // short f3 = theBadStrips->channels[j].flag3;
137  int indexl = indexer_->layerIndex( id.endcap(), id.station(), id.ring(), id.chamber(), lay );
138  badStripWords[indexl-1].set( chan-1, 1 ); // set bit 0-79 in 80-bit bitset representing this layer
139  } // j
140  } // i
141 
142  }
143 }
int i
Definition: DBlmapReader.cc:9
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
edm::ESHandle< CSCBadStrips > theBadStrips
edm::ESHandle< CSCIndexerBase > indexer_
std::vector< std::bitset< 80 > > badStripWords
bool readBadChannels() const
did we request reading bad channel info from db?
Definition: CSCConditions.h:98
int j
Definition: DBlmapReader.cc:9
void CSCConditions::fillBadWireWords ( )

Definition at line 145 of file CSCConditions.cc.

References badWireWords, Reference_intrackfit_cff::endcap, i, indexer_, j, MAX_LAYERS, readBadChannels(), relativeConstraints::ring, dqm_diff::start, relativeConstraints::station, and theBadWires.

Referenced by initializeEvent().

145  {
146  // reset existing values
147  badWireWords.assign( MAX_LAYERS, 0 );
148  if ( readBadChannels() ) {
149  // unpack what we've read from theBadWires
150 
151  for ( size_t i=0; i<theBadWires->chambers.size(); ++i ) { // loop over bad chambers
152  int indexc = theBadWires->chambers[i].chamber_index;
153  int start = theBadWires->chambers[i].pointer; // where this chamber's bad channels start in vector<BadChannel>
154  int nbad = theBadWires->chambers[i].bad_channels;
155 
156  CSCDetId id = indexer_->detIdFromChamberIndex( indexc ); // We need this to build layer index (1-2808)
157 
158  for ( int j=start-1; j<start-1+nbad; ++j ) { // bad channels in this chamber
159  short lay = theBadWires->channels[j].layer; // value 1-6
160  short chan = theBadWires->channels[j].channel; // value 1-80
161  // short f1 = theBadWires->channels[j].flag1;
162  // short f2 = theBadWires->channels[j].flag2;
163  // short f3 = theBadWires->channels[j].flag3;
164  int indexl = indexer_->layerIndex( id.endcap(), id.station(), id.ring(), id.chamber(), lay );
165  badWireWords[indexl-1].set( chan-1, 1 ); // set bit 0-111 in 112-bit bitset representing this layer
166  } // j
167  } // i
168 
169  }
170 }
int i
Definition: DBlmapReader.cc:9
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
edm::ESHandle< CSCBadWires > theBadWires
std::vector< std::bitset< 112 > > badWireWords
edm::ESHandle< CSCIndexerBase > indexer_
bool readBadChannels() const
did we request reading bad channel info from db?
Definition: CSCConditions.h:98
int j
Definition: DBlmapReader.cc:9
float CSCConditions::gain ( const CSCDetId detId,
int  channel 
) const

gain per channel

Definition at line 183 of file CSCConditions.cc.

References getHLTprescales::index, indexer_, edm::ESHandleBase::isValid(), mapper_, and theGains.

Referenced by CSCDbStripConditions::gain(), and CSCRecoConditions::gain().

184 {
185  assert(theGains.isValid());
186  CSCDetId idraw = mapper_->rawCSCDetId( id );
187  int iraw = mapper_->rawStripChannel( id, geomChannel );
188  int index = indexer_->stripChannelIndex( idraw, iraw ) - 1; // NOTE THE MINUS ONE!
189  return float( theGains->gain(index) ) /theGains->scale();
190 }
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESHandle< CSCChannelMapperBase > mapper_
edm::ESHandle< CSCDBGains > theGains
bool isValid() const
Definition: ESHandle.h:37
float CSCConditions::gainSigma ( const CSCDetId detId,
int  channel 
) const
inline

overall calibration precision

Definition at line 58 of file CSCConditions.h.

58 {return 0.005;}
float CSCConditions::gasGainCorrection ( const CSCDetId detId,
int  strip,
int  wire 
) const

gas gain correction as a function of detId (w/layer), strip, and wire channels

Definition at line 372 of file CSCConditions.cc.

References getHLTprescales::index, indexer_, edm::ESHandleBase::isValid(), mapper_, theGasGainCorrections, and useGasGainCorrections().

Referenced by CSCRecoConditions::gasGainCorrection().

373 {
374  if ( useGasGainCorrections() ){
375  assert(theGasGainCorrections.isValid());
376  CSCDetId idraw = mapper_->rawCSCDetId( id );
377  int iraw = mapper_->rawStripChannel( id, geomChannel );
378  int index = indexer_->gasGainIndex(idraw, iraw, iwiregroup) - 1; // NOTE THE MINUS ONE!
379  return float ( theGasGainCorrections->value(index) );
380  } else {
381  return 1.;
382  }
383 }
edm::ESHandle< CSCDBGasGainCorrection > theGasGainCorrections
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESHandle< CSCChannelMapperBase > mapper_
bool useGasGainCorrections() const
did we request reading gas gain correction info from db?
bool isValid() const
Definition: ESHandle.h:37
void CSCConditions::initializeEvent ( const edm::EventSetup es)

fetch database content via EventSetup

Definition at line 57 of file CSCConditions.cc.

References edm::ESWatcher< T >::check(), fillBadStripWords(), fillBadWireWords(), gainsWatcher_, edm::EventSetup::get(), indexer_, mapper_, readBadChambers(), readBadChannels(), theAverageGain, theBadChambers, theBadStrips, theBadWires, theChamberTimingCorrections, theChipCorrections, theCrosstalk, theGains, theGasGainCorrections, theNoiseMatrix, thePedestals, useGasGainCorrections(), and useTimingCorrections().

Referenced by CSCDbStripConditions::initializeEvent(), and CSCRecoConditions::initializeEvent().

58 {
59  // Algorithms
60  es.get<CSCIndexerRecord>().get( indexer_ );
61  es.get<CSCChannelMapperRecord>().get( mapper_ );
62 
63  // Strip gains
64  es.get<CSCDBGainsRcd>().get( theGains );
65  // Strip X-talk
66  es.get<CSCDBCrosstalkRcd>().get( theCrosstalk );
67  // Strip pedestals
68  es.get<CSCDBPedestalsRcd>().get( thePedestals );
69  // Strip autocorrelation noise matrix
71 
72  if ( useTimingCorrections()){
73  // Buckeye chip speeds
75  // Cable lengths from chambers to peripheral crate and additional chamber level timing correction
77  }
78 
79  if ( readBadChannels() ) {
80  // Bad strip channels
81  es.get<CSCBadStripsRcd>().get( theBadStrips );
82  // Bad wiregroup channels
83  es.get<CSCBadWiresRcd>().get( theBadWires );
84 
85  //@@ if( badStripsWatcher_.check( es ) ) {
87  //@@ }
88  //@@ if( badWiresWatcher_.check( es ) ) {
90  //@ }
91 
92  }
93 
94  // Has GainsRcd changed?
95  if( gainsWatcher_.check( es ) ) { // Yes...
96  theAverageGain = -1.0; // ...reset, so next access will recalculate it
97  }
98 
99  if ( readBadChambers() ) {
100  // Entire bad chambers
101  es.get<CSCBadChambersRcd>().get( theBadChambers );
102  }
103 
104  if ( useGasGainCorrections()){
106  }
107 
108 // print();
109 }
edm::ESHandle< CSCDBGasGainCorrection > theGasGainCorrections
edm::ESHandle< CSCDBNoiseMatrix > theNoiseMatrix
edm::ESHandle< CSCBadWires > theBadWires
void fillBadStripWords()
fill bad channel words
edm::ESHandle< CSCChamberTimeCorrections > theChamberTimingCorrections
bool useTimingCorrections() const
did we request reading timing correction info from db?
edm::ESHandle< CSCBadStrips > theBadStrips
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESWatcher< CSCDBGainsRcd > gainsWatcher_
edm::ESHandle< CSCChannelMapperBase > mapper_
bool readBadChannels() const
did we request reading bad channel info from db?
Definition: CSCConditions.h:98
edm::ESHandle< CSCBadChambers > theBadChambers
edm::ESHandle< CSCDBGains > theGains
void fillBadWireWords()
edm::ESHandle< CSCDBChipSpeedCorrection > theChipCorrections
edm::ESHandle< CSCDBCrosstalk > theCrosstalk
bool readBadChambers() const
did we request reading bad chamber info from db?
const T & get() const
Definition: EventSetup.h:55
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:58
bool useGasGainCorrections() const
did we request reading gas gain correction info from db?
float theAverageGain
edm::ESHandle< CSCDBPedestals > thePedestals
bool CSCConditions::isInBadChamber ( const CSCDetId id) const

Is the gven chamber flagged as bad?

Definition at line 172 of file CSCConditions.cc.

References getHLTprescales::index, indexer_, mapper_, readBadChambers(), and theBadChambers.

Referenced by CSCDbStripConditions::isInBadChamber().

172  {
173  //@@ NOT YET THOUGHT THROUGH FOR UNGANGED ME11A
174 
175  if ( readBadChambers() ) {
176  CSCDetId idraw = mapper_->rawCSCDetId( id );
177  int index = indexer_->chamberIndex( idraw );
178  return theBadChambers->isInBadChamber( index );
179  }
180  else return false;
181 }
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESHandle< CSCChannelMapperBase > mapper_
edm::ESHandle< CSCBadChambers > theBadChambers
bool readBadChambers() const
did we request reading bad chamber info from db?
const CSCDBNoiseMatrix::Item & CSCConditions::noiseMatrix ( const CSCDetId detId,
int  channel 
) const

raw noise matrix (unscaled short int elements)

Definition at line 235 of file CSCConditions.cc.

References getHLTprescales::index, indexer_, edm::ESHandleBase::isValid(), mapper_, and theNoiseMatrix.

Referenced by noiseMatrixElements().

236 {
237  //@@ BEWARE - THIS FUNCTION DOES NOT APPLy SCALE FACTOR USED IN PACKING VALUES IN CONDITIONS DATA
238  //@@ MAY BE AN ERROR? WHO WOULD WANT ACCESS WITHOUT IT?
239 
240  assert(theNoiseMatrix.isValid());
241  CSCDetId idraw = mapper_->rawCSCDetId( id );
242  int iraw = mapper_->rawStripChannel( id, geomChannel );
243  int index = indexer_->stripChannelIndex( idraw, iraw ) - 1; // NOTE THE MINUS ONE!
244  return theNoiseMatrix->item(index);
245 }
edm::ESHandle< CSCDBNoiseMatrix > theNoiseMatrix
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESHandle< CSCChannelMapperBase > mapper_
bool isValid() const
Definition: ESHandle.h:37
void CSCConditions::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)

Definition at line 247 of file CSCConditions.cc.

References noiseMatrix(), and theNoiseMatrix.

Referenced by CSCDbStripConditions::fetchNoisifier(), and CSCRecoConditions::noiseMatrix().

247  {
248  assert(me.size() > 11 );
249  const CSCDBNoiseMatrix::Item& item = noiseMatrix(id, geomChannel); // i.e. the function above
250  me[0] = float ( item.elem33 )/theNoiseMatrix->scale();
251  me[1] = float ( item.elem34 )/theNoiseMatrix->scale();
252  me[2] = float ( item.elem35 )/theNoiseMatrix->scale();
253  me[3] = float ( item.elem44 )/theNoiseMatrix->scale();
254  me[4] = float ( item.elem45 )/theNoiseMatrix->scale();
255  me[5] = float ( item.elem46 )/theNoiseMatrix->scale();
256  me[6] = float ( item.elem55 )/theNoiseMatrix->scale();
257  me[7] = float ( item.elem56 )/theNoiseMatrix->scale();
258  me[8] = float ( item.elem57 )/theNoiseMatrix->scale();
259  me[9] = float ( item.elem66 )/theNoiseMatrix->scale();
260  me[10] = float ( item.elem67 )/theNoiseMatrix->scale();
261  me[11] = float ( item.elem77 )/theNoiseMatrix->scale();
262 }
edm::ESHandle< CSCDBNoiseMatrix > theNoiseMatrix
const CSCDBNoiseMatrix::Item & noiseMatrix(const CSCDetId &detId, int channel) const
raw noise matrix (unscaled short int elements)
float CSCConditions::pedestal ( const CSCDetId detId,
int  channel 
) const

static ped in ADC counts

Definition at line 192 of file CSCConditions.cc.

References getHLTprescales::index, indexer_, edm::ESHandleBase::isValid(), mapper_, and thePedestals.

Referenced by CSCDbStripConditions::pedestal(), and CSCRecoConditions::pedestal().

193 {
194  assert(thePedestals.isValid());
195  CSCDetId idraw = mapper_->rawCSCDetId( id );
196  int iraw = mapper_->rawStripChannel( id, geomChannel );
197  int index = indexer_->stripChannelIndex( idraw, iraw ) - 1; // NOTE THE MINUS ONE!
198  return float( thePedestals->pedestal(index) )/thePedestals->scale_ped();
199 }
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESHandle< CSCChannelMapperBase > mapper_
bool isValid() const
Definition: ESHandle.h:37
edm::ESHandle< CSCDBPedestals > thePedestals
float CSCConditions::pedestalSigma ( const CSCDetId detId,
int  channel 
) const

static ped rms in ADC counts

Definition at line 202 of file CSCConditions.cc.

References getHLTprescales::index, indexer_, edm::ESHandleBase::isValid(), mapper_, and thePedestals.

Referenced by CSCDbStripConditions::pedestalSigma(), and CSCRecoConditions::pedestalSigma().

203 {
204  assert(thePedestals.isValid());
205  CSCDetId idraw = mapper_->rawCSCDetId( id );
206  int iraw = mapper_->rawStripChannel( id, geomChannel );
207  int index = indexer_->stripChannelIndex( idraw, iraw ) - 1; // NOTE THE MINUS ONE!
208  return float( thePedestals->pedestal_rms(index) )/thePedestals->scale_rms();
209 }
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESHandle< CSCChannelMapperBase > mapper_
bool isValid() const
Definition: ESHandle.h:37
edm::ESHandle< CSCDBPedestals > thePedestals
void CSCConditions::print ( void  ) const

Definition at line 392 of file CSCConditions.cc.

394 {
395 /*
396  std::cout << "SIZES: GAINS: " << theGains->gains.size()
397  << " PEDESTALS: " << thePedestals->pedestals.size()
398  << " NOISES " << theNoiseMatrix->matrix.size() << std::endl;;
399 
400  std::map< int,std::vector<CSCDBGains::Item> >::const_iterator layerGainsItr = theGains->gains.begin(),
401  lastGain = theGains->gains.end();
402  for( ; layerGainsItr != lastGain; ++layerGainsItr)
403  {
404  std::cout << "GAIN " << layerGainsItr->first
405  << " STRIPS " << layerGainsItr->second.size() << " "
406  << layerGainsItr->second[0].gain_slope
407  << " " << layerGainsItr->second[0].gain_intercept << std::endl;
408  }
409 
410  std::map< int,std::vector<CSCDBPedestals::Item> >::const_iterator pedestalItr = thePedestals->pedestals.begin(),
411  lastPedestal = thePedestals->pedestals.end();
412  for( ; pedestalItr != lastPedestal; ++pedestalItr)
413  {
414  std::cout << "PEDS " << pedestalItr->first << " "
415  << " STRIPS " << pedestalItr->second.size() << " ";
416  for(int i = 1; i < 80; ++i)
417  {
418  std::cout << pedestalItr->second[i-1].rms << " " ;
419  }
420  std::cout << std::endl;
421  }
422 
423  std::map< int,std::vector<CSCDBCrosstalk::Item> >::const_iterator crosstalkItr = theCrosstalk->crosstalk.begin(),
424  lastCrosstalk = theCrosstalk->crosstalk.end();
425  for( ; crosstalkItr != lastCrosstalk; ++crosstalkItr)
426  {
427  std::cout << "XTALKS " << crosstalkItr->first
428  << " STRIPS " << crosstalkItr->second.size() << " "
429  << crosstalkItr->second[5].xtalk_slope_left << " "
430  << crosstalkItr->second[5].xtalk_slope_right << " "
431  << crosstalkItr->second[5].xtalk_intercept_left << " "
432  << crosstalkItr->second[5].xtalk_intercept_right << std::endl;
433  }
434 */
435 }
int CSCConditions::rawStripChannel ( const CSCDetId id,
int  geomChannel 
) const

Definition at line 388 of file CSCConditions.cc.

References mapper_.

Referenced by CSCRecoConditions::badStrip().

389 { return mapper_->rawStripChannel( id, geomChannel); }
edm::ESHandle< CSCChannelMapperBase > mapper_
bool CSCConditions::readBadChambers ( ) const
inline

did we request reading bad chamber info from db?

Definition at line 101 of file CSCConditions.h.

References readBadChambers_.

Referenced by initializeEvent(), and isInBadChamber().

101 { return readBadChambers_; }
bool CSCConditions::readBadChannels ( ) const
inline

did we request reading bad channel info from db?

Definition at line 98 of file CSCConditions.h.

References readBadChannels_.

Referenced by fillBadStripWords(), fillBadWireWords(), and initializeEvent().

98 { return readBadChannels_; }
bool CSCConditions::useGasGainCorrections ( ) const
inline

did we request reading gas gain correction info from db?

Definition at line 117 of file CSCConditions.h.

References useGasGainCorrections_.

Referenced by gasGainCorrection(), and initializeEvent().

117 { return useGasGainCorrections_; }
bool useGasGainCorrections_
bool CSCConditions::useTimingCorrections ( ) const
inline

did we request reading timing correction info from db?

Definition at line 104 of file CSCConditions.h.

References useTimingCorrections_.

Referenced by anodeBXoffset(), chamberTimingCorrection(), chipCorrection(), and initializeEvent().

104 { return useTimingCorrections_; }
bool useTimingCorrections_

Member Data Documentation

std::vector< std::bitset<80> > CSCConditions::badStripWords
private

Definition at line 151 of file CSCConditions.h.

Referenced by badStripWord(), CSCConditions(), and fillBadStripWords().

std::vector< std::bitset<112> > CSCConditions::badWireWords
private

Definition at line 152 of file CSCConditions.h.

Referenced by badWireWord(), CSCConditions(), and fillBadWireWords().

edm::ESWatcher<CSCDBGainsRcd> CSCConditions::gainsWatcher_
private

Definition at line 156 of file CSCConditions.h.

Referenced by initializeEvent().

edm::ESHandle<CSCIndexerBase> CSCConditions::indexer_
private
edm::ESHandle<CSCChannelMapperBase> CSCConditions::mapper_
private
bool CSCConditions::readBadChambers_
private

Definition at line 146 of file CSCConditions.h.

Referenced by CSCConditions(), and readBadChambers().

bool CSCConditions::readBadChannels_
private

Definition at line 145 of file CSCConditions.h.

Referenced by CSCConditions(), and readBadChannels().

float CSCConditions::theAverageGain
mutableprivate

Definition at line 154 of file CSCConditions.h.

Referenced by averageGain(), and initializeEvent().

edm::ESHandle<CSCBadChambers> CSCConditions::theBadChambers
private

Definition at line 133 of file CSCConditions.h.

Referenced by initializeEvent(), and isInBadChamber().

edm::ESHandle<CSCBadStrips> CSCConditions::theBadStrips
private

Definition at line 131 of file CSCConditions.h.

Referenced by fillBadStripWords(), and initializeEvent().

edm::ESHandle<CSCBadWires> CSCConditions::theBadWires
private

Definition at line 132 of file CSCConditions.h.

Referenced by fillBadWireWords(), and initializeEvent().

edm::ESHandle<CSCChamberTimeCorrections> CSCConditions::theChamberTimingCorrections
private

Definition at line 135 of file CSCConditions.h.

Referenced by anodeBXoffset(), chamberTimingCorrection(), and initializeEvent().

edm::ESHandle<CSCDBChipSpeedCorrection> CSCConditions::theChipCorrections
private

Definition at line 134 of file CSCConditions.h.

Referenced by chipCorrection(), and initializeEvent().

edm::ESHandle<CSCDBCrosstalk> CSCConditions::theCrosstalk
private

Definition at line 128 of file CSCConditions.h.

Referenced by crossTalk(), crosstalkIntercept(), crosstalkSlope(), and initializeEvent().

edm::ESHandle<CSCDBGains> CSCConditions::theGains
private

Definition at line 127 of file CSCConditions.h.

Referenced by averageGain(), gain(), and initializeEvent().

edm::ESHandle<CSCDBGasGainCorrection> CSCConditions::theGasGainCorrections
private

Definition at line 136 of file CSCConditions.h.

Referenced by gasGainCorrection(), and initializeEvent().

edm::ESHandle<CSCDBNoiseMatrix> CSCConditions::theNoiseMatrix
private

Definition at line 130 of file CSCConditions.h.

Referenced by initializeEvent(), noiseMatrix(), and noiseMatrixElements().

edm::ESHandle<CSCDBPedestals> CSCConditions::thePedestals
private

Definition at line 129 of file CSCConditions.h.

Referenced by initializeEvent(), pedestal(), and pedestalSigma().

bool CSCConditions::useGasGainCorrections_
private

Definition at line 148 of file CSCConditions.h.

Referenced by CSCConditions(), and useGasGainCorrections().

bool CSCConditions::useTimingCorrections_
private

Definition at line 147 of file CSCConditions.h.

Referenced by CSCConditions(), and useTimingCorrections().