diff --git a/TopAnalysis/plugins/MiniAnalyzer.cc b/TopAnalysis/plugins/MiniAnalyzer.cc index ad654d6f43fd69e98941decab1a0f5033aa4fed7..bb895ee19a77ec8c62c8b6c1c5d846361b1b4c36 100644 --- a/TopAnalysis/plugins/MiniAnalyzer.cc +++ b/TopAnalysis/plugins/MiniAnalyzer.cc @@ -499,22 +499,24 @@ int MiniAnalyzer::recAnalysis(const edm::Event& iEvent, const edm::EventSetup& i edm::Handle<pat::PackedCandidateCollection> pfcands; iEvent.getByToken(pfToken_,pfcands); - //CTPPS local tracks - ev_.nfwdtrk=0; - edm::Handle<std::vector<CTPPSLocalTrackLite> > ctppslocaltracks; - iEvent.getByToken(ctppsToken_, ctppslocaltracks); - for (const CTPPSLocalTrackLite& lt : *ctppslocaltracks) { - const CTPPSDetId detid(lt.getRPId()); - if (detid.station()!=0) continue; // only keep the 210m horizontal stations - - ev_.fwdtrk_arm[ev_.nfwdtrk] = detid.arm(); // 0 = sector 4-5 ; 1 = sector 5-6 - ev_.fwdtrk_pot[ev_.nfwdtrk] = detid.rp(); // 2 = near pot ; 3 = far pot - ev_.fwdtrk_x[ev_.nfwdtrk] = lt.getX()*1.e-3; // store in m - ev_.fwdtrk_x_unc[ev_.nfwdtrk] = lt.getXUnc()*1.e-3; - ev_.fwdtrk_y[ev_.nfwdtrk] = lt.getY()*1.e-3; - ev_.fwdtrk_y_unc[ev_.nfwdtrk] = lt.getYUnc()*1.e-3; - - ev_.nfwdtrk++; + if(iEvent.isRealData()) { + //CTPPS local tracks (only present in data) + ev_.nfwdtrk=0; + edm::Handle<std::vector<CTPPSLocalTrackLite> > ctppslocaltracks; + iEvent.getByToken(ctppsToken_, ctppslocaltracks); + for (const CTPPSLocalTrackLite& lt : *ctppslocaltracks) { + const CTPPSDetId detid(lt.getRPId()); + if (detid.station()!=0) continue; // only keep the 210m horizontal stations + + ev_.fwdtrk_arm[ev_.nfwdtrk] = detid.arm(); // 0 = sector 4-5 ; 1 = sector 5-6 + ev_.fwdtrk_pot[ev_.nfwdtrk] = detid.rp(); // 2 = near pot ; 3 = far pot + ev_.fwdtrk_x[ev_.nfwdtrk] = lt.getX()*1.e-3; // store in m + ev_.fwdtrk_x_unc[ev_.nfwdtrk] = lt.getXUnc()*1.e-3; + ev_.fwdtrk_y[ev_.nfwdtrk] = lt.getY()*1.e-3; + ev_.fwdtrk_y_unc[ev_.nfwdtrk] = lt.getYUnc()*1.e-3; + + ev_.nfwdtrk++; + } } diff --git a/TopAnalysis/python/miniAnalyzer_cfi.py b/TopAnalysis/python/miniAnalyzer_cfi.py index 01895bbf7d943aaea00d9e28ebec4d317a3f71b7..f2c9fc21596d2faf0f0b1f83a94ae7886391f868 100644 --- a/TopAnalysis/python/miniAnalyzer_cfi.py +++ b/TopAnalysis/python/miniAnalyzer_cfi.py @@ -43,7 +43,8 @@ analysis = cms.EDAnalyzer("MiniAnalyzer", badPFMuonFilter = cms.InputTag('BadPFMuonFilter'), mets = cms.InputTag('slimmedMETs'), puppimets = cms.InputTag('slimmedMETsPuppi'), - pfCands = cms.InputTag('packedPFCandidates'), + pfCands = cms.InputTag('packedPFCandidates'), + ctppsLocalTracks = cms.InputTag('ctppsLocalTrackLiteProducer'), eleMvaIdMap = cms.InputTag("electronMVAValueMapProducer:ElectronMVAEstimatorRun2Spring16GeneralPurposeV1Values"), eleVetoIdMap = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Summer16-80X-V1-veto"), eleLooseIdMap = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Summer16-80X-V1-loose"), diff --git a/TopAnalysis/src/MiniEvent.cc b/TopAnalysis/src/MiniEvent.cc index b41eac55d8604c5705a62a0133a683eb549399b5..e3fee4d44851652235e66abf8a0ec40c8132b35e 100644 --- a/TopAnalysis/src/MiniEvent.cc +++ b/TopAnalysis/src/MiniEvent.cc @@ -124,6 +124,15 @@ void createMiniEventTree(TTree *t,MiniEvent_t &ev) t->Branch("met_phi", ev.met_phi, "met_phi[nmet]/F"); t->Branch("met_sig", ev.met_sig, "met_sig[nmet]/F"); t->Branch("met_filterBits", &ev.met_filterBits, "met_filterBits/I"); + + //CTPPS local tracks + t->Branch("nfwdtrk", &ev.nfwdtrk, "nfwdtrk/I"); + t->Branch("fwdtrk_arm", ev.fwdtrk_arm, "fwdtrk_arm[nfwdtrk]/F"); + t->Branch("fwdtrk_pot", ev.fwdtrk_pot, "fwdtrk_pot[nfwdtrk]/F"); + t->Branch("fwdtrk_x", ev.fwdtrk_x, "fwdtrk_x[nfwdtrk]/F"); + t->Branch("fwdtrk_x_unc",ev.fwdtrk_x_unc, "fwdtrk_x_unc[nfwdtrk]/F"); + t->Branch("fwdtrk_y", ev.fwdtrk_y, "fwdtrk_y[nfwdtrk]/F"); + t->Branch("fwdtrk_y_unc",ev.fwdtrk_y_unc, "fwdtrk_y_unc[nfwdtrk]/F"); } // @@ -255,4 +264,13 @@ void attachToMiniEventTree(TTree *t,MiniEvent_t &ev,bool full) t->SetBranchAddress("met_phi", ev.met_phi); t->SetBranchAddress("met_sig", ev.met_sig); t->SetBranchAddress("met_filterBits", &ev.met_filterBits); + + //CTPPS local tracks + t->SetBranchAddress("nfwdtrk", &ev.nfwdtrk); + t->SetBranchAddress("fwdtrk_arm", ev.fwdtrk_arm); + t->SetBranchAddress("fwdtrk_pot", ev.fwdtrk_pot); + t->SetBranchAddress("fwdtrk_x", ev.fwdtrk_x); + t->SetBranchAddress("fwdtrk_x_unc",ev.fwdtrk_x_unc); + t->SetBranchAddress("fwdtrk_y", ev.fwdtrk_y); + t->SetBranchAddress("fwdtrk_y_unc",ev.fwdtrk_y_unc); }