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 /// @todo Replace with PID::isParton()
00005 #define IS_PARTON_PDGID(id) ( abs(id) <= 100 && abs(id) != 22 && (abs(id) < 11 || abs(id) > 18) )
00006 
00007 namespace Rivet {
00008 
00009 
00010   /// @todo Add a FIRST/LAST/ANY enum to specify the mode for uniquifying replica chains (default = LAST)
00011 
00012 
00013   void UnstableFinalState::project(const Event& e) {
00014     _theParticles.clear();
00015 
00016     /// @todo Replace PID veto list with PID:: functions?
00017     vector<PdgId> vetoIds;
00018     vetoIds += 22; // status 2 photons don't count!
00019     vetoIds += 110; vetoIds += 990; vetoIds += 9990; // Reggeons
00020     //vetoIds += 9902210; // something weird from PYTHIA6
00021     foreach (const GenParticle* p, Rivet::particles(e.genEvent())) {
00022       const int st = p->status();
00023       bool passed =
00024         (st == 1 || (st == 2 && !contains(vetoIds, abs(p->pdg_id())))) &&
00025         !IS_PARTON_PDGID(p->pdg_id()) && ///< Always veto partons
00026         !p->is_beam() && // Filter beam particles
00027         _cuts->accept(p->momentum());
00028 
00029       // Avoid double counting by re-marking as unpassed if ID == (any) parent ID
00030       const GenVertex* pv = p->production_vertex();
00031       // if (passed && pv) {
00032       //   for (GenVertex::particles_in_const_iterator pp = pv->particles_in_const_begin(); pp != pv->particles_in_const_end(); ++pp) {
00033       //     if (p->pdg_id() == (*pp)->pdg_id() && (*pp)->status() == 2) {
00034       //       passed = false;
00035       //       break;
00036       //     }
00037       //   }
00038       // }
00039       //
00040       // Avoid double counting by re-marking as unpassed if ID == any child ID
00041       const GenVertex* dv = p->end_vertex();
00042       if (passed && dv) {
00043         foreach (GenParticle* pp, particles_out(dv)) {
00044           if (p->pdg_id() == pp->pdg_id() && pp->status() == 2) {
00045             passed = false;
00046             break;
00047           }
00048         }
00049       }
00050 
00051       // Add to output particles collection
00052       if (passed) _theParticles.push_back(Particle(*p));
00053 
00054       // Log parents and children
00055       if (getLog().isActive(Log::TRACE)) {
00056         MSG_TRACE("ID = " << p->pdg_id()
00057                   << ", status = " << st
00058                   << ", pT = " << p->momentum().perp()
00059                   << ", eta = " << p->momentum().eta()
00060                   << ": result = " << std::boolalpha << passed);
00061         if (pv) {
00062           for (GenVertex::particles_in_const_iterator pp = pv->particles_in_const_begin(); pp != pv->particles_in_const_end(); ++pp) {
00063             MSG_TRACE("  parent ID = " << (*pp)->pdg_id());
00064           }
00065         }
00066         if (dv) {
00067           for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin(); pp != dv->particles_out_const_end(); ++pp) {
00068             MSG_TRACE("  child ID  = " << (*pp)->pdg_id());
00069           }
00070         }
00071       }
00072     }
00073     MSG_DEBUG("Number of unstable final-state particles = " << _theParticles.size());
00074   }
00075 
00076 
00077 }