00001 #ifndef PhotonValidator_H 00002 #define PhotonValidator_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/EgammaCandidates/interface/Photon.h" 00015 #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h" 00016 00017 //#include "RecoEgamma/EgammaTools/interface/ConversionLikelihoodCalculator.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 #include <map> 00026 #include <vector> 00038 // forward declarations 00039 class TFile; 00040 class TH1F; 00041 class TH2F; 00042 class TProfile; 00043 class TTree; 00044 class SimVertex; 00045 class SimTrack; 00046 00047 00048 00049 class PhotonValidator : public edm::EDAnalyzer 00050 { 00051 00052 public: 00053 00054 // 00055 explicit PhotonValidator( const edm::ParameterSet& ) ; 00056 virtual ~PhotonValidator(); 00057 00058 00059 virtual void analyze( const edm::Event&, const edm::EventSetup& ) ; 00060 virtual void beginJob(); 00061 virtual void beginRun( edm::Run const & r, edm::EventSetup const & theEventSetup) ; 00062 virtual void endRun (edm::Run& r, edm::EventSetup const & es); 00063 virtual void endJob() ; 00064 00065 private: 00066 // 00067 00068 float phiNormalization( float& a); 00069 float etaTransformation( float a, float b); 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 nSimPho_[2]; 00080 int nSimConv_[2]; 00081 int nMatched_; 00082 int nRecConv_; 00083 int nRecConvAss_; 00084 int nRecConvAssWithEcal_; 00085 00086 int nInvalidPCA_; 00087 00088 edm::ParameterSet parameters_; 00089 edm::ESHandle<CaloGeometry> theCaloGeom_; 00090 edm::ESHandle<CaloTopology> theCaloTopo_; 00091 00092 std::string photonCollectionProducer_; 00093 std::string photonCollection_; 00094 00095 edm::InputTag bcBarrelCollection_; 00096 edm::InputTag bcEndcapCollection_; 00097 00098 edm::InputTag barrelEcalHits_; 00099 edm::InputTag endcapEcalHits_; 00100 00101 edm::InputTag label_tp_; 00102 00103 00104 std::string conversionOITrackProducer_; 00105 std::string conversionIOTrackProducer_; 00106 00107 00108 00109 PhotonMCTruthFinder* thePhotonMCTruthFinder_; 00110 TrackAssociatorBase * theTrackAssociator_; 00111 00112 bool fastSim_; 00113 bool isRunCentrally_; 00114 00115 00116 double minPhoEtCut_; 00117 double convTrackMinPtCut_; 00118 double likelihoodCut_; 00119 double trkIsolExtRadius_; 00120 double trkIsolInnRadius_; 00121 double trkPtLow_; 00122 double lip_; 00123 double ecalIsolRadius_; 00124 double bcEtLow_; 00125 double hcalIsolExtRadius_; 00126 double hcalIsolInnRadius_; 00127 double hcalHitEtLow_; 00128 int numOfTracksInCone_; 00129 double trkPtSumCut_; 00130 double ecalEtSumCut_; 00131 double hcalEtSumCut_; 00132 bool dCotCutOn_; 00133 double dCotCutValue_; 00134 double dCotHardCutValue_; 00135 00136 00138 double mcPhi_; 00139 double mcEta_; 00140 double mcConvR_; 00141 double mcConvZ_; 00142 double mcConvY_; 00143 double mcConvX_; 00144 double mcConvPhi_; 00145 double mcConvEta_; 00146 double mcJetEta_; 00147 double mcJetPhi_; 00148 00149 edm::RefVector<TrackingParticleCollection> theConvTP_; 00150 // std::vector<TrackingParticleRef> theConvTP_; 00151 00152 double simMinPt_; 00153 double simMaxPt_; 00154 00156 double recMinPt_; 00157 double recMaxPt_; 00158 00159 // 00160 MonitorElement* h_nSimPho_[2]; 00161 MonitorElement* h_SimPhoMotherType_[2]; 00162 MonitorElement* h_SimPhoMotherEt_[2]; 00163 MonitorElement* h_SimPhoMotherEta_[2]; 00164 MonitorElement* h_SimPhoEtaSmallR9_; 00165 // 00166 MonitorElement* h_nSimConv_[2]; 00167 MonitorElement* h_SimConvEtaPix_[2]; 00168 // 00169 MonitorElement* h_simTkPt_; 00170 MonitorElement* h_simTkEta_; 00171 00172 MonitorElement* h_simConvVtxRvsZ_[4]; 00173 MonitorElement* h_simConvVtxYvsX_; 00174 00175 00177 MonitorElement* h_SimPho_[3]; 00178 MonitorElement* h_AllSimConv_[5]; 00179 MonitorElement* h_VisSimConv_[6]; 00180 MonitorElement* h_VisSimConvLarge_; 00182 MonitorElement* h_MatchedSimPho_[3]; 00183 MonitorElement* h_MatchedSimPhoBadCh_[3]; 00184 MonitorElement* h_SimConvOneTracks_[5]; 00185 MonitorElement* h_SimConvOneMTracks_[5]; 00186 MonitorElement* h_SimConvTwoTracks_[5]; 00187 MonitorElement* h_SimConvTwoMTracks_[5]; 00188 MonitorElement* h_SimConvTwoMTracksAndVtxPGT0_[5]; 00189 MonitorElement* h_SimConvTwoMTracksAndVtxPGT0005_[5]; 00190 MonitorElement* h_SimConvTwoMTracksAndVtxPGT01_[5]; 00191 // Denominators for conversion fake rate 00192 MonitorElement* h_RecoConvTwoTracks_[5]; 00193 // Numerators for conversion fake rate 00194 MonitorElement* h_RecoConvTwoMTracks_[5]; 00195 00196 00198 MonitorElement* h_OIinnermostHitR_; 00199 MonitorElement* h_IOinnermostHitR_; 00200 MonitorElement* h_trkProv_[2]; 00201 00202 00203 MonitorElement* h_phoDEta_[2]; 00204 MonitorElement* h_phoDPhi_[2]; 00205 00206 00207 00208 MonitorElement* h_scEta_[2]; 00209 MonitorElement* h_scEtaWidth_[2]; 00210 MonitorElement* h_scPhi_[2]; 00211 MonitorElement* h_scPhiWidth_[2]; 00212 MonitorElement* h_scEtaPhi_[2]; 00213 00214 00215 MonitorElement* h_scE_[2][3]; 00216 MonitorElement* h_scEt_[2][3]; 00217 00218 MonitorElement* h_psE_; 00219 00220 MonitorElement* h_r9_[3][3]; 00221 MonitorElement* h2_r9VsEta_[3]; 00222 MonitorElement* p_r9VsEta_[3]; 00223 MonitorElement* h2_r9VsEt_[3]; 00224 MonitorElement* p_r9VsEt_[3]; 00225 // 00226 MonitorElement* h_r1_[3][3]; 00227 MonitorElement* h2_r1VsEta_[3]; 00228 MonitorElement* p_r1VsEta_[3]; 00229 MonitorElement* h2_r1VsEt_[3]; 00230 MonitorElement* p_r1VsEt_[3]; 00231 // 00232 MonitorElement* h_r2_[3][3]; 00233 MonitorElement* h2_r2VsEta_[3]; 00234 MonitorElement* p_r2VsEta_[3]; 00235 MonitorElement* h2_r2VsEt_[3]; 00236 MonitorElement* p_r2VsEt_[3]; 00237 // 00238 MonitorElement* h_sigmaIetaIeta_[3][3]; 00239 MonitorElement* h2_sigmaIetaIetaVsEta_[3]; 00240 MonitorElement* p_sigmaIetaIetaVsEta_[3]; 00241 MonitorElement* h2_sigmaIetaIetaVsEt_[3]; 00242 MonitorElement* p_sigmaIetaIetaVsEt_[3]; 00243 // 00244 MonitorElement* h_hOverE_[3][3]; 00245 MonitorElement* h2_hOverEVsEta_[3]; 00246 MonitorElement* p_hOverEVsEta_[3]; 00247 MonitorElement* h2_hOverEVsEt_[3]; 00248 MonitorElement* p_hOverEVsEt_[3]; 00249 00250 00251 00252 // 00253 MonitorElement* h_ecalRecHitSumEtConeDR04_[3][3]; 00254 MonitorElement* h2_ecalRecHitSumEtConeDR04VsEta_[3]; 00255 MonitorElement* p_ecalRecHitSumEtConeDR04VsEta_[3]; 00256 MonitorElement* h2_ecalRecHitSumEtConeDR04VsEt_[3]; 00257 MonitorElement* p_ecalRecHitSumEtConeDR04VsEt_[3]; 00258 // 00259 MonitorElement* h_hcalTowerSumEtConeDR04_[3][3]; 00260 MonitorElement* h2_hcalTowerSumEtConeDR04VsEta_[3]; 00261 MonitorElement* p_hcalTowerSumEtConeDR04VsEta_[3]; 00262 MonitorElement* h2_hcalTowerSumEtConeDR04VsEt_[3]; 00263 MonitorElement* p_hcalTowerSumEtConeDR04VsEt_[3]; 00264 // 00265 MonitorElement* h_isoTrkSolidConeDR04_[3][3]; 00266 MonitorElement* h2_isoTrkSolidConeDR04VsEta_[3]; 00267 MonitorElement* p_isoTrkSolidConeDR04VsEta_[3]; 00268 MonitorElement* h2_isoTrkSolidConeDR04VsEt_[3]; 00269 MonitorElement* p_isoTrkSolidConeDR04VsEt_[3]; 00270 // 00271 MonitorElement* h_nTrkSolidConeDR04_[3][3]; 00272 MonitorElement* h2_nTrkSolidConeDR04VsEta_[3]; 00273 MonitorElement* p_nTrkSolidConeDR04VsEta_[3]; 00274 MonitorElement* h2_nTrkSolidConeDR04VsEt_[3]; 00275 MonitorElement* p_nTrkSolidConeDR04VsEt_[3]; 00276 // 00277 00278 MonitorElement* h_gamgamMass_[3][3]; 00279 00280 MonitorElement* h_phoE_[2][3]; 00281 MonitorElement* h_phoEt_[2][3]; 00282 MonitorElement* h_phoERes_[3][3]; 00283 00284 MonitorElement* h2_eResVsEta_[3]; 00285 MonitorElement* p_eResVsEta_[3]; 00286 MonitorElement* h2_eResVsEt_[3][3]; 00287 MonitorElement* p_eResVsEt_[3][3]; 00288 00289 MonitorElement* h2_eResVsR9_[3]; 00290 MonitorElement* p_eResVsR9_[3]; 00291 MonitorElement* h2_sceResVsR9_[3]; 00292 MonitorElement* p_sceResVsR9_[3]; 00293 00294 00295 MonitorElement* h_phoEta_[2]; 00296 MonitorElement* h_phoPhi_[2]; 00297 00298 00299 00301 MonitorElement* h_nConv_[2][3]; 00302 MonitorElement* h_convEta_[3]; 00303 MonitorElement* h_convPhi_[2]; 00304 MonitorElement* h_convERes_[2][3]; 00305 MonitorElement* p_eResVsR_; 00306 00307 MonitorElement* h_convPtRes_[2][3]; 00308 00309 MonitorElement* h_invMass_[2][3]; 00310 MonitorElement* h_r9VsNofTracks_[2][3]; 00311 MonitorElement* h_EoverPTracks_[2][3]; 00312 MonitorElement* h_PoverETracks_[2][3]; 00313 00314 MonitorElement* h_mvaOut_[3]; 00315 MonitorElement* h2_etaVsRsim_[3]; 00316 MonitorElement* h2_etaVsRreco_[3]; 00317 00318 MonitorElement* h2_EoverEtrueVsEoverP_[3]; 00319 MonitorElement* h2_PoverPtrueVsEoverP_[3]; 00320 00321 MonitorElement* h2_EoverPVsEta_[3]; 00322 MonitorElement* p_EoverPVsEta_[3]; 00323 MonitorElement* h2_EoverPVsR_[3]; 00324 MonitorElement* p_EoverPVsR_[3]; 00325 00326 MonitorElement* h2_EoverEtrueVsEta_[3]; 00327 MonitorElement* p_EoverEtrueVsEta_[3]; 00328 MonitorElement* h2_EoverEtrueVsR_[3]; 00329 MonitorElement* p_EoverEtrueVsR_[3]; 00330 00331 00332 MonitorElement* h2_PoverPtrueVsEta_[3]; 00333 MonitorElement* p_PoverPtrueVsEta_[3]; 00334 00335 MonitorElement* h_DPhiTracksAtVtx_[2][3]; 00336 MonitorElement* h2_DPhiTracksAtVtxVsEta_; 00337 MonitorElement* p_DPhiTracksAtVtxVsEta_; 00338 MonitorElement* h2_DPhiTracksAtVtxVsR_; 00339 MonitorElement* p_DPhiTracksAtVtxVsR_; 00340 00341 MonitorElement* h_DCotTracks_[2][3]; 00342 MonitorElement* h2_DCotTracksVsEta_; 00343 MonitorElement* p_DCotTracksVsEta_; 00344 MonitorElement* h2_DCotTracksVsR_; 00345 MonitorElement* p_DCotTracksVsR_; 00346 00347 MonitorElement* h_distMinAppTracks_[2][3]; 00348 00349 00350 00351 MonitorElement* h_DPhiTracksAtEcal_[2][3]; 00352 MonitorElement* h2_DPhiTracksAtEcalVsR_; 00353 MonitorElement* p_DPhiTracksAtEcalVsR_; 00354 MonitorElement* h2_DPhiTracksAtEcalVsEta_; 00355 MonitorElement* p_DPhiTracksAtEcalVsEta_; 00356 00357 00358 MonitorElement* h_DEtaTracksAtEcal_[2][3]; 00359 00360 00361 00362 MonitorElement* h_convVtxRvsZ_[3]; 00363 MonitorElement* h_convVtxYvsX_; 00364 MonitorElement* h_convVtxRvsZ_zoom_[2]; 00365 MonitorElement* h_convVtxYvsX_zoom_[2]; 00366 00367 MonitorElement* h_convVtxdX_; 00368 MonitorElement* h_convVtxdY_; 00369 MonitorElement* h_convVtxdZ_; 00370 MonitorElement* h_convVtxdR_; 00371 00372 MonitorElement* h_convVtxdX_barrel_; 00373 MonitorElement* h_convVtxdY_barrel_; 00374 MonitorElement* h_convVtxdZ_barrel_; 00375 MonitorElement* h_convVtxdR_barrel_; 00376 00377 MonitorElement* h_convVtxdX_endcap_; 00378 MonitorElement* h_convVtxdY_endcap_; 00379 MonitorElement* h_convVtxdZ_endcap_; 00380 MonitorElement* h_convVtxdR_endcap_; 00381 00382 MonitorElement* h_convVtxdEta_; 00383 MonitorElement* h_convVtxdPhi_; 00384 00385 00386 MonitorElement* h2_convVtxdRVsR_; 00387 MonitorElement* p_convVtxdRVsR_; 00388 MonitorElement* h2_convVtxdRVsEta_; 00389 MonitorElement* p_convVtxdRVsEta_; 00390 MonitorElement* p_convVtxdXVsX_; 00391 MonitorElement* p_convVtxdYVsY_; 00392 MonitorElement* p_convVtxdZVsZ_; 00393 00394 MonitorElement* h2_convVtxRrecVsTrue_; 00395 00396 MonitorElement* h_vtxChi2_[3]; 00397 MonitorElement* h_vtxChi2Prob_[3]; 00398 00399 00400 00401 MonitorElement* h_zPVFromTracks_[5]; 00402 MonitorElement* h_dzPVFromTracks_[5]; 00403 MonitorElement* h2_dzPVVsR_; 00404 MonitorElement* p_dzPVVsR_; 00405 MonitorElement* p_dzPVVsEta_; 00406 00407 00409 MonitorElement* p_nHitsVsEta_[2]; 00410 MonitorElement* nHitsVsEta_[2]; 00411 MonitorElement* p_nHitsVsR_[2]; 00412 MonitorElement* nHitsVsR_[2]; 00413 MonitorElement* h_tkChi2_[2]; 00414 MonitorElement* h_tkChi2Large_[2]; 00415 MonitorElement* h2_Chi2VsEta_[3]; 00416 MonitorElement* p_Chi2VsEta_[3]; 00417 MonitorElement* h2_Chi2VsR_[3]; 00418 MonitorElement* p_Chi2VsR_[3]; 00419 00420 MonitorElement* h_TkD0_[3]; 00421 00422 MonitorElement* h_TkPtPull_[3]; 00423 MonitorElement* h2_TkPtPull_[3]; 00424 MonitorElement* p_TkPtPull_[3]; 00425 MonitorElement* h2_PtRecVsPtSim_[3]; 00426 MonitorElement* h2_PtRecVsPtSimMixProv_; 00427 00428 MonitorElement* hBCEnergyOverTrackPout_[3]; 00429 00430 // ME for bkg efficiencies 00431 MonitorElement* h_SimJet_[3]; 00432 MonitorElement* h_MatchedSimJet_[3]; 00433 MonitorElement* h_MatchedSimJetBadCh_[3]; 00434 // 00435 00436 MonitorElement* h_nPho_; 00437 00438 MonitorElement* h_scBkgEta_; 00439 MonitorElement* h_scBkgPhi_; 00440 MonitorElement* h_phoBkgEta_; 00441 MonitorElement* h_phoBkgPhi_; 00442 MonitorElement* h_phoBkgDEta_; 00443 MonitorElement* h_phoBkgDPhi_; 00444 MonitorElement* h_phoBkgE_[3]; 00445 MonitorElement* h_phoBkgEt_[3]; 00446 00447 00448 MonitorElement* h_scBkgE_[3]; 00449 MonitorElement* h_scBkgEt_[3]; 00450 00451 MonitorElement* h_r9Bkg_[3]; 00452 MonitorElement* h_r1Bkg_[3]; 00453 MonitorElement* h_r2Bkg_[3]; 00454 MonitorElement* h_hOverEBkg_[3]; 00455 00456 MonitorElement* h2_r9VsEtaBkg_; 00457 MonitorElement* h2_r9VsEtBkg_; 00458 00459 MonitorElement* h2_r1VsEtaBkg_; 00460 MonitorElement* h2_r1VsEtBkg_; 00461 MonitorElement* p_r1VsEtaBkg_; 00462 MonitorElement* p_r1VsEtBkg_; 00463 00464 MonitorElement* h2_r2VsEtaBkg_; 00465 MonitorElement* h2_r2VsEtBkg_; 00466 MonitorElement* p_r2VsEtaBkg_; 00467 MonitorElement* p_r2VsEtBkg_; 00468 00469 MonitorElement* h_sigmaIetaIetaBkg_[3]; 00470 MonitorElement* h2_sigmaIetaIetaVsEtaBkg_; 00471 MonitorElement* p_sigmaIetaIetaVsEtaBkg_; 00472 MonitorElement* h2_sigmaIetaIetaVsEtBkg_[3]; 00473 MonitorElement* p_sigmaIetaIetaVsEtBkg_[3]; 00474 00475 00476 MonitorElement* h2_hOverEVsEtaBkg_; 00477 MonitorElement* h2_hOverEVsEtBkg_; 00478 MonitorElement* p_hOverEVsEtaBkg_; 00479 MonitorElement* p_hOverEVsEtBkg_; 00480 00481 00482 MonitorElement* h_ecalRecHitSumEtConeDR04Bkg_[3]; 00483 MonitorElement* h2_ecalRecHitSumEtConeDR04VsEtaBkg_; 00484 MonitorElement* p_ecalRecHitSumEtConeDR04VsEtaBkg_; 00485 MonitorElement* h2_ecalRecHitSumEtConeDR04VsEtBkg_[3]; 00486 MonitorElement* p_ecalRecHitSumEtConeDR04VsEtBkg_[3]; 00487 00488 00489 MonitorElement* h_hcalTowerSumEtConeDR04Bkg_[3]; 00490 MonitorElement* h2_hcalTowerSumEtConeDR04VsEtaBkg_; 00491 MonitorElement* p_hcalTowerSumEtConeDR04VsEtaBkg_; 00492 MonitorElement* h2_hcalTowerSumEtConeDR04VsEtBkg_[3]; 00493 MonitorElement* p_hcalTowerSumEtConeDR04VsEtBkg_[3]; 00494 00495 MonitorElement* h_isoTrkSolidConeDR04Bkg_[3]; 00496 MonitorElement* h2_isoTrkSolidConeDR04VsEtaBkg_; 00497 MonitorElement* p_isoTrkSolidConeDR04VsEtaBkg_; 00498 MonitorElement* h2_isoTrkSolidConeDR04VsEtBkg_[3]; 00499 MonitorElement* p_isoTrkSolidConeDR04VsEtBkg_[3]; 00500 // 00501 MonitorElement* h_nTrkSolidConeDR04Bkg_[3]; 00502 MonitorElement* h2_nTrkSolidConeDR04VsEtaBkg_; 00503 MonitorElement* p_nTrkSolidConeDR04VsEtaBkg_; 00504 MonitorElement* h2_nTrkSolidConeDR04VsEtBkg_[3]; 00505 MonitorElement* p_nTrkSolidConeDR04VsEtBkg_[3]; 00506 // 00507 MonitorElement* h_convEtaBkg_; 00508 MonitorElement* h_convPhiBkg_; 00509 MonitorElement* h_mvaOutBkg_[3]; 00510 MonitorElement* nHitsVsEtaBkg_; 00511 MonitorElement* h_tkChi2Bkg_; 00512 MonitorElement* h_EoverPTracksBkg_[3]; 00513 MonitorElement* h_PoverETracksBkg_[3]; 00514 MonitorElement* h_DPhiTracksAtVtxBkg_[3]; 00515 MonitorElement* h_DCotTracksBkg_[3]; 00516 MonitorElement* h_convVtxYvsXBkg_; 00517 MonitorElement* h_convVtxRvsZBkg_[2]; 00518 00519 00520 00521 class sortPhotons 00522 { 00523 public: 00524 bool operator () (const reco::Photon & lhs, const reco::Photon & rhs) 00525 { 00526 return lhs.et() > rhs.et(); 00527 } 00528 }; 00529 00530 00531 00532 }; 00533 00534 00535 00536 00537 00538 00539 00540 #endif