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 &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)
 
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) 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 159 of file CSCRecoConditions.cc.

References CSCConditions::anodeBXoffset(), and theConditions.

Referenced by CSCMake2DRecHit::findWireBx().

159  {
160  return theConditions.anodeBXoffset(id);
161 }
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 CSCConditions::averageGain(), and theConditions.

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 
) const

Is the strip bad?

Is strip itself a bad strip?

Definition at line 133 of file CSCRecoConditions.cc.

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

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

133  {
134  //@@ NOT YET UPDATED FOR UNGANGED ME11A
135 
136  bool aBadS = false;
137  if(geomStrip>0 && geomStrip<81){
138  int geomChan = theConditions.channelFromStrip( id, geomStrip );
139  const std::bitset<80>& badStrips = theConditions.badStripWord(id);
140 
141  int rawChan = theConditions.rawStripChannel( id, geomChan );
142  if( rawChan>0 && rawChan<81 ){
143  aBadS = badStrips.test(rawChan-1); // 80 bits max, labelled 0-79.
144 
145  }
146  }
147  return aBadS;
148 }
const std::bitset< 80 > & badStripWord(const CSCDetId &id) const
bad channel words per CSCLayer - 1 bit per channel
int rawStripChannel(const CSCDetId &id, int geomChannel) const
int channelFromStrip(const CSCDetId &id, int geomStrip) const
feedthrough for external access
CSCConditions theConditions
const std::bitset< 112 > & CSCRecoConditions::badWireWord ( const CSCDetId id) const

Get bad wiregroup word.

Definition at line 151 of file CSCRecoConditions.cc.

References CSCConditions::badWireWord(), and theConditions.

Referenced by CSCHitFromWireOnly::isDeadWG().

151  {
152  return theConditions.badWireWord( id );
153 }
CSCConditions theConditions
const std::bitset< 112 > & badWireWord(const CSCDetId &id) const
float CSCRecoConditions::chamberTimingCorrection ( const CSCDetId id) const

Definition at line 155 of file CSCRecoConditions.cc.

References CSCConditions::chamberTimingCorrection(), and theConditions.

Referenced by CSCMake2DRecHit::hitFromStripAndWire().

155  {
157 }
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 35 of file CSCRecoConditions.cc.

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

Referenced by CSCMake2DRecHit::hitFromStripAndWire().

35  {
36  // geometric strip to geometric channel (e.g. ME1a, 1-48->1-16 ganged or 1-48 unganged)
37  int geomChannel = theConditions.channelFromStrip( id, geomStrip );
38  return theConditions.chipCorrection(id, geomChannel);
39 }
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 109 of file CSCRecoConditions.cc.

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

Referenced by CSCXonStrip_MatchGatti::findXOnStrip().

109  {
110 
111  // xtalks will be filled with crosstalk for geomStrip and its immediate neighbours
112 
113  xtalks.clear();
114 
115  for ( short int i = geomStrip-1; i < geomStrip+2; ++i) {
116  int geomChannel = theConditions.channelFromStrip( id, i );
117  std::vector<float> ct(4);
118  theConditions.crossTalk(id, geomChannel, ct);
119  xtalks.push_back(ct[0]);
120  xtalks.push_back(ct[1]);
121  xtalks.push_back(ct[2]);
122  xtalks.push_back(ct[3]);
123  }
124 }
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
int channelFromStrip(const CSCDetId &id, int geomStrip) const
feedthrough for external access
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 " << theConditions.gain(id, geomChannel);
30  return theConditions.gain(id, geomChannel);
31 }
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 163 of file CSCRecoConditions.cc.

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

Referenced by CSCMake2DRecHit::hitFromStripAndWire().

163  {
164  int geomChannel = theConditions.channelFromStrip( id, geomStrip);
165  return theConditions.gasGainCorrection(id, geomChannel, wiregroup);
166 }
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 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 
) const

Is a neighbour bad?

Is an immediate neighbour a bad strip?

Definition at line 127 of file CSCRecoConditions.cc.

References badStrip().

Referenced by CSCHitFromStripOnly::isNearDeadStrip().

127  {
128  bool nearBad = (badStrip(id,geomStrip-1) || badStrip(id,geomStrip+1));
129  return nearBad;
130 }
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 66 of file CSCRecoConditions.cc.

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

Referenced by CSCXonStrip_MatchGatti::findXOnStrip().

66  {
67 
68  // nMatrix will be filled with expanded noise matrix elements for strip 'geomStrip' and its immediate neighbours
69 
70  nMatrix.clear();
71 
72  // These are ME1/2 constants as fall-back
73  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.};
74 
75  float elem[15];
76 
77  for ( short int i = geomStrip-1; i < geomStrip+2; ++i) {
78 
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) elem[k] = 0.001; // fix if too small...
97  if (elem[k] > 50.) isFlawed = true; // fail if too big...
98  }
99 
100  if ( isFlawed ) {
101  // These are fake ME1/2:
102  for ( short int m = 0; m < 15; ++m ) { elem[m] = fakeme12[m]; }
103  }
104 
105  for (int k = 0; k < 15; ++k) { nMatrix.push_back( elem[k] ); }
106  }
107 }
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) ...
int j
Definition: DBlmapReader.cc:9
int channelFromStrip(const CSCDetId &id, int geomStrip) const
feedthrough for external access
CSCConditions theConditions
float stripWeight(const CSCDetId &id, int geomStrip) const
return gain weight for given strip channel
int k[5][pyjets_maxn]
T w() const
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 19 of file CSCRecoConditions.cc.

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

Referenced by CSCStaticPedestal::pedestal().

19  {
20  LogTrace("CSCRecoConditions") << id << " geomChannel " << geomChannel << " pedestal " << 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.

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 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) w = 1.5;
61  if (w < 0.5) w = 0.5;
62  LogTrace("CSCRecoConditions") << id << " geomStrip " << geomStrip << " stripWeight " << w;
63  return w;
64 }
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)
T w() const
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 46 of file CSCRecoConditions.cc.

References i, and stripWeight().

Referenced by CSCHitFromStripOnly::runStrip().

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

Member Data Documentation

CSCConditions CSCRecoConditions::theConditions
private