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 { 00020 using namespace Cuts; 00021 setName("FinalState"); 00022 const bool openpt = isZero(minpt); 00023 const bool openeta = (mineta <= -MAXDOUBLE && maxeta >= MAXDOUBLE); 00024 MSG_TRACE("Check for open FS conditions:" << std::boolalpha << " eta=" << openeta << ", pt=" << openpt); 00025 if ( openpt && openeta ) { 00026 _cuts = open(); 00027 } 00028 else { 00029 addProjection(FinalState(), "OpenFS"); 00030 if ( openeta ) 00031 _cuts = pT >= minpt; 00032 else if ( openpt ) 00033 _cuts = etaIn(mineta,maxeta); 00034 else 00035 _cuts = etaIn(mineta,maxeta) & (pT >= minpt); 00036 } 00037 } 00038 00039 00040 int FinalState::compare(const Projection& p) const { 00041 const FinalState& other = dynamic_cast<const FinalState&>(p); 00042 return _cuts == other._cuts ? EQUIVALENT : UNDEFINED; 00043 } 00044 00045 00046 void FinalState::project(const Event& e) { 00047 _theParticles.clear(); 00048 00049 // Handle "open FS" special case 00050 if ( _cuts == Cuts::open() ) { 00051 MSG_TRACE("Open FS processing: should only see this once per event (" << e.genEvent()->event_number() << ")"); 00052 foreach (const GenParticle* p, Rivet::particles(e.genEvent())) { 00053 if (p->status() == 1) { 00054 MSG_TRACE("FS GV = " << p->production_vertex()); 00055 _theParticles.push_back(Particle(*p)); 00056 } 00057 } 00058 return; 00059 } 00060 00061 // If this is not itself the "open" FS, base the calculations on the open FS' results 00062 /// @todo In general, we'd like to calculate a restrictive FS based on the most restricted superset FS. 00063 const Particles allstable = applyProjection<FinalState>(e, "OpenFS").particles(); 00064 foreach (const Particle& p, allstable) { 00065 const bool passed = accept(p); 00066 MSG_TRACE("Choosing: ID = " << p.pdgId() 00067 << ", pT = " << p.pT() 00068 << ", eta = " << p.eta() 00069 << ": result = " << std::boolalpha << passed); 00070 if (passed) _theParticles.push_back(p); 00071 } 00072 MSG_TRACE("Number of final-state particles = " << _theParticles.size()); 00073 } 00074 00075 00076 /// Decide if a particle is to be accepted or not. 00077 bool FinalState::accept(const Particle& p) const { 00078 // Not having status == 1 should never happen! 00079 assert(p.genParticle() == NULL || p.genParticle()->status() == 1); 00080 return _cuts->accept(p); 00081 } 00082 00083 00084 } Generated on Thu Mar 10 2016 08:29:50 for The Rivet MC analysis system by ![]() |