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 Member Functions | 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< 112 > & badStripWord () const
 bad strip channel word for a CSCLayer - 1 bit per channel More...
 
const std::bitset< 112 > & badWireWord () const
 bad wiregroup channel word for a CSCLayer - 1 bit per channel More...
 
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 fillBadChannelWords (const CSCDetId &id)
 Fill bad channel words - one for strips, one for wires, for an offline CSCDetId. More...
 
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...
 
const CSCDetIdidOfBadChannelWords () const
 the offline CSCDetId of current bad channel words 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 Member Functions

void fillBadStripWord (const CSCDetId &id)
 fill bad channel words for offline id More...
 
void fillBadWireWord (const CSCDetId &id)
 
void setIdOfBadChannelWords (const CSCDetId &id)
 Set id for current content of bad channel words - this is offline id i.e. separate for ME11A & ME11B. More...
 

Private Attributes

std::bitset< 112 > badStripWord_
 
std::bitset< 112 > badWireWord_
 
edm::ESWatcher< CSCDBGainsRcdgainsWatcher_
 
CSCDetId idOfBadChannelWords_
 
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 181 of file CSCConditions.h.

Constructor & Destructor Documentation

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

Definition at line 37 of file CSCConditions.cc.

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

41  indexer_(0), mapper_(0),
42  readBadChannels_(false), readBadChambers_(false),
45 {
46  readBadChannels_ = ps.getParameter<bool>("readBadChannels");
47  readBadChambers_ = ps.getParameter<bool>("readBadChambers");
48  useTimingCorrections_ = ps.getParameter<bool>("CSCUseTimingCorrections");
49  useGasGainCorrections_ = ps.getParameter<bool>("CSCUseGasGainCorrections");
50 
51 }
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
edm::ESHandle< CSCIndexerBase > indexer_
bool useTimingCorrections_
std::bitset< 112 > badWireWord_
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
std::bitset< 112 > badStripWord_
CSCDetId idOfBadChannelWords_
CSCConditions::~CSCConditions ( )

Definition at line 54 of file CSCConditions.cc.

54 {}

Member Function Documentation

float CSCConditions::anodeBXoffset ( const CSCDetId detId) const

anode bx offset in bx given detId of chamber

Definition at line 337 of file CSCConditions.cc.

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

Referenced by CSCRecoConditions::anodeBXoffset().

338 {
339  if ( useTimingCorrections() ){
341  CSCDetId idraw = mapper_->rawCSCDetId( id );
342  int index = indexer_->chamberIndex(idraw) - 1; // NOTE THE MINUS ONE!
343  return float ( theChamberTimingCorrections->item(index).anode_bx_offset*1./theChamberTimingCorrections->precision() );
344  }
345  else
346  return 0;
347 }
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:47
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 353 of file CSCConditions.cc.

References theAverageGain, and theGains.

Referenced by CSCRecoConditions::averageGain().

353  {
354 
355  const float loEdge = 5.0; // consider gains above this
356  const float hiEdge = 10.0; // consider gains below this
357  const float loLimit = 6.0; // lowest acceptable average gain
358  const float hiLimit = 9.0; // highest acceptable average gain
359  const float expectedAverage = 7.5; // default average gain
360 
361  if ( theAverageGain > 0. ) return theAverageGain; // only recalculate if necessary
362 
363  int n_strip = 0;
364  float gain_tot = 0.;
365 
366  CSCDBGains::GainContainer::const_iterator it;
367  for ( it=theGains->gains.begin(); it!=theGains->gains.end(); ++it ) {
368  float the_gain = float( it->gain_slope )/theGains->scale();
369  if (the_gain > loEdge && the_gain < hiEdge ) {
370  gain_tot += the_gain;
371  ++n_strip;
372  }
373  }
374 
375  // Average gain
376  if ( n_strip > 0 ) {
377  theAverageGain = gain_tot / n_strip;
378  }
379 
380  // Average gain has been around 7.5 in real data
381  if ( theAverageGain < loLimit || theAverageGain > hiLimit ) {
382  // LogTrace("CSC") << "Average CSC strip gain = "
383  // << theAverageGain << " is reset to expected value " << expectedAverage;
384  theAverageGain = expectedAverage;
385  }
386 
387  return theAverageGain;
388 }
edm::ESHandle< CSCDBGains > theGains
float theAverageGain
const std::bitset<112>& CSCConditions::badStripWord ( ) const
inline

bad strip channel word for a CSCLayer - 1 bit per channel

Definition at line 89 of file CSCConditions.h.

References badStripWord_.

Referenced by CSCRecoConditions::badStrip().

89  {
90  return badStripWord_;
91  }
std::bitset< 112 > badStripWord_
const std::bitset<112>& CSCConditions::badWireWord ( ) const
inline

bad wiregroup channel word for a CSCLayer - 1 bit per channel

Definition at line 94 of file CSCConditions.h.

References badWireWord_.

Referenced by CSCRecoConditions::badWireWord().

94  {
95  return badWireWord_;
96  }
std::bitset< 112 > badWireWord_
float CSCConditions::chamberTimingCorrection ( const CSCDetId detId) const

chamber timing correction in ns given detId of chamber

Definition at line 322 of file CSCConditions.cc.

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

Referenced by CSCRecoConditions::chamberTimingCorrection().

323 {
324  if ( useTimingCorrections() ){
326  CSCDetId idraw = mapper_->rawCSCDetId( id );
327  int index = indexer_->chamberIndex(idraw) - 1; // NOTE THE MINUS ONE!
328  return float (
329  theChamberTimingCorrections->item(index).cfeb_tmb_skew_delay*1./theChamberTimingCorrections->precision()
330  + theChamberTimingCorrections->item(index).cfeb_timing_corr*1./theChamberTimingCorrections->precision()
331  + (theChamberTimingCorrections->item(index).cfeb_cable_delay*25. )
332 );
333  }
334  else
335  return 0;
336 }
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:47
int CSCConditions::channelFromStrip ( const CSCDetId id,
int  geomStrip 
) const

feedthrough for external access

Definition at line 403 of file CSCConditions.cc.

References mapper_.

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

404 { 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 309 of file CSCConditions.cc.

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

Referenced by CSCRecoConditions::chipCorrection().

310 {
311  if ( useTimingCorrections() ){
312  assert(theChipCorrections.isValid());
313  CSCDetId idraw = mapper_->rawCSCDetId( id );
314  int iraw = mapper_->rawStripChannel( id, geomChannel);
315  int ichip = indexer_->chipIndex(iraw); // converts 1-80 to 1-5 (chip#, CFEB#)
316  int index = indexer_->chipIndex(idraw, ichip) - 1; // NOTE THE MINUS ONE!
317  return float ( theChipCorrections->value(index) )/theChipCorrections->scale();
318  }
319  else
320  return 0;
321 }
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:47
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 297 of file CSCConditions.cc.

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

Referenced by CSCRecoConditions::crossTalk().

297  {
298  assert(theCrosstalk.isValid());
299  CSCDetId idraw = mapper_->rawCSCDetId( id );
300  int iraw = mapper_->rawStripChannel( id, geomChannel );
301  int index = indexer_->stripChannelIndex( idraw, iraw ) - 1; // NOTE THE MINUS ONE!
302 
303  ct[0] = float ( theCrosstalk->lslope(index) )/theCrosstalk->sscale();
304  ct[1] = float ( theCrosstalk->linter(index) )/theCrosstalk->iscale();
305  ct[2] = float ( theCrosstalk->rslope(index) )/theCrosstalk->sscale();
306  ct[3] = float ( theCrosstalk->rinter(index) )/theCrosstalk->iscale();
307 }
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESHandle< CSCChannelMapperBase > mapper_
edm::ESHandle< CSCDBCrosstalk > theCrosstalk
bool isValid() const
Definition: ESHandle.h:47
float CSCConditions::crosstalkIntercept ( const CSCDetId detId,
int  channel,
bool  leftRight 
) const

crosstalk intercept for left and right

Definition at line 245 of file CSCConditions.cc.

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

Referenced by CSCDbStripConditions::crosstalk().

246 {
247  assert(theCrosstalk.isValid());
248  CSCDetId idraw = mapper_->rawCSCDetId( id );
249  int iraw = mapper_->rawStripChannel( id, geomChannel );
250  int index = indexer_->stripChannelIndex( idraw, iraw ) - 1; // NOTE THE MINUS ONE!
251  // resistive fraction is at the peak, where t=0
252  return leftRight ? float ( theCrosstalk->rinter(index) )/theCrosstalk->iscale()
253  : float ( theCrosstalk->linter(index) )/theCrosstalk->iscale() ;
254 }
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESHandle< CSCChannelMapperBase > mapper_
edm::ESHandle< CSCDBCrosstalk > theCrosstalk
bool isValid() const
Definition: ESHandle.h:47
float CSCConditions::crosstalkSlope ( const CSCDetId detId,
int  channel,
bool  leftRight 
) const

crosstalk slope for left and right

Definition at line 257 of file CSCConditions.cc.

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

Referenced by CSCDbStripConditions::crosstalk().

258 {
259  assert(theCrosstalk.isValid());
260  CSCDetId idraw = mapper_->rawCSCDetId( id );
261  int iraw = mapper_->rawStripChannel( id, geomChannel );
262  int index = indexer_->stripChannelIndex( idraw, iraw ) - 1; // NOTE THE MINUS ONE!
263  // resistive fraction is at the peak, where t=0
264  return leftRight ? float ( theCrosstalk->rslope(index) )/theCrosstalk->sscale()
265  : float ( theCrosstalk->lslope(index) )/theCrosstalk->sscale() ;
266 }
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESHandle< CSCChannelMapperBase > mapper_
edm::ESHandle< CSCDBCrosstalk > theCrosstalk
bool isValid() const
Definition: ESHandle.h:47
void CSCConditions::fillBadChannelWords ( const CSCDetId id)

Fill bad channel words - one for strips, one for wires, for an offline CSCDetId.

Definition at line 110 of file CSCConditions.cc.

References badStripWord_, badWireWord_, fillBadStripWord(), fillBadWireWord(), idOfBadChannelWords(), mapper_, readBadChannels(), and setIdOfBadChannelWords().

Referenced by CSCRecoConditions::fillBadChannelWords().

110  {
111 
112  // input CSCDetId is expected to be an offline value i.e. different for ME1/1A and ME1/1B
113 
114  // Only update content if necessary
115  if ( id != idOfBadChannelWords() ) {
116 
117  // store offline CSCDetId for the two bad channel words
119 
120  // reset to all zeroes
121  badStripWord_.reset();
122  badWireWord_.reset();
123 
124  if ( readBadChannels() ) {
125  // convert to online CSCDetId since that is how conditions data are stored
126  CSCDetId idraw = mapper_->rawCSCDetId( id );
127  fillBadStripWord( idraw );
128  fillBadWireWord( idraw );
129  }
130  }
131 }
void fillBadWireWord(const CSCDetId &id)
std::bitset< 112 > badWireWord_
edm::ESHandle< CSCChannelMapperBase > mapper_
bool readBadChannels() const
did we request reading bad channel info from db?
void fillBadStripWord(const CSCDetId &id)
fill bad channel words for offline id
void setIdOfBadChannelWords(const CSCDetId &id)
Set id for current content of bad channel words - this is offline id i.e. separate for ME11A &amp; ME11B...
const CSCDetId & idOfBadChannelWords() const
the offline CSCDetId of current bad channel words
Definition: CSCConditions.h:99
std::bitset< 112 > badStripWord_
void CSCConditions::fillBadStripWord ( const CSCDetId id)
private

fill bad channel words for offline id

Next function private.

Definition at line 135 of file CSCConditions.cc.

References badStripWord_, i, indexer_, j, dqm_diff::start, and theBadStrips.

Referenced by fillBadChannelWords().

135  {
136 
137  // Input CSCDetId is expected to be a 'raw' value
138 
139  // Find linear index of chamber for input CSCDetId
140  int inputIndex = indexer_->chamberIndex( id );
141  short inputLayer = id.layer();
142 
143  // Does this chamber occur in bad channel list? If so, unpack its bad channels
144 
145  // chambers is a vector<BadChamber>
146  // channels is a vector<BadChannel>
147  // Each BadChamber contains its index (1-468 or 540 w. ME42), the no. of bad channels,
148  // and the index within vector<BadChannel> where this chamber's bad channels start.
149 
150  for ( size_t i=0; i<theBadStrips->chambers.size(); ++i ) { // loop over bad chambers
151  int indexc = theBadStrips->chambers[i].chamber_index;
152  if (indexc != inputIndex ) continue; // next iteration if not a match
153 
154  int start = theBadStrips->chambers[i].pointer;
155  int nbad = theBadStrips->chambers[i].bad_channels;
156 
157  for ( int j=start-1; j<start-1+nbad; ++j ) { // bad channels in this chamber
158  short lay = theBadStrips->channels[j].layer; // value 1-6
159  if ( lay != inputLayer ) continue;
160 
161  short chan = theBadStrips->channels[j].channel; // value 1-80 (->112 for unganged ME1/1A)
162  // Flags so far unused (and unset in conditins data)
163  // short f1 = theBadStrips->channels[j].flag1;
164  // short f2 = theBadStrips->channels[j].flag2;
165  // short f3 = theBadStrips->channels[j].flag3;
166  badStripWord_.set( chan-1, 1 ); // set bit 0-79 (111) in 80 (112)-bit bitset representing this layer
167  } // j
168  } // i
169 
170 }
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_
int j
Definition: DBlmapReader.cc:9
std::bitset< 112 > badStripWord_
void CSCConditions::fillBadWireWord ( const CSCDetId id)
private

Definition at line 172 of file CSCConditions.cc.

References badWireWord_, i, indexer_, j, dqm_diff::start, and theBadWires.

Referenced by fillBadChannelWords().

172  {
173 
174  // Input CSCDetId is expected to be a 'raw' value
175 
176  // Find linear index of chamber for input CSCDetId
177  int inputIndex = indexer_->chamberIndex( id );
178  short inputLayer = id.layer();
179 
180  // unpack what we've read from theBadWires
181 
182  for ( size_t i=0; i<theBadWires->chambers.size(); ++i ) { // loop over bad chambers
183  int indexc = theBadWires->chambers[i].chamber_index;
184 
185  if (indexc != inputIndex ) continue; // next iteration if not a match
186 
187  int start = theBadWires->chambers[i].pointer;
188  int nbad = theBadWires->chambers[i].bad_channels;
189 
190  for ( int j=start-1; j<start-1+nbad; ++j ) { // bad channels in this chamber
191  short lay = theBadWires->channels[j].layer; // value 1-6
192  if ( lay != inputLayer ) continue;
193 
194  short chan = theBadWires->channels[j].channel; // value 1-112
195  // short f1 = theBadWires->channels[j].flag1;
196  // short f2 = theBadWires->channels[j].flag2;
197  // short f3 = theBadWires->channels[j].flag3;
198  badWireWord_.set( chan-1, 1 ); // set bit 0-111 in 112-bit bitset representing this layer
199  } // j
200  } // i
201 
202 }
int i
Definition: DBlmapReader.cc:9
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
edm::ESHandle< CSCBadWires > theBadWires
edm::ESHandle< CSCIndexerBase > indexer_
std::bitset< 112 > badWireWord_
int j
Definition: DBlmapReader.cc:9
float CSCConditions::gain ( const CSCDetId detId,
int  channel 
) const

gain per channel

Definition at line 216 of file CSCConditions.cc.

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

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

217 {
218  assert(theGains.isValid());
219  CSCDetId idraw = mapper_->rawCSCDetId( id );
220  int iraw = mapper_->rawStripChannel( id, geomChannel );
221  int index = indexer_->stripChannelIndex( idraw, iraw ) - 1; // NOTE THE MINUS ONE!
222  return float( theGains->gain(index) ) /theGains->scale();
223 }
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESHandle< CSCChannelMapperBase > mapper_
edm::ESHandle< CSCDBGains > theGains
bool isValid() const
Definition: ESHandle.h:47
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 390 of file CSCConditions.cc.

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

Referenced by CSCRecoConditions::gasGainCorrection().

391 {
392  if ( useGasGainCorrections() ){
393  assert(theGasGainCorrections.isValid());
394  CSCDetId idraw = mapper_->rawCSCDetId( id );
395  int iraw = mapper_->rawStripChannel( id, geomChannel );
396  int index = indexer_->gasGainIndex(idraw, iraw, iwiregroup) - 1; // NOTE THE MINUS ONE!
397  return float ( theGasGainCorrections->value(index) );
398  } else {
399  return 1.;
400  }
401 }
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:47
const CSCDetId& CSCConditions::idOfBadChannelWords ( ) const
inline

the offline CSCDetId of current bad channel words

Definition at line 99 of file CSCConditions.h.

References idOfBadChannelWords_.

Referenced by CSCRecoConditions::badStrip(), and fillBadChannelWords().

99  {
100  return idOfBadChannelWords_;
101  }
CSCDetId idOfBadChannelWords_
void CSCConditions::initializeEvent ( const edm::EventSetup es)

fetch database content via EventSetup

Definition at line 56 of file CSCConditions.cc.

References edm::ESWatcher< T >::check(), 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().

57 {
58  // Algorithms
59  es.get<CSCIndexerRecord>().get( indexer_ );
60  es.get<CSCChannelMapperRecord>().get( mapper_ );
61 
62  // Strip gains
63  es.get<CSCDBGainsRcd>().get( theGains );
64  // Strip X-talk
65  es.get<CSCDBCrosstalkRcd>().get( theCrosstalk );
66  // Strip pedestals
67  es.get<CSCDBPedestalsRcd>().get( thePedestals );
68  // Strip autocorrelation noise matrix
70 
71  if ( useTimingCorrections()){
72  // Buckeye chip speeds
74  // Cable lengths from chambers to peripheral crate and additional chamber level timing correction
76  }
77 
78  if ( readBadChannels() ) {
79  // Bad strip channels
80  es.get<CSCBadStripsRcd>().get( theBadStrips );
81  // Bad wiregroup channels
82  es.get<CSCBadWiresRcd>().get( theBadWires );
83 
84  //@@ if( badStripsWatcher_.check( es ) ) {
85  // fillBadStripWords();
86  //@@ }
87  //@@ if( badWiresWatcher_.check( es ) ) {
88  // fillBadWireWords();
89  //@ }
90 
91  }
92 
93  // Has GainsRcd changed?
94  if( gainsWatcher_.check( es ) ) { // Yes...
95  theAverageGain = -1.0; // ...reset, so next access will recalculate it
96  }
97 
98  if ( readBadChambers() ) {
99  // Entire bad chambers
100  es.get<CSCBadChambersRcd>().get( theBadChambers );
101  }
102 
103  if ( useGasGainCorrections()){
105  }
106 
107 // print();
108 }
edm::ESHandle< CSCDBGasGainCorrection > theGasGainCorrections
edm::ESHandle< CSCDBNoiseMatrix > theNoiseMatrix
edm::ESHandle< CSCBadWires > theBadWires
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?
edm::ESHandle< CSCBadChambers > theBadChambers
edm::ESHandle< CSCDBGains > theGains
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:57
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 204 of file CSCConditions.cc.

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

Referenced by CSCDbStripConditions::isInBadChamber().

204  {
205  //@@ We do not consider the possibility of having ME1/1A & ME1/1B independently 'bad'.
206  //@@ To do that we would need to define separate chamber indexes for ME1/1A & ME1/1B.
207 
208  if ( readBadChambers() ) {
209  CSCDetId idraw = mapper_->rawCSCDetId( id );
210  int index = indexer_->chamberIndex( idraw );
211  return theBadChambers->isInBadChamber( index );
212  }
213  else return false;
214 }
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 268 of file CSCConditions.cc.

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

Referenced by noiseMatrixElements().

269 {
270  //@@ BEWARE - THIS FUNCTION DOES NOT APPLY SCALE FACTOR USED IN PACKING VALUES IN CONDITIONS DATA
271  //@@ MAY BE AN ERROR? WHO WOULD WANT ACCESS WITHOUT IT?
272 
273  assert(theNoiseMatrix.isValid());
274  CSCDetId idraw = mapper_->rawCSCDetId( id );
275  int iraw = mapper_->rawStripChannel( id, geomChannel );
276  int index = indexer_->stripChannelIndex( idraw, iraw ) - 1; // NOTE THE MINUS ONE!
277  return theNoiseMatrix->item(index);
278 }
edm::ESHandle< CSCDBNoiseMatrix > theNoiseMatrix
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESHandle< CSCChannelMapperBase > mapper_
bool isValid() const
Definition: ESHandle.h:47
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 280 of file CSCConditions.cc.

References noiseMatrix(), and theNoiseMatrix.

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

280  {
281  assert(me.size() > 11 );
282  const CSCDBNoiseMatrix::Item& item = noiseMatrix(id, geomChannel); // i.e. the function above
283  me[0] = float ( item.elem33 )/theNoiseMatrix->scale();
284  me[1] = float ( item.elem34 )/theNoiseMatrix->scale();
285  me[2] = float ( item.elem35 )/theNoiseMatrix->scale();
286  me[3] = float ( item.elem44 )/theNoiseMatrix->scale();
287  me[4] = float ( item.elem45 )/theNoiseMatrix->scale();
288  me[5] = float ( item.elem46 )/theNoiseMatrix->scale();
289  me[6] = float ( item.elem55 )/theNoiseMatrix->scale();
290  me[7] = float ( item.elem56 )/theNoiseMatrix->scale();
291  me[8] = float ( item.elem57 )/theNoiseMatrix->scale();
292  me[9] = float ( item.elem66 )/theNoiseMatrix->scale();
293  me[10] = float ( item.elem67 )/theNoiseMatrix->scale();
294  me[11] = float ( item.elem77 )/theNoiseMatrix->scale();
295 }
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 225 of file CSCConditions.cc.

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

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

226 {
227  assert(thePedestals.isValid());
228  CSCDetId idraw = mapper_->rawCSCDetId( id );
229  int iraw = mapper_->rawStripChannel( id, geomChannel );
230  int index = indexer_->stripChannelIndex( idraw, iraw ) - 1; // NOTE THE MINUS ONE!
231  return float( thePedestals->pedestal(index) )/thePedestals->scale_ped();
232 }
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESHandle< CSCChannelMapperBase > mapper_
bool isValid() const
Definition: ESHandle.h:47
edm::ESHandle< CSCDBPedestals > thePedestals
float CSCConditions::pedestalSigma ( const CSCDetId detId,
int  channel 
) const

static ped rms in ADC counts

Definition at line 235 of file CSCConditions.cc.

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

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

236 {
237  assert(thePedestals.isValid());
238  CSCDetId idraw = mapper_->rawCSCDetId( id );
239  int iraw = mapper_->rawStripChannel( id, geomChannel );
240  int index = indexer_->stripChannelIndex( idraw, iraw ) - 1; // NOTE THE MINUS ONE!
241  return float( thePedestals->pedestal_rms(index) )/thePedestals->scale_rms();
242 }
edm::ESHandle< CSCIndexerBase > indexer_
edm::ESHandle< CSCChannelMapperBase > mapper_
bool isValid() const
Definition: ESHandle.h:47
edm::ESHandle< CSCDBPedestals > thePedestals
void CSCConditions::print ( void  ) const

Definition at line 410 of file CSCConditions.cc.

412 {
413 /*
414  std::cout << "SIZES: GAINS: " << theGains->gains.size()
415  << " PEDESTALS: " << thePedestals->pedestals.size()
416  << " NOISES " << theNoiseMatrix->matrix.size() << std::endl;;
417 
418  std::map< int,std::vector<CSCDBGains::Item> >::const_iterator layerGainsItr = theGains->gains.begin(),
419  lastGain = theGains->gains.end();
420  for( ; layerGainsItr != lastGain; ++layerGainsItr)
421  {
422  std::cout << "GAIN " << layerGainsItr->first
423  << " STRIPS " << layerGainsItr->second.size() << " "
424  << layerGainsItr->second[0].gain_slope
425  << " " << layerGainsItr->second[0].gain_intercept << std::endl;
426  }
427 
428  std::map< int,std::vector<CSCDBPedestals::Item> >::const_iterator pedestalItr = thePedestals->pedestals.begin(),
429  lastPedestal = thePedestals->pedestals.end();
430  for( ; pedestalItr != lastPedestal; ++pedestalItr)
431  {
432  std::cout << "PEDS " << pedestalItr->first << " "
433  << " STRIPS " << pedestalItr->second.size() << " ";
434  for(int i = 1; i < 80; ++i)
435  {
436  std::cout << pedestalItr->second[i-1].rms << " " ;
437  }
438  std::cout << std::endl;
439  }
440 
441  std::map< int,std::vector<CSCDBCrosstalk::Item> >::const_iterator crosstalkItr = theCrosstalk->crosstalk.begin(),
442  lastCrosstalk = theCrosstalk->crosstalk.end();
443  for( ; crosstalkItr != lastCrosstalk; ++crosstalkItr)
444  {
445  std::cout << "XTALKS " << crosstalkItr->first
446  << " STRIPS " << crosstalkItr->second.size() << " "
447  << crosstalkItr->second[5].xtalk_slope_left << " "
448  << crosstalkItr->second[5].xtalk_slope_right << " "
449  << crosstalkItr->second[5].xtalk_intercept_left << " "
450  << crosstalkItr->second[5].xtalk_intercept_right << std::endl;
451  }
452 */
453 }
int CSCConditions::rawStripChannel ( const CSCDetId id,
int  geomChannel 
) const

Definition at line 406 of file CSCConditions.cc.

References mapper_.

Referenced by CSCRecoConditions::badStrip().

407 { 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 112 of file CSCConditions.h.

References readBadChambers_.

Referenced by initializeEvent(), and isInBadChamber().

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

did we request reading bad channel info from db?

Definition at line 109 of file CSCConditions.h.

References readBadChannels_.

Referenced by fillBadChannelWords(), and initializeEvent().

109 { return readBadChannels_; }
void CSCConditions::setIdOfBadChannelWords ( const CSCDetId id)
inlineprivate

Set id for current content of bad channel words - this is offline id i.e. separate for ME11A & ME11B.

Definition at line 139 of file CSCConditions.h.

References idOfBadChannelWords_.

Referenced by fillBadChannelWords().

139  {
141  }
CSCDetId idOfBadChannelWords_
bool CSCConditions::useGasGainCorrections ( ) const
inline

did we request reading gas gain correction info from db?

Definition at line 127 of file CSCConditions.h.

References useGasGainCorrections_.

Referenced by gasGainCorrection(), and initializeEvent().

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

did we request reading timing correction info from db?

Definition at line 115 of file CSCConditions.h.

References useTimingCorrections_.

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

115 { return useTimingCorrections_; }
bool useTimingCorrections_

Member Data Documentation

std::bitset<112> CSCConditions::badStripWord_
private

Definition at line 170 of file CSCConditions.h.

Referenced by badStripWord(), fillBadChannelWords(), and fillBadStripWord().

std::bitset<112> CSCConditions::badWireWord_
private

Definition at line 171 of file CSCConditions.h.

Referenced by badWireWord(), fillBadChannelWords(), and fillBadWireWord().

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

Definition at line 175 of file CSCConditions.h.

Referenced by initializeEvent().

CSCDetId CSCConditions::idOfBadChannelWords_
private

Definition at line 169 of file CSCConditions.h.

Referenced by idOfBadChannelWords(), and setIdOfBadChannelWords().

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

Definition at line 164 of file CSCConditions.h.

Referenced by CSCConditions(), and readBadChambers().

bool CSCConditions::readBadChannels_
private

Definition at line 163 of file CSCConditions.h.

Referenced by CSCConditions(), and readBadChannels().

float CSCConditions::theAverageGain
mutableprivate

Definition at line 173 of file CSCConditions.h.

Referenced by averageGain(), and initializeEvent().

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

Definition at line 151 of file CSCConditions.h.

Referenced by initializeEvent(), and isInBadChamber().

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

Definition at line 149 of file CSCConditions.h.

Referenced by fillBadStripWord(), and initializeEvent().

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

Definition at line 150 of file CSCConditions.h.

Referenced by fillBadWireWord(), and initializeEvent().

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

Definition at line 153 of file CSCConditions.h.

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

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

Definition at line 152 of file CSCConditions.h.

Referenced by chipCorrection(), and initializeEvent().

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

Definition at line 146 of file CSCConditions.h.

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

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

Definition at line 145 of file CSCConditions.h.

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

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

Definition at line 154 of file CSCConditions.h.

Referenced by gasGainCorrection(), and initializeEvent().

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

Definition at line 148 of file CSCConditions.h.

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

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

Definition at line 147 of file CSCConditions.h.

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

bool CSCConditions::useGasGainCorrections_
private

Definition at line 166 of file CSCConditions.h.

Referenced by CSCConditions(), and useGasGainCorrections().

bool CSCConditions::useTimingCorrections_
private

Definition at line 165 of file CSCConditions.h.

Referenced by CSCConditions(), and useTimingCorrections().