Skip to content

Commit

Permalink
Improving SyncTreeProduce 1.1
Browse files Browse the repository at this point in the history
TreeProduction ntuple successfully integrated
Added a new process in the electronID_cfg
  • Loading branch information
clacaputo committed Oct 23, 2015
1 parent e8b5abd commit 464aa98
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 14 deletions.
2 changes: 1 addition & 1 deletion TreeProduction/interface/Tau.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
/* Trigger match information */ \
VECTOR_VAR(std::string, matchedTriggerPaths) \
/* tau discriminators */ \
NEW_TAU_DISCRIMINATOR_DATA() \
TAU_DISCRIMINATOR_DATA() \
/**/

// new TauID
Expand Down
27 changes: 15 additions & 12 deletions microAODProduction/plugins/SyncTreeProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

//HHbbTauTau Framework
#include "HHbbTauTau/AnalysisBase/include/SyncTree.h"
#include "TreeProduction/interface/Tau.h"
#include "HHbbTauTau/TreeProduction/interface/Tau.h"

#include "TTree.h"
#include "Math/VectorUtil.h"
Expand Down Expand Up @@ -110,7 +110,7 @@ class SyncTreeProducer : public edm::EDAnalyzer {
//Tau Tag
edm::EDGetToken tausMiniAODToken_;

std::shared_ptr<ntuple::SyncTree> syncTree;
ntuple::SyncTree syncTree;
};

//
Expand Down Expand Up @@ -158,12 +158,12 @@ SyncTreeProducer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu
using namespace reco;

// Save global info right away
syncTree->run() = iEvent.id().run();
syncTree->lumi() = iEvent.id().luminosityBlock();
syncTree->evt() = iEvent.id().event();
syncTree.run() = iEvent.id().run();
syncTree.lumi() = iEvent.id().luminosityBlock();
syncTree.evt() = iEvent.id().event();

// Get the MC collection
iEvent.getByToken(genParticlesMiniAODToken_,genParticles);
// iEvent.getByToken(genParticlesMiniAODToken_,genParticles);

//Get Tau collection
edm::Handle<edm::View<pat::Tau> > taus;
Expand All @@ -177,19 +177,22 @@ SyncTreeProducer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu
//pat::PackedCandidate const* packedLeadTauCand = dynamic_cast<pat::PackedCandidate const*>(src.leadChargedHadrCand().get());
//fabs(packedLeadTauCand->dz()) < 0.2; // The PackedCandidate::dz() method is wrt. the first PV by default

if(!(tau.pt() > 20 && fabs(tau.eta()) < 2.3 && tau.tauID('decayModeFindingNewDMs') > 0.5)) continue;
if(!(tau.pt() > 20 && fabs(tau.eta()) < 2.3 && tau.tauID("decayModeFindingNewDMs") > 0.5)) continue;
tmp_tau.eta = tau.eta();
tmp_tau.pt = tau.pt();
tmp_tau.phi = tau.phi();
tmp_tau.againstElectronLooseMVA5 = tau.tauID('againstElectronLooseMVA5');
tmp_tau.againstElectronMediumMVA5 = tau.tauID('againstElectronMediumMVA5');
tmp_tau.againstElectronTightMVA5 = tau.tauID('againstElectronTightMVA5');
tmp_tau.againstElectronVTightMVA5 = tau.tauID('againstElectronVTightMVA5');
// tmp_tau.againstElectronLooseMVA5 = tau.tauID('againstElectronLooseMVA5');
// tmp_tau.againstElectronMediumMVA5 = tau.tauID('againstElectronMediumMVA5');
// tmp_tau.againstElectronTightMVA5 = tau.tauID('againstElectronTightMVA5');
// tmp_tau.againstElectronVTightMVA5 = tau.tauID('againstElectronVTightMVA5');

tausV.push_back(tmp_tau);
}

}

if(!tausV.size()) return;
std::cout<<"Taus size: "<<tausV.size()<<std::endl;
syncTree.pt_1() = tausV.at(0).pt;
syncTree.Fill();

}
Expand Down
24 changes: 23 additions & 1 deletion microAODProduction/python/electronID_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,26 @@
print "Setting the ntupler"
print "="*50

process.synctupler = cms.EDAnalyzer('SyncTreeProducer',

genParticles = cms.InputTag("genParticles"),
#
# Objects specific to MiniAOD format
#
electronsMiniAOD = cms.InputTag("slimmedElectrons"),
genParticlesMiniAOD = cms.InputTag("prunedGenParticles"),
tauSrc = cms.InputTag("slimmedTaus"),
#
# ID decisions (common to all formats)
eleMediumIdMap = cms.InputTag("egmGsfElectronIDs:mvaEleID-Spring15-25ns-nonTrig-V1-wp90"),
eleTightIdMap = cms.InputTag("egmGsfElectronIDs:mvaEleID-Spring15-25ns-nonTrig-V1-wp80"),
#
# ValueMaps with MVA results
#
mvaValuesMap = cms.InputTag("electronMVAValueMapProducer:ElectronMVAEstimatorRun2Spring15NonTrig25nsV1Values"),
mvaCategoriesMap = cms.InputTag("electronMVAValueMapProducer:ElectronMVAEstimatorRun2Spring15NonTrig25nsV1Categories")
)

process.ntupler = cms.EDAnalyzer('ElectronsIDAnalyzer',
# The module automatically detects AOD vs miniAOD, so we configure both
#
Expand Down Expand Up @@ -108,6 +128,8 @@
mvaCategoriesMap = cms.InputTag("electronMVAValueMapProducer:ElectronMVAEstimatorRun2Spring15NonTrig25nsV1Categories")
)



process.TFileService = cms.Service("TFileService",
fileName = cms.string( outputFile )
)
Expand All @@ -118,4 +140,4 @@

# Make sure to add the ID sequence upstream from the user analysis module
#process.p = cms.Path(process.egmGsfElectronIDSequence * process.ntupler)
process.p = cms.Path(process.ntupler)
process.p = cms.Path(process.synctupler)

0 comments on commit 464aa98

Please sign in to comment.