CMS 3D CMS Logo

Public Member Functions | Private Attributes

MCLongLivedParticles Class Reference

#include <MCLongLivedParticles.h>

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

List of all members.

Public Member Functions

virtual bool filter (edm::Event &, const edm::EventSetup &)
 MCLongLivedParticles (const edm::ParameterSet &)
 ~MCLongLivedParticles ()

Private Attributes

float theCut

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

{
   //here do whatever other initialization is needed
  theCut = iConfig.getUntrackedParameter<double>("LengCut",10.);
}
MCLongLivedParticles::~MCLongLivedParticles ( )

Definition at line 18 of file MCLongLivedParticles.cc.

{
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)

}

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::getByType(), L1TEmulatorMonitor_cff::p, position, and mathSSE::sqrt().

{

  using namespace edm;
  
  Handle<HepMCProduct> evt;
  
  iEvent.getByType(evt);
  
  bool pass = false;
  
  const HepMC::GenEvent * generated_event = evt->GetEvent();
  HepMC::GenEvent::particle_const_iterator p;
  
  for (p = generated_event->particles_begin(); p != generated_event->particles_end(); p++)
    { 

      if((*p)->production_vertex()!=0&&(*p)->end_vertex()!=0)
        {
          float dist = sqrt((((*p)->production_vertex())->position().x()-((*p)->end_vertex())->position().x())*(((*p)->production_vertex())->position().x()-((*p)->end_vertex())->position().x())+
                            (((*p)->production_vertex())->position().y()-((*p)->end_vertex())->position().y())*(((*p)->production_vertex())->position().y()-((*p)->end_vertex())->position().y()));
          if(dist>theCut)
            pass=true;
        }
      
      if((*p)->production_vertex()==0&&!(*p)->end_vertex()!=0)
        {
          if(((*p)->end_vertex())->position().perp()>theCut)
            pass=true;
        }
      
      if(pass)
        return pass;
    }
  
  return pass;
}

Member Data Documentation

Definition at line 50 of file MCLongLivedParticles.h.