diff --git a/RecoLuminosity/LumiProducer/test/analysis/plugins/PCCNTupler.cc b/RecoLuminosity/LumiProducer/test/analysis/plugins/PCCNTupler.cc index 5094869a69202..8cb05fecb980a 100644 --- a/RecoLuminosity/LumiProducer/test/analysis/plugins/PCCNTupler.cc +++ b/RecoLuminosity/LumiProducer/test/analysis/plugins/PCCNTupler.cc @@ -48,7 +48,9 @@ PCCNTupler::PCCNTupler(edm::ParameterSet const& iConfig): saveType(iConfig.getUntrackedParameter("saveType")), sampleType(iConfig.getUntrackedParameter("sampleType")), includeVertexInformation(iConfig.getUntrackedParameter("includeVertexInformation",1)), - includePixels(iConfig.getUntrackedParameter("includePixels",1)) + includePixels(iConfig.getUntrackedParameter("includePixels",1)), + includeJets(iConfig.getUntrackedParameter("includeJets",0)), + splitByBX(iConfig.getUntrackedParameter("splitByBX",1)) { cout << "----------------------------------------------------------------------" << endl; cout << "--- PCCNTupler constructor" << endl; @@ -114,6 +116,28 @@ PCCNTupler::PCCNTupler(edm::ParameterSet const& iConfig): pileUpToken=consumes >(fPileUpInfoLabel); tree->Branch("nPU",&nPU,"nPU/I"); } + + if(includeJets){ + hltjetsToken_=consumes(edm::InputTag("ak4CaloJets")); + const int kMaxJetCal = 100; + jhcalpt = new float[kMaxJetCal]; + jhcalphi = new float[kMaxJetCal]; + jhcaleta = new float[kMaxJetCal]; + jhcale = new float[kMaxJetCal]; + jhcalemf = new float[kMaxJetCal]; + jhcaln90 = new float[kMaxJetCal]; + jhcaln90hits = new float[kMaxJetCal]; + + //ccla HLTJETS + tree->Branch("NohJetCal",&nhjetcal,"NohJetCal/I"); + tree->Branch("ohJetCalPt",jhcalpt,"ohJetCalPt[NohJetCal]/F"); + tree->Branch("ohJetCalPhi",jhcalphi,"ohJetCalPhi[NohJetCal]/F"); + tree->Branch("ohJetCalEta",jhcaleta,"ohJetCalEta[NohJetCal]/F"); + tree->Branch("ohJetCalE",jhcale,"ohJetCalE[NohJetCal]/F"); + tree->Branch("ohJetCalEMF",jhcalemf,"ohJetCalEMF[NohJetCal]/F"); + tree->Branch("ohJetCalN90",jhcaln90,"ohJetCalN90[NohJetCal]/F"); + tree->Branch("ohJetCalN90hits",jhcaln90hits,"ohJetCalN90hits[NohJetCal]/F"); + } } // ---------------------------------------------------------------------- @@ -192,6 +216,9 @@ void PCCNTupler::analyze(const edm::Event& iEvent, //LN = -99; // FIXME need the luminibble event = iEvent.id().event(); bunchCrossing = iEvent.bunchCrossing(); + if(!splitByBX){ //if no splitting by BX then we can remove info. + bunchCrossing=-10; + } timeStamp_local = iEvent.time().unixTime(); if(timeStamp_end timeStamp_local) timeStamp_begin =timeStamp_local; @@ -225,9 +252,10 @@ void PCCNTupler::analyze(const edm::Event& iEvent, if(recVtxs.isValid()){ - nVtx=recVtxs->size(); + //nVtx=recVtxs->size(); int ivtx=0; for(reco::VertexCollection::const_iterator v=recVtxs->begin(); v!=recVtxs->end(); ++v){ + if(v->isFake()) continue; vtx_isGood[ivtx] = false; vtx_nTrk[ivtx] = v->tracksSize(); vtx_ndof[ivtx] = (int)v->ndof(); @@ -252,6 +280,38 @@ void PCCNTupler::analyze(const edm::Event& iEvent, } ivtx++; } + nVtx=ivtx; + } + } + + if(includeJets){ + edm::Handle< reco::CaloJetCollection > hltjets; + iEvent.getByToken(hltjetsToken_, hltjets); + bool valid = hltjets.isValid(); + if (not valid) { + std::cout << "hltjets not valid "<pt()>5 && i->energy()>0.){ + jhcalpt[jhcal] = i->pt(); + jhcalphi[jhcal] = i->phi(); + jhcaleta[jhcal] = i->eta(); + jhcale[jhcal] = i->energy(); + jhcalemf[jhcal] = i->emEnergyFraction(); + jhcaln90[jhcal] = i->n90(); + //jetID->calculate( iEvent, *i ); + //jhcaln90hits[jhcal] = jetID->n90Hits(); + jhcal++; + } + + } + nhjetcal = jhcal; } } diff --git a/RecoLuminosity/LumiProducer/test/analysis/plugins/PCCNTupler.h b/RecoLuminosity/LumiProducer/test/analysis/plugins/PCCNTupler.h index 5835933d5b18d..922ebdc7c937f 100644 --- a/RecoLuminosity/LumiProducer/test/analysis/plugins/PCCNTupler.h +++ b/RecoLuminosity/LumiProducer/test/analysis/plugins/PCCNTupler.h @@ -27,6 +27,8 @@ #include "DataFormats/VertexReco/interface/VertexFwd.h" #include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/JetReco/interface/CaloJetCollection.h" + #include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Utilities/interface/EDGetToken.h" @@ -64,7 +66,10 @@ class PCCNTupler : public edm::one::EDAnalyzer > pixelToken; edm::EDGetTokenT recoVtxToken; edm::EDGetTokenT > pileUpToken; - + edm::EDGetTokenT hltjetsToken_; + float *jhcalpt, *jhcalphi, *jhcaleta, *jhcale, *jhcalemf, *jhcaln90, *jhcaln90hits; + int nhjetcal; + edm::InputTag fPrimaryVertexCollectionLabel; edm::InputTag fPixelClusterLabel; edm::InputTag fPileUpInfoLabel; @@ -96,6 +101,8 @@ class PCCNTupler : public edm::one::EDAnalyzer