![]() |
![]() |
#include <GeneratorInterface/GenFilters/interface/MCLongLivedParticles.h>
Public Member Functions | |
virtual bool | filter (Event &, const EventSetup &) |
MCLongLivedParticles (const edm::ParameterSet &) | |
~MCLongLivedParticles () | |
Private Attributes | |
float | theCut |
Definition at line 43 of file MCLongLivedParticles.h.
MCLongLivedParticles::MCLongLivedParticles | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 11 of file MCLongLivedParticles.cc.
References edm::ParameterSet::getUntrackedParameter(), and theCut.
00012 { 00013 //here do whatever other initialization is needed 00014 theCut = iConfig.getUntrackedParameter<double>("LengCut",10.); 00015 }
MCLongLivedParticles::~MCLongLivedParticles | ( | ) |
Definition at line 18 of file MCLongLivedParticles.cc.
00019 { 00020 00021 // do anything here that needs to be done at desctruction time 00022 // (e.g. close files, deallocate resources etc.) 00023 00024 }
bool MCLongLivedParticles::filter | ( | edm::Event & | iEvent, | |
const EventSetup & | iSetup | |||
) | [virtual] |
Implements edm::EDFilter.
Definition at line 28 of file MCLongLivedParticles.cc.
References dist(), edm::Event::getByType(), p, funct::sqrt(), and theCut.
00029 { 00030 00031 using namespace edm; 00032 00033 Handle<HepMCProduct> evt; 00034 00035 iEvent.getByType(evt); 00036 00037 bool pass = false; 00038 00039 HepMC::GenEvent * generated_event = new HepMC::GenEvent(*(evt->GetEvent())); 00040 HepMC::GenEvent::particle_iterator p; 00041 00042 for (p = generated_event->particles_begin(); p != generated_event->particles_end(); p++) 00043 { 00044 00045 if((*p)->production_vertex()!=0&&(*p)->end_vertex()!=0) 00046 { 00047 float dist = sqrt((((*p)->production_vertex())->position().x()-((*p)->end_vertex())->position().x())*(((*p)->production_vertex())->position().x()-((*p)->end_vertex())->position().x())+ 00048 (((*p)->production_vertex())->position().y()-((*p)->end_vertex())->position().y())*(((*p)->production_vertex())->position().y()-((*p)->end_vertex())->position().y())); 00049 if(dist>theCut) 00050 pass=true; 00051 } 00052 00053 if((*p)->production_vertex()==0&&!(*p)->end_vertex()!=0) 00054 { 00055 if(((*p)->end_vertex())->position().perp()>theCut) 00056 pass=true; 00057 } 00058 00059 if(pass) 00060 return pass; 00061 } 00062 00063 return pass; 00064 }
float MCLongLivedParticles::theCut [private] |
Definition at line 53 of file MCLongLivedParticles.h.
Referenced by filter(), and MCLongLivedParticles().