Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:24:39

0001 #ifndef CSCRecRecHitD_CSCRecoConditions_h
0002 #define CSCRecRecHitD_CSCRecoConditions_h
0003 
0004 /**
0005  * \class CSCRecoConditions
0006  *
0007  * Wrap CSCConditions class for use in CSC local reconstruction, in analogy with wrapper classes
0008  * Rick uses in CSCDigitizer.
0009  *
0010  * CSCConditions encapsulates the conditions data (e.g. calibration data) from the database
0011  * and presents it as CSCRecHitD requires (and that is somewhat historical!)
0012  *
0013  * All functions in public interface accept CSCDetId for ME1A (i.e. ring 4) with channel
0014  * number 1-16 (and not the raw ME11 channel 65-80).
0015  *
0016  * \author Tim Cox - UC Davis
0017  */
0018 
0019 #include "FWCore/Framework/interface/Frameworkfwd.h"
0020 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0021 #include "FWCore/Framework/interface/ConsumesCollector.h"
0022 #include "CalibMuon/CSCCalibration/interface/CSCConditions.h"
0023 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
0024 
0025 class CSCRecoConditions {
0026 public:
0027   // Passed a PSet just in case we need to configure in some way
0028   explicit CSCRecoConditions(const edm::ParameterSet& pset, edm::ConsumesCollector);
0029   ~CSCRecoConditions();
0030 
0031   /// fetch the cond data from the database
0032   void initializeEvent(const edm::EventSetup& es);
0033 
0034   /// channels and geomstrips  count from 1
0035 
0036   /// return gain for given strip
0037   float gain(const CSCDetId& id, int geomStrip) const;
0038 
0039   /// return average gain over entire CSC system
0040   float averageGain() const { return theConditions.averageGain(); }
0041 
0042   ///  calculate gain weights for all strips in a CSC layer (total in layer = nstrips)
0043   ///  this is averageGain()/gain for each strip filled into a C-array which caller must have allocated.
0044   ///  values are constrained to be in [0.5, 1.5]
0045   void stripWeights(const CSCDetId& id, short int nstrips, float* weights) const;
0046 
0047   /// static pedestal in ADC counts for strip channel (e.g. 1-16 for ganged ME1a, 1-48 for unganged ME1a)
0048   float pedestal(const CSCDetId& id, int channel) const;
0049 
0050   /// sigma of static pedestal in ADC counts for strip channel (e.g. 1-16 for ganged ME1a, 1-48 for unganged ME1a)
0051   float pedestalSigma(const CSCDetId& id, int channel) const;
0052 
0053   /// fill expanded noise matrix for 3 neighbouring strips as linear vector (must be allocated by caller)
0054   /// Note that centralStrip is a 'geomStrip' and ranges 1-48 in ME1a.
0055   void noiseMatrix(const CSCDetId& id, int centralStrip, std::vector<float>& nme) const;
0056 
0057   /// fill crosstalk information for 3 neighbouring strips as linear vector (must be allocated by caller)
0058   /// Note that centralStrip is a 'geomStrip' and e.g. always ranges 1-48 in ME1a.
0059   void crossTalk(const CSCDetId& id, int centralStrip, std::vector<float>& xtalks) const;
0060 
0061   // returns chip speed correction in ns given strio channel
0062   float chipCorrection(const CSCDetId& detId, int channel) const;
0063 
0064   // returns chamber level timing correction (cable length and extra chamber correction) in ns
0065   float chamberTimingCorrection(const CSCDetId& id) const;
0066 
0067   // returns anode bx off for each chamber, used to correct anode times to 0 for collision muons
0068   float anodeBXoffset(const CSCDetId& detId) const;
0069 
0070   /// returns gas-gain correction
0071   float gasGainCorrection(const CSCDetId& id, int strip, int wireGroup) const;
0072 
0073   /// fill bad strip & bad wiregroup bitsets from conditions data
0074   void fillBadChannelWords(const CSCDetId& id);
0075 
0076   /// Is a neighbour bad?
0077   bool nearBadStrip(const CSCDetId& id, int geomStrip, int nstrips) const;
0078 
0079   /// Is the strip bad?
0080   bool badStrip(const CSCDetId& id, int geomStrip, int nstrips) const;
0081 
0082   /// Get bad wiregroup word
0083   const std::bitset<112>& badWireWord(const CSCDetId& id) const;
0084 
0085 private:
0086   /// return gain weight for given strip channel
0087 
0088   float stripWeight(const CSCDetId& id, int geomStrip) const;
0089 
0090   CSCConditions theConditions;
0091 };
0092 
0093 #endif