00001 #include <iostream>
00002
00003 #include "FWCore/ServiceRegistry/interface/Service.h"
00004 #include "PhysicsTools/UtilAlgos/interface/TFileService.h"
00005
00006 #include "Validation/RecoEgamma/interface/PhotonValidator.h"
00007
00008
00009 #include "FWCore/Framework/interface/MakerMacros.h"
00010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00011 #include "FWCore/Utilities/interface/Exception.h"
00012
00013 #include "SimDataFormats/HepMCProduct/interface/HepMCProduct.h"
00014 #include "SimDataFormats/Track/interface/SimTrack.h"
00015 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
00016 #include "SimDataFormats/Vertex/interface/SimVertex.h"
00017 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
00018
00019 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h"
00020 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h"
00021 #include "SimDataFormats/TrackingAnalysis/interface/TrackingVertexContainer.h"
00022
00023 #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h"
00024 #include "SimTracker/Records/interface/TrackAssociatorRecord.h"
00025 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00026 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
00027 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00028 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00029
00030 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
00031 #include "TrackingTools/PatternTools/interface/TwoTrackMinimumDistance.h"
00032 #include "TrackingTools/TransientTrack/interface/TrackTransientTrack.h"
00033
00034 #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
00035 #include "TrackingTools/Records/interface/TransientTrackRecord.h"
00036 #include "CLHEP/Units/PhysicalConstants.h"
00037
00038
00039 #include "DataFormats/Common/interface/Handle.h"
00040 #include "DataFormats/TrackReco/interface/Track.h"
00041 #include "DataFormats/TrackReco/interface/TrackExtra.h"
00042 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00043 #include "DataFormats/EgammaCandidates/interface/Conversion.h"
00044 #include "DataFormats/EgammaCandidates/interface/ConversionFwd.h"
00045 #include "DataFormats/EgammaCandidates/interface/Photon.h"
00046 #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
00047 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00048 #include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h"
00049 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
00050 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
00051 #include "DataFormats/VertexReco/interface/Vertex.h"
00052
00053 #include "RecoEgamma/EgammaMCTools/interface/PhotonMCTruthFinder.h"
00054 #include "RecoEgamma/EgammaMCTools/interface/PhotonMCTruth.h"
00055 #include "RecoEgamma/EgammaMCTools/interface/ElectronMCTruth.h"
00056 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h"
00057 #include "RecoCaloTools/MetaCollections/interface/CaloRecHitMetaCollections.h"
00058 #include "Geometry/Records/interface/CaloGeometryRecord.h"
00059 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00060 #include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
00061
00062
00063
00064 #include "TFile.h"
00065 #include "TH1.h"
00066 #include "TH2.h"
00067 #include "TTree.h"
00068 #include "TVector3.h"
00069 #include "TProfile.h"
00070
00081 using namespace std;
00082
00083
00084 PhotonValidator::PhotonValidator( const edm::ParameterSet& pset )
00085 {
00086
00087 fName_ = pset.getUntrackedParameter<std::string>("Name");
00088 verbosity_ = pset.getUntrackedParameter<int>("Verbosity");
00089 parameters_ = pset;
00090
00091
00092 photonCollectionProducer_ = pset.getParameter<std::string>("phoProducer");
00093 photonCollection_ = pset.getParameter<std::string>("photonCollection");
00094
00095
00096 label_tp_ = pset.getParameter<edm::InputTag>("label_tp");
00097
00098 barrelEcalHits_ = pset.getParameter<edm::InputTag>("barrelEcalHits");
00099 endcapEcalHits_ = pset.getParameter<edm::InputTag>("endcapEcalHits");
00100
00101 conversionOITrackProducer_ = pset.getParameter<std::string>("conversionOITrackProducer");
00102 conversionIOTrackProducer_ = pset.getParameter<std::string>("conversionIOTrackProducer");
00103
00104
00105
00106 minPhoEtCut_ = pset.getParameter<double>("minPhoEtCut");
00107
00108
00109 trkIsolExtRadius_ = pset.getParameter<double>("trkIsolExtR");
00110 trkIsolInnRadius_ = pset.getParameter<double>("trkIsolInnR");
00111 trkPtLow_ = pset.getParameter<double>("minTrackPtCut");
00112 lip_ = pset.getParameter<double>("lipCut");
00113 ecalIsolRadius_ = pset.getParameter<double>("ecalIsolR");
00114 bcEtLow_ = pset.getParameter<double>("minBcEtCut");
00115 hcalIsolExtRadius_ = pset.getParameter<double>("hcalIsolExtR");
00116 hcalIsolInnRadius_ = pset.getParameter<double>("hcalIsolInnR");
00117 hcalHitEtLow_ = pset.getParameter<double>("minHcalHitEtCut");
00118
00119 numOfTracksInCone_ = pset.getParameter<int>("maxNumOfTracksInCone");
00120 trkPtSumCut_ = pset.getParameter<double>("trkPtSumCut");
00121 ecalEtSumCut_ = pset.getParameter<double>("ecalEtSumCut");
00122 hcalEtSumCut_ = pset.getParameter<double>("hcalEtSumCut");
00123 dCotCutOn_ = pset.getParameter<bool>("dCotCutOn");
00124 dCotCutValue_ = pset.getParameter<double>("dCotCutValue");
00125 dCotHardCutValue_ = pset.getParameter<double>("dCotHardCutValue");
00126
00127
00128 thePhotonMCTruthFinder_ = new PhotonMCTruthFinder();
00129
00130
00131 }
00132
00133
00134 void PhotonValidator::beginRun (edm::Run& r, edm::EventSetup const & theEventSetup) {
00135
00136
00137 edm::LogInfo("ConvertedPhotonProducer") << " get magnetic field" << "\n";
00138 theEventSetup.get<IdealMagneticFieldRecord>().get(theMF_);
00139
00140 }
00141
00142
00143
00144
00145 PhotonValidator::~PhotonValidator() {
00146
00147 delete thePhotonMCTruthFinder_;
00148
00149
00150 }
00151
00152
00153
00154
00155 void PhotonValidator::initVectors() {
00156
00157
00158
00159 double etaMin = parameters_.getParameter<double>("etaMin");
00160 double etaMax = parameters_.getParameter<double>("etaMax");
00161 int etaBin = parameters_.getParameter<int>("etaBin");
00162 int etaBin2 = parameters_.getParameter<int>("etaBin2");
00163
00164
00165
00166 double phiMin = parameters_.getParameter<double>("phiMin");
00167 double phiMax = parameters_.getParameter<double>("phiMax");
00168 int phiBin = parameters_.getParameter<int>("phiBin");
00169
00170
00171
00172 double rMin = parameters_.getParameter<double>("rMin");
00173 double rMax = parameters_.getParameter<double>("rMax");
00174 int rBin = parameters_.getParameter<int>("rBin");
00175
00176 double zMin = parameters_.getParameter<double>("zMin");
00177 double zMax = parameters_.getParameter<double>("zMax");
00178 int zBin = parameters_.getParameter<int>("zBin");
00179
00180
00181 double etMin = parameters_.getParameter<double>("etMin");
00182 double etMax = parameters_.getParameter<double>("etMax");
00183 int etBin = parameters_.getParameter<int>("etBin");
00184
00185
00186 double step=(etaMax-etaMin)/etaBin;
00187 etaintervals_.push_back(etaMin);
00188 for (int k=1;k<etaBin+1;k++) {
00189 double d=etaMin+k*step;
00190 etaintervals_.push_back(d);
00191 totSimPhoEta_.push_back(0);
00192 totMatchedSimPhoEta_.push_back(0);
00193 }
00194
00195 step=(etaMax-etaMin)/etaBin2;
00196 etaintervalslarge_.push_back(etaMin);
00197 for (int k=1;k<etaBin2+1;k++) {
00198 double d=etaMin+k*step;
00199 etaintervalslarge_.push_back(d);
00200 totSimConvEta_.push_back(0);
00201 totMatchedSimConvEtaTwoTracks_.push_back(0);
00202 totMatchedRecConvEtaTwoTracks_.push_back(0);
00203 totRecAssConvEtaTwoTracks_.push_back(0);
00204
00205 }
00206
00207
00208
00209 step=(phiMax-phiMin)/phiBin;
00210 phiintervals_.push_back(phiMin);
00211 for (int k=1;k<phiBin+1;k++) {
00212 double d=phiMin+k*step;
00213 phiintervals_.push_back(d);
00214 totSimPhoPhi_.push_back(0);
00215 totMatchedSimPhoPhi_.push_back(0);
00216
00217 totSimConvPhi_.push_back(0);
00218 totMatchedSimConvPhiTwoTracks_.push_back(0);
00219 totMatchedRecConvPhiTwoTracks_.push_back(0);
00220 totRecAssConvPhiTwoTracks_.push_back(0);
00221 }
00222 step=(rMax-rMin)/rBin;
00223 rintervals_.push_back(rMin);
00224 for (int k=1;k<rBin+1;k++) {
00225 double d=rMin+k*step;
00226 rintervals_.push_back(d);
00227 totSimConvR_.push_back(0);
00228 totMatchedSimConvRTwoTracks_.push_back(0);
00229 totMatchedRecConvRTwoTracks_.push_back(0);
00230 totRecAssConvRTwoTracks_.push_back(0);
00231
00232 }
00233 step=(zMax-zMin)/zBin;
00234 zintervals_.push_back(zMin);
00235 for (int k=1;k<zBin+1;k++) {
00236 double d=zMin+k*step;
00237 zintervals_.push_back(d);
00238 totSimConvZ_.push_back(0);
00239 totMatchedSimConvZTwoTracks_.push_back(0);
00240 totMatchedRecConvZTwoTracks_.push_back(0);
00241 totRecAssConvZTwoTracks_.push_back(0);
00242
00243 }
00244
00245 step=(etMax-etMin)/etBin;
00246 etintervals_.push_back(etMin);
00247 for (int k=1;k<etBin+1;k++) {
00248 double d=etMin+k*step;
00249 etintervals_.push_back(d);
00250 totSimConvEt_.push_back(0);
00251 totMatchedSimConvEtTwoTracks_.push_back(0);
00252 totMatchedRecConvEtTwoTracks_.push_back(0);
00253 totRecAssConvEtTwoTracks_.push_back(0);
00254 }
00255
00256
00257
00258
00259 }
00260
00261
00262
00263 void PhotonValidator::beginJob( const edm::EventSetup& setup)
00264 {
00265
00266
00267
00268
00269 nEvt_=0;
00270 nEntry_=0;
00271 nRecConv_=0;
00272 nRecConvAss_=0;
00273 nRecConvAssWithEcal_=0;
00274
00275 nInvalidPCA_=0;
00276
00277 dbe_ = 0;
00278 dbe_ = edm::Service<DQMStore>().operator->();
00279
00280
00281 edm::ESHandle<TrackAssociatorBase> theHitsAssociator;
00282 setup.get<TrackAssociatorRecord>().get("TrackAssociatorByHits",theHitsAssociator);
00283 theTrackAssociator_ = (TrackAssociatorBase *) theHitsAssociator.product();
00284
00285
00286 if (dbe_) {
00287 if (verbosity_ > 0 ) {
00288 dbe_->setVerbose(1);
00289 } else {
00290 dbe_->setVerbose(0);
00291 }
00292 }
00293 if (dbe_) {
00294 if (verbosity_ > 0 ) dbe_->showDirStructure();
00295 }
00296
00297
00298
00299 double resMin = parameters_.getParameter<double>("resMin");
00300 double resMax = parameters_.getParameter<double>("resMax");
00301 int resBin = parameters_.getParameter<int>("resBin");
00302
00303 double eMin = parameters_.getParameter<double>("eMin");
00304 double eMax = parameters_.getParameter<double>("eMax");
00305 int eBin = parameters_.getParameter<int>("eBin");
00306
00307 double etMin = parameters_.getParameter<double>("etMin");
00308 double etMax = parameters_.getParameter<double>("etMax");
00309 int etBin = parameters_.getParameter<int>("etBin");
00310
00311 double etaMin = parameters_.getParameter<double>("etaMin");
00312 double etaMax = parameters_.getParameter<double>("etaMax");
00313 int etaBin = parameters_.getParameter<int>("etaBin");
00314 int etaBin2 = parameters_.getParameter<int>("etaBin2");
00315
00316 double dEtaMin = parameters_.getParameter<double>("dEtaMin");
00317 double dEtaMax = parameters_.getParameter<double>("dEtaMax");
00318 int dEtaBin = parameters_.getParameter<int>("dEtaBin");
00319
00320 double phiMin = parameters_.getParameter<double>("phiMin");
00321 double phiMax = parameters_.getParameter<double>("phiMax");
00322 int phiBin = parameters_.getParameter<int>("phiBin");
00323
00324 double dPhiMin = parameters_.getParameter<double>("dPhiMin");
00325 double dPhiMax = parameters_.getParameter<double>("dPhiMax");
00326 int dPhiBin = parameters_.getParameter<int>("dPhiBin");
00327
00328 double rMin = parameters_.getParameter<double>("rMin");
00329 double rMax = parameters_.getParameter<double>("rMax");
00330 int rBin = parameters_.getParameter<int>("rBin");
00331
00332 double zMin = parameters_.getParameter<double>("zMin");
00333 double zMax = parameters_.getParameter<double>("zMax");
00334 int zBin = parameters_.getParameter<int>("zBin");
00335
00336
00337
00338 double r9Min = parameters_.getParameter<double>("r9Min");
00339 double r9Max = parameters_.getParameter<double>("r9Max");
00340 int r9Bin = parameters_.getParameter<int>("r9Bin");
00341
00342 double dPhiTracksMin = parameters_.getParameter<double>("dPhiTracksMin");
00343 double dPhiTracksMax = parameters_.getParameter<double>("dPhiTracksMax");
00344 int dPhiTracksBin = parameters_.getParameter<int>("dPhiTracksBin");
00345
00346 double dEtaTracksMin = parameters_.getParameter<double>("dEtaTracksMin");
00347 double dEtaTracksMax = parameters_.getParameter<double>("dEtaTracksMax");
00348 int dEtaTracksBin = parameters_.getParameter<int>("dEtaTracksBin");
00349
00351 initVectors();
00352
00353
00354
00355 if (dbe_) {
00357
00358
00359 dbe_->setCurrentFolder("Egamma/PhotonValidator/SimulationInfo");
00360
00361 std::string histname = "nOfSimPhotons";
00362 h_nSimPho_ = dbe_->book1D(histname,"# of Sim photons per event ",20,-0.5,19.5);
00363 histname = "SimPhoE";
00364 h_SimPhoE_ = dbe_->book1D(histname,"Sim photon energy spectrum",eBin,eMin,eMax);
00365 histname = "SimPhoEt";
00366 h_SimPhoEt_ = dbe_->book1D(histname,"Sim photon tranverse energy spectrum",etBin,etMin,etMax);
00367 h_SimPhoEta_ = dbe_->book1D("SimPhoEta"," Sim Photon Eta ",etaBin,etaMin, etaMax) ;
00368 h_SimPhoPhi_ = dbe_->book1D("SimPhoPhi"," Sim Photon Phi ",phiBin,phiMin,phiMax) ;
00369
00370 histname = "nOfSimConversions";
00371 h_nSimConv_[0] = dbe_->book1D(histname,"# of Sim conversions per event ",20,-0.5,19.5);
00372 histname = "SimConvE";
00373 h_SimConvE_[0]= dbe_->book1D(histname,"Sim conversions energy spectrum",eBin,eMin,eMax);
00374 histname = "SimConvEt";
00375 h_SimConvEt_[0] = dbe_->book1D(histname,"Sim conversion tranverse energy spectrum",etBin,etMin,etMax);
00376 h_SimConvEta_[0] = dbe_->book1D("SimConvEta"," Sim Conversion Eta ",etaBin,etaMin, etaMax) ;
00377
00378
00379
00380 h_SimConvPhi_[0] = dbe_->book1D("SimConvPhi"," Sim Conversion Phi ",phiBin,phiMin,phiMax) ;
00381 h_SimConvR_[0] = dbe_->book1D("SimConvR"," Sim Conversion Radius ",rBin,rMin,rMax) ;
00382 h_SimConvZ_[0] = dbe_->book1D("SimConvZ"," Sim Conversion Z ",zBin,zMin,zMax) ;
00383
00384 histname = "nOfVisSimConversions";
00385 h_nSimConv_[1] = dbe_->book1D(histname,"# of Sim conversions per event ",20,-0.5,19.5);
00386 histname = "VisSimConvE";
00387 h_SimConvE_[1]= dbe_->book1D(histname,"Sim conversions energy spectrum",eBin,eMin,eMax);
00388 histname = "VisSimConvEt";
00389 h_SimConvEt_[1] = dbe_->book1D(histname,"Visible Sim conversion tranverse energy spectrum",etBin,etMin,etMax);
00390 h_SimConvEta_[1] = dbe_->book1D("VisSimConvEta"," Visible Sim Conversion Eta ",etaBin,etaMin, etaMax) ;
00391
00392 h_SimConvEtaPix_[0] = dbe_->book1D("simConvEtaPix"," sim converted Photon Eta: Pix ",etaBin,etaMin, etaMax) ;
00393
00394
00395 h_SimConvPhi_[1] = dbe_->book1D("VisSimConvPhi"," Visible Sim Conversion Phi ",phiBin,phiMin,phiMax) ;
00396 h_SimConvR_[1] = dbe_->book1D("VisSimConvR"," Visible Sim Conversion Radius ",rBin,rMin,rMax) ;
00397 h_SimConvZ_[1] = dbe_->book1D("VisSimConvZ"," Visible Sim Conversion Z ",zBin,zMin,zMax) ;
00398 h_simTkPt_ = dbe_->book1D("simTkPt","Sim conversion tracks pt ",etBin*3,0.,etMax);
00399 h_simTkEta_ = dbe_->book1D("simTkEta","Sim conversion tracks eta ",etaBin,etaMin,etaMax);
00400
00401
00402 dbe_->setCurrentFolder("Egamma/PhotonValidator/Photons");
00403
00405 histname = "recoEffVsEta";
00406 phoEffEta_ = dbe_->book1D(histname,histname,etaBin,etaMin, etaMax);
00407 histname = "recoEffVsPhi";
00408 phoEffPhi_ = dbe_->book1D(histname,histname,phiBin,phiMin, phiMax);
00409
00410
00411 h_phoEta_[0] = dbe_->book1D("phoEta"," Photon Eta ",etaBin,etaMin, etaMax) ;
00412 h_phoPhi_[0] = dbe_->book1D("phoPhi"," Photon Phi ",phiBin,phiMin,phiMax) ;
00413
00414 h_phoDEta_[0] = dbe_->book1D("phoDEta"," Photon Eta(rec)-Eta(true) ",dEtaBin,dEtaMin, dEtaMax) ;
00415 h_phoDPhi_[0] = dbe_->book1D("phoDPhi"," Photon Phi(rec)-Phi(true) ",dPhiBin,dPhiMin,dPhiMax) ;
00416
00417 h_scEta_[0] = dbe_->book1D("scEta"," SC Eta ",etaBin,etaMin, etaMax);
00418 h_scPhi_[0] = dbe_->book1D("scPhi"," SC Phi ",phiBin,phiMin,phiMax);
00419
00420
00421 histname = "scE";
00422 h_scE_[0][0] = dbe_->book1D(histname+"All"," SC Energy: All Ecal ",eBin,eMin, eMax);
00423 h_scE_[0][1] = dbe_->book1D(histname+"Barrel"," SC Energy: Barrel ",eBin,eMin, eMax);
00424 h_scE_[0][2] = dbe_->book1D(histname+"Endcap"," SC Energy: Endcap ",eBin,eMin, eMax);
00425
00426 histname = "scEt";
00427 h_scEt_[0][0] = dbe_->book1D(histname+"All"," SC Et: All Ecal ",etBin,etMin, etMax) ;
00428 h_scEt_[0][1] = dbe_->book1D(histname+"Barrel"," SC Et: Barrel",etBin,etMin, etMax) ;
00429 h_scEt_[0][2] = dbe_->book1D(histname+"Endcap"," SC Et: Endcap",etBin,etMin, etMax) ;
00430
00431
00432
00433 histname = "r9";
00434 h_r9_[0][0] = dbe_->book1D(histname+"All", " r9: All Ecal",r9Bin,r9Min, r9Max) ;
00435 h_r9_[0][1] = dbe_->book1D(histname+"Barrel"," r9: Barrel ",r9Bin,r9Min, r9Max) ;
00436 h_r9_[0][2] = dbe_->book1D(histname+"Endcap"," r9: Endcap ",r9Bin,r9Min, r9Max) ;
00437
00438 histname = "r9ConvFromMC";
00439 h_r9_[1][0] = dbe_->book1D(histname+"All", " r9: All Ecal",r9Bin,r9Min, r9Max) ;
00440 h_r9_[1][1] = dbe_->book1D(histname+"Barrel"," r9: Barrel ",r9Bin,r9Min, r9Max) ;
00441 h_r9_[1][2] = dbe_->book1D(histname+"Endcap"," r9: Endcap ",r9Bin,r9Min, r9Max) ;
00442
00443 histname = "r9ConvFromReco";
00444 h_r9_[2][0] = dbe_->book1D(histname+"All", " r9: All Ecal",r9Bin,r9Min, r9Max) ;
00445 h_r9_[2][1] = dbe_->book1D(histname+"Barrel"," r9: Barrel ",r9Bin,r9Min, r9Max) ;
00446 h_r9_[2][2] = dbe_->book1D(histname+"Endcap"," r9: Endcap ",r9Bin,r9Min, r9Max) ;
00447
00448 histname="R9VsEta";
00449 h2_r9VsEta_[0] = dbe_->book2D(histname+"All"," All photons r9 vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0.,1.1);
00450 histname="pR9VsEta";
00451 p_r9VsEta_[0] = dbe_->book1D(histname+"All"," All photons r9 vs #eta: all Ecal ",etaBin2,etaMin, etaMax);
00452 histname="R9VsEta";
00453 h2_r9VsEta_[1] = dbe_->book2D(histname+"Unconv"," All photons r9 vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0.,1.1);
00454 histname="pR9VsEta";
00455 p_r9VsEta_[1] = dbe_->book1D(histname+"Unconv"," All photons r9 vs #eta: all Ecal ",etaBin2,etaMin, etaMax);
00456
00457
00458
00459
00460 histname = "phoE";
00461 h_phoE_[0][0]=dbe_->book1D(histname+"All"," Photon Energy: All ecal ", eBin,eMin, eMax);
00462 h_phoE_[0][1]=dbe_->book1D(histname+"Barrel"," Photon Energy: barrel ",eBin,eMin, eMax);
00463 h_phoE_[0][2]=dbe_->book1D(histname+"Endcap"," Photon Energy: Endcap ",eBin,eMin, eMax);
00464
00465 histname = "phoEt";
00466 h_phoEt_[0][0] = dbe_->book1D(histname+"All"," Photon Transverse Energy: All ecal ", etBin,etMin, etMax);
00467 h_phoEt_[0][1] = dbe_->book1D(histname+"Barrel"," Photon Transverse Energy: Barrel ",etBin,etMin, etMax);
00468 h_phoEt_[0][2] = dbe_->book1D(histname+"Endcap"," Photon Transverse Energy: Endcap ",etBin,etMin, etMax);
00469
00470 histname = "eRes";
00471 h_phoERes_[0][0] = dbe_->book1D(histname+"All"," Photon rec/true Energy: All ecal ", resBin,resMin, resMax);
00472 h_phoERes_[0][1] = dbe_->book1D(histname+"Barrel"," Photon rec/true Energy: Barrel ",resBin,resMin, resMax);
00473 h_phoERes_[0][2] = dbe_->book1D(histname+"Endcap"," Photon rec/true Energy: Endcap ",resBin,resMin, resMax);
00474
00475 h_phoERes_[1][0] = dbe_->book1D(histname+"unconvAll"," Photon rec/true Energy if r9>0.93: All ecal ", resBin,resMin, resMax);
00476 h_phoERes_[1][1] = dbe_->book1D(histname+"unconvBarrel"," Photon rec/true Energy if r9>0.93: Barrel ",resBin,resMin, resMax);
00477 h_phoERes_[1][2] = dbe_->book1D(histname+"unconvEndcap"," Photon rec/true Energyif r9>0.93: Endcap ",resBin,resMin, resMax);
00478
00479 h_phoERes_[2][0] = dbe_->book1D(histname+"convAll"," Photon rec/true Energy if r9<0.93: All ecal ", resBin,resMin, resMax);
00480 h_phoERes_[2][1] = dbe_->book1D(histname+"convBarrel"," Photon rec/true Energyif r9<0.93: Barrel ",resBin,resMin, resMax);
00481 h_phoERes_[2][2] = dbe_->book1D(histname+"convEndcap"," Photon rec/true Energyif r9<0.93: Endcap ",resBin,resMin, resMax);
00482
00483 histname="eResVsEta";
00484 h2_eResVsEta_[0] = dbe_->book2D(histname+"All"," All photons E/Etrue vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0., 2.5);
00485 histname="pEResVsEta";
00486 p_eResVsEta_[0] = dbe_->book1D(histname+"All"," All photons E/Etrue vs #eta: all Ecal ",etaBin2,etaMin, etaMax);
00487 histname="eResVsEta";
00488 h2_eResVsEta_[1] = dbe_->book2D(histname+"Unconv"," Unconv photons E/Etrue vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0., 2.5);
00489 histname="pEResVsEta";
00490 p_eResVsEta_[1] = dbe_->book1D(histname+"Unconv"," Unconv photons E/Etrue vs #eta: all Ecal ",etaBin2,etaMin, etaMax);
00491
00492
00493
00494 dbe_->setCurrentFolder("Egamma/PhotonValidator/ConversionInfo");
00495
00496 histname = "convEffVsEtaTwoTracks";
00497 convEffEtaTwoTracks_ = dbe_->book1D(histname,histname,etaBin2,etaMin, etaMax);
00498 histname = "convEffVsEtTwoTracks";
00499 convEffEtTwoTracks_ = dbe_->book1D(histname,histname,etBin,etMin, etMax);
00500 histname = "convEffVsPhiTwoTracks";
00501 convEffPhiTwoTracks_ = dbe_->book1D(histname,histname,phiBin,phiMin,phiMax);
00502 histname = "convEffVsRTwoTracks";
00503 convEffRTwoTracks_ = dbe_->book1D(histname,histname,rBin,rMin, rMax);
00504 histname = "convEffVsZTwoTracks";
00505 convEffZTwoTracks_ = dbe_->book1D(histname,histname,zBin,zMin,zMax);
00506
00507
00508 histname = "convFakeRateVsEtaTwoTracks";
00509 convFakeRateEtaTwoTracks_ = dbe_->book1D(histname,histname,etaBin2,etaMin, etaMax);
00510 histname = "convFakeRateVsPhiTwoTracks";
00511 convFakeRatePhiTwoTracks_ = dbe_->book1D(histname,histname,phiBin,phiMin,phiMax);
00512 histname = "convFakeRateVsRTwoTracks";
00513 convFakeRateRTwoTracks_ = dbe_->book1D(histname,histname,rBin,rMin, rMax);
00514 histname = "convFakeRateVsZTwoTracks";
00515 convFakeRateZTwoTracks_ = dbe_->book1D(histname,histname,zBin,zMin,zMax);
00516 histname = "convFakeRateVsEtTwoTracks";
00517 convFakeRateEtTwoTracks_ = dbe_->book1D(histname,histname,etBin,etMin, etMax);
00518
00519
00520 histname="nConv";
00521 h_nConv_[0][0] = dbe_->book1D(histname+"All","Number Of Conversions per isolated candidates per events: All Ecal ",10,-0.5, 9.5);
00522 h_nConv_[0][1] = dbe_->book1D(histname+"Barrel","Number Of Conversions per isolated candidates per events: Ecal Barrel ",10,-0.5, 9.5);
00523 h_nConv_[0][2] = dbe_->book1D(histname+"Endcap","Number Of Conversions per isolated candidates per events: Ecal Endcap ",10,-0.5, 9.5);
00524
00525 h_convEta_[0] = dbe_->book1D("convEta"," converted Photon Eta ",etaBin,etaMin, etaMax) ;
00526 h_convPhi_[0] = dbe_->book1D("convPhi"," converted Photon Phi ",phiBin,phiMin,phiMax) ;
00527
00528 histname = "convERes";
00529 h_convERes_[0][0] = dbe_->book1D(histname+"All"," Conversion rec/true Energy: All ecal ", resBin,resMin, resMax);
00530 h_convERes_[0][1] = dbe_->book1D(histname+"Barrel"," Conversion rec/true Energy: Barrel ",resBin,resMin, resMax);
00531 h_convERes_[0][2] = dbe_->book1D(histname+"Endcap"," Conversion rec/true Energy: Endcap ",resBin,resMin, resMax);
00532 histname = "convPRes";
00533 h_convPRes_[1][0] = dbe_->book1D(histname+"All"," Conversion rec/true Energy: All ecal ", resBin,resMin, resMax);
00534 h_convPRes_[1][1] = dbe_->book1D(histname+"Barrel"," Conversion rec/true Energy: Barrel ",resBin,resMin, resMax);
00535 h_convPRes_[1][2] = dbe_->book1D(histname+"Endcap"," Conversion rec/true Energy: Endcap ",resBin,resMin, resMax);
00536
00537
00538
00539 histname="r9VsTracks";
00540 h_r9VsNofTracks_[0][0] = dbe_->book2D(histname+"All"," photons r9 vs nTracks from conversions: All Ecal",r9Bin,r9Min, r9Max, 3, -0.5, 2.5) ;
00541 h_r9VsNofTracks_[0][1] = dbe_->book2D(histname+"Barrel"," photons r9 vs nTracks from conversions: Barrel Ecal",r9Bin,r9Min, r9Max, 3, -0.5, 2.5) ;
00542 h_r9VsNofTracks_[0][2] = dbe_->book2D(histname+"Endcap"," photons r9 vs nTracks from conversions: Endcap Ecal",r9Bin,r9Min, r9Max, 3, -0.5, 2.5) ;
00543
00544 histname="EoverPtracks";
00545 h_EoverPTracks_[1][0] = dbe_->book1D(histname+"All"," photons conversion E/p: all Ecal ",100, 0., 5.);
00546 h_EoverPTracks_[1][1] = dbe_->book1D(histname+"Barrel"," photons conversion E/p: Barrel Ecal",100, 0., 5.);
00547 h_EoverPTracks_[1][2] = dbe_->book1D(histname+"Endcap"," photons conversion E/p: Endcap Ecal ",100, 0., 5.);
00548
00549 histname="PoverEtracks";
00550 h_PoverETracks_[1][0] = dbe_->book1D(histname+"All"," photons conversion p/E: all Ecal ",100, 0., 5.);
00551 h_PoverETracks_[1][1] = dbe_->book1D(histname+"Barrel"," photons conversion p/E: Barrel Ecal",100, 0., 5.);
00552 h_PoverETracks_[1][2] = dbe_->book1D(histname+"Endcap"," photons conversion p/E: Endcap Ecal ",100, 0., 5.);
00553
00554
00555
00556 histname="EoverEtrueVsEoverP";
00557 h2_EoverEtrueVsEoverP_[0] = dbe_->book2D(histname+"All"," photons conversion E/Etrue vs E/P: all Ecal ",100, 0., 5., 100, 0.5, 1.5);
00558 h2_EoverEtrueVsEoverP_[1] = dbe_->book2D(histname+"Barrel"," photons conversion E/Etrue vs E/: Barrel Ecal",100, 0., 5.,100, 0.5, 1.5);
00559 h2_EoverEtrueVsEoverP_[2] = dbe_->book2D(histname+"Endcap"," photons conversion E/Etrue vs E/: Endcap Ecal ",100, 0., 5., 100, 0.5, 1.5);
00560 histname="PoverPtrueVsEoverP";
00561 h2_PoverPtrueVsEoverP_[0] = dbe_->book2D(histname+"All"," photons conversion P/Ptrue vs E/P: all Ecal ",100, 0., 5., 100, 0., 2.5);
00562 h2_PoverPtrueVsEoverP_[1] = dbe_->book2D(histname+"Barrel"," photons conversion P/Ptrue vs E/: Barrel Ecal",100, 0., 5.,100, 0., 2.5);
00563 h2_PoverPtrueVsEoverP_[2] = dbe_->book2D(histname+"Endcap"," photons conversion P/Ptrue vs E/: Endcap Ecal ",100, 0., 5., 100, 0., 2.5);
00564
00565 histname="EoverEtrueVsEta";
00566 h2_EoverEtrueVsEta_[0] = dbe_->book2D(histname+"All"," photons conversion with 2 (associated) reco tracks E/Etrue vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0., 2.5);
00567 histname="pEoverEtrueVsEta";
00568 p_EoverEtrueVsEta_[0] = dbe_->book1D(histname+"All"," photons conversion with 2 (associated) reco tracks E/Etrue vs #eta: all Ecal ",etaBin2,etaMin, etaMax);
00569
00570 histname="EoverEtrueVsEta";
00571 h2_EoverEtrueVsEta_[1] = dbe_->book2D(histname+"All2"," photons conversion 2 reco tracks E/Etrue vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0., 2.5);
00572 histname="pEoverEtrueVsEta";
00573 p_EoverEtrueVsEta_[1] = dbe_->book1D(histname+"All2"," photons conversion 2 reco tracks E/Etrue vs #eta: all Ecal ",etaBin2,etaMin, etaMax);
00574
00575
00576 histname="EoverEtrueVsR";
00577 h2_EoverEtrueVsR_[0] = dbe_->book2D(histname+"All"," photons conversion E/Etrue vs R: all Ecal ",rBin,rMin, rMax,100, 0., 2.5);
00578 histname="pEoverEtrueVsR";
00579 p_EoverEtrueVsR_[0] = dbe_->book1D(histname+"All"," photons conversion E/Etrue vs R: all Ecal ",rBin,rMin,rMax);
00580
00581
00582
00583 histname="PoverPtrueVsEta";
00584 h2_PoverPtrueVsEta_[0] = dbe_->book2D(histname+"All"," photons conversion P/Ptrue vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0., 5.);
00585 histname="pPoverPtrueVsEta";
00586 p_PoverPtrueVsEta_[0] = dbe_->book1D(histname+"All"," photons conversion P/Ptrue vs #eta: all Ecal ",etaBin2,etaMin, etaMax);
00587
00588 histname="EoverPVsEta";
00589 h2_EoverPVsEta_[0] = dbe_->book2D(histname+"All"," photons conversion E/P vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0., 5.);
00590 histname="pEoverPVsEta";
00591 p_EoverPVsEta_[0] = dbe_->book1D(histname+"All"," photons conversion E/P vs #eta: all Ecal ",etaBin2,etaMin, etaMax);
00592
00593 histname="EoverPVsR";
00594 h2_EoverPVsR_[0] = dbe_->book2D(histname+"All"," photons conversion E/P vs R: all Ecal ",rBin,rMin, rMax,100, 0., 5.);
00595 histname="pEoverPVsR";
00596 p_EoverPVsR_[0] = dbe_->book1D(histname+"All"," photons conversion E/P vs R: all Ecal ",rBin,rMin,rMax);
00597
00598
00599
00600
00601 histname="hInvMass";
00602 h_invMass_[0][0]= dbe_->book1D(histname+"All_AllTracks"," Photons:Tracks from conversion: Pair invariant mass: all Ecal ",100, 0., 1.5);
00603 h_invMass_[0][1]= dbe_->book1D(histname+"Barrel_AllTracks"," Photons:Tracks from conversion: Pair invariant mass: Barrel Ecal ",100, 0., 1.5);
00604 h_invMass_[0][2]= dbe_->book1D(histname+"Endcap_AllTracks"," Photons:Tracks from conversion: Pair invariant mass: Endcap Ecal ",100, 0., 1.5);
00605 histname="hInvMass";
00606 h_invMass_[1][0]= dbe_->book1D(histname+"All_AssTracks"," Photons:Tracks from conversion: Pair invariant mass: all Ecal ",100, 0., 1.5);
00607 h_invMass_[1][1]= dbe_->book1D(histname+"Barrel_AssTracks"," Photons:Tracks from conversion: Pair invariant mass: Barrel Ecal ",100, 0., 1.5);
00608 h_invMass_[1][2]= dbe_->book1D(histname+"Endcap_AssTracks"," Photons:Tracks from conversion: Pair invariant mass: Endcap Ecal ",100, 0., 1.5);
00609
00610
00611 histname="hDPhiTracksAtVtx";
00612 h_DPhiTracksAtVtx_[1][0] =dbe_->book1D(histname+"All", " Photons:Tracks from conversions: #delta#phi Tracks at vertex: all Ecal",dPhiTracksBin,dPhiTracksMin,dPhiTracksMax);
00613 h_DPhiTracksAtVtx_[1][1] =dbe_->book1D(histname+"Barrel", " Photons:Tracks from conversions: #delta#phi Tracks at vertex: Barrel Ecal",dPhiTracksBin,dPhiTracksMin,dPhiTracksMax);
00614 h_DPhiTracksAtVtx_[1][2] =dbe_->book1D(histname+"Endcap", " Photons:Tracks from conversions: #delta#phi Tracks at vertex: Endcap Ecal",dPhiTracksBin,dPhiTracksMin,dPhiTracksMax);
00615
00616 histname="hDPhiTracksAtVtxVsEta";
00617 h2_DPhiTracksAtVtxVsEta_ = dbe_->book2D(histname+"All"," Photons:Tracks from conversions: #delta#phi Tracks at vertex vs #eta",etaBin2,etaMin, etaMax,100, -0.5, 0.5);
00618 histname="pDPhiTracksAtVtxVsEta";
00619 p_DPhiTracksAtVtxVsEta_ = dbe_->book1D(histname+"All"," Photons:Tracks from conversions: #delta#phi Tracks at vertex vs #eta ",etaBin2,etaMin, etaMax);
00620
00621 histname="hDPhiTracksAtVtxVsR";
00622 h2_DPhiTracksAtVtxVsR_ = dbe_->book2D(histname+"All"," Photons:Tracks from conversions: #delta#phi Tracks at vertex vs R",rBin,rMin, rMax,100, -0.5, 0.5);
00623 histname="pDPhiTracksAtVtxVsR";
00624 p_DPhiTracksAtVtxVsR_ = dbe_->book1D(histname+"All"," Photons:Tracks from conversions: #delta#phi Tracks at vertex vs R ",rBin,rMin, rMax);
00625
00626
00627
00628
00629 histname="hDCotTracks";
00630 h_DCotTracks_[1][0]= dbe_->book1D(histname+"All"," Photons:Tracks from conversions #delta cotg(#Theta) Tracks: all Ecal ",dEtaTracksBin,dEtaTracksMin,dEtaTracksMax);
00631 h_DCotTracks_[1][1]= dbe_->book1D(histname+"Barrel"," Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Barrel Ecal ",dEtaTracksBin,dEtaTracksMin,dEtaTracksMax);
00632 h_DCotTracks_[1][2]= dbe_->book1D(histname+"Encap"," Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Endcap Ecal ",dEtaTracksBin,dEtaTracksMin,dEtaTracksMax);
00633
00634 histname="hDCotTracksVsEta";
00635 h2_DCotTracksVsEta_ = dbe_->book2D(histname+"All"," Photons:Tracks from conversions: #delta cotg(#Theta) Tracks vs #eta",etaBin2,etaMin, etaMax,100, -0.2, 0.2);
00636 histname="pDCotTracksVsEta";
00637 p_DCotTracksVsEta_ = dbe_->book1D(histname+"All"," Photons:Tracks from conversions: #delta cotg(#Theta) Tracks vs #eta ",etaBin2,etaMin, etaMax);
00638
00639 histname="hDCotTracksVsR";
00640 h2_DCotTracksVsR_ = dbe_->book2D(histname+"All"," Photons:Tracks from conversions: #delta cotg(#Theta) Tracks at vertex vs R",rBin,rMin, rMax,100, -0.2, 0.2);
00641 histname="pDCotTracksVsR";
00642 p_DCotTracksVsR_ = dbe_->book1D(histname+"All"," Photons:Tracks from conversions: #delta cotg(#Theta) Tracks at vertex vs R ",rBin,rMin, rMax);
00643
00644
00645 histname="hDistMinAppTracks";
00646 h_distMinAppTracks_[1][0]= dbe_->book1D(histname+"All"," Photons:Tracks from conversions Min Approach Dist Tracks: all Ecal ",dEtaTracksBin,-0.1,0.6);
00647 h_distMinAppTracks_[1][1]= dbe_->book1D(histname+"Barrel"," Photons:Tracks from conversions Min Approach Dist Tracks: Barrel Ecal ",dEtaTracksBin,-0.1,0.6);
00648 h_distMinAppTracks_[1][2]= dbe_->book1D(histname+"Encap"," Photons:Tracks from conversions Min Approach Dist Tracks: Endcap Ecal ",dEtaTracksBin,-0.1,0.6);
00649
00650
00651
00652 histname="hDPhiTracksAtEcal";
00653 h_DPhiTracksAtEcal_[1][0]= dbe_->book1D(histname+"All"," Photons:Tracks from conversions: #delta#phi at Ecal : all Ecal ",dPhiTracksBin,0.,dPhiTracksMax);
00654 h_DPhiTracksAtEcal_[1][1]= dbe_->book1D(histname+"Barrel"," Photons:Tracks from conversions: #delta#phi at Ecal : Barrel Ecal ",dPhiTracksBin,0.,dPhiTracksMax);
00655 h_DPhiTracksAtEcal_[1][2]= dbe_->book1D(histname+"Endcap"," Photons:Tracks from conversions: #delta#phi at Ecal : Endcap Ecal ",dPhiTracksBin,0.,dPhiTracksMax);
00656 histname="h2_DPhiTracksAtEcalVsR";
00657 h2_DPhiTracksAtEcalVsR_= dbe_->book2D(histname+"All"," Photons:Tracks from conversions: #delta#phi at Ecal vs R : all Ecal ",rBin,rMin, rMax, dPhiTracksBin,0.,dPhiTracksMax);
00658 histname="pDPhiTracksAtEcalVsR";
00659 p_DPhiTracksAtEcalVsR_ = dbe_->book1D(histname+"All"," Photons:Tracks from conversions: #delta#phi at Ecal vs R ",rBin,rMin, rMax);
00660
00661 histname="h2_DPhiTracksAtEcalVsEta";
00662 h2_DPhiTracksAtEcalVsEta_= dbe_->book2D(histname+"All"," Photons:Tracks from conversions: #delta#phi at Ecal vs #eta : all Ecal ",etaBin2,etaMin, etaMax, dPhiTracksBin,0.,dPhiTracksMax);
00663 histname="pDPhiTracksAtEcalVsEta";
00664 p_DPhiTracksAtEcalVsEta_ = dbe_->book1D(histname+"All"," Photons:Tracks from conversions: #delta#phi at Ecal vs #eta ",etaBin2,etaMin, etaMax);
00665
00666
00667
00668 histname="hDEtaTracksAtEcal";
00669 h_DEtaTracksAtEcal_[1][0]= dbe_->book1D(histname+"All"," Photons:Tracks from conversions: #delta#eta at Ecal : all Ecal ",dEtaTracksBin,dEtaTracksMin,dEtaTracksMax);
00670 h_DEtaTracksAtEcal_[1][1]= dbe_->book1D(histname+"Barrel"," Photons:Tracks from conversions: #delta#eta at Ecal : Barrel Ecal ",dEtaTracksBin,dEtaTracksMin,dEtaTracksMax);
00671 h_DEtaTracksAtEcal_[1][2]= dbe_->book1D(histname+"Endcap"," Photons:Tracks from conversions: #delta#eta at Ecal : Endcap Ecal ",dEtaTracksBin,dEtaTracksMin,dEtaTracksMax);
00672
00673
00674 h_convVtxRvsZ_[0] = dbe_->book2D("convVtxRvsZAll"," Photon Reco conversion vtx position",100, 0., 280.,200,0., 80.);
00675 h_convVtxRvsZ_[1] = dbe_->book2D("convVtxRvsZBarrel"," Photon Reco conversion vtx position",100, 0., 280.,200,0., 80.);
00676 h_convVtxRvsZ_[2] = dbe_->book2D("convVtxRvsZEndcap"," Photon Reco conversion vtx position",100, 0., 280.,200,0., 80.);
00677
00678 h_convVtxdX_ = dbe_->book1D("convVtxdX"," Photon Reco conversion vtx dX",100, -20.,20.);
00679 h_convVtxdY_ = dbe_->book1D("convVtxdY"," Photon Reco conversion vtx dY",100, -20.,20.);
00680 h_convVtxdZ_ = dbe_->book1D("convVtxdZ"," Photon Reco conversion vtx dZ",100, -20.,20.);
00681 h_convVtxdR_ = dbe_->book1D("convVtxdR"," Photon Reco conversion vtx dR",100, -20.,20.);
00682 h2_convVtxdRVsR_ = dbe_->book2D("h2ConvVtxdRVsR","Photon Reco conversion vtx dR vsR" ,rBin,rMin, rMax,100, -20.,20.);
00683 p_convVtxdRVsR_ = dbe_->book1D("pConvVtxdRVsR","Photon Reco conversion vtx dR vsR" ,rBin,rMin, rMax);
00684
00685
00686 h_zPVFromTracks_[1] = dbe_->book1D("zPVFromTracks"," Photons: PV z from conversion tracks",100, -25., 25.);
00687 h_dzPVFromTracks_[1] = dbe_->book1D("dzPVFromTracks"," Photons: PV Z_rec - Z_true from conversion tracks",100, -5., 5.);
00688 h2_dzPVVsR_ = dbe_->book2D("h2dzPVVsR","Photon Reco conversions: dz(PV) vs R" ,rBin,rMin, rMax,100, -3.,3.);
00689 p_dzPVVsR_ = dbe_->book1D("pdzPVVsR","Photon Reco conversions: dz(PV) vs R" ,rBin,rMin, rMax);
00690
00691
00692
00694 histname="nHitsVsEta";
00695 nHitsVsEta_[0] = dbe_->book2D(histname+"AllTracks","Photons:Tracks from conversions: # of hits vs #eta all tracks",etaBin,etaMin, etaMax,25,0., 25.);
00696 histname="h_nHitsVsEta";
00697 h_nHitsVsEta_[0] = dbe_->book1D(histname+"AllTracks","Photons:Tracks from conversions: # of hits vs #eta all tracks",etaBin,etaMin, etaMax);
00698
00699 histname="nHitsVsEta";
00700 nHitsVsEta_[1] = dbe_->book2D(histname+"AssTracks","Photons:Tracks from conversions: # of hits vs #eta associated tracks",etaBin,etaMin, etaMax,25,0., 25.);
00701 histname="h_nHitsVsEta";
00702 h_nHitsVsEta_[1] = dbe_->book1D(histname+"AssTracks","Photons:Tracks from conversions: # of hits vs #eta associated tracks",etaBin,etaMin, etaMax);
00703
00704
00705 histname="nHitsVsR";
00706 nHitsVsR_[0] = dbe_->book2D(histname+"AllTracks","Photons:Tracks from conversions: # of hits vs radius all tracks" ,rBin,rMin, rMax,25,0.,25);
00707 histname="h_nHitsVsR";
00708 h_nHitsVsR_[0] = dbe_->book1D(histname+"AllTracks","Photons:Tracks from conversions: # of hits vs radius all tracks",rBin,rMin, rMax);
00709 histname="tkChi2";
00710 h_tkChi2_[0] = dbe_->book1D(histname+"AllTracks","Photons:Tracks from conversions: #chi^{2} of all tracks", 100, 0., 20.0);
00711
00712 histname="nHitsVsR";
00713 nHitsVsR_[1] = dbe_->book2D(histname+"AssTracks","Photons:Tracks from conversions: # of hits vs radius associated tracks" ,rBin,rMin, rMax,25,0.,25);
00714 histname="h_nHitsVsR";
00715 h_nHitsVsR_[1] = dbe_->book1D(histname+"AssTracks","Photons:Tracks from conversions: # of hits vs radius associated tracks",rBin,rMin, rMax);
00716
00717 histname="tkChi2";
00718 h_tkChi2_[1] = dbe_->book1D(histname+"AssTracks","Photons:Tracks from conversions: #chi^{2} of associated tracks", 100, 0., 20.0);
00719 histname="h2Chi2VsEta";
00720 h2_Chi2VsEta_[0]=dbe_->book2D(histname+"All"," Reco Track #chi^{2} vs #eta: All ",etaBin2,etaMin, etaMax,100, 0., 20.);
00721 histname="pChi2VsEta";
00722 p_Chi2VsEta_[0]=dbe_->book1D(histname+"All"," Reco Track #chi^{2} vs #eta : All ",etaBin2,etaMin, etaMax);
00723
00724 histname="h2Chi2VsR";
00725 h2_Chi2VsR_[0]=dbe_->book2D(histname+"All"," Reco Track #chi^{2} vs R: All ",rBin,rMin, rMax,100, 0., 20.);
00726 histname="pChi2VsR";
00727 p_Chi2VsR_[0]=dbe_->book1D(histname+"All"," Reco Track #chi^{2} vas R : All ",rBin,rMin,rMax);
00728
00729
00730
00731 histname="hTkD0";
00732 h_TkD0_[0]=dbe_->book1D(histname+"All"," Reco Track D0*q: All ",100,-0.1,0.6);
00733 h_TkD0_[1]=dbe_->book1D(histname+"Barrel"," Reco Track D0*q: Barrel ",100,-0.1,0.6);
00734 h_TkD0_[2]=dbe_->book1D(histname+"Endcap"," Reco Track D0*q: Endcap ",100,-0.1,0.6);
00735
00736
00737
00738 histname="hTkPtPull";
00739 h_TkPtPull_[0]=dbe_->book1D(histname+"All"," Reco Track Pt pull: All ",100, -10., 10.);
00740 histname="hTkPtPull";
00741 h_TkPtPull_[1]=dbe_->book1D(histname+"Barrel"," Reco Track Pt pull: Barrel ",100, -10., 10.);
00742 histname="hTkPtPull";
00743 h_TkPtPull_[2]=dbe_->book1D(histname+"Endcap"," Reco Track Pt pull: Endcap ",100, -10., 10.);
00744
00745 histname="h2TkPtPullEta";
00746 h2_TkPtPull_[0]=dbe_->book2D(histname+"All"," Reco Track Pt pull: All ",etaBin2,etaMin, etaMax,100, -10., 10.);
00747 histname="pTkPtPullEta";
00748 p_TkPtPull_[0]=dbe_->book1D(histname+"All"," Reco Track Pt pull: All ",etaBin2,etaMin, etaMax);
00749
00750
00751 histname="PtRecVsPtSim";
00752 h2_PtRecVsPtSim_[0]=dbe_->book2D(histname+"All", "Pt Rec vs Pt sim: All ", etBin,etMin,etMax,etBin,etMin, etMax);
00753 h2_PtRecVsPtSim_[1]=dbe_->book2D(histname+"Barrel", "Pt Rec vs Pt sim: Barrel ", etBin,etMin,etMax,etBin,etMin, etMax);
00754 h2_PtRecVsPtSim_[2]=dbe_->book2D(histname+"Endcap", "Pt Rec vs Pt sim: Endcap ", etBin,etMin,etMax,etBin,etMin, etMax);
00755
00756
00757 histname="eBcOverTkPout";
00758 hBCEnergyOverTrackPout_[0] = dbe_->book1D(histname+"All","Matrching BC E/P_out: all Ecal ",100, 0., 5.);
00759 hBCEnergyOverTrackPout_[1] = dbe_->book1D(histname+"Barrel","Matrching BC E/P_out: Barrel ",100, 0., 5.);
00760 hBCEnergyOverTrackPout_[2] = dbe_->book1D(histname+"Endcap","Matrching BC E/P_out: Endcap ",100, 0., 5.);
00761
00762
00763
00764
00765 }
00766
00767
00768 return ;
00769 }
00770
00771
00772
00773
00774
00775 void PhotonValidator::analyze( const edm::Event& e, const edm::EventSetup& esup )
00776 {
00777
00778
00779 using namespace edm;
00780 const float etaPhiDistance=0.01;
00781
00782 const float TRK_BARL =0.9;
00783 const float BARL = 1.4442;
00784 const float END_LO = 1.566;
00785 const float END_HI = 2.5;
00786
00787 const Float_t mElec= 0.000511;
00788
00789
00790 nEvt_++;
00791 LogInfo("PhotonValidator") << "PhotonValidator Analyzing event number: " << e.id() << " Global Counter " << nEvt_ <<"\n";
00792
00793 std::cout << "PhotonValidator Analyzing event number: " << e.id() << " Global Counter " << nEvt_ <<"\n";
00794
00795
00796
00797 edm::ESHandle<CaloTopology> pTopology;
00798 esup.get<CaloTopologyRecord>().get(theCaloTopo_);
00799 const CaloTopology *topology = theCaloTopo_.product();
00800
00801
00802 esup.get<CaloGeometryRecord>().get(theCaloGeom_);
00803
00804
00805
00806 edm::ESHandle<TransientTrackBuilder> theTTB;
00807 esup.get<TransientTrackRecord>().get("TransientTrackBuilder",theTTB);
00808
00809
00811 Handle<reco::PhotonCollection> photonHandle;
00812 e.getByLabel(photonCollectionProducer_, photonCollection_ , photonHandle);
00813 const reco::PhotonCollection photonCollection = *(photonHandle.product());
00814 if (!photonHandle.isValid()) {
00815 edm::LogError("PhotonProducer") << "Error! Can't get the Photon collection "<< std::endl;
00816 return;
00817 }
00818
00819
00821 Handle< edm::View<reco::Track> > outInTrkHandle;
00822 e.getByLabel(conversionOITrackProducer_, outInTrkHandle);
00823
00824
00826 Handle< edm::View<reco::Track> > inOutTrkHandle;
00827 e.getByLabel(conversionIOTrackProducer_, inOutTrkHandle);
00828
00829
00830
00831
00832
00834
00835 std::vector<SimTrack> theSimTracks;
00836 std::vector<SimVertex> theSimVertices;
00837
00838 edm::Handle<SimTrackContainer> SimTk;
00839 edm::Handle<SimVertexContainer> SimVtx;
00840 e.getByLabel("g4SimHits",SimTk);
00841 e.getByLabel("g4SimHits",SimVtx);
00842
00843 theSimTracks.insert(theSimTracks.end(),SimTk->begin(),SimTk->end());
00844 theSimVertices.insert(theSimVertices.end(),SimVtx->begin(),SimVtx->end());
00845 std::vector<PhotonMCTruth> mcPhotons=thePhotonMCTruthFinder_->find (theSimTracks, theSimVertices);
00846
00847
00848 edm::Handle<TrackingParticleCollection> ElectronTPHandle;
00849 e.getByLabel(label_tp_,ElectronTPHandle);
00850
00851 const TrackingParticleCollection trackingParticles = *(ElectronTPHandle.product());
00852
00854 std::vector<reco::PhotonCollection::const_iterator> StoRMatchedConvertedPhotons;
00855
00856 reco::SimToRecoCollection OISimToReco = theTrackAssociator_->associateSimToReco(outInTrkHandle, ElectronTPHandle, &e);
00857 reco::SimToRecoCollection IOSimToReco = theTrackAssociator_->associateSimToReco(inOutTrkHandle, ElectronTPHandle, &e);
00858
00859 reco::RecoToSimCollection OIRecoToSim = theTrackAssociator_->associateRecoToSim(outInTrkHandle, ElectronTPHandle, &e);
00860 reco::RecoToSimCollection IORecoToSim = theTrackAssociator_->associateRecoToSim(inOutTrkHandle, ElectronTPHandle, &e);
00861
00862 vector<reco::SimToRecoCollection*> StoRCollPtrs;
00863 StoRCollPtrs.push_back(&OISimToReco);
00864 StoRCollPtrs.push_back(&IOSimToReco);
00865 vector<reco::RecoToSimCollection*> RtoSCollPtrs;
00866 RtoSCollPtrs.push_back(&OIRecoToSim);
00867 RtoSCollPtrs.push_back(&IORecoToSim);
00868
00869
00870 nSimPho_=0;
00871 nSimConv_[0]=0;
00872 nSimConv_[1]=0;
00873 for ( std::vector<PhotonMCTruth>::const_iterator mcPho=mcPhotons.begin(); mcPho !=mcPhotons.end(); mcPho++) {
00874 if ( (*mcPho).fourMomentum().et() < minPhoEtCut_ ) continue;
00875
00876 float mcPhi= (*mcPho).fourMomentum().phi();
00877 mcPhi_= phiNormalization(mcPhi);
00878 mcEta_= (*mcPho).fourMomentum().pseudoRapidity();
00879 mcEta_ = etaTransformation(mcEta_, (*mcPho).primaryVertex().z() );
00880
00881 mcConvR_= (*mcPho).vertex().perp();
00882 mcConvX_= (*mcPho).vertex().x();
00883 mcConvY_= (*mcPho).vertex().y();
00884 mcConvZ_= (*mcPho).vertex().z();
00885
00886
00887
00888
00889 if ( ! ( fabs(mcEta_) <= BARL || ( fabs(mcEta_) >= END_LO && fabs(mcEta_) <=END_HI ) ) )
00890 continue;
00891
00892
00893 nSimPho_++;
00894 h_SimPhoE_->Fill( (*mcPho).fourMomentum().e());
00895 h_SimPhoEt_->Fill( (*mcPho).fourMomentum().et());
00896 h_SimPhoEta_->Fill( mcEta_ ) ;
00897 h_SimPhoPhi_->Fill( mcPhi_ );
00898
00899 for (unsigned int f=0; f<etaintervals_.size()-1; f++){
00900 if (mcEta_>etaintervals_[f]&&
00901 mcEta_<etaintervals_[f+1]) {
00902 totSimPhoEta_[f]++;
00903 }
00904 }
00905 for (unsigned int f=0; f<phiintervals_.size()-1; f++){
00906 if (mcPhi_>phiintervals_[f]&&
00907 mcPhi_<phiintervals_[f+1]) {
00908 totSimPhoPhi_[f]++;
00909 }
00910 }
00911
00912
00914
00915 bool goodSimConversion=false;
00916 bool visibleConversion=false;
00917 bool visibleConversionsWithTwoSimTracks=false;
00918 if ( (*mcPho).isAConversion() == 1 ) {
00919 nSimConv_[0]++;
00920 h_SimConvE_[0]->Fill( (*mcPho).fourMomentum().e());
00921 h_SimConvEt_[0]->Fill( (*mcPho).fourMomentum().et());
00922 h_SimConvEta_[0]->Fill( mcEta_ ) ;
00923
00924 if ( mcConvR_ <15) h_SimConvEtaPix_[0]->Fill( mcEta_ ) ;
00925
00926 h_SimConvPhi_[0]->Fill( mcPhi_ );
00927 h_SimConvR_[0]->Fill( mcConvR_ );
00928 h_SimConvZ_[0]->Fill( mcConvZ_ );
00929
00930 if ( ( fabs(mcEta_) <= BARL && mcConvR_ <85 ) ||
00931 ( fabs(mcEta_) > BARL && fabs(mcEta_) <=END_HI && fabs( (*mcPho).vertex().z() ) < 210 ) ) visibleConversion=true;
00932
00933
00934
00935 theConvTP_.clear();
00936 std::cout << " PhotonValidator TrackingParticles TrackingParticleCollection size "<< trackingParticles.size() << "\n";
00937 for(size_t i = 0; i < trackingParticles.size(); ++i){
00938 TrackingParticleRef tp (ElectronTPHandle,i);
00939
00940
00941
00942
00943 if ( fabs( tp->vx() - (*mcPho).vertex().x() ) < 0.001 &&
00944 fabs( tp->vy() - (*mcPho).vertex().y() ) < 0.001 &&
00945 fabs( tp->vz() - (*mcPho).vertex().z() ) < 0.001) {
00946
00947
00948
00949
00950 theConvTP_.push_back( tp );
00951 }
00952 }
00953
00954
00955 if ( theConvTP_.size() == 2 ) visibleConversionsWithTwoSimTracks=true;
00956 goodSimConversion=false;
00957
00958 if ( visibleConversion && visibleConversionsWithTwoSimTracks ) goodSimConversion=true;
00959 if ( goodSimConversion ) {
00960 nSimConv_[1]++;
00961 h_SimConvE_[1]->Fill( (*mcPho).fourMomentum().e());
00962 h_SimConvEt_[1]->Fill( (*mcPho).fourMomentum().et());
00963 h_SimConvEta_[1]->Fill( mcEta_ ) ;
00964 h_SimConvPhi_[1]->Fill( mcPhi_ );
00965 h_SimConvR_[1]->Fill( mcConvR_ );
00966 h_SimConvZ_[1]->Fill( mcConvZ_ );
00967
00968 for ( vector<TrackingParticleRef>::iterator iTrk=theConvTP_.begin(); iTrk!=theConvTP_.end(); ++iTrk) {
00969 h_simTkPt_ -> Fill ( (*iTrk)->pt() );
00970 h_simTkEta_ -> Fill ( (*iTrk)->eta() );
00971
00972 }
00973
00975 for (unsigned int f=0; f<etaintervalslarge_.size()-1; f++){
00976 if (mcEta_>etaintervalslarge_[f]&&
00977 mcEta_<etaintervalslarge_[f+1]) {
00978 totSimConvEta_[f]++;
00979 }
00980 }
00981 for (unsigned int f=0; f<phiintervals_.size()-1; f++){
00982 if (mcPhi_>phiintervals_[f]&&
00983 mcPhi_<phiintervals_[f+1]) {
00984 totSimConvPhi_[f]++;
00985 }
00986 }
00987 for (unsigned int f=0; f<rintervals_.size()-1; f++){
00988 if (mcConvR_>rintervals_[f]&&
00989 mcConvR_<rintervals_[f+1]) {
00990 totSimConvR_[f]++;
00991 }
00992 }
00993 for (unsigned int f=0; f<zintervals_.size()-1; f++){
00994 if (mcConvZ_>zintervals_[f]&&
00995 mcConvZ_<zintervals_[f+1]) {
00996 totSimConvZ_[f]++;
00997 }
00998 }
00999 for (unsigned int f=0; f<etintervals_.size()-1; f++){
01000 if ((*mcPho).fourMomentum().et() >etintervals_[f]&&
01001 (*mcPho).fourMomentum().et()<etintervals_[f+1]) {
01002 totSimConvEt_[f]++;
01003 }
01004 }
01005
01006
01007
01008 }
01009
01010 }
01011
01012
01013
01014 float minDelta=10000.;
01015 std::vector<reco::Photon> thePhotons;
01016 int index=0;
01017 int iMatch=-1;
01018 bool matched=false;
01019
01020 for( reco::PhotonCollection::const_iterator iPho = photonCollection.begin(); iPho != photonCollection.end(); iPho++) {
01021 reco::Photon aPho = reco::Photon(*iPho);
01022 thePhotons.push_back(aPho);
01023 float phiPho=aPho.phi();
01024 float etaPho=aPho.eta();
01025 float deltaPhi = phiPho-mcPhi_;
01026 float deltaEta = etaPho-mcEta_;
01027 if ( deltaPhi > pi ) deltaPhi -= twopi;
01028 if ( deltaPhi < -pi) deltaPhi += twopi;
01029 deltaPhi=pow(deltaPhi,2);
01030 deltaEta=pow(deltaEta,2);
01031 float delta = sqrt( deltaPhi+deltaEta);
01032 if ( delta<0.1 && delta < minDelta ) {
01033 minDelta=delta;
01034 iMatch=index;
01035
01036 }
01037 index++;
01038 }
01039 if ( iMatch>-1 ) matched=true;
01040
01041
01042 if ( matched ) {
01043 for (unsigned int f=0; f<etaintervals_.size()-1; f++){
01044 if (mcEta_>etaintervals_[f]&&
01045 mcEta_<etaintervals_[f+1]) {
01046 totMatchedSimPhoEta_[f]++;
01047 }
01048 }
01049 for (unsigned int f=0; f<phiintervals_.size()-1; f++){
01050 if (mcPhi_>phiintervals_[f]&&
01051 mcPhi_<phiintervals_[f+1]) {
01052 totMatchedSimPhoPhi_[f]++;
01053 }
01054 }
01055 }
01056
01057
01058
01059
01060 if ( ! matched) continue;
01061
01062 bool phoIsInBarrel=false;
01063 bool phoIsInEndcap=false;
01064
01065 reco::Photon matchingPho = thePhotons[iMatch];
01066
01067 if ( fabs(matchingPho.superCluster()->position().eta() ) < 1.479 ) {
01068 phoIsInBarrel=true;
01069 } else {
01070 phoIsInEndcap=true;
01071 }
01072 edm::Handle<EcalRecHitCollection> ecalRecHitHandle;
01073 if ( phoIsInBarrel ) {
01074
01075
01076 e.getByLabel(barrelEcalHits_, ecalRecHitHandle);
01077 if (!ecalRecHitHandle.isValid()) {
01078 edm::LogError("PhotonProducer") << "Error! Can't get the product "<<barrelEcalHits_.label();
01079 return;
01080 }
01081
01082
01083 } else if ( phoIsInEndcap ) {
01084
01085
01086 e.getByLabel(endcapEcalHits_, ecalRecHitHandle);
01087 if (!ecalRecHitHandle.isValid()) {
01088 edm::LogError("PhotonProducer") << "Error! Can't get the product "<<endcapEcalHits_.label();
01089 return;
01090 }
01091
01092 }
01093
01094 int type=0;
01095 const EcalRecHitCollection ecalRecHitCollection = *(ecalRecHitHandle.product());
01096 float e3x3= EcalClusterTools::e3x3( *( matchingPho.superCluster()->seed() ), &ecalRecHitCollection, &(*topology));
01097 float r9 =e3x3/( matchingPho.superCluster()->rawEnergy()+ matchingPho.superCluster()->preshowerEnergy());
01098
01099
01100
01101
01102 float photonE = matchingPho.energy();
01103 float photonEt= matchingPho.energy()/cosh( matchingPho.eta()) ;
01104
01105
01106
01107 if ( r9 < 0.93 && phoIsInEndcap) {
01108
01109
01110 }
01111
01112 h_scEta_[type]->Fill( matchingPho.superCluster()->eta() );
01113 h_scPhi_[type]->Fill( matchingPho.superCluster()->phi() );
01114 h_scE_[type][0]->Fill( matchingPho.superCluster()->energy() );
01115 h_scEt_[type][0]->Fill( matchingPho.superCluster()->energy()/cosh( matchingPho.superCluster()->eta()) );
01116 h_r9_[type][0]->Fill( r9 );
01117 h2_r9VsEta_[0] -> Fill (mcEta_, r9);
01118
01119
01120 h_phoEta_[type]->Fill( matchingPho.eta() );
01121 h_phoPhi_[type]->Fill( matchingPho.phi() );
01122 h_phoDEta_[0]->Fill ( matchingPho.eta() - (*mcPho).fourMomentum().eta() );
01123 h_phoDPhi_[0]->Fill ( matchingPho.phi() - mcPhi_ );
01124
01125
01126 h_phoE_[type][0]->Fill( photonE );
01127 h_phoEt_[type][0]->Fill( photonEt);
01128
01129
01130
01131
01132 h_phoERes_[0][0]->Fill( photonE / (*mcPho).fourMomentum().e() );
01133 h2_eResVsEta_[0]->Fill (mcEta_, photonE/(*mcPho).fourMomentum().e() ) ;
01134
01135 if ( (*mcPho).isAConversion() == 0 ) {
01136 h2_eResVsEta_[1]->Fill (mcEta_, photonE/ (*mcPho).fourMomentum().e() ) ;
01137 h2_r9VsEta_[1] -> Fill (mcEta_, r9);
01138 }
01139
01140
01141
01142
01143
01144
01145 if ( photonE/(*mcPho).fourMomentum().e() < 0.3 && photonE/(*mcPho).fourMomentum().e() > 0.1 ) {
01146
01147
01148 }
01149
01150
01151 if ( r9 > 0.93 ) h_phoERes_[1][0]->Fill( photonE / (*mcPho).fourMomentum().e() );
01152 if ( r9 <= 0.93 ) h_phoERes_[2][0]->Fill(photonE / (*mcPho).fourMomentum().e() );
01153
01154
01155 if ( phoIsInBarrel ) {
01156 h_scE_[type][1]->Fill( matchingPho.superCluster()->energy() );
01157 h_scEt_[type][1]->Fill( matchingPho.superCluster()->energy()/cosh( matchingPho.superCluster()->eta()) );
01158 h_r9_[type][1]->Fill( r9 );
01159 h_phoE_[type][1]->Fill( photonE );
01160 h_phoEt_[type][1]->Fill( photonEt );
01161 h_nConv_[type][1]->Fill(float( matchingPho.conversions().size()));
01162
01163 h_phoERes_[0][1]->Fill( photonE / (*mcPho).fourMomentum().e() );
01164 if ( r9 > 0.93 ) {
01165 h_phoERes_[1][1]->Fill( photonE / (*mcPho).fourMomentum().e() );
01166 }
01167 if ( r9 <= 0.93 ) {
01168 h_phoERes_[2][1]->Fill( photonE / (*mcPho).fourMomentum().e() );
01169 }
01170 }
01171 if ( phoIsInEndcap ) {
01172 h_scE_[type][2]->Fill( matchingPho.superCluster()->energy() );
01173 h_scEt_[type][2]->Fill( matchingPho.superCluster()->energy()/cosh( matchingPho.superCluster()->eta()) );
01174 h_r9_[type][2]->Fill( r9 );
01175 h_phoE_[type][2]->Fill( photonE );
01176 h_phoEt_[type][2]->Fill( photonEt );
01177 h_nConv_[type][2]->Fill(float( matchingPho.conversions().size()));
01178 h_phoERes_[0][2]->Fill( photonE / (*mcPho).fourMomentum().e() );
01179 if ( r9 > 0.93 ) {
01180
01181 h_phoERes_[1][2]->Fill( photonE / (*mcPho).fourMomentum().e() );
01182 }
01183 if ( r9 <= 0.93 ) {
01184 h_phoERes_[2][2]->Fill( photonE / (*mcPho).fourMomentum().e() );
01185 }
01186 }
01187
01188
01189
01190
01191
01192 if ( ! (visibleConversion && visibleConversionsWithTwoSimTracks ) ) continue;
01193 h_r9_[1][0]->Fill( r9 );
01194 if ( phoIsInBarrel ) h_r9_[1][1]->Fill( r9 );
01195 if ( phoIsInEndcap ) h_r9_[1][2]->Fill( r9 );
01196
01197
01198 h_nConv_[type][0]->Fill(float( matchingPho.conversions().size()));
01199
01200
01202 std::vector<reco::ConversionRef> conversions = matchingPho.conversions();
01203 for (unsigned int iConv=0; iConv<conversions.size(); iConv++) {
01204
01205
01206 h2_EoverEtrueVsEta_[1]->Fill (mcEta_,matchingPho.superCluster()->energy()/ (*mcPho).fourMomentum().e() ) ;
01207
01208 reco::ConversionRef aConv=conversions[iConv];
01209 std::vector<reco::TrackRef> tracks = aConv->tracks();
01210 if (tracks.size() < 2 ) continue;
01211
01212 if ( dCotCutOn_ ) {
01213 if ( (fabs(mcEta_) > 1.1 && fabs (mcEta_) < 1.4 ) &&
01214 fabs( aConv->pairCotThetaSeparation() ) > dCotHardCutValue_ ) continue;
01215 if ( fabs( aConv->pairCotThetaSeparation() ) > dCotCutValue_ ) continue;
01216 }
01217
01218
01219 nRecConv_++;
01220
01221 h_convEta_[0]->Fill( aConv->caloCluster()[0]->eta() );
01222 h_convPhi_[0]->Fill( aConv->caloCluster()[0]->phi() );
01223 h_convERes_[0][0]->Fill( aConv->caloCluster()[0]->energy() / (*mcPho).fourMomentum().e() );
01224 h_r9VsNofTracks_[0][0]->Fill( r9, aConv->nTracks() ) ;
01225
01226 if ( phoIsInBarrel ) {
01227 h_convERes_[0][1]->Fill(aConv->caloCluster()[0]->energy() / (*mcPho).fourMomentum().e() );
01228 h_r9VsNofTracks_[0][1]->Fill( r9, aConv->nTracks() ) ;
01229 }
01230 if ( phoIsInEndcap ) {
01231 h_convERes_[0][2]->Fill(aConv->caloCluster()[0]->energy() / (*mcPho).fourMomentum().e() );
01232 h_r9VsNofTracks_[0][2]->Fill( r9, aConv->nTracks() ) ;
01233 }
01234
01235
01236 std::map<reco::TrackRef,TrackingParticleRef> myAss;
01237 std::map<reco::TrackRef,TrackingParticleRef>::const_iterator itAss;
01238 std::map<reco::TrackRef,TrackingParticleRef>::const_iterator itAssMin;
01239 std::map<reco::TrackRef,TrackingParticleRef>::const_iterator itAssMax;
01240
01241
01242 int nAssT2=0;
01243 int nAssT1=0;
01244 float px=0;
01245 float py=0;
01246 float pz=0;
01247 float e=0;
01248
01249 for (unsigned int i=0; i<tracks.size(); i++) {
01250
01251
01252
01253
01254
01255 type =0;
01256 nHitsVsEta_[type] ->Fill (mcEta_, float(tracks[i]->numberOfValidHits()) );
01257 nHitsVsR_[type] ->Fill (mcConvR_, float(tracks[i]->numberOfValidHits()) );
01258 h_tkChi2_[type] ->Fill (tracks[i]->normalizedChi2() );
01259
01260 px+= tracks[i]->innerMomentum().x();
01261 py+= tracks[i]->innerMomentum().y();
01262 pz+= tracks[i]->innerMomentum().z();
01263 e += sqrt ( tracks[i]->innerMomentum().x()*tracks[i]->innerMomentum().x() +
01264 tracks[i]->innerMomentum().y()*tracks[i]->innerMomentum().y() +
01265 tracks[i]->innerMomentum().z()*tracks[i]->innerMomentum().z() +
01266 + mElec*mElec ) ;
01267
01268
01270 TrackingParticleRef myTP;
01271 for (size_t j = 0; j < RtoSCollPtrs.size(); j++) {
01272 reco::RecoToSimCollection q = *(RtoSCollPtrs[j]);
01273
01274 RefToBase<reco::Track> myTk( aConv->tracks()[i] );
01275
01276 if( q.find(myTk ) != q.end() ) {
01277 std::vector<std::pair<TrackingParticleRef, double> > tp = q[myTk];
01278 for (int itp=0; itp<tp.size(); itp++) {
01279 myTP=tp[itp].first;
01280
01281 myAss.insert( std::make_pair ( aConv->tracks()[i] , myTP) );
01282 nAssT2++;
01283 }
01284 }
01285 }
01286
01287
01288
01289 }
01290
01291
01292
01293
01294 float totP = sqrt(px*px +py*py + pz*pz);
01295 float invM= (e + totP) * (e-totP) ;
01296 if ( invM> 0.) {
01297 invM= sqrt( invM);
01298 } else {
01299 invM=-1;
01300 }
01301
01302 type=0;
01303 h_invMass_[type][0] ->Fill( invM);
01304 if ( phoIsInBarrel ) h_invMass_[type][1] ->Fill(invM);
01305 if ( phoIsInEndcap ) h_invMass_[type][2] ->Fill(invM);
01306
01307
01308
01309
01311 if ( nAssT2 ==2 ) {
01312
01313
01314 h_r9_[2][0]->Fill( r9 );
01315 if ( phoIsInBarrel ) h_r9_[2][1]->Fill( r9 );
01316 if ( phoIsInEndcap ) h_r9_[2][2]->Fill( r9 );
01317
01318
01319 nRecConvAss_++;
01320
01321
01322 for (unsigned int f=0; f<etaintervalslarge_.size()-1; f++){
01323 if (mcEta_>etaintervalslarge_[f]&&
01324 mcEta_<etaintervalslarge_[f+1]) {
01325 totMatchedSimConvEtaTwoTracks_[f]++;
01326 }
01327 }
01328 for (unsigned int f=0; f<phiintervals_.size()-1; f++){
01329 if (mcPhi_>phiintervals_[f]&&
01330 mcPhi_<phiintervals_[f+1]) {
01331 totMatchedSimConvPhiTwoTracks_[f]++;
01332 }
01333 }
01334 for (unsigned int f=0; f<rintervals_.size()-1; f++){
01335 if (mcConvR_>rintervals_[f]&&
01336 mcConvR_<rintervals_[f+1]) {
01337 totMatchedSimConvRTwoTracks_[f]++;
01338 }
01339 }
01340 for (unsigned int f=0; f<zintervals_.size()-1; f++){
01341 if (mcConvZ_>zintervals_[f]&&
01342 mcConvZ_<zintervals_[f+1]) {
01343 totMatchedSimConvZTwoTracks_[f]++;
01344 }
01345 }
01346 for (unsigned int f=0; f<etintervals_.size()-1; f++){
01347 if ((*mcPho).fourMomentum().et()>etintervals_[f]&&
01348 (*mcPho).fourMomentum().et()<etintervals_[f+1]) {
01349 totMatchedSimConvEtTwoTracks_[f]++;
01350 }
01351 }
01352
01353
01355 type =1;
01356 float eoverp= aConv->EoverP();
01357
01358 h_invMass_[type][0] ->Fill( invM);
01359 h_convPRes_[type][0]->Fill( totP / (*mcPho).fourMomentum().e() );
01360 h_EoverPTracks_[type][0] ->Fill( eoverp ) ;
01361 h_PoverETracks_[type][0] ->Fill( 1./eoverp ) ;
01362 h2_EoverEtrueVsEoverP_[0] ->Fill( eoverp,matchingPho.superCluster()->energy()/ (*mcPho).fourMomentum().e() ) ;
01363 h2_PoverPtrueVsEoverP_[0] ->Fill( eoverp, totP/ (*mcPho).fourMomentum().e() ) ;
01364 h2_EoverEtrueVsEta_[0]->Fill (mcEta_,matchingPho.superCluster()->energy()/ (*mcPho).fourMomentum().e() ) ;
01365 h2_EoverEtrueVsR_[0]->Fill (mcConvR_,matchingPho.superCluster()->energy()/ (*mcPho).fourMomentum().e() ) ;
01366
01367 h2_PoverPtrueVsEta_[0]->Fill (mcEta_,totP/ (*mcPho).fourMomentum().e() ) ;
01368
01369 h2_EoverPVsEta_[0]->Fill (mcEta_, eoverp);
01370 h2_EoverPVsR_[0]->Fill (mcConvR_, eoverp);
01371
01372
01373
01374 reco::TrackRef track1 = tracks[0];
01375 reco::TrackRef track2 = tracks[1];
01376 reco::TransientTrack tt1 = (*theTTB).build( &track1);
01377 reco::TransientTrack tt2 = (*theTTB).build( &track2);
01378 TwoTrackMinimumDistance md;
01379 md.calculate ( tt1.initialFreeState(), tt2.initialFreeState() );
01380 if (md.status() ) {
01381
01382 h_distMinAppTracks_[1][0]->Fill ( md.distance() );
01383 } else {
01384 nInvalidPCA_++;
01385
01386 }
01387
01388 float dPhiTracksAtVtx = -99;
01389 float phiTk1= tracks[0]->innerMomentum().phi();
01390 float phiTk2= tracks[1]->innerMomentum().phi();
01391 dPhiTracksAtVtx = phiTk1-phiTk2;
01392 dPhiTracksAtVtx = phiNormalization( dPhiTracksAtVtx );
01393
01394 h_DPhiTracksAtVtx_[type][0]->Fill( dPhiTracksAtVtx);
01395 h2_DPhiTracksAtVtxVsEta_->Fill( mcEta_, dPhiTracksAtVtx);
01396 h2_DPhiTracksAtVtxVsR_->Fill( mcConvR_, dPhiTracksAtVtx);
01397
01398
01399 h_DCotTracks_[type][0] ->Fill ( aConv->pairCotThetaSeparation() );
01400 h2_DCotTracksVsEta_->Fill( mcEta_, aConv->pairCotThetaSeparation() );
01401 h2_DCotTracksVsR_->Fill( mcConvR_, aConv->pairCotThetaSeparation() );
01402
01403
01404
01405
01406
01407 if ( phoIsInBarrel ) {
01408 h_invMass_[type][1] ->Fill(invM);
01409 h_convPRes_[type][1]->Fill( totP / (*mcPho).fourMomentum().e() );
01410 h_EoverPTracks_[type][1] ->Fill( eoverp ) ;
01411 h_PoverETracks_[type][1] ->Fill( 1./eoverp ) ;
01412 h_DPhiTracksAtVtx_[type][1]->Fill( dPhiTracksAtVtx);
01413 h_DCotTracks_[type][1] ->Fill ( aConv->pairCotThetaSeparation() );
01414
01415 h2_EoverEtrueVsEoverP_[1] ->Fill( eoverp,matchingPho.superCluster()->energy()/ (*mcPho).fourMomentum().e() ) ;
01416
01417 h2_PoverPtrueVsEoverP_[1] ->Fill( eoverp, totP/ (*mcPho).fourMomentum().e() ) ;
01418 }
01419
01420
01421 if ( phoIsInEndcap ) {
01422 h_invMass_[type][2] ->Fill(invM);
01423 h_convPRes_[type][2]->Fill( totP / (*mcPho).fourMomentum().e() );
01424 h_EoverPTracks_[type][2] ->Fill( eoverp ) ;
01425 h_PoverETracks_[type][2] ->Fill( 1./eoverp ) ;
01426 h_DPhiTracksAtVtx_[type][2]->Fill( dPhiTracksAtVtx);
01427 h_DCotTracks_[type][2] ->Fill ( aConv->pairCotThetaSeparation() );
01428 h2_EoverEtrueVsEoverP_[2] ->Fill( eoverp,matchingPho.superCluster()->energy()/ (*mcPho).fourMomentum().e() ) ;
01429 h2_PoverPtrueVsEoverP_[2] ->Fill( eoverp, totP/ (*mcPho).fourMomentum().e() ) ;
01430 }
01431
01432
01433
01434 if ( aConv->conversionVertex().isValid() ) {
01435 h_convVtxRvsZ_[0] ->Fill ( fabs (aConv->conversionVertex().position().z() ), sqrt(aConv->conversionVertex().position().perp2()) ) ;
01436 h_convVtxdX_ ->Fill ( aConv->conversionVertex().position().x() - mcConvX_);
01437 h_convVtxdY_ ->Fill ( aConv->conversionVertex().position().y() - mcConvY_);
01438 h_convVtxdZ_ ->Fill ( aConv->conversionVertex().position().z() - mcConvZ_);
01439 h_convVtxdR_ ->Fill ( sqrt(aConv->conversionVertex().position().perp2()) - mcConvR_);
01440 h2_convVtxdRVsR_ ->Fill (mcConvR_, sqrt(aConv->conversionVertex().position().perp2()) - mcConvR_ );
01441 if ( fabs(matchingPho.superCluster()->position().eta() ) <= 1.) h_convVtxRvsZ_[1] ->Fill ( fabs (aConv->conversionVertex().position().z() ), sqrt(aConv->conversionVertex().position().perp2()) ) ;
01442 if ( fabs(matchingPho.superCluster()->position().eta() ) > 1.) h_convVtxRvsZ_[2] ->Fill ( fabs (aConv->conversionVertex().position().z() ), sqrt(aConv->conversionVertex().position().perp2()) ) ;
01443
01444 }
01445
01446
01447
01448 h_zPVFromTracks_[type]->Fill ( aConv->zOfPrimaryVertexFromTracks() );
01449 h_dzPVFromTracks_[type]->Fill ( aConv->zOfPrimaryVertexFromTracks() - (*mcPho).primaryVertex().z() );
01450 h2_dzPVVsR_ ->Fill(mcConvR_, aConv->zOfPrimaryVertexFromTracks() - (*mcPho).primaryVertex().z() );
01451
01452
01453 float dPhiTracksAtEcal=-99;
01454 float dEtaTracksAtEcal=-99;
01455 if (aConv->bcMatchingWithTracks()[0].isNonnull() && aConv->bcMatchingWithTracks()[1].isNonnull() ) {
01456 nRecConvAssWithEcal_++;
01457 float recoPhi1 = aConv->ecalImpactPosition()[0].phi();
01458 float recoPhi2 = aConv->ecalImpactPosition()[1].phi();
01459 float recoEta1 = aConv->ecalImpactPosition()[0].eta();
01460 float recoEta2 = aConv->ecalImpactPosition()[1].eta();
01461 float bcPhi1 = aConv->bcMatchingWithTracks()[0]->phi();
01462 float bcPhi2 = aConv->bcMatchingWithTracks()[1]->phi();
01463 float bcEta1 = aConv->bcMatchingWithTracks()[0]->eta();
01464 float bcEta2 = aConv->bcMatchingWithTracks()[1]->eta();
01465 recoPhi1 = phiNormalization(recoPhi1);
01466 recoPhi2 = phiNormalization(recoPhi2);
01467 bcPhi1 = phiNormalization(bcPhi1);
01468 bcPhi2 = phiNormalization(bcPhi2);
01469 dPhiTracksAtEcal = recoPhi1 -recoPhi2;
01470 dPhiTracksAtEcal = phiNormalization( dPhiTracksAtEcal );
01471 dEtaTracksAtEcal = recoEta1 -recoEta2;
01472
01473
01474 h_DPhiTracksAtEcal_[type][0]->Fill( fabs(dPhiTracksAtEcal));
01475 h2_DPhiTracksAtEcalVsR_ ->Fill (mcConvR_, fabs(dPhiTracksAtEcal));
01476 h2_DPhiTracksAtEcalVsEta_ ->Fill (mcEta_, fabs(dPhiTracksAtEcal));
01477
01478 h_DEtaTracksAtEcal_[type][0]->Fill( dEtaTracksAtEcal);
01479
01480 if ( phoIsInBarrel ) {
01481 h_DPhiTracksAtEcal_[type][1]->Fill( fabs(dPhiTracksAtEcal));
01482 h_DEtaTracksAtEcal_[type][1]->Fill( dEtaTracksAtEcal);
01483 }
01484 if ( phoIsInEndcap ) {
01485 h_DPhiTracksAtEcal_[type][2]->Fill( fabs(dPhiTracksAtEcal));
01486 h_DEtaTracksAtEcal_[type][2]->Fill( dEtaTracksAtEcal);
01487 }
01488
01489 }
01490
01491
01492
01493
01495 for (unsigned int i=0; i<tracks.size(); i++) {
01496 itAss= myAss.find( aConv->tracks()[i] );
01497 if ( itAss == myAss.end() ) continue;
01498
01499 nHitsVsEta_[type] ->Fill (mcEta_, float(tracks[i]->numberOfValidHits()) );
01500 nHitsVsR_[type] ->Fill (mcConvR_, float(tracks[i]->numberOfValidHits()) );
01501 h_tkChi2_[type] ->Fill (tracks[i]->normalizedChi2() );
01502 h2_Chi2VsEta_[0] ->Fill( mcEta_, tracks[i]->normalizedChi2() );
01503 h2_Chi2VsR_[0] ->Fill( mcConvR_, tracks[i]->normalizedChi2() );
01504
01505
01506
01507 float simPt = sqrt( ((*itAss).second)->momentum().perp2() );
01508 float recPt = sqrt( aConv->tracks()[i]->innerMomentum().Perp2() ) ;
01509 float ptres= recPt - simPt ;
01510 float pterror = aConv->tracks()[i]->ptError();
01511 h2_PtRecVsPtSim_[0]->Fill ( simPt, recPt);
01512
01513
01514
01515 h_TkPtPull_[0] ->Fill(ptres/pterror);
01516 h2_TkPtPull_[0] ->Fill(mcEta_, ptres/pterror);
01517
01518 h_TkD0_[0]->Fill ( tracks[i]->d0()* tracks[i]->charge() );
01519
01520
01521 if ( aConv->bcMatchingWithTracks()[i].isNonnull() ) hBCEnergyOverTrackPout_[0]->Fill ( aConv->bcMatchingWithTracks()[i]->energy()/sqrt(aConv->tracks()[i]->outerMomentum().Mag2()) );
01522
01523 if ( phoIsInBarrel ) {
01524 h_TkD0_[1]->Fill ( tracks[i]->d0()* tracks[i]->charge() );
01525 h_TkPtPull_[1] ->Fill(ptres/pterror);
01526 h2_PtRecVsPtSim_[1]->Fill ( simPt, recPt);
01527 if ( aConv->bcMatchingWithTracks()[i].isNonnull() ) hBCEnergyOverTrackPout_[1]->Fill ( aConv->bcMatchingWithTracks()[i]->energy()/sqrt(aConv->tracks()[i]->outerMomentum().Mag2()) );
01528
01529 }
01530 if ( phoIsInEndcap ) {
01531 h_TkD0_[2]->Fill ( tracks[i]->d0()* tracks[i]->charge() );
01532 h_TkPtPull_[2] ->Fill(ptres/pterror);
01533 h2_PtRecVsPtSim_[2]->Fill ( simPt, recPt);
01534 if ( aConv->bcMatchingWithTracks()[i].isNonnull() ) hBCEnergyOverTrackPout_[2]->Fill ( aConv->bcMatchingWithTracks()[i]->energy()/sqrt(aConv->tracks()[i]->outerMomentum().Mag2()) );
01535 }
01536
01537
01538
01539 }
01540
01541
01542
01543 }
01544
01545
01546
01547
01548
01549 }
01550
01551
01552
01553 }
01554
01555
01556 h_nSimPho_->Fill(float(nSimPho_));
01557 h_nSimConv_[0]->Fill(float(nSimConv_[0]));
01558 h_nSimConv_[1]->Fill(float(nSimConv_[1]));
01559
01560
01561
01563 for( reco::PhotonCollection::const_iterator iPho = photonCollection.begin(); iPho != photonCollection.end(); iPho++) {
01564 reco::Photon aPho = reco::Photon(*iPho);
01565 float et= aPho.superCluster()->energy()/cosh( aPho.superCluster()->eta()) ;
01566 std::vector<reco::ConversionRef> conversions = aPho.conversions();
01567 for (unsigned int iConv=0; iConv<conversions.size(); iConv++) {
01568
01569
01570 reco::ConversionRef aConv=conversions[iConv];
01571 std::vector<reco::TrackRef> tracks = aConv->tracks();
01572
01573 if (tracks.size() < 2 ) continue;
01574
01575 if ( dCotCutOn_ ) {
01576 if ( ( fabs(mcEta_) > 1.1 && fabs (mcEta_) < 1.4 ) &&
01577 fabs( aConv->pairCotThetaSeparation() ) > dCotHardCutValue_ ) continue;
01578 if ( fabs( aConv->pairCotThetaSeparation() ) > dCotCutValue_ ) continue;
01579 }
01580
01581
01582
01583 for (unsigned int f=0; f<etaintervalslarge_.size()-1; f++){
01584 if (aPho.eta()>etaintervalslarge_[f]&&
01585 aPho.eta()<etaintervalslarge_[f+1]) {
01586 totMatchedRecConvEtaTwoTracks_[f]++;
01587 }
01588
01589 }
01590 for (unsigned int f=0; f<phiintervals_.size()-1; f++){
01591 if (aPho.phi()>phiintervals_[f]&&
01592 aPho.phi()<phiintervals_[f+1]) {
01593 totMatchedRecConvPhiTwoTracks_[f]++;
01594 }
01595 }
01596
01597 for (unsigned int f=0; f<rintervals_.size()-1; f++){
01598 if (mcConvR_>rintervals_[f]&&
01599 mcConvR_<rintervals_[f+1]) {
01600 totMatchedRecConvRTwoTracks_[f]++;
01601 }
01602 }
01603 for (unsigned int f=0; f<zintervals_.size()-1; f++){
01604 if (mcConvZ_>zintervals_[f]&&
01605 mcConvZ_<zintervals_[f+1]) {
01606 totMatchedRecConvZTwoTracks_[f]++;
01607 }
01608 }
01609
01610 for (unsigned int f=0; f<etintervals_.size()-1; f++){
01611 if ( et >etintervals_[f]&&
01612 et <etintervals_[f+1]) {
01613 totMatchedRecConvEtTwoTracks_[f]++;
01614 }
01615 }
01616
01617
01618
01619 int nAssT2=0;
01620
01621 std::map<reco::TrackRef,TrackingParticleRef> myAss;
01622 for (unsigned int i=0; i<tracks.size(); i++) {
01623
01624 TrackingParticleRef myTP;
01625 for (size_t j = 0; j < RtoSCollPtrs.size(); j++) {
01626 reco::RecoToSimCollection q = *(RtoSCollPtrs[j]);
01627
01628 RefToBase<reco::Track> myTk( aConv->tracks()[i] );
01629
01630 if( q.find(myTk ) != q.end() ) {
01631 std::vector<std::pair<TrackingParticleRef, double> > tp = q[myTk];
01632 for (int itp=0; itp<tp.size(); itp++) {
01633 myTP=tp[itp].first;
01634
01635 myAss.insert( std::make_pair ( aConv->tracks()[i] , myTP) );
01636 nAssT2++;
01637 }
01638 }
01639 }
01640
01641 if ( nAssT2 == 2) {
01642
01643 for (unsigned int f=0; f<etaintervalslarge_.size()-1; f++){
01644 if (aPho.eta()>etaintervalslarge_[f]&&
01645 aPho.eta()<etaintervalslarge_[f+1]) {
01646 totRecAssConvEtaTwoTracks_[f]++;
01647 }
01648
01649 }
01650 for (unsigned int f=0; f<phiintervals_.size()-1; f++){
01651 if (aPho.phi()>phiintervals_[f]&&
01652 aPho.phi()<phiintervals_[f+1]) {
01653 totRecAssConvPhiTwoTracks_[f]++;
01654 }
01655 }
01656
01657 for (unsigned int f=0; f<rintervals_.size()-1; f++){
01658 if (mcConvR_>rintervals_[f]&&
01659 mcConvR_<rintervals_[f+1]) {
01660 totRecAssConvRTwoTracks_[f]++;
01661 }
01662 }
01663 for (unsigned int f=0; f<zintervals_.size()-1; f++){
01664 if (mcConvZ_>zintervals_[f]&&
01665 mcConvZ_<zintervals_[f+1]) {
01666 totRecAssConvZTwoTracks_[f]++;
01667 }
01668 }
01669 for (unsigned int f=0; f<etintervals_.size()-1; f++){
01670 if ( et >etintervals_[f]&&
01671 et <etintervals_[f+1]) {
01672 totRecAssConvEtTwoTracks_[f]++;
01673 }
01674 }
01675
01676
01677
01678
01679 }
01680 }
01681 }
01682 }
01683
01684
01685
01686
01687
01688 }
01689
01690
01691
01692 void PhotonValidator::fillPlotFromVectors(MonitorElement* h, std::vector<int>& numerator, std::vector<int>& denominator,std::string type){
01693 double value,err;
01694 for (unsigned int j=0; j<numerator.size(); j++){
01695 if (denominator[j]!=0){
01696 if (type=="effic")
01697 value = ((double) numerator[j])/((double) denominator[j]);
01698 else if (type=="fakerate")
01699 value = 1-((double) numerator[j])/((double) denominator[j]);
01700 else return;
01701 err = sqrt( value*(1-value)/(double) denominator[j] );
01702 h->setBinContent(j+1, value);
01703 h->setBinError(j+1,err);
01704 }
01705 else {
01706 h->setBinContent(j+1, 0);
01707 }
01708 }
01709 }
01710
01711
01712 void PhotonValidator::endJob()
01713 {
01714
01715
01716 for (int i=0; i<2; i++) {
01717 doProfileX( nHitsVsEta_[i], h_nHitsVsEta_[i]);
01718 doProfileX( nHitsVsR_[i], h_nHitsVsR_[i]);
01719 }
01720
01721
01722 doProfileX( h2_TkPtPull_[0],p_TkPtPull_[0]);
01723
01724
01725
01726 doProfileX( h2_eResVsEta_[0], p_eResVsEta_[0] );
01727 doProfileX( h2_eResVsEta_[1], p_eResVsEta_[1] );
01728
01729 doProfileX( h2_EoverEtrueVsEta_[0], p_EoverEtrueVsEta_[0] );
01730 doProfileX( h2_EoverEtrueVsEta_[1], p_EoverEtrueVsEta_[1] );
01731
01732 doProfileX( h2_EoverEtrueVsR_[0], p_EoverEtrueVsR_[0] );
01733 doProfileX( h2_PoverPtrueVsEta_[0], p_PoverPtrueVsEta_[0] );
01734 doProfileX( h2_EoverPVsEta_[0], p_EoverPVsEta_[0] );
01735 doProfileX( h2_EoverPVsR_[0], p_EoverPVsR_[0] );
01736
01737
01738 doProfileX( h2_Chi2VsEta_[0], p_Chi2VsEta_[0] );
01739 doProfileX( h2_Chi2VsR_[0], p_Chi2VsR_[0] );
01740 doProfileX( h2_DPhiTracksAtVtxVsEta_,p_DPhiTracksAtVtxVsEta_);
01741 doProfileX( h2_DPhiTracksAtVtxVsR_,p_DPhiTracksAtVtxVsR_);
01742 doProfileX( h2_DCotTracksVsEta_,p_DCotTracksVsEta_);
01743 doProfileX( h2_DCotTracksVsR_,p_DCotTracksVsR_);
01744
01745 doProfileX( h2_DPhiTracksAtEcalVsR_, p_DPhiTracksAtEcalVsR_);
01746 doProfileX( h2_DPhiTracksAtEcalVsEta_, p_DPhiTracksAtEcalVsEta_);
01747
01748 doProfileX( h2_convVtxdRVsR_, p_convVtxdRVsR_);
01749 doProfileX( h2_dzPVVsR_, p_dzPVVsR_);
01750
01751
01752
01753 fillPlotFromVectors(phoEffEta_,totMatchedSimPhoEta_,totSimPhoEta_,"effic");
01754 fillPlotFromVectors(phoEffPhi_,totMatchedSimPhoPhi_,totSimPhoPhi_,"effic");
01755
01756 fillPlotFromVectors(convEffEtaTwoTracks_,totMatchedSimConvEtaTwoTracks_,totSimConvEta_,"effic");
01757 fillPlotFromVectors(convEffPhiTwoTracks_,totMatchedSimConvPhiTwoTracks_,totSimConvPhi_,"effic");
01758 fillPlotFromVectors(convEffRTwoTracks_,totMatchedSimConvRTwoTracks_,totSimConvR_,"effic");
01759 fillPlotFromVectors(convEffZTwoTracks_,totMatchedSimConvZTwoTracks_,totSimConvZ_,"effic");
01760 fillPlotFromVectors(convEffEtTwoTracks_,totMatchedSimConvEtTwoTracks_,totSimConvEt_,"effic");
01761
01762 fillPlotFromVectors(convFakeRateEtaTwoTracks_,totRecAssConvEtaTwoTracks_,totMatchedRecConvEtaTwoTracks_,"fakerate");
01763 fillPlotFromVectors(convFakeRatePhiTwoTracks_,totRecAssConvPhiTwoTracks_,totMatchedRecConvPhiTwoTracks_,"fakerate");
01764 fillPlotFromVectors(convFakeRateRTwoTracks_, totRecAssConvRTwoTracks_,totMatchedRecConvRTwoTracks_,"fakerate");
01765 fillPlotFromVectors(convFakeRateZTwoTracks_,totRecAssConvZTwoTracks_,totMatchedRecConvZTwoTracks_,"fakerate");
01766 fillPlotFromVectors(convFakeRateEtTwoTracks_,totRecAssConvEtTwoTracks_,totMatchedRecConvEtTwoTracks_,"fakerate");
01767
01768
01769
01770 dbe_->showDirStructure();
01771 bool outputMEsInRootFile = parameters_.getParameter<bool>("OutputMEsInRootFile");
01772 std::string outputFileName = parameters_.getParameter<std::string>("OutputFileName");
01773 if(outputMEsInRootFile){
01774 dbe_->save(outputFileName);
01775 }
01776
01777 edm::LogInfo("PhotonValidator") << "Analyzed " << nEvt_ << "\n";
01778
01779 std::cout << "PhotonValidator::endJob Analyzed " << nEvt_ << " events " << "\n";
01780 std::cout << " Total number of photons " << nEntry_ << std::endl;
01781 std::cout << " Fraction of conv with two tracks having both BC matching " << float(nRecConvAssWithEcal_)/nRecConvAss_ << std::endl;
01782
01783 return ;
01784 }
01785
01786 float PhotonValidator::phiNormalization(float & phi)
01787 {
01788
01789 const float PI = 3.1415927;
01790 const float TWOPI = 2.0*PI;
01791
01792
01793 if(phi > PI) {phi = phi - TWOPI;}
01794 if(phi < -PI) {phi = phi + TWOPI;}
01795
01796
01797 return phi;
01798
01799 }
01800
01801
01802 float PhotonValidator::etaTransformation( float EtaParticle , float Zvertex) {
01803
01804
01805 const float PI = 3.1415927;
01806 const float TWOPI = 2.0*PI;
01807
01808
01809 const float R_ECAL = 136.5;
01810 const float Z_Endcap = 328.0;
01811 const float etaBarrelEndcap = 1.479;
01812
01813
01814
01815 float Theta = 0.0 ;
01816 float ZEcal = R_ECAL*sinh(EtaParticle)+Zvertex;
01817
01818 if(ZEcal != 0.0) Theta = atan(R_ECAL/ZEcal);
01819 if(Theta<0.0) Theta = Theta+PI ;
01820 float ETA = - log(tan(0.5*Theta));
01821
01822 if( fabs(ETA) > etaBarrelEndcap )
01823 {
01824 float Zend = Z_Endcap ;
01825 if(EtaParticle<0.0 ) Zend = -Zend ;
01826 float Zlen = Zend - Zvertex ;
01827 float RR = Zlen/sinh(EtaParticle);
01828 Theta = atan(RR/Zend);
01829 if(Theta<0.0) Theta = Theta+PI ;
01830 ETA = - log(tan(0.5*Theta));
01831 }
01832
01833 return ETA;
01834
01835 }
01836
01837
01838 std::vector<float> PhotonValidator::errors( TH1* histo1, TH1* histo2 ) {
01839 std::vector<float> nEntryNum, nEntryDen;
01840 std::vector<float> ratio;
01841 std::vector<float> erro;
01842
01844
01845
01846 const int nBin1=histo1->GetNbinsX();
01847 const int nBin2=histo2->GetNbinsX();
01848
01849
01850
01851
01852 static const int sega1=nBin1;
01853 static const int sega2=nBin2;
01854
01855
01856 nEntryNum.clear();
01857 nEntryDen.clear();
01858 ratio.clear();
01859 erro.clear();
01860
01861
01862
01863 for ( int i=1; i<=nBin1; i++) {
01864
01865
01866 nEntryNum.push_back( histo1->GetBinContent(i) ) ;
01867 }
01868 for ( int i=1; i<=nBin1; i++) {
01869
01870
01871 nEntryDen.push_back( histo2->GetBinContent(i) ) ;
01872
01873 }
01874
01875
01876
01877 float val, delta;
01878 for ( int i=0; i<nEntryNum.size() ; i++) {
01879
01880 val = 0, delta=0;
01881 if ( nEntryDen[i] !=0 ) {
01882 val= nEntryNum[i]/nEntryDen[i];
01883 delta= sqrt ( val*(1.-val)/ nEntryDen[i] );
01884 if (delta==0) delta=0.0003;
01885
01886 }
01887
01888
01889
01890 ratio.push_back( val ) ;
01891 erro.push_back(delta);
01892
01893 }
01894
01895
01896 return erro;
01897
01898
01899 }
01900
01901
01902 void PhotonValidator::doProfileX(TH2 * th2, MonitorElement* me){
01903 if (th2->GetNbinsX()==me->getNbinsX()){
01904 TH1F * h1 = (TH1F*) th2->ProfileX();
01905 for (int bin=0;bin!=h1->GetNbinsX();bin++){
01906 me->setBinContent(bin+1,h1->GetBinContent(bin+1));
01907 me->setBinError(bin+1,h1->GetBinError(bin+1));
01908 }
01909 delete h1;
01910 } else {
01911 throw cms::Exception("MultiTrackValidator") << "Different number of bins!";
01912 }
01913 }
01914
01915 void PhotonValidator::doProfileX(MonitorElement * th2m, MonitorElement* me) {
01916 doProfileX(th2m->getTH2F(), me);
01917 }