CMS 3D CMS Logo

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