#include <RecoLocalMuon/CSCRecHitD/src/CSCRecoConditions.h>
Public Member Functions | |
float | averageGain () const |
return average gain over entire CSC system | |
const std::bitset< 112 > & | badWireWord (const CSCDetId &id) const |
Get bad wiregroup word. | |
void | 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. | |
CSCRecoConditions (const edm::ParameterSet &pset) | |
float | gain (const CSCDetId &id, int channel) const |
channels count from 1 | |
void | initializeEvent (const edm::EventSetup &es) |
fetch the cond data from the database | |
bool | nearBadStrip (const CSCDetId &id, int geomStrip) const |
Is a neighbour bad? | |
void | 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. | |
float | pedestal (const CSCDetId &id, int channel) const |
static pedestal in ADC counts | |
float | pedestalSigma (const CSCDetId &id, int channel) const |
sigma of static pedestal in ADC counts | |
void | stripWeights (const CSCDetId &id, float *weights) const |
calculate gain weights for all strips in a CSC layer
| |
~CSCRecoConditions () | |
Private Member Functions | |
float | stripWeight (const CSCDetId &id, int channel) const |
return gain weight for given strip channel | |
Private Attributes | |
CSCConditions | theConditions |
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).
Definition at line 24 of file CSCRecoConditions.h.
CSCRecoConditions::CSCRecoConditions | ( | const edm::ParameterSet & | pset | ) | [explicit] |
CSCRecoConditions::~CSCRecoConditions | ( | ) |
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().
00039 { 00040 return theConditions.averageGain(); }
const std::bitset< 112 > & CSCRecoConditions::badWireWord | ( | const CSCDetId & | id | ) | const |
Get bad wiregroup word.
Definition at line 262 of file CSCRecoConditions.cc.
References CSCConditions::badWireWord(), and theConditions.
Referenced by CSCHitFromWireOnly::isDeadWG().
00262 { 00263 return theConditions.badWireWord( id ); 00264 }
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 181 of file CSCRecoConditions.cc.
References CSCConditions::crossTalk(), ct, GeomDetEnumerators::endcap, i, and theConditions.
Referenced by CSCXonStrip_MatchGatti::findXOnStrip().
00181 { 00182 00183 xtalks.clear(); 00184 00185 short int strip1 = centralStrip; 00186 short int triplet[3]; 00187 bool isME1a = (id.ring()==4); 00188 CSCDetId id1; 00189 00190 // ME1/a constants are stored in channels 65-80 of ME11, ME1/b in channels 1-64. 00191 // ME1/a channels are ganged - 48 strips to 16 channels. 00192 if ( isME1a ) { // ME1a 00193 00194 strip1 = centralStrip%16; // strip# 1-48 00195 if (strip1 == 0) strip1 = 16; // channel# 1-16 00196 strip1 += 64; // strip1 65-80 00197 id1=CSCDetId( id.endcap(), 1, 1, id.chamber(), id.layer() ); // ME11 detId 00198 00199 if (strip1 == 65) { 00200 triplet[0]=80; 00201 triplet[1]=65; 00202 triplet[2]=66; 00203 } else if (strip1 == 80) { 00204 triplet[0]=79; 00205 triplet[1]=80; 00206 triplet[2]=65; 00207 } else { 00208 triplet[0]=strip1-1; 00209 triplet[1]=strip1; 00210 triplet[2]=strip1+1; 00211 } 00212 } 00213 else { // non-ME1a 00214 triplet[0]=strip1-1; 00215 triplet[1]=strip1; 00216 triplet[2]=strip1+1; 00217 } 00218 00219 // For 3 neighbouring strips get crosstalks 00220 short int idx = 0; 00221 for ( short int i = 0; i < 3; ++i) { 00222 00223 short int channel = triplet[i]; 00224 std::vector<float> ct(4); 00225 00226 if ( isME1a ) { 00227 theConditions.crossTalk(id1, channel, ct); 00228 } 00229 else { 00230 theConditions.crossTalk(id, channel, ct); 00231 } 00232 00233 xtalks.push_back(ct[0]); 00234 xtalks.push_back(ct[1]); 00235 xtalks.push_back(ct[2]); 00236 xtalks.push_back(ct[3]); 00237 ++idx; 00238 } 00239 }
channels count from 1
Definition at line 16 of file CSCRecoConditions.cc.
References CSCConditions::gain(), CSCChannelTranslator::rawCSCDetId(), CSCChannelTranslator::rawStripChannel(), and theConditions.
00016 { 00017 CSCChannelTranslator translate; 00018 CSCDetId idraw = translate.rawCSCDetId( id ); 00019 int iraw = translate.rawStripChannel( id, channel ); 00020 return theConditions.gain(idraw, iraw); 00021 }
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().
00011 { 00012 theConditions.initializeEvent( es ); 00013 }
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 245 of file CSCRecoConditions.cc.
References CSCConditions::badStripWord(), CSCChannelTranslator::channelFromStrip(), CSCChannelTranslator::rawCSCDetId(), CSCChannelTranslator::rawStripChannel(), and theConditions.
Referenced by CSCHitFromStripOnly::isNearDeadStrip().
00245 { 00246 // Note ME1A strip runs 1-48 00247 CSCChannelTranslator translate; 00248 CSCDetId idraw = translate.rawCSCDetId( id ); 00249 int geomChan = translate.channelFromStrip( id, geomStrip ); 00250 int rawChan = translate.rawStripChannel( id, geomChan ); 00251 00252 const std::bitset<80>& badStrips = theConditions.badStripWord(idraw); 00253 00254 bool nearBad = false; 00255 if( rawChan>1 && rawChan<80 ){ // 80 bits max, labelled 0-79. Test 1-78 for neighbours. 00256 nearBad = (badStrips.test(rawChan) || badStrips.test(rawChan-2)); 00257 } 00258 return nearBad; 00259 }
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 GeomDetEnumerators::endcap, i, j, k, me, CSCConditions::noiseMatrixElements(), stripWeight(), theConditions, and w.
Referenced by CSCXonStrip_MatchGatti::findXOnStrip().
00066 { 00067 00068 // nMatrix will be filled with expanded noise matrix elements for 00069 // channel 'centralStrip' and its immediate neighbours 00070 nMatrix.clear(); 00071 00072 // Initialize values in case we can't find chamber with constants 00073 // These are ME1/2 constants... 00074 float elem[15]; 00075 elem[0] = 8.64; 00076 elem[1] = 3.47; 00077 elem[2] = 2.45; 00078 elem[3] = 8.60; 00079 elem[4] = 3.28; 00080 elem[5] = 1.88; 00081 elem[6] = 8.61; 00082 elem[7] = 3.18; 00083 elem[8] = 1.99; 00084 elem[9] = 7.67; 00085 elem[10] = 2.64; 00086 elem[11] = 0.; 00087 elem[12] = 7.71; 00088 elem[13] = 0.; 00089 elem[14] = 0.; 00090 00091 short int strip1 = centralStrip; 00092 short int triplet[3]; 00093 bool isME1a = (id.ring()==4); 00094 CSCDetId id1; 00095 00096 // ME1/a constants are stored in channels 65-80 of ME11, ME1/b in channels 1-64. 00097 // ME1/a channels are ganged - 48 strips to 16 channels. 00098 if ( isME1a ) { // ME1a 00099 00100 strip1 = centralStrip%16; // strip# 1-48 00101 if (strip1 == 0) strip1 = 16; // channel# 1-16 00102 strip1 += 64; // strip1 65-80 00103 id1=CSCDetId( id.endcap(), 1, 1, id.chamber(), id.layer() ); // ME11 detId 00104 00105 if (strip1 == 65) { 00106 triplet[0]=80; 00107 triplet[1]=65; 00108 triplet[2]=66; 00109 } else if (strip1 == 80) { 00110 triplet[0]=79; 00111 triplet[1]=80; 00112 triplet[2]=65; 00113 } else { 00114 triplet[0]=strip1-1; 00115 triplet[1]=strip1; 00116 triplet[2]=strip1+1; 00117 00118 } 00119 } 00120 else { // non-ME1a 00121 triplet[0]=strip1-1; 00122 triplet[1]=strip1; 00123 triplet[2]=strip1+1; 00124 } 00125 00126 for ( short int i = 0; i < 3; ++i) { 00127 00128 short int channel = triplet[i]; 00129 float w; 00130 std::vector<float> me(12); 00131 00132 if ( isME1a ) { 00133 w = stripWeight(id1, channel); 00134 theConditions.noiseMatrixElements(id1, channel, me); 00135 } 00136 else { 00137 w = stripWeight(id, channel); 00138 theConditions.noiseMatrixElements(id, channel, me); 00139 } 00140 w = w*w; 00141 for ( short int j=0; j<11; ++j ) { 00142 elem[j] = me[j] * w; 00143 } 00144 elem[11]= 0.; 00145 elem[12]= me[11] * w; 00146 elem[13]= 0.; 00147 elem[14]= 0.; 00148 00149 // Test that elements make sense: 00150 bool isFlawed = false; 00151 for ( int k = 0; k < 15; ++k) { 00152 // make sure the number isn't too close to zero... 00153 if (elem[k] < 0.001) elem[k] = 0.001; 00154 // make sure the number isn't too big... 00155 if (elem[k] > 50.) isFlawed = true; 00156 } 00157 00158 if ( isFlawed ) { 00159 // These are fake ME1/2: 00160 elem[0] = 8.64; 00161 elem[1] = 3.47; 00162 elem[2] = 2.45; 00163 elem[3] = 8.60; 00164 elem[4] = 3.28; 00165 elem[5] = 1.88; 00166 elem[6] = 8.61; 00167 elem[7] = 3.18; 00168 elem[8] = 1.99; 00169 elem[9] = 7.67; 00170 elem[10] = 2.64; 00171 elem[11] = 0.; 00172 elem[12] = 7.71; 00173 elem[13] = 0.; 00174 elem[14] = 0.; 00175 } 00176 00177 for (int k = 0; k < 15; ++k) nMatrix.push_back( elem[k] ); 00178 } 00179 }
static pedestal in ADC counts
Definition at line 23 of file CSCRecoConditions.cc.
References CSCConditions::pedestal(), CSCChannelTranslator::rawCSCDetId(), CSCChannelTranslator::rawStripChannel(), and theConditions.
00023 { 00024 CSCChannelTranslator translate; 00025 CSCDetId idraw = translate.rawCSCDetId( id ); 00026 int iraw = translate.rawStripChannel( id, channel ); 00027 return theConditions.pedestal(idraw, iraw); 00028 }
sigma of static pedestal in ADC counts
Definition at line 30 of file CSCRecoConditions.cc.
References CSCConditions::pedestalSigma(), CSCChannelTranslator::rawCSCDetId(), CSCChannelTranslator::rawStripChannel(), and theConditions.
00030 { 00031 CSCChannelTranslator translate; 00032 CSCDetId idraw = translate.rawCSCDetId( id ); 00033 int iraw = translate.rawStripChannel( id, channel ); 00034 return theConditions.pedestalSigma(idraw, iraw); 00035 }
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 267 of file CSCRecoConditions.cc.
References averageGain(), CSCConditions::gain(), theConditions, and w.
Referenced by noiseMatrix(), and stripWeights().
00267 { 00268 float w = averageGain() / theConditions.gain(id, channel); 00269 00270 // Weights are forced to lie within 0.5 and 1.5 00271 if (w > 1.5) w = 1.5; 00272 if (w < 0.5) w = 0.5; 00273 return w; 00274 }
calculate gain weights for all strips in a CSC layer
Definition at line 37 of file CSCRecoConditions.cc.
References GeomDetEnumerators::endcap, i, stripWeight(), and w.
Referenced by CSCHitFromStripOnly::runStrip().
00037 { 00038 00039 short int is = id.station(); 00040 short int ir = id.ring(); 00041 00042 short int strip1 = 1; 00043 short int nStrips = 80; 00044 if ( is == 1 && ir == 1) nStrips = 64; // ME1b 00045 if ( is == 1 && ir == 3) nStrips = 64; // ME13 00046 00047 if ( ir == 4 ) { // ME1a 00048 const CSCDetId testId( id.endcap(), 1, 1, id.chamber(), id.layer() ); // create ME11 detId 00049 strip1 = 65; // ME1a channels are 65-80 in ME11 00050 for ( short int i = 0; i < 16; ++i) { 00051 float w = stripWeight(testId, strip1+i); 00052 00053 // Unfold ganged channels in ME1a 00054 weights[i] = w; 00055 weights[i+16] = w; 00056 weights[i+32] = w; 00057 } 00058 } 00059 else { // non-ME1a chambers 00060 for ( short int i = 0; i < nStrips; ++i) { 00061 weights[i] = stripWeight(id, strip1+i); 00062 } 00063 } 00064 }
Definition at line 75 of file CSCRecoConditions.h.
Referenced by averageGain(), badWireWord(), crossTalk(), gain(), initializeEvent(), nearBadStrip(), noiseMatrix(), pedestal(), pedestalSigma(), and stripWeight().