Skip to content

Commit

Permalink
Merge pull request cms-sw#103 from steggema/HTauTauMiniAOD
Browse files Browse the repository at this point in the history
Merging, after having checked also that it has no side effect on the susy/tth side (as expected).

Giovanni
  • Loading branch information
gpetruc committed Aug 1, 2014
2 parents 9dcec85 + 29fac56 commit acde6c2
Show file tree
Hide file tree
Showing 501 changed files with 1,501 additions and 107,118 deletions.
85 changes: 49 additions & 36 deletions CMGTools/Common/plugins/MetFlavorProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ void MetFlavorProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetu
//PFJetCollection lCJets = *lHCJets;

//Get pfCandidates
Handle<PFCandidateCollection> lHCands;
// Handle<PFCandidateCollection> lHCands;
Handle<std::vector<pat::PackedCandidate>> lHCands;
iEvent.getByLabel(fPFCandName , lHCands);
const PFCandidateCollection& lCands = *lHCands;
const std::vector<pat::PackedCandidate>& lCands = *lHCands;

// vertices
Handle<reco::VertexCollection> lHVertices;
Expand Down Expand Up @@ -139,9 +140,9 @@ void MetFlavorProducer::makeJets(std::vector<MetUtilities::JetInfo> &iJetInfo,
}
}

void MetFlavorProducer::makeCandidates(std::vector<std::pair<LorentzVector,double> > &iPFInfo,const PFCandidateCollection &iCands,const Vertex *iPV) {
void MetFlavorProducer::makeCandidates(std::vector<std::pair<LorentzVector,double> > &iPFInfo,const std::vector<pat::PackedCandidate> &iCands,const Vertex *iPV) {
for(int i0 = 0; i0 < (int)iCands.size(); i0++) {
const PFCandidate* pflowCand = &(iCands.at(i0));
const pat::PackedCandidate* pflowCand = &(iCands.at(i0));
double pDZ = -999;
if(iPV != 0) pDZ = pfCandDz(pflowCand,iPV); //If there is no track return negative number -999
//LorentzVector pVec; pVec.SetCoordinates(pflowCand->pt(),pflowCand->eta(),pflowCand->phi(),pflowCand->mass());
Expand Down Expand Up @@ -177,41 +178,53 @@ bool MetFlavorProducer::passPFLooseId(const pat::Jet *iJet) {
if(iJet->chargedMultiplicity() < 1 && fabs(iJet->eta()) < 2.4 ) return false;
return true;
}
double MetFlavorProducer::pfCandDz(const PFCandidate* iPFCand, const Vertex *iPV) {
double MetFlavorProducer::pfCandDz(const pat::PackedCandidate* iPFCand, const Vertex *iPV) {
double lDz = -999;
if(iPFCand->trackRef().isNonnull()) lDz = fabs(iPFCand-> trackRef()->dz(iPV->position()));
else if(iPFCand->gsfTrackRef().isNonnull()) lDz = fabs(iPFCand->gsfTrackRef()->dz(iPV->position()));
// if(iPFCand->trackRef().isNonnull()) lDz = fabs(iPFCand-> trackRef()->dz(iPV->position()));
// FIXME - JAN - understand what the pseudoTrack gives
lDz = fabs(iPFCand->pseudoTrack().dz(iPV->position()));
// else if(iPFCand->gsfTrackRef().isNonnull()) lDz = fabs(iPFCand->gsfTrackRef()->dz(iPV->position()));
return lDz;
}
double MetFlavorProducer::jetMVA (const Jet *iCorrJet,double iJec, const Vertex iPV, const reco::VertexCollection &iAllvtx,bool iPrintDebug) {
PileupJetIdentifier lPUJetId = fPUJetIdAlgo->computeIdVariables(iCorrJet,iJec,&iPV,iAllvtx,true);
// PileupJetIdentifier *lPUJetIdRef = &lPUJetId;
if(iCorrJet->pt() < 10) {
PileupJetIdentifier pPUJetId = fPUJetIdAlgoLowPt->computeIdVariables(iCorrJet,iJec,&iPV,iAllvtx,true);
// lPUJetIdRef = &pPUJetId;
}
if(iPrintDebug) { std::cout << "Debug Jet MVA: "
<< lPUJetId.nvtx() << " "
<< iCorrJet->pt() << " "
<< lPUJetId.jetEta() << " "
<< lPUJetId.jetPhi() << " "
<< lPUJetId.d0() << " "
<< lPUJetId.dZ() << " "
<< lPUJetId.beta() << " "
<< lPUJetId.betaStar() << " "
<< lPUJetId.nCharged() << " "
<< lPUJetId.nNeutrals() << " "
<< lPUJetId.dRMean() << " "
<< lPUJetId.frac01() << " "
<< lPUJetId.frac02() << " "
<< lPUJetId.frac03() << " "
<< lPUJetId.frac04() << " "
<< lPUJetId.frac05()
<< " === : === "
<< lPUJetId.mva() << " " << endl;
}

return lPUJetId.mva();
double MetFlavorProducer::jetMVA (const pat::Jet *iCorrJet,double iJec, const Vertex& iPV, const reco::VertexCollection &iAllvtx, bool iPrintDebug) {

return iCorrJet->userFloat("pileupJetId:fullDiscriminant");
// std::cout << "jet " << iCorrJet << std::endl;
// std::cout << "iJec " << iJec << std::endl;
// std::cout << "vertex x " << iPV.x() << std::endl;
// std::cout << "vertex coll size " << iAllvtx.size() << std::endl;


// std::cout << "Is a PF jet? " << (dynamic_cast<const pat::Jet*>(iCorrJet))->isPFJet() << std::endl;

// PileupJetIdentifier lPUJetId = fPUJetIdAlgo->computeIdVariables(iCorrJet,iJec,&iPV,iAllvtx,true);
// // PileupJetIdentifier *lPUJetIdRef = &lPUJetId;
// if(iCorrJet->pt() < 10) {
// PileupJetIdentifier pPUJetId = fPUJetIdAlgoLowPt->computeIdVariables(iCorrJet,iJec,&iPV,iAllvtx,true);
// // lPUJetIdRef = &pPUJetId;
// }
// if(iPrintDebug) { std::cout << "Debug Jet MVA: "
// << lPUJetId.nvtx() << " "
// << iCorrJet->pt() << " "
// << lPUJetId.jetEta() << " "
// << lPUJetId.jetPhi() << " "
// << lPUJetId.d0() << " "
// << lPUJetId.dZ() << " "
// << lPUJetId.beta() << " "
// << lPUJetId.betaStar() << " "
// << lPUJetId.nCharged() << " "
// << lPUJetId.nNeutrals() << " "
// << lPUJetId.dRMean() << " "
// << lPUJetId.frac01() << " "
// << lPUJetId.frac02() << " "
// << lPUJetId.frac03() << " "
// << lPUJetId.frac04() << " "
// << lPUJetId.frac05()
// << " === : === "
// << lPUJetId.mva() << " " << endl;
// }

// return lPUJetId.mva();
}

#include "FWCore/Framework/interface/MakerMacros.h"
Expand Down
7 changes: 4 additions & 3 deletions CMGTools/Common/plugins/MetFlavorProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "DataFormats/Math/interface/LorentzVector.h"
#include "DataFormats/JetReco/interface/Jet.h"
#include "DataFormats/JetReco/interface/PFJet.h"
#include "DataFormats/PatCandidates/interface/PackedCandidate.h"
#include "RecoJets/JetProducers/interface/PileupJetIdAlgo.h"

#include "CMGTools/Common/interface/MetUtilities.h"
Expand Down Expand Up @@ -56,7 +57,7 @@ class MetFlavorProducer : public edm::EDProducer {
int fMetFlavor;

void makeCandidates(std::vector<std::pair<LorentzVector,double> > &iPFInfo,
const PFCandidateCollection &iCands,const Vertex *iPV);
const std::vector<pat::PackedCandidate> &iCands,const Vertex *iPV);
void makeVertices (std::vector<Vector>& iPVInfo,
const VertexCollection &iVertices);

Expand All @@ -65,6 +66,6 @@ class MetFlavorProducer : public edm::EDProducer {
const VertexCollection& iVertices,double iRho);

bool passPFLooseId(const pat::Jet *iJet);
double pfCandDz(const PFCandidate* iPFCand, const Vertex *iPV) ;
double jetMVA (const Jet *iuncorrJet,double iJec, const Vertex iPV, const reco::VertexCollection &iAllvtx,bool iPrintDebug=false);
double pfCandDz(const pat::PackedCandidate* iPFCand, const Vertex *iPV) ;
double jetMVA (const pat::Jet *iuncorrJet,double iJec, const Vertex& iPV, const reco::VertexCollection &iAllvtx,bool iPrintDebug=false);
};
2 changes: 1 addition & 1 deletion CMGTools/Common/python/eventCleaning/goodPVFilter_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## select events with at least one good PV
goodPVFilter = cms.EDFilter(
"VertexSelector",
src = cms.InputTag("offlinePrimaryVertices"),
src = cms.InputTag("offlineSlimmedPrimaryVertices"),
cut = cms.string("!isFake && ndof > 4 && abs(z) <= 24 && position.Rho <= 2"),
filter = cms.bool(True), # otherwise it won't filter the events, just produce an empty vertex collection.
)
Expand Down
13 changes: 7 additions & 6 deletions CMGTools/Common/python/factories/cmgTauMuCor_cfi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import FWCore.ParameterSet.Config as cms

cmgTauMuCorFactory = cms.PSet(
cmgTauMuCor = cms.PSet(
"TauMuUpdateProducer",
# leg1 and leg2 are dummy collections here
leg1Collection = cms.InputTag(''),
leg2Collection = cms.InputTag(''),
Expand All @@ -17,8 +18,8 @@
shiftTaus = cms.bool(True)
)

cmgTauMuCor = cms.EDFilter(
"TauMuUpdatePOProducer",
cfg = cmgTauMuCorFactory.clone(),
cuts = cms.PSet()
)
# cmgTauMuCor = cms.EDFilter(
# "TauMuUpdateProducer",
# cfg = cmgTauMuCorFactory.clone(),
# cuts = cms.PSet()
# )
6 changes: 3 additions & 3 deletions CMGTools/Common/python/factories/cmgTauMu_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
metCollection = cms.InputTag('cmgPFMET')
)

cmgTauMu = cms.EDFilter(
cmgTauMu = cms.EDProducer(
"TauMuPOProducer",
cfg = tauMuFactory.clone(),
cuts = cms.PSet(),
# cfg = tauMuFactory.clone(),
# cuts = cms.PSet(),
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
wpId = 2 # see MetUtilies.cc
pfMetForRegression = cms.EDProducer(
"MetFlavorProducer",
CorrJetName = cms.InputTag("patJets"),
PFCandidateName = cms.InputTag("particleFlow"),
VertexName = cms.InputTag("offlinePrimaryVertices"),
RhoName = cms.InputTag('kt6PFJets','rho'),
CorrJetName = cms.InputTag("slimmedJets"),
PFCandidateName = cms.InputTag("packedPFCandidates"),
VertexName = cms.InputTag("offlineSlimmedPrimaryVertices"),
RhoName = cms.InputTag('fixedGridRhoFastjetAll'),
JetPtMin = cms.double(jetPtMin), # should be 0 for 5X and 1 for 4X
dZMin = cms.double(0.1),
MetFlavor = cms.int32(0), # 0 PF 1 TK 2 No PU 3 PU 4 PUC
Expand Down
11 changes: 8 additions & 3 deletions CMGTools/Common/python/skims/cmgTauMuSel_cfi.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import FWCore.ParameterSet.Config as cms

# cmgTauMuSel = cms.EDFilter(
# "CmgTauMuSelector",
# src = cms.InputTag( "cmgTauMu" ),
# cut = cms.string( "pt()>0" )
# )

cmgTauMuSel = cms.EDFilter(
"CmgTauMuSelector",
"PATCompositeCandidateSelector",
src = cms.InputTag( "cmgTauMu" ),
cut = cms.string( "pt()>0" )
cut = cms.string( "" )
)


3 changes: 0 additions & 3 deletions CMGTools/H2TauTau/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@

<use name="boost"/>
<use name="rootcintex"/>
<use name="rootrflx"/>
<use name="roofitcore"/>

<use name="FWCore/Framework"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/FWLite"/>
Expand All @@ -16,7 +14,6 @@
<use name="PhysicsTools/PatUtils"/>
<use name="PhysicsTools/PatExamples"/>
<use name="PhysicsTools/SelectorUtils"/>
<use name="AnalysisDataFormats/CMGTools"/>
<use name="TauAnalysis/SVFitStandAlone"/>
<use name="TauAnalysis/CandidateTools"/>
<use name="CMGTools/Common"/>
Expand Down
32 changes: 0 additions & 32 deletions CMGTools/H2TauTau/Colin/PythonExamples/binWidthNorm.py

This file was deleted.

9 changes: 0 additions & 9 deletions CMGTools/H2TauTau/Colin/PythonExamples/classAttribute.py

This file was deleted.

72 changes: 0 additions & 72 deletions CMGTools/H2TauTau/Colin/analysis.cfg

This file was deleted.

Loading

0 comments on commit acde6c2

Please sign in to comment.