CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/Validation/RecoTrack/interface/MTVHistoProducerAlgoForTracker.h

Go to the documentation of this file.
00001 #ifndef Validation_RecoTrack_MTVHistoProducerAlgoForTracker_h
00002 #define Validation_RecoTrack_MTVHistoProducerAlgoForTracker_h
00003 
00004 /* \author B.Mangano, UCSD
00005  *
00006  * Concrete class implementing the MTVHistoProducerAlgo interface.
00007  * To be used within the MTV to fill histograms for Tracker tracks.
00008  */
00009 
00010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00011 #include "Validation/RecoTrack/interface/MTVHistoProducerAlgo.h"
00012 
00013 #include "DataFormats/TrackReco/interface/Track.h"
00014 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
00015 #include "CommonTools/RecoAlgos/interface/TrackingParticleSelector.h"
00016 
00017 #include "DQMServices/Core/interface/MonitorElement.h"
00018 #include <TH1F.h>
00019 #include <TH2F.h>
00020 
00021 
00022 
00023 class MTVHistoProducerAlgoForTracker: public MTVHistoProducerAlgo {
00024  public:
00025   MTVHistoProducerAlgoForTracker(const edm::ParameterSet& pset) ;
00026   virtual ~MTVHistoProducerAlgoForTracker();
00027 
00028   void initialize(){setUpVectors();};
00029 
00030   void bookSimHistos();
00031 
00032   void bookRecoHistos();
00033   void bookRecoHistosForStandaloneRunning();
00034 
00035 
00036   void fill_generic_simTrack_histos(int counter,ParticleBase::Vector,ParticleBase::Point vertex, int bx);
00037 
00038 
00039   void fill_recoAssociated_simTrack_histos(int count,
00040                                            const TrackingParticle& tp,
00041                                            ParticleBase::Vector momentumTP,ParticleBase::Point vertexTP,
00042                                            double dxy, double dz, int nSimHits,
00043                                            const reco::Track* track,
00044                        int numVertices, double vertz);
00045 
00046 
00047   void fill_generic_recoTrack_histos(int count,
00048                                      const reco::Track& track,
00049                                      math::XYZPoint bsPosition,
00050                                      bool isMatched,
00051                                      bool isSigMatched,
00052                                      bool isChargeMatched,
00053                      int numAssocRecoTracks,
00054                      int numVertices,
00055                          int tpbunchcrossing,
00056                                      int nSimHits,
00057                                      double sharedFraction);
00058 
00059   void fill_dedx_recoTrack_histos(int count, edm::RefToBase<reco::Track>& trackref, std::vector< edm::ValueMap<reco::DeDxData> > v_dEdx);
00060   //  void fill_dedx_recoTrack_histos(reco::TrackRef trackref, std::vector< edm::ValueMap<reco::DeDxData> > v_dEdx);
00061 
00062   void fill_simAssociated_recoTrack_histos(int count,
00063                                            const reco::Track& track);
00064 
00065   void fill_trackBased_histos(int count, 
00066                               int assTracks, 
00067                               int numRecoTracks,
00068                               int numSimTracks);
00069 
00070 
00071   void fill_ResoAndPull_recoTrack_histos(int count,
00072                                          ParticleBase::Vector momentumTP,
00073                                          ParticleBase::Point vertexTP,
00074                                          int chargeTP,
00075                                          const reco::Track& track,
00076                                          math::XYZPoint bsPosition);
00077 
00078   void finalHistoFits(int counter);
00079 
00080 
00081   void fillHistosFromVectors(int counter);
00082   void fillProfileHistosFromVectors(int counter);
00083 
00084 
00085  private:
00086 
00087   // private methods for internal usage
00088   void setUpVectors();
00089 
00090 
00092   void getRecoMomentum (const reco::Track& track, double& pt, double& ptError,
00093                         double& qoverp, double& qoverpError, double& lambda, double& lambdaError,  
00094                         double& phi, double& phiError ) const;
00096   void getRecoMomentum (const reco::GsfTrack& gsfTrack, double& pt, double& ptError,
00097                         double& qoverp, double& qoverpError, double& lambda, double& lambdaError,  
00098                         double& phi, double& phiError) const;
00099 
00100   double getEta(double eta); 
00101   
00102   double getPt(double pt); 
00103 
00104 
00105   //private data members       
00106   TrackingParticleSelector* generalTpSelector;
00107   TrackingParticleSelector* TpSelectorForEfficiencyVsEta;
00108   TrackingParticleSelector* TpSelectorForEfficiencyVsCon;
00109   TrackingParticleSelector* TpSelectorForEfficiencyVsPhi;
00110   TrackingParticleSelector* TpSelectorForEfficiencyVsPt;
00111   TrackingParticleSelector* TpSelectorForEfficiencyVsVTXR;
00112   TrackingParticleSelector* TpSelectorForEfficiencyVsVTXZ;
00113 
00114   double minEta, maxEta;  int nintEta;  bool useFabsEta;
00115   double minPt, maxPt;  int nintPt;   bool useInvPt;   bool useLogPt;
00116   double minHit, maxHit;  int nintHit;
00117   double minPhi, maxPhi;  int nintPhi;
00118   double minDxy, maxDxy;  int nintDxy;
00119   double minDz, maxDz;  int nintDz;
00120   double minVertpos, maxVertpos;  int nintVertpos;
00121   double minZpos, maxZpos;  int nintZpos;
00122   double minDeDx, maxDeDx;  int nintDeDx;
00123   double minVertcount, maxVertcount;  int nintVertcount;
00124 
00125   //
00126   double ptRes_rangeMin,ptRes_rangeMax; int ptRes_nbin;
00127   double phiRes_rangeMin,phiRes_rangeMax; int phiRes_nbin;
00128   double cotThetaRes_rangeMin,cotThetaRes_rangeMax; int cotThetaRes_nbin;
00129   double dxyRes_rangeMin,dxyRes_rangeMax; int dxyRes_nbin;
00130   double dzRes_rangeMin,dzRes_rangeMax; int dzRes_nbin;
00131 
00132 
00133   //sim
00134   std::vector<MonitorElement*> h_ptSIM, h_etaSIM, h_tracksSIM, h_vertposSIM, h_bunchxSIM;
00135   
00136   //1D
00137   std::vector<MonitorElement*> h_tracks, h_fakes, h_hits, h_charge;
00138   std::vector<MonitorElement*> h_effic,  h_fakerate, h_recoeta, h_assoceta, h_assoc2eta, h_simuleta, h_loopereta, h_misideta, h_looprate, h_misidrate;
00139   std::vector<MonitorElement*> h_efficPt, h_fakeratePt, h_recopT, h_assocpT, h_assoc2pT, h_simulpT, h_looperpT, h_misidpT, h_loopratepT, h_misidratepT;
00140   std::vector<MonitorElement*> h_effic_vs_hit, h_fake_vs_hit, h_recohit, h_assochit, h_assoc2hit, h_simulhit, h_looperhit, h_misidhit, h_loopratehit, h_misidratehit;
00141   std::vector<MonitorElement*> h_effic_vs_phi, h_fake_vs_phi, h_recophi, h_assocphi, h_assoc2phi, h_simulphi, h_looperphi, h_misidphi, h_loopratephi, h_misidratephi;
00142   std::vector<MonitorElement*> h_effic_vs_dxy, h_fake_vs_dxy, h_recodxy, h_assocdxy, h_assoc2dxy, h_simuldxy, h_looperdxy, h_misiddxy, h_loopratedxy, h_misidratedxy;
00143   std::vector<MonitorElement*> h_effic_vs_dz, h_fake_vs_dz, h_recodz, h_assocdz, h_assoc2dz, h_simuldz, h_looperdz, h_misiddz, h_loopratedz, h_misidratedz;
00144 
00145   std::vector<MonitorElement*> h_effic_vs_vertpos, h_effic_vs_zpos, h_assocvertpos, h_simulvertpos, h_assoczpos, h_simulzpos;
00146   std::vector<MonitorElement*> h_pt, h_eta, h_pullTheta,h_pullPhi,h_pullDxy,h_pullDz,h_pullQoverp;
00147   std::vector<MonitorElement*> h_effic_vertcount_entire,  h_fakerate_vertcount_entire, h_reco_vertcount_entire, h_assoc_vertcount_entire, h_assoc2_vertcount_entire, h_simul_vertcount_entire;
00148   std::vector<MonitorElement*> h_effic_vertcount_barrel,  h_fakerate_vertcount_barrel, h_reco_vertcount_barrel, h_assoc_vertcount_barrel, h_assoc2_vertcount_barrel, h_simul_vertcount_barrel;
00149   std::vector<MonitorElement*> h_effic_vertcount_fwdpos,  h_fakerate_vertcount_fwdpos, h_reco_vertcount_fwdpos, h_assoc_vertcount_fwdpos, h_assoc2_vertcount_fwdpos, h_simul_vertcount_fwdpos;
00150   std::vector<MonitorElement*> h_effic_vertcount_fwdneg,  h_fakerate_vertcount_fwdneg, h_reco_vertcount_fwdneg, h_assoc_vertcount_fwdneg, h_assoc2_vertcount_fwdneg, h_simul_vertcount_fwdneg;
00151   std::vector<MonitorElement*> h_effic_vertz_entire,  h_assoc_vertz_entire, h_simul_vertz_entire;
00152   std::vector<MonitorElement*> h_effic_vertz_barrel,  h_assoc_vertz_barrel, h_simul_vertz_barrel;
00153   std::vector<MonitorElement*> h_effic_vertz_fwdpos,  h_assoc_vertz_fwdpos, h_simul_vertz_fwdpos;
00154   std::vector<MonitorElement*> h_effic_vertz_fwdneg,  h_assoc_vertz_fwdneg, h_simul_vertz_fwdneg;
00155   std::vector<MonitorElement*> h_algo;
00156   std::vector<MonitorElement*> h_fakerate_ootpu_entire, h_reco_ootpu_entire, h_assoc2_ootpu_entire;
00157   std::vector<MonitorElement*> h_fakerate_ootpu_barrel, h_reco_ootpu_barrel, h_assoc2_ootpu_barrel;
00158   std::vector<MonitorElement*> h_fakerate_ootpu_fwdpos, h_reco_ootpu_fwdpos, h_assoc2_ootpu_fwdpos; 
00159   std::vector<MonitorElement*> h_fakerate_ootpu_fwdneg, h_reco_ootpu_fwdneg, h_assoc2_ootpu_fwdneg;
00160   std::vector<MonitorElement*> h_fomt_eta, h_fomt_sig_eta, h_fomt_vertcount, h_fomt_sig_vertcount;
00161   std::vector<MonitorElement*> h_fomt_itpu_eta, h_fomt_sig_itpu_eta, h_fomt_itpu_vertcount, h_fomt_sig_itpu_vertcount;
00162   std::vector<MonitorElement*> h_fomt_ootpu_eta, h_fomt_ootpu_vertcount;
00163   std::vector<MonitorElement*> h_assoc2_itpu_eta, h_assoc2_itpu_sig_eta, h_assoc2eta_sig;
00164   std::vector<MonitorElement*> h_assoc2_itpu_vertcount, h_assoc2_itpu_sig_vertcount;
00165   std::vector<MonitorElement*> h_assoc2_ootpu_eta, h_assoc2_ootpu_vertcount;
00166   std::vector<MonitorElement*> h_reco_ootpu_eta, h_reco_ootpu_vertcount;
00167   std::vector<MonitorElement*> h_effic_PU_eta, h_effic_PU_vertcount, h_effic_PU_zpos;
00168   std::vector<MonitorElement*> h_con_eta, h_con_vertcount, h_con_zpos;
00169 
00170 
00171   // dE/dx
00172   // in the future these might become an array
00173   std::vector<MonitorElement*> h_dedx_estim1;
00174   std::vector<MonitorElement*> h_dedx_estim2;
00175   std::vector<MonitorElement*> h_dedx_nom1;
00176   std::vector<MonitorElement*> h_dedx_nom2;
00177   std::vector<MonitorElement*> h_dedx_sat1;
00178   std::vector<MonitorElement*> h_dedx_sat2;
00179   
00180   //2D  
00181   std::vector<MonitorElement*> nrec_vs_nsim;
00182   std::vector<MonitorElement*> nrecHit_vs_nsimHit_sim2rec;
00183   std::vector<MonitorElement*> nrecHit_vs_nsimHit_rec2sim;
00184 
00185   //assoc hits
00186   std::vector<MonitorElement*> h_assocFraction, h_assocSharedHit;
00187   
00188   //#hit vs eta: to be used with doProfileX
00189   std::vector<MonitorElement*> nhits_vs_eta, 
00190     nPXBhits_vs_eta, nPXFhits_vs_eta, 
00191     nTIBhits_vs_eta,nTIDhits_vs_eta,
00192     nTOBhits_vs_eta,nTEChits_vs_eta,
00193     nLayersWithMeas_vs_eta, nPXLlayersWithMeas_vs_eta, 
00194     nSTRIPlayersWithMeas_vs_eta, nSTRIPlayersWith1dMeas_vs_eta, nSTRIPlayersWith2dMeas_vs_eta;
00195 
00196 
00197   std::vector<MonitorElement*> h_hits_eta,
00198     h_PXBhits_eta, h_PXFhits_eta, h_TIBhits_eta,h_TIDhits_eta,
00199     h_TOBhits_eta,h_TEChits_eta,h_DThits_eta,h_CSChits_eta,h_RPChits_eta,
00200     h_LayersWithMeas_eta, h_PXLlayersWithMeas_eta, 
00201     h_STRIPlayersWithMeas_eta, h_STRIPlayersWith1dMeas_eta, h_STRIPlayersWith2dMeas_eta;
00202     
00203 
00204   std::vector< std::vector<double> > etaintervals;
00205   std::vector< std::vector<double> > pTintervals;
00206   std::vector< std::vector<double> > phiintervals;
00207   std::vector< std::vector<double> > dxyintervals;
00208   std::vector< std::vector<double> > dzintervals;
00209   std::vector< std::vector<double> > vertposintervals;
00210   std::vector< std::vector<double> > zposintervals;
00211   std::vector< std::vector<double> > vertcountintervals;
00212   std::vector< std::vector<int> > totSIMeta,totRECeta,totASSeta,totASS2eta,totloopeta,totmisideta,totASS2etaSig;
00213   std::vector< std::vector<int> > totSIMpT,totRECpT,totASSpT,totASS2pT,totlooppT,totmisidpT;
00214   std::vector< std::vector<int> > totSIM_hit,totREC_hit,totASS_hit,totASS2_hit,totloop_hit,totmisid_hit;
00215   std::vector< std::vector<int> > totSIM_phi,totREC_phi,totASS_phi,totASS2_phi,totloop_phi,totmisid_phi;
00216   std::vector< std::vector<int> > totSIM_dxy,totREC_dxy,totASS_dxy,totASS2_dxy,totloop_dxy,totmisid_dxy;
00217   std::vector< std::vector<int> > totSIM_dz,totREC_dz,totASS_dz,totASS2_dz,totloop_dz,totmisid_dz;
00218 
00219   std::vector< std::vector<int> > totSIM_vertpos,totASS_vertpos,totSIM_zpos,totASS_zpos;
00220   std::vector< std::vector<int> > totSIM_vertcount_entire,totASS_vertcount_entire,totREC_vertcount_entire,totASS2_vertcount_entire,totASS2_vertcount_entire_signal;
00221   std::vector< std::vector<int> > totSIM_vertcount_barrel,totASS_vertcount_barrel,totREC_vertcount_barrel,totASS2_vertcount_barrel;
00222   std::vector< std::vector<int> > totSIM_vertcount_fwdpos,totASS_vertcount_fwdpos,totREC_vertcount_fwdpos,totASS2_vertcount_fwdpos;
00223   std::vector< std::vector<int> > totSIM_vertcount_fwdneg,totASS_vertcount_fwdneg,totREC_vertcount_fwdneg,totASS2_vertcount_fwdneg;
00224   std::vector< std::vector<int> > totSIM_vertz_entire,totASS_vertz_entire;
00225   std::vector< std::vector<int> > totSIM_vertz_barrel,totASS_vertz_barrel;
00226   std::vector< std::vector<int> > totSIM_vertz_fwdpos,totASS_vertz_fwdpos;
00227   std::vector< std::vector<int> > totSIM_vertz_fwdneg,totASS_vertz_fwdneg;
00228   std::vector< std::vector<int> > totREC_algo;
00229   std::vector< std::vector<int> > totREC_ootpu_entire, totASS2_ootpu_entire; 
00230   std::vector< std::vector<int> > totREC_ootpu_barrel, totASS2_ootpu_barrel;
00231   std::vector< std::vector<int> > totREC_ootpu_fwdpos, totASS2_ootpu_fwdpos;
00232   std::vector< std::vector<int> > totREC_ootpu_fwdneg, totASS2_ootpu_fwdneg;
00233   std::vector< std::vector<int> > totREC_ootpu_eta_entire, totASS2_ootpu_eta_entire;
00234   std::vector< std::vector<int> > totASS2_itpu_eta_entire, totASS2_itpu_eta_entire_signal, totASS2_itpu_vertcount_entire, totASS2_itpu_vertcount_entire_signal;
00235   std::vector< std::vector<int> > totFOMT_eta, totFOMT_vertcount;
00236   std::vector< std::vector<int> > totCONeta, totCONvertcount, totCONzpos;
00237   
00238 
00239 
00240   //---- second set of histograms (originally not used by the SeedGenerator)
00241   //1D
00242   std::vector<MonitorElement*> h_nchi2, h_nchi2_prob, h_losthits;
00243   
00244   //2D  
00245   std::vector<MonitorElement*> chi2_vs_nhits, etares_vs_eta;
00246   std::vector<MonitorElement*> h_ptshifteta;
00247   std::vector<MonitorElement*> ptres_vs_phi, chi2_vs_phi, nhits_vs_phi, phires_vs_phi;
00248 
00249   //Profile2D
00250   std::vector<MonitorElement*> ptmean_vs_eta_phi, phimean_vs_eta_phi;
00251   
00252   //assoc chi2
00253   std::vector<MonitorElement*> h_assochi2, h_assochi2_prob;
00254   
00255   //chi2 and # lost hits vs eta: to be used with doProfileX
00256   std::vector<MonitorElement*> chi2_vs_eta, nlosthits_vs_eta;
00257   std::vector<MonitorElement*> h_chi2meanh, h_losthits_eta;
00258   std::vector<MonitorElement*> h_hits_phi;  
00259   std::vector<MonitorElement*> h_chi2meanhitsh, h_chi2mean_vs_phi;
00260   
00261   //resolution of track params: to be used with fitslicesytool
00262   std::vector<MonitorElement*> dxyres_vs_eta, ptres_vs_eta, dzres_vs_eta, phires_vs_eta, cotThetares_vs_eta;
00263   std::vector<MonitorElement*> dxyres_vs_pt, ptres_vs_pt, dzres_vs_pt, phires_vs_pt, cotThetares_vs_pt;
00264 
00265   std::vector<MonitorElement*> h_dxyrmsh, h_ptrmsh, h_dzrmsh, h_phirmsh, h_cotThetarmsh;
00266   std::vector<MonitorElement*> h_dxyrmshPt, h_ptrmshPt, h_dzrmshPt, h_phirmshPt, h_cotThetarmshPt;
00267   std::vector<MonitorElement*> h_ptrmshPhi, h_phirmshPhi;
00268   //  std::vector<MonitorElement*> h_phimeanh,h_ptmeanhhi, h_phimeanhPhi;
00269   
00270   std::vector<MonitorElement*> h_dxymeanh, h_ptmeanh, h_dzmeanh, h_phimeanh, h_cotThetameanh;
00271   std::vector<MonitorElement*> h_dxymeanhPt, h_ptmeanhPt, h_dzmeanhPt, h_phimeanhPt, h_cotThetameanhPt;
00272   std::vector<MonitorElement*> h_ptmeanhPhi, h_phimeanhPhi;
00273 
00274   //pulls of track params vs eta: to be used with fitslicesytool
00275   std::vector<MonitorElement*> dxypull_vs_eta, ptpull_vs_eta, dzpull_vs_eta, phipull_vs_eta, thetapull_vs_eta;
00276   std::vector<MonitorElement*> ptpull_vs_phi, phipull_vs_phi, thetapull_vs_phi;
00277   std::vector<MonitorElement*> h_dxypulleta, h_ptpulleta, h_dzpulleta, h_phipulleta, h_thetapulleta;
00278   std::vector<MonitorElement*> h_ptpullphi, h_phipullphi, h_thetapullphi;
00279   std::vector<MonitorElement*> h_dxypulletamean, h_ptpulletamean, h_dzpulletamean, h_phipulletamean, h_thetapulletamean;
00280   std::vector<MonitorElement*> h_ptpullphimean, h_phipullphimean, h_thetapullphimean;
00281 
00282 };
00283 
00284 #endif