CMS 3D CMS Logo

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

#include <MCLongLivedParticles.h>

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

Public Member Functions

bool filter (edm::Event &, const edm::EventSetup &) override
 
 MCLongLivedParticles (const edm::ParameterSet &)
 
 ~MCLongLivedParticles () override
 
- 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
 
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)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::InputTag hepMCProductTag_
 
float theCut
 

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 ESProduct , Transition Tr = Transition::Event>
auto esConsumes (eventsetup::EventSetupRecordKey const &, 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 40 of file MCLongLivedParticles.h.

Constructor & Destructor Documentation

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

Definition at line 11 of file MCLongLivedParticles.cc.

References edm::ParameterSet::getUntrackedParameter(), and theCut.

11  :
12  hepMCProductTag_(iConfig.getUntrackedParameter<edm::InputTag>("hepMCProductTag",edm::InputTag("generator","unsmeared"))) {
13  //here do whatever other initialization is needed
14  theCut = iConfig.getUntrackedParameter<double>("LengCut",10.);
15 }
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag hepMCProductTag_
MCLongLivedParticles::~MCLongLivedParticles ( )
override

Definition at line 18 of file MCLongLivedParticles.cc.

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

Member Function Documentation

bool MCLongLivedParticles::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 28 of file MCLongLivedParticles.cc.

References edm::Event::getByLabel(), edm::HepMCProduct::GetEvent(), hepMCProductTag_, AlCaHLTBitMon_ParallelJobs::p, position, mathSSE::sqrt(), and theCut.

29 {
30 
31  using namespace edm;
32 
34 
35  iEvent.getByLabel(hepMCProductTag_, evt);
36 
37  bool pass = false;
38 
39  const HepMC::GenEvent * generated_event = evt->GetEvent();
40  HepMC::GenEvent::particle_const_iterator p;
41 
42  for (p = generated_event->particles_begin(); p != generated_event->particles_end(); p++)
43  {
44 
45  if(((*p)->production_vertex() != nullptr) && ((*p)->end_vertex()!=nullptr))
46  {
47  float dist = sqrt((((*p)->production_vertex())->position().x()-((*p)->end_vertex())->position().x())*(((*p)->production_vertex())->position().x()-((*p)->end_vertex())->position().x())+
48  (((*p)->production_vertex())->position().y()-((*p)->end_vertex())->position().y())*(((*p)->production_vertex())->position().y()-((*p)->end_vertex())->position().y()));
49  if(dist>theCut)
50  pass=true;
51  }
52 
53  if(((*p)->production_vertex()==nullptr) && (!((*p)->end_vertex()!=nullptr)))
54  {
55  if(((*p)->end_vertex())->position().perp()>theCut)
56  pass=true;
57  }
58 
59  if(pass)
60  return pass;
61  }
62 
63  return pass;
64 }
edm::InputTag hepMCProductTag_
T sqrt(T t)
Definition: SSEVec.h:18
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:535
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:38
HLT enums.
static int position[264][3]
Definition: ReadPGInfo.cc:509

Member Data Documentation

edm::InputTag MCLongLivedParticles::hepMCProductTag_
private

Definition at line 51 of file MCLongLivedParticles.h.

Referenced by filter().

float MCLongLivedParticles::theCut
private

Definition at line 50 of file MCLongLivedParticles.h.

Referenced by filter(), and MCLongLivedParticles().