FinalState.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Projections/FinalState.hh" 00003 00004 namespace Rivet { 00005 00006 00007 // @deprecated, keep for backwards compatibility for now. 00008 FinalState::FinalState(double mineta, double maxeta, double minpt) 00009 { 00010 using namespace Cuts; 00011 setName("FinalState"); 00012 const bool openpt = isZero(minpt); 00013 const bool openeta = (mineta <= -MAXDOUBLE && maxeta >= MAXDOUBLE); 00014 MSG_TRACE("Check for open FS conditions:" << std::boolalpha 00015 << " eta=" << openeta 00016 << ", pt=" << openpt); 00017 if ( openpt && openeta ) { 00018 _cuts = open(); 00019 } 00020 else { 00021 addProjection(FinalState(), "OpenFS"); 00022 if ( openeta ) 00023 _cuts = pT >= minpt; 00024 else if ( openpt ) 00025 _cuts = etaIn(mineta,maxeta); 00026 else 00027 _cuts = etaIn(mineta,maxeta) & (pT >= minpt); 00028 } 00029 } 00030 00031 00032 FinalState::FinalState(Cut c) 00033 : ParticleFinder(c) 00034 { 00035 setName("FinalState"); 00036 const bool open = ( c == Cuts::open() ); 00037 MSG_TRACE("Check for open FS conditions: " << std::boolalpha << open); 00038 if ( !open ) { 00039 addProjection(FinalState(), "OpenFS"); 00040 } 00041 } 00042 00043 00044 00045 00046 /// @todo HOW DO WE COMPARE CUTS OBJECTS? 00047 int FinalState::compare(const Projection& p) const { 00048 const FinalState& other = dynamic_cast<const FinalState&>(p); 00049 00050 //MSG_TRACE("FS::compare: " << 1 << " " << this << " " << &p); 00051 // std::vector<std::pair<double, double> > eta1(_etaRanges); 00052 //std::vector<std::pair<double, double> > eta2(other._etaRanges); 00053 //std::sort(eta1.begin(), eta1.end()); 00054 //std::sort(eta2.begin(), eta2.end()); 00055 00056 //MSG_TRACE("FS::compare: " << 2 << " " << this << " " << &p); 00057 //if (eta1 < eta2) return ORDERED; 00058 //else if (eta2 < eta1) return UNORDERED; 00059 00060 //MSG_TRACE("FS::compare: " << 3 << " " << this << " " << &p); 00061 //return cmp(_ptmin, other._ptmin); 00062 return _cuts == other._cuts ? EQUIVALENT : UNDEFINED; 00063 } 00064 00065 00066 00067 void FinalState::project(const Event& e) { 00068 _theParticles.clear(); 00069 00070 // Handle "open FS" special case 00071 if ( _cuts == Cuts::open() ) { 00072 //MSG_TRACE("Open FS processing: should only see this once per event (" 00073 // << e.genEvent().event_number() << ")"); 00074 foreach (const GenParticle* p, Rivet::particles(e.genEvent())) { 00075 if (p->status() == 1) { 00076 //MSG_TRACE("FS GV = " << p->production_vertex()); 00077 _theParticles.push_back(Particle(*p)); 00078 } 00079 } 00080 return; 00081 } 00082 00083 // If this is not itself the "open" FS, base the calculations on the open FS' results 00084 /// @todo In general, we'd like to calculate a restrictive FS based on the most restricted superset FS. 00085 const Particles allstable = applyProjection<FinalState>(e, "OpenFS").particles(); 00086 foreach (const Particle& p, allstable) { 00087 const bool passed = accept(p); 00088 MSG_TRACE("Choosing: ID = " << p.pdgId() 00089 << ", pT = " << p.pT() 00090 << ", eta = " << p.eta() 00091 << ": result = " << std::boolalpha << passed); 00092 if (passed) _theParticles.push_back(p); 00093 } 00094 //MSG_DEBUG("Number of final-state particles = " << _theParticles.size()); 00095 } 00096 00097 00098 /// Decide if a particle is to be accepted or not. 00099 bool FinalState::accept(const Particle& p) const { 00100 // Not having s.c. == 1 should never happen! 00101 assert(p.genParticle() == NULL || p.genParticle()->status() == 1); 00102 00103 return _cuts->accept(p); 00104 } 00105 00106 00107 } Generated on Tue Sep 30 2014 19:45:44 for The Rivet MC analysis system by ![]() |