CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
NanoAODBaseCrossCleaner Class Reference

#include <PhysicsTools/NanoAODBaseCrossCleaner/plugins/NanoAODBaseCrossCleaner.cc>

Inheritance diagram for NanoAODBaseCrossCleaner:
edm::stream::EDProducer<> NanoAODSimpleCrossCleaner

Public Member Functions

 NanoAODBaseCrossCleaner (const edm::ParameterSet &)
 
 ~NanoAODBaseCrossCleaner () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginStream (edm::StreamID) override
 
void endStream () override
 
virtual void objectSelection (const edm::View< pat::Jet > &jets, const edm::View< pat::Muon > &muons, const edm::View< pat::Electron > &eles, const edm::View< pat::Tau > &taus, const edm::View< pat::Photon > &photons, std::vector< uint8_t > &jetBits, std::vector< uint8_t > &muonBits, std::vector< uint8_t > &eleBits, std::vector< uint8_t > &tauBits, std::vector< uint8_t > &photonBits)
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

const std::string doc_
 
const std::string electronName_
 
const edm::EDGetTokenT< edm::View< pat::Electron > > electrons_
 
const StringCutObjectSelector< pat::ElectronelectronSel_
 
const std::string jetName_
 
const edm::EDGetTokenT< edm::View< pat::Jet > > jets_
 
const StringCutObjectSelector< pat::JetjetSel_
 
const std::string lowPtElectronName_
 
edm::EDGetTokenT< edm::View< pat::Electron > > lowPtElectrons_
 
const StringCutObjectSelector< pat::ElectronlowPtElectronSel_
 
edm::InputTag lowPtElectronsTag_
 
const std::string muonName_
 
const edm::EDGetTokenT< edm::View< pat::Muon > > muons_
 
const StringCutObjectSelector< pat::MuonmuonSel_
 
const std::string name_
 
const std::string photonName_
 
const edm::EDGetTokenT< edm::View< pat::Photon > > photons_
 
const StringCutObjectSelector< pat::PhotonphotonSel_
 
const std::string tauName_
 
const edm::EDGetTokenT< edm::View< pat::Tau > > taus_
 
const StringCutObjectSelector< pat::TautauSel_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 48 of file NanoAODBaseCrossCleaner.h.

Constructor & Destructor Documentation

◆ NanoAODBaseCrossCleaner()

NanoAODBaseCrossCleaner::NanoAODBaseCrossCleaner ( const edm::ParameterSet params)
explicit

Definition at line 25 of file NanoAODBaseCrossCleaner.cc.

26  : name_(params.getParameter<std::string>("name")),
27  doc_(params.getParameter<std::string>("doc")),
28  jets_(consumes<edm::View<pat::Jet>>(params.getParameter<edm::InputTag>("jets"))),
29  muons_(consumes<edm::View<pat::Muon>>(params.getParameter<edm::InputTag>("muons"))),
30  electrons_(consumes<edm::View<pat::Electron>>(params.getParameter<edm::InputTag>("electrons"))),
31  lowPtElectronsTag_(params.getParameter<edm::InputTag>("lowPtElectrons")),
33  taus_(consumes<edm::View<pat::Tau>>(params.getParameter<edm::InputTag>("taus"))),
34  photons_(consumes<edm::View<pat::Photon>>(params.getParameter<edm::InputTag>("photons"))),
35  jetSel_(params.getParameter<std::string>("jetSel")),
36  muonSel_(params.getParameter<std::string>("muonSel")),
37  electronSel_(params.getParameter<std::string>("electronSel")),
38  lowPtElectronSel_(params.getParameter<std::string>("lowPtElectronSel")),
39  tauSel_(params.getParameter<std::string>("tauSel")),
40  photonSel_(params.getParameter<std::string>("photonSel")),
41  jetName_(params.getParameter<std::string>("jetName")),
42  muonName_(params.getParameter<std::string>("muonName")),
43  electronName_(params.getParameter<std::string>("electronName")),
44  lowPtElectronName_(params.getParameter<std::string>("lowPtElectronName")),
45  tauName_(params.getParameter<std::string>("tauName")),
46  photonName_(params.getParameter<std::string>("photonName"))
47 
48 {
49  produces<nanoaod::FlatTable>("jets");
50  produces<nanoaod::FlatTable>("muons");
51  produces<nanoaod::FlatTable>("electrons");
52  produces<nanoaod::FlatTable>("lowPtElectrons");
53  produces<nanoaod::FlatTable>("taus");
54  produces<nanoaod::FlatTable>("photons");
55 }
const edm::EDGetTokenT< edm::View< pat::Photon > > photons_
const edm::EDGetTokenT< edm::View< pat::Jet > > jets_
const StringCutObjectSelector< pat::Jet > jetSel_
const StringCutObjectSelector< pat::Muon > muonSel_
const edm::EDGetTokenT< edm::View< pat::Tau > > taus_
const StringCutObjectSelector< pat::Photon > photonSel_
edm::EDGetTokenT< edm::View< pat::Electron > > lowPtElectrons_
const std::string lowPtElectronName_
const StringCutObjectSelector< pat::Tau > tauSel_
const edm::EDGetTokenT< edm::View< pat::Electron > > electrons_
const StringCutObjectSelector< pat::Electron > electronSel_
const edm::EDGetTokenT< edm::View< pat::Muon > > muons_
const StringCutObjectSelector< pat::Electron > lowPtElectronSel_

◆ ~NanoAODBaseCrossCleaner()

NanoAODBaseCrossCleaner::~NanoAODBaseCrossCleaner ( )
override

Definition at line 57 of file NanoAODBaseCrossCleaner.cc.

57  {
58  // do anything here that needs to be done at destruction time
59  // (e.g. close files, deallocate resources etc.)
60 }

Member Function Documentation

◆ beginStream()

void NanoAODBaseCrossCleaner::beginStream ( edm::StreamID  )
overrideprivate

Definition at line 134 of file NanoAODBaseCrossCleaner.cc.

134 {}

◆ endStream()

void NanoAODBaseCrossCleaner::endStream ( )
overrideprivate

Definition at line 137 of file NanoAODBaseCrossCleaner.cc.

137 {}

◆ fillDescriptions()

void NanoAODBaseCrossCleaner::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 140 of file NanoAODBaseCrossCleaner.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

140  {
142  desc.add<std::string>("name")->setComment("suffix name of the output flat table");
143  desc.add<std::string>("doc")->setComment(
144  "a bitmap defining the objects that remain after selection and cross cleaning");
145  desc.add<edm::InputTag>("jets")->setComment("a jet collection derived from pat::Jet");
146  desc.add<edm::InputTag>("muons")->setComment("a muon collection derived from pat::Muon");
147  desc.add<edm::InputTag>("electrons")->setComment("an electron collection derived from pat::Electron");
148  desc.add<edm::InputTag>("lowPtElectrons")
149  ->setComment("an optional electron collection derived from pat::Electron, empty=>not used");
150  desc.add<edm::InputTag>("taus")->setComment("a tau collection derived from pat::Tau");
151  desc.add<edm::InputTag>("photons")->setComment("a photon collection derived from pat::Photon");
152 
153  desc.add<std::string>("jetSel")->setComment("function on pat::Jet defining the selection of jets");
154  desc.add<std::string>("muonSel")->setComment("function on pat::Muon defining the selection of muons");
155  desc.add<std::string>("electronSel")->setComment("function on pat::Electron defining the selection of electrons");
156  desc.add<std::string>("lowPtElectronSel")
157  ->setComment("function on pat::Electron defining the selection on alternative electrons collection");
158  desc.add<std::string>("tauSel")->setComment("function on pat::Tau defining the selection on taus");
159  desc.add<std::string>("photonSel")->setComment("function on pat::Photon defining the selection on photons");
160 
161  desc.add<std::string>("jetName")->setComment("name of the jet mask flat table output");
162  desc.add<std::string>("muonName")->setComment("name of the muon mask flat table output");
163  desc.add<std::string>("electronName")->setComment("name of the electron mask flat table output");
164  desc.add<std::string>("lowPtElectronName")->setComment("name of the alternative electron mask flat table output");
165  desc.add<std::string>("tauName")->setComment("name of the tau mask flat table output");
166  desc.add<std::string>("photonName")->setComment("name of the photon mask flat table output");
167 
168  descriptions.addWithDefaultLabel(desc);
169 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ objectSelection()

virtual void NanoAODBaseCrossCleaner::objectSelection ( const edm::View< pat::Jet > &  jets,
const edm::View< pat::Muon > &  muons,
const edm::View< pat::Electron > &  eles,
const edm::View< pat::Tau > &  taus,
const edm::View< pat::Photon > &  photons,
std::vector< uint8_t > &  jetBits,
std::vector< uint8_t > &  muonBits,
std::vector< uint8_t > &  eleBits,
std::vector< uint8_t > &  tauBits,
std::vector< uint8_t > &  photonBits 
)
inlineprivatevirtual

Reimplemented in NanoAODSimpleCrossCleaner.

Definition at line 59 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

68  {};

◆ produce()

void NanoAODBaseCrossCleaner::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 68 of file NanoAODBaseCrossCleaner.cc.

References doc_, MillePedeFileConverter_cfg::e, electronName_, electrons_, electronSel_, hltEgammaEleL1TrkIsoL1Seeded_cfi::eles, iEvent, dqmiolumiharvest::j, jetName_, PDWG_EXODelayedJetMET_cff::jets, jets_, jetSel_, lowPtElectronName_, lowPtElectrons_, lowPtElectronSel_, visualization-live-secondInstance_cfg::m, eostools::move(), muonName_, PDWG_BPHSkim_cff::muons, muons_, muonSel_, name_, objectSelection(), AlCaHLTBitMon_ParallelJobs::p, photonName_, BPHMonitor_cfi::photons, photons_, photonSel_, submitPVValidationJobs::t, tauName_, Tau3MuMonitor_cff::taus, taus_, and tauSel_.

68  {
69  using namespace edm;
70  const auto& jetsProd = iEvent.get(jets_);
71  std::vector<uint8_t> jets;
72  jets.reserve(jetsProd.size());
73  for (const auto& j : jetsProd) {
74  jets.push_back(jetSel_(j));
75  }
76  auto jetsTable = std::make_unique<nanoaod::FlatTable>(jetsProd.size(), jetName_, false, true);
77 
78  const auto& muonsProd = iEvent.get(muons_);
79  std::vector<uint8_t> muons;
80  muons.reserve(muonsProd.size());
81  for (const auto& m : muonsProd) {
82  muons.push_back(muonSel_(m));
83  }
84  auto muonsTable = std::make_unique<nanoaod::FlatTable>(muonsProd.size(), muonName_, false, true);
85 
86  const auto& electronsProd = iEvent.get(electrons_);
87  std::vector<uint8_t> eles;
88  eles.reserve(electronsProd.size());
89  for (const auto& e : electronsProd) {
90  eles.push_back(electronSel_(e));
91  }
92  auto electronsTable = std::make_unique<nanoaod::FlatTable>(electronsProd.size(), electronName_, false, true);
93 
94  const auto& lowPtelectronsProd = iEvent.get(lowPtElectrons_);
95  std::vector<uint8_t> lowPtEles;
96  lowPtEles.reserve(lowPtelectronsProd.size());
97  for (const auto& e : lowPtelectronsProd) {
98  lowPtEles.push_back(lowPtElectronSel_(e));
99  }
100  auto lowPtElectronsTable = std::make_unique<nanoaod::FlatTable>(lowPtEles.size(), lowPtElectronName_, false, true);
101 
102  const auto& tausProd = iEvent.get(taus_);
103  std::vector<uint8_t> taus;
104  for (const auto& t : tausProd) {
105  taus.push_back(tauSel_(t));
106  }
107  auto tausTable = std::make_unique<nanoaod::FlatTable>(tausProd.size(), tauName_, false, true);
108 
109  const auto& photonsProd = iEvent.get(photons_);
110  std::vector<uint8_t> photons;
111  for (const auto& p : photonsProd) {
112  photons.push_back(photonSel_(p));
113  }
114  auto photonsTable = std::make_unique<nanoaod::FlatTable>(photonsProd.size(), photonName_, false, true);
115 
116  objectSelection(jetsProd, muonsProd, electronsProd, tausProd, photonsProd, jets, muons, eles, taus, photons);
117 
118  muonsTable->addColumn<uint8_t>(name_, muons, doc_);
119  jetsTable->addColumn<uint8_t>(name_, jets, doc_);
120  electronsTable->addColumn<uint8_t>(name_, eles, doc_);
121  lowPtElectronsTable->addColumn<uint8_t>(name_, lowPtEles, doc_);
122  tausTable->addColumn<uint8_t>(name_, taus, doc_);
123  photonsTable->addColumn<uint8_t>(name_, photons, doc_);
124 
125  iEvent.put(std::move(jetsTable), "jets");
126  iEvent.put(std::move(muonsTable), "muons");
127  iEvent.put(std::move(electronsTable), "electrons");
128  iEvent.put(std::move(tausTable), "taus");
129  iEvent.put(std::move(photonsTable), "photons");
130  iEvent.put(std::move(lowPtElectronsTable), "lowPtElectrons");
131 }
const edm::EDGetTokenT< edm::View< pat::Photon > > photons_
const edm::EDGetTokenT< edm::View< pat::Jet > > jets_
const StringCutObjectSelector< pat::Jet > jetSel_
const StringCutObjectSelector< pat::Muon > muonSel_
const edm::EDGetTokenT< edm::View< pat::Tau > > taus_
int iEvent
Definition: GenABIO.cc:224
const StringCutObjectSelector< pat::Photon > photonSel_
edm::EDGetTokenT< edm::View< pat::Electron > > lowPtElectrons_
const std::string lowPtElectronName_
const StringCutObjectSelector< pat::Tau > tauSel_
HLT enums.
const edm::EDGetTokenT< edm::View< pat::Electron > > electrons_
const StringCutObjectSelector< pat::Electron > electronSel_
const edm::EDGetTokenT< edm::View< pat::Muon > > muons_
virtual void objectSelection(const edm::View< pat::Jet > &jets, const edm::View< pat::Muon > &muons, const edm::View< pat::Electron > &eles, const edm::View< pat::Tau > &taus, const edm::View< pat::Photon > &photons, std::vector< uint8_t > &jetBits, std::vector< uint8_t > &muonBits, std::vector< uint8_t > &eleBits, std::vector< uint8_t > &tauBits, std::vector< uint8_t > &photonBits)
def move(src, dest)
Definition: eostools.py:511
const StringCutObjectSelector< pat::Electron > lowPtElectronSel_

Member Data Documentation

◆ doc_

const std::string NanoAODBaseCrossCleaner::doc_
private

Definition at line 77 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

◆ electronName_

const std::string NanoAODBaseCrossCleaner::electronName_
private

Definition at line 94 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

◆ electrons_

const edm::EDGetTokenT<edm::View<pat::Electron> > NanoAODBaseCrossCleaner::electrons_
private

Definition at line 81 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

◆ electronSel_

const StringCutObjectSelector<pat::Electron> NanoAODBaseCrossCleaner::electronSel_
private

Definition at line 88 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

◆ jetName_

const std::string NanoAODBaseCrossCleaner::jetName_
private

Definition at line 92 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

◆ jets_

const edm::EDGetTokenT<edm::View<pat::Jet> > NanoAODBaseCrossCleaner::jets_
private

Definition at line 79 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

◆ jetSel_

const StringCutObjectSelector<pat::Jet> NanoAODBaseCrossCleaner::jetSel_
private

Definition at line 86 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

◆ lowPtElectronName_

const std::string NanoAODBaseCrossCleaner::lowPtElectronName_
private

Definition at line 95 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

◆ lowPtElectrons_

edm::EDGetTokenT<edm::View<pat::Electron> > NanoAODBaseCrossCleaner::lowPtElectrons_
private

Definition at line 83 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

◆ lowPtElectronSel_

const StringCutObjectSelector<pat::Electron> NanoAODBaseCrossCleaner::lowPtElectronSel_
private

Definition at line 89 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

◆ lowPtElectronsTag_

edm::InputTag NanoAODBaseCrossCleaner::lowPtElectronsTag_
private

Definition at line 82 of file NanoAODBaseCrossCleaner.h.

◆ muonName_

const std::string NanoAODBaseCrossCleaner::muonName_
private

Definition at line 93 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

◆ muons_

const edm::EDGetTokenT<edm::View<pat::Muon> > NanoAODBaseCrossCleaner::muons_
private

Definition at line 80 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

◆ muonSel_

const StringCutObjectSelector<pat::Muon> NanoAODBaseCrossCleaner::muonSel_
private

Definition at line 87 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

◆ name_

const std::string NanoAODBaseCrossCleaner::name_
private

Definition at line 68 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

◆ photonName_

const std::string NanoAODBaseCrossCleaner::photonName_
private

Definition at line 97 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

◆ photons_

const edm::EDGetTokenT<edm::View<pat::Photon> > NanoAODBaseCrossCleaner::photons_
private

Definition at line 85 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

◆ photonSel_

const StringCutObjectSelector<pat::Photon> NanoAODBaseCrossCleaner::photonSel_
private

Definition at line 91 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

◆ tauName_

const std::string NanoAODBaseCrossCleaner::tauName_
private

Definition at line 96 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

◆ taus_

const edm::EDGetTokenT<edm::View<pat::Tau> > NanoAODBaseCrossCleaner::taus_
private

Definition at line 84 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

◆ tauSel_

const StringCutObjectSelector<pat::Tau> NanoAODBaseCrossCleaner::tauSel_
private

Definition at line 90 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().