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
 
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
 
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)
 
 ~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
 
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
 
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
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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]

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 ( const edm::ParameterSet iConfig)
explicit

Definition at line 48 of file RemovePileUpDominatedEventsGen.cc.

References bunchCrossing, and ~RemovePileUpDominatedEventsGen().

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
const edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupSummaryInfos_
const edm::EDGetTokenT< GenEventInfoProduct > generatorInfo_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
RemovePileUpDominatedEventsGen::~RemovePileUpDominatedEventsGen ( )
overridedefault

Member Function Documentation

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

Definition at line 110 of file RemovePileUpDominatedEventsGen.cc.

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addDefault(), DEFINE_FWK_MODULE, and HLT_2018_cff::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)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool RemovePileUpDominatedEventsGen::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 58 of file RemovePileUpDominatedEventsGen.cc.

References bunchCrossing, newFWLiteAna::found, generatorInfo_, edm::Event::getByToken(), PileupSummaryInfo::getPU_pT_hats(), eostools::move(), pileupSummaryInfos_, edm::Handle< T >::product(), edm::Event::put(), 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 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
const edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupSummaryInfos_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
const edm::EDGetTokenT< GenEventInfoProduct > generatorInfo_
double qScale() const
const std::vector< float > & getPU_pT_hats() const
T const * product() const
Definition: Handle.h:69
HLT enums.
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

unsigned int RemovePileUpDominatedEventsGen::bunchCrossing
private

Definition at line 45 of file RemovePileUpDominatedEventsGen.cc.

Referenced by filter(), and RemovePileUpDominatedEventsGen().

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

Definition at line 44 of file RemovePileUpDominatedEventsGen.cc.

Referenced by filter().

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

Definition at line 43 of file RemovePileUpDominatedEventsGen.cc.

Referenced by filter().