CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
CSCRecoConditions Class Reference

#include <CSCRecoConditions.h>

Public Member Functions

float anodeBXoffset (const CSCDetId &detId) const
 
float averageGain () const
 return average gain over entire CSC system More...
 
bool badStrip (const CSCDetId &id, int geomStrip, int nstrips) const
 Is the strip bad? More...
 
const std::bitset< 112 > & badWireWord (const CSCDetId &id) const
 Get bad wiregroup word. More...
 
float chamberTimingCorrection (const CSCDetId &id) const
 
float chipCorrection (const CSCDetId &detId, int channel) const
 All other functions are accessed by geometrical strip label (i.e. strip number according to local coordinates) More...
 
void crossTalk (const CSCDetId &id, int centralStrip, std::vector< float > &xtalks) const
 
 CSCRecoConditions (const edm::ParameterSet &pset)
 
void fillBadChannelWords (const CSCDetId &id)
 fill bad strip & bad wiregroup bitsets from conditions data More...
 
float gain (const CSCDetId &id, int geomStrip) const
 channels and geomstrips count from 1 More...
 
float gasGainCorrection (const CSCDetId &id, int strip, int wireGroup) const
 returns gas-gain correction More...
 
void initializeEvent (const edm::EventSetup &es)
 fetch the cond data from the database More...
 
bool nearBadStrip (const CSCDetId &id, int geomStrip, int nstrips) const
 Is a neighbour bad? More...
 
void noiseMatrix (const CSCDetId &id, int centralStrip, std::vector< float > &nme) const
 
float pedestal (const CSCDetId &id, int channel) const
 static pedestal in ADC counts for strip channel (e.g. 1-16 for ganged ME1a, 1-48 for unganged ME1a) More...
 
float pedestalSigma (const CSCDetId &id, int channel) const
 sigma of static pedestal in ADC counts for strip channel (e.g. 1-16 for ganged ME1a, 1-48 for unganged ME1a) More...
 
void stripWeights (const CSCDetId &id, short int nstrips, float *weights) const
 
 ~CSCRecoConditions ()
 

Private Member Functions

float stripWeight (const CSCDetId &id, int geomStrip) const
 return gain weight for given strip channel More...
 

Private Attributes

CSCConditions theConditions
 

Detailed Description

Wrap CSCConditions class for use in CSC local reconstruction, in analogy with wrapper classes Rick uses in CSCDigitizer.

CSCConditions encapsulates the conditions data (e.g. calibration data) from the database and presents it as CSCRecHitD requires (and that is somewhat historical!)

All functions in public interface accept CSCDetId for ME1A (i.e. ring 4) with channel number 1-16 (and not the raw ME11 channel 65-80).

Author
Tim Cox - UC Davis

Definition at line 24 of file CSCRecoConditions.h.

Constructor & Destructor Documentation

CSCRecoConditions::CSCRecoConditions ( const edm::ParameterSet pset)
explicit

Definition at line 6 of file CSCRecoConditions.cc.

6 : theConditions(ps) {}
CSCConditions theConditions
CSCRecoConditions::~CSCRecoConditions ( )

Definition at line 8 of file CSCRecoConditions.cc.

8 {}

Member Function Documentation

float CSCRecoConditions::anodeBXoffset ( const CSCDetId detId) const

Definition at line 168 of file CSCRecoConditions.cc.

References CSCConditions::anodeBXoffset(), and theConditions.

Referenced by averageGain(), and CSCMake2DRecHit::findWireBx().

168 { return theConditions.anodeBXoffset(id); }
float anodeBXoffset(const CSCDetId &detId) const
anode bx offset in bx given detId of chamber
CSCConditions theConditions
float CSCRecoConditions::averageGain ( ) const
inline
bool CSCRecoConditions::badStrip ( const CSCDetId id,
int  geomStrip,
int  nstrips 
) const

Is the strip bad?

Is strip itself a bad strip?

Definition at line 138 of file CSCRecoConditions.cc.

References CSCConditions::badStripWord(), CSCConditions::channelFromStrip(), CSCConditions::idOfBadChannelWords(), CSCConditions::rawStripChannel(), and theConditions.

Referenced by CSCRecoBadChannelsAnalyzer::analyze(), averageGain(), CSCHitFromStripOnly::isDeadStrip(), and nearBadStrip().

138  {
139  // input nstrips is no. of strips in the layer (could get this from CSCChamberSpecs or CSCLayerGeometry
140  // but then need a CSCLayer*)
141 
142  bool bad = true; // if geomStrip out of range, call strip bad
143 
144  if (id != theConditions.idOfBadChannelWords()) {
145  bad = false; // if bad channel words for this id not filled, call strip good
146  return bad;
147  }
148 
149  if (geomStrip > 0 && geomStrip <= nstrips) {
150  bad = false; // default to good
151  int geomChan = theConditions.channelFromStrip(id, geomStrip);
152  int rawChan = theConditions.rawStripChannel(id, geomChan);
153  if (rawChan > 0 && rawChan < 113) {
154  const std::bitset<112>& badStrips = theConditions.badStripWord();
155  bad = badStrips.test(rawChan - 1); // 112 bits max, labelled 0-111.
156  }
157  }
158  return bad;
159 }
int rawStripChannel(const CSCDetId &id, int geomChannel) const
int channelFromStrip(const CSCDetId &id, int geomStrip) const
feedthrough for external access
CSCConditions theConditions
const CSCDetId & idOfBadChannelWords() const
the offline CSCDetId of current bad channel words
Definition: CSCConditions.h:98
const std::bitset< 112 > & badStripWord() const
bad strip channel word for a CSCLayer - 1 bit per channel
Definition: CSCConditions.h:92
const std::bitset< 112 > & CSCRecoConditions::badWireWord ( const CSCDetId id) const

Get bad wiregroup word.

Definition at line 162 of file CSCRecoConditions.cc.

References CSCConditions::badWireWord(), and theConditions.

Referenced by averageGain(), and CSCHitFromWireOnly::isDeadWG().

162 { return theConditions.badWireWord(); }
const std::bitset< 112 > & badWireWord() const
bad wiregroup channel word for a CSCLayer - 1 bit per channel
Definition: CSCConditions.h:95
CSCConditions theConditions
float CSCRecoConditions::chamberTimingCorrection ( const CSCDetId id) const

Definition at line 164 of file CSCRecoConditions.cc.

References CSCConditions::chamberTimingCorrection(), and theConditions.

Referenced by averageGain(), and CSCMake2DRecHit::hitFromStripAndWire().

164  {
166 }
float chamberTimingCorrection(const CSCDetId &detId) const
chamber timing correction in ns given detId of chamber
CSCConditions theConditions
float CSCRecoConditions::chipCorrection ( const CSCDetId detId,
int  channel 
) const

All other functions are accessed by geometrical strip label (i.e. strip number according to local coordinates)

Definition at line 36 of file CSCRecoConditions.cc.

References CSCConditions::channelFromStrip(), CSCConditions::chipCorrection(), and theConditions.

Referenced by averageGain(), and CSCMake2DRecHit::hitFromStripAndWire().

36  {
37  // geometric strip to geometric channel (e.g. ME1a, 1-48->1-16 ganged or 1-48 unganged)
38  int geomChannel = theConditions.channelFromStrip(id, geomStrip);
39  return theConditions.chipCorrection(id, geomChannel);
40 }
float chipCorrection(const CSCDetId &detId, int channel) const
chip speed correction in ns given detId (w/layer) and strip channel
int channelFromStrip(const CSCDetId &id, int geomStrip) const
feedthrough for external access
CSCConditions theConditions
void CSCRecoConditions::crossTalk ( const CSCDetId id,
int  centralStrip,
std::vector< float > &  xtalks 
) const

fill crosstalk information for 3 neighbouring strips as linear vector (must be allocated by caller) Note that centralStrip is a 'geomStrip' and e.g. always ranges 1-48 in ME1a.

Definition at line 115 of file CSCRecoConditions.cc.

References CSCConditions::channelFromStrip(), CSCConditions::crossTalk(), mps_fire::i, and theConditions.

Referenced by averageGain(), and CSCXonStrip_MatchGatti::findXOnStrip().

115  {
116  // xtalks will be filled with crosstalk for geomStrip and its immediate neighbours
117 
118  xtalks.clear();
119 
120  for (short int i = geomStrip - 1; i < geomStrip + 2; ++i) {
121  int geomChannel = theConditions.channelFromStrip(id, i);
122  std::vector<float> ct(4);
123  theConditions.crossTalk(id, geomChannel, ct);
124  xtalks.push_back(ct[0]);
125  xtalks.push_back(ct[1]);
126  xtalks.push_back(ct[2]);
127  xtalks.push_back(ct[3]);
128  }
129 }
void crossTalk(const CSCDetId &id, int channel, std::vector< float > &ct) const
int channelFromStrip(const CSCDetId &id, int geomStrip) const
feedthrough for external access
CSCConditions theConditions
void CSCRecoConditions::fillBadChannelWords ( const CSCDetId id)

fill bad strip & bad wiregroup bitsets from conditions data

Fill badStrip word and badWire word for given CSC layer, id.

Definition at line 13 of file CSCRecoConditions.cc.

References CSCConditions::fillBadChannelWords(), and theConditions.

Referenced by CSCRecoBadChannelsAnalyzer::analyze(), averageGain(), and CSCRecHitDBuilder::build().

void fillBadChannelWords(const CSCDetId &id)
CSCConditions theConditions
float CSCRecoConditions::gain ( const CSCDetId id,
int  geomStrip 
) const

channels and geomstrips count from 1

return gain for given strip

Definition at line 28 of file CSCRecoConditions.cc.

References CSCConditions::gain(), LogTrace, and theConditions.

Referenced by stripWeight().

28  {
29  LogTrace("CSCRecoConditions") << id << " geomChannel " << geomChannel << " gain "
30  << theConditions.gain(id, geomChannel);
31  return theConditions.gain(id, geomChannel);
32 }
CSCConditions theConditions
#define LogTrace(id)
float gain(const CSCDetId &detId, int channel) const
gain per channel
float CSCRecoConditions::gasGainCorrection ( const CSCDetId id,
int  strip,
int  wireGroup 
) const

returns gas-gain correction

Definition at line 170 of file CSCRecoConditions.cc.

References CSCConditions::channelFromStrip(), CSCConditions::gasGainCorrection(), and theConditions.

Referenced by averageGain(), and CSCMake2DRecHit::hitFromStripAndWire().

170  {
171  int geomChannel = theConditions.channelFromStrip(id, geomStrip);
172  return theConditions.gasGainCorrection(id, geomChannel, wiregroup);
173 }
int channelFromStrip(const CSCDetId &id, int geomStrip) const
feedthrough for external access
CSCConditions theConditions
float gasGainCorrection(const CSCDetId &detId, int strip, int wire) const
void CSCRecoConditions::initializeEvent ( const edm::EventSetup es)

fetch the cond data from the database

Definition at line 10 of file CSCRecoConditions.cc.

References CSCConditions::initializeEvent(), and theConditions.

Referenced by CSCRecoBadChannelsAnalyzer::analyze(), and CSCRecHitDProducer::produce().

CSCConditions theConditions
void initializeEvent(const edm::EventSetup &es)
fetch database content via EventSetup
bool CSCRecoConditions::nearBadStrip ( const CSCDetId id,
int  geomStrip,
int  nstrips 
) const

Is a neighbour bad?

Is an immediate neighbour a bad strip?

Definition at line 132 of file CSCRecoConditions.cc.

References badStrip().

Referenced by CSCRecoBadChannelsAnalyzer::analyze(), averageGain(), and CSCHitFromStripOnly::isNearDeadStrip().

132  {
133  bool nearBad = (badStrip(id, geomStrip - 1, nstrips) || badStrip(id, geomStrip + 1, nstrips));
134  return nearBad;
135 }
bool badStrip(const CSCDetId &id, int geomStrip, int nstrips) const
Is the strip bad?
void CSCRecoConditions::noiseMatrix ( const CSCDetId id,
int  centralStrip,
std::vector< float > &  nme 
) const

fill expanded noise matrix for 3 neighbouring strips as linear vector (must be allocated by caller) Note that centralStrip is a 'geomStrip' and ranges 1-48 in ME1a.

Definition at line 68 of file CSCRecoConditions.cc.

References CSCConditions::channelFromStrip(), HTMLExport::elem(), mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, visualization-live-secondInstance_cfg::m, hlt_dqm_clientPB-live_cfg::me, CSCConditions::noiseMatrixElements(), stripWeight(), theConditions, and w.

Referenced by averageGain(), and CSCXonStrip_MatchGatti::findXOnStrip().

68  {
69  // nMatrix will be filled with expanded noise matrix elements for strip 'geomStrip' and its immediate neighbours
70 
71  nMatrix.clear();
72 
73  // These are ME1/2 constants as fall-back
74  const float fakeme12[15] = {8.64, 3.47, 2.45, 8.60, 3.28, 1.88, 8.61, 3.18, 1.99, 7.67, 2.64, 0., 7.71, 0., 0.};
75 
76  float elem[15];
77 
78  for (short int i = geomStrip - 1; i < geomStrip + 2; ++i) {
79  std::vector<float> me(12);
80 
81  float w = stripWeight(id, i);
82  w = w * w;
83  int geomChannel = theConditions.channelFromStrip(id, i);
84  theConditions.noiseMatrixElements(id, geomChannel, me);
85  for (short int j = 0; j < 11; ++j) {
86  elem[j] = me[j] * w;
87  }
88  elem[11] = 0.;
89  elem[12] = me[11] * w;
90  elem[13] = 0.;
91  elem[14] = 0.;
92 
93  // Test that elements make sense:
94  bool isFlawed = false;
95  for (short int k = 0; k < 15; ++k) {
96  if (elem[k] < 0.001)
97  elem[k] = 0.001; // fix if too small...
98  if (elem[k] > 50.)
99  isFlawed = true; // fail if too big...
100  }
101 
102  if (isFlawed) {
103  // These are fake ME1/2:
104  for (short int m = 0; m < 15; ++m) {
105  elem[m] = fakeme12[m];
106  }
107  }
108 
109  for (int k = 0; k < 15; ++k) {
110  nMatrix.push_back(elem[k]);
111  }
112  }
113 }
const double w
Definition: UKUtility.cc:23
void noiseMatrixElements(const CSCDetId &id, int channel, std::vector< float > &me) const
int channelFromStrip(const CSCDetId &id, int geomStrip) const
feedthrough for external access
CSCConditions theConditions
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:19
float stripWeight(const CSCDetId &id, int geomStrip) const
return gain weight for given strip channel
float CSCRecoConditions::pedestal ( const CSCDetId id,
int  geomChannel 
) const

static pedestal in ADC counts for strip channel (e.g. 1-16 for ganged ME1a, 1-48 for unganged ME1a)

gains & pedestals are requested by geometric channel (as in CSCStripDigi- e.g. 1-16 for ganged ME1a, and with any readout flips already removed)

Definition at line 18 of file CSCRecoConditions.cc.

References LogTrace, CSCConditions::pedestal(), and theConditions.

Referenced by averageGain(), and CSCStaticPedestal::pedestal().

18  {
19  LogTrace("CSCRecoConditions") << id << " geomChannel " << geomChannel << " pedestal "
20  << theConditions.pedestal(id, geomChannel);
21  return theConditions.pedestal(id, geomChannel);
22 }
float pedestal(const CSCDetId &detId, int channel) const
static ped in ADC counts
CSCConditions theConditions
#define LogTrace(id)
float CSCRecoConditions::pedestalSigma ( const CSCDetId id,
int  channel 
) const

sigma of static pedestal in ADC counts for strip channel (e.g. 1-16 for ganged ME1a, 1-48 for unganged ME1a)

Definition at line 24 of file CSCRecoConditions.cc.

References CSCConditions::pedestalSigma(), and theConditions.

Referenced by averageGain().

24  {
25  return theConditions.pedestalSigma(id, geomChannel);
26 }
float pedestalSigma(const CSCDetId &detId, int channel) const
static ped rms in ADC counts
CSCConditions theConditions
float CSCRecoConditions::stripWeight ( const CSCDetId id,
int  geomStrip 
) const
private

return gain weight for given strip channel

Definition at line 56 of file CSCRecoConditions.cc.

References averageGain(), CSCConditions::channelFromStrip(), gain(), LogTrace, theConditions, and w.

Referenced by averageGain(), noiseMatrix(), and stripWeights().

56  {
57  int geomChannel = theConditions.channelFromStrip(id, geomStrip);
58  float w = averageGain() / gain(id, geomChannel); // averageGain() from CSCConditions
59  // Weights are forced to lie within 0.5 and 1.5
60  if (w > 1.5)
61  w = 1.5;
62  if (w < 0.5)
63  w = 0.5;
64  LogTrace("CSCRecoConditions") << id << " geomStrip " << geomStrip << " stripWeight " << w;
65  return w;
66 }
const double w
Definition: UKUtility.cc:23
float averageGain() const
return average gain over entire CSC system
float gain(const CSCDetId &id, int geomStrip) const
channels and geomstrips count from 1
int channelFromStrip(const CSCDetId &id, int geomStrip) const
feedthrough for external access
CSCConditions theConditions
#define LogTrace(id)
void CSCRecoConditions::stripWeights ( const CSCDetId id,
short int  nstrips,
float *  weights 
) const

calculate gain weights for all strips in a CSC layer (total in layer = nstrips) this is averageGain()/gain for each strip filled into a C-array which caller must have allocated. values are constrained to be in [0.5, 1.5]

Definition at line 47 of file CSCRecoConditions.cc.

References mps_fire::i, and stripWeight().

Referenced by averageGain(), and CSCHitFromStripOnly::runStrip().

47  {
48  for (short int i = 1; i < nstrips + 1; ++i) {
49  weights[i - 1] = stripWeight(id, i);
50  }
51 }
float stripWeight(const CSCDetId &id, int geomStrip) const
return gain weight for given strip channel

Member Data Documentation

CSCConditions CSCRecoConditions::theConditions
private