00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "DataFormats/Common/interface/AssociationVector.h"
00012 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
00013 #include "DataFormats/Candidate/interface/CandMatchMap.h"
00014 #include "FWCore/Framework/interface/EDAnalyzer.h"
00015 #include "DataFormats/Candidate/interface/Particle.h"
00016 #include "DataFormats/Candidate/interface/Candidate.h"
00017 #include "DataFormats/Candidate/interface/CandidateFwd.h"
00018 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
00019 #include "DataFormats/MuonReco/interface/Muon.h"
00020 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00021 #include "FWCore/Framework/interface/Event.h"
00022 #include "FWCore/Framework/interface/EventSetup.h"
00023 #include "FWCore/Utilities/interface/InputTag.h"
00024 #include "DataFormats/Candidate/interface/OverlapChecker.h"
00025 #include "DataFormats/Math/interface/deltaR.h"
00026 #include "TH1.h"
00027 #include "TH2.h"
00028 #include "TH3.h"
00029 #include <vector>
00030 using namespace edm;
00031 using namespace std;
00032 using namespace reco;
00033
00034 class ZMuMuPerformances : public edm::EDAnalyzer {
00035 public:
00036 ZMuMuPerformances(const edm::ParameterSet& pset);
00037 private:
00038 virtual void analyze(const edm::Event& event, const edm::EventSetup& setup);
00039 bool check_ifZmumu(const Candidate * dauGen0, const Candidate * dauGen1, const Candidate * dauGen2);
00040 float getParticlePt(const int ipart, const Candidate * dauGen0, const Candidate * dauGen1, const Candidate * dauGen2);
00041 float getParticleEta(const int ipart, const Candidate * dauGen0, const Candidate * dauGen1, const Candidate * dauGen2);
00042 float getParticlePhi(const int ipart, const Candidate * dauGen0, const Candidate * dauGen1, const Candidate * dauGen2);
00043 Particle::LorentzVector getParticleP4(const int ipart, const Candidate * dauGen0, const Candidate * dauGen1, const Candidate * dauGen2);
00044 virtual void endJob();
00045
00046 edm::InputTag zMuMu_, zMuMuMatchMap_;
00047 edm::InputTag zMuTrack_, zMuTrackMatchMap_;
00048 edm::InputTag zMuStandAlone_, zMuStandAloneMatchMap_;
00049 edm::InputTag muons_, muonMatchMap_, muonIso_;
00050 edm::InputTag tracks_, trackIso_;
00051 edm::InputTag genParticles_;
00052
00053 bool noCut_;
00054 double zMassMin_, zMassMax_;
00055 double ptminPlus_, ptmaxPlus_, etaminPlus_, etamaxPlus_;
00056 double ptminMinus_, ptmaxMinus_, etaminMinus_, etamaxMinus_, isomax_;
00057
00058 double etamax_, ptmin_, massMin_, massMax_, isoMax_;
00059
00060 reco::CandidateBaseRef globalMuonCandRef_, trackMuonCandRef_, standAloneMuonCandRef_;
00061 OverlapChecker overlap_;
00062
00063
00064 TH1D *h_n_globalMuon_perEvent, *h_n_staOnlyMuon_perEvent, *h_n_trackerOnlyMuon_perEvent, *h_n_trackerStaOnlyMuon_perEvent;
00065 TH1D *h_n_globalMuon_perEvent_MCmatch, *h_n_staOnlyMuon_perEvent_MCmatch, *h_n_trackerOnlyMuon_perEvent_MCmatch;
00066 TH1D *h_n_trackerStaOnlyMuon_perEvent_MCmatch, *h_n_tracks_perEvent;
00067 TH1D *h_n_zMuMu_perEvent, *h_n_zMuSta_perEvent, *h_n_zMuTrack_perEvent;
00068
00069
00070 TH1D *h_zMuMuMassSameSign, *h_zMuMuMassSameSign_MCmatch,*h_zMuMuMassOppositeSign;
00071
00072
00073 TH1D *h_GlobalMuonChargeTimeGenCharge,*h_TrackerMuonChargeTimeGenCharge;
00074
00075 TH1D *h_GlobalMuonEtaMinusGenEta,*h_TrackerMuonEtaMinusGenEta,*h_GlobalMuonPtMinusGenPt,*h_TrackerMuonPtMinusGenPt;
00076 TH1D *h_GlobalMuonStaComponentEtaMinusGenEta, *h_GlobalMuonStaComponentPtMinusGenPt;
00077 TH2D *h_DEtaGlobalGenvsEtaGen, *h_DPtGlobalGenvsPtGen, *h_DEtaGlobalStaComponentGenvsEtaGen,*h_DPtGlobalStaComponentGenvsPtGen;
00078 TH2D *h_DPtGlobalGenvsEtaGen, *h_DPtGlobalStaComponentGenvsEtaGen;
00079
00080 TH1D *h_GlobalMuonEtaMinusGenEta_ZMuMuTagged;
00081 TH1D *h_GlobalMuonPtMinusGenPt_ZMuMuTagged;
00082 TH1D *h_GlobalMuonStaComponentEtaMinusGenEta_ZMuMuTagged, *h_GlobalMuonStaComponentPtMinusGenPt_ZMuMuTagged;
00083 TH2D *h_DEtaGlobalGenvsEtaGen_ZMuMuTagged, *h_DPtGlobalGenvsPtGen_ZMuMuTagged;
00084 TH2D *h_DEtaGlobalStaComponentGenvsEtaGen_ZMuMuTagged,*h_DPtGlobalStaComponentGenvsPtGen_ZMuMuTagged;
00085 TH2D *h_DPtGlobalGenvsEtaGen_ZMuMuTagged, *h_DPtGlobalStaComponentGenvsEtaGen_ZMuMuTagged;
00086 TH2D *h_DPtTrackGenvsPtGen_ZMuMuTagged, *h_DPtTrackGenvsEtaGen_ZMuMuTagged;
00087
00088
00089 TH1D *h_zMuTrackMass_ZMuMuTagged, *h_etaTrack_ZMuMuTagged, *h_phiTrack_ZMuMuTagged, *h_ptTrack_ZMuMuTagged, *h_DRTrack_ZMuMuTagged;
00090
00091 TH1D *h_zMuTrackMass_wrongStaCharge_ZMuMuTagged, *h_etaTrack_wrongStaCharge_ZMuMuTagged;
00092 TH1D *h_phiTrack_wrongStaCharge_ZMuMuTagged, *h_ptTrack_wrongStaCharge_ZMuMuTagged, *h_DRTrack_wrongStaCharge_ZMuMuTagged;
00093
00094
00095 TH1D *h_zMuStaMass_correctStaCharge_ZMuMuTagged, *h_ptStaMinusptTrack_correctStaCharge_ZMuMuTagged;
00096 TH2D *h_ptStaMinusptTrack_vsEtaTracker_correctStaCharge_ZMuMuTagged;
00097 TH2D *h_ptStaMinusptTrack_vsPtTracker_correctStaCharge_ZMuMuTagged;
00098
00099
00100 TH1D *h_zMuStaMass_ZMuMuTagged, *h_etaSta_ZMuMuTagged, *h_phiSta_ZMuMuTagged, *h_ptSta_ZMuMuTagged, *h_DRSta_ZMuMuTagged;
00101
00102 TH1D *h_zMuStaMass_wrongTrkCharge_ZMuMuTagged, *h_etaSta_wrongTrkCharge_ZMuMuTagged;
00103 TH1D *h_phiSta_wrongTrkCharge_ZMuMuTagged, *h_ptSta_wrongTrkCharge_ZMuMuTagged, *h_DRSta_wrongTrkCharge_ZMuMuTagged;
00104
00105
00106 TH1D *h_zMuTrackMass_ZMuTrackTagged, *h_etaTrack_ZMuTrackTagged, *h_phiTrack_ZMuTrackTagged, *h_ptTrack_ZMuTrackTagged, *h_DRTrack_ZMuTrackTagged;
00107
00108 TH1D *h_zMuTrackMass_wrongStaCharge_ZMuTrackTagged, *h_etaTrack_wrongStaCharge_ZMuTrackTagged;
00109 TH1D *h_phiTrack_wrongStaCharge_ZMuTrackTagged, *h_ptTrack_wrongStaCharge_ZMuTrackTagged, *h_DRTrack_wrongStaCharge_ZMuTrackTagged;
00110
00111
00112 TH1D *h_zMuStaMass_ZMuStaTagged, *h_etaSta_ZMuStaTagged, *h_phiSta_ZMuStaTagged, *h_ptSta_ZMuStaTagged;
00113
00114 TH1D *h_zMuStaMass_wrongTrkCharge_ZMuStaTagged, *h_etaSta_wrongTrkCharge_ZMuStaTagged;
00115 TH1D *h_phiSta_wrongTrkCharge_ZMuStaTagged, *h_ptSta_wrongTrkCharge_ZMuStaTagged;
00116
00117
00118
00119 int totalNumberOfZfound;
00120 int totalNumberOfZpassed;
00121
00122 int nZMuMuSameSign;
00123 int nZMuMuSameSign_mcMatched;
00124
00125 int n_goodTrack_ZMuMutagged;
00126 int n_correctStaCharge_ZMuMutagged;
00127 int n_wrongStaCharge_ZMuMutagged;
00128
00129 int n_goodSta_ZMuMutagged;
00130 int n_correctTrkCharge_ZMuMutagged;
00131 int n_wrongTrkCharge_ZMuMutagged;
00132
00133 int n_goodTrack_ZMuTracktagged;
00134 int n_correctStaCharge_ZMuTracktagged;
00135 int n_wrongStaCharge_ZMuTracktagged;
00136 int n_StaNotFound_ZMuTracktagged;
00137
00138 int n_goodSta_ZMuStatagged;
00139 int n_correctTrkCharge_ZMuStatagged;
00140 int n_wrongTrkCharge_ZMuStatagged;
00141 int n_TrkNotFound_ZMuStatagged;
00142
00143 int n_OneGoodZMuTrack;
00144 int n_MultipleGoodZMuTrack;
00145 int numberOfMatchedZMuSta_;
00146 int n_ZMuStaTaggedMatched;
00147 };
00148
00149 #include "FWCore/ServiceRegistry/interface/Service.h"
00150 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00151 #include "DataFormats/Common/interface/Handle.h"
00152 #include "DataFormats/Candidate/interface/Particle.h"
00153 #include "DataFormats/Candidate/interface/Candidate.h"
00154 #include "DataFormats/Common/interface/ValueMap.h"
00155 #include "DataFormats/Candidate/interface/CandAssociation.h"
00156 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
00157 #include "DataFormats/Math/interface/LorentzVector.h"
00158 #include "DataFormats/TrackReco/interface/Track.h"
00159 #include <iostream>
00160 #include <iterator>
00161 #include <cmath>
00162 using namespace std;
00163 using namespace reco;
00164 using namespace edm;
00165
00166
00167 typedef edm::ValueMap<float> IsolationCollection;
00168
00169 ZMuMuPerformances::ZMuMuPerformances(const ParameterSet& pset) :
00170 zMuMu_(pset.getParameter<InputTag>("zMuMu")),
00171 zMuMuMatchMap_(pset.getParameter<InputTag>("zMuMuMatchMap")),
00172 zMuTrack_(pset.getParameter<InputTag>("zMuTrack")),
00173 zMuTrackMatchMap_(pset.getParameter<InputTag>("zMuTrackMatchMap")),
00174 zMuStandAlone_(pset.getParameter<InputTag>("zMuStandAlone")),
00175 zMuStandAloneMatchMap_(pset.getParameter<InputTag>("zMuStandAloneMatchMap")),
00176 muons_(pset.getParameter<InputTag>("muons")),
00177 muonMatchMap_(pset.getParameter<InputTag>("muonMatchMap")),
00178 muonIso_(pset.getParameter<InputTag>("muonIso")),
00179 tracks_(pset.getParameter<InputTag>("tracks")),
00180 trackIso_(pset.getParameter<InputTag>("trackIso")),
00181 genParticles_(pset.getParameter<InputTag>( "genParticles" ) ),
00182
00183 noCut_(pset.getParameter<bool>("noCut")),
00184
00185 zMassMin_(pset.getUntrackedParameter<double>("zMassMin")),
00186 zMassMax_(pset.getUntrackedParameter<double>("zMassMax")),
00187 ptminPlus_(pset.getUntrackedParameter<double>("ptminPlus")),
00188 ptmaxPlus_(pset.getUntrackedParameter<double>("ptmaxPlus")),
00189 etaminPlus_(pset.getUntrackedParameter<double>("etaminPlus")),
00190 etamaxPlus_(pset.getUntrackedParameter<double>("etamaxPlus")),
00191 ptminMinus_(pset.getUntrackedParameter<double>("ptminMinus")),
00192 ptmaxMinus_(pset.getUntrackedParameter<double>("ptmaxMinus")),
00193 etaminMinus_(pset.getUntrackedParameter<double>("etaminMinus")),
00194 etamaxMinus_(pset.getUntrackedParameter<double>("etamaxMinus")),
00195 isomax_(pset.getUntrackedParameter<double>("isomax")) {
00196 Service<TFileService> fs;
00197
00198
00199 etamax_ = etamaxPlus_;
00200 ptmin_ = ptminPlus_;
00201 massMin_ = zMassMin_;
00202 massMax_ = zMassMax_;
00203 isoMax_ = isomax_;
00204
00205
00206 h_n_globalMuon_perEvent = fs->make<TH1D>("n_globalMuon_perEvent","n.of globalMuons per Event",6,-.5,5.5);
00207 h_n_staOnlyMuon_perEvent = fs->make<TH1D>("n_staOnlyMuon_perEvent","n.of standAlone Only Muons per Event",6,-.5,5.5);
00208 h_n_trackerOnlyMuon_perEvent = fs->make<TH1D>("n_trackerOnlyMuon_perEvent","n.of tracker Only Muons per Event",6,-.5,5.5);
00209 h_n_trackerStaOnlyMuon_perEvent = fs->make<TH1D>("n_trackerStaOnlyMuon_perEvent","n.of tracker & StandAlone Only Muons per Event",6,-.5,5.5);
00210 h_n_globalMuon_perEvent_MCmatch = fs->make<TH1D>("n_globalMuon_perEvent_MCmatch","n.of globalMuons per Event (MCmatch)",6,-.5,5.5);
00211 h_n_staOnlyMuon_perEvent_MCmatch = fs->make<TH1D>("n_staOnlyMuon_perEvent_MCmatch","n.of standAlone Only Muons per Event (MCmatch)",6,-.5,5.5);
00212 h_n_trackerOnlyMuon_perEvent_MCmatch = fs->make<TH1D>("n_trackerOnlyMuon_perEvent_MCmatch","n.of tracker Only Muons per Event (MCmatch)",6,-.5,5.5);
00213 h_n_trackerStaOnlyMuon_perEvent_MCmatch = fs->make<TH1D>("n_trackerStaOnlyMuon_perEvent_MCmatch","n.of tracker & StandAlone Only Muons per Event (MCmatch)",6,-.5,5.5);
00214 h_n_tracks_perEvent = fs->make<TH1D>("n_tracks_perEvent","n.of tracks per Event",100,-.5,99.5);
00215 h_n_zMuMu_perEvent = fs->make<TH1D>("n_zMuMu_perEvent","n.of global-global muons per Event",6,-.5,5.5);
00216 h_n_zMuSta_perEvent = fs->make<TH1D>("n_zMuSta_perEvent","n.of global-sta muons per Event",6,-.5,5.5);
00217 h_n_zMuTrack_perEvent = fs->make<TH1D>("n_zMuTrack_perEvent","n.of global-track muons per Event",100,-.5,99.5);
00218
00219
00220 h_zMuMuMassSameSign = fs->make<TH1D>("zMuMuMassSameSign","inv Mass ZMuMu cand SameSign",100, 0., 200.);
00221 h_zMuMuMassOppositeSign = fs->make<TH1D>("zMuMuMassOppositeSign","inv Mass ZMuMu cand OppositeSign",100, 0., 200.);
00222 h_zMuMuMassSameSign_MCmatch = fs->make<TH1D>("zMuMuMassSameSign_MCmatch","inv Mass ZMuMu cand SameSign (MC match)",100, 0., 200.);
00223
00224
00225
00226 h_GlobalMuonChargeTimeGenCharge = fs->make<TH1D>("GlobalMuonChargeTimeGenCharge","charge global mu times charge generated mu",3, -1.5, 1.5);
00227 h_TrackerMuonChargeTimeGenCharge = fs->make<TH1D>("TrackerMuonChargeTimeGenCharge","charge Tracker mu times charge generated mu",3, -1.5, 1.5);
00228
00229 h_GlobalMuonEtaMinusGenEta = fs->make<TH1D>("GlobalMuonEtaMinusGenEta","global mu Eta minus generated mu Eta",100, -.005, .005);
00230 h_GlobalMuonPtMinusGenPt = fs->make<TH1D>("GlobalMuonPtMinusGenPtoverPt","global mu Pt minus generated mu Pt over Pt",100, -.5, .5);
00231 h_GlobalMuonStaComponentEtaMinusGenEta = fs->make<TH1D>("GlobalMuonStaComponentEtaMinusGenEta","global mu Sta cmponent Eta minus generated mu Eta",100, -.5, .5);
00232 h_GlobalMuonStaComponentPtMinusGenPt = fs->make<TH1D>("GlobalMuonStaComponentPtMinusGenPtoerPt","global mu Sta component Pt minus generated mu Pt over Pt",100, -1., 1.);
00233 h_TrackerMuonEtaMinusGenEta = fs->make<TH1D>("TrackerMuonEtaMinusGenEta","Tracker mu Eta minus Eta generated mu",100, -.005, .005);
00234 h_TrackerMuonPtMinusGenPt = fs->make<TH1D>("TrackerMuonPtMinusenPtoverPt","Tracker mu Pt minus Pt generated mu over Pt",100, -.5, .5);
00235
00236 h_DEtaGlobalGenvsEtaGen = fs->make<TH2D>("h_DEtaGlobalGenvsEtaGen","Eta global - Eta Gen vs Eta gen",50,-2.5,2.5,100,-.005,.005);
00237 h_DEtaGlobalStaComponentGenvsEtaGen = fs->make<TH2D>("h_DEtaGlobalStaComponentGenvsEtaGen","Eta Sta component of a Global - Eta Gen vs Eta gen",50,-2.5,2.5,100,-.5,.5);
00238 h_DPtGlobalGenvsPtGen = fs->make<TH2D>("h_DPtGlobalGenovePtvsPtGen","Pt global - Pt Gen over Pt vs Pt gen",50,0.,100.,100,-.5,.5);
00239 h_DPtGlobalStaComponentGenvsPtGen = fs->make<TH2D>("h_DPtGlobalStaComponentGenoverPtvsPtGen","Pt Sta component of a Global - Pt Gen over Pt vs Pt gen",50,0.,100.,100,-1.,1.);
00240
00241
00242 h_GlobalMuonEtaMinusGenEta_ZMuMuTagged = fs->make<TH1D>("GlobalMuonEtaMinusGenEta_ZMuMuTagged","global mu Eta minus generated mu Eta",100, -.005, .005);
00243 h_GlobalMuonPtMinusGenPt_ZMuMuTagged = fs->make<TH1D>("GlobalMuonPtMinusGenPtoverPt_ZMuMuTagged","global mu Pt minus generated mu Pt over Pt",100, -.5, .5);
00244 h_GlobalMuonStaComponentEtaMinusGenEta_ZMuMuTagged = fs->make<TH1D>("GlobalMuonStaComponentEtaMinusGenEta_ZMuMuTagged","global mu Sta cmponent Eta minus generated mu Eta",100, -.5, .5);
00245 h_GlobalMuonStaComponentPtMinusGenPt_ZMuMuTagged = fs->make<TH1D>("GlobalMuonStaComponentPtMinusGenPtoverPt_ZMuMuTagged","global mu Sta component Pt minus generated mu Pt over Pt",100, -1., 1.);
00246 h_DEtaGlobalGenvsEtaGen_ZMuMuTagged = fs->make<TH2D>("h_DEtaGlobalGenvsEtaGen_ZMuMuTagged","Eta global - Eta Gen vs Eta gen",50,-2.5,2.5,100,-.005,.005);
00247 h_DEtaGlobalStaComponentGenvsEtaGen_ZMuMuTagged = fs->make<TH2D>("h_DEtaGlobalStaComponentGenvsEtaGen_ZMuMuTagged","Eta Sta component of a Global - Eta Gen vs Eta gen",50,-2.5,2.5,100,-.5,.5);
00248 h_DPtGlobalGenvsPtGen_ZMuMuTagged = fs->make<TH2D>("h_DPtGlobalGenOverPtvsPtGen_ZMuMuTagged","Pt global - Pt Gen vs Pt gen over Pt",50,0.,100.,100,-.5,.5);
00249 h_DPtGlobalStaComponentGenvsPtGen_ZMuMuTagged = fs->make<TH2D>("h_DPtGlobalStaComponentGenoverPtvsPtGen_ZMuMuTagged","Pt Sta component of a Global - Pt Gen over Pt vs Pt gen",50,0.,100.,100,-1.,1.);
00250 h_DPtGlobalGenvsEtaGen_ZMuMuTagged = fs->make<TH2D>("h_DPtGlobalGenOverPtvsEtaGen_ZMuMuTagged","Pt global - Pt Gen over Pt vs Eta gen",50,-2.5,2.5,100,-.5,.5);
00251 h_DPtGlobalStaComponentGenvsEtaGen_ZMuMuTagged = fs->make<TH2D>("h_DPtGlobalStaComponentGenoverPtvsEtaGen_ZMuMuTagged","Pt Sta component of a Global - Pt Gen over Pt vs Eta gen",50,-2.5,2.5,100,-1.,1.);
00252 h_DPtTrackGenvsPtGen_ZMuMuTagged = fs->make<TH2D>("h_DPtTrackGenOverPtvsPtGen_ZMuMuTagged","Pt track - Pt Gen vs Pt gen over Pt",50,0.,100.,100,-.5,.5);
00253 h_DPtTrackGenvsEtaGen_ZMuMuTagged = fs->make<TH2D>("h_DPtTrackGenOverPtvsEtaGen_ZMuMuTagged","Pt track - Pt Gen over Pt vs Eta gen",50,-2.5,2.5,100,-.5,.5);
00254
00255
00256 h_zMuTrackMass_ZMuMuTagged = fs->make<TH1D>("zMuTrackMass_ZMuMuTagged","inv Mass ZMuTrack cand (global-global)",100, 0., 200.);
00257 h_etaTrack_ZMuMuTagged = fs->make<TH1D>("etaTrack_ZMuMuTagged","eta of Track (global-global)",50, -2.5, 2.5);
00258 h_phiTrack_ZMuMuTagged = fs->make<TH1D>("phiTrack_ZMuMuTagged","phi of Track (global-global)",50, -3.1415, 3.1415);
00259 h_ptTrack_ZMuMuTagged = fs->make<TH1D>("ptTrack_ZMuMuTagged","pt of Track (global-global)",100, 0., 100.);
00260 h_DRTrack_ZMuMuTagged = fs->make<TH1D>("DRTrackSta_ZMuMuTagged","DR track-sta (global-global)",100, 0., 5.);
00261
00262
00263 h_zMuTrackMass_wrongStaCharge_ZMuMuTagged = fs->make<TH1D>("zMuTrackMass_wrongStaCharge_ZMuMuTagged","inv Mass ZMuTrack cand (global-global wrongStaCharge)",100, 0., 200.);
00264 h_etaTrack_wrongStaCharge_ZMuMuTagged = fs->make<TH1D>("etaTrack_wrongStaCharge_ZMuMuTagged","eta of Track (global-global wrongStaCharge)",50, -2.5, 2.5);
00265 h_phiTrack_wrongStaCharge_ZMuMuTagged = fs->make<TH1D>("phiTrack_wrongStaCharge_ZMuMuTagged","phi of Track (global-global wrongStaCharge)",50, -3.1415, 3.1415);
00266 h_ptTrack_wrongStaCharge_ZMuMuTagged = fs->make<TH1D>("ptTrack_wrongStaCharge_ZMuMuTagged","pt of Track (global-global wrongStaCharge)",100, 0., 100.);
00267 h_DRTrack_wrongStaCharge_ZMuMuTagged = fs->make<TH1D>("DRTrackSta_wrongStaCharge_ZMuMuTagged","DR track-sta (global-global wrongStaCharge)",100, 0., 5.);
00268
00269
00270 h_zMuStaMass_correctStaCharge_ZMuMuTagged = fs->make<TH1D>("zMuStaMass_correctStaCharge_ZMuMuTagged","inv Mass ZMuSta cand (global-global correctStaCharge)",100, 0., 200.);
00271 h_ptStaMinusptTrack_correctStaCharge_ZMuMuTagged = fs->make<TH1D>("ptStaMinusptTrackoverPT_correctStaCharge_ZMuMuTagged","ptSta - ptTrack over Pt (global-global correctStaCharge)",100, -1., 1.);
00272 h_ptStaMinusptTrack_vsPtTracker_correctStaCharge_ZMuMuTagged = fs->make<TH2D>("ptStaMinusptTrackoverPt_vsPtTracker_correctStaCharge_ZMuMuTagged","ptSta - ptTrack over Pt vs ptTrack (global-global correctStaCharge)",100,0.,100.,100, -1., 1.);
00273 h_ptStaMinusptTrack_vsEtaTracker_correctStaCharge_ZMuMuTagged = fs->make<TH2D>("ptStaMinusptTrackoverPt_vsEtaTracker_correctStaCharge_ZMuMuTagged","ptSta - ptTrack over Pt vs etaTrack (global-global correctStaCharge)",100,-2.5, 2.5, 100, -1., 1.);
00274
00275
00276 h_zMuStaMass_ZMuMuTagged = fs->make<TH1D>("zMuStaMass_ZMuMuTagged","inv Mass ZMuSta cand (global-global)",100, 0., 200.);
00277 h_etaSta_ZMuMuTagged = fs->make<TH1D>("etaSta_ZMuMuTagged","eta of Sta (global-global)",50, -2.5, 2.5);
00278 h_phiSta_ZMuMuTagged = fs->make<TH1D>("phiSta_ZMuMuTagged","phi of Sta (global-global)",50, -3.1415, 3.1415);
00279 h_ptSta_ZMuMuTagged = fs->make<TH1D>("ptSta_ZMuMuTagged","pt of Sta (global-global)",100, 0., 100.);
00280 h_DRSta_ZMuMuTagged = fs->make<TH1D>("DRTrackSta_ZMuMuTagged_staSelected","DR track-sta sta selected (global-global)",100, 0., 5.);
00281
00282
00283 h_zMuStaMass_wrongTrkCharge_ZMuMuTagged = fs->make<TH1D>("zMuStaMass_wrongTrkCharge_ZMuMuTagged","inv Mass ZMuSta cand (global-global wrongTrkCharge)",100, 0., 200.);
00284 h_etaSta_wrongTrkCharge_ZMuMuTagged = fs->make<TH1D>("etaSta_wrongTrkCharge_ZMuMuTagged","eta of Sta (global-global wrongTrkCharge)",50, -2.5, 2.5);
00285 h_phiSta_wrongTrkCharge_ZMuMuTagged = fs->make<TH1D>("phiSta_wrongTrkCharge_ZMuMuTagged","phi of Sta (global-global wrongTrkCharge)",50, -3.1415, 3.1415);
00286 h_ptSta_wrongTrkCharge_ZMuMuTagged = fs->make<TH1D>("ptSta_wrongTrkCharge_ZMuMuTagged","pt of Sta (global-global wrongTrkCharge)",100, 0., 100.);
00287 h_DRSta_wrongTrkCharge_ZMuMuTagged = fs->make<TH1D>("DRTrackSta_wrongTrkCharge_ZMuMuTagged","DR track-sta (global-global wrongTrkCharge)",100, 0., 5.);
00288
00289
00290
00291
00292 h_zMuTrackMass_ZMuTrackTagged = fs->make<TH1D>("zMuTrackMass_ZMuTrackTagged","inv Mass ZMuTrack cand (global-track)",100, 0., 200.);
00293 h_etaTrack_ZMuTrackTagged = fs->make<TH1D>("etaTrack_ZMuTrackTagged","eta of Track (global-track)",50, -2.5, 2.5);
00294 h_phiTrack_ZMuTrackTagged = fs->make<TH1D>("phiTrack_ZMuTrackTagged","phi of Track (global-track)",50, -3.1415, 3.1415);
00295 h_ptTrack_ZMuTrackTagged = fs->make<TH1D>("ptTrack_ZMuTrackTagged","pt of Track (global-track)",100, 0., 100.);
00296 h_DRTrack_ZMuTrackTagged = fs->make<TH1D>("DRTrackSta_ZMuTrackTagged","DR track-sta (global-track)",100, 0., 5.);
00297
00298
00299 h_zMuTrackMass_wrongStaCharge_ZMuTrackTagged = fs->make<TH1D>("zMuTrackMass_wrongStaCharge_ZMuTrackTagged","inv Mass ZMuTrack cand (global-track wrongUnMatcehdStaCharge)",100, 0., 200.);
00300 h_etaTrack_wrongStaCharge_ZMuTrackTagged = fs->make<TH1D>("etaTrack_wrongStaCharge_ZMuTrackTagged","eta of Track (global-track wrongUnMatchedStaCharge)",50, -2.5, 2.5);
00301 h_phiTrack_wrongStaCharge_ZMuTrackTagged = fs->make<TH1D>("phiTrack_wrongStaCharge_ZMuTrackTagged","phi of Track (global-track wrongUnMatchedStaCharge)",50, -3.1415, 3.1415);
00302 h_ptTrack_wrongStaCharge_ZMuTrackTagged = fs->make<TH1D>("ptTrack_wrongStaCharge_ZMuTrackTagged","pt of Track (global-track wrongUnMatchedStaCharge)",100, 0., 100.);
00303 h_DRTrack_wrongStaCharge_ZMuTrackTagged = fs->make<TH1D>("DRTrackSta_wrongStaCharge_ZMuTrackTagged","DR track-sta (global-track wrongUnMatchedStaCharge)",100, 0., 5.);
00304
00305
00306 h_zMuStaMass_ZMuStaTagged = fs->make<TH1D>("zMuStaMass_ZMuStaTagged","inv Mass ZMuSta cand (global-sta)",100, 0., 200.);
00307 h_etaSta_ZMuStaTagged = fs->make<TH1D>("etaSta_ZMuStaTagged","eta of Sta (global-sta)",50, -2.5, 2.5);
00308 h_phiSta_ZMuStaTagged = fs->make<TH1D>("phiSta_ZMuStaTagged","phi of Sta (global-sta)",50, -3.1415, 3.1415);
00309 h_ptSta_ZMuStaTagged = fs->make<TH1D>("ptSta_ZMuStaTagged","pt of Sta (global-sta)",100, 0., 100.);
00310
00311
00312 h_zMuStaMass_wrongTrkCharge_ZMuStaTagged = fs->make<TH1D>("zMuStaMass_wrongTrkCharge_ZMuStaTagged","inv Mass ZMuSta cand (global-sta wrongUnMatcehdTrkCharge)",100, 0., 200.);
00313 h_etaSta_wrongTrkCharge_ZMuStaTagged = fs->make<TH1D>("etaSta_wrongTrkCharge_ZMuStaTagged","eta of Sta (global-sta wrongUnMatchedTrkCharge)",50, -2.5, 2.5);
00314 h_phiSta_wrongTrkCharge_ZMuStaTagged = fs->make<TH1D>("phiSta_wrongTrkCharge_ZMuStaTagged","phi of Sta (global-sta wrongUnMatchedTrkCharge)",50, -3.1415, 3.1415);
00315 h_ptSta_wrongTrkCharge_ZMuStaTagged = fs->make<TH1D>("ptSta_wrongTrkCharge_ZMuStaTagged","pt of Sta (global-sta wrongUnMatchedTrkCharge)",100, 0., 100.);
00316
00317
00318 totalNumberOfZfound=0;
00319 totalNumberOfZpassed=0;
00320 nZMuMuSameSign_mcMatched = 0;
00321 nZMuMuSameSign = 0;
00322 n_goodTrack_ZMuMutagged = 0;
00323 n_correctStaCharge_ZMuMutagged = 0;
00324 n_wrongStaCharge_ZMuMutagged = 0;
00325 n_goodSta_ZMuMutagged = 0;
00326 n_correctTrkCharge_ZMuMutagged = 0;
00327 n_wrongTrkCharge_ZMuMutagged = 0;
00328 n_goodTrack_ZMuTracktagged = 0;
00329 n_correctStaCharge_ZMuTracktagged = 0;
00330 n_wrongStaCharge_ZMuTracktagged = 0;
00331 n_StaNotFound_ZMuTracktagged=0;
00332
00333 n_goodSta_ZMuStatagged = 0;
00334 n_correctTrkCharge_ZMuStatagged = 0;
00335 n_wrongTrkCharge_ZMuStatagged = 0;
00336 n_TrkNotFound_ZMuStatagged=0;
00337
00338 n_OneGoodZMuTrack=0;
00339 n_MultipleGoodZMuTrack=0;
00340 numberOfMatchedZMuSta_=0;
00341 n_ZMuStaTaggedMatched=0;
00342 }
00343
00344 void ZMuMuPerformances::analyze(const Event& event, const EventSetup& setup) {
00345 Handle<CandidateView> zMuMu;
00346 Handle<GenParticleMatch> zMuMuMatchMap;
00347 Handle<CandidateView> zMuTrack;
00348 Handle<GenParticleMatch> zMuTrackMatchMap;
00349 Handle<CandidateView> zMuStandAlone;
00350 Handle<GenParticleMatch> zMuStandAloneMatchMap;
00351 Handle<CandidateView> muons;
00352 Handle<GenParticleMatch> muonMatchMap;
00353 Handle<IsolationCollection> muonIso;
00354 Handle<CandidateView> tracks;
00355 Handle<IsolationCollection> trackIso;
00356 Handle<GenParticleCollection> genParticles;
00357
00358 event.getByLabel(zMuMu_, zMuMu);
00359 event.getByLabel(zMuTrack_, zMuTrack);
00360 event.getByLabel(zMuStandAlone_, zMuStandAlone);
00361 event.getByLabel(muons_, muons);
00362 event.getByLabel(muonMatchMap_, muonMatchMap);
00363 event.getByLabel(tracks_, tracks);
00364 event.getByLabel(genParticles_, genParticles);
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378 int n_globalMuon_perEvent=0;
00379 int n_staOnlyMuon_perEvent=0;
00380 int n_trackerOnlyMuon_perEvent=0;
00381 int n_trackerStaOnlyMuon_perEvent=0;
00382 int n_globalMuon_perEvent_MCmatch=0;
00383 int n_staOnlyMuon_perEvent_MCmatch=0;
00384 int n_trackerOnlyMuon_perEvent_MCmatch=0;
00385 int n_trackerStaOnlyMuon_perEvent_MCmatch=0;
00386
00387 for(unsigned int j = 0; j < muons->size() ; ++j) {
00388 CandidateBaseRef muCandRef = muons->refAt(j);
00389 const Candidate & muCand = (*muons)[j];
00390 const reco::Muon & muon = dynamic_cast<const reco::Muon &>(muCand);
00391 reco::TrackRef innerTrackRef = muon.track();
00392 reco::TrackRef outerTrackRef = muon.standAloneMuon();
00393 TrackRef muStaComponentRef = muCand.get<TrackRef,reco::StandAloneMuonTag>();
00394 TrackRef muTrkComponentRef = muCand.get<TrackRef>();
00395 GenParticleRef muonMatch = (*muonMatchMap)[muCandRef];
00396 if (muCandRef->isGlobalMuon()==1) n_globalMuon_perEvent++;
00397 if (muCandRef->isGlobalMuon()==0 && muCandRef->isTrackerMuon()==0 && muCandRef->isStandAloneMuon()==1) n_staOnlyMuon_perEvent++;
00398 if (muCandRef->isGlobalMuon()==0 && muCandRef->isTrackerMuon()==1 && muCandRef->isStandAloneMuon()==0) n_trackerOnlyMuon_perEvent++;
00399 if (muCandRef->isGlobalMuon()==0 && muCandRef->isTrackerMuon()==1 && muCandRef->isStandAloneMuon()==1) n_trackerStaOnlyMuon_perEvent++;
00400
00401 if (muonMatch.isNonnull()) {
00402 if (muCandRef->isGlobalMuon()==1) n_globalMuon_perEvent_MCmatch++;
00403 if (muCandRef->isGlobalMuon()==0 && muCandRef->isTrackerMuon()==0 && muCandRef->isStandAloneMuon()==1) n_staOnlyMuon_perEvent_MCmatch++;
00404 if (muCandRef->isGlobalMuon()==0 && muCandRef->isTrackerMuon()==1 && muCandRef->isStandAloneMuon()==0) n_trackerOnlyMuon_perEvent_MCmatch++;
00405 if (muCandRef->isGlobalMuon()==0 && muCandRef->isTrackerMuon()==1 && muCandRef->isStandAloneMuon()==1) n_trackerStaOnlyMuon_perEvent_MCmatch++;
00406 double productCharge = muCandRef->charge() * muonMatch->charge();
00407 if (muCandRef->isGlobalMuon()==1) {
00408 h_GlobalMuonChargeTimeGenCharge->Fill(productCharge);
00409 h_GlobalMuonEtaMinusGenEta->Fill(muCandRef->eta() - muonMatch->eta());
00410 h_GlobalMuonPtMinusGenPt->Fill((muCandRef->pt() - muonMatch->pt())/muonMatch->pt());
00411 h_GlobalMuonStaComponentEtaMinusGenEta->Fill(muStaComponentRef->eta() - muonMatch->eta());
00412 h_GlobalMuonStaComponentPtMinusGenPt->Fill((muStaComponentRef->pt() - muonMatch->pt())/muonMatch->pt());
00413 h_DEtaGlobalGenvsEtaGen->Fill(muonMatch->eta(),muCandRef->eta() - muonMatch->eta());
00414 h_DPtGlobalGenvsPtGen->Fill(muonMatch->pt(),(muCandRef->pt() - muonMatch->pt())/muonMatch->pt());
00415 h_DEtaGlobalStaComponentGenvsEtaGen->Fill(muonMatch->eta(),muStaComponentRef->eta() - muonMatch->eta());
00416 h_DPtGlobalStaComponentGenvsPtGen->Fill(muonMatch->pt(),(muStaComponentRef->pt() - muonMatch->pt())/muonMatch->pt());
00417 }
00418 if (muCandRef->isGlobalMuon()==0 && muCandRef->isTrackerMuon()==1) {
00419 h_TrackerMuonChargeTimeGenCharge->Fill(productCharge);
00420 h_TrackerMuonEtaMinusGenEta->Fill(muCandRef->eta() - muonMatch->eta());
00421 h_TrackerMuonPtMinusGenPt->Fill((muCandRef->pt() - muonMatch->pt())/muonMatch->pt());
00422 }
00423 }
00424 }
00425 h_n_globalMuon_perEvent->Fill(n_globalMuon_perEvent);
00426 h_n_staOnlyMuon_perEvent->Fill(n_staOnlyMuon_perEvent);
00427 h_n_trackerOnlyMuon_perEvent->Fill(n_trackerOnlyMuon_perEvent);
00428 h_n_trackerStaOnlyMuon_perEvent->Fill(n_trackerStaOnlyMuon_perEvent);
00429 h_n_globalMuon_perEvent_MCmatch->Fill(n_globalMuon_perEvent_MCmatch);
00430 h_n_staOnlyMuon_perEvent_MCmatch->Fill(n_staOnlyMuon_perEvent_MCmatch);
00431 h_n_trackerOnlyMuon_perEvent_MCmatch->Fill(n_trackerOnlyMuon_perEvent_MCmatch);
00432 h_n_trackerStaOnlyMuon_perEvent_MCmatch->Fill(n_trackerStaOnlyMuon_perEvent_MCmatch);
00433 h_n_tracks_perEvent->Fill(tracks->size());
00434
00435 h_n_zMuMu_perEvent->Fill(zMuMu->size());
00436 h_n_zMuSta_perEvent->Fill(zMuStandAlone->size());
00437 h_n_zMuTrack_perEvent->Fill(zMuTrack->size());
00438
00439
00440
00441
00442
00443
00444 if (zMuMu->size() > 0 ) {
00445 event.getByLabel(zMuMuMatchMap_, zMuMuMatchMap);
00446 event.getByLabel(muonIso_, muonIso);
00447 event.getByLabel(muonMatchMap_, muonMatchMap);
00448 float muGenplus_pt = 0, muGenminus_pt = 0, muGenplus_eta = 100, muGenminus_eta = 100;
00449 for(unsigned int i = 0; i < zMuMu->size(); ++i) {
00450 const Candidate & zMuMuCand = (*zMuMu)[i];
00451 CandidateBaseRef zMuMuCandRef = zMuMu->refAt(i);
00452 GenParticleRef zMuMuMatch = (*zMuMuMatchMap)[zMuMuCandRef];
00453 bool isMCMatched = false;
00454 if(zMuMuMatch.isNonnull()) {
00455 isMCMatched = true;
00456 if(zMuMuMatch->pdgId() == 23 && zMuMuMatch->status()==3 && zMuMuMatch->numberOfDaughters() == 3) {
00457
00458 const Candidate * dauGen0 = zMuMuMatch->daughter(0);
00459 const Candidate * dauGen1 = zMuMuMatch->daughter(1);
00460 const Candidate * dauGen2 = zMuMuMatch->daughter(2);
00461 if (check_ifZmumu(dauGen0, dauGen1, dauGen2)) {
00462 muGenplus_pt = getParticlePt(-13,dauGen0,dauGen1,dauGen2);
00463 muGenminus_pt = getParticlePt(13,dauGen0,dauGen1,dauGen2);
00464 muGenplus_eta = getParticleEta(-13,dauGen0,dauGen1,dauGen2);
00465 muGenminus_eta = getParticleEta(13,dauGen0,dauGen1,dauGen2);
00466 Particle::LorentzVector pZ(0, 0, 0, 0);
00467 Particle::LorentzVector muplusp4 = getParticleP4(-13,dauGen0,dauGen1,dauGen2);
00468 Particle::LorentzVector muminusp4 = getParticleP4(13,dauGen0,dauGen1,dauGen2);
00469 pZ = muplusp4 + muminusp4;
00470 }
00471 }
00472
00473 }
00474
00475 TrackRef as1 = zMuMuCand.daughter(0)->get<TrackRef,reco::StandAloneMuonTag>();
00476 TrackRef as2 = zMuMuCand.daughter(1)->get<TrackRef,reco::StandAloneMuonTag>();
00477 TrackRef a1 = zMuMuCand.daughter(0)->get<TrackRef,reco::CombinedMuonTag>();
00478 TrackRef a2 = zMuMuCand.daughter(1)->get<TrackRef,reco::CombinedMuonTag>();
00479 TrackRef at1 = zMuMuCand.daughter(0)->get<TrackRef>();
00480 TrackRef at2 = zMuMuCand.daughter(1)->get<TrackRef>();
00481
00482 math::XYZTLorentzVector ps1(as1->px(),as1->py(),as1->pz(),as1->p());
00483 math::XYZTLorentzVector ps2(as2->px(),as2->py(),as2->pz(),as2->p());
00484 math::XYZTLorentzVector pg1(a1->px(),a1->py(),a1->pz(),a1->p());
00485 math::XYZTLorentzVector pg2(a2->px(),a2->py(),a2->pz(),a2->p());
00486 math::XYZTLorentzVector ptrk1(at1->px(),at1->py(),at1->pz(),at1->p());
00487 math::XYZTLorentzVector ptrk2(at2->px(),at2->py(),at2->pz(),at2->p());
00488
00489
00490 double massGlobalSta = (pg1+ps2).mass();
00491 double massStaGlobal = (ps1+pg2).mass();
00492
00493 double massGlobalTracker = (pg1+ptrk2).mass();
00494 double massTrackerGlobal = (ptrk1+pg2).mass();
00495 double etaGlobal1 = a1->eta();
00496 double etaGlobal2 = a2->eta();
00497 double etaSta1 = as1->eta();
00498 double etaSta2 = as2->eta();
00499 double etaTracker1 = at1->eta();
00500 double etaTracker2 = at2->eta();
00501
00502
00503 double phiSta1 = as1->phi();
00504 double phiSta2 = as2->phi();
00505 double phiTracker1 = at1->phi();
00506 double phiTracker2 = at2->phi();
00507 double ptGlobal1 = a1->pt();
00508 double ptGlobal2 = a2->pt();
00509 double ptSta1 = as1->pt();
00510 double ptSta2 = as2->pt();
00511 double ptTracker1 = at1->pt();
00512 double ptTracker2 = at2->pt();
00513 double chargeGlobal1 = a1->charge();
00514 double chargeGlobal2 = a2->charge();
00515 double chargeSta1 = as1->charge();
00516 double chargeSta2 = as2->charge();
00517 double chargeTracker1 = at1->charge();
00518 double chargeTracker2 = at2->charge();
00519 double DR1 = deltaR(etaSta1, phiSta1, etaTracker1, phiTracker1);
00520 double DR2 = deltaR(etaSta2, phiSta2, etaTracker2, phiTracker2);
00521
00522 if (chargeGlobal1 == chargeGlobal2) {
00523 nZMuMuSameSign++;
00524 h_zMuMuMassSameSign->Fill(zMuMuCand.mass());
00525 if (isMCMatched) {
00526 nZMuMuSameSign_mcMatched++;
00527 h_zMuMuMassSameSign_MCmatch->Fill(zMuMuCand.mass());
00528
00529 }
00530 } else {
00531 h_zMuMuMassOppositeSign->Fill(zMuMuCand.mass());
00532 }
00533
00534 bool etaCut = false;
00535 bool ptCut = false;
00536
00537 bool massCut = false;
00538
00539
00540
00541
00542
00543
00544 if (abs(etaGlobal1)<etamax_ && abs(etaTracker2)<etamax_) etaCut = true;
00545 if (ptGlobal1>ptmin_ && ptTracker2>ptmin_) ptCut = true;
00546 if (massGlobalTracker>massMin_ && massGlobalTracker<massMax_) massCut = true;
00547
00548 if (noCut_) {
00549 etaCut = true;
00550 ptCut = true;
00551 massCut = true;
00552 }
00553
00554 if (etaCut && ptCut && massCut) {
00555
00556 if (chargeSta1 == chargeTracker1 && chargeTracker1 != chargeTracker2) {
00557 n_goodTrack_ZMuMutagged++;
00558 h_zMuTrackMass_ZMuMuTagged->Fill(massGlobalTracker);
00559 h_etaTrack_ZMuMuTagged->Fill(etaTracker2);
00560 h_phiTrack_ZMuMuTagged->Fill(phiTracker2);
00561 h_ptTrack_ZMuMuTagged->Fill(ptTracker2);
00562 h_DRTrack_ZMuMuTagged->Fill(DR2);
00563
00564 if (isMCMatched) {
00565 double etaGen, ptGen;
00566 if (chargeGlobal1==1) {
00567 etaGen = muGenplus_eta;
00568 ptGen = muGenplus_pt;
00569 } else {
00570 etaGen = muGenminus_eta;
00571 ptGen = muGenminus_pt;
00572 }
00573 h_GlobalMuonEtaMinusGenEta_ZMuMuTagged->Fill(etaGlobal1 - etaGen);
00574 h_GlobalMuonPtMinusGenPt_ZMuMuTagged->Fill((ptGlobal1 - ptGen)/ptGen);
00575 h_GlobalMuonStaComponentEtaMinusGenEta_ZMuMuTagged->Fill(etaSta1 - etaGen);
00576 h_GlobalMuonStaComponentPtMinusGenPt_ZMuMuTagged->Fill((ptSta1 - ptGen)/ptGen);
00577 h_DEtaGlobalGenvsEtaGen_ZMuMuTagged->Fill(etaGen,etaGlobal1-etaGen);
00578 h_DPtGlobalGenvsPtGen_ZMuMuTagged->Fill(ptGen,(ptGlobal1-ptGen)/ptGen);
00579 h_DEtaGlobalStaComponentGenvsEtaGen_ZMuMuTagged->Fill(etaGen,etaSta1-etaGen);
00580 h_DPtGlobalStaComponentGenvsPtGen_ZMuMuTagged->Fill(ptGen,(ptSta1-ptGen)/ptGen);
00581 h_DPtGlobalGenvsEtaGen_ZMuMuTagged->Fill(etaGen,(ptGlobal1-ptGen)/ptGen);
00582 h_DPtGlobalStaComponentGenvsEtaGen_ZMuMuTagged->Fill(etaGen,(ptSta1-ptGen)/ptGen);
00583 h_DPtTrackGenvsPtGen_ZMuMuTagged->Fill(ptGen,(ptTracker1-ptGen)/ptGen);
00584 h_DPtTrackGenvsEtaGen_ZMuMuTagged->Fill(etaGen,(ptTracker1-ptGen)/ptGen);
00585
00586 }
00587
00588 if (chargeSta2 == chargeTracker2) {
00589 n_correctStaCharge_ZMuMutagged++;
00590 h_zMuStaMass_correctStaCharge_ZMuMuTagged->Fill(massGlobalSta);
00591 h_ptStaMinusptTrack_correctStaCharge_ZMuMuTagged->Fill((ptSta2-ptTracker2)/ptTracker2);
00592 h_ptStaMinusptTrack_vsEtaTracker_correctStaCharge_ZMuMuTagged->Fill(etaTracker2,(ptSta2-ptTracker2)/ptTracker2);
00593 h_ptStaMinusptTrack_vsPtTracker_correctStaCharge_ZMuMuTagged->Fill(ptTracker2,(ptSta2-ptTracker2)/ptTracker2);
00594
00595 }
00596 if (chargeSta2 != chargeTracker2) {
00597 n_wrongStaCharge_ZMuMutagged++;
00598 h_zMuTrackMass_wrongStaCharge_ZMuMuTagged->Fill(massGlobalTracker);
00599 h_etaTrack_wrongStaCharge_ZMuMuTagged->Fill(etaTracker2);
00600 h_phiTrack_wrongStaCharge_ZMuMuTagged->Fill(phiTracker2);
00601 h_ptTrack_wrongStaCharge_ZMuMuTagged->Fill(ptTracker2);
00602 h_DRTrack_wrongStaCharge_ZMuMuTagged->Fill(DR2);
00603 }
00604 }
00605 }
00606
00607
00608 etaCut = false;
00609 ptCut = false;
00610 massCut = false;
00611
00612 if (abs(etaGlobal2)<etamax_ && abs(etaTracker1)<etamax_) etaCut = true;
00613 if (ptGlobal2>ptmin_ && ptTracker1>ptmin_) ptCut = true;
00614 if (massTrackerGlobal>massMin_ && massTrackerGlobal<massMax_) massCut = true;
00615
00616 if (noCut_) {
00617 etaCut = true;
00618 ptCut = true;
00619 massCut = true;
00620 }
00621
00622 if (etaCut && ptCut && massCut) {
00623
00624 if (chargeSta2 == chargeTracker2 && chargeTracker1 != chargeTracker2) {
00625 n_goodTrack_ZMuMutagged++;
00626 h_zMuTrackMass_ZMuMuTagged->Fill(massTrackerGlobal);
00627 h_etaTrack_ZMuMuTagged->Fill(etaTracker1);
00628 h_phiTrack_ZMuMuTagged->Fill(phiTracker1);
00629 h_ptTrack_ZMuMuTagged->Fill(ptTracker1);
00630 h_DRTrack_ZMuMuTagged->Fill(DR1);
00631
00632
00633 if (isMCMatched) {
00634 double etaGen, ptGen;
00635 if (chargeGlobal2==1) {
00636 etaGen = muGenplus_eta;
00637 ptGen = muGenplus_pt;
00638 } else {
00639 etaGen = muGenminus_eta;
00640 ptGen = muGenminus_pt;
00641 }
00642 h_GlobalMuonEtaMinusGenEta_ZMuMuTagged->Fill(etaGlobal2 - etaGen);
00643 h_GlobalMuonPtMinusGenPt_ZMuMuTagged->Fill((ptGlobal2 - ptGen)/ptGen);
00644 h_GlobalMuonStaComponentEtaMinusGenEta_ZMuMuTagged->Fill(etaSta2 - etaGen);
00645 h_GlobalMuonStaComponentPtMinusGenPt_ZMuMuTagged->Fill((ptSta2 - ptGen)/ptGen);
00646 h_DEtaGlobalGenvsEtaGen_ZMuMuTagged->Fill(etaGen,etaGlobal2-etaGen);
00647 h_DPtGlobalGenvsPtGen_ZMuMuTagged->Fill(ptGen,(ptGlobal2-ptGen)/ptGen);
00648 h_DEtaGlobalStaComponentGenvsEtaGen_ZMuMuTagged->Fill(etaGen,etaSta2-etaGen);
00649 h_DPtGlobalStaComponentGenvsPtGen_ZMuMuTagged->Fill(ptGen,(ptSta2-ptGen)/ptGen);
00650 h_DPtGlobalGenvsEtaGen_ZMuMuTagged->Fill(etaGen,(ptGlobal2-ptGen)/ptGen);
00651 h_DPtGlobalStaComponentGenvsEtaGen_ZMuMuTagged->Fill(etaGen,(ptSta2-ptGen)/ptGen);
00652 h_DPtTrackGenvsPtGen_ZMuMuTagged->Fill(ptGen,(ptTracker2-ptGen)/ptGen);
00653 h_DPtTrackGenvsEtaGen_ZMuMuTagged->Fill(etaGen,(ptTracker2-ptGen)/ptGen);
00654 }
00655
00656
00657 if (chargeSta1 == chargeTracker1) {
00658 n_correctStaCharge_ZMuMutagged++;
00659 h_zMuStaMass_correctStaCharge_ZMuMuTagged->Fill(massStaGlobal);
00660 h_ptStaMinusptTrack_correctStaCharge_ZMuMuTagged->Fill((ptSta1-ptTracker1)/ptTracker1);
00661 h_ptStaMinusptTrack_vsEtaTracker_correctStaCharge_ZMuMuTagged->Fill(etaTracker1,(ptSta1-ptTracker1)/ptTracker1);
00662 h_ptStaMinusptTrack_vsPtTracker_correctStaCharge_ZMuMuTagged->Fill(ptTracker1,(ptSta1-ptTracker1)/ptTracker1);
00663
00664 }
00665 if (chargeSta1 != chargeTracker1) {
00666 n_wrongStaCharge_ZMuMutagged++;
00667 h_zMuTrackMass_wrongStaCharge_ZMuMuTagged->Fill(massTrackerGlobal);
00668 h_etaTrack_wrongStaCharge_ZMuMuTagged->Fill(etaTracker1);
00669 h_phiTrack_wrongStaCharge_ZMuMuTagged->Fill(phiTracker1);
00670 h_ptTrack_wrongStaCharge_ZMuMuTagged->Fill(ptTracker1);
00671 h_DRTrack_wrongStaCharge_ZMuMuTagged->Fill(DR1);
00672 }
00673 }
00674 }
00675
00676
00677
00678
00679
00680 etaCut = false;
00681 ptCut = false;
00682
00683 massCut = false;
00684
00685
00686 if (abs(etaGlobal1)<etamax_ && abs(etaSta2)<etamax_) etaCut = true;
00687 if (ptGlobal1>ptmin_ && ptSta2>ptmin_) ptCut = true;
00688 if (massGlobalSta>massMin_ && massGlobalSta<massMax_) massCut = true;
00689
00690 if (noCut_) {
00691 etaCut = true;
00692 ptCut = true;
00693 massCut = true;
00694 }
00695
00696 if (etaCut && ptCut && massCut) {
00697
00698 if (chargeSta1 == chargeTracker1 && chargeTracker1 != chargeSta2) {
00699 n_goodSta_ZMuMutagged++;
00700 h_zMuStaMass_ZMuMuTagged->Fill(massGlobalSta);
00701 h_etaSta_ZMuMuTagged->Fill(etaSta2);
00702 h_phiSta_ZMuMuTagged->Fill(phiSta2);
00703 h_ptSta_ZMuMuTagged->Fill(ptSta2);
00704 h_DRSta_ZMuMuTagged->Fill(DR2);
00705
00706 if (chargeSta2 == chargeTracker2) {
00707 n_correctTrkCharge_ZMuMutagged++;
00708
00709 }
00710 if (chargeSta2 != chargeTracker2) {
00711 n_wrongTrkCharge_ZMuMutagged++;
00712 h_zMuStaMass_wrongTrkCharge_ZMuMuTagged->Fill(massGlobalSta);
00713 h_etaSta_wrongTrkCharge_ZMuMuTagged->Fill(etaSta2);
00714 h_phiSta_wrongTrkCharge_ZMuMuTagged->Fill(phiSta2);
00715 h_ptSta_wrongTrkCharge_ZMuMuTagged->Fill(ptSta2);
00716 h_DRSta_wrongTrkCharge_ZMuMuTagged->Fill(DR2);
00717 }
00718 }
00719 }
00720
00721 etaCut = false;
00722 ptCut = false;
00723
00724 massCut = false;
00725
00726
00727 if (abs(etaGlobal2)<etamax_ && abs(etaSta1)<etamax_) etaCut = true;
00728 if (ptGlobal2>ptmin_ && ptSta1>ptmin_) ptCut = true;
00729 if (massStaGlobal>massMin_ && massStaGlobal<massMax_) massCut = true;
00730
00731 if (noCut_) {
00732 etaCut = true;
00733 ptCut = true;
00734 massCut = true;
00735 }
00736
00737 if (etaCut && ptCut && massCut) {
00738
00739 if (chargeSta2 == chargeTracker2 && chargeTracker2 != chargeSta1) {
00740 n_goodSta_ZMuMutagged++;
00741 h_zMuStaMass_ZMuMuTagged->Fill(massStaGlobal);
00742 h_etaSta_ZMuMuTagged->Fill(etaSta1);
00743 h_phiSta_ZMuMuTagged->Fill(phiSta1);
00744 h_ptSta_ZMuMuTagged->Fill(ptSta1);
00745 h_DRSta_ZMuMuTagged->Fill(DR1);
00746
00747 if (chargeSta1 == chargeTracker1) {
00748 n_correctTrkCharge_ZMuMutagged++;
00749
00750 }
00751 if (chargeSta1 != chargeTracker1) {
00752 n_wrongTrkCharge_ZMuMutagged++;
00753 h_zMuStaMass_wrongTrkCharge_ZMuMuTagged->Fill(massStaGlobal);
00754 h_etaSta_wrongTrkCharge_ZMuMuTagged->Fill(etaSta1);
00755 h_phiSta_wrongTrkCharge_ZMuMuTagged->Fill(phiSta1);
00756 h_ptSta_wrongTrkCharge_ZMuMuTagged->Fill(ptSta1);
00757 h_DRSta_wrongTrkCharge_ZMuMuTagged->Fill(DR1);
00758 }
00759 }
00760 }
00761
00762
00763 }
00764 }
00765
00766
00767
00768
00769
00770 int taggedZ_index = -1;
00771 int taggedMuon_index = -1;
00772 int n_ZMuTrackTagged_inEvent = 0;
00773 if (zMuTrack->size() > 0 && zMuMu->size()==0) {
00774 event.getByLabel(zMuTrackMatchMap_, zMuTrackMatchMap);
00775 for(unsigned int i = 0; i < zMuTrack->size(); ++i) {
00776 const Candidate & zMuTrackCand = (*zMuTrack)[i];
00777 CandidateBaseRef zMuTrackCandRef = zMuTrack->refAt(i);
00778 GenParticleRef zMuTrackMatch = (*zMuTrackMatchMap)[zMuTrackCandRef];
00779
00780
00781
00782
00783
00784 double m = zMuTrackCand.mass();
00785 CandidateBaseRef zglobalDaughter = zMuTrackCand.daughter(0)->masterClone();
00786 CandidateBaseRef ztrackerDaughter = zMuTrackCand.daughter(1)->masterClone();
00787 TrackRef zglobalDaughter_StaComponentRef = zMuTrackCand.daughter(0)->get<TrackRef,reco::StandAloneMuonTag>();
00788
00789 TrackRef zglobalDaughter_TrackComponentRef = zMuTrackCand.daughter(0)->get<TrackRef>();
00790
00791 double ZtrackerDaughterCharge = ztrackerDaughter->charge();
00792 double ZtrackerDaughterPt = ztrackerDaughter->pt();
00793 double ZtrackerDaughterEta = ztrackerDaughter->eta();
00794 double ZtrackerDaughterPhi = ztrackerDaughter->phi();
00795 double ZglobalDaughterPt = zglobalDaughter->pt();
00796 double ZglobalDaughterEta = zglobalDaughter->eta();
00797 double ZglobalDaughter_StaComponentCharge = zglobalDaughter_StaComponentRef->charge();
00798 double ZglobalDaughter_TrackComponentCharge = zglobalDaughter_TrackComponentRef->charge();
00799
00800
00801
00802
00803
00804
00805 bool etaCut = false;
00806 bool ptCut = false;
00807
00808 bool massCut = false;
00809 if (abs(ZglobalDaughterEta)<etamax_ && abs(ZtrackerDaughterEta)<etamax_) etaCut = true;
00810 if (ZglobalDaughterPt>ptmin_ && ZtrackerDaughterPt>ptmin_) ptCut = true;
00811 if (m>massMin_ && m<massMax_) massCut = true;
00812
00813 if (noCut_) {
00814 etaCut = true;
00815 ptCut = true;
00816 massCut = true;
00817 }
00818 if (etaCut && ptCut && massCut && ZglobalDaughter_StaComponentCharge == ZglobalDaughter_TrackComponentCharge &&
00819 ZglobalDaughter_TrackComponentCharge != ZtrackerDaughterCharge) {
00820 n_ZMuTrackTagged_inEvent++;
00821
00822
00823
00824
00825 for(unsigned int j = 0; j < muons->size() ; ++j) {
00826 CandidateBaseRef muCandRef = muons->refAt(j);
00827 const Candidate & muCand = (*muons)[j];
00828 TrackRef muStaComponentRef = muCand.get<TrackRef,reco::StandAloneMuonTag>();
00829 TrackRef muTrkComponentRef = muCand.get<TrackRef>();
00830
00831 if (muCandRef->isStandAloneMuon()==1 && muCandRef->isGlobalMuon()==0 && muCandRef->isTrackerMuon()==1) {
00832 double muEta = muCandRef->eta();
00833 double muPhi = muCandRef->phi();
00834
00835 double DRmuSta_trackOfZ = deltaR(muEta, muPhi, ZtrackerDaughterEta, ZtrackerDaughterPhi);
00836 if (DRmuSta_trackOfZ == 0) {
00837 taggedZ_index = i;
00838 taggedMuon_index = j;
00839 }
00840 }
00841 }
00842 }
00843
00844 }
00845 }
00846
00847
00848 if (n_ZMuTrackTagged_inEvent>0) {
00849
00850 if (taggedZ_index==-1) {
00851 n_StaNotFound_ZMuTracktagged++;
00852
00853 } else {
00854 const Candidate & zMuTrackCand = (*zMuTrack)[taggedZ_index];
00855 CandidateBaseRef zMuTrackCandRef = zMuTrack->refAt(taggedZ_index);
00856 double m = zMuTrackCand.mass();
00857 CandidateBaseRef zglobalDaughter = zMuTrackCand.daughter(0)->masterClone();
00858 CandidateBaseRef ztrackerDaughter = zMuTrackCand.daughter(1)->masterClone();
00859 TrackRef zglobalDaughter_StaComponentRef = zMuTrackCand.daughter(0)->get<TrackRef,reco::StandAloneMuonTag>();
00860
00861 TrackRef zglobalDaughter_TrackComponentRef = zMuTrackCand.daughter(0)->get<TrackRef>();
00862
00863 double ZtrackerDaughterCharge = ztrackerDaughter->charge();
00864 double ZtrackerDaughterPt = ztrackerDaughter->pt();
00865 double ZtrackerDaughterEta = ztrackerDaughter->eta();
00866 double ZtrackerDaughterPhi = ztrackerDaughter->phi();
00867
00868 CandidateBaseRef muCandRef = muons->refAt(taggedMuon_index);
00869 const Candidate & muCand = (*muons)[taggedMuon_index];
00870 TrackRef muStaComponentRef = muCand.get<TrackRef,reco::StandAloneMuonTag>();
00871 TrackRef muTrkComponentRef = muCand.get<TrackRef>();
00872
00873 double muEta = muStaComponentRef->eta();
00874 double muPhi = muStaComponentRef->phi();
00875 double muCharge = muStaComponentRef->charge();
00876
00877 double DRmuSta_trackOfZ = deltaR(muEta, muPhi, ZtrackerDaughterEta, ZtrackerDaughterPhi);
00878
00879 n_goodTrack_ZMuTracktagged++;
00880 h_zMuTrackMass_ZMuTrackTagged->Fill(m);
00881 h_etaTrack_ZMuTrackTagged->Fill(ZtrackerDaughterEta);
00882 h_phiTrack_ZMuTrackTagged->Fill(ZtrackerDaughterPhi);
00883 h_ptTrack_ZMuTrackTagged->Fill(ZtrackerDaughterPt);
00884 h_DRTrack_ZMuTrackTagged->Fill(DRmuSta_trackOfZ);
00885
00886
00887 if (muCharge != ZtrackerDaughterCharge) {
00888 n_wrongStaCharge_ZMuTracktagged++;
00889 h_zMuTrackMass_wrongStaCharge_ZMuTrackTagged->Fill(m);
00890 h_etaTrack_wrongStaCharge_ZMuTrackTagged->Fill(ZtrackerDaughterEta);
00891 h_phiTrack_wrongStaCharge_ZMuTrackTagged->Fill(ZtrackerDaughterPhi);
00892 h_ptTrack_wrongStaCharge_ZMuTrackTagged->Fill(ZtrackerDaughterPt);
00893 h_DRTrack_wrongStaCharge_ZMuTrackTagged->Fill(DRmuSta_trackOfZ);
00894 } else {
00895 n_correctStaCharge_ZMuTracktagged++;
00896 }
00897 }
00898 }
00899
00900
00901
00902
00903
00904
00905
00906 bool isZMuStaMatched=false;
00907
00908 taggedZ_index = -1;
00909 taggedMuon_index = -1;
00910 int n_ZMuStaTagged_inEvent = 0;
00911 if (zMuStandAlone->size() > 0) {
00912 event.getByLabel(zMuStandAloneMatchMap_, zMuStandAloneMatchMap);
00913 for(unsigned int i = 0; i < zMuStandAlone->size(); ++i) {
00914 const Candidate & zMuStaCand = (*zMuStandAlone)[i];
00915 CandidateBaseRef zMuStaCandRef = zMuStandAlone->refAt(i);
00916
00917 GenParticleRef zMuStaMatch = (*zMuStandAloneMatchMap)[zMuStaCandRef];
00918 if(zMuStaMatch.isNonnull()) {
00919 numberOfMatchedZMuSta_++;
00920 isZMuStaMatched = true;
00921 }
00922
00923 double m = zMuStaCand.mass();
00924 CandidateBaseRef zglobalDaughter = zMuStaCand.daughter(0)->masterClone();
00925 CandidateBaseRef zstandaloneDaughter = zMuStaCand.daughter(1)->masterClone();
00926 int iglb = 0;
00927 int ista = 1;
00928 if (zglobalDaughter->isGlobalMuon()==0 && zstandaloneDaughter->isGlobalMuon()==1) {
00929 CandidateBaseRef buffer = zglobalDaughter;
00930 zglobalDaughter = zstandaloneDaughter;
00931 zstandaloneDaughter = buffer;
00932 iglb = 1;
00933 ista = 0;
00934 }
00935 TrackRef zglobalDaughter_StaComponentRef = zMuStaCand.daughter(iglb)->get<TrackRef,reco::StandAloneMuonTag>();
00936
00937 TrackRef zglobalDaughter_TrackComponentRef = zMuStaCand.daughter(iglb)->get<TrackRef>();
00938
00939 TrackRef zstaDaughter_StaComponentRef = zMuStaCand.daughter(ista)->get<TrackRef,reco::StandAloneMuonTag>();
00940
00941 TrackRef zstaDaughter_TrackComponentRef = zMuStaCand.daughter(ista)->get<TrackRef>();
00942
00943 double ZglobalDaughterPt = zglobalDaughter->pt();
00944 double ZglobalDaughterEta = zglobalDaughter->eta();
00945
00946 double ZstaDaughter_StaComponentCharge = zstaDaughter_StaComponentRef->charge();
00947 double ZstaDaughter_StaComponentPt = zstaDaughter_StaComponentRef->pt();
00948 double ZstaDaughter_StaComponentEta = zstaDaughter_StaComponentRef->eta();
00949 double ZstaDaughter_StaComponentPhi = zstaDaughter_StaComponentRef->phi();
00950 double ZstaDaughter_TrackComponentCharge = zstaDaughter_TrackComponentRef->charge();
00951
00952 double ZglobalDaughter_StaComponentCharge = zglobalDaughter_StaComponentRef->charge();
00953 double ZglobalDaughter_TrackComponentCharge = zglobalDaughter_TrackComponentRef->charge();
00954
00955
00956 bool etaCut = false;
00957 bool ptCut = false;
00958
00959 bool massCut = false;
00960 if (abs(ZglobalDaughterEta)<etamax_ && abs(ZstaDaughter_StaComponentEta)<etamax_) etaCut = true;
00961 if (ZglobalDaughterPt>ptmin_ && ZstaDaughter_StaComponentPt>ptmin_) ptCut = true;
00962 if (m>massMin_ && m<massMax_) massCut = true;
00963
00964 if (noCut_) {
00965 etaCut = true;
00966 ptCut = true;
00967 massCut = true;
00968 }
00969 if (etaCut && ptCut && massCut && ZglobalDaughter_StaComponentCharge == ZglobalDaughter_TrackComponentCharge &&
00970 ZglobalDaughter_StaComponentCharge != ZstaDaughter_StaComponentCharge) {
00971 n_ZMuStaTagged_inEvent++;
00972 if (isZMuStaMatched) n_ZMuStaTaggedMatched++;
00973
00974
00975 if (zstandaloneDaughter->isStandAloneMuon()==1 && zstandaloneDaughter->isTrackerMuon()==1) {
00976 n_goodSta_ZMuStatagged++;
00977 h_zMuStaMass_ZMuStaTagged->Fill(m);
00978 h_etaSta_ZMuStaTagged->Fill(ZstaDaughter_StaComponentEta);
00979 h_phiSta_ZMuStaTagged->Fill(ZstaDaughter_StaComponentPhi);
00980 h_ptSta_ZMuStaTagged->Fill(ZstaDaughter_StaComponentPt);
00981
00982
00983 if (ZstaDaughter_StaComponentCharge != ZstaDaughter_TrackComponentCharge) {
00984 n_wrongTrkCharge_ZMuStatagged++;
00985 h_zMuStaMass_wrongTrkCharge_ZMuStaTagged->Fill(m);
00986 h_etaSta_wrongTrkCharge_ZMuStaTagged->Fill(ZstaDaughter_StaComponentEta);
00987 h_phiSta_wrongTrkCharge_ZMuStaTagged->Fill(ZstaDaughter_StaComponentPhi);
00988 h_ptSta_wrongTrkCharge_ZMuStaTagged->Fill(ZstaDaughter_StaComponentPt);
00989 } else {
00990 n_correctTrkCharge_ZMuStatagged++;
00991 }
00992
00993 } else {
00994 n_TrkNotFound_ZMuStatagged++;
00995 }
00996 }
00997 if (n_ZMuStaTagged_inEvent==0) {
00998 }
00999
01000
01001 }
01002 }
01003
01004 }
01005
01006 bool ZMuMuPerformances::check_ifZmumu(const Candidate * dauGen0, const Candidate * dauGen1, const Candidate * dauGen2)
01007 {
01008 int partId0 = dauGen0->pdgId();
01009 int partId1 = dauGen1->pdgId();
01010 int partId2 = dauGen2->pdgId();
01011 bool muplusFound=false;
01012 bool muminusFound=false;
01013 bool ZFound=false;
01014 if (partId0==13 || partId1==13 || partId2==13) muminusFound=true;
01015 if (partId0==-13 || partId1==-13 || partId2==-13) muplusFound=true;
01016 if (partId0==23 || partId1==23 || partId2==23) ZFound=true;
01017 return muplusFound*muminusFound*ZFound;
01018 }
01019
01020 float ZMuMuPerformances::getParticlePt(const int ipart, const Candidate * dauGen0, const Candidate * dauGen1, const Candidate * dauGen2)
01021 {
01022 int partId0 = dauGen0->pdgId();
01023 int partId1 = dauGen1->pdgId();
01024 int partId2 = dauGen2->pdgId();
01025 float ptpart=0.;
01026 if (partId0 == ipart) {
01027 for(unsigned int k = 0; k < dauGen0->numberOfDaughters(); ++k) {
01028 const Candidate * dauMuGen = dauGen0->daughter(k);
01029 if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
01030 ptpart = dauMuGen->pt();
01031 }
01032 }
01033 }
01034 if (partId1 == ipart) {
01035 for(unsigned int k = 0; k < dauGen1->numberOfDaughters(); ++k) {
01036 const Candidate * dauMuGen = dauGen1->daughter(k);
01037 if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
01038 ptpart = dauMuGen->pt();
01039 }
01040 }
01041 }
01042 if (partId2 == ipart) {
01043 for(unsigned int k = 0; k < dauGen2->numberOfDaughters(); ++k) {
01044 const Candidate * dauMuGen = dauGen2->daughter(k);
01045 if(abs(dauMuGen->pdgId()) == ipart && dauMuGen->status() ==1) {
01046 ptpart = dauMuGen->pt();
01047 }
01048 }
01049 }
01050 return ptpart;
01051 }
01052
01053 float ZMuMuPerformances::getParticleEta(const int ipart, const Candidate * dauGen0, const Candidate * dauGen1, const Candidate * dauGen2)
01054 {
01055 int partId0 = dauGen0->pdgId();
01056 int partId1 = dauGen1->pdgId();
01057 int partId2 = dauGen2->pdgId();
01058 float etapart=0.;
01059 if (partId0 == ipart) {
01060 for(unsigned int k = 0; k < dauGen0->numberOfDaughters(); ++k) {
01061 const Candidate * dauMuGen = dauGen0->daughter(k);
01062 if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
01063 etapart = dauMuGen->eta();
01064 }
01065 }
01066 }
01067 if (partId1 == ipart) {
01068 for(unsigned int k = 0; k < dauGen1->numberOfDaughters(); ++k) {
01069 const Candidate * dauMuGen = dauGen1->daughter(k);
01070 if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
01071 etapart = dauMuGen->eta();
01072 }
01073 }
01074 }
01075 if (partId2 == ipart) {
01076 for(unsigned int k = 0; k < dauGen2->numberOfDaughters(); ++k) {
01077 const Candidate * dauMuGen = dauGen2->daughter(k);
01078 if(abs(dauMuGen->pdgId()) == ipart && dauMuGen->status() ==1) {
01079 etapart = dauMuGen->eta();
01080 }
01081 }
01082 }
01083 return etapart;
01084 }
01085
01086 float ZMuMuPerformances::getParticlePhi(const int ipart, const Candidate * dauGen0, const Candidate * dauGen1, const Candidate * dauGen2)
01087 {
01088 int partId0 = dauGen0->pdgId();
01089 int partId1 = dauGen1->pdgId();
01090 int partId2 = dauGen2->pdgId();
01091 float phipart=0.;
01092 if (partId0 == ipart) {
01093 for(unsigned int k = 0; k < dauGen0->numberOfDaughters(); ++k) {
01094 const Candidate * dauMuGen = dauGen0->daughter(k);
01095 if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
01096 phipart = dauMuGen->phi();
01097 }
01098 }
01099 }
01100 if (partId1 == ipart) {
01101 for(unsigned int k = 0; k < dauGen1->numberOfDaughters(); ++k) {
01102 const Candidate * dauMuGen = dauGen1->daughter(k);
01103 if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
01104 phipart = dauMuGen->phi();
01105 }
01106 }
01107 }
01108 if (partId2 == ipart) {
01109 for(unsigned int k = 0; k < dauGen2->numberOfDaughters(); ++k) {
01110 const Candidate * dauMuGen = dauGen2->daughter(k);
01111 if(abs(dauMuGen->pdgId()) == ipart && dauMuGen->status() ==1) {
01112 phipart = dauMuGen->phi();
01113 }
01114 }
01115 }
01116 return phipart;
01117 }
01118
01119 Particle::LorentzVector ZMuMuPerformances::getParticleP4(const int ipart, const Candidate * dauGen0, const Candidate * dauGen1, const Candidate * dauGen2)
01120 {
01121 int partId0 = dauGen0->pdgId();
01122 int partId1 = dauGen1->pdgId();
01123 int partId2 = dauGen2->pdgId();
01124 Particle::LorentzVector p4part(0.,0.,0.,0.);
01125 if (partId0 == ipart) {
01126 for(unsigned int k = 0; k < dauGen0->numberOfDaughters(); ++k) {
01127 const Candidate * dauMuGen = dauGen0->daughter(k);
01128 if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
01129 p4part = dauMuGen->p4();
01130 }
01131 }
01132 }
01133 if (partId1 == ipart) {
01134 for(unsigned int k = 0; k < dauGen1->numberOfDaughters(); ++k) {
01135 const Candidate * dauMuGen = dauGen1->daughter(k);
01136 if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
01137 p4part = dauMuGen->p4();
01138 }
01139 }
01140 }
01141 if (partId2 == ipart) {
01142 for(unsigned int k = 0; k < dauGen2->numberOfDaughters(); ++k) {
01143 const Candidate * dauMuGen = dauGen2->daughter(k);
01144 if(abs(dauMuGen->pdgId()) == ipart && dauMuGen->status() ==1) {
01145 p4part = dauMuGen->p4();
01146 }
01147 }
01148 }
01149 return p4part;
01150 }
01151
01152
01153
01154 void ZMuMuPerformances::endJob() {
01155
01156 cout << "------------------------------------ Counters --------------------------------" << endl;
01157 cout << "totalNumberOfZfound = " << totalNumberOfZfound << endl;
01158 cout << "totalNumberOfZpassed = " << totalNumberOfZpassed << endl;
01159 cout << "Number Of ZMuMu Same Sign (no cuts) " << nZMuMuSameSign << endl;
01160 cout << "Number Of ZMuMu Same Sign (no cuts) MC matched " << nZMuMuSameSign_mcMatched << endl;
01161
01162 cout << "------------------------------------ Counters for standAlone charge mis-id studies --------------------------------" << endl;
01163 cout << " number of goodTracks tagged for ZMuMu collection = " << n_goodTrack_ZMuMutagged << endl;
01164 cout << " number of goodTracks tagged for ZMuMu collection (correct Sta charge) = " << n_correctStaCharge_ZMuMutagged << endl;
01165 cout << " number of goodTracks tagged for ZMuMu collection (wrong Sta charge) = " << n_wrongStaCharge_ZMuMutagged << endl<<endl;
01166 cout << " number of goodTracks tagged for ZMuTrack collection unMatchedSTA = " << n_goodTrack_ZMuTracktagged << endl;
01167 cout << " number of goodTracks tagged for ZMuTrack collection unMatchedSTA (correct Sta charge) = " << n_correctStaCharge_ZMuTracktagged << endl;
01168 cout << " number of goodTracks tagged for ZMuTrack collection unMatchedSTA (wrong Sta charge) = " << n_wrongStaCharge_ZMuTracktagged << endl<<endl;
01169 cout << " number of goodTracks tagged for ZMuTrack collection (No STA found) = " << n_StaNotFound_ZMuTracktagged << endl;
01170
01171 cout << "------------------------------------ Counters for Track charge mis-id studies --------------------------------" << endl;
01172 cout << " number of goodStandAlone tagged for ZMuMu collection = " << n_goodSta_ZMuMutagged << endl;
01173 cout << " number of goodStandAlone tagged for ZMuMu collection (correct Trk charge) = " << n_correctTrkCharge_ZMuMutagged << endl;
01174 cout << " number of goodStandAlone tagged for ZMuMu collection (wrong Trk charge) = " << n_wrongTrkCharge_ZMuMutagged << endl<<endl;
01175 cout << " number of goodSta tagged for ZMuSta collection unMatchedTrk = " << n_goodSta_ZMuStatagged << endl;
01176 cout << " number of goodSta tagged for ZMuSta collection unMatchedTrk (correct Trk charge) = " << n_correctTrkCharge_ZMuStatagged << endl;
01177 cout << " number of goodSta tagged for ZMuSta collection unMatchedTrk (wrong Trk charge) = " << n_wrongTrkCharge_ZMuStatagged << endl<<endl;
01178 cout << " number of goodSta tagged for ZMuSta collection (No Trk found) = " << n_TrkNotFound_ZMuStatagged << endl;
01179 cout << " number of ZMuSta mactched = " << numberOfMatchedZMuSta_ << endl;
01180 cout << " number of ZMuSta Tagged matched = " << n_ZMuStaTaggedMatched << endl;
01181 }
01182
01183 #include "FWCore/Framework/interface/MakerMacros.h"
01184
01185 DEFINE_FWK_MODULE(ZMuMuPerformances);
01186