CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
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<>
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::EDFilterBase
typedef EDFilterAdaptorBase 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::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

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.

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 }

References bunchCrossing.

◆ ~RemovePileUpDominatedEventsGen()

RemovePileUpDominatedEventsGen::~RemovePileUpDominatedEventsGen ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 110 of file RemovePileUpDominatedEventsGen.cc.

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

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addDefault(), and HLT_2018_cff::InputTag.

◆ filter()

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

Implements edm::stream::EDFilterBase.

Definition at line 58 of file RemovePileUpDominatedEventsGen.cc.

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 }

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

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().

RemovePileUpDominatedEventsGen::bunchCrossing
unsigned int bunchCrossing
Definition: RemovePileUpDominatedEventsGen.cc:45
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
edm::Handle::product
T const * product() const
Definition: Handle.h:70
GenEventInfoProduct::qScale
double qScale() const
Definition: GenEventInfoProduct.h:41
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::LogInfo
Definition: MessageLogger.h:254
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
RemovePileUpDominatedEventsGen::generatorInfo_
const edm::EDGetTokenT< GenEventInfoProduct > generatorInfo_
Definition: RemovePileUpDominatedEventsGen.cc:44
PileupSummaryInfo::getPU_pT_hats
const std::vector< float > & getPU_pT_hats() const
Definition: PileupSummaryInfo.h:72
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::Handle
Definition: AssociativeIterator.h:50
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
iEvent
int iEvent
Definition: GenABIO.cc:224
RemovePileUpDominatedEventsGen::pileupSummaryInfos_
const edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupSummaryInfos_
Definition: RemovePileUpDominatedEventsGen.cc:43
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:126
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
edm::InputTag
Definition: InputTag.h:15
PileupSummaryInfo
Definition: PileupSummaryInfo.h:22