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 ) {
7 }
CSCConditions theConditions
CSCRecoConditions::~CSCRecoConditions ( )

Definition at line 9 of file CSCRecoConditions.cc.

9  {
10 }

Member Function Documentation

float CSCRecoConditions::anodeBXoffset ( const CSCDetId detId) const

Definition at line 171 of file CSCRecoConditions.cc.

References CSCConditions::anodeBXoffset(), and theConditions.

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

171  {
172  return theConditions.anodeBXoffset(id);
173 }
float anodeBXoffset(const CSCDetId &detId) const
anode bx offset in bx given detId of chamber
CSCConditions theConditions
float CSCRecoConditions::averageGain ( ) const
inline

return average gain over entire CSC system

Definition at line 41 of file CSCRecoConditions.h.

References anodeBXoffset(), CSCConditions::averageGain(), badStrip(), badWireWord(), chamberTimingCorrection(), chipCorrection(), crossTalk(), fillBadChannelWords(), gasGainCorrection(), nearBadStrip(), noiseMatrix(), pedestal(), pedestalSigma(), digi_MixPreMix_cfi::strip, stripWeight(), stripWeights(), theConditions, and create_public_lumi_plots::weights.

Referenced by stripWeight().

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

Get bad wiregroup word.

Definition at line 163 of file CSCRecoConditions.cc.

References CSCConditions::badWireWord(), and theConditions.

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

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

Definition at line 167 of file CSCRecoConditions.cc.

References CSCConditions::chamberTimingCorrection(), and theConditions.

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

167  {
169 }
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 40 of file CSCRecoConditions.cc.

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

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

40  {
41  // geometric strip to geometric channel (e.g. ME1a, 1-48->1-16 ganged or 1-48 unganged)
42  int geomChannel = theConditions.channelFromStrip( id, geomStrip );
43  return theConditions.chipCorrection(id, geomChannel);
44 }
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 114 of file CSCRecoConditions.cc.

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

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

114  {
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
fill vector (dim 4, must be allocated by caller) with crosstalk sl, il, sr, ir
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 17 of file CSCRecoConditions.cc.

References CSCConditions::fillBadChannelWords(), and theConditions.

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

17  {
19 }
void fillBadChannelWords(const CSCDetId &id)
Fill bad channel words - one for strips, one for wires, for an offline CSCDetId.
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 33 of file CSCRecoConditions.cc.

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

Referenced by stripWeight().

33  {
34  LogTrace("CSCRecoConditions") << id << " geomChannel " << geomChannel << " gain " << theConditions.gain(id, geomChannel);
35  return theConditions.gain(id, geomChannel);
36 }
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 175 of file CSCRecoConditions.cc.

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

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

175  {
176  int geomChannel = theConditions.channelFromStrip( id, geomStrip);
177  return theConditions.gasGainCorrection(id, geomChannel, wiregroup);
178 }
int channelFromStrip(const CSCDetId &id, int geomStrip) const
feedthrough for external access
CSCConditions theConditions
float gasGainCorrection(const CSCDetId &detId, int strip, int wire) const
gas gain correction as a function of detId (w/layer), strip, and wire channels
void CSCRecoConditions::initializeEvent ( const edm::EventSetup es)

fetch the cond data from the database

Definition at line 12 of file CSCRecoConditions.cc.

References CSCConditions::initializeEvent(), and theConditions.

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

12  {
14 }
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 71 of file CSCRecoConditions.cc.

References CSCConditions::channelFromStrip(), HTMLExport::elem(), mps_fire::i, gen::k, funct::m, CSCConditions::noiseMatrixElements(), stripWeight(), theConditions, and w.

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

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

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

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

24  {
25  LogTrace("CSCRecoConditions") << id << " geomChannel " << geomChannel << " pedestal " << theConditions.pedestal(id, geomChannel);
26  return theConditions.pedestal(id, geomChannel);
27 }
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 29 of file CSCRecoConditions.cc.

References CSCConditions::pedestalSigma(), and theConditions.

Referenced by averageGain().

29  {
30  return theConditions.pedestalSigma(id, geomChannel);
31 }
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 61 of file CSCRecoConditions.cc.

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

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

61  {
62  int geomChannel = theConditions.channelFromStrip( id, geomStrip );
63  float w = averageGain() / gain(id, geomChannel); // averageGain() from CSCConditions
64  // Weights are forced to lie within 0.5 and 1.5
65  if (w > 1.5) w = 1.5;
66  if (w < 0.5) w = 0.5;
67  LogTrace("CSCRecoConditions") << id << " geomStrip " << geomStrip << " stripWeight " << w;
68  return w;
69 }
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 51 of file CSCRecoConditions.cc.

References mps_fire::i, and stripWeight().

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

51  {
52 
53  for ( short int i = 1; i < nstrips+1; ++i) {
54  weights[i-1] = stripWeight(id, i) ;
55  }
56 }
float stripWeight(const CSCDetId &id, int geomStrip) const
return gain weight for given strip channel

Member Data Documentation

CSCConditions CSCRecoConditions::theConditions
private