CMS 3D CMS Logo

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

#include <RemovePileUpDominatedEventsGen/RemovePileUpDominatedEventsGen/plugins/RemovePileUpDominatedEventsGen.cc>

Inheritance diagram for RemovePileUpDominatedEventsGen:
edm::stream::EDFilter<> edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 RemovePileUpDominatedEventsGen (const edm::ParameterSet &)
 
 ~RemovePileUpDominatedEventsGen () override
 
- Public Member Functions inherited from edm::stream::EDFilter<>
 EDFilter ()=default
 
 EDFilter (const EDFilter &)=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 EDFilteroperator= (const EDFilter &)=delete
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
 EDFilterBase (const EDFilterBase &)=delete
 
ModuleDescription const & moduleDescription () const
 
const EDFilterBaseoperator= (const EDFilterBase &)=delete
 
 ~EDFilterBase () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

bool filter (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

unsigned int bunchCrossing
 
const edm::EDGetTokenT< GenEventInfoProductgeneratorInfo_
 
const edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupSummaryInfos_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDFilter<>
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
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: [one line class summary]

This EDFilter select events having the generator pt-hat greater than the pt-had of the pile-up collisions. This code is used by STEAM-TSG in order to estimate the HLT rate using MC sample, especially to avoid a rate double counting due to pile-up. For more information on the theory of this method see Appendix B of https://www.dropbox.com/home/TesiPhD_Silvio?preview=PhD_thesis.pdf .

Implementation: [Notes on implementation]

Definition at line 34 of file RemovePileUpDominatedEventsGen.cc.

Constructor & Destructor Documentation

◆ RemovePileUpDominatedEventsGen()

RemovePileUpDominatedEventsGen::RemovePileUpDominatedEventsGen ( const edm::ParameterSet iConfig)
explicit

Definition at line 48 of file RemovePileUpDominatedEventsGen.cc.

References bunchCrossing.

50  consumes<std::vector<PileupSummaryInfo> >(iConfig.getParameter<edm::InputTag>("pileupSummaryInfos"))),
51  generatorInfo_(consumes<GenEventInfoProduct>(iConfig.getParameter<edm::InputTag>("generatorInfo"))) {
52  bunchCrossing = 0;
53  produces<float>();
54 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupSummaryInfos_
const edm::EDGetTokenT< GenEventInfoProduct > generatorInfo_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)

◆ ~RemovePileUpDominatedEventsGen()

RemovePileUpDominatedEventsGen::~RemovePileUpDominatedEventsGen ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 110 of file RemovePileUpDominatedEventsGen.cc.

References edm::ConfigurationDescriptions::addDefault(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

110  {
112  desc.add<edm::InputTag>("pileupSummaryInfos", edm::InputTag("addPileupInfo"));
113  desc.add<edm::InputTag>("generatorInfo", edm::InputTag("generator"));
114  descriptions.addDefault(desc);
115 }
void addDefault(ParameterSetDescription const &psetDescription)

◆ filter()

bool RemovePileUpDominatedEventsGen::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::stream::EDFilterBase.

Definition at line 58 of file RemovePileUpDominatedEventsGen.cc.

References bunchCrossing, newFWLiteAna::found, generatorInfo_, PileupSummaryInfo::getPU_pT_hats(), iEvent, eostools::move(), pileupSummaryInfos_, edm::Handle< T >::product(), and GenEventInfoProduct::qScale().

58  {
59  using namespace edm;
60  using namespace std;
61 
63  iEvent.getByToken(generatorInfo_, generatorInfo);
64 
65  edm::Handle<std::vector<PileupSummaryInfo> > pileupSummaryInfos;
66  iEvent.getByToken(pileupSummaryInfos_, pileupSummaryInfos);
67 
68  //find in-time pile-up
69  if (bunchCrossing >= pileupSummaryInfos.product()->size() ||
70  pileupSummaryInfos.product()->at(bunchCrossing).getBunchCrossing() != 0) {
71  bool found = false;
72  for (bunchCrossing = 0; bunchCrossing < pileupSummaryInfos.product()->size() && !found; ++bunchCrossing) {
73  if (pileupSummaryInfos.product()->at(bunchCrossing).getBunchCrossing() == 0) {
74  found = true;
75  bunchCrossing--;
76  }
77  }
78  if (!found) {
79  edm::LogInfo("RemovePileUpDominatedEventsGen") << "In-time pile-up not found!" << endl;
80  return true;
81  }
82  }
83 
84  // cout << "Using "<<bunchCrossing<<endl;
85  // cout << "pileupSummaryInfos.product()->at(bunchCrossing).getBunchCrossing() "<<pileupSummaryInfos.product()->at(bunchCrossing).getBunchCrossing()<<endl;
86 
87  //get the PU pt-hat max
88  float signal_pT_hat = -1;
89  float pu_pT_hat_max = -1;
90 
91  PileupSummaryInfo puSummary_onTime = pileupSummaryInfos.product()->at(bunchCrossing);
92  for (const auto& pu_pT_hat : puSummary_onTime.getPU_pT_hats())
93  if (pu_pT_hat > pu_pT_hat_max)
94  pu_pT_hat_max = pu_pT_hat;
95 
96  //get the signal pt-hat
97  signal_pT_hat = generatorInfo->qScale();
98 
99  //save PU - signal pt-hat
100  std::unique_ptr<float> pOut(new float());
101  *pOut = signal_pT_hat - pu_pT_hat_max;
102  iEvent.put(std::move(pOut));
103 
104  //filter the event
105  if (signal_pT_hat > pu_pT_hat_max)
106  return true;
107  return false;
108 }
const std::vector< float > & getPU_pT_hats() const
const edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupSummaryInfos_
T const * product() const
Definition: Handle.h:70
const edm::EDGetTokenT< GenEventInfoProduct > generatorInfo_
int iEvent
Definition: GenABIO.cc:224
Log< level::Info, false > LogInfo
HLT enums.
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ bunchCrossing

unsigned int RemovePileUpDominatedEventsGen::bunchCrossing
private

Definition at line 45 of file RemovePileUpDominatedEventsGen.cc.

Referenced by filter(), and RemovePileUpDominatedEventsGen().

◆ generatorInfo_

const edm::EDGetTokenT<GenEventInfoProduct> RemovePileUpDominatedEventsGen::generatorInfo_
private

Definition at line 44 of file RemovePileUpDominatedEventsGen.cc.

Referenced by filter().

◆ pileupSummaryInfos_

const edm::EDGetTokenT<std::vector<PileupSummaryInfo> > RemovePileUpDominatedEventsGen::pileupSummaryInfos_
private

Definition at line 43 of file RemovePileUpDominatedEventsGen.cc.

Referenced by filter().