HepMC_helper::SelectJetTag Class Reference

#include <SelectJetTag.h>

Inheritance diagram for HepMC_helper::SelectJetTag:

Inheritance graph
[legend]
Collaboration diagram for HepMC_helper::SelectJetTag:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SelectJetTag (int id, double pt, double eta)
 ~SelectJetTag ()
IMCselectorcreate () const
bool operator() (const Particle *const p) const
bool operator() (const Particle &p) const
bool operator() (const Particle &p)

Private Member Functions

bool isBBaryon (const int pID) const
bool isBMeson (const int pID) const
bool isDBaryon (const int pID) const
bool isDMeson (const int pID) const
std::string longToStr (const long n) const

Private Attributes

int m_id
double m_ptMin
double m_etaMax

Detailed Description

Definition at line 16 of file SelectJetTag.h.


Constructor & Destructor Documentation

HepMC_helper::SelectJetTag::SelectJetTag ( int  id,
double  pt,
double  eta 
)

Definition at line 227 of file HepMC_helper.cxx.

00227                                                          :
00228     m_id(abs(id)), m_ptMin(pt), m_etaMax(eta) { }
  bool SelectJetTag::operator() ( const Particle* const p ) const{

HepMC_helper::SelectJetTag::~SelectJetTag (  )  [inline]

Definition at line 21 of file SelectJetTag.h.

00021 {};


Member Function Documentation

IMCselector * HepMC_helper::SelectJetTag::create (  )  const [virtual]

Implements HepMC_helper::IMCselector.

Definition at line 273 of file HepMC_helper.cxx.

00273 {return new SelectJetTag(*this);}

bool HepMC_helper::SelectJetTag::operator() ( const Particle *const   p  )  const [virtual]

Implements HepMC_helper::IMCselector.

Definition at line 229 of file HepMC_helper.cxx.

00229                                                                {
00230     // check on kinematics
00231     if( abs(p->pdg_id())                    !=     m_id) return false ; 
00232     if( p->momentum().perp()                 <  m_ptMin) return false ; 
00233     if((abs(p->momentum().pseudoRapidity())) > m_etaMax) return false ; 
00234 
00235     // No documentary quark
00236     if (p->status() == 3)                                return false ;
00237     // No quark from B/D decays (Herwig)
00238     bool fromHadron        = false;
00239     HepMC::GenVertex *pvtx = p->production_vertex();
00240     if (pvtx) {
00241       HepMC::GenVertex::particle_iterator firstParent = pvtx->particles_begin(HepMC::ancestors);
00242       HepMC::GenVertex::particle_iterator endParent   = pvtx->particles_end(HepMC::ancestors);
00243       HepMC::GenVertex::particle_iterator thisParent  = firstParent;
00244       for(; thisParent != endParent; ++thisParent){
00245        int pdgAnces = (*thisParent)->pdg_id();
00246        if (isBBaryon(pdgAnces) || isBMeson(pdgAnces) || // B --> b,c
00247            isDBaryon(pdgAnces) || isDMeson(pdgAnces) )  // D --> c
00248          fromHadron = true;
00249        if (fromHadron) break;
00250       }
00251     }
00252     if (fromHadron) return false;
00253 
00254     if(p->end_vertex()){
00255       
00256       HepMC::GenVertex::particle_iterator firstChild = 
00257         p->end_vertex()->particles_begin(HepMC::children);
00258       
00259       HepMC::GenVertex::particle_iterator endChild = 
00260         p->end_vertex()->particles_end(HepMC::children);
00261       
00262       HepMC::GenVertex::particle_iterator thisChild = firstChild; 
00263       
00264       //Should be vetoing this tag if it has a child of the same pdg id
00265       // following kludge due to fact that parents are included in
00266       // the list of children!
00267       for(; thisChild!=endChild; ++thisChild){
00268         if(abs((*thisChild)->pdg_id()) == m_id) return false;
00269       }
00270     }
00271     return true ;       
00272   }

bool HepMC_helper::SelectJetTag::operator() ( const Particle p  )  const

Definition at line 274 of file HepMC_helper.cxx.

00274                                                           {
00275     return this->operator()(&p);
00276   } 

bool HepMC_helper::SelectJetTag::isBBaryon ( const int  pID  )  const [private]

Definition at line 279 of file HepMC_helper.cxx.

00279                                                   {
00280     // PdgID of B-baryon is of form ...xxx5xxx
00281     std::string idStr = longToStr( abs(pID) );
00282     char digit4 = idStr[ idStr.length() - 4 ];
00283     if( (digit4=='5') ) 
00284       return true;
00285     else 
00286       return false;
00287   }

bool HepMC_helper::SelectJetTag::isBMeson ( const int  pID  )  const [private]

Definition at line 289 of file HepMC_helper.cxx.

00289                                                  {
00290     // PdgID of B-meson is of form ...xxx05xx
00291     std::string idStr = longToStr( abs(pID) );
00292     char digit3 = idStr[ idStr.length() - 3 ];
00293     char digit4;
00294     if( idStr.length() < 4 ) { digit4 = '0'; }
00295     else { digit4 = idStr[ idStr.length() - 4 ]; };
00296     if( (digit4=='0') && (digit3=='5') ) 
00297       return true;
00298     else 
00299       return false;
00300   }

bool HepMC_helper::SelectJetTag::isDBaryon ( const int  pID  )  const [private]

Definition at line 301 of file HepMC_helper.cxx.

00301                                                     {
00302       // PdgID of D-baryon is of form ...xxx4xxx
00303       std::string idStr = longToStr( abs(pID) );
00304       char digit4 = idStr[ idStr.length() - 4 ];
00305       if( (digit4=='4') ) 
00306         return true;
00307       else 
00308         return false;
00309     }

bool HepMC_helper::SelectJetTag::isDMeson ( const int  pID  )  const [private]

Definition at line 311 of file HepMC_helper.cxx.

00311                                                    {
00312       // PdgID of D-meson is of form ...xxx04xx
00313       std::string idStr = longToStr( abs(pID) );
00314       char digit3 = idStr[ idStr.length() - 3 ];
00315       char digit4;
00316       if( idStr.length() < 4 ) { digit4 = '0'; }
00317       else { digit4 = idStr[ idStr.length() - 4 ]; };
00318       if( (digit4=='0') && (digit3=='4') ) 
00319         return true;
00320       else 
00321         return false;
00322     }

std::string HepMC_helper::SelectJetTag::longToStr ( const long  n  )  const [private]

Definition at line 324 of file HepMC_helper.cxx.

00324                                                           {
00325       if (0==n) return "0"; 
00326       std::string str = "";
00327       for ( long m = n; m!=0; m/=10 )
00328         str = char( '0' + abs(m%10) ) + str;
00329       if ( n<0 )
00330         str = "-" + str;
00331       return str;
00332     }

bool HepMC_helper::IMCselector::operator() ( const Particle p  )  [inline, inherited]

Definition at line 27 of file IMCselector.h.

00027 {return this->operator()(&p);} 


Member Data Documentation

int HepMC_helper::SelectJetTag::m_id [private]

Definition at line 32 of file SelectJetTag.h.

double HepMC_helper::SelectJetTag::m_ptMin [private]

Definition at line 33 of file SelectJetTag.h.

double HepMC_helper::SelectJetTag::m_etaMax [private]

Definition at line 34 of file SelectJetTag.h.


The documentation for this class was generated from the following files:
Generated on Fri Sep 21 13:20:59 2007 for AtlfastUtils by  doxygen 1.5.1