Skip to content

Commit

Permalink
add a switch allowing/disallowing skipping missing tauId products in …
Browse files Browse the repository at this point in the history
…the event
  • Loading branch information
mbluj committed Oct 26, 2017
1 parent 4feb9c9 commit 31cdc5e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions PhysicsTools/PatAlgos/plugins/PATTauProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ PATTauProducer::PATTauProducer(const edm::ParameterSet & iConfig):
}
caloTauIDTokens_ = edm::vector_transform(tauIDSrcs_, [this](NameTag const & tag){return mayConsume<reco::CaloTauDiscriminator>(tag.second);});
pfTauIDTokens_ = edm::vector_transform(tauIDSrcs_, [this](NameTag const & tag){return mayConsume<reco::PFTauDiscriminator>(tag.second);});
skipMissingTauID_ = iConfig.getParameter<bool>( "skipMissingTauID" );
// IsoDeposit configurables
if (iConfig.exists("isoDeposits")) {
edm::ParameterSet depconf = iConfig.getParameter<edm::ParameterSet>("isoDeposits");
Expand Down Expand Up @@ -315,7 +316,7 @@ void PATTauProducer::produce(edm::Event & iEvent, const edm::EventSetup & iSetup
edm::Handle<reco::PFTauDiscriminator> pfTauIdDiscr;
iEvent.getByToken(pfTauIDTokens_[i], pfTauIdDiscr);

if(!pfTauIdDiscr.isValid()){
if(skipMissingTauID_ && !pfTauIdDiscr.isValid()){
edm::LogWarning("DataSource") << "Tau discriminator '" << tauIDSrcs_[i].first
<< "' has not been found in the event. It will not be embedded into the pat::Tau object.";
continue;
Expand All @@ -330,7 +331,7 @@ void PATTauProducer::produce(edm::Event & iEvent, const edm::EventSetup & iSetup
edm::Handle<reco::CaloTauDiscriminator> caloTauIdDiscr;
iEvent.getByToken(caloTauIDTokens_[i], caloTauIdDiscr);

if(!caloTauIdDiscr.isValid()){
if(skipMissingTauID_ && !caloTauIdDiscr.isValid()){
edm::LogWarning("DataSource") << "Tau discriminator '" << tauIDSrcs_[i].first
<< "' has not been found in the event. It will not be embedded into the pat::Tau object.";
continue;
Expand Down Expand Up @@ -532,7 +533,9 @@ void PATTauProducer::fillDescriptions(edm::ConfigurationDescriptions & descripti
tauIDSourcesPSet.setAllowAnything();
iDesc.addNode( edm::ParameterDescription<edm::InputTag>("tauIDSource", edm::InputTag(), true) xor
edm::ParameterDescription<edm::ParameterSetDescription>("tauIDSources", tauIDSourcesPSet, true)
)->setComment("input with electron ID variables");
)->setComment("input with tau ID variables");
// (Dis)allow to skip missing tauId sources
iDesc.add<bool>("skipMissingTauID", false)->setComment("allow to skip a tau ID variable when not present in the event");

// IsoDeposit configurables
edm::ParameterSetDescription isoDepositsPSet;
Expand Down
2 changes: 1 addition & 1 deletion PhysicsTools/PatAlgos/plugins/PATTauProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ namespace pat {
std::vector<NameTag> tauIDSrcs_;
std::vector<edm::EDGetTokenT<reco::CaloTauDiscriminator> > caloTauIDTokens_;
std::vector<edm::EDGetTokenT<reco::PFTauDiscriminator> > pfTauIDTokens_;

bool skipMissingTauID_;
// tools
GreaterByPt<Tau> pTTauComparator_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
againstElectronTightMVA6 = cms.InputTag("hpsPFTauDiscriminationByMVA6TightElectronRejection"),
againstElectronVTightMVA6 = cms.InputTag("hpsPFTauDiscriminationByMVA6VTightElectronRejection"),
),

skipMissingTauID = cms.bool(False), #Allow to skip a tau ID variable when not present in the event"
# mc matching configurables
addGenMatch = cms.bool(True),
embedGenMatch = cms.bool(True),
Expand Down

0 comments on commit 31cdc5e

Please sign in to comment.