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 &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)
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
float gasGainCorrection (const CSCDetId &id, int strip, int wireGroup) const
 returns gas-gain correction
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 for strip channel (e.g. 1-16 for ganged ME1a, 1-48 for unganged ME1a)
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)
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

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.

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

Definition at line 9 of file CSCRecoConditions.cc.

                                      {
}

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

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

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

                                                                          {
  //@@ NOT YET UPDATED FOR UNGANGED ME11A

  bool aBadS = false;
  if(geomStrip>0 && geomStrip<81){
    int geomChan = theConditions.channelFromStrip( id, geomStrip );
    const std::bitset<80>& badStrips = theConditions.badStripWord(id);

    int rawChan = theConditions.rawStripChannel( id, geomChan );
    if( rawChan>0 && rawChan<81 ){
      aBadS = badStrips.test(rawChan-1); // 80 bits max, labelled 0-79.

    }
  }
  return aBadS;
}
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().

                                                                               {
    return theConditions.badWireWord( id );
}
float CSCRecoConditions::chamberTimingCorrection ( const CSCDetId id) const
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().

                                                                                {
  // geometric strip to geometric channel (e.g. ME1a, 1-48->1-16 ganged or 1-48 unganged)
  int geomChannel = theConditions.channelFromStrip( id, geomStrip );
  return theConditions.chipCorrection(id, geomChannel);
}
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().

                                                                                                    {

  // xtalks will be filled with crosstalk for geomStrip and its immediate neighbours

  xtalks.clear();

  for ( short int i = geomStrip-1; i < geomStrip+2; ++i) {
    int geomChannel = theConditions.channelFromStrip( id, i );
    std::vector<float> ct(4);
    theConditions.crossTalk(id, geomChannel, ct);
    xtalks.push_back(ct[0]);
    xtalks.push_back(ct[1]);
    xtalks.push_back(ct[2]);
    xtalks.push_back(ct[3]);
  }
}
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().

                                                                       {
  LogTrace("CSCRecoConditions") << id << " geomChannel " <<  geomChannel << " gain " << theConditions.gain(id, geomChannel);
  return theConditions.gain(id, geomChannel);
}
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().

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

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

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

                                                                                                        {

  // nMatrix will be filled with expanded noise matrix elements for strip 'geomStrip' and its immediate neighbours

  nMatrix.clear();

  // These are ME1/2 constants as fall-back
  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.};

  float elem[15];

  for ( short int i = geomStrip-1; i < geomStrip+2; ++i) {

    std::vector<float> me(12);

    float w = stripWeight(id, i);
    w = w*w;
    int geomChannel = theConditions.channelFromStrip( id, i );
    theConditions.noiseMatrixElements(id, geomChannel, me);
    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 ( short int k = 0; k < 15; ++k) {
      if (elem[k] < 0.001) elem[k] = 0.001; // fix if too small...
      if (elem[k] > 50.) isFlawed = true; // fail if too big...
    }

    if ( isFlawed ) {
      // These are fake ME1/2:
      for ( short int m = 0; m < 15; ++m ) { elem[m] = fakeme12[m]; }
    }

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

                                                                           {
  LogTrace("CSCRecoConditions") << id << " geomChannel " << geomChannel << " pedestal " << theConditions.pedestal(id, geomChannel);
  return theConditions.pedestal(id, geomChannel);
}
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.

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

                                                                              {
   int geomChannel = theConditions.channelFromStrip( id, geomStrip );
   float w = averageGain() / gain(id, geomChannel); // averageGain() from CSCConditions
   // 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;
   LogTrace("CSCRecoConditions") << id << " geomStrip " << geomStrip << " stripWeight " << w;
   return w;
}
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().

                                                                                                  {

  for ( short int i = 1; i < nstrips+1; ++i) {
      weights[i-1] = stripWeight(id, i) ;
  }
}

Member Data Documentation