CMS 3D CMS Logo

edm::SubEvent Class Reference

#include <SimDataFormats/HiGenData/interface/SubEvent.h>

List of all members.

Public Member Functions

HepMC::GenParticle * getBoson (const HepMC::GenEvent &evt)
HepMC::GenParticle * getParticle (const HepMC::GenEvent &evt, int index) const
std::vector< HepMC::GenParticle * > getParticles (const HepMC::GenEvent &evt) const
HepMC::GenParticle * getParton1 (const HepMC::GenEvent &evt)
HepMC::GenParticle * getParton2 (const HepMC::GenEvent &evt)
HepMC::GenVertex * getVertex (const HepMC::GenEvent &evt) const
 SubEvent (int id=-1)
virtual ~SubEvent ()

Private Attributes

int sub_id


Detailed Description

Definition at line 15 of file SubEvent.h.


Constructor & Destructor Documentation

edm::SubEvent::SubEvent ( int  id = -1  )  [inline]

Definition at line 17 of file SubEvent.h.

00017 : sub_id(id) {} 

virtual edm::SubEvent::~SubEvent (  )  [inline, virtual]

Definition at line 18 of file SubEvent.h.

00018 {}


Member Function Documentation

HepMC::GenParticle * SubEvent::getBoson ( const HepMC::GenEvent &  evt  ) 

Definition at line 53 of file SubEvent.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and getParticle().

00053                                                                            {
00054    HepMC::GenParticle* boson = getParticle(evt,3);
00055       if(boson) return boson;
00056       else{
00057          std::cout<<"error loading boson, particle with index 1 doesn't exist!"<<std::endl;
00058          return 0;
00059       }
00060 }

HepMC::GenParticle * SubEvent::getParticle ( const HepMC::GenEvent &  evt,
int  index 
) const

Definition at line 6 of file SubEvent.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and getParticles().

Referenced by getBoson(), getParton1(), and getParton2().

00006                                                                                  {
00007 
00008   //to be fixed
00009    
00010    std::vector<HepMC::GenParticle*> parts = getParticles(evt);
00011    HepMC::GenParticle* particle = parts[index];
00012    if(particle) return particle;
00013    else{
00014       std::cout<<"error loading particle, particle with index "<<index<<" doesn't exist!"<<std::endl;
00015       return 0;
00016    }
00017 }

std::vector< HepMC::GenParticle * > SubEvent::getParticles ( const HepMC::GenEvent &  evt  )  const

Definition at line 19 of file SubEvent.cc.

References end, getVertex(), and p.

Referenced by getParticle(), and edm::GenHIEvent::getParticles().

00019                                                                                   {
00020       std::vector<HepMC::GenParticle*> cands;
00021 
00022    HepMC::GenVertex* vertex = getVertex(evt);
00023    HepMC::GenVertex::particle_iterator p;
00024    HepMC::GenVertex::particle_iterator start = vertex->particles_begin( HepMC::relatives ); //
00025    HepMC::GenVertex::particle_iterator end = vertex->particles_end( HepMC::relatives ); //
00026    for ( p = start; p != end; ++p ) {
00027       cands.push_back(*p);
00028    }
00029         
00030       return cands;
00031 
00032 }

HepMC::GenParticle * SubEvent::getParton1 ( const HepMC::GenEvent &  evt  ) 

Definition at line 61 of file SubEvent.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and getParticle().

00061                                                                                 {
00062       HepMC::GenParticle* parton = getParticle(evt,1);
00063       if(parton) return parton;
00064       else{
00065          std::cout<<"error loading parton, particle with index 2 doesn't exist!"<<std::endl;
00066          return 0;
00067       }
00068 }

HepMC::GenParticle * SubEvent::getParton2 ( const HepMC::GenEvent &  evt  ) 

Definition at line 69 of file SubEvent.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and getParticle().

00069                                                                                  {
00070       HepMC::GenParticle* parton = getParticle(evt,2);
00071       if(parton) return parton;
00072       else{
00073          std::cout<<"error loading parton, particle with index 3 doesn't exist!"<<std::endl;
00074          return 0;
00075       }
00076 }

HepMC::GenVertex * SubEvent::getVertex ( const HepMC::GenEvent &  evt  )  const

Definition at line 34 of file SubEvent.cc.

References GenMuonPlsPt100GeV_cfg::cout, dummy, end, lat::endl(), sub_id, and v.

Referenced by getParticles(), and edm::GenHIEvent::getVertex().

00034                                                                            {
00035    
00036    HepMC::GenVertex* vertex;
00037    HepMC::GenEvent::vertex_const_iterator v;
00038    HepMC::GenEvent::vertex_const_iterator start = evt.vertices_begin();
00039    HepMC::GenEvent::vertex_const_iterator end = evt.vertices_end();
00040    for ( v = start; v != end; ++v ){
00041       HepMC::GenVertex* dummy = *v;
00042       if(dummy->id() == sub_id){
00043          vertex = *v; 
00044          break;
00045       }
00046    }
00047    if(!vertex){
00048       std::cout<<"Error - Vertex with id : "<<sub_id<<" could not be found!"<<std::endl;
00049    }
00050    return vertex;
00051 }


Member Data Documentation

int edm::SubEvent::sub_id [private]

Definition at line 27 of file SubEvent.h.

Referenced by getVertex().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:44:24 2009 for CMSSW by  doxygen 1.5.4