00001 #include <iostream>
00002
00003 #include "FWCore/ServiceRegistry/interface/Service.h"
00004 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00005
00006 #include "Validation/RecoEgamma/interface/TkConvValidator.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/GeneratorProducts/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/GlobalPhysicalConstants.h"
00037 #include "CommonTools/Statistics/interface/ChiSquaredProbability.h"
00038
00039 #include "MagneticField/Engine/interface/MagneticField.h"
00040 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00041 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00042 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00043 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
00044 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00045 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
00046 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
00047 #include "TrackingTools/MaterialEffects/interface/PropagatorWithMaterial.h"
00048
00049
00050 #include "DataFormats/Common/interface/Handle.h"
00051 #include "DataFormats/TrackReco/interface/Track.h"
00052 #include "DataFormats/TrackReco/interface/TrackExtra.h"
00053 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00054 #include "DataFormats/EgammaCandidates/interface/Conversion.h"
00055 #include "DataFormats/EgammaCandidates/interface/ConversionFwd.h"
00056 #include "DataFormats/EgammaCandidates/interface/Photon.h"
00057 #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
00058 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00059 #include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h"
00060 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
00061 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
00062 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
00063 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
00064 #include "DataFormats/CaloRecHit/interface/CaloCluster.h"
00065 #include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h"
00066 #include "DataFormats/DetId/interface/DetId.h"
00067 #include "DataFormats/JetReco/interface/GenJetCollection.h"
00068 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
00069 #include "DataFormats/GeometrySurface/interface/BoundCylinder.h"
00070 #include "DataFormats/GeometrySurface/interface/BoundDisk.h"
00071 #include "DataFormats/GeometrySurface/interface/SimpleCylinderBounds.h"
00072 #include "DataFormats/GeometrySurface/interface/SimpleDiskBounds.h"
00073
00074
00075 #include "RecoEgamma/EgammaMCTools/interface/PhotonMCTruthFinder.h"
00076 #include "RecoEgamma/EgammaMCTools/interface/PhotonMCTruth.h"
00077 #include "RecoEgamma/EgammaMCTools/interface/ElectronMCTruth.h"
00078 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h"
00079 #include "RecoCaloTools/MetaCollections/interface/CaloRecHitMetaCollections.h"
00080 #include "Geometry/Records/interface/CaloGeometryRecord.h"
00081 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00082 #include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
00083
00084
00085 #include "TFile.h"
00086 #include "TH1.h"
00087 #include "TH2.h"
00088 #include "TTree.h"
00089 #include "TVector3.h"
00090 #include "TProfile.h"
00091
00102 using namespace std;
00103
00104
00105 TkConvValidator::TkConvValidator( const edm::ParameterSet& pset )
00106 {
00107
00108 fName_ = pset.getUntrackedParameter<std::string>("Name");
00109 verbosity_ = pset.getUntrackedParameter<int>("Verbosity");
00110 parameters_ = pset;
00111
00112 conversionCollectionProducer_ = pset.getParameter<std::string>("convProducer");
00113 conversionCollection_ = pset.getParameter<std::string>("conversionCollection");
00114
00115 minPhoEtCut_ = pset.getParameter<double>("minPhoEtCut");
00116 mergedTracks_ = pset.getParameter<bool>("mergedTracks");
00117 isRunCentrally_= pset.getParameter<bool>("isRunCentrally");
00118
00119 }
00120
00121
00122
00123
00124
00125 TkConvValidator::~TkConvValidator() {}
00126
00127
00128
00129
00130 void TkConvValidator::beginJob() {
00131
00132 nEvt_=0;
00133 nEntry_=0;
00134 nRecConv_=0;
00135 nRecConvAss_=0;
00136 nRecConvAssWithEcal_=0;
00137
00138 nInvalidPCA_=0;
00139
00140 dbe_ = 0;
00141 dbe_ = edm::Service<DQMStore>().operator->();
00142
00143
00144 double etMin = parameters_.getParameter<double>("etMin");
00145 double etMax = parameters_.getParameter<double>("etMax");
00146 int etBin = parameters_.getParameter<int>("etBin");
00147
00148
00149 double resMin = parameters_.getParameter<double>("resMin");
00150 double resMax = parameters_.getParameter<double>("resMax");
00151 int resBin = parameters_.getParameter<int>("resBin");
00152
00153 double etaMin = parameters_.getParameter<double>("etaMin");
00154 double etaMax = parameters_.getParameter<double>("etaMax");
00155 int etaBin = parameters_.getParameter<int>("etaBin");
00156 int etaBin2 = parameters_.getParameter<int>("etaBin2");
00157
00158
00159 double phiMin = parameters_.getParameter<double>("phiMin");
00160 double phiMax = parameters_.getParameter<double>("phiMax");
00161 int phiBin = parameters_.getParameter<int>("phiBin");
00162
00163
00164 double rMin = parameters_.getParameter<double>("rMin");
00165 double rMax = parameters_.getParameter<double>("rMax");
00166 int rBin = parameters_.getParameter<int>("rBin");
00167
00168 double zMin = parameters_.getParameter<double>("zMin");
00169 double zMax = parameters_.getParameter<double>("zMax");
00170 int zBin = parameters_.getParameter<int>("zBin");
00171
00172 double dPhiTracksMin = parameters_.getParameter<double>("dPhiTracksMin");
00173 double dPhiTracksMax = parameters_.getParameter<double>("dPhiTracksMax");
00174 int dPhiTracksBin = parameters_.getParameter<int>("dPhiTracksBin");
00175
00176
00177
00178
00179
00180 double dCotTracksMin = parameters_.getParameter<double>("dCotTracksMin");
00181 double dCotTracksMax = parameters_.getParameter<double>("dCotTracksMax");
00182 int dCotTracksBin = parameters_.getParameter<int>("dCotTracksBin");
00183
00184
00185 double chi2Min = parameters_.getParameter<double>("chi2Min");
00186 double chi2Max = parameters_.getParameter<double>("chi2Max");
00187
00188
00189 double rMinForXray = parameters_.getParameter<double>("rMinForXray");
00190 double rMaxForXray = parameters_.getParameter<double>("rMaxForXray");
00191 int rBinForXray = parameters_.getParameter<int>("rBinForXray");
00192 double zMinForXray = parameters_.getParameter<double>("zMinForXray");
00193 double zMaxForXray = parameters_.getParameter<double>("zMaxForXray");
00194 int zBinForXray = parameters_.getParameter<int>("zBinForXray");
00195 int zBin2ForXray = parameters_.getParameter<int>("zBin2ForXray");
00196
00197 minPhoPtForEffic = parameters_.getParameter<double>("minPhoPtForEffic");
00198 maxPhoEtaForEffic = parameters_.getParameter<double>("maxPhoEtaForEffic");
00199 maxPhoZForEffic = parameters_.getParameter<double>("maxPhoZForEffic");
00200 maxPhoRForEffic = parameters_.getParameter<double>("maxPhoRForEffic");
00201 minPhoPtForPurity = parameters_.getParameter<double>("minPhoPtForPurity");
00202 maxPhoEtaForPurity = parameters_.getParameter<double>("maxPhoEtaForPurity");
00203 maxPhoZForPurity = parameters_.getParameter<double>("maxPhoZForPurity");
00204 maxPhoRForPurity = parameters_.getParameter<double>("maxPhoRForPurity");
00205
00206 if (dbe_) {
00207
00209
00210
00211 dbe_->setCurrentFolder("EgammaV/ConversionValidator/SimulationInfo");
00212
00213
00215 std::string histname = "nOfSimConversions";
00216 h_nSimConv_[0] = dbe_->book1D(histname,"# of Sim conversions per event ",20,-0.5,19.5);
00218 histname = "h_AllSimConvEta";
00219 h_AllSimConv_[0] = dbe_->book1D(histname," All conversions: simulated #eta",etaBin2,etaMin,etaMax);
00220 histname = "h_AllSimConvPhi";
00221 h_AllSimConv_[1] = dbe_->book1D(histname," All conversions: simulated #phi",phiBin,phiMin,phiMax);
00222 histname = "h_AllSimConvR";
00223 h_AllSimConv_[2] = dbe_->book1D(histname," All conversions: simulated R",rBin,rMin,rMax);
00224 histname = "h_AllSimConvZ";
00225 h_AllSimConv_[3] = dbe_->book1D(histname," All conversions: simulated Z",zBin,zMin,zMax);
00226 histname = "h_AllSimConvEt";
00227 h_AllSimConv_[4] = dbe_->book1D(histname," All conversions: simulated Et",etBin,etMin,etMax);
00228
00229 histname = "nOfVisSimConversions";
00230 h_nSimConv_[1] = dbe_->book1D(histname,"# of Sim conversions per event ",20,-0.5,19.5);
00231 histname = "h_VisSimConvEta";
00232 h_VisSimConv_[0] = dbe_->book1D(histname," All vis conversions: simulated #eta",etaBin2,etaMin, etaMax);
00233 histname = "h_VisSimConvPhi";
00234 h_VisSimConv_[1] = dbe_->book1D(histname," All vis conversions: simulated #phi",phiBin,phiMin, phiMax);
00235 histname = "h_VisSimConvR";
00236 h_VisSimConv_[2] = dbe_->book1D(histname," All vis conversions: simulated R",rBin,rMin,rMax);
00237 histname = "h_VisSimConvZ";
00238 h_VisSimConv_[3] = dbe_->book1D(histname," All vis conversions: simulated Z",zBin,zMin, zMax);
00239 histname = "h_VisSimConvEt";
00240 h_VisSimConv_[4] = dbe_->book1D(histname," All vis conversions: simulated Et",etBin,etMin, etMax);
00241
00242
00243 histname = "h_SimConvTwoMTracksEta";
00244 h_SimConvTwoMTracks_[0] = dbe_->book1D(histname," All vis conversions with 2 reco-matching tracks: simulated #eta",etaBin2,etaMin, etaMax);
00245 histname = "h_SimConvTwoMTracksPhi";
00246 h_SimConvTwoMTracks_[1] = dbe_->book1D(histname," All vis conversions with 2 reco-matching tracks: simulated #phi",phiBin,phiMin, phiMax);
00247 histname = "h_SimConvTwoMTracksR";
00248 h_SimConvTwoMTracks_[2] = dbe_->book1D(histname," All vis conversions with 2 reco-matching tracks: simulated R",rBin,rMin, rMax);
00249 histname = "h_SimConvTwoMTracksZ";
00250 h_SimConvTwoMTracks_[3] = dbe_->book1D(histname," All vis conversions with 2 reco-matching tracks: simulated Z",zBin,zMin, zMax);
00251 histname = "h_SimConvTwoMTracksEt";
00252 h_SimConvTwoMTracks_[4] = dbe_->book1D(histname," All vis conversions with 2 reco-matching tracks: simulated Et",etBin,etMin, etMax);
00253
00254 histname = "h_SimConvTwoTracksEta";
00255 h_SimConvTwoTracks_[0] = dbe_->book1D(histname," All vis conversions with 2 reco tracks: simulated #eta",etaBin2,etaMin, etaMax);
00256 histname = "h_SimConvTwoTracksPhi";
00257 h_SimConvTwoTracks_[1] = dbe_->book1D(histname," All vis conversions with 2 reco tracks: simulated #phi",phiBin,phiMin, phiMax);
00258 histname = "h_SimConvTwoTracksR";
00259 h_SimConvTwoTracks_[2] = dbe_->book1D(histname," All vis conversions with 2 reco tracks: simulated R",rBin,rMin, rMax);
00260 histname = "h_SimConvTwoTracksZ";
00261 h_SimConvTwoTracks_[3] = dbe_->book1D(histname," All vis conversions with 2 reco tracks: simulated Z",zBin,zMin, zMax);
00262 histname = "h_SimConvTwoTracksEt";
00263 h_SimConvTwoTracks_[4] = dbe_->book1D(histname," All vis conversions with 2 reco tracks: simulated Et",etBin,etMin, etMax);
00264
00265 histname = "h_SimConvTwoMTracksEtaAndVtxPGT0";
00266 h_SimConvTwoMTracksAndVtxPGT0_[0] = dbe_->book1D(histname," All vis conversions with 2 reco-matching tracks + vertex: simulated #eta",etaBin2,etaMin, etaMax);
00267 histname = "h_SimConvTwoMTracksPhiAndVtxPGT0";
00268 h_SimConvTwoMTracksAndVtxPGT0_[1] = dbe_->book1D(histname," All vis conversions with 2 reco-matching tracks + vertex: simulated #phi",phiBin,phiMin, phiMax);
00269 histname = "h_SimConvTwoMTracksRAndVtxPGT0";
00270 h_SimConvTwoMTracksAndVtxPGT0_[2] = dbe_->book1D(histname," All vis conversions with 2 reco-matching tracks + vertex: simulated R",rBin,rMin, rMax);
00271 histname = "h_SimConvTwoMTracksZAndVtxPGT0";
00272 h_SimConvTwoMTracksAndVtxPGT0_[3] = dbe_->book1D(histname," All vis conversions with 2 reco-matching tracks + vertex: simulated Z",zBin,zMin, zMax);
00273 histname = "h_SimConvTwoMTracksEtAndVtxPGT0";
00274 h_SimConvTwoMTracksAndVtxPGT0_[4] = dbe_->book1D(histname," All vis conversions with 2 reco-matching tracks + vertex: simulated Et",etBin,etMin, etMax);
00275
00276
00277 histname = "h_SimConvTwoMTracksEtaAndVtxPGT0005";
00278 h_SimConvTwoMTracksAndVtxPGT0005_[0] = dbe_->book1D(histname," All vis conversions with 2 reco-matching tracks + vertex: simulated #eta",etaBin2,etaMin, etaMax);
00279 histname = "h_SimConvTwoMTracksPhiAndVtxPGT0005";
00280 h_SimConvTwoMTracksAndVtxPGT0005_[1] = dbe_->book1D(histname," All vis conversions with 2 reco-matching tracks + vertex: simulated #phi",phiBin,phiMin, phiMax);
00281 histname = "h_SimConvTwoMTracksRAndVtxPGT0005";
00282 h_SimConvTwoMTracksAndVtxPGT0005_[2] = dbe_->book1D(histname," All vis conversions with 2 reco-matching tracks + vertex: simulated R",rBin,rMin, rMax);
00283 histname = "h_SimConvTwoMTracksZAndVtxPGT0005";
00284 h_SimConvTwoMTracksAndVtxPGT0005_[3] = dbe_->book1D(histname," All vis conversions with 2 reco-matching tracks + vertex: simulated Z",zBin,zMin, zMax);
00285 histname = "h_SimConvTwoMTracksEtAndVtxPGT0005";
00286 h_SimConvTwoMTracksAndVtxPGT0005_[4] = dbe_->book1D(histname," All vis conversions with 2 reco-matching tracks + vertex: simulated Et",etBin,etMin, etMax);
00287
00288
00289 h_SimConvEtaPix_[0] = dbe_->book1D("simConvEtaPix"," sim converted Photon Eta: Pix ",etaBin,etaMin, etaMax) ;
00290 h_simTkPt_ = dbe_->book1D("simTkPt","Sim conversion tracks pt ",etBin*3,0.,etMax);
00291 h_simTkEta_ = dbe_->book1D("simTkEta","Sim conversion tracks eta ",etaBin,etaMin,etaMax);
00292
00293 h_simConvVtxRvsZ_[0] = dbe_->book2D("simConvVtxRvsZAll"," Photon Sim conversion vtx position",zBinForXray, zMinForXray, zMaxForXray, rBinForXray, rMinForXray, rMaxForXray);
00294 h_simConvVtxRvsZ_[1] = dbe_->book2D("simConvVtxRvsZBarrel"," Photon Sim conversion vtx position",zBinForXray, zMinForXray, zMaxForXray, rBinForXray, rMinForXray, rMaxForXray);
00295 h_simConvVtxRvsZ_[2] = dbe_->book2D("simConvVtxRvsZEndcap"," Photon Sim conversion vtx position",zBin2ForXray, zMinForXray, zMaxForXray, rBinForXray, rMinForXray, rMaxForXray);
00296 h_simConvVtxRvsZ_[3] = dbe_->book2D("simConvVtxRvsZBarrel2"," Photon Sim conversion vtx position when reco R<4cm",zBinForXray, zMinForXray, zMaxForXray, rBinForXray, rMinForXray, rMaxForXray);
00297 h_simConvVtxYvsX_ = dbe_->book2D("simConvVtxYvsXTrkBarrel"," Photon Sim conversion vtx position, (x,y) eta<1 ",100, -80., 80., 100, -80., 80.);
00298
00299 dbe_->setCurrentFolder("EgammaV/ConversionValidator/ConversionInfo");
00300
00301 histname="nConv";
00302 h_nConv_[0][0] = dbe_->book1D(histname+"All","Number Of Conversions per isolated candidates per events: All Ecal ",10,-0.5, 9.5);
00303 h_nConv_[0][1] = dbe_->book1D(histname+"Barrel","Number Of Conversions per isolated candidates per events: Ecal Barrel ",10,-0.5, 9.5);
00304 h_nConv_[0][2] = dbe_->book1D(histname+"Endcap","Number Of Conversions per isolated candidates per events: Ecal Endcap ",10,-0.5, 9.5);
00305 h_nConv_[1][0] = dbe_->book1D(histname+"All_Ass","Number Of associated Conversions per isolated candidates per events: All Ecal ",10,-0.5, 9.5);
00306
00307 h_convEta_[0][0] = dbe_->book1D("convEta"," converted Photon Eta ",etaBin,etaMin, etaMax) ;
00308 h_convPhi_[0][0] = dbe_->book1D("convPhi"," converted Photon Phi ",phiBin,phiMin,phiMax) ;
00309 h_convR_[0][0] = dbe_->book1D("convR"," converted photon R",rBin,rMin, rMax);
00310 h_convZ_[0][0] = dbe_->book1D("convZ"," converted photon Z",zBin,zMin, zMax);
00311 h_convPt_[0][0] = dbe_->book1D("convPt"," conversions Transverse Energy: all eta ", etBin,etMin, etMax);
00312
00313 h_convEta_[1][0] = dbe_->book1D("convEtaAss"," Matched converted Photon Eta ",etaBin,etaMin, etaMax) ;
00314 h_convPhi_[1][0] = dbe_->book1D("convPhiAss"," Matched converted Photon Phi ",phiBin,phiMin,phiMax) ;
00315 h_convR_[1][0] = dbe_->book1D("convRAss"," Matched converted photon R",rBin,rMin, rMax);
00316 h_convZ_[1][0] = dbe_->book1D("convZAss"," Matched converted photon Z",zBin,zMin, zMax);
00317 h_convPt_[1][0] = dbe_->book1D("convPtAss","Matched conversions Transverse Energy: all eta ", etBin,etMin, etMax);
00318
00319 h_convEta_[2][0] = dbe_->book1D("convEtaFake"," Fake converted Photon Eta ",etaBin,etaMin, etaMax) ;
00320 h_convPhi_[2][0] = dbe_->book1D("convPhiFake"," Fake converted Photon Phi ",phiBin,phiMin,phiMax) ;
00321 h_convR_[2][0] = dbe_->book1D("convRFake"," Fake converted photon R",rBin,rMin, rMax);
00322 h_convZ_[2][0] = dbe_->book1D("convZFake"," Fake converted photon Z",zBin,zMin, zMax);
00323 h_convPt_[2][0] = dbe_->book1D("convPtFake","Fake conversions Transverse Energy: all eta ", etBin,etMin, etMax);
00324
00325 h_convRplot_ = dbe_->book1D("convRplot"," converted photon R",400, 0.,80.);
00326 h_convZplot_ = dbe_->book1D("convZplot"," converted photon Z",320,-160.,160.);
00327
00328
00329 histname = "convPtRes";
00330 h_convPtRes_[0] = dbe_->book1D(histname+"All"," Conversion Pt rec/true : All ecal ", resBin,resMin, resMax);
00331 h_convPtRes_[1] = dbe_->book1D(histname+"Barrel"," Conversion Pt rec/true : Barrel ",resBin,resMin, resMax);
00332 h_convPtRes_[2] = dbe_->book1D(histname+"Endcap"," Conversion Pt rec/true : Endcap ",resBin,resMin, resMax);
00333
00334
00335 histname="hInvMass";
00336 h_invMass_[0][0]= dbe_->book1D(histname+"All_AllTracks"," Photons:Tracks from conversion: Pair invariant mass: all Ecal ",100, 0., 1.5);
00337 h_invMass_[0][1]= dbe_->book1D(histname+"Barrel_AllTracks"," Photons:Tracks from conversion: Pair invariant mass: Barrel Ecal ",100, 0., 1.5);
00338 h_invMass_[0][2]= dbe_->book1D(histname+"Endcap_AllTracks"," Photons:Tracks from conversion: Pair invariant mass: Endcap Ecal ",100, 0., 1.5);
00339
00340 h_invMass_[1][0]= dbe_->book1D(histname+"All_AssTracks"," Photons:Tracks from conversion: Pair invariant mass: all Ecal ",100, 0., 1.5);
00341 h_invMass_[1][1]= dbe_->book1D(histname+"Barrel_AssTracks"," Photons:Tracks from conversion: Pair invariant mass: Barrel Ecal ",100, 0., 1.5);
00342 h_invMass_[1][2]= dbe_->book1D(histname+"Endcap_AssTracks"," Photons:Tracks from conversion: Pair invariant mass: Endcap Ecal ",100, 0., 1.5);
00343
00344 h_invMass_[2][0]= dbe_->book1D(histname+"All_FakeTracks"," Photons:Tracks from conversion: Pair invariant mass: all Ecal ",100, 0., 1.5);
00345 h_invMass_[2][1]= dbe_->book1D(histname+"Barrel_FakeTracks"," Photons:Tracks from conversion: Pair invariant mass: Barrel Ecal ",100, 0., 1.5);
00346 h_invMass_[2][2]= dbe_->book1D(histname+"Endcap_FaleTracks"," Photons:Tracks from conversion: Pair invariant mass: Endcap Ecal ",100, 0., 1.5);
00347
00348
00349
00350 histname="hDPhiTracksAtVtx";
00351 h_DPhiTracksAtVtx_[0][0] =dbe_->book1D(histname+"All", " Photons:Tracks from conversions: #delta#phi Tracks at vertex: all Ecal",dPhiTracksBin,dPhiTracksMin,dPhiTracksMax);
00352 h_DPhiTracksAtVtx_[0][1] =dbe_->book1D(histname+"Barrel", " Photons:Tracks from conversions: #delta#phi Tracks at vertex: Barrel Ecal",dPhiTracksBin,dPhiTracksMin,dPhiTracksMax);
00353 h_DPhiTracksAtVtx_[0][2] =dbe_->book1D(histname+"Endcap", " Photons:Tracks from conversions: #delta#phi Tracks at vertex: Endcap Ecal",dPhiTracksBin,dPhiTracksMin,dPhiTracksMax);
00354 h_DPhiTracksAtVtx_[1][0] =dbe_->book1D(histname+"All_Ass", " Photons:Tracks from conversions: #delta#phi Tracks at vertex: all Ecal",dPhiTracksBin,dPhiTracksMin,dPhiTracksMax);
00355 h_DPhiTracksAtVtx_[1][1] =dbe_->book1D(histname+"Barrel_Ass", " Photons:Tracks from conversions: #delta#phi Tracks at vertex: Barrel Ecal",dPhiTracksBin,dPhiTracksMin,dPhiTracksMax);
00356 h_DPhiTracksAtVtx_[1][2] =dbe_->book1D(histname+"Endcap_Ass", " Photons:Tracks from conversions: #delta#phi Tracks at vertex: Endcap Ecal",dPhiTracksBin,dPhiTracksMin,dPhiTracksMax);
00357 h_DPhiTracksAtVtx_[2][0] =dbe_->book1D(histname+"All_Fakes", " Photons:Tracks from conversions: #delta#phi Tracks at vertex: all Ecal",dPhiTracksBin,dPhiTracksMin,dPhiTracksMax);
00358 h_DPhiTracksAtVtx_[2][1] =dbe_->book1D(histname+"Barrel_Fakes", " Photons:Tracks from conversions: #delta#phi Tracks at vertex: Barrel Ecal",dPhiTracksBin,dPhiTracksMin,dPhiTracksMax);
00359 h_DPhiTracksAtVtx_[2][2] =dbe_->book1D(histname+"Endcap_Fakes", " Photons:Tracks from conversions: #delta#phi Tracks at vertex: Endcap Ecal",dPhiTracksBin,dPhiTracksMin,dPhiTracksMax);
00360
00361
00362
00363 histname="hDPhiTracksAtVtxVsEta";
00364 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);
00365 histname="pDPhiTracksAtVtxVsEta";
00366 p_DPhiTracksAtVtxVsEta_ = dbe_->bookProfile(histname+"All"," Photons:Tracks from conversions: #delta#phi Tracks at vertex vs #eta ",etaBin2,etaMin, etaMax, 100, -0.5, 0.5,"");
00367
00368 histname="hDPhiTracksAtVtxVsR";
00369 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);
00370 histname="pDPhiTracksAtVtxVsR";
00371 p_DPhiTracksAtVtxVsR_ = dbe_->bookProfile(histname+"All"," Photons:Tracks from conversions: #delta#phi Tracks at vertex vs R ",rBin,rMin, rMax,100, -0.5, 0.5,"");
00372
00373
00374 histname="hDCotTracks";
00375 h_DCotTracks_[0][0]= dbe_->book1D(histname+"All"," Photons:Tracks from conversions #delta cotg(#Theta) Tracks: all Ecal ",dCotTracksBin,dCotTracksMin,dCotTracksMax);
00376 h_DCotTracks_[0][1]= dbe_->book1D(histname+"Barrel"," Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Barrel Ecal ",dCotTracksBin,dCotTracksMin,dCotTracksMax);
00377 h_DCotTracks_[0][2]= dbe_->book1D(histname+"Endcap"," Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Endcap Ecal ",dCotTracksBin,dCotTracksMin,dCotTracksMax);
00378 h_DCotTracks_[1][0]= dbe_->book1D(histname+"All_Ass"," Photons:Tracks from conversions #delta cotg(#Theta) Tracks: all Ecal ",dCotTracksBin,dCotTracksMin,dCotTracksMax);
00379 h_DCotTracks_[1][1]= dbe_->book1D(histname+"Barrel_Ass"," Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Barrel Ecal ",dCotTracksBin,dCotTracksMin,dCotTracksMax);
00380 h_DCotTracks_[1][2]= dbe_->book1D(histname+"Endcap_Ass"," Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Endcap Ecal ",dCotTracksBin,dCotTracksMin,dCotTracksMax);
00381 h_DCotTracks_[2][0]= dbe_->book1D(histname+"All_Fakes"," Photons:Tracks from conversions #delta cotg(#Theta) Tracks: all Ecal ",dCotTracksBin,dCotTracksMin,dCotTracksMax);
00382 h_DCotTracks_[2][1]= dbe_->book1D(histname+"Barrel_Fakes"," Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Barrel Ecal ",dCotTracksBin,dCotTracksMin,dCotTracksMax);
00383 h_DCotTracks_[2][2]= dbe_->book1D(histname+"Endcap_Fakes"," Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Endcap Ecal ",dCotTracksBin,dCotTracksMin,dCotTracksMax);
00384
00385
00386 histname="hDCotTracksVsEta";
00387 h2_DCotTracksVsEta_ = dbe_->book2D(histname+"All"," Photons:Tracks from conversions: #delta cotg(#Theta) Tracks vs #eta",etaBin2,etaMin, etaMax,100, -0.2, 0.2);
00388 histname="pDCotTracksVsEta";
00389 p_DCotTracksVsEta_ = dbe_->bookProfile(histname+"All"," Photons:Tracks from conversions: #delta cotg(#Theta) Tracks vs #eta ",etaBin2,etaMin, etaMax, 100, -0.2, 0.2,"");
00390
00391 histname="hDCotTracksVsR";
00392 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);
00393 histname="pDCotTracksVsR";
00394 p_DCotTracksVsR_ = dbe_->bookProfile(histname+"All"," Photons:Tracks from conversions: #delta cotg(#Theta) Tracks at vertex vs R ",rBin,rMin, rMax,100, -0.2, 0.2,"");
00395
00396
00397 histname="hDistMinAppTracks";
00398 h_distMinAppTracks_[0][0]= dbe_->book1D(histname+"All"," Photons:Tracks from conversions Min Approach Dist Tracks: all Ecal ",120, -0.5, 1.0);
00399 h_distMinAppTracks_[0][1]= dbe_->book1D(histname+"Barrel"," Photons:Tracks from conversions Min Approach Dist Tracks: Barrel Ecal ",120, -0.5, 1.0);
00400 h_distMinAppTracks_[0][2]= dbe_->book1D(histname+"Endcap"," Photons:Tracks from conversions Min Approach Dist Tracks: Endcap Ecal ",120, -0.5, 1.0);
00401 h_distMinAppTracks_[1][0]= dbe_->book1D(histname+"All_Ass"," Photons:Tracks from conversions Min Approach Dist Tracks: all Ecal ",120, -0.5, 1.0);
00402 h_distMinAppTracks_[1][1]= dbe_->book1D(histname+"Barrel_Ass"," Photons:Tracks from conversions Min Approach Dist Tracks: Barrel Ecal ",120, -0.5, 1.0);
00403 h_distMinAppTracks_[1][2]= dbe_->book1D(histname+"Endcap_Ass"," Photons:Tracks from conversions Min Approach Dist Tracks: Endcap Ecal ",120, -0.5, 1.0);
00404 h_distMinAppTracks_[2][0]= dbe_->book1D(histname+"All_Fakes"," Photons:Tracks from conversions Min Approach Dist Tracks: all Ecal ",120, -0.5, 1.0);
00405 h_distMinAppTracks_[2][1]= dbe_->book1D(histname+"Barrel_Fakes"," Photons:Tracks from conversions Min Approach Dist Tracks: Barrel Ecal ",120, -0.5, 1.0);
00406 h_distMinAppTracks_[2][2]= dbe_->book1D(histname+"Endcap_Fakes"," Photons:Tracks from conversions Min Approach Dist Tracks: Endcap Ecal ",120, -0.5, 1.0);
00407
00408
00409 h_convVtxRvsZ_[0] = dbe_->book2D("convVtxRvsZAll"," Photon Reco conversion vtx position",zBinForXray, zMinForXray, zMaxForXray, rBinForXray, rMinForXray, rMaxForXray);
00410 h_convVtxRvsZ_[1] = dbe_->book2D("convVtxRvsZBarrel"," Photon Reco conversion vtx position",zBinForXray, zMinForXray, zMaxForXray, rBinForXray, rMinForXray, rMaxForXray);
00411 h_convVtxRvsZ_[2] = dbe_->book2D("convVtxRvsZEndcap"," Photon Reco conversion vtx position",zBin2ForXray, zMinForXray, zMaxForXray, rBinForXray, rMinForXray, rMaxForXray);
00412 h_convVtxYvsX_ = dbe_->book2D("convVtxYvsXTrkBarrel"," Photon Reco conversion vtx position, (x,y) eta<1 ", 1000, -60., 60., 1000, -60., 60.);
00414 h_convVtxRvsZ_zoom_[0] = dbe_->book2D("convVtxRvsZBarrelZoom1"," Photon Reco conversion vtx position",zBinForXray, zMinForXray, zMaxForXray, rBinForXray, -10., 40.);
00415 h_convVtxRvsZ_zoom_[1] = dbe_->book2D("convVtxRvsZBarrelZoom2"," Photon Reco conversion vtx position",zBinForXray, zMinForXray, zMaxForXray, rBinForXray, -10., 20.);
00416 h_convVtxYvsX_zoom_[0] = dbe_->book2D("convVtxYvsXTrkBarrelZoom1"," Photon Reco conversion vtx position, (x,y) eta<1 ",100, -40., 40., 100, -40., 40.);
00417 h_convVtxYvsX_zoom_[1] = dbe_->book2D("convVtxYvsXTrkBarrelZoom2"," Photon Reco conversion vtx position, (x,y) eta<1 ",100, -20., 20., 100, -20., 20.);
00418
00419 h_convVtxdR_ = dbe_->book1D("convVtxdR"," Photon Reco conversion vtx dR",100, -10.,10.);
00420 h_convVtxdX_ = dbe_->book1D("convVtxdX"," Photon Reco conversion vtx dX",100, -10.,10.);
00421 h_convVtxdY_ = dbe_->book1D("convVtxdY"," Photon Reco conversion vtx dY",100, -10.,10.);
00422 h_convVtxdZ_ = dbe_->book1D("convVtxdZ"," Photon Reco conversion vtx dZ",100, -20.,20.);
00423
00424 h_convVtxdPhi_ = dbe_->book1D("convVtxdPhi"," Photon Reco conversion vtx dPhi",100, -0.01,0.01);
00425 h_convVtxdEta_ = dbe_->book1D("convVtxdEta"," Photon Reco conversion vtx dEta",100, -0.5,0.5);
00426
00427 h_convVtxdR_barrel_ = dbe_->book1D("convVtxdR_barrel"," Photon Reco conversion vtx dR, |eta|<=1.2",100, -10.,10.);
00428 h_convVtxdX_barrel_ = dbe_->book1D("convVtxdX_barrel"," Photon Reco conversion vtx dX, |eta|<=1.2",100, -10.,10.);
00429 h_convVtxdY_barrel_ = dbe_->book1D("convVtxdY_barrel"," Photon Reco conversion vtx dY, |eta|<=1.2 ",100, -10.,10.);
00430 h_convVtxdZ_barrel_ = dbe_->book1D("convVtxdZ_barrel"," Photon Reco conversion vtx dZ, |eta|<=1.2,",100, -20.,20.);
00431
00432 h_convVtxdR_endcap_ = dbe_->book1D("convVtxdR_endcap"," Photon Reco conversion vtx dR, |eta|>1.2 ",100, -10.,10.);
00433 h_convVtxdX_endcap_ = dbe_->book1D("convVtxdX_endcap"," Photon Reco conversion vtx dX, |eta|>1.2",100, -10.,10.);
00434 h_convVtxdY_endcap_ = dbe_->book1D("convVtxdY_endcap"," Photon Reco conversion vtx dY, |eta|>1.2",100, -10.,10.);
00435 h_convVtxdZ_endcap_ = dbe_->book1D("convVtxdZ_endcap"," Photon Reco conversion vtx dZ, |eta|>1.2",100, -20.,20.);
00436
00437
00438
00439 h2_convVtxdRVsR_ = dbe_->book2D("h2ConvVtxdRVsR"," Conversion vtx dR vsR" ,rBin,rMin, rMax,100, -20.,20.);
00440 h2_convVtxdRVsEta_ = dbe_->book2D("h2ConvVtxdRVsEta","Conversion vtx dR vs Eta" ,etaBin2,etaMin, etaMax,100, -20.,20.);
00441
00442 p_convVtxdRVsR_ = dbe_->bookProfile("pConvVtxdRVsR"," Conversion vtx dR vsR" ,rBin,rMin, rMax ,100, -20.,20., "");
00443 p_convVtxdRVsEta_ = dbe_->bookProfile("pConvVtxdRVsEta","Conversion vtx dR vs Eta" ,etaBin2,etaMin, etaMax, 100, -20.,20., "");
00444 p_convVtxdXVsX_ = dbe_->bookProfile("pConvVtxdXVsX","Conversion vtx dX vs X" ,120,-60, 60 ,100, -20.,20., "");
00445 p_convVtxdYVsY_ = dbe_->bookProfile("pConvVtxdYVsY","Conversion vtx dY vs Y" ,120,-60, 60 ,100, -20.,20., "");
00446 p_convVtxdZVsZ_ = dbe_->bookProfile("pConvVtxdZVsZ","Conversion vtx dZ vs Z" ,zBin,zMin,zMax ,100, -20.,20., "");
00447
00448 p_convVtxdZVsR_ = dbe_->bookProfile("pConvVtxdZVsR","Conversion vtx dZ vs R" ,rBin,rMin,rMax ,100, -20.,20., "");
00449 p2_convVtxdRVsRZ_ = dbe_->bookProfile2D("p2ConvVtxdRVsRZ","Conversion vtx dR vs RZ" ,zBin,zMin, zMax,rBin,rMin,rMax,100, 0.,20.,"s");
00450 p2_convVtxdZVsRZ_ = dbe_->bookProfile2D("p2ConvVtxdZVsRZ","Conversion vtx dZ vs RZ" ,zBin,zMin, zMax,rBin,rMin,rMax,100, 0.,20.,"s");
00451
00452
00453
00454 h2_convVtxRrecVsTrue_ = dbe_->book2D("h2ConvVtxRrecVsTrue","Photon Reco conversion vtx R rec vs true" ,rBin,rMin, rMax,rBin,rMin, rMax);
00455
00456 histname="vtxChi2Prob";
00457 h_vtxChi2Prob_[0][0] = dbe_->book1D(histname+"All","vertex #chi^{2} all", 100, 0., 1.);
00458 h_vtxChi2Prob_[0][1] = dbe_->book1D(histname+"Barrel","vertex #chi^{2} barrel", 100, 0., 1.);
00459 h_vtxChi2Prob_[0][2] = dbe_->book1D(histname+"Endcap","vertex #chi^{2} endcap", 100, 0., 1.);
00460 h_vtxChi2Prob_[1][0] = dbe_->book1D(histname+"All_Ass","vertex #chi^{2} all", 100, 0., 1.);
00461 h_vtxChi2Prob_[1][1] = dbe_->book1D(histname+"Barrel_Ass","vertex #chi^{2} barrel", 100, 0., 1.);
00462 h_vtxChi2Prob_[1][2] = dbe_->book1D(histname+"Endcap_Ass","vertex #chi^{2} endcap", 100, 0., 1.);
00463 h_vtxChi2Prob_[2][0] = dbe_->book1D(histname+"All_Fakes","vertex #chi^{2} all", 100, 0., 1.);
00464 h_vtxChi2Prob_[2][1] = dbe_->book1D(histname+"Barrel_Fakes","vertex #chi^{2} barrel", 100, 0., 1.);
00465 h_vtxChi2Prob_[2][2] = dbe_->book1D(histname+"Endcap_Fakes","vertex #chi^{2} endcap", 100, 0., 1.);
00466
00467
00468 h_zPVFromTracks_[1] = dbe_->book1D("zPVFromTracks"," Photons: PV z from conversion tracks",100, -25., 25.);
00469 h_dzPVFromTracks_[1] = dbe_->book1D("dzPVFromTracks"," Photons: PV Z_rec - Z_true from conversion tracks",100, -5., 5.);
00470 h2_dzPVVsR_ = dbe_->book2D("h2dzPVVsR","Photon Reco conversions: dz(PV) vs R" ,rBin,rMin, rMax,100, -3.,3.);
00471 p_dzPVVsR_ = dbe_->bookProfile("pdzPVVsR","Photon Reco conversions: dz(PV) vs R" ,rBin,rMin, rMax, 100, -3.,3.,"");
00472
00473
00475 histname="nHits";
00476 nHits_[0] = dbe_->book2D(histname+"AllTracks","Photons:Tracks from conversions: # of hits all tracks",etaBin,etaMin, etaMax,30,0., 30.);
00477 nHits_[1] = dbe_->book2D(histname+"AllTracks_Ass","Photons:Tracks from conversions: # of hits all tracks ass",etaBin,etaMin, etaMax,30,0., 30.);
00478 nHits_[2] = dbe_->book2D(histname+"AllTracks_Fakes","Photons:Tracks from conversions: # of hits all tracks fakes",etaBin,etaMin, etaMax,30,0., 30.);
00479
00480
00481 histname="nHitsVsEta";
00482 nHitsVsEta_[0] = dbe_->book2D(histname+"AllTracks","Photons:Tracks from conversions: # of hits vs #eta all tracks",etaBin,etaMin, etaMax,30,0., 30.);
00483 nHitsVsEta_[1] = dbe_->book2D(histname+"AllTracks_Ass","Photons:Tracks from conversions: # of hits vs #eta all tracks",etaBin,etaMin, etaMax,30,0., 30.);
00484 nHitsVsEta_[2] = dbe_->book2D(histname+"AllTracks_Fakes","Photons:Tracks from conversions: # of hits vs #eta all tracks",etaBin,etaMin, etaMax,30,0., 30.);
00485 histname="h_nHitsVsEta";
00486 p_nHitsVsEta_[0] = dbe_->bookProfile(histname+"AllTracks","Photons:Tracks from conversions: # of hits vs #eta all tracks",etaBin,etaMin, etaMax, 30,-0.5, 29.5,"");
00487 p_nHitsVsEta_[1] = dbe_->bookProfile(histname+"AllTracks_Ass","Photons:Tracks from conversions: # of hits vs #eta all tracks",etaBin,etaMin, etaMax, 30,-0.5, 29.5,"");
00488 p_nHitsVsEta_[2] = dbe_->bookProfile(histname+"AllTracks_Fakes","Photons:Tracks from conversions: # of hits vs #eta all tracks",etaBin,etaMin, etaMax, 30,-0.5, 29.5,"");
00489
00490
00491 histname="nHitsVsR";
00492 nHitsVsR_[0] = dbe_->book2D(histname+"AllTracks","Photons:Tracks from conversions: # of hits vs radius all tracks" ,rBin,rMin, rMax,30,0., 30.);
00493 nHitsVsR_[1] = dbe_->book2D(histname+"AllTracks_Ass","Photons:Tracks from conversions: # of hits vs radius all tracks" ,rBin,rMin, rMax,30,0., 30.);
00494 nHitsVsR_[2] = dbe_->book2D(histname+"AllTracks_Fakes","Photons:Tracks from conversions: # of hits vs radius all tracks" ,rBin,rMin, rMax,30,0., 30.);
00495
00496 histname="h_nHitsVsR";
00497 p_nHitsVsR_[0] = dbe_->bookProfile(histname+"AllTracks","Photons:Tracks from conversions: # of hits vs radius all tracks",rBin,rMin, rMax, 30,-0.5, 29.5,"");
00498 p_nHitsVsR_[1] = dbe_->bookProfile(histname+"AllTracks_Ass","Photons:Tracks from conversions: # of hits vs radius all tracks",rBin,rMin, rMax, 30,-0.5, 29.5,"");
00499 p_nHitsVsR_[2] = dbe_->bookProfile(histname+"AllTracks_Fakes","Photons:Tracks from conversions: # of hits vs radius all tracks",rBin,rMin, rMax, 30,-0.5, 29.5,"");
00500
00501 histname="tkChi2";
00502 h_tkChi2_[0] = dbe_->book1D(histname+"AllTracks","Photons:Tracks from conversions: #chi^{2} of all tracks", 100, chi2Min, chi2Max);
00503 h_tkChi2_[1] = dbe_->book1D(histname+"AllTracks_Ass","Photons:Tracks from conversions: #chi^{2} of all tracks", 100, chi2Min, chi2Max);
00504 h_tkChi2_[2] = dbe_->book1D(histname+"AllTracks_Fakes","Photons:Tracks from conversions: #chi^{2} of all tracks", 100, chi2Min, chi2Max);
00505
00506 histname="tkChi2Large";
00507 h_tkChi2Large_[0] = dbe_->book1D(histname+"AllTracks","Photons:Tracks from conversions: #chi^{2} of all tracks", 1000, 0., 5000.0);
00508 h_tkChi2Large_[1] = dbe_->book1D(histname+"AllTracks_Ass","Photons:Tracks from conversions: #chi^{2} of all tracks", 1000, 0., 5000.0);
00509 h_tkChi2Large_[2] = dbe_->book1D(histname+"AllTracks_Fakes","Photons:Tracks from conversions: #chi^{2} of all tracks", 1000, 0., 5000.0);
00510
00511
00512 histname="h2Chi2VsEta";
00513 h2_Chi2VsEta_[0]=dbe_->book2D(histname+"All"," Reco Track #chi^{2} vs #eta: All ",etaBin2,etaMin, etaMax,100, chi2Min, chi2Max);
00514 h2_Chi2VsEta_[1]=dbe_->book2D(histname+"All_Ass"," Reco Track #chi^{2} vs #eta: All ",etaBin2,etaMin, etaMax,100, chi2Min, chi2Max);
00515 h2_Chi2VsEta_[2]=dbe_->book2D(histname+"All_Fakes"," Reco Track #chi^{2} vs #eta: All ",etaBin2,etaMin, etaMax,100, chi2Min, chi2Max);
00516 histname="pChi2VsEta";
00517 p_Chi2VsEta_[0]=dbe_->bookProfile(histname+"All"," Reco Track #chi^{2} vs #eta : All ",etaBin2,etaMin, etaMax, 100, chi2Min, chi2Max,"");
00518 p_Chi2VsEta_[1]=dbe_->bookProfile(histname+"All_Ass"," Reco Track #chi^{2} vs #eta : All ",etaBin2,etaMin, etaMax, 100, chi2Min, chi2Max,"");
00519 p_Chi2VsEta_[2]=dbe_->bookProfile(histname+"All_Fakes"," Reco Track #chi^{2} vs #eta : All ",etaBin2,etaMin, etaMax, 100, chi2Min, chi2Max,"");
00520
00521 histname="h2Chi2VsR";
00522 h2_Chi2VsR_[0]=dbe_->book2D(histname+"All"," Reco Track #chi^{2} vs R: All ",rBin,rMin, rMax,100,chi2Min, chi2Max);
00523 h2_Chi2VsR_[1]=dbe_->book2D(histname+"All_Ass"," Reco Track #chi^{2} vs R: All ",rBin,rMin, rMax,100,chi2Min, chi2Max);
00524 h2_Chi2VsR_[2]=dbe_->book2D(histname+"All_Fakes"," Reco Track #chi^{2} vs R: All ",rBin,rMin, rMax,100,chi2Min, chi2Max);
00525 histname="pChi2VsR";
00526 p_Chi2VsR_[0]=dbe_->bookProfile(histname+"All"," Reco Track #chi^{2} vas R : All ",rBin,rMin,rMax, 100,chi2Min, chi2Max,"");
00527 p_Chi2VsR_[1]=dbe_->bookProfile(histname+"All_Ass"," Reco Track #chi^{2} vas R : All ",rBin,rMin,rMax, 100,chi2Min, chi2Max,"");
00528 p_Chi2VsR_[2]=dbe_->bookProfile(histname+"All_Fakes"," Reco Track #chi^{2} vas R : All ",rBin,rMin,rMax, 100,chi2Min, chi2Max,"");
00529
00530 histname="hTkD0";
00531 h_TkD0_[0]=dbe_->book1D(histname+"All"," Reco Track D0*q: All ",200,-0.1,60);
00532 h_TkD0_[1]=dbe_->book1D(histname+"All_Ass"," Reco Track D0*q: Barrel ",200,-0.1,60);
00533 h_TkD0_[2]=dbe_->book1D(histname+"All_Fakes"," Reco Track D0*q: Endcap ",200,-0.1,60);
00534
00535
00536
00537 histname="hTkPtPull";
00538 h_TkPtPull_[0]=dbe_->book1D(histname+"All"," Reco Track Pt pull: All ",100, -20., 10.);
00539 histname="hTkPtPull";
00540 h_TkPtPull_[1]=dbe_->book1D(histname+"Barrel"," Reco Track Pt pull: Barrel ",100, -20., 10.);
00541 histname="hTkPtPull";
00542 h_TkPtPull_[2]=dbe_->book1D(histname+"Endcap"," Reco Track Pt pull: Endcap ",100, -20., 10.);
00543
00544 histname="h2TkPtPullEta";
00545 h2_TkPtPull_[0]=dbe_->book2D(histname+"All"," Reco Track Pt pull: All ",etaBin2,etaMin, etaMax,100, -20., 10.);
00546 histname="pTkPtPullEta";
00547 p_TkPtPull_[0]=dbe_->bookProfile(histname+"All"," Reco Track Pt pull: All ",etaBin2,etaMin, etaMax, 100, -20., 10., " ");
00548
00549
00550 histname="PtRecVsPtSim";
00551 h2_PtRecVsPtSim_[0]=dbe_->book2D(histname+"All", "Pt Rec vs Pt sim: All ", etBin,etMin,etMax,etBin,etMin, etMax);
00552 h2_PtRecVsPtSim_[1]=dbe_->book2D(histname+"Barrel", "Pt Rec vs Pt sim: Barrel ", etBin,etMin,etMax,etBin,etMin, etMax);
00553 h2_PtRecVsPtSim_[2]=dbe_->book2D(histname+"Endcap", "Pt Rec vs Pt sim: Endcap ", etBin,etMin,etMax,etBin,etMin, etMax);
00554
00555 histname="photonPtRecVsPtSim";
00556 h2_photonPtRecVsPtSim_=dbe_->book2D(histname+"All", "Pt Rec vs Pt sim: All ", etBin,etMin,etMax,etBin,etMin, etMax);
00557
00558
00559
00560 h_match_= dbe_->book1D("h_match"," ", 3, -0.5,2.5);
00561
00562
00563 }
00564
00565
00566
00567 }
00568
00569
00570
00571 void TkConvValidator::beginRun (edm::Run const & r, edm::EventSetup const & theEventSetup) {
00572
00573
00574 edm::LogInfo("ConvertedPhotonProducer") << " get magnetic field" << "\n";
00575 theEventSetup.get<IdealMagneticFieldRecord>().get(theMF_);
00576
00577
00578 edm::ESHandle<TrackAssociatorBase> theHitsAssociator;
00579 theEventSetup.get<TrackAssociatorRecord>().get("TrackAssociatorByHits",theHitsAssociator);
00580 theTrackAssociator_ = (TrackAssociatorBase *) theHitsAssociator.product();
00581
00582
00583
00584
00585 thePhotonMCTruthFinder_ = new PhotonMCTruthFinder();
00586
00587 }
00588
00589 void TkConvValidator::endRun (edm::Run& r, edm::EventSetup const & theEventSetup) {
00590
00591 delete thePhotonMCTruthFinder_;
00592
00593 }
00594
00595
00596
00597 void TkConvValidator::analyze( const edm::Event& e, const edm::EventSetup& esup ) {
00598
00599 using namespace edm;
00600
00601
00602
00603 const float BARL = 1.4442;
00604
00605 const float END_HI = 2.5;
00606
00607
00608
00609
00610 nEvt_++;
00611 LogInfo("TkConvValidator") << "TkConvValidator Analyzing event number: " << e.id() << " Global Counter " << nEvt_ <<"\n";
00612
00613
00614
00615
00616 esup.get<CaloGeometryRecord>().get(theCaloGeom_);
00617
00618
00619
00620 edm::ESHandle<TransientTrackBuilder> theTTB;
00621 esup.get<TransientTrackRecord>().get("TransientTrackBuilder",theTTB);
00622
00623
00625 Handle<reco::ConversionCollection> convHandle;
00626 e.getByLabel(conversionCollectionProducer_, conversionCollection_ , convHandle);
00627 const reco::ConversionCollection convCollection = *(convHandle.product());
00628 if (!convHandle.isValid()) {
00629 edm::LogError("ConversionsProducer") << "Error! Can't get the collection "<< std::endl;
00630 return;
00631 }
00632
00633
00634 edm::Handle<reco::VertexCollection> vertexHandle;
00635 reco::VertexCollection vertexCollection;
00636 e.getByLabel("offlinePrimaryVertices", vertexHandle);
00637 if (!vertexHandle.isValid()) {
00638 edm::LogError("TrackerOnlyConversionProducer") << "Error! Can't get the product primary Vertex Collection "<< "\n";
00639 } else {
00640 vertexCollection = *(vertexHandle.product());
00641 }
00642 reco::Vertex the_pvtx;
00643 bool valid_pvtx = false;
00644 if (!vertexCollection.empty()){
00645 the_pvtx = *(vertexCollection.begin());
00646
00647 if (the_pvtx.isValid() && fabs(the_pvtx.position().z())<=15 && the_pvtx.position().Rho()<=2){
00648 valid_pvtx = true;
00649 }
00650 }
00651
00652
00653
00654 edm::ESHandle<TrackerGeometry> tracker;
00655 esup.get<TrackerDigiGeometryRecord>().get(tracker);
00656 const TrackerGeometry* trackerGeom = tracker.product();
00657
00658
00659
00661
00662 std::vector<SimTrack> theSimTracks;
00663 std::vector<SimVertex> theSimVertices;
00664
00665 edm::Handle<SimTrackContainer> SimTk;
00666 edm::Handle<SimVertexContainer> SimVtx;
00667 e.getByLabel("g4SimHits",SimTk);
00668 e.getByLabel("g4SimHits",SimVtx);
00669
00670 bool useTP= parameters_.getParameter<bool>("useTP");
00671 TrackingParticleCollection tpForEfficiency;
00672 TrackingParticleCollection tpForFakeRate;
00673 edm::Handle<TrackingParticleCollection> TPHandleForEff;
00674 edm::Handle<TrackingParticleCollection> TPHandleForFakeRate;
00675 if ( useTP) {
00676 e.getByLabel("tpSelecForEfficiency",TPHandleForEff);
00677 tpForEfficiency = *(TPHandleForEff.product());
00678 e.getByLabel("tpSelecForFakeRate",TPHandleForFakeRate);
00679 tpForFakeRate = *(TPHandleForFakeRate.product());
00680 }
00681
00682
00683
00684 theSimTracks.insert(theSimTracks.end(),SimTk->begin(),SimTk->end());
00685 theSimVertices.insert(theSimVertices.end(),SimVtx->begin(),SimVtx->end());
00686 std::vector<PhotonMCTruth> mcPhotons=thePhotonMCTruthFinder_->find (theSimTracks, theSimVertices);
00687
00688 edm::Handle<edm::HepMCProduct> hepMC;
00689 e.getByLabel("generator",hepMC);
00690
00691
00692
00693
00694 edm::Handle<reco::GenJetCollection> GenJetsHandle ;
00695 e.getByLabel("iterativeCone5GenJets","",GenJetsHandle);
00696 reco::GenJetCollection genJetCollection = *(GenJetsHandle.product());
00697
00698
00699
00700
00701 std::map<const reco::Track*,TrackingParticleRef> myAss;
00702 std::map<const reco::Track*,TrackingParticleRef>::const_iterator itAss;
00703
00704 for ( std::vector<PhotonMCTruth>::const_iterator mcPho=mcPhotons.begin(); mcPho !=mcPhotons.end(); mcPho++) {
00705
00706 mcConvPt_= (*mcPho).fourMomentum().et();
00707 float mcPhi= (*mcPho).fourMomentum().phi();
00708 mcPhi_= phiNormalization(mcPhi);
00709 mcEta_= (*mcPho).fourMomentum().pseudoRapidity();
00710 mcEta_ = etaTransformation(mcEta_, (*mcPho).primaryVertex().z() );
00711 mcConvR_= (*mcPho).vertex().perp();
00712 mcConvX_= (*mcPho).vertex().x();
00713 mcConvY_= (*mcPho).vertex().y();
00714 mcConvZ_= (*mcPho).vertex().z();
00715 mcConvEta_= (*mcPho).vertex().eta();
00716 mcConvPhi_= (*mcPho).vertex().phi();
00717
00718 if ( fabs(mcEta_) > END_HI ) continue;
00719
00720 if (mcConvPt_<minPhoPtForEffic) continue;
00721 if (fabs(mcEta_)>maxPhoEtaForEffic) continue;
00722 if (fabs(mcConvZ_)>maxPhoZForEffic) continue;
00723 if (mcConvR_>maxPhoRForEffic) continue;
00725
00726 bool goodSimConversion=false;
00727 bool visibleConversion=false;
00728 bool visibleConversionsWithTwoSimTracks=false;
00729 if ( (*mcPho).isAConversion() == 1 ) {
00730 nSimConv_[0]++;
00731 h_AllSimConv_[0]->Fill( mcEta_ ) ;
00732 h_AllSimConv_[1]->Fill( mcPhi_ );
00733 h_AllSimConv_[2]->Fill( mcConvR_ );
00734 h_AllSimConv_[3]->Fill( mcConvZ_ );
00735 h_AllSimConv_[4]->Fill( (*mcPho).fourMomentum().et());
00736
00737 if ( mcConvR_ <15) h_SimConvEtaPix_[0]->Fill( mcEta_ ) ;
00738
00739 if ( ( fabs(mcEta_) <= BARL && mcConvR_ <85 ) ||
00740 ( fabs(mcEta_) > BARL && fabs(mcEta_) <=END_HI && fabs( (*mcPho).vertex().z() ) < 210 ) ) visibleConversion=true;
00741
00742 theConvTP_.clear();
00743
00744
00745 for(size_t i = 0; i < tpForEfficiency.size(); ++i){
00746 TrackingParticleRef tp (TPHandleForEff,i);
00747 if ( fabs( tp->vx() - (*mcPho).vertex().x() ) < 0.0001 &&
00748 fabs( tp->vy() - (*mcPho).vertex().y() ) < 0.0001 &&
00749 fabs( tp->vz() - (*mcPho).vertex().z() ) < 0.0001) {
00750 theConvTP_.push_back( tp );
00751 }
00752 }
00753
00754
00755 if ( theConvTP_.size() == 2 ) visibleConversionsWithTwoSimTracks=true;
00756 goodSimConversion=false;
00757
00758 if ( visibleConversion && visibleConversionsWithTwoSimTracks ) goodSimConversion=true;
00759 if ( goodSimConversion ) {
00760 nSimConv_[1]++;
00761 h_VisSimConv_[0]->Fill( mcEta_ ) ;
00762 h_VisSimConv_[1]->Fill( mcPhi_ );
00763 h_VisSimConv_[2]->Fill( mcConvR_ );
00764 h_VisSimConv_[3]->Fill( mcConvZ_ );
00765 h_VisSimConv_[4]->Fill( (*mcPho).fourMomentum().et());
00766
00767 }
00768
00769 for ( edm::RefVector<TrackingParticleCollection>::iterator iTrk=theConvTP_.begin(); iTrk!=theConvTP_.end(); ++iTrk) {
00770 h_simTkPt_ -> Fill ( (*iTrk)->pt() );
00771 h_simTkEta_ -> Fill ( (*iTrk)->eta() );
00772 }
00773
00774
00775 }
00776
00777 if ( ! (visibleConversion && visibleConversionsWithTwoSimTracks ) ) continue;
00778
00779 h_simConvVtxRvsZ_[0] ->Fill ( fabs (mcConvZ_), mcConvR_ ) ;
00780 if ( fabs(mcEta_) <=1.) {
00781 h_simConvVtxRvsZ_[1] ->Fill ( fabs (mcConvZ_), mcConvR_ ) ;
00782 h_simConvVtxYvsX_ ->Fill ( mcConvX_, mcConvY_ ) ;
00783 }
00784 else
00785 h_simConvVtxRvsZ_[2] ->Fill ( fabs (mcConvZ_), mcConvR_ ) ;
00786
00787
00788 for ( edm::RefVector<TrackingParticleCollection>::iterator iTP= theConvTP_.begin(); iTP!=theConvTP_.end(); iTP++)
00789 {
00790
00791 }
00792
00793
00795 for (reco::ConversionCollection::const_iterator conv = convHandle->begin();conv!=convHandle->end();++conv) {
00796
00797 const reco::Conversion aConv = (*conv);
00798 if ( mergedTracks_ ) {
00799 if ( !( aConv.quality(reco::Conversion::arbitratedMerged) && aConv.quality(reco::Conversion::highPurity) ) ) continue;
00800 } else {
00801 if (! ( aConv.quality(reco::Conversion::generalTracksOnly) && aConv.quality(reco::Conversion::highPurity) ) ) continue;
00802 }
00803
00804
00805
00806 std::vector<edm::RefToBase<reco::Track> > tracks = aConv.tracks();
00807
00808 const reco::Vertex& vtx = aConv.conversionVertex();
00809
00810 if (tracks.size() !=2 || !(vtx.isValid())) continue;
00811
00812
00813
00814 RefToBase<reco::Track> tfrb1 = aConv.tracks().front();
00815 RefToBase<reco::Track> tfrb2 = aConv.tracks().back();
00816
00817
00818
00819
00820
00821 RefToBaseVector<reco::Track> tc1, tc2;
00822 tc1.push_back(tfrb1);
00823 tc2.push_back(tfrb2);
00824 bool isAssociated = false;
00825 reco::SimToRecoCollection q1 = theTrackAssociator_->associateSimToReco(tc1,theConvTP_,&e);
00826 reco::SimToRecoCollection q2 = theTrackAssociator_->associateSimToReco(tc2,theConvTP_,&e);
00827
00828 std::vector<std::pair<RefToBase<reco::Track>, double> > trackV1, trackV2;
00829
00830 int tp_1 = 0, tp_2 = 1;
00831 if (q1.find(theConvTP_[0])!=q1.end()){
00832 trackV1 = (std::vector<std::pair<RefToBase<reco::Track>, double> >) q1[theConvTP_[0]];
00833 } else if (q1.find(theConvTP_[1])!=q1.end()){
00834 trackV1 = (std::vector<std::pair<RefToBase<reco::Track>, double> >) q1[theConvTP_[1]];
00835 tp_1 = 1;
00836 }
00837 if (q2.find(theConvTP_[1])!=q2.end()){
00838 trackV2 = (std::vector<std::pair<RefToBase<reco::Track>, double> >) q2[theConvTP_[1]];
00839 } else if (q2.find(theConvTP_[0])!=q2.end()){
00840 trackV2 = (std::vector<std::pair<RefToBase<reco::Track>, double> >) q2[theConvTP_[0]];
00841 tp_2 = 0;
00842 }
00843 if (!(trackV1.size()&&trackV2.size()))
00844 continue;
00845 if (tp_1 == tp_2) continue;
00846
00847 edm::RefToBase<reco::Track> tr1 = trackV1.front().first;
00848 edm::RefToBase<reco::Track> tr2 = trackV2.front().first;
00849
00850
00851 myAss.insert( std::make_pair (tr1.get(),theConvTP_[tp_1] ) );
00852 myAss.insert( std::make_pair (tr2.get(),theConvTP_[tp_2]) );
00853
00854
00855
00856
00857
00858
00859
00860 isAssociated = true;
00861
00863 h_SimConvTwoMTracks_[0]->Fill( mcEta_ ) ;
00864 h_SimConvTwoMTracks_[1]->Fill( mcPhi_ );
00865 h_SimConvTwoMTracks_[2]->Fill( mcConvR_ );
00866 h_SimConvTwoMTracks_[3]->Fill( mcConvZ_ );
00867 h_SimConvTwoMTracks_[4]->Fill( (*mcPho).fourMomentum().et());
00868
00869 float chi2Prob = ChiSquaredProbability( aConv.conversionVertex().chi2(), aConv.conversionVertex().ndof() );
00870 if ( chi2Prob > 0) {
00871 h_SimConvTwoMTracksAndVtxPGT0_[0]->Fill( mcEta_ ) ;
00872 h_SimConvTwoMTracksAndVtxPGT0_[1]->Fill( mcPhi_ );
00873 h_SimConvTwoMTracksAndVtxPGT0_[2]->Fill( mcConvR_ );
00874 h_SimConvTwoMTracksAndVtxPGT0_[3]->Fill( mcConvZ_ );
00875 h_SimConvTwoMTracksAndVtxPGT0_[4]->Fill( (*mcPho).fourMomentum().et());
00876 }
00877 if ( chi2Prob > 0.0005) {
00878 h_SimConvTwoMTracksAndVtxPGT0005_[0]->Fill( mcEta_ ) ;
00879 h_SimConvTwoMTracksAndVtxPGT0005_[1]->Fill( mcPhi_ );
00880 h_SimConvTwoMTracksAndVtxPGT0005_[2]->Fill( mcConvR_ );
00881 h_SimConvTwoMTracksAndVtxPGT0005_[3]->Fill( mcConvZ_ );
00882 h_SimConvTwoMTracksAndVtxPGT0005_[4]->Fill( (*mcPho).fourMomentum().et());
00883
00884 }
00885
00886
00887 }
00888 }
00889
00890
00891
00892
00893 for (reco::ConversionCollection::const_iterator conv = convHandle->begin();conv!=convHandle->end();++conv) {
00894 const reco::Conversion aConv = (*conv);
00895 if ( mergedTracks_ ) {
00896 if ( !( aConv.quality(reco::Conversion::arbitratedMerged) && aConv.quality(reco::Conversion::highPurity) ) ) continue;
00897
00898 } else {
00899 if (! ( aConv.quality(reco::Conversion::generalTracksOnly) && aConv.quality(reco::Conversion::highPurity) ) ) continue;
00900 }
00901
00902
00903
00904 std::vector<edm::RefToBase<reco::Track> > tracks = aConv.tracks();
00905 const reco::Vertex& vtx = aConv.conversionVertex();
00906
00907 if (tracks.size() !=2 || !(vtx.isValid())) continue;
00908
00909 bool phoIsInBarrel=false;
00910 bool phoIsInEndcap=false;
00911 RefToBase<reco::Track> tk1 = aConv.tracks().front();
00912 RefToBase<reco::Track> tk2 = aConv.tracks().back();
00913 RefToBaseVector<reco::Track> tc1, tc2;
00914 tc1.push_back(tk1);
00915 tc2.push_back(tk2);
00916
00917
00918 const reco::Track refTk1 = aConv.conversionVertex().refittedTracks().front();
00919 const reco::Track refTk2 = aConv.conversionVertex().refittedTracks().back();
00920
00921
00922 float dPhiTracksAtVtx = aConv.dPhiTracksAtVtx();
00923
00924 math::XYZVector p1AtVtx= recalculateMomentumAtFittedVertex ( (*theMF_), *trackerGeom, tk1, aConv.conversionVertex() );
00925 math::XYZVector p2AtVtx= recalculateMomentumAtFittedVertex ( (*theMF_), *trackerGeom, tk2, aConv.conversionVertex() );
00926 if ( sqrt(p1AtVtx.perp2()) > sqrt(p2AtVtx.perp2()) )
00927 dPhiTracksAtVtx = p1AtVtx.phi() - p2AtVtx.phi();
00928 else
00929 dPhiTracksAtVtx = p2AtVtx.phi() - p1AtVtx.phi();
00930
00931
00932 math::XYZVector convMom = tk1->momentum() + tk2->momentum();
00933 math::XYZVector refittedMom = aConv.refittedPairMomentum();
00934
00935
00936 if (fabs(refittedMom.eta())< 1.479 ) {
00937 phoIsInBarrel=true;
00938 } else {
00939 phoIsInEndcap=true;
00940 }
00941
00942 nRecConv_++;
00943
00945 int match =0;
00946 float invM=aConv.pairInvariantMass();
00947 float chi2Prob = ChiSquaredProbability( aConv.conversionVertex().chi2(), aConv.conversionVertex().ndof() );
00948
00949 h_convEta_[match][0]->Fill( refittedMom.eta() );
00950 h_convPhi_[match][0]->Fill( refittedMom.phi() );
00951 h_convR_[match][0]->Fill( sqrt(aConv.conversionVertex().position().perp2()) );
00952 h_convRplot_->Fill( sqrt(aConv.conversionVertex().position().perp2()) );
00953 h_convZ_[match][0]->Fill( aConv.conversionVertex().position().z() );
00954 h_convZplot_->Fill( aConv.conversionVertex().position().z() );
00955 h_convPt_[match][0]->Fill( sqrt(refittedMom.perp2()) );
00956 h_invMass_[match][0] ->Fill( invM);
00957 h_vtxChi2Prob_[match][0] ->Fill (chi2Prob);
00958
00959
00960
00961 h_distMinAppTracks_[match][0] ->Fill (aConv.distOfMinimumApproach());
00962 h_DPhiTracksAtVtx_[match][0]->Fill( dPhiTracksAtVtx);
00963 h2_DPhiTracksAtVtxVsEta_->Fill( mcEta_, dPhiTracksAtVtx);
00964 h2_DPhiTracksAtVtxVsR_->Fill( mcConvR_, dPhiTracksAtVtx);
00965 p_DPhiTracksAtVtxVsEta_->Fill( mcEta_, dPhiTracksAtVtx);
00966 p_DPhiTracksAtVtxVsR_->Fill( mcConvR_, dPhiTracksAtVtx);
00967
00968 h_DCotTracks_[match][0] ->Fill ( aConv.pairCotThetaSeparation() );
00969 h2_DCotTracksVsEta_->Fill( mcEta_, aConv.pairCotThetaSeparation() );
00970 h2_DCotTracksVsR_->Fill( mcConvR_, aConv.pairCotThetaSeparation() );
00971 p_DCotTracksVsEta_->Fill( mcEta_, aConv.pairCotThetaSeparation() );
00972 p_DCotTracksVsR_->Fill( mcConvR_, aConv.pairCotThetaSeparation() );
00973
00974 if ( phoIsInBarrel ) {
00975 h_invMass_[match][1] ->Fill(invM);
00976 h_vtxChi2Prob_[match][1] ->Fill (chi2Prob);
00977 h_distMinAppTracks_[match][1] ->Fill (aConv.distOfMinimumApproach());
00978 h_DPhiTracksAtVtx_[match][1]->Fill( dPhiTracksAtVtx);
00979 h_DCotTracks_[match][1] ->Fill ( aConv.pairCotThetaSeparation() );
00980 }
00981
00982
00983 if ( phoIsInEndcap ) {
00984 h_invMass_[match][2] ->Fill(invM);
00985 h_vtxChi2Prob_[match][2] ->Fill (chi2Prob);
00986 h_distMinAppTracks_[match][2] ->Fill (aConv.distOfMinimumApproach());
00987 h_DPhiTracksAtVtx_[match][2]->Fill( dPhiTracksAtVtx);
00988 h_DCotTracks_[match][2] ->Fill ( aConv.pairCotThetaSeparation() );
00989 }
00990
00991 h_convVtxRvsZ_[0] ->Fill ( fabs (aConv.conversionVertex().position().z() ), sqrt(aConv.conversionVertex().position().perp2()) ) ;
00992 h_convVtxYvsX_ ->Fill ( aConv.conversionVertex().position().x(), aConv.conversionVertex().position().y() );
00993 h_convVtxYvsX_zoom_[0] ->Fill ( aConv.conversionVertex().position().x(), aConv.conversionVertex().position().y() );
00994 h_convVtxYvsX_zoom_[1] ->Fill ( aConv.conversionVertex().position().x(), aConv.conversionVertex().position().y() );
00995
00996
00997
00998 for (unsigned int i=0; i<tracks.size(); i++) {
00999 double d0;
01000 if (valid_pvtx){
01001 d0 = - tracks[i]->dxy(the_pvtx.position());
01002 } else {
01003 d0 = tracks[i]->d0();
01004 }
01005 h_TkD0_[match]->Fill ( d0* tracks[i]->charge() );
01006 nHitsVsEta_[match] ->Fill (mcEta_, float(tracks[i]->numberOfValidHits()) );
01007 nHitsVsR_[match] ->Fill (mcConvR_, float(tracks[i]->numberOfValidHits()) );
01008 p_nHitsVsEta_[match] ->Fill (mcEta_, float(tracks[i]->numberOfValidHits()) -0.0001);
01009 p_nHitsVsR_[match] ->Fill (mcConvR_, float(tracks[i]->numberOfValidHits()) -0.0001);
01010 h_tkChi2_[match] ->Fill (tracks[i]->normalizedChi2() );
01011 h_tkChi2Large_[match] ->Fill (tracks[i]->normalizedChi2() );
01012 h2_Chi2VsEta_[match] ->Fill( mcEta_, tracks[i]->normalizedChi2() );
01013 h2_Chi2VsR_[match] ->Fill( mcConvR_, tracks[i]->normalizedChi2() );
01014 p_Chi2VsEta_[match] ->Fill( mcEta_, tracks[i]->normalizedChi2() );
01015 p_Chi2VsR_[match] ->Fill( mcConvR_, tracks[i]->normalizedChi2() );
01016
01017 }
01018
01019 bool associated = false;
01020 float mcConvPt_= -99999999;
01021
01022 float simPV_Z=0;
01023 for ( std::vector<PhotonMCTruth>::const_iterator mcPho=mcPhotons.begin(); mcPho !=mcPhotons.end(); mcPho++) {
01024 mcConvPt_= (*mcPho).fourMomentum().et();
01025 float mcPhi= (*mcPho).fourMomentum().phi();
01026 simPV_Z = (*mcPho).primaryVertex().z();
01027 mcPhi_= phiNormalization(mcPhi);
01028 mcEta_= (*mcPho).fourMomentum().pseudoRapidity();
01029 mcEta_ = etaTransformation(mcEta_, (*mcPho).primaryVertex().z() );
01030 mcConvR_= (*mcPho).vertex().perp();
01031 mcConvX_= (*mcPho).vertex().x();
01032 mcConvY_= (*mcPho).vertex().y();
01033 mcConvZ_= (*mcPho).vertex().z();
01034 mcConvEta_= (*mcPho).vertex().eta();
01035 mcConvPhi_= (*mcPho).vertex().phi();
01036 if ( fabs(mcEta_) > END_HI ) continue;
01037 if (mcConvPt_<minPhoPtForPurity) continue;
01038 if (fabs(mcEta_)>maxPhoEtaForPurity) continue;
01039 if (fabs(mcConvZ_)>maxPhoZForPurity) continue;
01040 if (mcConvR_>maxPhoRForEffic) continue;
01041
01042 if ( (*mcPho).isAConversion() != 1 ) continue;
01043 if (!( ( fabs(mcEta_) <= BARL && mcConvR_ <85 ) ||
01044 ( fabs(mcEta_) > BARL && fabs(mcEta_) <=END_HI && fabs( (*mcPho).vertex().z() ) < 210 ) ) )
01045 continue;
01046
01047
01048 theConvTP_.clear();
01049 for(size_t i = 0; i < tpForFakeRate.size(); ++i){
01050 TrackingParticleRef tp (TPHandleForFakeRate,i);
01051 if ( fabs( tp->vx() - (*mcPho).vertex().x() ) < 0.0001 &&
01052 fabs( tp->vy() - (*mcPho).vertex().y() ) < 0.0001 &&
01053 fabs( tp->vz() - (*mcPho).vertex().z() ) < 0.0001) {
01054 theConvTP_.push_back( tp );
01055
01056
01057 }
01058 }
01059
01060 if ( theConvTP_.size() < 2 ) continue;
01061
01062 associated = false;
01063 reco::RecoToSimCollection p1 = theTrackAssociator_->associateRecoToSim(tc1,theConvTP_,&e);
01064 reco::RecoToSimCollection p2 = theTrackAssociator_->associateRecoToSim(tc2,theConvTP_,&e);
01065 try{
01066 std::vector<std::pair<TrackingParticleRef, double> > tp1 = p1[tk1];
01067 std::vector<std::pair<TrackingParticleRef, double> > tp2 = p2[tk2];
01068 if (!(tp1.size()&&tp2.size())){
01069 tp1 = p1[tk2];
01070 tp2 = p2[tk1];
01071 }
01072 if (tp1.size()&&tp2.size()) {
01073 TrackingParticleRef tpr1 = tp1.front().first;
01074 TrackingParticleRef tpr2 = tp2.front().first;
01075 if (abs(tpr1->pdgId())==11&&abs(tpr2->pdgId())==11) {
01076 if ( (tpr1->parentVertex()->sourceTracks_end()-tpr1->parentVertex()->sourceTracks_begin()==1) &&
01077 (tpr2->parentVertex()->sourceTracks_end()-tpr2->parentVertex()->sourceTracks_begin()==1)) {
01078 if (tpr1->parentVertex().key()==tpr2->parentVertex().key() && ((*tpr1->parentVertex()->sourceTracks_begin())->pdgId()==22)) {
01079 mcConvR_ = sqrt(tpr1->parentVertex()->position().Perp2());
01080 mcConvZ_ = tpr1->parentVertex()->position().z();
01081 mcConvX_ = tpr1->parentVertex()->position().x();
01082 mcConvY_ = tpr1->parentVertex()->position().y();
01083 mcConvEta_ = tpr1->parentVertex()->position().eta();
01084 mcConvPhi_ = tpr1->parentVertex()->position().phi();
01085 mcConvPt_ = sqrt((*tpr1->parentVertex()->sourceTracks_begin())->momentum().Perp2());
01086
01087
01088
01089 associated = true;
01090 break;
01091 }
01092 }
01093 }
01094 }
01095 } catch (Exception event) {
01096
01097
01098 }
01099
01100 }
01101
01102 if ( associated ) match=1;
01103 else
01104 match=2;
01105
01106 h_match_->Fill(float(match));
01108 if ( match == 1) nRecConvAss_++;
01109 h_convEta_[match][0]->Fill( refittedMom.eta() );
01110 h_convPhi_[match][0]->Fill( refittedMom.phi() );
01111 h_convR_[match][0]->Fill( sqrt(aConv.conversionVertex().position().perp2()) );
01112 h_convZ_[match][0]->Fill( aConv.conversionVertex().position().z() );
01113 h_convPt_[match][0]->Fill( sqrt(refittedMom.perp2()) );
01114 h_invMass_[match][0] ->Fill( invM);
01115 h_vtxChi2Prob_[match][0] ->Fill (chi2Prob);
01116 h_DPhiTracksAtVtx_[match][0]->Fill( dPhiTracksAtVtx);
01117 h_DCotTracks_[match][0] ->Fill ( aConv.pairCotThetaSeparation() );
01118 h_distMinAppTracks_[match][0] ->Fill (aConv.distOfMinimumApproach());
01119
01120 if ( match==1) {
01121 h2_photonPtRecVsPtSim_->Fill ( mcConvPt_, sqrt(refittedMom.perp2()) );
01122 h_convPtRes_[0]->Fill ( sqrt(refittedMom.perp2())/mcConvPt_);
01123 }
01124
01125 if ( phoIsInBarrel ) {
01126 h_invMass_[match][1] ->Fill(invM);
01127 h_vtxChi2Prob_[match][1] ->Fill (chi2Prob);
01128 h_DPhiTracksAtVtx_[match][1]->Fill( dPhiTracksAtVtx);
01129 h_DCotTracks_[match][1] ->Fill ( aConv.pairCotThetaSeparation() );
01130 h_distMinAppTracks_[match][1] ->Fill (aConv.distOfMinimumApproach());
01131 if ( match==1) h_convPtRes_[1]->Fill ( sqrt(refittedMom.perp2())/mcConvPt_);
01132 }
01133
01134
01135 if ( phoIsInEndcap ) {
01136 h_invMass_[match][2] ->Fill(invM);
01137 h_vtxChi2Prob_[match][2] ->Fill (chi2Prob);
01138 h_DPhiTracksAtVtx_[match][2]->Fill( dPhiTracksAtVtx);
01139 h_DCotTracks_[match][2] ->Fill ( aConv.pairCotThetaSeparation() );
01140 h_distMinAppTracks_[match][2] ->Fill (aConv.distOfMinimumApproach());
01141 if ( match==1) h_convPtRes_[2]->Fill ( sqrt(refittedMom.perp2())/mcConvPt_);
01142 }
01143
01144
01145 if ( match == 1 ) {
01146 h_convVtxdX_ ->Fill ( aConv.conversionVertex().position().x() - mcConvX_);
01147 h_convVtxdY_ ->Fill ( aConv.conversionVertex().position().y() - mcConvY_);
01148 h_convVtxdZ_ ->Fill ( aConv.conversionVertex().position().z() - mcConvZ_);
01149 h_convVtxdR_ ->Fill ( sqrt(aConv.conversionVertex().position().perp2()) - mcConvR_);
01150 h_convVtxdPhi_ ->Fill ( aConv.conversionVertex().position().phi() - mcConvPhi_);
01151 h_convVtxdEta_ ->Fill ( aConv.conversionVertex().position().eta() - mcConvEta_);
01152 h2_convVtxdRVsR_ ->Fill (mcConvR_, sqrt(aConv.conversionVertex().position().perp2()) - mcConvR_ );
01153 h2_convVtxdRVsEta_ ->Fill (mcEta_, sqrt(aConv.conversionVertex().position().perp2()) - mcConvR_ );
01154 p_convVtxdRVsR_ ->Fill (mcConvR_, sqrt(aConv.conversionVertex().position().perp2()) - mcConvR_ );
01155 p_convVtxdRVsEta_ ->Fill (mcEta_, sqrt(aConv.conversionVertex().position().perp2()) - mcConvR_ );
01156 p_convVtxdXVsX_ ->Fill (mcConvX_, aConv.conversionVertex().position().x() - mcConvX_ );
01157 p_convVtxdYVsY_ ->Fill (mcConvY_, aConv.conversionVertex().position().y() - mcConvY_ );
01158 p_convVtxdZVsZ_ ->Fill (mcConvZ_, aConv.conversionVertex().position().z() - mcConvZ_ );
01159 p_convVtxdZVsR_ ->Fill (mcConvR_, aConv.conversionVertex().position().z() - mcConvZ_ );
01160
01161 float dR=sqrt(aConv.conversionVertex().position().perp2()) - mcConvR_;
01162 float dZ=aConv.conversionVertex().position().z() - mcConvZ_;
01163 p2_convVtxdRVsRZ_ ->Fill (mcConvZ_,mcConvR_, dR );
01164 p2_convVtxdZVsRZ_ ->Fill (mcConvZ_,mcConvR_, dZ );
01165
01166
01167
01168
01169 h2_convVtxRrecVsTrue_ -> Fill (mcConvR_, sqrt(aConv.conversionVertex().position().perp2()) );
01170
01171
01172 h_zPVFromTracks_[match]->Fill ( aConv.zOfPrimaryVertexFromTracks() );
01173 h_dzPVFromTracks_[match]->Fill ( aConv.zOfPrimaryVertexFromTracks() - simPV_Z );
01174 h2_dzPVVsR_ ->Fill(mcConvR_, aConv.zOfPrimaryVertexFromTracks() - simPV_Z );
01175 p_dzPVVsR_ ->Fill(mcConvR_, aConv.zOfPrimaryVertexFromTracks() - simPV_Z );
01176
01177 if ( phoIsInBarrel ) {
01178 h_convVtxdX_barrel_ ->Fill ( aConv.conversionVertex().position().x() - mcConvX_);
01179 h_convVtxdY_barrel_ ->Fill ( aConv.conversionVertex().position().y() - mcConvY_);
01180 h_convVtxdZ_barrel_ ->Fill ( aConv.conversionVertex().position().z() - mcConvZ_);
01181 h_convVtxdR_barrel_ ->Fill ( sqrt(aConv.conversionVertex().position().perp2()) - mcConvR_);
01182
01183 }
01184 if ( phoIsInEndcap ) {
01185 h_convVtxdX_endcap_ ->Fill ( aConv.conversionVertex().position().x() - mcConvX_);
01186 h_convVtxdY_endcap_ ->Fill ( aConv.conversionVertex().position().y() - mcConvY_);
01187 h_convVtxdZ_endcap_ ->Fill ( aConv.conversionVertex().position().z() - mcConvZ_);
01188 h_convVtxdR_endcap_ ->Fill ( sqrt(aConv.conversionVertex().position().perp2()) - mcConvR_);
01189
01190 }
01191
01192
01193 }
01194
01196 for (unsigned int i=0; i<tracks.size(); i++) {
01197
01198 RefToBase<reco::Track> tfrb(aConv.tracks()[i] );
01199 itAss= myAss.find( tfrb.get() );
01200
01201 nHitsVsEta_[match] ->Fill (mcEta_, float(tracks[i]->numberOfValidHits()) );
01202 nHitsVsR_[match] ->Fill (mcConvR_, float(tracks[i]->numberOfValidHits()) );
01203 p_nHitsVsEta_[match] ->Fill (mcEta_, float(tracks[i]->numberOfValidHits()) -0.0001);
01204 p_nHitsVsR_[match] ->Fill (mcConvR_, float(tracks[i]->numberOfValidHits()) -0.0001);
01205 h_tkChi2_[match] ->Fill (tracks[i]->normalizedChi2() );
01206 h_tkChi2Large_[match] ->Fill (tracks[i]->normalizedChi2() );
01207 h2_Chi2VsEta_[match] ->Fill( mcEta_, tracks[i]->normalizedChi2() );
01208 h2_Chi2VsR_[match] ->Fill( mcConvR_, tracks[i]->normalizedChi2() );
01209 p_Chi2VsEta_[match] ->Fill( mcEta_, tracks[i]->normalizedChi2() );
01210 p_Chi2VsR_[match] ->Fill( mcConvR_, tracks[i]->normalizedChi2() );
01211 double d0;
01212 if (valid_pvtx){
01213 d0 = - tracks[i]->dxy(the_pvtx.position());
01214 } else {
01215 d0 = tracks[i]->d0();
01216 }
01217 h_TkD0_[match]->Fill (d0* tracks[i]->charge() );
01218
01219
01220 if ( itAss == myAss.end() ) continue;
01221 reco::Track refTrack= aConv.conversionVertex().refittedTracks()[i];
01222
01223 float simPt = sqrt( ((*itAss).second)->momentum().perp2() );
01224 float recPt = refTrack.pt();
01225 float ptres= recPt - simPt ;
01226
01227 float pterror = aConv.conversionVertex().refittedTracks()[i].ptError();
01228 h2_PtRecVsPtSim_[0]->Fill ( simPt, recPt);
01229 h_TkPtPull_[0] ->Fill(ptres/pterror);
01230 h2_TkPtPull_[0] ->Fill(mcEta_, ptres/pterror);
01231
01232 if ( phoIsInBarrel ) {
01233 h_TkPtPull_[1] ->Fill(ptres/pterror);
01234 h2_PtRecVsPtSim_[1]->Fill ( simPt, recPt);
01235 }
01236 if ( phoIsInEndcap ) {
01237 h_TkPtPull_[2] ->Fill(ptres/pterror);
01238 h2_PtRecVsPtSim_[2]->Fill ( simPt, recPt);
01239 }
01240 }
01241
01242
01243
01244 }
01245
01246
01247 h_nConv_[0][0]->Fill (float(nRecConv_));
01248 h_nConv_[1][0]->Fill (float(nRecConvAss_));
01249
01250
01251
01252 }
01253
01254
01255
01256
01257
01258 void TkConvValidator::endJob() {
01259
01260
01261 std::string outputFileName = parameters_.getParameter<std::string>("OutputFileName");
01262 if ( ! isRunCentrally_ ) {
01263 dbe_->save(outputFileName);
01264 }
01265
01266 edm::LogInfo("TkConvValidator") << "Analyzed " << nEvt_ << "\n";
01267
01268
01269
01270 return ;
01271 }
01272
01273
01274 math::XYZVector TkConvValidator::recalculateMomentumAtFittedVertex ( const MagneticField& mf, const TrackerGeometry& trackerGeom, const edm::RefToBase<reco::Track>& tk, const reco::Vertex& vtx) {
01275
01276 math::XYZVector result;
01277 Surface::RotationType rot;
01278 ReferenceCountingPointer<BoundCylinder> theBarrel_(new BoundCylinder( Surface::PositionType(0,0,0), rot,
01279 SimpleCylinderBounds( sqrt(vtx.position().perp2())-0.001,
01280 sqrt(vtx.position().perp2())+0.001,
01281 -fabs(vtx.position().z()),
01282 fabs(vtx.position().z()))));
01283
01284 ReferenceCountingPointer<BoundDisk> theDisk_(new BoundDisk( Surface::PositionType( 0, 0, vtx.position().z()), rot,
01285 SimpleDiskBounds( 0, sqrt(vtx.position().perp2()), -0.001, 0.001)));
01286
01287 TrajectoryStateTransform transformer;
01288 const TrajectoryStateOnSurface myTSOS = transformer.innerStateOnSurface(*tk, trackerGeom, &mf);
01289 PropagatorWithMaterial propag( anyDirection, 0.000511, &mf );
01290 TrajectoryStateOnSurface stateAtVtx;
01291 stateAtVtx = propag.propagate(myTSOS, *theBarrel_);
01292 if (!stateAtVtx.isValid() ) {
01293 stateAtVtx = propag.propagate(myTSOS, *theDisk_);
01294 }
01295 if (stateAtVtx.isValid()){
01296 return math::XYZVector ( double(stateAtVtx.globalMomentum().x()), double(stateAtVtx.globalMomentum().y()), double(stateAtVtx.globalMomentum().z()));
01297 } else {
01298 return math::XYZVector(0.,0.,0.);
01299 }
01300
01301
01302
01303 }
01304
01305
01306 float TkConvValidator::phiNormalization(float & phi)
01307 {
01308
01309 const float PI = 3.1415927;
01310 const float TWOPI = 2.0*PI;
01311
01312
01313 if(phi > PI) {phi = phi - TWOPI;}
01314 if(phi < -PI) {phi = phi + TWOPI;}
01315
01316
01317 return phi;
01318
01319 }
01320
01321
01322 float TkConvValidator::etaTransformation( float EtaParticle , float Zvertex) {
01323
01324
01325 const float PI = 3.1415927;
01326
01327
01328 const float R_ECAL = 136.5;
01329 const float Z_Endcap = 328.0;
01330 const float etaBarrelEndcap = 1.479;
01331
01332
01333
01334 float Theta = 0.0 ;
01335 float ZEcal = R_ECAL*sinh(EtaParticle)+Zvertex;
01336
01337 if(ZEcal != 0.0) Theta = atan(R_ECAL/ZEcal);
01338 if(Theta<0.0) Theta = Theta+PI ;
01339 float ETA = - log(tan(0.5*Theta));
01340
01341 if( fabs(ETA) > etaBarrelEndcap )
01342 {
01343 float Zend = Z_Endcap ;
01344 if(EtaParticle<0.0 ) Zend = -Zend ;
01345 float Zlen = Zend - Zvertex ;
01346 float RR = Zlen/sinh(EtaParticle);
01347 Theta = atan(RR/Zend);
01348 if(Theta<0.0) Theta = Theta+PI ;
01349 ETA = - log(tan(0.5*Theta));
01350 }
01351
01352 return ETA;
01353
01354 }
01355
01356