CMS 3D CMS Logo

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

#include <LHEVpTFilter.h>

Inheritance diagram for LHEVpTFilter:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 LHEVpTFilter (const edm::ParameterSet &)
 
 ~LHEVpTFilter ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () 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)
 

Private Member Functions

virtual void endJob ()
 
virtual bool filter (edm::Event &, const edm::EventSetup &)
 

Private Attributes

std::vector< ROOT::Math::PxPyPzEVector > lepCands
 
std::vector< lhef::HEPEUP::FiveVectorlheParticles
 
int passedEvents_
 
edm::EDGetTokenT< LHEEventProductsrc_
 
int totalEvents_
 
double vptMax_
 
double vptMin_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter 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
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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

Definition at line 38 of file LHEVpTFilter.h.

Constructor & Destructor Documentation

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

Definition at line 6 of file LHEVpTFilter.cc.

References edm::ParameterSet::getParameter(), and src_.

6  :
7 vptMin_(iConfig.getParameter<double>("VpTMin")),
8 vptMax_(iConfig.getParameter<double>("VpTMax")),
10 {
11  //here do whatever other initialization is needed
12  src_ = consumes<LHEEventProduct>(iConfig.getParameter<edm::InputTag>("src"));
13 
14 }
T getParameter(std::string const &) const
double vptMin_
Definition: LHEVpTFilter.h:53
double vptMax_
Definition: LHEVpTFilter.h:54
edm::EDGetTokenT< LHEEventProduct > src_
Definition: LHEVpTFilter.h:49
LHEVpTFilter::~LHEVpTFilter ( )

Definition at line 16 of file LHEVpTFilter.cc.

17 {
18 
19  // do anything here that needs to be done at destruction time
20  // (e.g. close files, deallocate resources etc.)
21 
22 }

Member Function Documentation

void LHEVpTFilter::endJob ( void  )
privatevirtual

Reimplemented from edm::EDFilter.

Definition at line 59 of file LHEVpTFilter.cc.

References DEFINE_FWK_MODULE, passedEvents_, and totalEvents_.

59  {
60  edm::LogInfo("LHEVpTFilter") << "=== Results of LHEVpTFilter: passed "
61  << passedEvents_ << "/" << totalEvents_ << " events" << std::endl;
62 }
bool LHEVpTFilter::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Definition at line 26 of file LHEVpTFilter.cc.

References funct::abs(), edm::Event::getByToken(), LHEEventProduct::hepeup(), mps_fire::i, lhef::HEPEUP::IDUP, lhef::HEPEUP::ISTUP, lepCands, lheParticles, passedEvents_, EnergyCorrector::pt, lhef::HEPEUP::PUP, src_, totalEvents_, and vptMin_.

27 {
28  lepCands.clear();
30  iEvent.getByToken( src_ , EvtHandle ) ;
31 
32  totalEvents_++;
33 
34  lheParticles = EvtHandle->hepeup().PUP;
35 
36  for (unsigned int i = 0; i < lheParticles.size(); ++i) {
37  if (EvtHandle->hepeup().ISTUP[i] != 1) { // keep only outgoing particles
38  continue;
39  }
40  unsigned absPdgId = std::abs(EvtHandle->hepeup().IDUP[i]);
41  if(absPdgId >=11 && absPdgId<=16){
42  lepCands.push_back(ROOT::Math::PxPyPzEVector(lheParticles[i][0],lheParticles[i][1],lheParticles[i][2],lheParticles[i][3]));
43  }
44  }
45  double vpt_ = -1;
46  if (lepCands.size()==2){
47  vpt_ = (lepCands[0]+lepCands[1]).pt();
48  }
49  if ( vpt_ <= vptMax_ && vpt_ > vptMin_) {
50  passedEvents_++;
51  return true;
52  } else {
53  return false;
54  }
55 
56 }
double vptMin_
Definition: LHEVpTFilter.h:53
const lhef::HEPEUP & hepeup() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::vector< FiveVector > PUP
Definition: LesHouches.h:261
std::vector< ROOT::Math::PxPyPzEVector > lepCands
Definition: LHEVpTFilter.h:51
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< int > ISTUP
Definition: LesHouches.h:243
std::vector< int > IDUP
Definition: LesHouches.h:238
std::vector< lhef::HEPEUP::FiveVector > lheParticles
Definition: LHEVpTFilter.h:50
edm::EDGetTokenT< LHEEventProduct > src_
Definition: LHEVpTFilter.h:49

Member Data Documentation

std::vector<ROOT::Math::PxPyPzEVector> LHEVpTFilter::lepCands
private

Definition at line 51 of file LHEVpTFilter.h.

Referenced by filter().

std::vector<lhef::HEPEUP::FiveVector> LHEVpTFilter::lheParticles
private

Definition at line 50 of file LHEVpTFilter.h.

Referenced by filter().

int LHEVpTFilter::passedEvents_
private

Definition at line 56 of file LHEVpTFilter.h.

Referenced by endJob(), and filter().

edm::EDGetTokenT<LHEEventProduct> LHEVpTFilter::src_
private

Definition at line 49 of file LHEVpTFilter.h.

Referenced by filter(), and LHEVpTFilter().

int LHEVpTFilter::totalEvents_
private

Definition at line 55 of file LHEVpTFilter.h.

Referenced by endJob(), and filter().

double LHEVpTFilter::vptMax_
private

Definition at line 54 of file LHEVpTFilter.h.

double LHEVpTFilter::vptMin_
private

Definition at line 53 of file LHEVpTFilter.h.

Referenced by filter().