Go to the documentation of this file.00001 #ifndef RecoLocalTracker_SiPixelRecHits_PixelCPEBase_H
00002 #define RecoLocalTracker_SiPixelRecHits_PixelCPEBase_H 1
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <utility>
00015 #include <vector>
00016 #include "TMath.h"
00017
00018 #include "RecoLocalTracker/ClusterParameterEstimator/interface/PixelClusterParameterEstimator.h"
00019 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitQuality.h"
00020
00021 #include "Geometry/CommonDetUnit/interface/GeomDetType.h"
00022 #include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h"
00023 #include "Geometry/CommonTopologies/interface/PixelTopology.h"
00024 #include "Geometry/CommonTopologies/interface/Topology.h"
00025
00026
00027 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00028
00029
00030 #include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementPoint.h"
00031 #include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementError.h"
00032 #include "DataFormats/GeometrySurface/interface/GloballyPositioned.h"
00033
00034 #include "CondFormats/SiPixelObjects/interface/SiPixelLorentzAngle.h"
00035 #include "CondFormats/SiPixelObjects/interface/SiPixelCPEGenericErrorParm.h"
00036 #include "CondFormats/SiPixelObjects/interface/SiPixelTemplateDBObject.h"
00037
00038
00039
00040 #include <unordered_map>
00041
00042 #include <iostream>
00043
00044
00045 class RectangularPixelTopology;
00046 class MagneticField;
00047 class PixelCPEBase : public PixelClusterParameterEstimator
00048 {
00049 public:
00050 struct Param
00051 {
00052 Param() : bz(-9e10f) {}
00053 float bz;
00054 LocalVector drift;
00055 };
00056
00057 public:
00058 PixelCPEBase(edm::ParameterSet const& conf, const MagneticField * mag = 0,
00059 const SiPixelLorentzAngle * lorentzAngle = 0, const SiPixelCPEGenericErrorParm * genErrorParm = 0,
00060 const SiPixelTemplateDBObject * templateDBobject = 0);
00061
00062
00063
00064
00065
00066 inline LocalValues localParameters( const SiPixelCluster & cl,
00067 const GeomDetUnit & det ) const
00068 {
00069 nRecHitsTotal_++ ;
00070 setTheDet( det, cl );
00071 computeAnglesFromDetPosition(cl, det);
00072
00073
00074 LocalPoint lp = localPosition( cl, det );
00075 LocalError le = localError( cl, det );
00076
00077 return std::make_pair( lp, le );
00078 }
00079
00080
00081
00082
00083 LocalValues localParameters( const SiPixelCluster & cl,
00084 const GeomDetUnit & det,
00085 const LocalTrajectoryParameters & ltp) const
00086 {
00087 nRecHitsTotal_++ ;
00088 setTheDet( det, cl );
00089 computeAnglesFromTrajectory(cl, det, ltp);
00090
00091
00092 LocalPoint lp = localPosition( cl, det );
00093 LocalError le = localError( cl, det );
00094
00095 return std::make_pair( lp, le );
00096 }
00097
00098
00099
00100
00101 LocalValues localParameters( const SiPixelCluster & cl,
00102 const GeomDetUnit & det,
00103 float alpha, float beta) const
00104 {
00105 nRecHitsTotal_++ ;
00106 alpha_ = alpha;
00107 beta_ = beta;
00108 double HalfPi = 0.5*TMath::Pi();
00109 cotalpha_ = tan(HalfPi - alpha_);
00110 cotbeta_ = tan(HalfPi - beta_ );
00111 setTheDet( det, cl );
00112
00113
00114 LocalPoint lp = localPosition( cl, det );
00115 LocalError le = localError( cl, det );
00116
00117 return std::make_pair( lp, le );
00118 }
00119
00120
00121 void computeAnglesFromDetPosition(const SiPixelCluster & cl,
00122 const GeomDetUnit & det ) const;
00123
00124
00125
00126
00127 inline void setMagField(const MagneticField *mag) const { magfield_ = mag; }
00128
00129
00130
00131
00132 virtual LocalPoint localPosition(const SiPixelCluster& cl, const GeomDetUnit & det) const;
00133 virtual LocalError localError (const SiPixelCluster& cl, const GeomDetUnit & det) const = 0;
00134
00135
00136
00137
00138
00139 inline float probabilityX() const { return probabilityX_ ; }
00140 inline float probabilityY() const { return probabilityY_ ; }
00141 inline float probabilityXY() const {
00142 if ( probabilityX_ !=0 && probabilityY_ !=0 )
00143 {
00144 return probabilityX_ * probabilityY_ * (1.f - std::log(probabilityX_ * probabilityY_) ) ;
00145 }
00146 else
00147 return 0;
00148 }
00149
00150 inline float probabilityQ() const { return probabilityQ_ ; }
00151 inline float qBin() const { return qBin_ ; }
00152 inline bool isOnEdge() const { return isOnEdge_ ; }
00153 inline bool hasBadPixels() const { return hasBadPixels_ ; }
00154 inline bool spansTwoRocks() const { return spansTwoROCs_ ; }
00155 inline bool hasFilledProb() const { return hasFilledProb_ ; }
00156
00157
00158
00159
00160 inline unsigned int clusterProbComputationFlag() const
00161 {
00162 return clusterProbComputationFlag_ ;
00163 }
00164
00165
00166
00171
00172 SiPixelRecHitQuality::QualWordType rawQualityWord() const;
00173
00174
00175 protected:
00176
00177
00178
00179 typedef GloballyPositioned<double> Frame;
00180
00181
00182
00183
00184
00185 mutable const PixelGeomDetUnit * theDet;
00186
00187
00188
00189 mutable const PixelTopology * theTopol;
00190 mutable const RectangularPixelTopology * theRecTopol;
00191
00192 mutable Param const * theParam;
00193
00194 mutable GeomDetType::SubDetector thePart;
00195
00196 mutable float theThickness;
00197 mutable float thePitchX;
00198 mutable float thePitchY;
00199
00200
00201 mutable float theNumOfRow;
00202 mutable float theNumOfCol;
00203 mutable float theDetZ;
00204 mutable float theDetR;
00205 mutable float theLShiftX;
00206 mutable float theLShiftY;
00207 mutable float theSign;
00208
00209
00210 mutable float alpha_;
00211 mutable float beta_;
00212
00213
00214 mutable float cotalpha_;
00215 mutable float cotbeta_;
00216
00217
00218 mutable float trk_lp_x;
00219 mutable float trk_lp_y;
00220
00221
00222 mutable int nRecHitsTotal_ ;
00223 mutable int nRecHitsUsedEdge_ ;
00224
00225
00226 mutable bool with_track_angle;
00227
00228
00229 mutable float probabilityX_ ;
00230 mutable float probabilityY_ ;
00231 mutable float probabilityQ_ ;
00232 mutable float qBin_ ;
00233 mutable bool isOnEdge_ ;
00234 mutable bool hasBadPixels_ ;
00235 mutable bool spansTwoROCs_ ;
00236 mutable bool hasFilledProb_ ;
00237
00238
00239
00240
00241
00242
00243
00244 unsigned int clusterProbComputationFlag_ ;
00245
00246
00247
00248
00249
00250
00251
00252 mutable LocalVector driftDirection_;
00253 mutable double lorentzShiftX_;
00254 mutable double lorentzShiftY_;
00255 mutable double lorentzShiftInCmX_;
00256 mutable double lorentzShiftInCmY_;
00257
00258
00259
00260
00261 int theVerboseLevel;
00262
00263 mutable const MagneticField * magfield_;
00264
00265 mutable const SiPixelLorentzAngle * lorentzAngle_;
00266
00267 mutable const SiPixelCPEGenericErrorParm * genErrorParm_;
00268
00269 mutable const SiPixelTemplateDBObject * templateDBobject_;
00270
00271 bool alpha2Order;
00272
00273
00274
00275
00276 mutable Topology::LocalTrackPred loc_trk_pred_;
00277
00278 mutable LocalTrajectoryParameters loc_traj_param_;
00279
00280
00281
00282
00283 void setTheDet( const GeomDetUnit & det, const SiPixelCluster & cluster ) const ;
00284
00285 MeasurementPoint measurementPosition( const SiPixelCluster& cluster,
00286 const GeomDetUnit & det) const;
00287 MeasurementError measurementError ( const SiPixelCluster&,
00288 const GeomDetUnit & det) const ;
00289
00290
00291
00292
00293
00294 void computeAnglesFromTrajectory (const SiPixelCluster & cl,
00295 const GeomDetUnit & det,
00296 const LocalTrajectoryParameters & ltp) const;
00297 LocalVector driftDirection ( GlobalVector bfield ) const ;
00298 LocalVector driftDirection ( LocalVector bfield ) const ;
00299 LocalVector driftDirectionCorrect( GlobalVector bfield ) const ;
00300 void computeLorentzShifts() const ;
00301
00302 bool isFlipped() const;
00303
00304
00305
00306
00307
00308
00309
00310
00311 float lorentzShiftX() const;
00312 float lorentzShiftY() const;
00313
00314
00315 virtual float xpos( const SiPixelCluster& ) const = 0;
00316 virtual float ypos( const SiPixelCluster& ) const = 0;
00317
00318
00319 LocalVector const & getDrift() const {return driftDirection_ ;}
00320
00321
00322
00323 Param const & param() const;
00324
00325 private:
00326 typedef std::unordered_map< unsigned int, Param> Params;
00327
00328 mutable Params m_Params;
00329
00330
00331
00332 };
00333
00334 #endif
00335
00336