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 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) const
 Is the strip bad? More...
 
const std::bitset< 112 > & badWireWord (const CSCDetId &id) const
 Get bad wiregroup word. More...
 
float chamberTimingCorrection (const CSCDetId &detId) const
 
float chipCorrection (const CSCDetId &detId, int channel) const
 
void crossTalk (const CSCDetId &id, int centralStrip, std::vector< float > &xtalks) const
 
 CSCRecoConditions (const edm::ParameterSet &pset)
 
float gain (const CSCDetId &id, int channel) const
 channels count from 1 More...
 
float gasGainCorrection (const CSCDetId &detId, int strip, int wire) const
 returns gas-gain correction given detId (w/layer), strip, channel. This converts ME1/4 strips 1-16 to ME1/1 channels 65-80 More...
 
void initializeEvent (const edm::EventSetup &es)
 fetch the cond data from the database More...
 
bool nearBadStrip (const CSCDetId &id, int geomStrip) 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 More...
 
float pedestalSigma (const CSCDetId &id, int channel) const
 sigma of static pedestal in ADC counts More...
 
void stripWeights (const CSCDetId &id, float *weights) const
 
 ~CSCRecoConditions ()
 

Private Member Functions

float stripWeight (const CSCDetId &id, int channel) const
 

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 5 of file CSCRecoConditions.cc.

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

Definition at line 8 of file CSCRecoConditions.cc.

8  {
9 }

Member Function Documentation

float CSCRecoConditions::anodeBXoffset ( const CSCDetId detId) const

Definition at line 58 of file CSCRecoConditions.cc.

References CSCConditions::anodeBXoffset(), CSCChannelTranslator::rawCSCDetId(), and theConditions.

Referenced by CSCMake2DRecHit::findWireBx().

58  {
59  CSCChannelTranslator translate;
60  // If ME1/4, set ring = 1
61  CSCDetId idraw = translate.rawCSCDetId( id );
62  return theConditions.anodeBXoffset(idraw);
63 }
float anodeBXoffset(const CSCDetId &detId) const
CSCConditions theConditions
CSCDetId rawCSCDetId(const CSCDetId &id) const
float CSCRecoConditions::averageGain ( ) const
inline

return average gain over entire CSC system

Definition at line 39 of file CSCRecoConditions.h.

References CSCConditions::averageGain(), and theConditions.

Referenced by stripWeight().

39  {
40  return theConditions.averageGain(); }
CSCConditions theConditions
float averageGain() const
average gain over entire CSC system (logically const although must be cached here).
bool CSCRecoConditions::badStrip ( const CSCDetId id,
int  geomStrip 
) const

Is the strip bad?

Test for a bad strip.

Definition at line 297 of file CSCRecoConditions.cc.

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

Referenced by CSCHitFromStripOnly::isDeadStrip(), and nearBadStrip().

297  {
298  // Note ME1A strip runs 1-48
299  bool aBadS = false;
300  if(geomStrip>0 && geomStrip<81){
301  CSCChannelTranslator translate;
302  CSCDetId idraw = translate.rawCSCDetId( id );
303  int geomChan = translate.channelFromStrip( id, geomStrip );
304  int rawChan = translate.rawStripChannel( id, geomChan );
305 
306  const std::bitset<80>& badStrips = theConditions.badStripWord(idraw);
307 
308  if( rawChan>0 && rawChan<81 ){ // 80 bits max, labelled 0-79. Test 0-79 (i.e. any - that's the idea)
309  aBadS = badStrips.test(rawChan-1);
310  }
311  }
312  return aBadS;
313 }
const std::bitset< 80 > & badStripWord(const CSCDetId &id) const
return bad channel words per CSCLayer - 1 bit per channel
CSCConditions theConditions
int channelFromStrip(const CSCDetId &id, int strip) const
int rawStripChannel(const CSCDetId &id, int igeom) const
Return raw strip channel number for input geometrical channel number.
CSCDetId rawCSCDetId(const CSCDetId &id) const
const std::bitset< 112 > & CSCRecoConditions::badWireWord ( const CSCDetId id) const

Get bad wiregroup word.

Definition at line 316 of file CSCRecoConditions.cc.

References CSCConditions::badWireWord(), and theConditions.

Referenced by CSCHitFromWireOnly::isDeadWG().

316  {
317  return theConditions.badWireWord( id );
318 }
CSCConditions theConditions
const std::bitset< 112 > & badWireWord(const CSCDetId &id) const
float CSCRecoConditions::chamberTimingCorrection ( const CSCDetId detId) const

Definition at line 51 of file CSCRecoConditions.cc.

References CSCConditions::chamberTimingCorrection(), CSCChannelTranslator::rawCSCDetId(), and theConditions.

Referenced by CSCMake2DRecHit::hitFromStripAndWire().

51  {
52  CSCChannelTranslator translate;
53  // If ME1/4, set ring = 1
54  CSCDetId idraw = translate.rawCSCDetId( id );
56 }
float chamberTimingCorrection(const CSCDetId &detId) const
CSCConditions theConditions
CSCDetId rawCSCDetId(const CSCDetId &id) const
float CSCRecoConditions::chipCorrection ( const CSCDetId detId,
int  channel 
) const

Definition at line 37 of file CSCRecoConditions.cc.

References CSCChannelTranslator::channelFromStrip(), CSCConditions::chipCorrection(), CSCChannelTranslator::rawCSCDetId(), CSCChannelTranslator::rawStripChannel(), and theConditions.

Referenced by CSCMake2DRecHit::hitFromStripAndWire().

37  {
38  //printf("RecoCondition before translation e:%d s:%d r:%d c:%d l:%d strip:%d \n",id.endcap(),id.station(), id.ring(),id.chamber(),id.layer(),geomStrip);
39  CSCChannelTranslator translate;
40  // If ME1/4, set ring = 1
41  CSCDetId idraw = translate.rawCSCDetId( id );
42  // If ME1/4, collapse 48 chips into 16 electronics channel (1-48) -> (1-16)
43  int geomChannel = translate.channelFromStrip( id, geomStrip );
44  // Translate geometry-oriented strip channels into raw channels
45  // reordering ME+1/1a and ME-1/1b and moving ME1/1a (1-16)->(65-80)
46  int iraw = translate.rawStripChannel( id, geomChannel);
47  //printf("RecoCondition after translation e:%d s:%d r:%d c:%d l:%d strip:%d \n",idraw.endcap(),idraw.station(), idraw.ring(),idraw.chamber(),idraw.layer(),iraw);
48  return theConditions.chipCorrection(idraw, iraw);
49 }
float chipCorrection(const CSCDetId &detId, int channel) const
CSCConditions theConditions
int channelFromStrip(const CSCDetId &id, int strip) const
int rawStripChannel(const CSCDetId &id, int igeom) const
Return raw strip channel number for input geometrical channel number.
CSCDetId rawCSCDetId(const CSCDetId &id) const
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 ranges 1-48 in ME1a.

Definition at line 209 of file CSCRecoConditions.cc.

References CSCConditions::crossTalk(), CSCDetId, Reference_intrackfit_cff::endcap, i, and theConditions.

Referenced by CSCXonStrip_MatchGatti::findXOnStrip().

209  {
210 
211  xtalks.clear();
212 
213  short int strip1 = centralStrip;
214  short int triplet[3];
215  bool isME1a = (id.ring()==4);
216  CSCDetId id1;
217 
218  // ME1/a constants are stored in channels 65-80 of ME11, ME1/b in channels 1-64.
219  // ME1/a channels are ganged - 48 strips to 16 channels.
220  if ( isME1a ) { // ME1a
221 
222  strip1 = centralStrip%16; // strip# 1-48
223  if (strip1 == 0) strip1 = 16; // channel# 1-16
224  strip1 += 64; // strip1 65-80
225  id1=CSCDetId( id.endcap(), 1, 1, id.chamber(), id.layer() ); // ME11 detId
226 
227  if (strip1 == 65) {
228  triplet[0]=80;
229  triplet[1]=65;
230  triplet[2]=66;
231  } else if (strip1 == 80) {
232  triplet[0]=79;
233  triplet[1]=80;
234  triplet[2]=65;
235  } else {
236  triplet[0]=strip1-1;
237  triplet[1]=strip1;
238  triplet[2]=strip1+1;
239  }
240  }
241  else { // non-ME1a
242  triplet[0]=strip1-1;
243  triplet[1]=strip1;
244  triplet[2]=strip1+1;
245  }
246 
247  // For 3 neighbouring strips get crosstalks
248  short int idx = 0;
249  for ( short int i = 0; i < 3; ++i) {
250 
251  short int channel = triplet[i];
252  std::vector<float> ct(4);
253 
254  if ( isME1a ) {
255  theConditions.crossTalk(id1, channel, ct);
256  }
257  else {
258  theConditions.crossTalk(id, channel, ct);
259  }
260 
261  xtalks.push_back(ct[0]);
262  xtalks.push_back(ct[1]);
263  xtalks.push_back(ct[2]);
264  xtalks.push_back(ct[3]);
265  ++idx;
266  }
267 }
int i
Definition: DBlmapReader.cc:9
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
CSCConditions theConditions
float CSCRecoConditions::gain ( const CSCDetId id,
int  channel 
) const

channels count from 1

Definition at line 16 of file CSCRecoConditions.cc.

References CSCConditions::gain(), CSCChannelTranslator::rawCSCDetId(), CSCChannelTranslator::rawStripChannel(), and theConditions.

16  {
17  CSCChannelTranslator translate;
18  CSCDetId idraw = translate.rawCSCDetId( id );
19  int iraw = translate.rawStripChannel( id, channel );
20  return theConditions.gain(idraw, iraw);
21 }
CSCConditions theConditions
float gain(const CSCDetId &detId, int channel) const
channels count from 1
int rawStripChannel(const CSCDetId &id, int igeom) const
Return raw strip channel number for input geometrical channel number.
CSCDetId rawCSCDetId(const CSCDetId &id) const
float CSCRecoConditions::gasGainCorrection ( const CSCDetId detId,
int  strip,
int  wire 
) const

returns gas-gain correction given detId (w/layer), strip, channel. This converts ME1/4 strips 1-16 to ME1/1 channels 65-80

Definition at line 330 of file CSCRecoConditions.cc.

References CSCChannelTranslator::channelFromStrip(), CSCConditions::gasGainCorrection(), CSCChannelTranslator::rawCSCDetId(), CSCChannelTranslator::rawStripChannel(), and theConditions.

Referenced by CSCMake2DRecHit::hitFromStripAndWire().

330  {
331  //printf("RecoCondition before translation e:%d s:%d r:%d c:%d l:%d strip:%d wire:%d \n",id.endcap(),id.station(), id.ring(),id.chamber(),id.layer(),geomStrip,wire);
332  CSCChannelTranslator translate;
333  // If ME1/4, set ring = 1
334  CSCDetId idraw = translate.rawCSCDetId( id );
335  // If ME1/4, collapse 48 chips into 16 electronics channel (1-48) -> (1-16)
336  int geomChannel = translate.channelFromStrip( id, geomStrip );
337  // Translate geometry-oriented strip channels into raw channels
338  // reordering ME+1/1a and ME-1/1b and moving ME1/1a (1-16)->(65-80)
339  int iraw = translate.rawStripChannel( id, geomChannel);
340  //printf("RecoCondition after translation e:%d s:%d r:%d c:%d l:%d strip:%d \n",idraw.endcap(),idraw.station(), idraw.ring(),idraw.chamber(),idraw.layer(),iraw);
341  return theConditions.gasGainCorrection(idraw, iraw, wire);
342 }
CSCConditions theConditions
int channelFromStrip(const CSCDetId &id, int strip) const
int rawStripChannel(const CSCDetId &id, int igeom) const
Return raw strip channel number for input geometrical channel number.
float gasGainCorrection(const CSCDetId &detId, int strip, int wire) const
gas gain correction as a function of detId (w/layer), strip, and wire
CSCDetId rawCSCDetId(const CSCDetId &id) const
void CSCRecoConditions::initializeEvent ( const edm::EventSetup es)

fetch the cond data from the database

Definition at line 11 of file CSCRecoConditions.cc.

References CSCConditions::initializeEvent(), and theConditions.

Referenced by CSCRecHitDProducer::produce().

11  {
13 }
CSCConditions theConditions
void initializeEvent(const edm::EventSetup &es)
fetch the maps from the database
bool CSCRecoConditions::nearBadStrip ( const CSCDetId id,
int  geomStrip 
) const

Is a neighbour bad?

Test for neighbouring bad strip I'm a bit confused about this - it returns true if strip is not at edge, and either of its neighbours is bad.

Definition at line 273 of file CSCRecoConditions.cc.

References badStrip().

Referenced by CSCHitFromStripOnly::isNearDeadStrip().

273  {
274  // Note ME1A strip runs 1-48
275  /*
276  CSCChannelTranslator translate;
277  CSCDetId idraw = translate.rawCSCDetId( id );
278  int geomChan = translate.channelFromStrip( id, geomStrip );
279  int rawChan = translate.rawStripChannel( id, geomChan );
280 
281  const std::bitset<80>& badStrips = theConditions.badStripWord(idraw);
282 
283  bool nearBad = false;
284  if( rawChan>1 && rawChan<80 ){ // 80 bits max, labelled 0-79. Test 1-78 for neighbours.
285  nearBad = (badStrips.test(rawChan) || badStrips.test(rawChan-2));
286  }
287  */
288  //
289  bool nearBad = (badStrip(id,geomStrip-1) || badStrip(id,geomStrip+1));
290 
291 
292  return nearBad;
293 }
bool badStrip(const CSCDetId &id, int geomStrip) 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 94 of file CSCRecoConditions.cc.

References CSCDetId, HTMLExport::elem(), Reference_intrackfit_cff::endcap, i, j, gen::k, CSCConditions::noiseMatrixElements(), stripWeight(), theConditions, and w().

Referenced by CSCXonStrip_MatchGatti::findXOnStrip().

94  {
95 
96  // nMatrix will be filled with expanded noise matrix elements for
97  // channel 'centralStrip' and its immediate neighbours
98  nMatrix.clear();
99 
100  // Initialize values in case we can't find chamber with constants
101  // These are ME1/2 constants...
102  float elem[15];
103  elem[0] = 8.64;
104  elem[1] = 3.47;
105  elem[2] = 2.45;
106  elem[3] = 8.60;
107  elem[4] = 3.28;
108  elem[5] = 1.88;
109  elem[6] = 8.61;
110  elem[7] = 3.18;
111  elem[8] = 1.99;
112  elem[9] = 7.67;
113  elem[10] = 2.64;
114  elem[11] = 0.;
115  elem[12] = 7.71;
116  elem[13] = 0.;
117  elem[14] = 0.;
118 
119  short int strip1 = centralStrip;
120  short int triplet[3];
121  bool isME1a = (id.ring()==4);
122  CSCDetId id1;
123 
124  // ME1/a constants are stored in channels 65-80 of ME11, ME1/b in channels 1-64.
125  // ME1/a channels are ganged - 48 strips to 16 channels.
126  if ( isME1a ) { // ME1a
127 
128  strip1 = centralStrip%16; // strip# 1-48
129  if (strip1 == 0) strip1 = 16; // channel# 1-16
130  strip1 += 64; // strip1 65-80
131  id1=CSCDetId( id.endcap(), 1, 1, id.chamber(), id.layer() ); // ME11 detId
132 
133  if (strip1 == 65) {
134  triplet[0]=80;
135  triplet[1]=65;
136  triplet[2]=66;
137  } else if (strip1 == 80) {
138  triplet[0]=79;
139  triplet[1]=80;
140  triplet[2]=65;
141  } else {
142  triplet[0]=strip1-1;
143  triplet[1]=strip1;
144  triplet[2]=strip1+1;
145 
146  }
147  }
148  else { // non-ME1a
149  triplet[0]=strip1-1;
150  triplet[1]=strip1;
151  triplet[2]=strip1+1;
152  }
153 
154  for ( short int i = 0; i < 3; ++i) {
155 
156  short int channel = triplet[i];
157  float w;
158  std::vector<float> me(12);
159 
160  if ( isME1a ) {
161  w = stripWeight(id1, channel);
162  theConditions.noiseMatrixElements(id1, channel, me);
163  }
164  else {
165  w = stripWeight(id, channel);
166  theConditions.noiseMatrixElements(id, channel, me);
167  }
168  w = w*w;
169  for ( short int j=0; j<11; ++j ) {
170  elem[j] = me[j] * w;
171  }
172  elem[11]= 0.;
173  elem[12]= me[11] * w;
174  elem[13]= 0.;
175  elem[14]= 0.;
176 
177  // Test that elements make sense:
178  bool isFlawed = false;
179  for ( int k = 0; k < 15; ++k) {
180  // make sure the number isn't too close to zero...
181  if (elem[k] < 0.001) elem[k] = 0.001;
182  // make sure the number isn't too big...
183  if (elem[k] > 50.) isFlawed = true;
184  }
185 
186  if ( isFlawed ) {
187  // These are fake ME1/2:
188  elem[0] = 8.64;
189  elem[1] = 3.47;
190  elem[2] = 2.45;
191  elem[3] = 8.60;
192  elem[4] = 3.28;
193  elem[5] = 1.88;
194  elem[6] = 8.61;
195  elem[7] = 3.18;
196  elem[8] = 1.99;
197  elem[9] = 7.67;
198  elem[10] = 2.64;
199  elem[11] = 0.;
200  elem[12] = 7.71;
201  elem[13] = 0.;
202  elem[14] = 0.;
203  }
204 
205  for (int k = 0; k < 15; ++k) nMatrix.push_back( elem[k] );
206  }
207 }
int i
Definition: DBlmapReader.cc:9
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) ...
float stripWeight(const CSCDetId &id, int channel) const
int j
Definition: DBlmapReader.cc:9
CSCConditions theConditions
int k[5][pyjets_maxn]
T w() const
float CSCRecoConditions::pedestal ( const CSCDetId id,
int  channel 
) const

static pedestal in ADC counts

Definition at line 23 of file CSCRecoConditions.cc.

References CSCConditions::pedestal(), CSCChannelTranslator::rawCSCDetId(), CSCChannelTranslator::rawStripChannel(), and theConditions.

Referenced by CSCStaticPedestal::pedestal().

23  {
24  CSCChannelTranslator translate;
25  CSCDetId idraw = translate.rawCSCDetId( id );
26  int iraw = translate.rawStripChannel( id, channel );
27  return theConditions.pedestal(idraw, iraw);
28 }
float pedestal(const CSCDetId &detId, int channel) const
in ADC counts
CSCConditions theConditions
int rawStripChannel(const CSCDetId &id, int igeom) const
Return raw strip channel number for input geometrical channel number.
CSCDetId rawCSCDetId(const CSCDetId &id) const
float CSCRecoConditions::pedestalSigma ( const CSCDetId id,
int  channel 
) const

sigma of static pedestal in ADC counts

Definition at line 30 of file CSCRecoConditions.cc.

References CSCConditions::pedestalSigma(), CSCChannelTranslator::rawCSCDetId(), CSCChannelTranslator::rawStripChannel(), and theConditions.

30  {
31  CSCChannelTranslator translate;
32  CSCDetId idraw = translate.rawCSCDetId( id );
33  int iraw = translate.rawStripChannel( id, channel );
34  return theConditions.pedestalSigma(idraw, iraw);
35 }
float pedestalSigma(const CSCDetId &detId, int channel) const
CSCConditions theConditions
int rawStripChannel(const CSCDetId &id, int igeom) const
Return raw strip channel number for input geometrical channel number.
CSCDetId rawCSCDetId(const CSCDetId &id) const
float CSCRecoConditions::stripWeight ( const CSCDetId id,
int  channel 
) const
private

return gain weight for given strip channel

WARNING - expects ME11 detId for both ME1b (channels 1-64) AND for ME1a (channels 65-80) so this requires 'raw' channel interface.

Definition at line 321 of file CSCRecoConditions.cc.

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

Referenced by noiseMatrix(), and stripWeights().

321  {
322  float w = averageGain() / theConditions.gain(id, channel);
323 
324  // Weights are forced to lie within 0.5 and 1.5
325  if (w > 1.5) w = 1.5;
326  if (w < 0.5) w = 0.5;
327  return w;
328 }
float averageGain() const
return average gain over entire CSC system
CSCConditions theConditions
float gain(const CSCDetId &detId, int channel) const
channels count from 1
T w() const
void CSCRecoConditions::stripWeights ( const CSCDetId id,
float *  weights 
) const

calculate gain weights for all strips in a CSC layer

  • filled into C-array which caller must have allocated.

Definition at line 65 of file CSCRecoConditions.cc.

References Reference_intrackfit_cff::endcap, i, stripWeight(), and w().

Referenced by CSCHitFromStripOnly::runStrip().

65  {
66 
67  short int is = id.station();
68  short int ir = id.ring();
69 
70  short int strip1 = 1;
71  short int nStrips = 80;
72  if ( is == 1 && ir == 1) nStrips = 64; // ME1b
73  if ( is == 1 && ir == 3) nStrips = 64; // ME13
74 
75  if ( ir == 4 ) { // ME1a
76  const CSCDetId testId( id.endcap(), 1, 1, id.chamber(), id.layer() ); // create ME11 detId
77  strip1 = 65; // ME1a channels are 65-80 in ME11
78  for ( short int i = 0; i < 16; ++i) {
79  float w = stripWeight(testId, strip1+i);
80 
81  // Unfold ganged channels in ME1a
82  weights[i] = w;
83  weights[i+16] = w;
84  weights[i+32] = w;
85  }
86  }
87  else { // non-ME1a chambers
88  for ( short int i = 0; i < nStrips; ++i) {
89  weights[i] = stripWeight(id, strip1+i);
90  }
91  }
92 }
int i
Definition: DBlmapReader.cc:9
float stripWeight(const CSCDetId &id, int channel) const
T w() const

Member Data Documentation

CSCConditions CSCRecoConditions::theConditions
private