Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tau DQM miniAOD validation for DATA #44029

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Configuration/StandardSequences/python/Validation_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@
validationLiteTracking.replace(globalValidation,globalValidationLiteTracking)
validationLiteTracking.remove(condDataValidation)

validationMiniAOD = cms.Sequence(type0PFMEtCorrectionPFCandToVertexAssociationForValidationMiniAOD * JetValidationMiniAOD * METValidationMiniAOD * tauValidationSequenceMiniAOD * bTagMiniValidationSource)
validationMiniAOD = cms.Sequence(type0PFMEtCorrectionPFCandToVertexAssociationForValidationMiniAOD
* JetValidationMiniAOD
* METValidationMiniAOD
* tauValidationSequenceMiniAODonMC
* bTagMiniValidationSource)

prevalidation_preprod = cms.Sequence( preprodPrevalidation )

Expand Down
6 changes: 2 additions & 4 deletions DQMOffline/Configuration/python/DQMOfflineFS_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
DQMOfflinePrePOG = cms.Sequence(
pvMonitor *
bTagPlotsDATA *
dqmPhysics *
produceDenomsData *
pfTauRunDQMValidation
)
dqmPhysics
)

# Fix Jet Corrector in FastSim
topSingleMuonMediumDQM.setup.jetExtras.jetCorrector = cms.InputTag("ak4PFCHSL1FastL2L3Corrector")
Expand Down
3 changes: 3 additions & 0 deletions DQMOffline/Configuration/python/DQMOfflineMC_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@
#PostDQMOfflineNanoAOD.replace(nanoDQM, nanoDQMMC)
from PhysicsTools.NanoAOD.nanojmeDQM_cff import nanojmeDQMMC
DQMOfflineNanoJME.replace(nanojmeDQM, nanojmeDQMMC)

# Remove data seq for MC [already in Validation]
PostDQMOfflineMiniAOD.remove(DQMOfflineTAU)
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,6 @@
from Validation.RecoParticleFlow.DQMForPF_MiniAOD_cff import *
from DQMOffline.RecoB.bTagMiniDQM_cff import *

DQMHarvestMiniAOD = cms.Sequence( dataCertificationJetMETSequence * muonQualityTests_miniAOD * DQMHarvestPF * bTagMiniDQMHarvesting)
DQMHarvestMiniAOD = cms.Sequence( dataCertificationJetMETSequence * muonQualityTests_miniAOD * DQMHarvestPF * bTagMiniDQMHarvesting * DQMHarvestTAU)
DQMHarvestNanoAOD = cms.Sequence( nanoHarvest )

28 changes: 16 additions & 12 deletions DQMOffline/Configuration/python/DQMOffline_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@
#DQMOfflineCommon
from DQM.TrackingMonitorSource.pixelTracksMonitoring_cff import *
from DQMOffline.RecoB.PixelVertexMonitor_cff import *
from Validation.RecoTau.DQMSequences_cfi import *

DQMOfflinePixelTracking = cms.Sequence( pixelTracksMonitoring *
pixelPVMonitor *
Expand All @@ -222,9 +221,6 @@

DQMOfflineTrackerPhase2 = cms.Sequence( trackerphase2DQMSource )

DQMOfflineTAU = cms.Sequence( produceDenomsData *
pfTauRunDQMValidation )

DQMOfflineTrackerStripCommon = cms.Sequence( SiStripDQMTier0Common )

DQMOfflineTrackerPixel = cms.Sequence( siPixelOfflineDQM_source )
Expand All @@ -237,8 +233,7 @@
DQMOfflineTrigger *
DQMOfflineBeam *
DQMOfflineCASTOR *
DQMOfflinePhysics *
DQMOfflineTAU
DQMOfflinePhysics
)

DQMOfflineCommonFakeHLT = cms.Sequence( DQMOfflineCommon )
Expand Down Expand Up @@ -282,11 +277,6 @@
_run3_GEM_DQMOfflineMuon += gemSources
run3_GEM.toReplaceWith(DQMOfflineMuon, _run3_GEM_DQMOfflineMuon)

#Taus not created in pp conditions for HI
from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
_DQMOfflineTAU = cms.Sequence()
pp_on_AA.toReplaceWith(DQMOfflineTAU, _DQMOfflineTAU)


# miniAOD DQM validation
from Validation.RecoParticleFlow.miniAODDQM_cff import * # On MiniAOD vs RECO
Expand All @@ -295,13 +285,27 @@
from DQMOffline.RecoB.bTagMiniDQM_cff import *
from DQMOffline.Muon.miniAOD_cff import *
from DQM.Physics.DQMTopMiniAOD_cff import *
from Validation.RecoTau.DQMSequences_cfi import *

DQMOfflineTAU = cms.Sequence( produceDenomsData *
pfTauRunDQMValidation )

#Taus not created in pp conditions for HI
from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
_DQMOfflineTAU = cms.Sequence()
pp_on_AA.toReplaceWith(DQMOfflineTAU, _DQMOfflineTAU)


DQMOfflineMiniAOD = cms.Sequence(jetMETDQMOfflineRedoProductsMiniAOD*bTagMiniDQMSource*muonMonitors_miniAOD*MuonMiniAOD*DQMOfflinePF)

#Post sequences are automatically placed in the EndPath by ConfigBuilder if PAT is run.
#miniAOD DQM sequences need to access the filter results.

PostDQMOfflineMiniAOD = cms.Sequence(miniAODDQMSequence*jetMETDQMOfflineSourceMiniAOD*tracksDQMMiniAOD*topPhysicsminiAOD)
PostDQMOfflineMiniAOD = cms.Sequence(miniAODDQMSequence
* jetMETDQMOfflineSourceMiniAOD
* tracksDQMMiniAOD
* topPhysicsminiAOD
* DQMOfflineTAU)
PostDQMOffline = cms.Sequence()

from Configuration.Eras.Modifier_run3_HB_cff import run3_HB
Expand Down
3 changes: 3 additions & 0 deletions Validation/RecoTau/interface/TauValidationMiniAOD.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class TauValidationMiniAOD : public DQMEDAnalyzer {
std::map<std::string, MonitorElement *> dmMigrationMap, ntau_vs_dmMap;
std::map<std::string, MonitorElement *> pTOverProng_dm0Map, pTOverProng_dm1p2Map, pTOverProng_dm5Map,
pTOverProng_dm6Map, pTOverProng_dm10Map, pTOverProng_dm11Map;
std::map<std::string, MonitorElement *> fracMap;

edm::ParameterSet histoSettings_;
std::string extensionName_;
std::vector<edm::ParameterSet> discriminators_;
Expand All @@ -102,6 +104,7 @@ class TauValidationMiniAOD : public DQMEDAnalyzer {
std::string ztt;
std::string zee;
std::string zmm;
bool isMC_;
};

#endif
1 change: 1 addition & 0 deletions Validation/RecoTau/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<use name="DataFormats/TauReco"/>
<use name="DataFormats/MuonReco"/>
<use name="DataFormats/JetReco"/>
<use name="DataFormats/PatCandidates"/>
<use name="DataFormats/EgammaCandidates"/>
<use name="DataFormats/HepMCCandidate"/>
<use name="CommonTools/UtilAlgos"/>
Expand Down
18 changes: 13 additions & 5 deletions Validation/RecoTau/plugins/ElectronFromPVSelector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
#include "DataFormats/VertexReco/interface/Vertex.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"

// -- new -- [GS]
#include "DataFormats/PatCandidates/interface/Electron.h"

#include <algorithm>
#include <cmath>
#include <memory>
Expand All @@ -35,7 +38,8 @@ class GsfElectronFromPVSelector : public edm::global::EDProducer<> {
double max_dxy_;
double max_dz_;
edm::EDGetTokenT<std::vector<reco::Vertex>> v_recoVertexToken_;
edm::EDGetTokenT<std::vector<reco::GsfElectron>> v_recoGsfElectronToken_;
//edm::EDGetTokenT<std::vector<reco::GsfElectron>> v_recoGsfElectronToken_;
edm::EDGetTokenT<pat::ElectronCollection> v_recoGsfElectronToken_;
};

////////////////////////////////////////////////////////////////////////////////
Expand All @@ -47,8 +51,10 @@ GsfElectronFromPVSelector::GsfElectronFromPVSelector(edm::ParameterSet const& iC
max_dz_{iConfig.getParameter<double>("max_dz")},
v_recoVertexToken_{consumes<std::vector<reco::Vertex>>(iConfig.getParameter<edm::InputTag>("srcVertex"))},
v_recoGsfElectronToken_{
consumes<std::vector<reco::GsfElectron>>(iConfig.getParameter<edm::InputTag>("srcElectron"))} {
produces<std::vector<reco::GsfElectron>>();
//consumes<std::vector<reco::GsfElectron>>(iConfig.getParameter<edm::InputTag>("srcElectron"))} {
consumes<pat::ElectronCollection>(iConfig.getParameter<edm::InputTag>("srcElectron"))} {
//produces<std::vector<reco::GsfElectron>>();
produces<pat::ElectronCollection>();
}

////////////////////////////////////////////////////////////////////////////////
Expand All @@ -59,10 +65,12 @@ void GsfElectronFromPVSelector::produce(edm::StreamID, edm::Event& iEvent, edm::
edm::Handle<std::vector<reco::Vertex>> vertices;
iEvent.getByToken(v_recoVertexToken_, vertices);

edm::Handle<std::vector<reco::GsfElectron>> gsfElectrons;
//edm::Handle<std::vector<reco::GsfElectron>> gsfElectrons;
edm::Handle<pat::ElectronCollection> gsfElectrons;
iEvent.getByToken(v_recoGsfElectronToken_, gsfElectrons);

auto goodGsfElectrons = std::make_unique<std::vector<reco::GsfElectron>>();
//auto goodGsfElectrons = std::make_unique<std::vector<reco::GsfElectron>>();
auto goodGsfElectrons = std::make_unique<pat::ElectronCollection>();

if (!vertices->empty() && !gsfElectrons->empty()) {
auto const& pv = vertices->front();
Expand Down
17 changes: 12 additions & 5 deletions Validation/RecoTau/plugins/IsoTracks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "DataFormats/PatCandidates/interface/PackedCandidate.h"

#include <memory>
#include <vector>

Expand All @@ -21,7 +23,8 @@ class IsoTracks : public edm::global::EDProducer<> {
private:
double coneRadius_;
double threshold_;
edm::EDGetTokenT<std::vector<reco::Track>> v_recoTrackToken_;
//edm::EDGetTokenT<std::vector<reco::Track>> v_recoTrackToken_;
edm::EDGetTokenT<std::vector<pat::PackedCandidate>> v_recoTrackToken_;
};

////////////////////////////////////////////////////////////////////////////////
Expand All @@ -31,8 +34,10 @@ class IsoTracks : public edm::global::EDProducer<> {
IsoTracks::IsoTracks(edm::ParameterSet const& iConfig)
: coneRadius_{iConfig.getParameter<double>("radius")},
threshold_{iConfig.getParameter<double>("SumPtFraction")},
v_recoTrackToken_{consumes<std::vector<reco::Track>>(iConfig.getParameter<edm::InputTag>("src"))} {
produces<std::vector<reco::Track>>();
//v_recoTrackToken_{consumes<std::vector<reco::Track>>(iConfig.getParameter<edm::InputTag>("src"))} {
v_recoTrackToken_{consumes<std::vector<pat::PackedCandidate>>(iConfig.getParameter<edm::InputTag>("src"))} {
//produces<std::vector<reco::Track>>();
produces<std::vector<pat::PackedCandidate>>();
}

////////////////////////////////////////////////////////////////////////////////
Expand All @@ -41,9 +46,11 @@ IsoTracks::IsoTracks(edm::ParameterSet const& iConfig)

//______________________________________________________________________________
void IsoTracks::produce(edm::StreamID, edm::Event& iEvent, edm::EventSetup const&) const {
auto isoTracks = std::make_unique<std::vector<reco::Track>>();
//auto isoTracks = std::make_unique<std::vector<reco::Track>>();
auto isoTracks = std::make_unique<std::vector<pat::PackedCandidate>>();

edm::Handle<std::vector<reco::Track>> dirtyTracks;
//edm::Handle<std::vector<reco::Track>> dirtyTracks;
edm::Handle<std::vector<pat::PackedCandidate>> dirtyTracks;
iEvent.getByToken(v_recoTrackToken_, dirtyTracks);

if (dirtyTracks->empty()) {
Expand Down
17 changes: 12 additions & 5 deletions Validation/RecoTau/plugins/MuonFromPVSelector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#include "DataFormats/VertexReco/interface/Vertex.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"

// -- new -- [GS]
#include "DataFormats/PatCandidates/interface/Muon.h"

#include <memory>
#include <numeric>
#include <vector>
Expand All @@ -28,7 +31,8 @@ class MuonFromPVSelector : public edm::global::EDProducer<> {
double max_dxy_;
double max_dz_;
edm::EDGetTokenT<std::vector<reco::Vertex>> v_recoVertexToken_;
edm::EDGetTokenT<std::vector<reco::Muon>> v_recoMuonToken_;
//edm::EDGetTokenT<std::vector<reco::Muon>> v_recoMuonToken_;
edm::EDGetTokenT<pat::MuonCollection> v_recoMuonToken_;
};

////////////////////////////////////////////////////////////////////////////////
Expand All @@ -39,21 +43,24 @@ MuonFromPVSelector::MuonFromPVSelector(edm::ParameterSet const& iConfig)
: max_dxy_{iConfig.getParameter<double>("max_dxy")},
max_dz_{iConfig.getParameter<double>("max_dz")},
v_recoVertexToken_{consumes<std::vector<reco::Vertex>>(iConfig.getParameter<edm::InputTag>("srcVertex"))},
v_recoMuonToken_{consumes<std::vector<reco::Muon>>(iConfig.getParameter<edm::InputTag>("srcMuon"))} {
produces<std::vector<reco::Muon>>();
//v_recoMuonToken_{consumes<std::vector<reco::Muon>>(iConfig.getParameter<edm::InputTag>("srcMuon"))} {
v_recoMuonToken_{consumes<pat::MuonCollection>(iConfig.getParameter<edm::InputTag>("srcMuon"))} {
produces<pat::MuonCollection>();
}

////////////////////////////////////////////////////////////////////////////////
// implementation of member functions
////////////////////////////////////////////////////////////////////////////////

void MuonFromPVSelector::produce(edm::StreamID, edm::Event& iEvent, edm::EventSetup const&) const {
auto goodMuons = std::make_unique<std::vector<reco::Muon>>();
//auto goodMuons = std::make_unique<std::vector<reco::Muon>>();
auto goodMuons = std::make_unique<pat::MuonCollection>();

edm::Handle<std::vector<reco::Vertex>> vertices;
iEvent.getByToken(v_recoVertexToken_, vertices);

edm::Handle<std::vector<reco::Muon>> muons;
//edm::Handle<std::vector<reco::Muon>> muons;
edm::Handle<pat::MuonCollection> muons;
iEvent.getByToken(v_recoMuonToken_, muons);

if (!vertices->empty()) {
Expand Down
21 changes: 17 additions & 4 deletions Validation/RecoTau/plugins/ObjectViewCleaner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "DataFormats/PatCandidates/interface/Jet.h" // new
#include "DataFormats/PatCandidates/interface/Electron.h" // new
#include "DataFormats/PatCandidates/interface/Muon.h" // new

#include <memory>
#include <sstream>
#include <vector>
Expand Down Expand Up @@ -83,7 +87,9 @@ namespace {
? iConfig.getParameter<std::string>("srcObjectsToRemoveSelection")
: "",
true} {
produces<edm::RefToBaseVector<T>>();
// produces<edm::RefToBaseVector<T>>();
// need to write a class_def.xml??
produces<std::vector<T>>();
}

//______________________________________________________________________________
Expand All @@ -93,11 +99,13 @@ namespace {
iEvent.getByToken(srcCands_, candidates);
globalCache()->nObjectsTot += candidates->size();

auto cleanObjects = std::make_unique<edm::RefToBaseVector<T>>();
//auto cleanObjects = std::make_unique<edm::RefToBaseVector<T>>();
auto cleanObjects = std::make_unique<std::vector<T>>();
for (unsigned int iCand{}; iCand < candidates->size(); ++iCand) {
auto const& candidate = candidates->at(iCand);
if (objKeepCut_(candidate) && isIsolated(iEvent, candidate)) {
cleanObjects->push_back(candidates->refAt(iCand));
//cleanObjects->push_back(candidates->refAt(iCand));
cleanObjects->push_back(candidate);
}
}
globalCache()->nObjectsClean += cleanObjects->size();
Expand Down Expand Up @@ -152,7 +160,7 @@ namespace {
////////////////////////////////////////////////////////////////////////////////
// plugin definitions
////////////////////////////////////////////////////////////////////////////////

/*
typedef ObjectViewCleaner<reco::Candidate> TauValCandViewCleaner;
typedef ObjectViewCleaner<reco::Jet> TauValJetViewCleaner;
typedef ObjectViewCleaner<reco::Muon> TauValMuonViewCleaner;
Expand All @@ -168,3 +176,8 @@ DEFINE_FWK_MODULE(TauValGsfElectronViewCleaner);
DEFINE_FWK_MODULE(TauValElectronViewCleaner);
DEFINE_FWK_MODULE(TauValPhotonViewCleaner);
DEFINE_FWK_MODULE(TauValTrackViewCleaner);
*/

// -- new -- //
typedef ObjectViewCleaner<pat::Jet> TauValPatJetViewCleaner;
DEFINE_FWK_MODULE(TauValPatJetViewCleaner);
28 changes: 28 additions & 0 deletions Validation/RecoTau/plugins/Selectors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@
#include "DataFormats/HepMCCandidate/interface/GenParticle.h"
#include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h"

//#include "DataFormats/PatCandidates/interface/CandKinResolution.h" // new
//#include "DataFormats/PatCandidates/interface/CompositeCandidate.h" // new

#include "DataFormats/PatCandidates/interface/Jet.h" // new
#include "DataFormats/PatCandidates/interface/Electron.h" // new
#include "DataFormats/PatCandidates/interface/Muon.h" // new
#include "DataFormats/TrackReco/interface/Track.h" // new
#include "DataFormats/PatCandidates/interface/PackedCandidate.h"
#include "CommonTools/RecoAlgos/interface/CandidateProducer.h"

#include <vector>
#include <iostream>

Expand All @@ -50,6 +60,22 @@ typedef SingleObjectSelector<edm::View<reco::GsfElectron>,
reco::GsfElectronCollection>
TauValElectronSelector;

// -- new -- [GS] //
typedef SingleObjectSelector<pat::JetCollection, StringCutObjectSelector<pat::Jet> > TauValPatJetSelector;
typedef SingleObjectSelector<pat::ElectronCollection, StringCutObjectSelector<pat::Electron>, pat::ElectronCollection>
TauValPatElectronSelector;
typedef SingleObjectSelector<pat::MuonCollection, StringCutObjectSelector<pat::Muon> > TauValPatMuonSelector;
typedef SingleObjectSelector<std::vector<pat::PackedCandidate>, StringCutObjectSelector<pat::PackedCandidate> >
PFTrackSelector;
//typedef CandidateProducer<std::vector<pat::PackedCandidate>, std::vector<pat::PackedCandidate> >
// ConcreteChargedPFCandidateProducer;
DEFINE_FWK_MODULE(TauValPatJetSelector);
DEFINE_FWK_MODULE(TauValPatElectronSelector);
DEFINE_FWK_MODULE(TauValPatMuonSelector);
DEFINE_FWK_MODULE(PFTrackSelector);
//DEFINE_FWK_MODULE(ConcreteChargedPFCandidateProducer);
// -------------- //

DEFINE_FWK_MODULE(TauValPFJetSelector);
DEFINE_FWK_MODULE(TauValJetSelector);
DEFINE_FWK_MODULE(TauValMuonSelector);
Expand Down Expand Up @@ -94,12 +120,14 @@ bool ElectronIdFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::Even
// Loop over electrons
for (unsigned int i = 0; i < electrons->size(); i++) {
edm::Ref<reco::GsfElectronCollection> electronRef(electrons, i);
//edm::Ref<pat::ElectronCollection> electronRef(electrons, i);
if ((eIDmap[electronRef]) == eid_)
product->push_back((*electrons)[i]);
}

//cout << "Putting in the event" << endl;
std::unique_ptr<reco::GsfElectronCollection> collection(product);
//std::unique_ptr<pat::ElectronCollection> collection(product);
iEvent.put(std::move(collection));
return true;
}
Expand Down
Loading