CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

CSCRecoConditions Class Reference

#include <CSCRecoConditions.h>

List of all members.

Public Member Functions

float anodeBXoffset (const CSCDetId &detId) const
float averageGain () const
 return average gain over entire CSC system
bool badStrip (const CSCDetId &id, int geomStrip) const
 Is the strip bad?
const std::bitset< 112 > & badWireWord (const CSCDetId &id) const
 Get bad wiregroup word.
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
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
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
 ~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.

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

Definition at line 8 of file CSCRecoConditions.cc.

                                      {
}

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().

                                                                { 
  CSCChannelTranslator translate;
  // If ME1/4, set ring = 1
  CSCDetId idraw = translate.rawCSCDetId( id );
  return theConditions.anodeBXoffset(idraw);
}
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().

                            { 
     return theConditions.averageGain(); }
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().

                                                                          {
  // Note ME1A strip runs 1-48 
  bool aBadS = false;
  if(geomStrip>0 && geomStrip<81){ 
    CSCChannelTranslator translate;
    CSCDetId idraw = translate.rawCSCDetId( id );
    int geomChan = translate.channelFromStrip( id, geomStrip ); 
    int rawChan = translate.rawStripChannel( id, geomChan ); 

    const std::bitset<80>& badStrips = theConditions.badStripWord(idraw);

    if( rawChan>0 && rawChan<81 ){ // 80 bits max, labelled 0-79. Test 0-79 (i.e. any - that's the idea)
      aBadS = badStrips.test(rawChan-1);
    }
  }
  return aBadS;
}
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().

                                                                               {
    return theConditions.badWireWord( id );
}
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().

                                                                          { 
  CSCChannelTranslator translate;
  // If ME1/4, set ring = 1
  CSCDetId idraw = translate.rawCSCDetId( id );
  return theConditions.chamberTimingCorrection(idraw);
}
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().

                                                                                { 
  //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);
  CSCChannelTranslator translate;
  // If ME1/4, set ring = 1
  CSCDetId idraw = translate.rawCSCDetId( id );
  // If ME1/4, collapse 48 chips into 16 electronics channel (1-48) -> (1-16)
  int geomChannel = translate.channelFromStrip( id, geomStrip );
  // Translate geometry-oriented strip channels into raw channels 
  // reordering ME+1/1a and ME-1/1b and moving ME1/1a (1-16)->(65-80)
  int iraw = translate.rawStripChannel( id, geomChannel);
  //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);
  return theConditions.chipCorrection(idraw, iraw);
}
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().

                                                                                                       {

  xtalks.clear();

  short int strip1 = centralStrip;
  short int triplet[3];
  bool isME1a = (id.ring()==4);
  CSCDetId id1;

  // ME1/a constants are stored in channels 65-80 of ME11, ME1/b in channels 1-64.
  // ME1/a channels are ganged - 48 strips to 16 channels.
  if ( isME1a ) { // ME1a

    strip1 = centralStrip%16;     // strip#   1-48
    if (strip1 == 0) strip1 = 16; // channel# 1-16
    strip1 += 64;                 // strip1   65-80
    id1=CSCDetId( id.endcap(), 1, 1, id.chamber(), id.layer() ); // ME11 detId
    
    if (strip1 == 65) {
      triplet[0]=80;
      triplet[1]=65;
      triplet[2]=66;
    } else if (strip1 == 80) {
      triplet[0]=79;
      triplet[1]=80;
      triplet[2]=65;
    } else {
      triplet[0]=strip1-1;
      triplet[1]=strip1;
      triplet[2]=strip1+1;
    }
  } 
  else { // non-ME1a
      triplet[0]=strip1-1;
      triplet[1]=strip1;
      triplet[2]=strip1+1;
  }

  // For 3 neighbouring strips get crosstalks
  short int idx = 0;
  for ( short int i = 0; i < 3; ++i) {
  
    short int channel = triplet[i];
    std::vector<float> ct(4);

    if ( isME1a ) {
      theConditions.crossTalk(id1, channel, ct);
    }
    else {
      theConditions.crossTalk(id, channel, ct);
    }

    xtalks.push_back(ct[0]);
    xtalks.push_back(ct[1]);
    xtalks.push_back(ct[2]);
    xtalks.push_back(ct[3]);
    ++idx;
  }
}
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.

                                                                    { 
  CSCChannelTranslator translate;
  CSCDetId idraw = translate.rawCSCDetId( id );
  int iraw = translate.rawStripChannel( id, channel );
  return theConditions.gain(idraw, iraw);
}
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().

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().

                                                                              {
  // Note ME1A strip runs 1-48 
  /*
  CSCChannelTranslator translate;
  CSCDetId idraw = translate.rawCSCDetId( id );
  int geomChan = translate.channelFromStrip( id, geomStrip ); 
  int rawChan = translate.rawStripChannel( id, geomChan ); 

  const std::bitset<80>& badStrips = theConditions.badStripWord(idraw);

  bool nearBad = false;
  if( rawChan>1 && rawChan<80 ){ // 80 bits max, labelled 0-79. Test 1-78 for neighbours.
    nearBad = (badStrips.test(rawChan) || badStrips.test(rawChan-2));
  }
  */
  //
  bool nearBad = (badStrip(id,geomStrip-1) || badStrip(id,geomStrip+1));


  return nearBad;
}
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, Reference_intrackfit_cff::endcap, i, j, gen::k, CSCConditions::noiseMatrixElements(), stripWeight(), and theConditions.

Referenced by CSCXonStrip_MatchGatti::findXOnStrip().

                                                                                                           {

  // nMatrix will be filled with expanded noise matrix elements for 
  // channel 'centralStrip' and its immediate neighbours
  nMatrix.clear();

  // Initialize values in case we can't find chamber with constants
  // These are ME1/2 constants...
  float elem[15];
  elem[0] = 8.64;
  elem[1] = 3.47;
  elem[2] = 2.45;
  elem[3] = 8.60;
  elem[4] = 3.28;
  elem[5] = 1.88;
  elem[6] = 8.61;
  elem[7] = 3.18;
  elem[8] = 1.99;
  elem[9] = 7.67;
  elem[10] = 2.64;
  elem[11] = 0.;
  elem[12] = 7.71;
  elem[13] = 0.;
  elem[14] = 0.;

  short int strip1 = centralStrip;
  short int triplet[3];
  bool isME1a = (id.ring()==4);
  CSCDetId id1;

  // ME1/a constants are stored in channels 65-80 of ME11, ME1/b in channels 1-64.
  // ME1/a channels are ganged - 48 strips to 16 channels.
  if ( isME1a ) { // ME1a

    strip1 = centralStrip%16;     // strip#   1-48
    if (strip1 == 0) strip1 = 16; // channel# 1-16
    strip1 += 64;                 // strip1   65-80
    id1=CSCDetId( id.endcap(), 1, 1, id.chamber(), id.layer() ); // ME11 detId
    
    if (strip1 == 65) {
      triplet[0]=80;
      triplet[1]=65;
      triplet[2]=66;
    } else if (strip1 == 80) {
      triplet[0]=79;
      triplet[1]=80;
      triplet[2]=65;
    } else {
      triplet[0]=strip1-1;
      triplet[1]=strip1;
      triplet[2]=strip1+1;

    }
  } 
  else { // non-ME1a
      triplet[0]=strip1-1;
      triplet[1]=strip1;
      triplet[2]=strip1+1;
  }

  for ( short int i = 0; i < 3; ++i) {
  
    short int channel = triplet[i];
    float w;
    std::vector<float> me(12);

    if ( isME1a ) {
      w = stripWeight(id1, channel);
      theConditions.noiseMatrixElements(id1, channel, me);
    }
    else {
      w = stripWeight(id, channel);
      theConditions.noiseMatrixElements(id, channel, me);
    }
    w = w*w;
    for ( short int j=0; j<11; ++j ) {
      elem[j] = me[j] * w;     
    }
    elem[11]= 0.; 
    elem[12]= me[11] * w;
    elem[13]= 0.;
    elem[14]= 0.;
      
    // Test that elements make sense:
    bool isFlawed = false;      
    for ( int k = 0; k < 15; ++k) {
      // make sure the number isn't too close to zero...
      if (elem[k] < 0.001) elem[k] = 0.001;
      // make sure the number isn't too big...
      if (elem[k] > 50.) isFlawed = true; 
    }

    if ( isFlawed ) {
      // These are fake ME1/2:
      elem[0] = 8.64;
      elem[1] = 3.47;
      elem[2] = 2.45;
      elem[3] = 8.60;
      elem[4] = 3.28;
      elem[5] = 1.88;
      elem[6] = 8.61;
      elem[7] = 3.18;
      elem[8] = 1.99;
      elem[9] = 7.67;
      elem[10] = 2.64;
      elem[11] = 0.;
      elem[12] = 7.71;
      elem[13] = 0.;
      elem[14] = 0.;
    }

    for (int k = 0; k < 15; ++k) nMatrix.push_back( elem[k] );
  }
}
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().

                                                                        { 
  CSCChannelTranslator translate;
  CSCDetId idraw = translate.rawCSCDetId( id );
  int iraw = translate.rawStripChannel( id, channel );
  return theConditions.pedestal(idraw, iraw);
}
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.

                                                                             { 
  CSCChannelTranslator translate;
  CSCDetId idraw = translate.rawCSCDetId( id );
  int iraw = translate.rawStripChannel( id, channel );
  return theConditions.pedestalSigma(idraw, iraw);
}
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(), and theConditions.

Referenced by noiseMatrix(), and stripWeights().

                                                                            {
   float w = averageGain() / theConditions.gain(id, channel);
  
   // Weights are forced to lie within 0.5 and 1.5
   if (w > 1.5) w = 1.5;
   if (w < 0.5) w = 0.5;
   return w;
}
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, and stripWeight().

Referenced by CSCHitFromStripOnly::runStrip().

                                                                               {

  short int is = id.station();
  short int ir = id.ring();

  short int strip1 = 1;
  short int nStrips = 80;
  if ( is == 1 && ir == 1) nStrips = 64; // ME1b
  if ( is == 1 && ir == 3) nStrips = 64; // ME13

  if ( ir == 4 ) { // ME1a
    const CSCDetId testId( id.endcap(), 1, 1, id.chamber(), id.layer() ); // create ME11 detId
    strip1 = 65; // ME1a channels are 65-80 in ME11
    for ( short int i = 0; i < 16; ++i) {
      float w = stripWeight(testId, strip1+i);

      // Unfold ganged channels in ME1a
      weights[i]    = w;
      weights[i+16] = w;
      weights[i+32] = w;
    }
  } 
  else { // non-ME1a chambers
    for ( short int i = 0; i < nStrips; ++i) {
      weights[i] = stripWeight(id, strip1+i);
    }
  }
}

Member Data Documentation