CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/CalibTracker/SiPixelErrorEstimation/interface/SiPixelErrorEstimation.h

Go to the documentation of this file.
00001 
00002 #ifndef CalibTracker_SiPixelerrorEstimation_SiPixelErrorEstimation_h
00003 #define CalibTracker_SiPixelerrorEstimation_SiPixelErrorEstimation_h
00004 
00005 #include <memory>
00006 
00007 // user include files
00008 #include "FWCore/Framework/interface/Frameworkfwd.h"
00009 #include "FWCore/Framework/interface/EDAnalyzer.h"
00010 #include "FWCore/Framework/interface/Event.h"
00011 #include "FWCore/Framework/interface/MakerMacros.h"
00012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00013 #include "FWCore/Framework/interface/EventSetup.h"
00014 #include "FWCore/Framework/interface/ESHandle.h"
00015 #include "FWCore/Framework/interface/MakerMacros.h"
00016 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00017 
00018 #include "DataFormats/Common/interface/Handle.h"
00019 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00020 #include "DataFormats/Common/interface/EDProduct.h"
00021 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
00022 #include "DataFormats/TrajectorySeed/interface/TrajectorySeed.h"
00023 
00024 #include "TrackingTools/MaterialEffects/interface/PropagatorWithMaterial.h"
00025 #include "TrackingTools/KalmanUpdators/interface/KFUpdator.h"
00026 #include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimator.h"
00027 #include "TrackingTools/TrackFitters/interface/KFTrajectoryFitter.h"
00028 #include "TrackingTools/TrackFitters/interface/KFTrajectorySmoother.h"
00029 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
00030 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00031 
00032 #include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h" 
00033 
00034 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00035 
00036 //--- for SimHit association
00037 #include "SimDataFormats/TrackingHit/interface/PSimHit.h"  
00038 #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" 
00039 
00040 #include "Geometry/CommonTopologies/interface/PixelTopology.h"
00041 #include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h"
00042 #include "Geometry/CommonDetUnit/interface/GeomDetType.h" 
00043 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h" 
00044 #include "Geometry/TrackerGeometryBuilder/interface/GluedGeomDet.h"
00045 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00046 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00047 #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h"
00048 #include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetType.h"
00049 
00050 #include <string>
00051 
00052 #include <TROOT.h>
00053 #include <TTree.h>
00054 #include <TFile.h>
00055 #include <TH1F.h>
00056 #include <TProfile.h>
00057 
00058 class TTree;
00059 class TFile; 
00060 
00061 class SiPixelErrorEstimation : public edm::EDAnalyzer 
00062 {
00063  public:
00064   
00065   explicit SiPixelErrorEstimation(const edm::ParameterSet&);
00066   virtual ~SiPixelErrorEstimation();
00067     
00068   virtual void beginJob() ;
00069   virtual void analyze(const edm::Event&, const edm::EventSetup&);
00070   virtual void endJob() ;
00071 
00072   void computeAnglesFromDetPosition( const SiPixelCluster & cl, 
00073                                      const GeomDetUnit    & det, 
00074                                      float& alpha, float& beta );
00075     
00076  private: 
00077   
00078   edm::ParameterSet conf_;
00079   std::string outputFile_;
00080   std::string src_;
00081   bool checkType_; // do we check that the simHit associated with recHit is of the expected particle type ?
00082   int genType_; // the type of particle that the simHit associated with recHits should be
00083   bool include_trk_hits_; // if set to false, take only hits directly from detector modules (don't ntuplize hits from tracks)
00084 
00085   // variables that go in the output ttree_track_hits_
00086   float rechitx; // x position of hit 
00087   float rechity; // y position of hit
00088   float rechitz; // z position of hit
00089   float rechiterrx; // x position error of hit (error not squared)
00090   float rechiterry; // y position error of hit (error not squared)
00091   float rechitresx; // difference between reconstructed hit x position and 'true' x position
00092   float rechitresy; // difference between reconstructed hit y position and 'true' y position
00093   float rechitpullx; // x residual divideded by error
00094   float rechitpully; // y residual divideded by error
00095 
00096   int npix; // number of pixel in the cluster
00097   int nxpix; // size of cluster (number of pixels) along x direction
00098   int nypix; // size of cluster (number of pixels) along y direction
00099   float charge; // total charge in cluster
00100 
00101   int edgex; // edgex = 1 if the cluster is at the x edge of the module  
00102   int edgey; // edgey = 1 if the cluster is at the y edge of the module 
00103 
00104   int bigx; // bigx = 1 if the cluster contains at least one big pixel in x
00105   int bigy; // bigy = 1 if the cluster contains at least one big pixel in y
00106 
00107   float alpha; // track angle in the xz plane of the module local coordinate system  
00108   float beta;  // track angle in the yz plane of the module local coordinate system  
00109 
00110   float trk_alpha; // reconstructed track angle in the xz plane of the module local coordinate system  
00111   float trk_beta;  // reconstructed track angle in the yz plane of the module local coordinate system  
00112 
00113   float phi;   // polar track angle
00114   float eta;   // pseudo-rapidity (function of theta, the azimuthal angle)
00115 
00116   int subdetId;
00117   int layer;  
00118   int ladder; 
00119   int mod;    
00120   int side;    
00121   int disk;   
00122   int blade;  
00123   int panel;  
00124   int plaq;   
00125  
00126   int half; // half = 1 if the barrel module is half size and 0 if it is full size (only defined for barrel) 
00127   int flipped; // flipped = 1 if the module is flipped and 0 if non-flipped (only defined for barrel) 
00128 
00129   int nsimhit; // number of simhits associated with a rechit
00130   int pidhit; // PID of the particle that produced the simHit associated with the recHit
00131   int simproc; // procces tye
00132 
00133   float simhitx; // true x position of hit 
00134   float simhity; // true y position of hit
00135 
00136   int evt;
00137   int run;
00138 
00139   float hit_probx;
00140   float hit_proby;
00141   float hit_cprob0;
00142   float hit_cprob1;
00143   float hit_cprob2;
00144 
00145    // variables that go in the output ttree_sll_hits_
00146   
00147   int all_subdetid;
00148 
00149   int all_layer;
00150   int all_ladder;
00151   int all_mod;
00152 
00153   int all_side;
00154   int all_disk;
00155   int all_blade;
00156   int all_panel;
00157   int all_plaq;
00158   
00159   int all_half;
00160   int all_flipped;
00161 
00162   int all_cols;
00163   int all_rows;
00164 
00165   float all_rechitx;
00166   float all_rechity;
00167   float all_rechitz;
00168 
00169   float all_simhitx;
00170   float all_simhity;
00171 
00172   float all_rechiterrx;
00173   float all_rechiterry;
00174 
00175   float all_rechitresx;
00176   float all_rechitresy;
00177 
00178   float all_rechitpullx;
00179   float all_rechitpully;
00180 
00181   int all_npix;
00182   int all_nxpix;
00183   int all_nypix;
00184 
00185   int all_edgex;
00186   int all_edgey;
00187 
00188   int all_bigx;
00189   int all_bigy;
00190 
00191   float all_alpha;
00192   float all_beta;
00193 
00194   float all_simphi;
00195   float all_simtheta;
00196 
00197   int all_nsimhit;
00198   int all_pidhit;
00199   int all_simproc;
00200 
00201   float all_vtxr;
00202   float all_vtxz;
00203 
00204   float all_simpx;
00205   float all_simpy;
00206   float all_simpz;
00207 
00208   float all_eloss;
00209 
00210   int all_trkid;
00211 
00212   float all_x1;
00213   float all_x2;
00214   float all_y1;
00215   float all_y2;
00216   float all_z1;
00217   float all_z2;
00218 
00219   float all_row1;
00220   float all_row2;
00221   float all_col1;
00222   float all_col2;
00223 
00224   float all_gx1;
00225   float all_gx2;
00226   float all_gy1;
00227   float all_gy2;
00228   float all_gz1;
00229   float all_gz2;
00230 
00231   float all_simtrketa;
00232   float all_simtrkphi;
00233 
00234   float all_clust_row;
00235   float all_clust_col;
00236 
00237   float all_clust_x;
00238   float all_clust_y;
00239 
00240   float all_clust_q;
00241 
00242   int all_clust_maxpixcol;
00243   int all_clust_maxpixrow;
00244   int all_clust_minpixcol;
00245   int all_clust_minpixrow;
00246 
00247   int all_clust_geoid;
00248 
00249   float all_clust_alpha;
00250   float all_clust_beta;
00251 
00252   static const int maxpix = 10000;
00253   float all_pixrow[maxpix];
00254   float all_pixcol[maxpix];
00255   float all_pixadc[maxpix];
00256   // Just added
00257   float all_pixx[maxpix];
00258   float all_pixy[maxpix];
00259   float all_pixgx[maxpix];
00260   float all_pixgy[maxpix];
00261   float all_pixgz[maxpix];
00262     
00263   float all_hit_probx;
00264   float all_hit_proby;
00265   float all_hit_cprob0;
00266   float all_hit_cprob1;
00267   float all_hit_cprob2;
00268 
00269   // ----------------------------------
00270 
00271   TFile * tfile_;
00272   TTree * ttree_all_hits_;
00273   TTree * ttree_track_hits_;
00274   
00275 };
00276 
00277 #endif