Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef CSCRecHitD_CSCXonStrip_MatchGatti_h
0002 #define CSCRecHitD_CSCXonStrip_MatchGatti_h
0003 //---- Large part taken from RecHitB
0004 
0005 /** \class CSCXonStrip_MatchGatti
0006  *
0007  * When having both strip and wire hit in a layer, use Gatti "matching" to
0008  * calculate position ond error of strip hit.  
0009  *
0010  * \author Stoyan Stoynev - NU 
0011  *
0012  */
0013 
0014 #include <RecoLocalMuon/CSCRecHitD/src/CSCStripHit.h>
0015 #include <RecoLocalMuon/CSCRecHitD/src/CSCRecoConditions.h>
0016 #include <FWCore/ParameterSet/interface/ParameterSet.h>
0017 
0018 #include <map>
0019 #include <vector>
0020 
0021 class CSCLayer;
0022 class CSCChamberSpecs;
0023 
0024 class CSCXonStrip_MatchGatti {
0025 public:
0026   explicit CSCXonStrip_MatchGatti(const edm::ParameterSet& ps);
0027 
0028   ~CSCXonStrip_MatchGatti();
0029 
0030   // Member functions
0031 
0032   /// Returns fitted local x position and its estimated error.
0033   void findXOnStrip(const CSCDetId& id,
0034                     const CSCLayer* layer,
0035                     const CSCStripHit& stripHit,
0036                     int centralStrip,
0037                     float& xWithinChamber,
0038                     float& stripWidth,
0039                     const float& tpeak,
0040                     float& xWithinStrip,
0041                     float& sigma,
0042                     int& quality_flag);
0043 
0044   /// Use specs to setup Gatti parameters
0045   void initChamberSpecs();
0046 
0047   /// Set matrix for XT corrections and noise
0048   void setupMatrix();
0049 
0050   /// Cache pointer to conditions data
0051   void setConditions(const CSCRecoConditions* reco) { recoConditions_ = reco; }
0052 
0053 private:
0054   // No copying of this class
0055   CSCXonStrip_MatchGatti(const CSCXonStrip_MatchGatti&);
0056   CSCXonStrip_MatchGatti& operator=(const CSCXonStrip_MatchGatti&);
0057 
0058   double h;  // This is the distance between strip and wire planes
0059   float stripWidth;
0060   double r;  // This is the ratio h/stripwidth
0061 
0062   double k_1, k_2, k_3, sqrt_k_3, norm;  // See equation above for description
0063 
0064   // The charge (3x3); [1][1] is the maximum
0065   float chargeSignal[3][3];  // 3x3 data array for gatti fit
0066 
0067   /// x-talks  0 = left, 1 = middle, 2 = right ; and then second [] is for time bin tmax-1, tmax, tmax+1
0068   float xt_l[3][3], xt_r[3][3];
0069   float xt_lr0[3], xt_lr1[3], xt_lr2[3];
0070 
0071   /// Store elements of matrices for chi^2 computation: 0 = left, 1 = middle, 2 = right
0072   float v11[3], v12[3], v13[3], v22[3], v23[3], v33[3];
0073 
0074   /// Store elements of auto-correlation matrices:      0 = left, 1 = middle, 2 = right
0075   float a11[3], a12[3], a13[3], a22[3], a23[3], a33[3];
0076 
0077   // Store chamber specs
0078   const CSCChamberSpecs* specs_;
0079 
0080   // Store XT-corrected charges - 3x3 sum; Left, Central, Right charges (3 time-bins summed)
0081 
0082   double q_sum, q_sumL, q_sumC, q_sumR;
0083 
0084   // Parameter settings from config file
0085   bool useCalib;
0086   bool use3TimeBins;
0087   float xtalksOffset;
0088 
0089   // Cache pointer to conditions for current event
0090   const CSCRecoConditions* recoConditions_;
0091 
0092   // some variables and functions to use
0093 
0094   // "Match Gatti" calculations
0095   double calculateXonStripError(float stripWidth, bool ME1_1);
0096   double calculateXonStripPosition(float stripWidth, bool ME1_1);
0097   double xfError_Noise(double noise);
0098   double xfError_XTasym(double XTasym);
0099 
0100   double estimated2Gatti(double Xestimated, float StripWidth, bool ME1_1);
0101   double estimated2GattiCorrection(double Xestimated, float StripWidth, bool ME1_1);
0102 
0103   void getCorrectionValues(std::string Estimator);
0104   void hardcodedCorrectionInitialization();
0105 
0106   static const int n_SW_noME1_1 = 11;
0107   static const int n_SW_ME1_1 = 6;
0108   static const int n_val = 501;
0109   //std::vector <std::vector <float> > Xcorrection(N_SW, std::vector <float> (N_val));
0110   float x_correction_noME1_1[n_SW_noME1_1][n_val];
0111   float x_correction_ME1_1[n_SW_ME1_1][n_val];
0112   float x_centralVal[n_val];
0113 
0114   float noise_level;
0115   float xt_asymmetry;
0116   float const_syst;
0117 
0118   float noise_level_ME1a;
0119   float xt_asymmetry_ME1a;
0120   float const_syst_ME1a;
0121   float noise_level_ME1b;
0122   float xt_asymmetry_ME1b;
0123   float const_syst_ME1b;
0124   float noise_level_ME12;
0125   float xt_asymmetry_ME12;
0126   float const_syst_ME12;
0127   float noise_level_ME13;
0128   float xt_asymmetry_ME13;
0129   float const_syst_ME13;
0130   float noise_level_ME21;
0131   float xt_asymmetry_ME21;
0132   float const_syst_ME21;
0133   float noise_level_ME22;
0134   float xt_asymmetry_ME22;
0135   float const_syst_ME22;
0136   float noise_level_ME31;
0137   float xt_asymmetry_ME31;
0138   float const_syst_ME31;
0139   float noise_level_ME32;
0140   float xt_asymmetry_ME32;
0141   float const_syst_ME32;
0142   float noise_level_ME41;
0143   float xt_asymmetry_ME41;
0144   float const_syst_ME41;
0145 };
0146 
0147 #endif