FinalState.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Projections/FinalState.hh" 00003 00004 namespace Rivet { 00005 00006 00007 FinalState::FinalState(const Cut & c) 00008 : ParticleFinder(c) 00009 { 00010 setName("FinalState"); 00011 const bool open = (c == Cuts::open()); 00012 MSG_TRACE("Check for open FS conditions: " << std::boolalpha << open); 00013 if (!open) addProjection(FinalState(), "OpenFS"); 00014 } 00015 00016 00017 /// @deprecated, keep for backwards compatibility for now. 00018 FinalState::FinalState(double mineta, double maxeta, double minpt) { 00019 setName("FinalState"); 00020 const bool openpt = isZero(minpt); 00021 const bool openeta = (mineta <= -MAXDOUBLE && maxeta >= MAXDOUBLE); 00022 MSG_TRACE("Check for open FS conditions:" << std::boolalpha << " eta=" << openeta << ", pt=" << openpt); 00023 if (openpt && openeta) { 00024 _cuts = Cuts::open(); 00025 } 00026 else { 00027 addProjection(FinalState(), "OpenFS"); 00028 if (openeta) 00029 _cuts = (Cuts::pT >= minpt); 00030 else if ( openpt ) 00031 _cuts = Cuts::etaIn(mineta, maxeta); 00032 else 00033 _cuts = (Cuts::etaIn(mineta, maxeta) && Cuts::pT >= minpt); 00034 } 00035 } 00036 00037 00038 int FinalState::compare(const Projection& p) const { 00039 const FinalState& other = dynamic_cast<const FinalState&>(p); 00040 return _cuts == other._cuts ? EQUIVALENT : UNDEFINED; 00041 } 00042 00043 00044 void FinalState::project(const Event& e) { 00045 _theParticles.clear(); 00046 00047 // Handle "open FS" special case 00048 if (_cuts == Cuts::OPEN) { 00049 MSG_TRACE("Open FS processing: should only see this once per event (" << e.genEvent()->event_number() << ")"); 00050 for (const GenParticle* p : Rivet::particles(e.genEvent())) { 00051 if (p->status() == 1) { 00052 MSG_TRACE("FS GV = " << p->production_vertex()); 00053 _theParticles.push_back(Particle(*p)); 00054 } 00055 } 00056 return; 00057 } 00058 00059 // If this is not itself the "open" FS, base the calculations on the open FS' results 00060 /// @todo In general, we'd like to calculate a restrictive FS based on the most restricted superset FS. 00061 const Particles allstable = applyProjection<FinalState>(e, "OpenFS").particles(); 00062 for (const Particle& p : allstable) { 00063 const bool passed = accept(p); 00064 MSG_TRACE("Choosing: ID = " << p.pid() 00065 << ", pT = " << p.pT()/GeV << " GeV" 00066 << ", eta = " << p.eta() 00067 << ": result = " << std::boolalpha << passed); 00068 if (passed) _theParticles.push_back(p); 00069 } 00070 MSG_TRACE("Number of final-state particles = " << _theParticles.size()); 00071 } 00072 00073 00074 /// Decide if a particle is to be accepted or not. 00075 bool FinalState::accept(const Particle& p) const { 00076 // Not having status == 1 should never happen! 00077 assert(p.genParticle() == NULL || p.genParticle()->status() == 1); 00078 return _cuts->accept(p); 00079 } 00080 00081 00082 } Generated on Tue Dec 13 2016 16:32:37 for The Rivet MC analysis system by ![]() |