CMS 3D CMS Logo

Public Member Functions | Private Attributes

MCLongLivedParticles Class Reference

#include <MCLongLivedParticles.h>

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

List of all members.

Public Member Functions

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

Private Attributes

edm::InputTag hepMCProductTag_
float theCut

Detailed Description

Definition at line 41 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.

                                                                         :
  hepMCProductTag_(iConfig.getParameter<edm::InputTag>("hepMCProductTag")) {
   //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::getByLabel(), hepMCProductTag_, AlCaHLTBitMon_ParallelJobs::p, position, mathSSE::sqrt(), and theCut.

{

  using namespace edm;
  
  Handle<HepMCProduct> evt;
  
  iEvent.getByLabel(hepMCProductTag_, 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 52 of file MCLongLivedParticles.h.

Referenced by filter().

Definition at line 51 of file MCLongLivedParticles.h.

Referenced by filter(), and MCLongLivedParticles().