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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper NanoAODSimpleCrossCleaner

Public Member Functions

 NanoAODBaseCrossCleaner (const edm::ParameterSet &)
 
 ~NanoAODBaseCrossCleaner () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (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 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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 49 of file NanoAODBaseCrossCleaner.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file NanoAODBaseCrossCleaner.cc.

25  :
26  name_(params.getParameter<std::string>("name") ),
27  doc_(params.getParameter<std::string>("doc") ),
33  jetSel_(params.getParameter<std::string>("jetSel") ),
34  muonSel_(params.getParameter<std::string>("muonSel") ),
35  electronSel_(params.getParameter<std::string>("electronSel") ),
36  tauSel_(params.getParameter<std::string>("tauSel") ),
37  photonSel_(params.getParameter<std::string>("photonSel") ),
38  jetName_(params.getParameter<std::string>("jetName") ),
39  muonName_(params.getParameter<std::string>("muonName") ),
40  electronName_(params.getParameter<std::string>("electronName") ),
41  tauName_(params.getParameter<std::string>("tauName") ),
42  photonName_(params.getParameter<std::string>("photonName") )
43 
44 {
45  produces<nanoaod::FlatTable>("jets");
46  produces<nanoaod::FlatTable>("muons");
47  produces<nanoaod::FlatTable>("electrons");
48  produces<nanoaod::FlatTable>("taus");
49  produces<nanoaod::FlatTable>("photons");
50 
51 }
T getParameter(std::string const &) const
const edm::EDGetTokenT< edm::View< pat::Photon > > photons_
const edm::EDGetTokenT< edm::View< pat::Jet > > jets_
const StringCutObjectSelector< pat::Jet > jetSel_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const StringCutObjectSelector< pat::Muon > muonSel_
const edm::EDGetTokenT< edm::View< pat::Tau > > taus_
const StringCutObjectSelector< pat::Photon > photonSel_
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_
NanoAODBaseCrossCleaner::~NanoAODBaseCrossCleaner ( )
override

Definition at line 54 of file NanoAODBaseCrossCleaner.cc.

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

Member Function Documentation

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

Reimplemented from edm::stream::EDProducerBase.

Definition at line 124 of file NanoAODBaseCrossCleaner.cc.

125 {
126 }
void NanoAODBaseCrossCleaner::endStream ( )
overrideprivatevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 130 of file NanoAODBaseCrossCleaner.cc.

130  {
131 }
void NanoAODBaseCrossCleaner::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 135 of file NanoAODBaseCrossCleaner.cc.

References edm::ConfigurationDescriptions::addDefault(), DEFINE_FWK_MODULE, and edm::ParameterSetDescription::setUnknown().

135  {
136  //The following says we do not know what parameters are allowed so do no validation
137  // Please change this to state exactly what you do use, even if it is no parameters
139  desc.setUnknown();
140  descriptions.addDefault(desc);
141 }
void addDefault(ParameterSetDescription const &psetDescription)
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 60 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

63  {};
void NanoAODBaseCrossCleaner::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 71 of file NanoAODBaseCrossCleaner.cc.

References doc_, MillePedeFileConverter_cfg::e, electronName_, electrons_, electronSel_, edm::Event::getByToken(), jetName_, fwrapper::jets, jets_, jetSel_, funct::m, eostools::move(), muonName_, extraflags_cff::muons, muons_, muonSel_, name_, objectSelection(), AlCaHLTBitMon_ParallelJobs::p, photonName_, nano_cff::photons, photons_, photonSel_, edm::Event::put(), lumiQTWidget::t, tauName_, nano_cff::taus, taus_, tauSel_, and nanoaod::FlatTable::UInt8Column.

72 {
73  using namespace edm;
75  iEvent.getByToken(jets_, jetsIn);
76  std::vector<uint8_t> jets;
77  for (const auto & j: *jetsIn) {jets.push_back(jetSel_(j));}
78  auto jetsTable = std::make_unique<nanoaod::FlatTable>(jetsIn->size(),jetName_,false,true);
79 
81  iEvent.getByToken(muons_, muonsIn);
82  std::vector<uint8_t> muons;
83  for (const auto & m: *muonsIn) {muons.push_back(muonSel_(m));}
84  auto muonsTable = std::make_unique<nanoaod::FlatTable>(muonsIn->size(),muonName_,false,true);
85 
86 
88  iEvent.getByToken(electrons_, electronsIn);
89  std::vector<uint8_t> eles;
90  for (const auto & e: *electronsIn) {eles.push_back(electronSel_(e));}
91  auto electronsTable = std::make_unique<nanoaod::FlatTable>(electronsIn->size(),electronName_,false,true);
92 
94  iEvent.getByToken(taus_, tausIn);
95  std::vector<uint8_t> taus;
96  for (const auto & t: *tausIn) {taus.push_back(tauSel_(t));}
97  auto tausTable = std::make_unique<nanoaod::FlatTable>(tausIn->size(),tauName_,false,true);
98 
100  iEvent.getByToken(photons_, photonsIn);
101  std::vector<uint8_t> photons;
102  for (const auto & p: *photonsIn) {photons.push_back(photonSel_(p));}
103  auto photonsTable = std::make_unique<nanoaod::FlatTable>(photonsIn->size(),photonName_,false,true);
104 
105 
106  objectSelection(*jetsIn,*muonsIn,*electronsIn,*tausIn,*photonsIn,jets,muons,eles,taus,photons);
107 
108  muonsTable->addColumn<uint8_t>(name_,muons,doc_,nanoaod::FlatTable::UInt8Column);
109  jetsTable->addColumn<uint8_t>(name_,jets,doc_,nanoaod::FlatTable::UInt8Column);
110  electronsTable->addColumn<uint8_t>(name_,eles,doc_,nanoaod::FlatTable::UInt8Column);
111  tausTable->addColumn<uint8_t>(name_,taus,doc_,nanoaod::FlatTable::UInt8Column);
112  photonsTable->addColumn<uint8_t>(name_,photons,doc_,nanoaod::FlatTable::UInt8Column);
113 
114  iEvent.put(std::move(jetsTable),"jets");
115  iEvent.put(std::move(muonsTable),"muons");
116  iEvent.put(std::move(electronsTable),"electrons");
117  iEvent.put(std::move(tausTable),"taus");
118  iEvent.put(std::move(photonsTable),"photons");
119 
120 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
const edm::EDGetTokenT< edm::View< pat::Photon > > photons_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
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_
vector< PseudoJet > jets
const StringCutObjectSelector< pat::Photon > photonSel_
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:510

Member Data Documentation

const std::string NanoAODBaseCrossCleaner::doc_
private

Definition at line 72 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

const std::string NanoAODBaseCrossCleaner::electronName_
private

Definition at line 86 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

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

Definition at line 76 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

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

Definition at line 81 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

const std::string NanoAODBaseCrossCleaner::jetName_
private

Definition at line 84 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

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

Definition at line 74 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

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

Definition at line 79 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

const std::string NanoAODBaseCrossCleaner::muonName_
private

Definition at line 85 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

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

Definition at line 75 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

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

Definition at line 80 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

const std::string NanoAODBaseCrossCleaner::name_
private

Definition at line 63 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

const std::string NanoAODBaseCrossCleaner::photonName_
private

Definition at line 88 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

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

Definition at line 78 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

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

Definition at line 83 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

const std::string NanoAODBaseCrossCleaner::tauName_
private

Definition at line 87 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

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

Definition at line 77 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().

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

Definition at line 82 of file NanoAODBaseCrossCleaner.h.

Referenced by produce().