00001
00002
00003 #include "Rivet/Tools/Logging.hh"
00004 #include "Rivet/Projections/Multiplicity.hh"
00005 #include "Rivet/Cmp.hh"
00006 #include "HepPDT/ParticleID.hh"
00007
00008
00009 namespace Rivet {
00010
00011 int Multiplicity::compare(const Projection& p) const {
00012 const Multiplicity& other = dynamic_cast<const Multiplicity&>(p);
00013 return pcmp(*_fsproj, *other._fsproj);
00014 }
00015
00016
00017 void Multiplicity::project(const Event& e) {
00018 Log& log = getLog();
00019
00020
00021 _totalMult = 0;
00022 _totalChMult = 0;
00023 _totalUnchMult = 0;
00024 _hadMult = 0;
00025 _hadChMult = 0;
00026 _hadUnchMult = 0;
00027
00028
00029 const FinalState& fs = e.applyProjection(*_fsproj);
00030
00031
00032 for (ParticleVector::const_iterator p = fs.particles().begin(); p != fs.particles().end(); ++p) {
00033 ++_totalMult;
00034 HepPDT::ParticleID pInfo = p->getPdgId();
00035 bool isHadron = pInfo.isHadron();
00036 if (pInfo.threeCharge() != 0) {
00037 ++_totalChMult;
00038 if (isHadron) {
00039 ++_hadMult;
00040 ++_hadChMult;
00041 }
00042 log << Log::DEBUG << "Incrementing charged multiplicity = " << _totalChMult
00043 << " (" << _hadChMult << " hadrons)" << endl;
00044 } else {
00045 ++_totalUnchMult;
00046 if (isHadron) {
00047 ++_hadMult;
00048 ++_hadUnchMult;
00049 }
00050 log << Log::DEBUG << "Incrementing uncharged multiplicity = " << _totalUnchMult
00051 << " (" << _hadUnchMult << " hadrons)" << endl;
00052 }
00053 }
00054 }
00055
00056
00057 }