CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/Validation/RecoEgamma/plugins/TkConvValidator.h

Go to the documentation of this file.
00001 #ifndef TkConvValidator_H
00002 #define TkConvValidator_H
00003 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00004 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00005 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00006 #include "FWCore/Framework/interface/EDAnalyzer.h"
00007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00008 #include "FWCore/Framework/interface/Event.h"
00009 #include "FWCore/Framework/interface/EventSetup.h"
00010 #include "FWCore/Framework/interface/ESHandle.h"
00011 #include "RecoEgamma/EgammaMCTools/interface/PhotonMCTruthFinder.h"
00012 #include "SimTracker/TrackAssociation/interface/TrackAssociatorBase.h"
00013 #include "MagneticField/Engine/interface/MagneticField.h"
00014 #include "DataFormats/Common/interface/RefToBaseVector.h"
00015 #include "DataFormats/Common/interface/RefVector.h"
00016 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00017 #include "DataFormats/VertexReco/interface/Vertex.h"
00018 //
00019 //DQM services
00020 #include "DQMServices/Core/interface/DQMStore.h"
00021 #include "FWCore/ServiceRegistry/interface/Service.h"
00022 #include "DQMServices/Core/interface/MonitorElement.h"
00023 
00024 
00025 //
00026 #include <map>
00027 #include <vector>
00028 
00029 // forward declarations
00030 class TFile;
00031 class TH1F;
00032 class TH2F;
00033 class TProfile;
00034 class TTree;
00035 class SimVertex;
00036 class SimTrack;
00048 class TkConvValidator : public edm::EDAnalyzer
00049 {
00050 
00051  public:
00052    
00053   //
00054   explicit TkConvValidator( const edm::ParameterSet& ) ;
00055   virtual ~TkConvValidator();
00056                                    
00057       
00058   virtual void analyze( const edm::Event&, const edm::EventSetup& ) ;
00059   virtual void beginJob();
00060   virtual void beginRun( edm::Run const & r, edm::EventSetup const & theEventSetup) ;
00061   virtual void endRun (edm::Run& r, edm::EventSetup const & es);
00062   virtual void endJob() ;
00063   
00064  private:
00065   //
00066 
00067   float  phiNormalization( float& a);
00068   float  etaTransformation( float a, float b);
00069   math::XYZVector recalculateMomentumAtFittedVertex (const MagneticField& mf, const TrackerGeometry& trackerGeom, const  edm::RefToBase<reco::Track>&   tk,const  reco::Vertex& vtx);
00070 
00071       
00072   std::string fName_;
00073   DQMStore *dbe_;
00074   edm::ESHandle<MagneticField> theMF_;
00075 
00076   int verbosity_;
00077   int nEvt_;
00078   int nEntry_;
00079   int nSimConv_[2];
00080   int nMatched_;
00081   int nRecConv_;
00082   int nRecConvAss_;
00083   int nRecConvAssWithEcal_;
00084 
00085   int nInvalidPCA_;
00086 
00087   edm::ParameterSet parameters_;
00088   edm::ESHandle<CaloGeometry> theCaloGeom_;         
00089   edm::ESHandle<CaloTopology> theCaloTopo_;
00090 
00091   std::string conversionCollectionProducer_;       
00092   std::string conversionCollection_;
00093   std::string conversionTrackProducer_;
00094 
00095   std::string photonCollectionProducer_;       
00096   std::string photonCollection_;
00097 
00098   std::string dqmpath_;
00099 
00100   edm::InputTag label_tp_;
00101 
00102   PhotonMCTruthFinder*  thePhotonMCTruthFinder_;
00103   TrackAssociatorBase * theTrackAssociator_;
00104 
00105   bool isRunCentrally_;
00106 
00107   double minPhoEtCut_;
00108   double trkIsolExtRadius_;
00109   double trkIsolInnRadius_;
00110   double trkPtLow_;
00111   double lip_;
00112   double ecalIsolRadius_;
00113   double bcEtLow_;
00114   double hcalIsolExtRadius_;
00115   double hcalIsolInnRadius_;
00116   double hcalHitEtLow_;
00117   int  numOfTracksInCone_;
00118   double trkPtSumCut_;
00119   double ecalEtSumCut_;
00120   double hcalEtSumCut_;
00121   bool dCotCutOn_;
00122   double dCotCutValue_;
00123   double dCotHardCutValue_;
00124   bool generalTracksOnly_;
00125   bool arbitratedMerged_;
00126   bool arbitratedEcalSeeded_;
00127   bool ecalalgotracks_;
00128   bool highPurity_;
00129   double minProb_;
00130   uint maxHitsBeforeVtx_;
00131   double minLxy_;
00132   
00133 
00135   double mcPhi_;
00136   double mcEta_;
00137   double mcConvPt_;      
00138   double mcConvR_;      
00139   double mcConvZ_;
00140   double mcConvY_;            
00141   double mcConvX_;            
00142   double mcConvPhi_;            
00143   double mcConvEta_;            
00144   double mcJetEta_;
00145   double mcJetPhi_;
00146 
00147   edm::RefVector<TrackingParticleCollection> theConvTP_;
00148   //std::vector<TrackingParticleRef>    theConvTP_;
00149 
00150   double minPhoPtForEffic;
00151   double maxPhoEtaForEffic;
00152   double maxPhoZForEffic;
00153   double maxPhoRForEffic;
00154   double minPhoPtForPurity;
00155   double maxPhoEtaForPurity;
00156   double maxPhoZForPurity;
00157   double maxPhoRForPurity;
00158 
00159   double simMinPt_;
00160   double simMaxPt_;
00161   
00163   double recMinPt_;
00164   double recMaxPt_;
00165 
00166   //
00167   //
00168   MonitorElement* h_nSimConv_[2];
00169   MonitorElement* h_SimConvEtaPix_[2];
00170   //
00171   MonitorElement* h_simTkPt_;
00172   MonitorElement* h_simTkEta_;
00173 
00174   MonitorElement* h_simConvVtxRvsZ_[4];
00175   MonitorElement* h_simConvVtxYvsX_;
00176 
00177 
00179   MonitorElement*   h_AllSimConv_[5];
00180   MonitorElement*   h_VisSimConv_[6];
00181   MonitorElement*   h_VisSimConvLarge_;
00183   MonitorElement*   h_SimConvOneTracks_[5];
00184   MonitorElement*   h_SimConvOneMTracks_[5];
00185   MonitorElement*   h_SimConvTwoTracks_[5];
00186   MonitorElement*   h_SimConvTwoMTracks_[5];
00187   MonitorElement*   h_SimConvTwoMTracksAndVtxPGT0_[5];
00188   MonitorElement*   h_SimConvTwoMTracksAndVtxPGT0005_[5];
00189   MonitorElement*   h_SimConvTwoMTracksAndVtxPGT01_[5];
00190   // Numerator for double-counting quantification
00191   MonitorElement*   h_SimRecConvOneTracks_[5];
00192   MonitorElement*   h_SimRecConvOneMTracks_[5];
00193   MonitorElement*   h_SimRecConvTwoTracks_[5];
00194   MonitorElement*   h_SimRecConvTwoMTracks_[5];
00195   
00196   // Denominators for conversion fake rate
00197   MonitorElement*   h_RecoConvTwoTracks_[5];
00198   // Numerators for conversion fake rate
00199   MonitorElement*   h_RecoConvTwoMTracks_[5];
00200 
00201 
00203   MonitorElement* h_nConv_[3][3];
00204   MonitorElement* h_convEtaMatchSC_[3][3];
00205   MonitorElement* h_convEta_[3][3];
00206   MonitorElement* h_convEta2_[3][3];
00207   MonitorElement* h_convPhi_[3][3];
00208   MonitorElement* h_convR_[3][3];
00209   MonitorElement* h_convZ_[3][3];
00210   MonitorElement* h_convPt_[3][3];
00211   MonitorElement* h_EoverPTracks_[3][3];
00212 
00213   MonitorElement* h_convSCdEta_[3][3];
00214   MonitorElement* h_convSCdPhi_[3][3];
00215 
00216 
00217   MonitorElement* h_convRplot_;
00218   MonitorElement* h_convZplot_;
00219 
00220   MonitorElement* h_convPtRes_[3];
00221 
00222   MonitorElement* h_invMass_[3][3];
00223   
00224   MonitorElement* h_DPhiTracksAtVtx_[3][3];
00225   MonitorElement* h2_DPhiTracksAtVtxVsEta_;
00226   MonitorElement* p_DPhiTracksAtVtxVsEta_;
00227   MonitorElement* h2_DPhiTracksAtVtxVsR_;
00228   MonitorElement* p_DPhiTracksAtVtxVsR_;
00229 
00230   MonitorElement* h_DCotTracks_[3][3];
00231   MonitorElement* h2_DCotTracksVsEta_;
00232   MonitorElement* p_DCotTracksVsEta_;
00233   MonitorElement* h2_DCotTracksVsR_;
00234   MonitorElement* p_DCotTracksVsR_;
00235 
00236   MonitorElement* h_distMinAppTracks_[3][3];
00237 
00238   MonitorElement* h_DPhiTracksAtEcal_[3][3];
00239   MonitorElement* h2_DPhiTracksAtEcalVsR_;
00240   MonitorElement* p_DPhiTracksAtEcalVsR_;
00241   MonitorElement* h2_DPhiTracksAtEcalVsEta_;
00242   MonitorElement* p_DPhiTracksAtEcalVsEta_;
00243 
00244   MonitorElement* h_DEtaTracksAtEcal_[3][3];
00245 
00246   
00247 
00248   MonitorElement* h_convVtxRvsZ_[3];
00249   MonitorElement* h_convVtxYvsX_;
00250   MonitorElement* h_convVtxRvsZ_zoom_[2];
00251   MonitorElement* h_convVtxYvsX_zoom_[2];
00252 
00253   MonitorElement* h_convVtxdX_;
00254   MonitorElement* h_convVtxdY_;
00255   MonitorElement* h_convVtxdZ_;
00256   MonitorElement* h_convVtxdR_;
00257   MonitorElement* h_convVtxdEta_;
00258   MonitorElement* h_convVtxdPhi_;
00259 
00260   MonitorElement* h_convVtxdX_barrel_;
00261   MonitorElement* h_convVtxdY_barrel_;
00262   MonitorElement* h_convVtxdZ_barrel_;
00263   MonitorElement* h_convVtxdR_barrel_;
00264 
00265   MonitorElement* h_convVtxdX_endcap_;
00266   MonitorElement* h_convVtxdY_endcap_;
00267   MonitorElement* h_convVtxdZ_endcap_;
00268   MonitorElement* h_convVtxdR_endcap_;
00269 
00270 
00271   MonitorElement* h2_convVtxdRVsR_;
00272   MonitorElement* h2_convVtxdRVsEta_;
00273 
00274   MonitorElement* p_convVtxdRVsR_;
00275   MonitorElement* p_convVtxdRVsEta_;
00276 
00277   MonitorElement* p_convVtxdXVsX_;
00278   MonitorElement* p_convVtxdYVsY_;
00279   MonitorElement* p_convVtxdZVsZ_;
00280   MonitorElement* p_convVtxdZVsR_;
00281 
00282 
00283   MonitorElement* p2_convVtxdRVsRZ_;
00284   MonitorElement* p2_convVtxdZVsRZ_;
00285 
00286   MonitorElement* h2_convVtxRrecVsTrue_;
00287 
00288 
00289   MonitorElement*  h_vtxChi2Prob_[3][3];
00290 
00291 
00292 
00293   MonitorElement* h_zPVFromTracks_[2]; 
00294   MonitorElement* h_dzPVFromTracks_[2]; 
00295   MonitorElement* h2_dzPVVsR_;
00296   MonitorElement* p_dzPVVsR_;
00297 
00298   MonitorElement* h_lxybs_[3][3];
00299   MonitorElement* h_maxNHitsBeforeVtx_[3][3];
00300   MonitorElement* h_leadNHitsBeforeVtx_[3][3];
00301   MonitorElement* h_trailNHitsBeforeVtx_[3][3]; 
00302   MonitorElement* h_sumNHitsBeforeVtx_[3][3];  
00303   MonitorElement* h_deltaExpectedHitsInner_[3][3];  
00304   MonitorElement* h_leadExpectedHitsInner_[3][3];      
00305   MonitorElement* h_maxDlClosestHitToVtx_[3][3];
00306   MonitorElement* h_maxDlClosestHitToVtxSig_[3][3];
00307   MonitorElement* h_nSharedHits_[3][3];
00308 
00309 
00310 
00312   MonitorElement* nHits_[3]; 
00313   MonitorElement* p_nHitsVsEta_[3]; 
00314   MonitorElement* nHitsVsEta_[3]; 
00315   MonitorElement* p_nHitsVsR_[3]; 
00316   MonitorElement* nHitsVsR_[3]; 
00317   MonitorElement* h_tkChi2_[3];
00318   MonitorElement* h_tkChi2Large_[3];
00319   MonitorElement* h2_Chi2VsEta_[3];
00320   MonitorElement* p_Chi2VsEta_[3];
00321   MonitorElement* h2_Chi2VsR_[3];
00322   MonitorElement* p_Chi2VsR_[3];
00323 
00324   MonitorElement* h_TkD0_[3];
00325 
00326   MonitorElement* h_TkPtPull_[3];
00327   MonitorElement* h2_TkPtPull_[3];
00328   MonitorElement* p_TkPtPull_[3];
00329   MonitorElement* h2_PtRecVsPtSim_[3];
00330   MonitorElement* h2_photonPtRecVsPtSim_;
00331 
00332   MonitorElement* h_match_;
00333 
00334   MonitorElement* p2_effRZ_; 
00335 
00336   MonitorElement* h_nHitsBeforeVtx_[3];
00337   MonitorElement* h_dlClosestHitToVtx_[3];
00338   MonitorElement* h_dlClosestHitToVtxSig_[3];
00339 
00340 };
00341 
00342 
00343 
00344 
00345 #endif