CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual bool filter (edm::Event &, const edm::EventSetup &)
 
 MCLongLivedParticles (const edm::ParameterSet &)
 
 ~MCLongLivedParticles ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
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 &)
 
- 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

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.getParameter<edm::InputTag>("hepMCProductTag")) {
13  //here do whatever other initialization is needed
14  theCut = iConfig.getUntrackedParameter<double>("LengCut",10.);
15 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag hepMCProductTag_
MCLongLivedParticles::~MCLongLivedParticles ( )

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 
)
virtual

Implements edm::EDFilter.

Definition at line 28 of file MCLongLivedParticles.cc.

References edm::Event::getByLabel(), 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()!=0&&(*p)->end_vertex()!=0)
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()==0&&!(*p)->end_vertex()!=0)
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:418
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().