rivet is hosted by Hepforge, IPPP Durham
UnstableFinalState.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Projections/UnstableFinalState.hh"
00003 
00004 #define IS_PARTON_PDGID(id) ( abs(id) <= 100 && abs(id) != 22 && (abs(id) < 11 || abs(id) > 18) )
00005 
00006 namespace Rivet {
00007 
00008 
00009   void UnstableFinalState::project(const Event& e) {
00010     _theParticles.clear();
00011 
00012     vector<PdgId> vetoIds;
00013     vetoIds += 22; // status 2 photons don't count!
00014     vetoIds += 110; vetoIds += 990; vetoIds += 9990; // Reggeons
00015     //vetoIds += 9902210; // something weird from PYTHIA6
00016     foreach (GenParticle* p, Rivet::particles(e.genEvent())) {
00017       const int st = p->status();
00018       bool passed =
00019         (st == 1 || (st == 2 && find(vetoIds.begin(), vetoIds.end(), abs(p->pdg_id())) == vetoIds.end())) &&
00020         !IS_PARTON_PDGID(p->pdg_id()) && //< Always veto partons?
00021         !isZero(p->momentum().perp()) && 
00022     _cuts->accept(p->momentum());
00023 
00024       // Avoid double counting by re-marking as unpassed if particle ID == parent ID
00025       const GenVertex* pv = p->production_vertex();
00026       const GenVertex* dv = p->end_vertex();
00027       if (passed && pv) {
00028         for (GenVertex::particles_in_const_iterator pp = pv->particles_in_const_begin() ;
00029              pp != pv->particles_in_const_end() ; ++pp) {
00030           if ( p->pdg_id() == (*pp)->pdg_id() && (*pp)->status() == 2 ) {
00031             passed = false;
00032             break;
00033           }
00034         }
00035       }
00036 
00037       // Add to output particles collection
00038       if (passed) {
00039         _theParticles.push_back(Particle(*p));
00040       }
00041 
00042       // Log parents and children
00043       if (getLog().isActive(Log::TRACE)) {
00044         MSG_TRACE("ID = " << p->pdg_id()
00045                   << ", status = " << st
00046                   << ", pT = " << p->momentum().perp()
00047                   << ", eta = " << p->momentum().eta()
00048                   << ": result = " << std::boolalpha << passed);
00049         if (pv) {
00050           for (GenVertex::particles_in_const_iterator pp = pv->particles_in_const_begin() ;
00051                pp != pv->particles_in_const_end() ; ++pp) {
00052             MSG_TRACE("  parent ID = " << (*pp)->pdg_id());
00053           }
00054         }
00055         if (dv) {
00056           for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin() ;
00057                pp != dv->particles_out_const_end() ; ++pp) {
00058             MSG_TRACE("  child ID  = " << (*pp)->pdg_id());
00059           }
00060         }
00061       }
00062     }
00063     MSG_DEBUG("Number of unstable final-state particles = " << _theParticles.size());
00064   }
00065 
00066 
00067 }