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
 
- 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)
 
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::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::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]

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

48  :
49 pileupSummaryInfos_( consumes<std::vector<PileupSummaryInfo> >(iConfig.getParameter<edm::InputTag>("pileupSummaryInfos")) ),
50 generatorInfo_( consumes<GenEventInfoProduct>(iConfig.getParameter<edm::InputTag>("generatorInfo")) )
51 {
53 produces<float>();
54 }
T getParameter(std::string const &) const
const edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupSummaryInfos_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< GenEventInfoProduct > generatorInfo_
RemovePileUpDominatedEventsGen::~RemovePileUpDominatedEventsGen ( )
overridedefault

Member Function Documentation

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

Definition at line 109 of file RemovePileUpDominatedEventsGen.cc.

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

109  {
111  desc.add<edm::InputTag> ("pileupSummaryInfos",edm::InputTag("addPileupInfo"));
112  desc.add<edm::InputTag> ("generatorInfo",edm::InputTag("generator"));
113  descriptions.addDefault(desc);
114 }
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, runEdmFileComparison::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() || pileupSummaryInfos.product()->at(bunchCrossing).getBunchCrossing()!=0)
70  {
71  bool found=false;
72  for(bunchCrossing=0; bunchCrossing<pileupSummaryInfos.product()->size() && !found; ++bunchCrossing)
73  {
74  if( pileupSummaryInfos.product()->at(bunchCrossing).getBunchCrossing() == 0 ){
75  found=true;
76  bunchCrossing--;
77  }
78  }
79  if(!found){
80  edm::LogInfo("RemovePileUpDominatedEventsGen") << "In-time pile-up not found!" << endl;
81  return true;
82  }
83  }
84 
85 // cout << "Using "<<bunchCrossing<<endl;
86 // cout << "pileupSummaryInfos.product()->at(bunchCrossing).getBunchCrossing() "<<pileupSummaryInfos.product()->at(bunchCrossing).getBunchCrossing()<<endl;
87 
88  //get the PU pt-hat max
89  float signal_pT_hat = -1;
90  float pu_pT_hat_max = -1;
91 
92  PileupSummaryInfo puSummary_onTime = pileupSummaryInfos.product()->at(bunchCrossing);
93  for(const auto& pu_pT_hat : puSummary_onTime.getPU_pT_hats()) if (pu_pT_hat>pu_pT_hat_max) pu_pT_hat_max = pu_pT_hat;
94 
95  //get the signal pt-hat
96  signal_pT_hat = generatorInfo->qScale();
97 
98  //save PU - signal pt-hat
99  std::unique_ptr<float> pOut(new float());
100  *pOut=signal_pT_hat-pu_pT_hat_max;
101  iEvent.put(std::move(pOut));
102 
103  //filter the event
104  if (signal_pT_hat>pu_pT_hat_max) return true;
105  return false;
106 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
const edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupSummaryInfos_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
const edm::EDGetTokenT< GenEventInfoProduct > generatorInfo_
double qScale() const
const std::vector< float > & getPU_pT_hats() const
T const * product() const
Definition: Handle.h:81
HLT enums.
def move(src, dest)
Definition: eostools.py:510

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