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     // @todo We should really implement the FinalState algorithm here instead
00013     double etamin, etamax;
00014     if ( _etaRanges.empty() ) {
00015       etamin = -MAXDOUBLE;
00016       etamax = MAXDOUBLE;
00017     } else {
00018       // With our current constructor choice, we can only ever have one entry
00019       assert( _etaRanges.size() == 1 );
00020       etamin = _etaRanges[0].first;
00021       etamax = _etaRanges[0].second;
00022     }
00023 
00024     vector<PdgId> vetoIds;
00025     vetoIds += 22; // status 2 photons don't count!
00026     vetoIds += 110; vetoIds += 990; vetoIds += 9990; // Reggeons
00027     //vetoIds += 9902210; // something weird from PYTHIA6
00028     foreach (GenParticle* p, Rivet::particles(e.genEvent())) {
00029       const int st = p->status();
00030       bool passed =
00031         (st == 1 || (st == 2 && find(vetoIds.begin(), vetoIds.end(), abs(p->pdg_id())) == vetoIds.end())) &&
00032         !IS_PARTON_PDGID(p->pdg_id()) && //< Always veto partons?
00033         !isZero(p->momentum().perp()) && p->momentum().perp() >= _ptmin &&
00034         inRange(p->momentum().eta(), etamin, etamax);
00035 
00036       // Avoid double counting by re-marking as unpassed if particle ID == parent ID
00037       const GenVertex* pv = p->production_vertex();
00038       const GenVertex* dv = p->end_vertex();
00039       if (passed && pv) {
00040         for (GenVertex::particles_in_const_iterator pp = pv->particles_in_const_begin() ;
00041              pp != pv->particles_in_const_end() ; ++pp) {
00042           if ( p->pdg_id() == (*pp)->pdg_id() && (*pp)->status() == 2 ) {
00043             passed = false;
00044             break;
00045           }
00046         }
00047       }
00048 
00049       // Add to output particles collection
00050       if (passed) {
00051         _theParticles.push_back(Particle(*p));
00052       }
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() ;
00063                pp != pv->particles_in_const_end() ; ++pp) {
00064             MSG_TRACE("  parent ID = " << (*pp)->pdg_id());
00065           }
00066         }
00067         if (dv) {
00068           for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin() ;
00069                pp != dv->particles_out_const_end() ; ++pp) {
00070             MSG_TRACE("  child ID  = " << (*pp)->pdg_id());
00071           }
00072         }
00073       }
00074     }
00075     MSG_DEBUG("Number of unstable final-state particles = " << _theParticles.size());
00076   }
00077 
00078 
00079 }