00001 // -*- C++ -*- 00002 #include "Rivet/Projection.hh" 00003 #include "Rivet/Tools/Logging.hh" 00004 #include "Rivet/Event.hh" 00005 #include "Rivet/Cmp.hh" 00006 00007 namespace Rivet { 00008 00009 00010 Projection::Projection() 00011 : _name("BaseProjection") 00012 { 00013 addBeamPair(ANY, ANY); 00014 getLog() << Log::TRACE << "Creating " << name() << " at " << this << endl; 00015 } 00016 00017 00018 Projection:: ~Projection() { 00019 getLog() << Log::TRACE << "Destroying " << name() << " at " << this << endl; 00020 } 00021 00022 00023 // int Projection::compare(const Projection& p) const { 00024 // return mkNamedPCmp(p, "FS"); 00025 // } 00026 00027 00028 bool Projection::before(const Projection& p) const { 00029 const std::type_info& thisid = typeid(*this); 00030 const std::type_info& otherid = typeid(p); 00031 if (thisid == otherid) { 00032 return compare(p) < 0; 00033 } else { 00034 return thisid.before(otherid); 00035 } 00036 } 00037 00038 00039 const set<BeamPair> Projection::beamPairs() const { 00040 set<BeamPair> ret = _beamPairs; 00041 set<ConstProjectionPtr> projs = getProjections(); 00042 for (set<ConstProjectionPtr>::const_iterator ip = projs.begin(); ip != projs.end(); ++ip) { 00043 ConstProjectionPtr p = *ip; 00044 getLog() << Log::TRACE << "Proj addr = " << p << endl; 00045 if (p) ret = intersection(ret, p->beamPairs()); 00046 } 00047 return ret; 00048 } 00049 00050 00051 Cmp<Projection> Projection::mkNamedPCmp(const Projection& otherparent, 00052 const string& pname) const { 00053 return pcmp(*this, otherparent, pname); 00054 } 00055 00056 00057 Cmp<Projection> Projection::mkPCmp(const Projection& otherparent, 00058 const string& pname) const { 00059 return pcmp(*this, otherparent, pname); 00060 } 00061 00062 00063 }