|
[Rivet-svn] r2842 - in trunk: include/Rivet include/Rivet/Projections src/Projectionsblackhole at projects.hepforge.org blackhole at projects.hepforge.orgThu Dec 9 19:09:35 GMT 2010
Author: buckley Date: Thu Dec 9 19:09:35 2010 New Revision: 2842 Log: Code clean-ups and doc comments Modified: trunk/include/Rivet/Jet.hh trunk/include/Rivet/Projections/UnstableFinalState.hh trunk/src/Projections/UnstableFinalState.cc Modified: trunk/include/Rivet/Jet.hh ============================================================================== --- trunk/include/Rivet/Jet.hh Wed Dec 8 23:06:54 2010 (r2841) +++ trunk/include/Rivet/Jet.hh Thu Dec 9 19:09:35 2010 (r2842) @@ -55,12 +55,12 @@ vector<Particle>& particles() { return _fullParticles; } - + /// Get the Rivet::Particles (full information) in this jet (const version) const vector<Particle>& particles() const { return _fullParticles; } - + /// Number of particles (tracks) in this jet. size_t size() const { return _particles.size(); @@ -74,7 +74,7 @@ /// Add a particle/track to this jet. Jet& addParticle(const Particle& particle); - + /// Check whether this jet contains a particular particle. bool containsParticle(const Particle& particle) const; @@ -84,10 +84,10 @@ /// Check whether this jet contains at least one of certain particle types. bool containsParticleId(const vector<PdgId>& pids) const; - /// Check whether this jet contains a charm-flavoured hadron. + /// Check whether this jet contains a charm-flavoured hadron (or decay products from one). bool containsCharm() const; - /// Check whether this jet contains a bottom-flavoured hadron. + /// Check whether this jet contains a bottom-flavoured hadron (or decay products from one). bool containsBottom() const; /// Reset this jet as empty. @@ -109,7 +109,7 @@ /// Get equivalent single momentum four-vector. (caches) const FourMomentum& momentum() const; - + // /// Get equivalent single momentum four-vector. (caches) // FourMomentum& momentum(); @@ -122,7 +122,7 @@ /// Get the energy carried in this jet by neutral particles. double neutralEnergy() const; - + /// Get the energy carried in this jet by hadrons. double hadronicEnergy() const; @@ -165,7 +165,7 @@ /// Cached effective jet 4-vector mutable FourMomentum _momentum; mutable bool _okMomentum; - + }; Modified: trunk/include/Rivet/Projections/UnstableFinalState.hh ============================================================================== --- trunk/include/Rivet/Projections/UnstableFinalState.hh Wed Dec 8 23:06:54 2010 (r2841) +++ trunk/include/Rivet/Projections/UnstableFinalState.hh Thu Dec 9 19:09:35 2010 (r2842) @@ -40,6 +40,7 @@ /// Is this final state empty? virtual bool empty() const { return _theParticles.empty(); } + /// @deprecated Is this final state empty? virtual bool isEmpty() const { return _theParticles.empty(); } Modified: trunk/src/Projections/UnstableFinalState.cc ============================================================================== --- trunk/src/Projections/UnstableFinalState.cc Wed Dec 8 23:06:54 2010 (r2841) +++ trunk/src/Projections/UnstableFinalState.cc Thu Dec 9 19:09:35 2010 (r2842) @@ -18,7 +18,6 @@ void UnstableFinalState::project(const Event& e) { - Log& log = getLog(); _theParticles.clear(); for (GenEvent::particle_const_iterator p = e.genEvent().particles_begin(); @@ -28,46 +27,43 @@ const double eta = (*p)->momentum().eta(); const GenVertex* pv = (*p)->production_vertex(); const GenVertex* dv = (*p)->end_vertex(); - bool passed = ( st == 1 || (st == 2 && abs((*p)->pdg_id()) != 22) ) && - !isZero(pT) && - pT >= _ptmin && - eta > _etamin && - eta < _etamax && - !IS_PARTON_PDGID((*p)->pdg_id()); - if (passed) { - if (pv!=NULL) { - for (GenVertex::particles_in_const_iterator pp = pv->particles_in_const_begin() ; - pp != pv->particles_in_const_end() ; ++pp) { - // Avoid double counting if particle == parent - if ( (*p)->pdg_id() == (*pp)->pdg_id() ) - passed = false; - } + bool passed = \ + ( st == 1 || (st == 2 && abs((*p)->pdg_id()) != 22) ) && + !isZero(pT) && + pT >= _ptmin && + eta > _etamin && + eta < _etamax && + !IS_PARTON_PDGID((*p)->pdg_id()); + // Avoid double counting by re-marking as unpassed if particle == parent + if (passed && pv) { + for (GenVertex::particles_in_const_iterator pp = pv->particles_in_const_begin() ; + pp != pv->particles_in_const_end() ; ++pp) { + if ( (*p)->pdg_id() == (*pp)->pdg_id() ) + passed = false; } } - - if (log.isActive(Log::TRACE)) { - log << Log::TRACE << std::boolalpha - << "ID = " << (*p)->pdg_id() << ", status = " << st << ", pT = " << pT - << ", eta = " << eta << ": result = " << passed << endl; - if (pv!=NULL) { + if (passed) { + _theParticles.push_back(Particle(**p)); + } + if (getLog().isActive(Log::TRACE)) { + MSG_TRACE("ID = " << (*p)->pdg_id() << ", status = " << st << ", pT = " << pT + << ", eta = " << eta << ": result = " << std::boolalpha << passed); + if (pv) { for (GenVertex::particles_in_const_iterator pp = pv->particles_in_const_begin() ; - pp != pv->particles_in_const_end() ; ++pp) { - log << Log::TRACE << std::boolalpha - << " parent ID = " << (*pp)->pdg_id() << endl; + pp != pv->particles_in_const_end() ; ++pp) { + MSG_TRACE(" parent ID = " << (*pp)->pdg_id()); } } - if (dv!=NULL) { + if (dv) { for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin() ; - pp != dv->particles_out_const_end() ; ++pp) { - log << Log::TRACE << std::boolalpha - << " child ID = " << (*pp)->pdg_id() << endl; + pp != dv->particles_out_const_end() ; ++pp) { + MSG_TRACE(" child ID = " << (*pp)->pdg_id()); } } } - if (passed) _theParticles.push_back(Particle(**p)); } - log << Log::DEBUG << "Number of final-state particles = " - << _theParticles.size() << endl; + MSG_DEBUG("Number of final-state particles = " << _theParticles.size()); } + }
More information about the Rivet-svn mailing list |