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