diff --git a/Analysis/BasicConsistency.cc b/Analysis/BasicConsistency.cc --- a/Analysis/BasicConsistency.cc +++ b/Analysis/BasicConsistency.cc @@ -1,325 +1,328 @@ // -*- C++ -*- // // BasicConsistency.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the BasicConsistency class. // #include "BasicConsistency.h" +#include "ThePEG/Utilities/DescribeClass.h" #include "ThePEG/Interface/Parameter.h" #include "ThePEG/Interface/Switch.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/EventRecord/Event.h" #include "ThePEG/Repository/EventGenerator.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" #include "Herwig/Utilities/EnumParticles.h" #include "ThePEG/PDT/DecayMode.h" #include "ThePEG/Utilities/ColourOutput.h" using namespace Herwig; using namespace ThePEG; BasicConsistency::BasicConsistency() : _epsmom(ZERO),_checkquark(true), _checkcharge(true), _checkcluster(true), _checkBR(true), _absolutemomentumtolerance(1*MeV), _relativemomentumtolerance(1e-5) {} IBPtr BasicConsistency::clone() const { return new_ptr(*this); } IBPtr BasicConsistency::fullclone() const { return new_ptr(*this); } void BasicConsistency::analyze(tEventPtr event, long, int, int) { bool writeEvent=false; set<tcPPtr> particles; event->selectFinalState(inserter(particles)); int charge(-event->incoming().first->dataPtr()->iCharge() -event->incoming().second->dataPtr()->iCharge()); Lorentz5Momentum ptotal(-event->incoming().first->momentum() -event->incoming().second->momentum()); const Energy beamenergy = ptotal.m(); for(set<tcPPtr>::const_iterator it = particles.begin(); it != particles.end(); ++it) { if (_checkquark && (*it)->coloured()) { cerr << "Had quarks in final state in event " << event->number() << '\n'; generator()->log() << "Had quarks in final state in event " << event->number() << '\n'; writeEvent = true; } else if( _checkcluster && (**it).id()==ParticleID::Cluster) { cerr << "Had clusters in final state in event " << event->number() << '\n'; generator()->log() << "Had clusters in final state in event " << event->number() << '\n'; writeEvent = true; } charge += (*it)->dataPtr()->iCharge(); ptotal += (*it)->momentum(); bool problem=false; LorentzDistance test; for(unsigned int ix=0;ix<5;++ix) { switch (ix) { case 0: test = (*it)->vertex(); break; case 1: test = (*it)->labVertex(); break; case 2: test = (*it)->decayVertex(); break; case 3: test = (*it)->labDecayVertex(); break; case 4: test = (*it)->lifeLength(); break; } problem |= ! ( isfinite(double(test.x()/mm)) && isfinite(double(test.y()/mm)) && isfinite(double(test.z()/mm)) && isfinite(double(test.t()/mm)) ); } if(problem) { generator()->log() << "Problem with position of " << **it << "\n" << (*it)->vertex()/mm << "\n" << (*it)->labVertex()/mm << "\n" << (*it)->decayVertex()/mm << "\n" << (*it)->labDecayVertex()/mm << "\n" << (*it)->lifeLength()/mm << "\n"; } } if ( _checkcharge && charge != 0 ) { cerr << "\nCharge imbalance by " << charge << "in event " << event->number() << '\n'; generator()->log() << "Charge imbalance by " << charge << "in event " << event->number() << '\n'; writeEvent = true; } Energy mag = ptotal.m(); Energy ee = ptotal.e(); if (std::isnan(double(mag/MeV))) { cerr << "\nMomentum is 'nan'; " << ptotal/MeV << " MeV in event " << event->number() << '\n'; generator()->log() <<"\nMomentum is 'nan'; " << ptotal/MeV << " MeV in event " << event->number() << '\n'; writeEvent = true; } const Energy epsilonmax = max( _absolutemomentumtolerance, _relativemomentumtolerance * beamenergy ); if (abs(mag) > epsilonmax || abs(ee) > epsilonmax) { cerr << "\nMomentum imbalance by " << ptotal/MeV << " MeV in event " << event->number() << '\n'; generator()->log() <<"\nMomentum imbalance by " << ptotal/MeV << " MeV in event " << event->number() << '\n'; writeEvent = true; } if (abs(mag) > _epsmom) _epsmom = abs(mag); if (abs(ee) > _epsmom) _epsmom = abs(ee); if (abs(ptotal.x()) > _epsmom) _epsmom = abs(ptotal.x()); if (abs(ptotal.y()) > _epsmom) _epsmom = abs(ptotal.y()); if (abs(ptotal.z()) > _epsmom) _epsmom = abs(ptotal.z()); particles.clear(); event->select(inserter(particles), ThePEG::AllSelector()); for(set<tcPPtr>::const_iterator it = particles.begin(); it != particles.end(); ++it) { bool problem=false; LorentzDistance test; for(unsigned int ix=0;ix<5;++ix) { switch (ix) { case 0: test = (*it)->vertex(); break; case 1: test = (*it)->labVertex(); break; case 2: test = (*it)->decayVertex(); break; case 3: test = (*it)->labDecayVertex(); break; case 4: test = (*it)->lifeLength(); break; } problem |= ( ! isfinite(double(test.m2()/mm/mm)) ); } if(problem) { generator()->log() << "Problem with position of " << **it << "\n" << (*it)->vertex()/mm << "\n" << (*it)->labVertex()/mm << "\n" << (*it)->decayVertex()/mm << "\n" << (*it)->labDecayVertex()/mm << "\n" << (*it)->lifeLength()/mm << "\n"; writeEvent=true; } } if(writeEvent) generator()->log() << *event; } void BasicConsistency::persistentOutput(PersistentOStream & os) const { os << _checkquark << _checkcharge << _checkcluster << _checkBR << ounit(_absolutemomentumtolerance,MeV) << _relativemomentumtolerance; } void BasicConsistency::persistentInput(PersistentIStream & is, int) { is >> _checkquark >> _checkcharge >> _checkcluster >> _checkBR >> iunit(_absolutemomentumtolerance,MeV) >> _relativemomentumtolerance; } -ClassDescription<BasicConsistency> BasicConsistency::initBasicConsistency; -// Definition of the static class description member. +// The following static variable is needed for the type +// description system in ThePEG. +DescribeClass<BasicConsistency,AnalysisHandler> +describeHerwigBasicConsistency("Herwig::BasicConsistency", "HwAnalysis.so"); void BasicConsistency::Init() { static ClassDocumentation<BasicConsistency> documentation ("The BasicConsistency analysis handler checks for" " momentum and charge conservation."); static Switch<BasicConsistency,bool> interfaceCheckQuark ("CheckQuark", "Check whether there are quarks in the final state", &BasicConsistency::_checkquark, true, false, false); static SwitchOption interfaceCheckQuarkCheck (interfaceCheckQuark, "Yes", "Check for quarks", true); static SwitchOption interfaceCheckQuarkNoCheck (interfaceCheckQuark, "No", "Don't check for quarks", false); static Switch<BasicConsistency,bool> interfaceCheckCharge ("CheckCharge", "Check whether charge is conserved", &BasicConsistency::_checkcharge, true, false, false); static SwitchOption interfaceCheckChargeCheck (interfaceCheckCharge, "Yes", "Check charge conservation", true); static SwitchOption interfaceCheckChargeNoCheck (interfaceCheckCharge, "No", "Don't check charge conservation", false); static Switch<BasicConsistency,bool> interfaceCheckCluster ("CheckCluster", "Check whether there are clusters in the final state", &BasicConsistency::_checkcluster, true, false, false); static SwitchOption interfaceCheckClusterCheck (interfaceCheckCluster, "Yes", "Check for clusters", true); static SwitchOption interfaceCheckClusterNoCheck (interfaceCheckCluster, "No", "Don't check for clusters", false); static Switch<BasicConsistency,bool> interfaceCheckBranchingRatios ("CheckBranchingRatios", "Check whether the branching ratios of the particles add up to one.", &BasicConsistency::_checkBR, true, false, false); static SwitchOption interfaceCheckBranchingRatiosYes (interfaceCheckBranchingRatios, "Yes", "Perform the check", true); static SwitchOption interfaceCheckBranchingRatiosNo (interfaceCheckBranchingRatios, "No", "Don't perform the check", false); static Parameter<BasicConsistency,Energy> interfaceAbsoluteMomentumTolerance ("AbsoluteMomentumTolerance", "The value of the momentum imbalance above which warnings are issued/MeV.\n" "Final tolerance is the larger of AbsoluteMomentumTolerance and\n" "RelativeMomentumTolerance*beam energy.", &BasicConsistency::_absolutemomentumtolerance, MeV, 1*MeV, ZERO, 1e10*GeV, false, false, true); static Parameter<BasicConsistency,double> interfaceRelativeMomentumTolerance ("RelativeMomentumTolerance", "The value of the momentum imbalance as a fraction of the beam energy\n" "above which warnings are issued.\n" "Final tolerance is the larger of AbsoluteMomentumTolerance and\n" "RelativeMomentumTolerance*beam energy.", &BasicConsistency::_relativemomentumtolerance, 1e-5, 0.0, 1.0, false, false, true); } void BasicConsistency::dofinish() { AnalysisHandler::dofinish(); cout << "\nBasicConsistency: maximum 4-momentum violation: " << ANSI::blue << _epsmom/MeV << " MeV\n" << ANSI::reset; } void BasicConsistency::doinitrun() { AnalysisHandler::doinitrun(); static double eps=1e-12; for(ParticleMap::const_iterator it=generator()->particles().begin(); it!=generator()->particles().end();++it) { if(it->second->stable()) continue; double total(0.); for(DecaySet::const_iterator dit=it->second->decayModes().begin(); dit!=it->second->decayModes().end();++dit) { if((**dit).on()) total +=(**dit).brat(); } if(abs(total-1.)>eps) { cerr << "Warning: Total BR for " << it->second->PDGName() << " does not add up to 1. sum = " << total << "\n"; } } } diff --git a/Analysis/BasicConsistency.h b/Analysis/BasicConsistency.h --- a/Analysis/BasicConsistency.h +++ b/Analysis/BasicConsistency.h @@ -1,205 +1,168 @@ // -*- C++ -*- // // BasicConsistency.h is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #ifndef THEPEG_BasicConsistency_H #define THEPEG_BasicConsistency_H // // This is the declaration of the BasicConsistency class. // #include "ThePEG/Handlers/AnalysisHandler.h" namespace Herwig { using namespace ThePEG; /** \ingroup Analysis * The BasicConsistency class is a simple analysis which performs a basic * analysis of the event checking that energy, momentum and charge are * conserved and no quarks or clusters are final-state particles. * * @see \ref BasicConsistencyInterfaces "The interfaces" * defined for BasicConsistency. */ class BasicConsistency: public AnalysisHandler { public: /** * The default constructor. */ BasicConsistency(); /** @name Virtual functions required by the AnalysisHandler class. */ //@{ /** * Analyze a given Event. Note that a fully generated event * may be presented several times, if it has been manipulated in * between. The default version of this function will call transform * to make a lorentz transformation of the whole event, then extract * all final state particles and call analyze(tPVector) of this * analysis object and those of all associated analysis objects. The * default version will not, however, do anything on events which * have not been fully generated, or have been manipulated in any * way. * @param event pointer to the Event to be analyzed. * @param ieve the event number. * @param loop the number of times this event has been presented. * If negative the event is now fully generated. * @param state a number different from zero if the event has been * manipulated in some way since it was last presented. */ virtual void analyze(tEventPtr event, long ieve, int loop, int state); //@} public: /** @name Functions used by the persistent I/O system. */ //@{ /** * Function used to write out object persistently. * @param os the persistent output stream written to. */ void persistentOutput(PersistentOStream & os) const; /** * Function used to read in object persistently. * @param is the persistent input stream read from. * @param version the version number of the object when written. */ void persistentInput(PersistentIStream & is, int version); //@} /** * The standard Init function used to initialize the interfaces. * Called exactly once for each class by the class description system * before the main function starts or * when this class is dynamically loaded. */ static void Init(); protected: /** @name Clone Methods. */ //@{ /** * Make a simple clone of this object. * @return a pointer to the new object. */ virtual IBPtr clone() const; /** Make a clone of this object, possibly modifying the cloned object * to make it sane. * @return a pointer to the new object. */ virtual IBPtr fullclone() const; //@} protected: /** @name Standard Interfaced functions. */ //@{ /** * Initialize this object. Called in the run phase just before * a run begins. */ virtual void doinitrun(); /** * Finalize this object. Called in the run phase just after a * run has ended. Used eg. to write out statistics. */ virtual void dofinish(); //@} private: /** - * The static object used to initialize the description of this class. - * Indicates that this is a concrete class with persistent data. - */ - static ClassDescription<BasicConsistency> initBasicConsistency; - - /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ BasicConsistency & operator=(const BasicConsistency &); private: /** * Maximum momentum deviation */ Energy _epsmom; /** * check for quarks */ bool _checkquark; /** * check for charge conservation */ bool _checkcharge; /** * Check for clusters in the final-state */ bool _checkcluster; /** * Check the branching ratios */ bool _checkBR; /** * Maximum absolute momentum deviation before warning */ Energy _absolutemomentumtolerance; /** * Maximum momentum deviation relative to beam energy before warning */ double _relativemomentumtolerance; }; } -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** This template specialization informs ThePEG about the - * base classes of BasicConsistency. */ -template <> -struct BaseClassTrait<Herwig::BasicConsistency,1> { - /** Typedef of the first base class of BasicConsistency. */ - typedef AnalysisHandler NthBase; -}; - -/** This template specialization informs ThePEG about the name of - * the BasicConsistency class and the shared object where it is defined. */ -template <> -struct ClassTraits<Herwig::BasicConsistency> - : public ClassTraitsBase<Herwig::BasicConsistency> { - /** Return a platform-independent class name */ - static string className() { return "Herwig::BasicConsistency"; } - /** Return the name(s) of the shared library (or libraries) be loaded to get - * access to the BasicConsistency class and any other class on which it depends - * (except the base class). */ - static string library() { return "HwAnalysis.so"; } -}; - -/** @endcond */ - -} - #endif /* THEPEG_BasicConsistency_H */ diff --git a/Analysis/DrellYanPT.cc b/Analysis/DrellYanPT.cc --- a/Analysis/DrellYanPT.cc +++ b/Analysis/DrellYanPT.cc @@ -1,67 +1,70 @@ // -*- C++ -*- // // This is the implementation of the non-inlined, non-templated member // functions of the DrellYanPT class. // #include "DrellYanPT.h" +#include "ThePEG/Utilities/DescribeClass.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Repository/EventGenerator.h" #include "ThePEG/EventRecord/Particle.h" #include "ThePEG/EventRecord/Event.h" #include "ThePEG/PDT/EnumParticles.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" using namespace Herwig; DrellYanPT::DrellYanPT() : _Zpt(0.,250.,250), _Wppt(0.,250.,250), _Wmpt(0.,250.,250) {} void DrellYanPT::dofinish() { AnalysisHandler::dofinish(); ofstream outZ ("pt_Z.dat"); _Zpt.normaliseToCrossSection(); _Zpt.simpleOutput(outZ,true); ofstream outWm ("pt_Wm.dat"); _Wmpt.normaliseToCrossSection(); _Wmpt.simpleOutput(outWm,true); ofstream outWp ("pt_Wp.dat"); _Wppt.normaliseToCrossSection(); _Wppt.simpleOutput(outWp,true); } void DrellYanPT::analyze(tEventPtr event, long ieve, int loop, int state) { AnalysisHandler::analyze(event, ieve, loop, state); // Rotate to CMS, extract final state particles and call analyze(particles). StepVector::const_iterator sit =event->primaryCollision()->steps().begin(); StepVector::const_iterator send=event->primaryCollision()->steps().end(); for(;sit!=send;++sit) { ParticleSet part=(**sit).all(); ParticleSet::const_iterator iter=part.begin(); ParticleSet::const_iterator end =part.end(); for( ;iter!=end;++iter) { if(((**iter).id()==ParticleID::Z0||(**iter).id()==ParticleID::gamma) && (**iter).children().size()==2) { _Zpt.addWeighted((**iter).momentum().perp()/GeV,event->weight()); } else if ((**iter).id()==ParticleID::Wplus && (**iter).children().size()==2) { _Wppt.addWeighted((**iter).momentum().perp()/GeV,event->weight()); } else if ((**iter).id()==ParticleID::Wminus && (**iter).children().size()==2) { _Wmpt.addWeighted((**iter).momentum().perp()/GeV,event->weight()); } } } } -NoPIOClassDescription<DrellYanPT> DrellYanPT::initDrellYanPT; -// Definition of the static class description member. +// The following static variable is needed for the type +// description system in ThePEG. +DescribeNoPIOClass<DrellYanPT,AnalysisHandler> +describeHerwigDrellYanPT("Herwig::DrellYanPT", "HwAnalysis.so"); void DrellYanPT::Init() { static ClassDocumentation<DrellYanPT> documentation ("Analyses the pt of weak bosons produces in Drell-Yan processes."); } diff --git a/Analysis/DrellYanPT.h b/Analysis/DrellYanPT.h --- a/Analysis/DrellYanPT.h +++ b/Analysis/DrellYanPT.h @@ -1,168 +1,127 @@ // -*- C++ -*- #ifndef HERWIG_DrellYanPT_H #define HERWIG_DrellYanPT_H // // This is the declaration of the DrellYanPT class. // #include "ThePEG/Handlers/AnalysisHandler.h" #include "Herwig/Utilities/Histogram.h" namespace Herwig { using namespace ThePEG; /** \ingroup Analysis * * This AnalysisHandler books histograms * of the weak boson's pt in Drell-Yan * processes. * * An Interface switch allows you to choose * between output of the histograms * as TopDraw or plain ASCII files, which * may be processed further, e.g. by gnuplot. * * @see \ref DrellYanPTInterfaces "The interfaces" * defined for DrellYanPT. */ class DrellYanPT: public AnalysisHandler { public: /** * The default constructor. */ DrellYanPT(); /** @name Virtual functions required by the AnalysisHandler class. */ //@{ /** * Analyze a given Event. Note that a fully generated event * may be presented several times, if it has been manipulated in * between. The default version of this function will call transform * to make a lorentz transformation of the whole event, then extract * all final state particles and call analyze(tPVector) of this * analysis object and those of all associated analysis objects. The * default version will not, however, do anything on events which * have not been fully generated, or have been manipulated in any * way. * @param event pointer to the Event to be analyzed. * @param ieve the event number. * @param loop the number of times this event has been presented. * If negative the event is now fully generated. * @param state a number different from zero if the event has been * manipulated in some way since it was last presented. */ virtual void analyze(tEventPtr event, long ieve, int loop, int state); //@} public: /** * The standard Init function used to initialize the interfaces. * Called exactly once for each class by the class description system * before the main function starts or * when this class is dynamically loaded. */ static void Init(); protected: /** @name Clone Methods. */ //@{ /** * Make a simple clone of this object. * @return a pointer to the new object. */ virtual IBPtr clone() const {return new_ptr(*this);} /** Make a clone of this object, possibly modifying the cloned object * to make it sane. * @return a pointer to the new object. */ virtual IBPtr fullclone() const {return new_ptr(*this);} //@} protected: /** @name Standard Interfaced functions. */ //@{ /** * Finalize this object. Called in the run phase just after a * run has ended. Used eg. to write out statistics. */ virtual void dofinish(); //@} private: /** * Histogram of the Z's pt */ Histogram _Zpt; /** * Histogram of the W+'s pt */ Histogram _Wppt; /** * Histogram of the W-'s pt */ Histogram _Wmpt; /** - * The static object used to initialize the description of this class. - * Indicates that this is a concrete class with persistent data. - */ - static NoPIOClassDescription<DrellYanPT> initDrellYanPT; - - /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ DrellYanPT & operator=(const DrellYanPT &); }; } -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** This template specialization informs ThePEG about the - * base classes of DrellYanPT. */ -template <> -struct BaseClassTrait<Herwig::DrellYanPT,1> { - /** Typedef of the first base class of DrellYanPT. */ - typedef AnalysisHandler NthBase; -}; - -/** This template specialization informs ThePEG about the name of - * the DrellYanPT class and the shared object where it is defined. */ -template <> -struct ClassTraits<Herwig::DrellYanPT> - : public ClassTraitsBase<Herwig::DrellYanPT> { - /** Return a platform-independent class name */ - static string className() { return "Herwig::DrellYanPT"; } - /** - * The name of a file containing the dynamic library where the class - * DrellYanPT is implemented. It may also include several, space-separated, - * libraries if the class DrellYanPT depends on other classes (base classes - * excepted). In this case the listed libraries will be dynamically - * linked in the order they are specified. - */ - static string library() { return "HwAnalysis.so"; } -}; - -/** @endcond */ - -} - #endif /* HERWIG_DrellYanPT_H */ diff --git a/Analysis/GammaGammaAnalysis.cc b/Analysis/GammaGammaAnalysis.cc --- a/Analysis/GammaGammaAnalysis.cc +++ b/Analysis/GammaGammaAnalysis.cc @@ -1,126 +1,129 @@ // -*- C++ -*- // // GammaGammaAnalysis.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the GammaGammaAnalysis class. // #include "GammaGammaAnalysis.h" +#include "ThePEG/Utilities/DescribeClass.h" #include "ThePEG/Repository/EventGenerator.h" #include "ThePEG/EventRecord/Particle.h" #include "ThePEG/EventRecord/Event.h" #include "ThePEG/PDT/EnumParticles.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" using namespace Herwig; GammaGammaAnalysis::GammaGammaAnalysis() : _ptharder(0.,250.,100), _ptsofter(0.,250.,100), _ptpair(0.,250.,100), _Eharder(0.,3000.,100), _Esofter(0.,3000.,100), _Epair(0.,6000.,100), _rapharder(-12.,12.,120), _rapsofter(-12.,12.,120), _rappair(-12.,12.,120), _phiharder(-Constants::pi,Constants::pi,50), _phisofter(-Constants::pi,Constants::pi,50), _deltaphi(-Constants::pi,Constants::pi,100), _mpair(0,1000,100) {} void GammaGammaAnalysis::dofinish() { AnalysisHandler::dofinish(); string fname = generator()->filename() + string("-") + name() + string(".top"); ofstream outfile(fname.c_str()); using namespace HistogramOptions; _ptharder.topdrawOutput(outfile,Frame|Ylog,"BLACK","pt harder"); _ptsofter.topdrawOutput(outfile,Frame|Ylog,"BLACK","pt softer"); _ptpair.topdrawOutput(outfile,Frame|Ylog,"BLACK","pt pair"); _Eharder.topdrawOutput(outfile,Frame|Ylog,"BLACK","E harder"); _Esofter.topdrawOutput(outfile,Frame|Ylog,"BLACK","E softer"); _Epair.topdrawOutput(outfile,Frame|Ylog,"BLACK","E pair"); _rapharder.topdrawOutput(outfile,Frame,"BLACK","y harder"); _rapsofter.topdrawOutput(outfile,Frame,"BLACK","y softer"); _rappair.topdrawOutput(outfile,Frame,"BLACK","y pair"); _phiharder.topdrawOutput(outfile,Frame,"BLACK","phi harder"); _phisofter.topdrawOutput(outfile,Frame,"BLACK","phi softer"); _deltaphi.topdrawOutput(outfile,Frame,"BLACK","Delta phi"); _mpair.topdrawOutput(outfile,Frame|Ylog,"BLACK","M pair"); outfile.close(); } namespace { inline Lorentz5Momentum getMomentum(tcPPtr particle) { return particle->momentum(); //Lorentz5Momentum tmp = particle->children()[0]->next()->momentum(); //tmp += particle->children()[1]->next()->momentum(); //tmp.rescaleMass(); //return tmp; } } void GammaGammaAnalysis::analyze(tEventPtr event, long, int, int) { // AnalysisHandler::analyze(event, ieve, loop, state); // Rotate to CMS, extract final state particles and call analyze(particles). // find the Z Lorentz5Momentum p1, p2, ppair; bool foundphotons = false; set<tcPPtr> particles; event->selectFinalState(inserter(particles)); for(set<tcPPtr>::const_iterator it = particles.begin(); it != particles.end(); ++it) { if((**it).id()==ParticleID::gamma) { // find the two hardest photons in the event if( getMomentum(*it).perp() > p2.perp() ) { if (getMomentum(*it).perp() > p1.perp()) { p2 = p1; p1 = getMomentum(*it); } else { p2 = getMomentum(*it); } } } } // cerr << "E1 = " << p1.e()/GeV << ", E1 = " << p1.e()/GeV << "\n"; if (p1.perp()/GeV > 0 && p2.perp()/GeV > 0) foundphotons = true; ppair = p1 + p2; if (foundphotons) { _ptharder += p1.perp()/GeV; _ptsofter += p2.perp()/GeV; _ptpair += ppair.perp()/GeV; _Eharder += p1.e()/GeV; _Esofter += p2.e()/GeV; _Epair += ppair.e()/GeV; _rapharder += p1.rapidity(); _rapsofter += p2.rapidity(); _rappair += ppair.rapidity(); _phiharder += p1.phi(); _phisofter += p2.phi(); _deltaphi += (p2.vect()).deltaPhi(p1.vect()); _mpair += ppair.m()/GeV; } else { cerr << "Analysis/GammaGammaAnalysis: Found no hard photon in event " << event->number() << ".\n"; generator()->log() << "Analysis/GammaGammaAnalysis: " << "Found no hard photon in event " << event->number() << ".\n" << *event; } } -NoPIOClassDescription<GammaGammaAnalysis> GammaGammaAnalysis::initGammaGammaAnalysis; -// Definition of the static class description member. +// The following static variable is needed for the type +// description system in ThePEG. +DescribeNoPIOClass<GammaGammaAnalysis,AnalysisHandler> +describeHerwigGammaGammaAnalysis("Herwig::GammaGammaAnalysis", "HwAnalysis.so"); void GammaGammaAnalysis::Init() { static ClassDocumentation<GammaGammaAnalysis> documentation ("There is no documentation for the GammaGammaAnalysis class"); } diff --git a/Analysis/GammaGammaAnalysis.h b/Analysis/GammaGammaAnalysis.h --- a/Analysis/GammaGammaAnalysis.h +++ b/Analysis/GammaGammaAnalysis.h @@ -1,216 +1,179 @@ // -*- C++ -*- // // GammaGammaAnalysis.h is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #ifndef HERWIG_GammaGammaAnalysis_H #define HERWIG_GammaGammaAnalysis_H // // This is the declaration of the GammaGammaAnalysis class. // #include "ThePEG/Repository/CurrentGenerator.h" #include "ThePEG/Handlers/AnalysisHandler.h" #include "Herwig/Utilities/Histogram.h" namespace Herwig { using namespace ThePEG; /** \ingroup Analysis * GammaGammaAnalysis is for the analysis of events with a pair of hard * photons produced. These are selected as the two highest pt photons * in the final state of the event. A topdrawer file with histograms * is written to the working directory. * * @see \ref GammaGammaAnalysisInterfaces "The interfaces" * defined for GammaGammaAnalysis. */ class GammaGammaAnalysis: public AnalysisHandler { public: /** * The default constructor. */ GammaGammaAnalysis(); /** @name Virtual functions required by the AnalysisHandler class. */ //@{ /** * Analyze a given Event. Note that a fully generated event * may be presented several times, if it has been manipulated in * between. The default version of this function will call transform * to make a lorentz transformation of the whole event, then extract * all final state particles and call analyze(tPVector) of this * analysis object and those of all associated analysis objects. The * default version will not, however, do anything on events which * have not been fully generated, or have been manipulated in any * way. * @param event pointer to the Event to be analyzed. * @param ieve the event number. * @param loop the number of times this event has been presented. * If negative the event is now fully generated. * @param state a number different from zero if the event has been * manipulated in some way since it was last presented. */ virtual void analyze(tEventPtr event, long ieve, int loop, int state); //@} public: /** * The standard Init function used to initialize the interfaces. * Called exactly once for each class by the class description system * before the main function starts or * when this class is dynamically loaded. */ static void Init(); protected: /** @name Clone Methods. */ //@{ /** * Make a simple clone of this object. * @return a pointer to the new object. */ virtual IBPtr clone() const {return new_ptr(*this);} /** Make a clone of this object, possibly modifying the cloned object * to make it sane. * @return a pointer to the new object. */ virtual IBPtr fullclone() const {return new_ptr(*this);} //@} protected: /** @name Standard Interfaced functions. */ //@{ /** * Finalize this object. Called in the run phase just after a * run has ended. Used eg. to write out statistics. */ virtual void dofinish(); //@} private: /** - * The static object used to initialize the description of this class. - * Indicates that this is a concrete class without persistent data. - */ - static NoPIOClassDescription<GammaGammaAnalysis> initGammaGammaAnalysis; - - /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ GammaGammaAnalysis & operator=(const GammaGammaAnalysis &); private: /** * \f$p_T\f$ of the harder photon */ Histogram _ptharder; /** * \f$p_T\f$ of the softer photon */ Histogram _ptsofter; /** * \f$p_T\f$ of the photon pair */ Histogram _ptpair; /** * Energy of the harder photon */ Histogram _Eharder; /** * Energy of the softer photon */ Histogram _Esofter; /** * Energy of the photon pair */ Histogram _Epair; /** * Rapidity of the harder photon */ Histogram _rapharder; /** * Rapidity of the softer photon */ Histogram _rapsofter; /** * Rapidity of the photon pair */ Histogram _rappair; /** * Azimuth of the harder photon */ Histogram _phiharder; /** * Azimuth of the softer photon */ Histogram _phisofter; /** * Azimuth of the photon pair */ Histogram _deltaphi; /** * Invariant mass of the pair */ Histogram _mpair; }; } -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** This template specialization informs ThePEG about the - * base classes of GammaGammaAnalysis. */ -template <> -struct BaseClassTrait<Herwig::GammaGammaAnalysis,1> { - /** Typedef of the first base class of GammaGammaAnalysis. */ - typedef AnalysisHandler NthBase; -}; - -/** This template specialization informs ThePEG about the name of - * the GammaGammaAnalysis class and the shared object where it is defined. */ -template <> -struct ClassTraits<Herwig::GammaGammaAnalysis> - : public ClassTraitsBase<Herwig::GammaGammaAnalysis> { - /** Return a platform-independent class name */ - static string className() { return "Herwig::GammaGammaAnalysis"; } - /** Return the name(s) of the shared library (or libraries) be loaded to get - * access to the GammaGammaAnalysis class and any other class on which it depends - * (except the base class). */ - static string library() { return "HwAnalysis.so"; } -}; - -/** @endcond */ - -} - #endif /* HERWIG_GammaGammaAnalysis_H */ diff --git a/Analysis/GammaJetAnalysis.cc b/Analysis/GammaJetAnalysis.cc --- a/Analysis/GammaJetAnalysis.cc +++ b/Analysis/GammaJetAnalysis.cc @@ -1,107 +1,110 @@ // -*- C++ -*- // // GammaJetAnalysis.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the GammaJetAnalysis class. // #include "GammaJetAnalysis.h" +#include "ThePEG/Utilities/DescribeClass.h" #include "ThePEG/Repository/EventGenerator.h" #include "ThePEG/EventRecord/Particle.h" #include "ThePEG/EventRecord/Event.h" #include "ThePEG/PDT/EnumParticles.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" using namespace Herwig; GammaJetAnalysis::GammaJetAnalysis() : _ptg(0.,250.,100), _ptgZoom(35.,65.,100), _Eg(0,3000,100), _rapg(-10.,10.,100), _phig(-Constants::pi,Constants::pi,100) {} void GammaJetAnalysis::dofinish() { AnalysisHandler::dofinish(); string fname = generator()->filename() + string("-") + name() + string(".top"); ofstream outfile(fname.c_str()); using namespace HistogramOptions; _Eg.topdrawOutput(outfile,Frame,"BLACK","Energy of Gamma"); _Eg.topdrawOutput(outfile,Frame|Ylog,"BLACK","Energy of Gamma"); _ptg.topdrawOutput(outfile,Frame,"BLACK","pt of Gamma"); _ptg.topdrawOutput(outfile,Frame|Ylog,"BLACK","pt of Gamma"); _ptgZoom.topdrawOutput(outfile,Frame,"BLACK","35<pt/GeV<65 of Gamma"); _ptgZoom.topdrawOutput(outfile,Frame|Ylog,"BLACK","35<pt/GeV<65 of Gamma"); _rapg.topdrawOutput(outfile,Frame,"BLACK","Rapidity of Gamma"); _rapg.topdrawOutput(outfile,Frame|Ylog,"BLACK","Rapidity of Gamma"); _phig.topdrawOutput(outfile,Frame,"BLACK","Azimuth of Gamma"); _phig.topdrawOutput(outfile,Frame|Ylog,"BLACK","Azimuth of Gamma"); outfile.close(); } namespace { inline Lorentz5Momentum getMomentum(tcPPtr particle) { return particle->momentum(); //Lorentz5Momentum tmp = particle->children()[0]->next()->momentum(); //tmp += particle->children()[1]->next()->momentum(); //tmp.rescaleMass(); //return tmp; } } void GammaJetAnalysis::analyze(tEventPtr event, long, int, int) { // AnalysisHandler::analyze(event, ieve, loop, state); // Rotate to CMS, extract final state particles and call analyze(particles). // find the Z Lorentz5Momentum pg; bool foundphoton = false; set<tcPPtr> particles; event->selectFinalState(inserter(particles)); for(set<tcPPtr>::const_iterator it = particles.begin(); it != particles.end(); ++it) { if((**it).id()==ParticleID::gamma) { // only book the hardest photon in the event if( (**it).momentum().perp() > pg.perp() ) { foundphoton = true; pg=getMomentum(*it); } } } if (foundphoton) { Energy pt = pg.perp(); (_ptg)+=(pt)/GeV; (_Eg)+=pg.e()/GeV; (_ptgZoom)+=(pt)/GeV; double rap = 0.5*log((pg.e()+pg.z())/(pg.e()-pg.z())); (_rapg)+=(rap); (_phig)+=pg.phi(); } else { cerr << "Analysis/GammaJetAnalysis: Found no hard photon in event " << event->number() << ".\n"; generator()->log() << "Analysis/GammaJetAnalysis: " << "Found no hard photon in event " << event->number() << ".\n" << *event; } } -NoPIOClassDescription<GammaJetAnalysis> GammaJetAnalysis::initGammaJetAnalysis; -// Definition of the static class description member. +// The following static variable is needed for the type +// description system in ThePEG. +DescribeNoPIOClass<GammaJetAnalysis,AnalysisHandler> +describeHerwigGammaJetAnalysis("Herwig::GammaJetAnalysis", "HwAnalysis.so"); void GammaJetAnalysis::Init() { static ClassDocumentation<GammaJetAnalysis> documentation ("There is no documentation for the GammaJetAnalysis class"); } diff --git a/Analysis/GammaJetAnalysis.h b/Analysis/GammaJetAnalysis.h --- a/Analysis/GammaJetAnalysis.h +++ b/Analysis/GammaJetAnalysis.h @@ -1,170 +1,133 @@ // -*- C++ -*- // // GammaJetAnalysis.h is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #ifndef HERWIG_GammaJetAnalysis_H #define HERWIG_GammaJetAnalysis_H // // This is the declaration of the GammaJetAnalysis class. // #include "ThePEG/Repository/CurrentGenerator.h" #include "ThePEG/Handlers/AnalysisHandler.h" #include "Herwig/Utilities/Histogram.h" namespace Herwig { using namespace ThePEG; /** \ingroup Analysis * GammaJetAnalysis selects the photon with the hightest pt in the final * state and books a number of histograms from its four momentum. The * results are witten in topdrawer format to the working directory. * * @see \ref GammaJetAnalysisInterfaces "The interfaces" * defined for GammaJetAnalysis. */ class GammaJetAnalysis: public AnalysisHandler { public: /** * The default constructor. */ GammaJetAnalysis(); /** @name Virtual functions required by the AnalysisHandler class. */ //@{ /** * Analyze a given Event. Note that a fully generated event * may be presented several times, if it has been manipulated in * between. The default version of this function will call transform * to make a lorentz transformation of the whole event, then extract * all final state particles and call analyze(tPVector) of this * analysis object and those of all associated analysis objects. The * default version will not, however, do anything on events which * have not been fully generated, or have been manipulated in any * way. * @param event pointer to the Event to be analyzed. * @param ieve the event number. * @param loop the number of times this event has been presented. * If negative the event is now fully generated. * @param state a number different from zero if the event has been * manipulated in some way since it was last presented. */ virtual void analyze(tEventPtr event, long ieve, int loop, int state); //@} public: /** * The standard Init function used to initialize the interfaces. * Called exactly once for each class by the class description system * before the main function starts or * when this class is dynamically loaded. */ static void Init(); protected: /** @name Clone Methods. */ //@{ /** * Make a simple clone of this object. * @return a pointer to the new object. */ virtual IBPtr clone() const {return new_ptr(*this);} /** Make a clone of this object, possibly modifying the cloned object * to make it sane. * @return a pointer to the new object. */ virtual IBPtr fullclone() const {return new_ptr(*this);} //@} protected: /** @name Standard Interfaced functions. */ //@{ /** * Finalize this object. Called in the run phase just after a * run has ended. Used eg. to write out statistics. */ virtual void dofinish(); private: /** - * The static object used to initialize the description of this class. - * Indicates that this is a concrete class with persistent data. - */ - static NoPIOClassDescription<GammaJetAnalysis> initGammaJetAnalysis; - - /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ GammaJetAnalysis & operator=(const GammaJetAnalysis &); private: /** * \f$p_T\f$ of the photon */ Histogram _ptg; Histogram _ptgZoom; /** * Energy of the photon */ Histogram _Eg; /** * Rapidity of the photon */ Histogram _rapg; /** * Azimuth of the photon */ Histogram _phig; }; } -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** This template specialization informs ThePEG about the - * base classes of GammaJetAnalysis. */ -template <> -struct BaseClassTrait<Herwig::GammaJetAnalysis,1> { - /** Typedef of the first base class of GammaJetAnalysis. */ - typedef AnalysisHandler NthBase; -}; - -/** This template specialization informs ThePEG about the name of - * the GammaJetAnalysis class and the shared object where it is defined. */ -template <> -struct ClassTraits<Herwig::GammaJetAnalysis> - : public ClassTraitsBase<Herwig::GammaJetAnalysis> { - /** Return a platform-independent class name */ - static string className() { return "Herwig::GammaJetAnalysis"; } - /** Return the name(s) of the shared library (or libraries) be loaded to get - * access to the GammaJetAnalysis class and any other class on which it depends - * (except the base class). */ - static string library() { return "HwAnalysis.so"; } -}; - -/** @endcond */ - -} - #endif /* HERWIG_GammaJetAnalysis_H */ diff --git a/Analysis/HiggsJetAnalysis.cc b/Analysis/HiggsJetAnalysis.cc --- a/Analysis/HiggsJetAnalysis.cc +++ b/Analysis/HiggsJetAnalysis.cc @@ -1,99 +1,102 @@ // -*- C++ -*- // // HiggsJetAnalysis.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the HiggsJetAnalysis class. // #include "HiggsJetAnalysis.h" +#include "ThePEG/Utilities/DescribeClass.h" #include "ThePEG/Repository/EventGenerator.h" #include "ThePEG/EventRecord/Particle.h" #include "ThePEG/EventRecord/Event.h" #include "ThePEG/PDT/EnumParticles.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" using namespace Herwig; HiggsJetAnalysis::HiggsJetAnalysis() : _pth(0.,250.,100), _pthZoom(35.,65.,100), _raph(-10.,10.,100), _phih(-Constants::pi,Constants::pi,100) {} void HiggsJetAnalysis::dofinish() { AnalysisHandler::dofinish(); string fname = generator()->filename() + string("-") + name() + string(".top"); ofstream outfile(fname.c_str()); using namespace HistogramOptions; _pth.topdrawOutput(outfile,Frame,"BLACK","pt of Higgs"); _pth.topdrawOutput(outfile,Frame|Ylog,"BLACK","pt of Higgs"); _pthZoom.topdrawOutput(outfile,Frame,"BLACK","35<pt/GeV<65 of Higgs"); _pthZoom.topdrawOutput(outfile,Frame|Ylog,"BLACK","35<pt/GeV<65 of Higgs"); _raph.topdrawOutput(outfile,Frame,"BLACK","Rapidity of h"); _raph.topdrawOutput(outfile,Frame|Ylog,"BLACK","Rapidity of h"); _phih.topdrawOutput(outfile,Frame,"BLACK","Azimuth of h"); _phih.topdrawOutput(outfile,Frame|Ylog,"BLACK","Azimuth of h"); outfile.close(); } namespace { bool isLastInShower(const Particle & p) { return p.children().size() > 1 && p.children()[0]->id() != p.id() && p.children()[1]->id() != p.id(); } struct Higgs { static bool AllCollisions() { return false; } static bool AllSteps() { return true; } // === // pick the last instance from the shower static bool FinalState() { return false; } static bool Intermediate() { return true; } // === static bool Check(const Particle & p) { return p.id() == ParticleID::h0 && isLastInShower(p); } }; } void HiggsJetAnalysis::analyze(tEventPtr event, long, int, int) { tcParticleSet higgses; event->select(inserter(higgses), ThePEG::ParticleSelector<Higgs>()); if ( higgses.empty() ) return; else if ( higgses.size() > 1 ) { cerr << "\nMultiple h0 found. Only binning first one.\n"; } tcPPtr higgs = *higgses.begin(); Lorentz5Momentum ph = higgs->momentum(); double pt = ph.perp()/GeV; (_pth)+=(pt); (_pthZoom)+=(pt); double rap = 0.5*log((ph.e()+ph.z())/(ph.e()-ph.z())); (_raph)+=(rap); (_phih)+=ph.phi(); } -NoPIOClassDescription<HiggsJetAnalysis> HiggsJetAnalysis::initHiggsJetAnalysis; -// Definition of the static class description member. +// The following static variable is needed for the type +// description system in ThePEG. +DescribeNoPIOClass<HiggsJetAnalysis,AnalysisHandler> +describeHerwigHiggsJetAnalysis("Herwig::HiggsJetAnalysis", "HwAnalysis.so"); void HiggsJetAnalysis::Init() { static ClassDocumentation<HiggsJetAnalysis> documentation ("Standard analysis of a single h0 after showering."); } diff --git a/Analysis/HiggsJetAnalysis.h b/Analysis/HiggsJetAnalysis.h --- a/Analysis/HiggsJetAnalysis.h +++ b/Analysis/HiggsJetAnalysis.h @@ -1,170 +1,133 @@ // -*- C++ -*- // // HiggsJetAnalysis.h is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #ifndef HERWIG_HiggsJetAnalysis_H #define HERWIG_HiggsJetAnalysis_H // // This is the declaration of the HiggsJetAnalysis class. // #include "ThePEG/Repository/CurrentGenerator.h" #include "ThePEG/Handlers/AnalysisHandler.h" #include "Herwig/Utilities/Histogram.h" namespace Herwig { using namespace ThePEG; /** \ingroup Analysis * HiggsJetAnalysis assumes that there is one Higgs in the final state * and books some observables computed from its four momentum. It * shouldn't do anything in case there is no Higgs in the event. * * @see \ref HiggsJetAnalysisInterfaces "The interfaces" * defined for HiggsJetAnalysis. */ class HiggsJetAnalysis: public AnalysisHandler { public: /** @name Standard constructors and destructors. */ //@{ /** * The default constructor. */ HiggsJetAnalysis(); //@} public: /** @name Virtual functions required by the AnalysisHandler class. */ //@{ /** * Analyze a given Event. Note that a fully generated event * may be presented several times, if it has been manipulated in * between. The default version of this function will call transform * to make a lorentz transformation of the whole event, then extract * all final state particles and call analyze(tPVector) of this * analysis object and those of all associated analysis objects. The * default version will not, however, do anything on events which * have not been fully generated, or have been manipulated in any * way. * @param event pointer to the Event to be analyzed. * @param ieve the event number. * @param loop the number of times this event has been presented. * If negative the event is now fully generated. * @param state a number different from zero if the event has been * manipulated in some way since it was last presented. */ virtual void analyze(tEventPtr event, long ieve, int loop, int state); //@} public: /** * The standard Init function used to initialize the interfaces. * Called exactly once for each class by the class description system * before the main function starts or * when this class is dynamically loaded. */ static void Init(); protected: /** @name Clone Methods. */ //@{ /** * Make a simple clone of this object. * @return a pointer to the new object. */ virtual IBPtr clone() const {return new_ptr(*this);} /** Make a clone of this object, possibly modifying the cloned object * to make it sane. * @return a pointer to the new object. */ virtual IBPtr fullclone() const {return new_ptr(*this);} //@} protected: /** @name Standard Interfaced functions. */ //@{ /** * Finalize this object. Called in the run phase just after a * run has ended. Used eg. to write out statistics. */ virtual void dofinish(); private: /** - * The static object used to initialize the description of this class. - * Indicates that this is a concrete class without persistent data. - */ - static NoPIOClassDescription<HiggsJetAnalysis> initHiggsJetAnalysis; - - /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ HiggsJetAnalysis & operator=(const HiggsJetAnalysis &); private: /** * \f$p_T\f$ of the h boson */ Histogram _pth; Histogram _pthZoom; /** * Rapidity of h */ Histogram _raph; /** * Azimuth of h */ Histogram _phih; }; } -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** This template specialization informs ThePEG about the - * base classes of HiggsJetAnalysis. */ -template <> -struct BaseClassTrait<Herwig::HiggsJetAnalysis,1> { - /** Typedef of the first base class of HiggsJetAnalysis. */ - typedef AnalysisHandler NthBase; -}; - -/** This template specialization informs ThePEG about the name of - * the HiggsJetAnalysis class and the shared object where it is defined. */ -template <> -struct ClassTraits<Herwig::HiggsJetAnalysis> - : public ClassTraitsBase<Herwig::HiggsJetAnalysis> { - /** Return a platform-independent class name */ - static string className() { return "Herwig::HiggsJetAnalysis"; } - /** Return the name(s) of the shared library (or libraries) be loaded to get - * access to the HiggsJetAnalysis class and any other class on which it depends - * (except the base class). */ - static string library() { return "HwAnalysis.so"; } -}; - -/** @endcond */ - -} - #endif /* HERWIG_HiggsJetAnalysis_H */ diff --git a/Analysis/LEPBMultiplicity.cc b/Analysis/LEPBMultiplicity.cc --- a/Analysis/LEPBMultiplicity.cc +++ b/Analysis/LEPBMultiplicity.cc @@ -1,163 +1,166 @@ // -*- C++ -*- // // LEPBMultiplicity.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the LEPBMultiplicity class. // #include "LEPBMultiplicity.h" +#include "ThePEG/Utilities/DescribeClass.h" #include "ThePEG/Repository/EventGenerator.h" #include "ThePEG/EventRecord/Event.h" #include "ThePEG/PDT/EnumParticles.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "Herwig/Utilities/StandardSelectors.h" using namespace Herwig; using namespace ThePEG; BranchingInfo::BranchingInfo(double inmult,double inerror) : obsBranching(inmult), obsError(inerror), actualCount(0), sumofsquares(0.0) {} double BranchingInfo::simBranching(long N, BranchingInfo den) { return den.actualCount>0 ? double(actualCount) / double(den.actualCount) : double(actualCount) / double(N) ; } double BranchingInfo::simError(long N, BranchingInfo den) { double rn = N*( sumofsquares/double(N) - sqr(simBranching(N))) / sqr(double(actualCount)); double rd = den.actualCount>0 ? N*( den.sumofsquares/double(N) - sqr(den.simBranching(N))) / sqr(double(den.actualCount)) : 0.; return simBranching(N,den)*sqrt(rn+rd); } double BranchingInfo::nSigma(long N,BranchingInfo den) { return obsBranching == 0.0 ? 0.0 : (simBranching(N,den) - obsBranching) / sqrt(sqr(simError(N,den)) + sqr(obsError)); } string BranchingInfo::bargraph(long N, BranchingInfo den) { if (obsBranching == 0.0) return " ? "; else if (nSigma(N,den) >= 6.0) return "-----|---->"; else if (nSigma(N,den) >= 5.0) return "-----|----*"; else if (nSigma(N,den) >= 4.0) return "-----|---*-"; else if (nSigma(N,den) >= 3.0) return "-----|--*--"; else if (nSigma(N,den) >= 2.0) return "-----|-*---"; else if (nSigma(N,den) >= 1.0) return "-----|*----"; else if (nSigma(N,den) > -1.0) return "-----*-----"; else if (nSigma(N,den) > -2.0) return "----*|-----"; else if (nSigma(N,den) > -3.0) return "---*-|-----"; else if (nSigma(N,den) > -4.0) return "--*--|-----"; else if (nSigma(N,den) > -5.0) return "-*---|-----"; else if (nSigma(N,den) > -6.0) return "*----|-----"; else return "<----|-----"; } LEPBMultiplicity::LEPBMultiplicity() { // B+ _data[521 ] = BranchingInfo(0.403, 0.009); // B_s _data[531 ] = BranchingInfo(0.103, 0.009); // baryons _data[5122] = BranchingInfo(0.091, 0.015); // b's _data[5] = BranchingInfo(0. , 0. ); } void LEPBMultiplicity::analyze(tEventPtr event, long , int , int ) { // extract the weakly decaying B hadrons using set to avoid double counting set<PPtr> particles; map <long,long> eventcount; StepVector steps = event->primaryCollision()->steps(); steps[0]->select(inserter(particles), ThePEG::AllSelector()); unsigned int nb=0; for(set<PPtr>::const_iterator cit=particles.begin();cit!=particles.end();++cit) { if(abs((*cit)->id())==ParticleID::b) ++nb; } if(nb!=0) eventcount.insert(make_pair(5,nb)); particles.clear(); event->select(inserter(particles),WeakBHadronSelector()); for(set<PPtr>::const_iterator it = particles.begin(); it != particles.end(); ++it) { long ID = abs( (*it)->id() ); //special for b baryons if(ID!=511&&ID!=521&&ID!=531) ID=5122; if (_data.find(ID) != _data.end()) { eventcount.insert(make_pair(ID,0)); ++eventcount[ID]; } } for(map<long,long>::const_iterator it = eventcount.begin(); it != eventcount.end(); ++it) { _data[it->first].actualCount += it->second; _data[it->first].sumofsquares += sqr(double(it->second)); } } -NoPIOClassDescription<LEPBMultiplicity> LEPBMultiplicity::initLEPBMultiplicity; -// Definition of the static class description member. +// The following static variable is needed for the type +// description system in ThePEG. +DescribeNoPIOClass<LEPBMultiplicity,AnalysisHandler> +describeHerwigLEPBMultiplicity("Herwig::LEPBMultiplicity", "HwAnalysis.so"); void LEPBMultiplicity::Init() { static ClassDocumentation<LEPBMultiplicity> documentation ("The LEP B multiplicity analysis.", "The LEP B multiplicity analysis uses data from PDG 2006 \\cite{Yao:2006px}.", "%\\cite{Yao:2006px}\n" "\\bibitem{Yao:2006px}\n" " W.~M.~Yao {\\it et al.} [Particle Data Group],\n" " %``Review of particle physics,''\n" " J.\\ Phys.\\ G {\\bf 33} (2006) 1.\n" " %%CITATION = JPHGB,G33,1;%%\n" ); } void LEPBMultiplicity::dofinish() { useMe(); string filename = generator()->filename() + ".Bmult"; ofstream outfile(filename.c_str()); outfile << "\nB branching fraction (compared to LEP data):\n" " ID Name simMult obsMult obsErr Sigma\n"; long N = generator()->currentEventNumber() - 1; BranchingInfo den = _data[5]; for (map<long,BranchingInfo>::const_iterator it = _data.begin(); it != _data.end(); ++it) { if(it->first==5) continue; BranchingInfo multiplicity = it->second; string name = (it->first==5122 ? "b baryons" : generator()->getParticleData(it->first)->PDGName() ) +" "; ios::fmtflags oldFlags = outfile.flags(); outfile << std::scientific << std::showpoint << std::setprecision(3) << setw(7) << it->first << ' ' << setw(9) << name << ' ' << setw(2) << multiplicity.simBranching(N,den) << " | " << setw(2) << multiplicity.obsBranching << " +/- " << setw(2) << multiplicity.obsError << ' ' << std::showpos << std::setprecision(1) << multiplicity.nSigma(N,den) << ' ' << multiplicity.bargraph(N,den) << std::noshowpos; outfile << '\n'; outfile.flags(oldFlags); } } diff --git a/Analysis/LEPBMultiplicity.h b/Analysis/LEPBMultiplicity.h --- a/Analysis/LEPBMultiplicity.h +++ b/Analysis/LEPBMultiplicity.h @@ -1,220 +1,179 @@ // -*- C++ -*- // // LEPBMultiplicity.h is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #ifndef HERWIG_LEPBMultiplicity_H #define HERWIG_LEPBMultiplicity_H // // This is the declaration of the LEPBMultiplicity class. // #include "ThePEG/Handlers/AnalysisHandler.h" namespace Herwig { using namespace ThePEG; /** \ingroup Analysis * Struct for the multiplcity data */ struct BranchingInfo { /** * Default constructor * @param mult The observed multiplcity. * @param error The error on the observed multiplicity */ BranchingInfo(double mult=0.,double error=0.); /** * The observed multiplicity */ double obsBranching; /** * The error on the observed multiplicity */ double obsError; /** * Number of particles of this type */ long actualCount; /** * Sum of squares of number per event for error */ double sumofsquares; /** * The average fraction per quark * @param N The number of events * @param den The denominator to give the fraction */ double simBranching(long N,BranchingInfo den=BranchingInfo()); /** * The error on the average number per event * @param N The number of events * @param den The denominator to give the fraction */ double simError(long N,BranchingInfo den=BranchingInfo()); /** * Is the result more than \f$3\sigma\f$ from the experimental result * @param N The number of events * @param den The denominator to give the fraction */ double nSigma(long N,BranchingInfo den=BranchingInfo()); /** * Plot standard error in a simple barchart * @param N The number of events * @param den The denominator to give the fraction */ string bargraph(long N,BranchingInfo den=BranchingInfo()); }; /** * The LEPBBMultiplicity class is designed to compare the production * rates of \f$B^+\f$, \f$B^0\f$, \f$B^0_s\f$ and B-baryons in * B events at LEP * * @see \ref LEPBMultiplicityInterfaces "The interfaces" * defined for LEPBMultiplicity. */ class LEPBMultiplicity: public AnalysisHandler { public: /** * The default constructor. */ LEPBMultiplicity(); public: /** @name Virtual functions required by the AnalysisHandler class. */ //@{ /** * Analyze a given Event. Note that a fully generated event * may be presented several times, if it has been manipulated in * between. The default version of this function will call transform * to make a lorentz transformation of the whole event, then extract * all final state particles and call analyze(tPVector) of this * analysis object and those of all associated analysis objects. The * default version will not, however, do anything on events which * have not been fully generated, or have been manipulated in any * way. * @param event pointer to the Event to be analyzed. * @param ieve the event number. * @param loop the number of times this event has been presented. * If negative the event is now fully generated. * @param state a number different from zero if the event has been * manipulated in some way since it was last presented. */ virtual void analyze(tEventPtr event, long ieve, int loop, int state); //@} public: /** * The standard Init function used to initialize the interfaces. * Called exactly once for each class by the class description system * before the main function starts or * when this class is dynamically loaded. */ static void Init(); protected: /** @name Clone Methods. */ //@{ /** * Make a simple clone of this object. * @return a pointer to the new object. */ virtual IBPtr clone() const {return new_ptr(*this);} /** Make a clone of this object, possibly modifying the cloned object * to make it sane. * @return a pointer to the new object. */ virtual IBPtr fullclone() const {return new_ptr(*this);} //@} protected: /** @name Standard Interfaced functions. */ //@{ /** * Finalize this object. Called in the run phase just after a * run has ended. Used eg. to write out statistics. */ virtual void dofinish(); //@} private: /** - * The static object used to initialize the description of this class. - * Indicates that this is an concrete class without persistent data. - */ - static NoPIOClassDescription<LEPBMultiplicity> initLEPBMultiplicity; - - /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ LEPBMultiplicity & operator=(const LEPBMultiplicity &); private: /** * Map of PDG codes to multiplicity info */ map<long,BranchingInfo> _data; }; } -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** This template specialization informs ThePEG about the - * base classes of LEPBMultiplicity. */ -template <> -struct BaseClassTrait<Herwig::LEPBMultiplicity,1> { - /** Typedef of the first base class of LEPBMultiplicity. */ - typedef AnalysisHandler NthBase; -}; - -/** This template specialization informs ThePEG about the name of - * the LEPBMultiplicity class and the shared object where it is defined. */ -template <> -struct ClassTraits<Herwig::LEPBMultiplicity> - : public ClassTraitsBase<Herwig::LEPBMultiplicity> { - /** Return a platform-independent class name */ - static string className() { return "Herwig::LEPBMultiplicity"; } - /** - * The name of a file containing the dynamic library where the class - * LEPBMultiplicity is implemented. It may also include several, space-separated, - * libraries if the class LEPBMultiplicity depends on other classes (base classes - * excepted). In this case the listed libraries will be dynamically - * linked in the order they are specified. - */ - static string library() { return "HwAnalysis.so"; } -}; - -/** @endcond */ - -} - #endif /* HERWIG_LEPBMultiplicity_H */ diff --git a/Analysis/LEPEventShapes.cc b/Analysis/LEPEventShapes.cc --- a/Analysis/LEPEventShapes.cc +++ b/Analysis/LEPEventShapes.cc @@ -1,665 +1,668 @@ // -*- C++ -*- // // LEPEventShapes.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the LEPEventShapes class. // #include "LEPEventShapes.h" +#include "ThePEG/Utilities/DescribeClass.h" #include "EventShapes.h" #include "ThePEG/EventRecord/Event.h" #include "ThePEG/Interface/Reference.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" #include "ThePEG/Repository/CurrentGenerator.h" using namespace Herwig; void LEPEventShapes::analyze(tEventPtr event, long ieve, int loop, int state) { AnalysisHandler::analyze(event, ieve, loop, state); if ( loop > 0 || state != 0 || !event ) return; // get the final-state particles tPVector hadrons=event->getFinalState(); // event shapes } LorentzRotation LEPEventShapes::transform(tEventPtr) const { return LorentzRotation(); // Return the Rotation to the frame in which you want to perform the analysis. } void LEPEventShapes::analyze(const tPVector & ) { double eventweight = generator()->currentEvent()->weight(); _omthr ->addWeighted( 1.-_shapes->thrust() ,eventweight); _maj ->addWeighted( _shapes->thrustMajor() ,eventweight); _min ->addWeighted( _shapes->thrustMinor() ,eventweight); _obl ->addWeighted( _shapes->oblateness() ,eventweight); _c ->addWeighted( _shapes->CParameter() ,eventweight); _d ->addWeighted( _shapes->DParameter() ,eventweight); _sph ->addWeighted( _shapes->sphericity() ,eventweight); _apl ->addWeighted( _shapes->aplanarity() ,eventweight); _pla ->addWeighted( _shapes->planarity() ,eventweight); _mhi ->addWeighted( _shapes->Mhigh2() ,eventweight); _mlo ->addWeighted( _shapes->Mlow2() ,eventweight); _mdiff ->addWeighted( _shapes->Mdiff2() ,eventweight); _bmax ->addWeighted( _shapes->Bmax() ,eventweight); _bmin ->addWeighted( _shapes->Bmin() ,eventweight); _bsum ->addWeighted( _shapes->Bsum() ,eventweight); _bdiff ->addWeighted( _shapes->Bdiff() ,eventweight); } void LEPEventShapes::persistentOutput(PersistentOStream & os) const { os << _shapes; } void LEPEventShapes::persistentInput(PersistentIStream & is, int) { is >> _shapes; } -ClassDescription<LEPEventShapes> LEPEventShapes::initLEPEventShapes; -// Definition of the static class description member. +// The following static variable is needed for the type +// description system in ThePEG. +DescribeClass<LEPEventShapes,AnalysisHandler> +describeHerwigLEPEventShapes("Herwig::LEPEventShapes", "HwAnalysis.so HwLEPAnalysis.so"); void LEPEventShapes::Init() { static ClassDocumentation<LEPEventShapes> documentation ("The LEPEventShapes class compares event shapes at the Z mass" "with experimental results", "The LEP EventShapes analysis uses data from \\cite{Pfeifenschneider:1999rz,Abreu:1996na}.", "%\\cite{Pfeifenschneider:1999rz}\n" "\\bibitem{Pfeifenschneider:1999rz}\n" " P.~Pfeifenschneider {\\it et al.} [JADE collaboration and OPAL\n" " Collaboration],\n" " ``QCD analyses and determinations of alpha(s) in e+ e- annihilation at\n" " %energies between 35-GeV and 189-GeV,''\n" " Eur.\\ Phys.\\ J.\\ C {\\bf 17}, 19 (2000)\n" " [arXiv:hep-ex/0001055].\n" " %%CITATION = EPHJA,C17,19;%%\n" "%\\cite{Abreu:1996na}\n" "\\bibitem{Abreu:1996na}\n" " P.~Abreu {\\it et al.} [DELPHI Collaboration],\n" " ``Tuning and test of fragmentation models based on identified particles and\n" " %precision event shape data,''\n" " Z.\\ Phys.\\ C {\\bf 73}, 11 (1996).\n" " %%CITATION = ZEPYA,C73,11;%%\n" ); static Reference<LEPEventShapes,EventShapes> interfaceEventShapes ("EventShapes", "Pointer to the object which calculates the event shapes", &LEPEventShapes::_shapes, false, false, true, false, false); } void LEPEventShapes::dofinish() { useMe(); AnalysisHandler::dofinish(); string fname = generator()->filename() + string("-") + name() + string(".top"); ofstream output(fname.c_str()); using namespace HistogramOptions; _omthr->topdrawOutput(output,Frame|Errorbars|Ylog, "RED", "1-T compared to DELPHI data", " ", "1/SdS/d(1-T)", " G G ", "1-T", " "); _maj->topdrawOutput(output,Frame|Errorbars|Ylog, "RED", "Thrust Major compared to DELPHI data", " ", "1/SdS/dMajor", " G G ", "Major", " "); _min->topdrawOutput(output,Frame|Errorbars|Ylog, "RED", "Thrust Minor compared to DELPHI data", " ", "1/SdS/dMinor", " G G ", "Minor", " "); _obl->topdrawOutput(output,Frame|Errorbars|Ylog, "RED", "Oblateness compared to DELPHI data", " ", "1/SdS/dO", " G G ", "O", " "); _sph->topdrawOutput(output,Frame|Errorbars|Ylog, "RED", "Sphericity compared to DELPHI data", " ", "1/SdS/dS", " G G ", "S", " "); _apl->topdrawOutput(output,Frame|Errorbars|Ylog, "RED", "Aplanarity compared to DELPHI data", " ", "1/SdS/dA", " G G ", "A", " "); _pla->topdrawOutput(output,Frame|Errorbars|Ylog, "RED", "Planarity compared to DELPHI data", " ", "1/SdS/dP", " G G ", "P", " "); _c->topdrawOutput(output,Frame|Errorbars|Ylog, "RED", "C parameter compared to DELPHI data", " ", "1/SdS/dC", " G G ", "C", " "); _d->topdrawOutput(output,Frame|Errorbars|Ylog, "RED", "D parameter compared to DELPHI data", " ", "1/SdS/dD", " G G ", "D", " "); _mhi->topdrawOutput(output,Frame|Errorbars|Ylog, "RED", "High hemisphere mass compared to DELPHI data", " ", "1/SdS/dM0high1", " G G X X", "M0high1", " X X"); _mlo->topdrawOutput(output,Frame|Errorbars|Ylog, "RED", "Low hemisphere mass compared to DELPHI data", " ", "1/SdS/dM0low1", " G G X X", "M0low1", " X X"); _mdiff->topdrawOutput(output,Frame|Errorbars|Ylog, "RED", "Difference in hemisphere masses compared to DELPHI data", " ", "1/SdS/dM0diff1", " G G X X", "M0diff1", " X X"); _bmax->topdrawOutput(output,Frame|Errorbars|Ylog, "RED", "Wide jet broadening measure compared to DELPHI data", " ", "1/SdS/dB0max1", " G G X X", "B0max1", " X X"); _bmin->topdrawOutput(output,Frame|Errorbars|Ylog, "RED", "Narrow jet broadening measure compared to DELPHI data", " ", "1/SdS/dB0min1", " G G X X", "B0min1", " X X"); _bsum->topdrawOutput(output,Frame|Errorbars|Ylog, "RED", "Sum of jet broadening measures compared to DELPHI data", " ", "1/SdS/dB0sum1", " G G X X", "B0sum1", " X X"); _bdiff->topdrawOutput(output,Frame|Errorbars|Ylog, "RED", "Difference of jet broadenings measure compared to DELPHI data", " ", "1/SdS/dB0diff1", " G G X X", "B0diff1", " X X"); // chi squareds double chisq=0.,minfrac=0.05; unsigned int ndegrees; _omthr->chiSquared(chisq,ndegrees,minfrac); generator()->log() << "Chi Square = " << chisq << " for " << ndegrees << " degrees of freedom for DELPHI thrust distribution\n"; _maj->chiSquared(chisq,ndegrees,minfrac); generator()->log() << "Chi Square = " << chisq << " for " << ndegrees << " degrees of freedom for DELPHI major distribution\n"; _min->chiSquared(chisq,ndegrees,minfrac); generator()->log() << "Chi Square = " << chisq << " for " << ndegrees << " degrees of freedom for DELPHI minor distribution\n"; _obl->chiSquared(chisq,ndegrees,minfrac); generator()->log() << "Chi Square = " << chisq << " for " << ndegrees << " degrees of freedom for DELPHI oblateness distribution\n"; _sph->chiSquared(chisq,ndegrees,minfrac); generator()->log() << "Chi Square = " << chisq << " for " << ndegrees << " degrees of freedom for DELPHI sphericity distribution\n"; _apl->chiSquared(chisq,ndegrees,minfrac); generator()->log() << "Chi Square = " << chisq << " for " << ndegrees << " degrees of freedom for DELPHI aplanarity distribution\n"; _pla->chiSquared(chisq,ndegrees,minfrac); generator()->log() << "Chi Square = " << chisq << " for " << ndegrees << " degrees of freedom for DELPHI planarity distribution\n"; _c->chiSquared(chisq,ndegrees,minfrac); generator()->log() << "Chi Square = " << chisq << " for " << ndegrees << " degrees of freedom for DELPHI C distribution\n"; _d->chiSquared(chisq,ndegrees,minfrac); generator()->log() << "Chi Square = " << chisq << " for " << ndegrees << " degrees of freedom for DELPHI D distribution\n"; _mhi->chiSquared(chisq,ndegrees,minfrac); generator()->log() << "Chi Square = " << chisq << " for " << ndegrees << " degrees of freedom for DELPHI m_high distribution\n"; _mlo->chiSquared(chisq,ndegrees,minfrac); generator()->log() << "Chi Square = " << chisq << " for " << ndegrees << " degrees of freedom for DELPHI m_low distribution\n"; _mdiff->chiSquared(chisq,ndegrees,minfrac); generator()->log() << "Chi Square = " << chisq << " for " << ndegrees << " degrees of freedom for DELPHI m_diff distribution\n"; _bmax->chiSquared(chisq,ndegrees,minfrac); generator()->log() << "Chi Square = " << chisq << " for " << ndegrees << " degrees of freedom for DELPHI B_max distribution\n"; _bmin->chiSquared(chisq,ndegrees,minfrac); generator()->log() << "Chi Square = " << chisq << " for " << ndegrees << " degrees of freedom for DELPHI B_min distribution\n"; _bsum->chiSquared(chisq,ndegrees,minfrac); generator()->log() << "Chi Square = " << chisq << " for " << ndegrees << " degrees of freedom for DELPHI B_sum distribution\n"; _bdiff->chiSquared(chisq,ndegrees,minfrac); generator()->log() << "Chi Square = " << chisq << " for " << ndegrees << " degrees of freedom for DELPHI B_diff distribution\n"; } void LEPEventShapes::doinitrun() { AnalysisHandler::doinitrun(); vector<double> bins,data,error; // 1-T double vals1[] = {0.000, 0.010, 0.020, 0.030, 0.040, 0.050, 0.060, 0.070, 0.080, 0.090, 0.100, 0.120, 0.140, 0.160, 0.180, 0.200, 0.250, 0.300, 0.350, 0.400, 0.500}; double data1[]= { 1.030,10.951,17.645,14.192,10.009, 7.572, 5.760, 4.619, 3.792, 3.176, 2.456, 1.825, 1.401, 1.074, 0.8262, 0.5525,0.3030,0.1312,0.0238,0.0007}; double error1stat[]={0.019 ,0.051 ,0.066 ,0.061 ,0.050 , 0.044 ,0.038 ,0.034 ,0.031 ,0.028 , 0.018 ,0.015 ,0.013 ,0.011 ,0.0100 , 0.0051 ,0.0038 ,0.0025 ,0.0012 ,0.0002 }; double error1syst[]={0.076 , 0.527 , 0.547 , 0.292 , 0.152 , 0.101 , 0.076 , 0.062 , 0.051 , 0.042 , 0.032 , 0.022 , 0.016 , 0.011 , 0.0083, 0.0065 , 0.0058, 0.0044, 0.0014, 0.0001}; double error1[20]; for(unsigned int ix=0;ix<20;++ix){error1[ix]=sqrt(sqr(error1stat[ix])+ sqr(error1syst[ix]));} bins = vector<double>(vals1 ,vals1 +21); data = vector<double>(data1 ,data1 +20); error = vector<double>(error1,error1+20); _omthr= new_ptr(Histogram(bins,data,error)); // major double vals2[] = {0.000, 0.020, 0.040, 0.050, 0.060, 0.070, 0.080, 0.100, 0.120, 0.140, 0.160, 0.200, 0.240, 0.280, 0.320, 0.360, 0.400, 0.440, 0.480, 0.520, 0.560, 0.600, 0.640}; double data2[]={0.00040 ,0.0590 ,0.642 ,2.178 ,4.303 , 5.849 ,6.889 ,6.342 ,4.890 ,3.900 , 2.960 ,2.124 ,1.5562 ,1.1807 ,0.8693, 0.6493 ,0.4820 ,0.3493 ,0.2497 ,0.1489, 0.0714 ,0.0203}; double error2stat[]={0.00090 ,0.0030 ,0.013 ,0.024 ,0.034 , 0.039 ,0.030 ,0.028 ,0.024 ,0.021 , 0.013 ,0.011 ,0.0095 ,0.0083 ,0.0071 , 0.0061 ,0.0052 ,0.0044 ,0.0037 ,0.0028 , 0.0019 ,0.0010}; double error2syst[]={0.00005 ,0.0058 ,0.028 ,0.086 ,0.155 , 0.192 ,0.194 ,0.143 ,0.085 ,0.050 , 0.030 ,0.021 ,0.0156 ,0.0118 ,0.0087 , 0.0065 ,0.0048 ,0.0055 ,0.0065 ,0.0058 , 0.0038 ,0.0014}; double error2[22]; for(unsigned int ix=0;ix<22;++ix){error2[ix]=sqrt(sqr(error2stat[ix])+ sqr(error2syst[ix]));} bins = vector<double>(vals2 ,vals2 +23); data = vector<double>(data2 ,data2 +22); error = vector<double>(error2,error2+22); _maj= new_ptr(Histogram(bins,data,error)); // minor double vals3[] = {0.000, 0.020, 0.040, 0.050, 0.060, 0.070, 0.080, 0.100, 0.120, 0.140, 0.160, 0.200, 0.240, 0.280, 0.320, 0.400}; double data3[]={ 0.0156 , 1.236 , 5.706 , 9.714 ,12.015 , 12.437 ,10.404 , 6.918 , 4.250 , 2.517 , 1.2561 , 0.4895 , 0.2112 , 0.0879 , 0.0250 }; double error3stat[]={0.0017 ,0.013 ,0.037 ,0.048 ,0.054 , 0.055 ,0.036 ,0.029 ,0.023 ,0.017 , 0.0086 ,0.0054 ,0.0036 ,0.0023 ,0.0009}; double error3syst[]={0.0036,0.066 ,0.073 ,0.125 ,0.155 , 0.161 ,0.136 ,0.092 ,0.058 ,0.035 , 0.0187,0.0080,0.0039,0.0018,0.0006}; double error3[15]; for(unsigned int ix=0;ix<15;++ix){error3[ix]=sqrt(sqr(error3stat[ix])+ sqr(error3syst[ix]));} bins = vector<double>(vals3 ,vals3 +16); data = vector<double>(data3 ,data3 +15); error = vector<double>(error3,error3+15); _min= new_ptr(Histogram(bins,data,error)); // oblateness double vals4[] = {0.000, 0.020, 0.040, 0.060, 0.080, 0.100, 0.120, 0.140, 0.160, 0.200, 0.240, 0.280, 0.320, 0.360, 0.400, 0.440, 0.520}; double data4[]={ 9.357 ,11.508 , 7.215 , 4.736 , 3.477 , 2.696 , 2.106 , 1.690 , 1.2648 , 0.8403 , 0.5674 , 0.3842 , 0.2573 , 0.1594 , 0.0836 , 0.0221 }; double error4stat[]={0.036 ,0.038 ,0.029 ,0.023 ,0.020 , 0.018 ,0.016 ,0.014 ,0.0085 ,0.0069 , 0.0056 ,0.0046 ,0.0037 ,0.0029 ,0.0020 , 0.0007}; double error4syst[]={0.178 ,0.140 ,0.072 ,0.047 ,0.035 , 0.027 ,0.021 ,0.017 ,0.0126,0.0087, 0.0065,0.0050,0.0043,0.0037,0.0030, 0.0015}; double error4[16]; for(unsigned int ix=0;ix<16;++ix){error4[ix]=sqrt(sqr(error4stat[ix])+ sqr(error4syst[ix]));} bins = vector<double>(vals4 ,vals4 +17); data = vector<double>(data4 ,data4 +16); error = vector<double>(error4,error4+16); _obl= new_ptr(Histogram(bins,data,error)); // sphericity double vals5[] = {0.000, 0.010, 0.020, 0.030, 0.040, 0.050, 0.060, 0.080, 0.100, 0.120, 0.160, 0.200, 0.250, 0.300, 0.350, 0.400, 0.500, 0.600, 0.700, 0.850}; double data5[]={16.198 ,20.008 ,12.896 , 8.237 , 5.885 , 4.458 , 3.272 , 2.290 , 1.699 , 1.2018 , 0.7988 , 0.5610 , 0.3926 , 0.2810 , 0.2099 , 0.1441 , 0.0842 , 0.04160 , 0.00758 }; double error5stat[]={0.067 ,0.072 ,0.056 ,0.043 ,0.037 , 0.032 ,0.019 ,0.016 ,0.014 ,0.0082 , 0.0067 ,0.0050 ,0.0042 ,0.0035 ,0.0030 , 0.0018 ,0.0013 ,0.00092 ,0.00032}; double error5syst[]={0.208 ,0.246 ,0.153 ,0.094 ,0.065 , 0.048 ,0.034 ,0.023 ,0.017 ,0.0120 , 0.0080 ,0.0063 ,0.0051 ,0.0043 ,0.0037 , 0.0032 ,0.0023 ,0.00129,0.00024}; double error5[19]; for(unsigned int ix=0;ix<19;++ix){error5[ix]=sqrt(sqr(error5stat[ix])+ sqr(error5syst[ix]));} bins = vector<double>(vals5 ,vals5 +20); data = vector<double>(data5 ,data5 +19); error = vector<double>(error5,error5+19); _sph=new_ptr(Histogram(bins,data,error)); // aplanarity double vals6[] = {0.000, 0.005, 0.010, 0.015, 0.020, 0.030, 0.040, 0.060, 0.080, 0.100, 0.120, 0.140, 0.160, 0.200, 0.250, 0.300}; double data6[]={75.10 ,55.31 ,26.03 ,13.927 , 6.768 , 3.014 , 1.281 , 0.5181 , 0.2619 , 0.1461 , 0.0758 , 0.0467 , 0.0234 , 0.00884 , 0.00310 }; double error6stat[]={0.19 ,0.17 ,0.11 ,0.079 ,0.038 , 0.025 ,0.012 ,0.0075 ,0.0054 ,0.0041 , 0.0029 ,0.0023 ,0.0011 ,0.00061 ,0.00040 }; double error6syst[]={0.75 ,0.55 ,0.28 ,0.176 ,0.098 , 0.056 ,0.035 ,0.0188 ,0.0118 ,0.0079 , 0.0043 ,0.0027 ,0.0014 ,0.00052,0.00018}; double error6[15]; for(unsigned int ix=0;ix<15;++ix){error6[ix]=sqrt(sqr(error6stat[ix])+ sqr(error6syst[ix]));} bins = vector<double>(vals6 ,vals6 +16); data = vector<double>(data6 ,data6 +15); error = vector<double>(error6,error6+15); _apl= new_ptr(Histogram(bins,data,error)); // planarity double vals7[] = {0.000, 0.005, 0.010, 0.015, 0.020, 0.025, 0.030, 0.035, 0.040, 0.050, 0.060, 0.080, 0.100, 0.120, 0.160, 0.200, 0.250, 0.300, 0.350, 0.400, 0.500}; double data7[]={68.69 ,31.66 ,17.091 ,11.370 , 8.417 , 6.578 , 5.479 , 4.493 , 3.610 , 2.749 , 1.987 , 1.362 , 1.008 , 0.6676 , 0.4248 , 0.2692 , 0.1742 , 0.1042 , 0.0566 , 0.0145 }; double error7stat[]={0.19 ,0.12 ,0.088 ,0.072 ,0.062 , 0.055 ,0.050 ,0.045 ,0.029 ,0.025 , 0.015 ,0.012 ,0.011 ,0.0061 ,0.0048 , 0.0034 ,0.0028 ,0.0021 ,0.0015 ,0.0006}; double error7syst[]={0.74 ,0.35 ,0.188 ,0.127 ,0.095 , 0.075 ,0.063 ,0.052 ,0.042 ,0.033 , 0.024 ,0.017 ,0.013 ,0.0093,0.0063, 0.0042 ,0.0029,0.0019,0.0011,0.0003}; double error7[20]; for(unsigned int ix=0;ix<20;++ix){error7[ix]=sqrt(sqr(error7stat[ix])+ sqr(error7syst[ix]));} bins = vector<double>(vals7 ,vals7 +21); data = vector<double>(data7 ,data7 +20); error = vector<double>(error7,error7+20); _pla= new_ptr(Histogram(bins,data,error)); // C double vals8[] = {0.000, 0.040, 0.080, 0.120, 0.160, 0.200, 0.240, 0.280, 0.320, 0.360, 0.400, 0.440, 0.480, 0.520, 0.560, 0.600, 0.640, 0.680, 0.720, 0.760, 0.800, 0.840, 0.880, 0.920}; double data8[]={0.0881 ,1.5383 ,3.909 ,3.833 ,2.835 , 2.164 ,1.716 ,1.3860 ,1.1623 ,0.9720 , 0.8349 ,0.7161 ,0.6205 ,0.5441 ,0.4844 , 0.4209 ,0.3699 ,0.3286 ,0.2813 ,0.2178 , 0.1287 ,0.0542 ,0.0212 }; double error8stat[]={0.0030 ,0.0100 ,0.016 ,0.016 ,0.013 , 0.012 ,0.010 ,0.0092 ,0.0084 ,0.0077 , 0.0072 ,0.0066 ,0.0061 ,0.0057 ,0.0054 , 0.0050 ,0.0046 ,0.0044 ,0.0040 ,0.0033 , 0.0026 ,0.0016 ,0.0009}; double error8syst[]={0.0067,0.0831,0.142 ,0.088 ,0.040 , 0.022 ,0.017 ,0.0139,0.0116,0.0097, 0.0083,0.0072,0.0062,0.0054,0.0050, 0.0063,0.0079,0.0099,0.0129,0.0151, 0.0130,0.0076,0.0040}; double error8[23]; for(unsigned int ix=0;ix<23;++ix){error8[ix]=sqrt(sqr(error8stat[ix])+ sqr(error8syst[ix]));} bins = vector<double>(vals8 ,vals8 +24); data = vector<double>(data8 ,data8 +23); error = vector<double>(error8,error8+23); _c= new_ptr(Histogram(bins,data,error)); // D double vals9[] = {0.000, 0.008, 0.016, 0.030, 0.044, 0.066, 0.088, 0.112, 0.136, 0.162, 0.188, 0.218, 0.248, 0.284, 0.320, 0.360, 0.400, 0.450, 0.500, 0.560, 0.620, 0.710, 0.800}; double data9[]={22.228 ,22.766 ,12.107 , 6.879 , 4.284 , 2.727 , 1.909 , 1.415 , 1.051 , 0.7977 , 0.6155 , 0.4566 , 0.3341 , 0.2452 , 0.1774 , 0.1234 , 0.0902 , 0.0603 , 0.0368 , 0.0222 , 0.0128 , 0.0052 }; double error9stat[]={0.082 ,0.085 ,0.047 ,0.035 ,0.022 , 0.018 ,0.014 ,0.012 ,0.010 ,0.0089 , 0.0073 ,0.0063 ,0.0049 ,0.0042 ,0.0033 , 0.0028 ,0.0021 ,0.0017 ,0.0012 ,0.0009 , 0.0006 ,0.0004}; double error9syst[]={0.868 ,0.440 ,0.150 ,0.079 ,0.053 , 0.036 ,0.028 ,0.022 ,0.018 ,0.0145, 0.0117 ,0.0089,0.0065,0.0049,0.0037 , 0.0028,0.0023 ,0.0018,0.0013,0.0009, 0.0006,0.0003}; double error9[22]; for(unsigned int ix=0;ix<22;++ix){error9[ix]=sqrt(sqr(error9stat[ix])+ sqr(error9syst[ix]));} bins = vector<double>(vals9 ,vals9 +23); data = vector<double>(data9 ,data9 +22); error = vector<double>(error9,error9+22); _d= new_ptr(Histogram(bins,data,error)); // M high double vals10[] = {0.000, 0.010, 0.020, 0.030, 0.040, 0.050, 0.060, 0.080, 0.100, 0.120, 0.140, 0.160, 0.200, 0.250, 0.300, 0.350, 0.400}; double data10[]={ 1.994 ,18.580 ,20.678 ,13.377 , 8.965 , 6.558 , 4.515 , 2.914 , 1.991 , 1.406 , 1.010 , 0.6319 , 0.3085 , 0.1115 , 0.0184 , 0.0008 }; double error10stat[]={0.027 ,0.065 ,0.076 ,0.060 ,0.049 , 0.041 ,0.024 ,0.019 ,0.016 ,0.013 , 0.011 ,0.0063 ,0.0039 ,0.0022 ,0.0008 , 0.0002 }; double error10syst[]={0.166 ,0.709 ,0.729 ,0.412 ,0.239 , 0.151 ,0.082 ,0.037 ,0.020 ,0.014 , 0.010 ,0.0063,0.0051,0.0039,0.0012, 0.0001}; double error10[16]; for(unsigned int ix=0;ix<16;++ix){error10[ix]=sqrt(sqr(error10stat[ix])+ sqr(error10syst[ix]));} bins = vector<double>(vals10 ,vals10 +17); data = vector<double>(data10 ,data10 +16); error = vector<double>(error10,error10+16); _mhi= new_ptr(Histogram(bins,data,error)); // M low double vals11[] = {0.000, 0.010, 0.020, 0.030, 0.040, 0.050, 0.060, 0.080, 0.100, 0.120}; double data11[]={23.414 ,39.12 ,18.080 , 7.704 , 3.922 , 2.128 , 1.013 , 0.3748 , 0.1412 }; double error11stat[]={0.074 ,0.11 ,0.081 ,0.052 ,0.036 , 0.026 ,0.013 ,0.0079 ,0.0050}; double error11syst[]={1.595 ,2.65 ,1.215 ,0.514 ,0.260 , 0.140 ,0.066 ,0.0241,0.0089}; double error11[9]; for(unsigned int ix=0;ix<9;++ix){error11[ix]=sqrt(sqr(error11stat[ix])+ sqr(error11syst[ix]));} bins = vector<double>(vals11 ,vals11 +10); data = vector<double>(data11 ,data11 + 9); error = vector<double>(error11,error11+ 9); _mlo= new_ptr(Histogram(bins,data,error)); // M diff double vals12[] = {0.000, 0.010, 0.020, 0.030, 0.040, 0.060, 0.080, 0.120, 0.160, 0.200, 0.250, 0.300, 0.350, 0.400}; double data12[]={35.393 ,20.745 ,11.426 , 7.170 , 4.344 , 2.605 , 1.4238 , 0.7061 , 0.3831 , 0.1836 , 0.0579 , 0.0075 , 0.0003}; double error12stat[]={0.092 ,0.071 ,0.052 ,0.041 ,0.023 , 0.017 ,0.0092 ,0.0064 ,0.0046 ,0.0028 , 0.0015 ,0.0006 ,0.0002}; double error12syst[]={0.354 ,0.207 ,0.114 ,0.072 ,0.043 , 0.026 ,0.0142,0.0071,0.0044,0.0032, 0.0018,0.0006,0.0001}; double error12[13]; for(unsigned int ix=0;ix<13;++ix){error12[ix]=sqrt(sqr(error12stat[ix])+ sqr(error12syst[ix]));} bins = vector<double>(vals12 ,vals12 +14); data = vector<double>(data12 ,data12 +13); error = vector<double>(error12,error12+13); _mdiff= new_ptr(Histogram(bins,data,error)); // Bmax double vals13[] = {0.010, 0.020, 0.030, 0.040, 0.050, 0.060, 0.070, 0.080, 0.100, 0.120, 0.140, 0.170, 0.200, 0.240, 0.280, 0.320}; double data13[]={0.6707 , 7.538 ,14.690 ,13.942 ,11.298 , 9.065 , 7.387 , 5.445 , 3.796 , 2.670 , 1.756 , 1.0580 , 0.5288 , 0.1460 , 0.0029 }; double error13stat[]={0.0096 ,0.038 ,0.058 ,0.057 ,0.053 , 0.048 ,0.043 ,0.026 ,0.022 ,0.018 , 0.012 ,0.0092 ,0.0056 ,0.0028 ,0.0004}; double error13syst[]={0.1077,0.809 ,0.745 ,0.592 ,0.379 , 0.266 ,0.222 ,0.176 ,0.127 ,0.087 , 0.051 ,0.0218,0.0053,0.0071,0.0003}; double error13[15]; for(unsigned int ix=0;ix<15;++ix){error13[ix]=sqrt(sqr(error13stat[ix])+ sqr(error13syst[ix]));} bins = vector<double>(vals13 ,vals13 +16); data = vector<double>(data13 ,data13 +15); error = vector<double>(error13,error13+15); _bmax= new_ptr(Histogram(bins,data,error)); // Bmin double vals14[] = {0.000, 0.010, 0.020, 0.030, 0.040, 0.050, 0.060, 0.080, 0.100, 0.120, 0.150, 0.180}; double data14[]={0.645 ,11.169 ,28.908 ,25.972 ,14.119 , 7.500 , 3.405 , 1.320 , 0.5448 , 0.1916 , 0.0366}; double error14stat[]={0.010 ,0.045 ,0.082 ,0.083 ,0.061 , 0.044 ,0.021 ,0.013 ,0.0082 ,0.0040 , 0.0017}; double error14syst[]={0.096 ,1.006 ,1.823 ,1.478 ,0.860 , 0.494 ,0.233 ,0.089 ,0.0328,0.0104, 0.0034}; double error14[11]; for(unsigned int ix=0;ix<11;++ix){error14[ix]=sqrt(sqr(error14stat[ix])+ sqr(error14syst[ix]));} bins = vector<double>(vals14 ,vals14 +12); data = vector<double>(data14 ,data14 +11); error = vector<double>(error14,error14+11); _bmin= new_ptr(Histogram(bins,data,error)); // Bsum double vals15[] = {0.020, 0.030, 0.040, 0.050, 0.060, 0.070, 0.080, 0.090, 0.100, 0.110, 0.130, 0.150, 0.170, 0.190, 0.210, 0.240, 0.270, 0.300, 0.330, 0.360}; double data15[]={0.2030 ,1.628 ,4.999 ,8.190 ,9.887 , 9.883 ,9.007 ,7.746 ,6.714 ,5.393 , 3.998 ,2.980 ,2.294 ,1.747 ,1.242 , 0.8125 ,0.4974 ,0.2285 ,0.0732 }; double error15stat[]={0.0055 ,0.015 ,0.031 ,0.041 ,0.047 , 0.049 ,0.047 ,0.044 ,0.041 ,0.026 , 0.023 ,0.019 ,0.017 ,0.015 ,0.010 , 0.0080 ,0.0062 ,0.0041 ,0.0024}; double error15syst[]={0.0383,0.183 ,0.463 ,0.644 ,0.661 , 0.564 ,0.443 ,0.332 ,0.255 ,0.180 , 0.125 ,0.098 ,0.085 ,0.075 ,0.063 , 0.0469,0.0296,0.0119,0.0007}; double error15[19]; for(unsigned int ix=0;ix<19;++ix){error15[ix]=sqrt(sqr(error15stat[ix])+ sqr(error15syst[ix]));} bins = vector<double>(vals15 ,vals15 +20); data = vector<double>(data15 ,data15 +19); error = vector<double>(error15,error15+19); _bsum= new_ptr(Histogram(bins,data,error)); // Bdiff double vals16[] = {0.000, 0.010, 0.020, 0.030, 0.040, 0.050, 0.060, 0.070, 0.080, 0.090, 0.100, 0.120, 0.140, 0.160, 0.180, 0.200, 0.240, 0.280}; double data16[]={26.630 ,18.684 ,12.343 , 8.819 , 6.688 , 5.111 , 4.071 , 3.271 , 2.681 , 2.233 , 1.647 , 1.111 , 0.7618 , 0.5138 , 0.3167 , 0.1265 , 0.0117}; double error16stat[]={0.081 ,0.066 ,0.054 ,0.046 ,0.040 , 0.035 ,0.031 ,0.028 ,0.025 ,0.023 , 0.014 ,0.011 ,0.0095 ,0.0078 ,0.0062 , 0.0026 ,0.0008}; double error16syst[]={0.459 ,0.292 ,0.186 ,0.134 ,0.106 , 0.084 ,0.068 ,0.054 ,0.043 ,0.035 , 0.026 ,0.019 ,0.0144,0.0119,0.0098, 0.0056,0.0008}; double error16[17]; for(unsigned int ix=0;ix<17;++ix){error16[ix]=sqrt(sqr(error16stat[ix])+ sqr(error16syst[ix]));} bins = vector<double>(vals16 ,vals16 +18); data = vector<double>(data16 ,data16 +17); error = vector<double>(error16,error16+17); _bdiff= new_ptr(Histogram(bins,data,error)); } diff --git a/Analysis/LEPEventShapes.h b/Analysis/LEPEventShapes.h --- a/Analysis/LEPEventShapes.h +++ b/Analysis/LEPEventShapes.h @@ -1,270 +1,233 @@ // -*- C++ -*- // // LEPEventShapes.h is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #ifndef HERWIG_LEPEventShapes_H #define HERWIG_LEPEventShapes_H // // This is the declaration of the LEPEventShapes class. // #include "ThePEG/Handlers/AnalysisHandler.h" #include "ThePEG/Vectors/Lorentz5Vector.h" #include "EventShapes.h" #include "Herwig/Utilities/Histogram.h" namespace Herwig { using namespace ThePEG; /** \ingroup Analysis * The LEPEventShapes class performs the analysis of global event shapes and * compares with LEP data. This handler is solely intended as a slave * handler for the EventShapesMasterAnalysis class. * * @see \ref LEPEventShapesInterfaces "The interfaces" * defined for LEPEventShapes */ class LEPEventShapes: public AnalysisHandler { public: /** @name Virtual functions required by the AnalysisHandler class. */ //@{ /** * Analyze a given Event. Note that a fully generated event * may be presented several times, if it has been manipulated in * between. The default version of this function will call transform * to make a lorentz transformation of the whole event, then extract * all final state particles and call analyze(tPVector) of this * analysis object and those of all associated analysis objects. The * default version will not, however, do anything on events which * have not been fully generated, or have been manipulated in any * way. * @param event pointer to the Event to be analyzed. * @param ieve the event number. * @param loop the number of times this event has been presented. * If negative the event is now fully generated. * @param state a number different from zero if the event has been * manipulated in some way since it was last presented. */ virtual void analyze(tEventPtr event, long ieve, int loop, int state); /** * Transform the event to the desired Lorentz frame and return the * corresponding LorentzRotation. * @param event a pointer to the Event to be transformed. * @return the LorentzRotation used in the transformation. */ virtual LorentzRotation transform(tEventPtr event) const; /** * Analyze the given vector of particles. The default version calls * analyze(tPPtr) for each of the particles. * @param particles the vector of pointers to particles to be analyzed */ virtual void analyze(const tPVector & particles); using AnalysisHandler::analyze; //@} public: /** @name Functions used by the persistent I/O system. */ //@{ /** * Function used to write out object persistently. * @param os the persistent output stream written to. */ void persistentOutput(PersistentOStream & os) const; /** * Function used to read in object persistently. * @param is the persistent input stream read from. * @param version the version number of the object when written. */ void persistentInput(PersistentIStream & is, int version); //@} /** * The standard Init function used to initialize the interfaces. * Called exactly once for each class by the class description system * before the main function starts or * when this class is dynamically loaded. */ static void Init(); protected: /** @name Clone Methods. */ //@{ /** * Make a simple clone of this object. * @return a pointer to the new object. */ virtual IBPtr clone() const {return new_ptr(*this);} /** Make a clone of this object, possibly modifying the cloned object * to make it sane. * @return a pointer to the new object. */ virtual IBPtr fullclone() const {return new_ptr(*this);} //@} protected: /** @name Standard Interfaced functions. */ //@{ /** * Initialize this object. Called in the run phase just before * a run begins. */ virtual void doinitrun(); /** * Finalize this object. Called in the run phase just after a * run has ended. Used eg. to write out statistics. */ virtual void dofinish(); //@} private: /** - * The static object used to initialize the description of this class. - * Indicates that this is a concrete class with persistent data. - */ - static ClassDescription<LEPEventShapes> initLEPEventShapes; - - /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ LEPEventShapes & operator=(const LEPEventShapes &); private: /** * Histogram for \f$1-T\f$ distribution. */ HistogramPtr _omthr; /** * Histogram for the major distribution */ HistogramPtr _maj; /** * Histogram for the minor distribution */ HistogramPtr _min; /** * Histogram for the oblateness distribution */ HistogramPtr _obl; /** * Histogram for the sphericity distribution */ HistogramPtr _sph; /** * Histogram for the aplanarity distribution */ HistogramPtr _apl; /** * Histogram for the planarity distribution */ HistogramPtr _pla; /** * Histogram for the C distribution */ HistogramPtr _c; /** * Histogram for the D distribution */ HistogramPtr _d; /** * Histogram for the \f$M_{\rm high}\f$ distribution */ HistogramPtr _mhi; /** * Histogram for the \f$M_{\rm low}\f$ distribution */ HistogramPtr _mlo; /** * Histogram for the \f$M_{\rm high}-M_{\rm low}\f$ distribution */ HistogramPtr _mdiff; /** * Histogram for the \f$B_{\rm max}\f$ distribution */ HistogramPtr _bmax; /** * Histogram for the \f$B_{\rm min}\f$ distribution */ HistogramPtr _bmin; /** * Histogram for the \f$B_{\rm max}+B_{\rm min}\f$ distribution */ HistogramPtr _bsum; /** * Histogram for the \f$B_{\rm max}-B_{\rm min}\f$ distribution */ HistogramPtr _bdiff; /** * Pointer to the object which calculates the event shapes */ EventShapesPtr _shapes; }; } -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** This template specialization informs ThePEG about the - * base classes of LEPEventShapes. */ -template <> -struct BaseClassTrait<Herwig::LEPEventShapes,1> { - /** Typedef of the first base class of LEPEventShapes. */ - typedef AnalysisHandler NthBase; -}; - -/** This template specialization informs ThePEG about the name of - * the LEPEventShapes class and the shared object where it is defined. */ -template <> -struct ClassTraits<Herwig::LEPEventShapes> - : public ClassTraitsBase<Herwig::LEPEventShapes> { - /** Return a platform-independent class name */ - static string className() { return "Herwig::LEPEventShapes"; } - /** Return the name(s) of the shared library (or libraries) be loaded to get - * access to the LEPEventShapes class and any other class on which it depends - * (except the base class). */ - static string library() { return "HwAnalysis.so HwLEPAnalysis.so"; } -}; - -/** @endcond */ - -} - #endif /* HERWIG_LEPEventShapes_H */ diff --git a/Analysis/LEPMultiplicityCount.cc b/Analysis/LEPMultiplicityCount.cc --- a/Analysis/LEPMultiplicityCount.cc +++ b/Analysis/LEPMultiplicityCount.cc @@ -1,421 +1,424 @@ // -*- C++ -*- // // LEPMultiplicityCount.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the LEPMultiplicityCount class. // #include "LEPMultiplicityCount.h" +#include "ThePEG/Utilities/DescribeClass.h" #include "ThePEG/Interface/ParVector.h" #include "ThePEG/Interface/Switch.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/EventRecord/StandardSelectors.h" #include "ThePEG/EventRecord/Event.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" #include "Herwig/Utilities/EnumParticles.h" #include "Herwig/Hadronization/Cluster.h" #include <iostream> #include <sstream> #include <fstream> using namespace Herwig; using namespace ThePEG; IBPtr LEPMultiplicityCount::clone() const { return new_ptr(*this); } IBPtr LEPMultiplicityCount::fullclone() const { return new_ptr(*this); } LEPMultiplicityCount::LEPMultiplicityCount() : _makeHistograms(false) { // Average particle multiplicities in hadronic Z decay // PDG 2006 with 2007 partial update // all charged _data[0] = MultiplicityInfo(20.76, 0.16, lightMeson); // all charged // gamma _data[22] = MultiplicityInfo(20.97, 1.17, lightMeson); // pi+, pi0, eta _data[211] = MultiplicityInfo(17.03, 0.16, lightMeson); _data[111] = MultiplicityInfo( 9.76, 0.26, lightMeson); _data[221] = MultiplicityInfo( 1.01, 0.08, lightMeson); // rho+, rho0, omega, eta' _data[213] = MultiplicityInfo( 2.40, 0.49, lightMeson); _data[113] = MultiplicityInfo( 1.24, 0.10, lightMeson); _data[223] = MultiplicityInfo( 1.02, 0.06, lightMeson); _data[331] = MultiplicityInfo( 0.17, 0.05, lightMeson); // f_0(980), a_0(980), phi _data[10221] = MultiplicityInfo(0.147, 0.011, other); _data[9000211] = MultiplicityInfo(0.27, 0.14, other); _data[333] = MultiplicityInfo(0.098, 0.006, strangeMeson); // f_2(1270), f_1(1285), f_2'(1525), K+, K0 _data[225] = MultiplicityInfo(0.169, 0.025, other); _data[20223] = MultiplicityInfo(0.165, 0.051, other); _data[335] = MultiplicityInfo(0.012, 0.006, other); _data[321] = MultiplicityInfo(2.24, 0.04, strangeMeson); _data[311] = MultiplicityInfo(2.039, 0.025, lightMeson); // K*+(892), K*0(892), K*_2(1430) _data[323] = MultiplicityInfo(0.72, 0.05, strangeMeson); _data[313] = MultiplicityInfo(0.739, 0.022, strangeMeson); _data[315] = MultiplicityInfo(0.073, 0.023, strangeMeson); // D+, D0, D_s+ _data[411] = MultiplicityInfo(0.187, 0.020, other); _data[421] = MultiplicityInfo(0.462, 0.026, other); _data[431] = MultiplicityInfo(0.131, 0.028, other); // D*+(2010), J/Psi(1S), Psi(2S) _data[413] = MultiplicityInfo(0.183, 0.008, other); _data[443] = MultiplicityInfo(0.0056, 0.0007, other); _data[100443] = MultiplicityInfo(0.0023, 0.0007, other); // p, Delta++(1232), Lambda, Sigma+, Sigma-, Sigma0 _data[2212] = MultiplicityInfo(1.046, 0.026, lightBaryon); _data[2224] = MultiplicityInfo(0.087, 0.033, lightBaryon); _data[3122] = MultiplicityInfo(0.388, 0.009, lightBaryon); _data[3222] = MultiplicityInfo(0.107, 0.010, lightBaryon); _data[3112] = MultiplicityInfo(0.082, 0.007, lightBaryon); _data[3212] = MultiplicityInfo(0.076, 0.010, lightBaryon); // Sigma*+, Sigma*-, Xi-, Xi*0, Omega- _data[3224] = MultiplicityInfo(0.0239, 0.0021, lightBaryon); _data[3114] = MultiplicityInfo(0.0240, 0.0024, lightBaryon); _data[3312] = MultiplicityInfo(0.0258, 0.0009, lightBaryon); _data[3324] = MultiplicityInfo(0.0059, 0.0011, lightBaryon); _data[3334] = MultiplicityInfo(0.00164, 0.00028, lightBaryon); // Lambda_c+ _data[4122] = MultiplicityInfo(0.078, 0.024, other); // old values from 1.0 paper // _data[433] = MultiplicityInfo(0.096, 0.046, other); _data[2112] = MultiplicityInfo(0.991, 0.054, lightBaryon); // _data[2214] = MultiplicityInfo(0., 0., lightBaryon); // _data[2114] = MultiplicityInfo(0., 0., lightBaryon); // values unknown // B mesons // _data[513] = MultiplicityInfo(0.28, 0.04, other); // flavour averaged value! _data[513] = MultiplicityInfo(0., 0., other); _data[511] = MultiplicityInfo(0., 0., other); // B0 _data[521] = MultiplicityInfo(0., 0., other); // B+ _data[531] = MultiplicityInfo(0., 0., other); // B_s _data[541] = MultiplicityInfo(0., 0., other); // B_c // B baryons _data[5122] = MultiplicityInfo(0., 0., other); // Lambda_b _data[5112] = MultiplicityInfo(0., 0., other); // Sig_b- _data[5212] = MultiplicityInfo(0., 0., other); // Sig_b0 _data[5222] = MultiplicityInfo(0., 0., other); // Sig_b+ _data[5132] = MultiplicityInfo(0., 0., other); // Xi_b- _data[5232] = MultiplicityInfo(0., 0., other); // Xi_b0 _data[5312] = MultiplicityInfo(0., 0., other); // Xi'_b- _data[5322] = MultiplicityInfo(0., 0., other); // Xi'_b0 _data[5332] = MultiplicityInfo(0., 0., other); // Omega_b- } namespace { bool isLastCluster(tcPPtr p) { if ( p->id() != ParticleID::Cluster ) return false; for ( size_t i = 0, end = p->children().size(); i < end; ++i ) { if ( p->children()[i]->id() == ParticleID::Cluster ) return false; } return true; } Energy parentClusterMass(tcPPtr p) { if (p->parents().empty()) return -1.0*MeV; tcPPtr parent = p->parents()[0]; if (parent->id() == ParticleID::Cluster) { if ( isLastCluster(parent) ) return parent->mass(); else return p->mass(); } else return parentClusterMass(parent); } bool isPrimaryCluster(tcPPtr p) { if ( p->id() != ParticleID::Cluster ) return false; if( p->parents().empty()) return false; for ( size_t i = 0, end = p->parents().size(); i < end; ++i ) { if ( !(p->parents()[i]->dataPtr()->coloured()) ) return false; } return true; } } void LEPMultiplicityCount::analyze(tEventPtr event, long, int, int) { set<tcPPtr> particles; event->selectFinalState(inserter(particles)); map <long,long> eventcount; for(set<tcPPtr>::const_iterator it = particles.begin(); it != particles.end(); ++it) { if((*it)->dataPtr()->charged()) ++eventcount[0]; long ID = abs( (*it)->id() ); ++_finalstatecount[ID]; } // ======== StepVector steps = event->primaryCollision()->steps(); particles.clear(); steps[0]->select(inserter(particles), ThePEG::AllSelector()); for(set<tcPPtr>::const_iterator it = particles.begin(); it != particles.end(); ++it) { long ID = (*it)->id(); ++_collisioncount[ID]; } // ======= particles.clear(); if (steps.size() > 2) { for ( StepVector::const_iterator it = steps.begin()+2; it != steps.end(); ++it ) { (**it).select(inserter(particles), ThePEG::AllSelector()); } } if( _makeHistograms ) _histograms.insert(make_pair(ParticleID::Cluster, Histogram(0.0,10.0,200))); for(set<tcPPtr>::const_iterator it = particles.begin(); it != particles.end(); ++it) { long ID = abs( (*it)->id() ); if(ID==ParticleID::K0) continue; if(ID==ParticleID::K_L0||ID==ParticleID::K_S0) ID=ParticleID::K0; if ( _makeHistograms && isLastCluster(*it) ) { _histograms[ParticleID::Cluster] += (*it)->mass()/GeV; tcClusterPtr clu = dynamic_ptr_cast<tcClusterPtr>(*it); if (clu) { _clusters.insert(make_pair(clu->clusterId(), Histogram(0.0,10.0,200))); _clusters[clu->clusterId()] += (*it)->mass()/GeV; } } if( _makeHistograms && isPrimaryCluster(*it) ) { _primary.insert(make_pair(0, Histogram(0.0,20.0,400))); _primary[0] += (*it)->mass()/GeV; tcClusterPtr clu = dynamic_ptr_cast<tcClusterPtr>(*it); if(clu) { _primary.insert(make_pair(clu->clusterId(), Histogram(0.0,20.0,400))); _primary[clu->clusterId()] += (*it)->mass()/GeV; } } if (_data.find(ID) != _data.end()) { ++eventcount[ID]; if (_makeHistograms && ! (*it)->parents().empty() && (*it)->parents()[0]->id() == ParticleID::Cluster) { _histograms.insert(make_pair(ID,Histogram(0.0,10.0,200))); _histograms[ID] += parentClusterMass(*it)/GeV; } } } for(map<long,MultiplicityInfo>::iterator it = _data.begin(); it != _data.end(); ++it) { long currentcount = eventcount.find(it->first) == eventcount.end() ? 0 : eventcount[it->first]; it->second.count += currentcount; } } void LEPMultiplicityCount::analyze(const tPVector & ) {} void LEPMultiplicityCount::dofinish() { useMe(); string filename = generator()->filename() + ".mult"; ofstream outfile(filename.c_str()); outfile << "\nParticle multiplicities (compared to LEP data):\n" " ID Name simMult obsMult obsErr Sigma\n"; for (map<long,MultiplicityInfo>::const_iterator it = _data.begin(); it != _data.end(); ++it) { MultiplicityInfo multiplicity = it->second; string name = (it->first==0 ? "All chgd" : generator()->getParticleData(it->first)->PDGName() ); ios::fmtflags oldFlags = outfile.flags(); outfile << std::scientific << std::showpoint << std::setprecision(3) << setw(7) << it->first << ' ' << setw(9) << name << ' ' << setw(2) << multiplicity.simMultiplicity() << " | " << setw(2) << multiplicity.obsMultiplicity << " +/- " << setw(2) << multiplicity.obsError << ' ' << std::showpos << std::setprecision(1) << multiplicity.nSigma() << ' ' << multiplicity.bargraph() << std::noshowpos; outfile << '\n'; outfile.flags(oldFlags); } outfile << "\nCount of particles involved in hard process:\n"; for (map<long,long>::const_iterator it = _collisioncount.begin(); it != _collisioncount.end(); ++ it) { string name = generator()->getParticleData(it->first)->PDGName(); outfile << name << '\t' << it->second << '\n'; } outfile << "\nFinal state particle count:\n"; for (map<long,long>::const_iterator it = _finalstatecount.begin(); it != _finalstatecount.end(); ++ it) { string name = generator()->getParticleData(it->first)->PDGName(); outfile << name << '\t' << it->second << '\n'; } outfile.close(); if (_makeHistograms) { Histogram piratio = _histograms[ParticleID::piplus].ratioWith(_histograms[ParticleID::pi0]); Histogram Kratio = _histograms[ParticleID::Kplus].ratioWith(_histograms[ParticleID::K0]); using namespace HistogramOptions; string histofilename = filename + ".top"; ofstream outfile2(histofilename.c_str()); for (map<int,Histogram>::const_iterator it = _primary.begin(); it != _primary.end(); ++it) { ostringstream title1; title1 << "Primary Cluster " << it->first; string title = title1.str(); it->second.topdrawOutput(outfile2,Frame|Ylog,"BLACK",title,"", "N (200 bins)","","Cluster mass [GeV]"); } map<long,Histogram>::const_iterator cit = _histograms.find(ParticleID::Cluster); string title = generator()->getParticleData(cit->first)->PDGName(); cit->second.topdrawOutput(outfile2,Frame|Ylog,"BLACK",title,"", "N (200 bins)","","Parent cluster mass [GeV]"); for (map<int,Histogram>::const_iterator it = _clusters.begin(); it != _clusters.end(); ++it) { ostringstream title1; title1 << "Final Cluster " << it->first; string title = title1.str(); it->second.topdrawOutput(outfile2,Frame|Rawcount|Ylog,"BLACK",title,"", "N (200 bins)","","Cluster mass [GeV]"); } for (map<long,Histogram>::const_iterator it = _histograms.begin(); it != _histograms.end(); ++it) { string title = generator()->getParticleData(it->first)->PDGName(); it->second.topdrawOutput(outfile2,Frame|Rawcount|Ylog,"BLACK",title,"", "N (200 bins)","","Parent cluster mass [GeV]"); } piratio.topdrawOutput(outfile2,Frame|Rawcount,"BLACK","pi+ / pi0","", "","","Parent cluster mass [GeV]"); Kratio.topdrawOutput(outfile2,Frame|Rawcount,"BLACK","K+ / K0","", "","","Parent cluster mass [GeV]"); outfile2.close(); } AnalysisHandler::dofinish(); } -ClassDescription<LEPMultiplicityCount> LEPMultiplicityCount::initLEPMultiplicityCount; -// Definition of the static class description member. +// The following static variable is needed for the type +// description system in ThePEG. +DescribeClass<LEPMultiplicityCount,AnalysisHandler> +describeHerwigLEPMultiplicityCount("Herwig::LEPMultiplicityCount", "HwAnalysis.so"); void LEPMultiplicityCount::Init() { static ParVector<LEPMultiplicityCount,long> interfaceparticlecodes ("ParticleCodes", "The PDG code for the particles", &LEPMultiplicityCount::_particlecodes, 0, 0, 0, -10000000, 10000000, false, false, true); static ParVector<LEPMultiplicityCount,double> interfaceMultiplicity ("Multiplicity", "The multiplicity for the particle", &LEPMultiplicityCount::_multiplicity, 0, 0, 0, 0., 1000., false, false, true); static ParVector<LEPMultiplicityCount,double> interfaceError ("Error", "The error on the multiplicity for the particle", &LEPMultiplicityCount::_error, 0, 0, 0, 0., 1000., false, false, true); static ParVector<LEPMultiplicityCount,unsigned int> interfaceSpecies ("Species", "The type of particle", &LEPMultiplicityCount::_species, 0, 0, other, 0, other, false, false, true); static Switch<LEPMultiplicityCount,bool> interfaceHistograms ("Histograms", "Set to On if detailed histograms are required.", &LEPMultiplicityCount::_makeHistograms, false, true, false); static SwitchOption interfaceHistogramsYes (interfaceHistograms, "Yes", "Generate histograms of cluster mass dependence.", true); static SwitchOption interfaceHistogramsNo (interfaceHistograms, "No", "Do not generate histograms.", false); static ClassDocumentation<LEPMultiplicityCount> documentation ("The LEPMultiplicityCount class count the multiplcities of final-state particles" " and compares them with LEP data.", "The LEP multiplicity analysis uses data from PDG 2006 \\cite{Yao:2006px}.", "%\\cite{Yao:2006px}\n" "\\bibitem{Yao:2006px}\n" " W.~M.~Yao {\\it et al.} [Particle Data Group],\n" " %``Review of particle physics,''\n" " J.\\ Phys.\\ G {\\bf 33} (2006) 1.\n" " %%CITATION = JPHGB,G33,1;%%\n" ); } void LEPMultiplicityCount::persistentOutput(PersistentOStream & os) const { os << _particlecodes << _multiplicity << _error << _species << _makeHistograms; } void LEPMultiplicityCount::persistentInput(PersistentIStream & is, int) { is >> _particlecodes >> _multiplicity >> _error >> _species >> _makeHistograms; } diff --git a/Analysis/LEPMultiplicityCount.h b/Analysis/LEPMultiplicityCount.h --- a/Analysis/LEPMultiplicityCount.h +++ b/Analysis/LEPMultiplicityCount.h @@ -1,231 +1,194 @@ // -*- C++ -*- // // LEPMultiplicityCount.h is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #ifndef HERWIG_LEPMultiplicityCount_H #define HERWIG_LEPMultiplicityCount_H // // This is the declaration of the LEPMultiplicityCount class. // #include "ThePEG/Handlers/AnalysisHandler.h" #include "ThePEG/Repository/Repository.h" #include "ThePEG/PDT/ParticleData.h" #include "Herwig/Utilities/Histogram.h" #include "MultiplicityInfo.h" namespace Herwig { using namespace ThePEG; /** \ingroup Analysis * The LEPMultiplicityCount class is designed to count particle multiplicities and * compare them to LEP data. * * @see \ref LEPMultiplicityCountInterfaces "The interfaces" * defined for LEPMultiplicityCount. */ class LEPMultiplicityCount: public AnalysisHandler { public: /** * The default constructor. */ LEPMultiplicityCount(); public: /** @name Virtual functions required by the AnalysisHandler class. */ //@{ /** * Analyze a given Event. Note that a fully generated event * may be presented several times, if it has been manipulated in * between. The default version of this function will call transform * to make a lorentz transformation of the whole event, then extract * all final state particles and call analyze(tPVector) of this * analysis object and those of all associated analysis objects. The * default version will not, however, do anything on events which * have not been fully generated, or have been manipulated in any * way. * @param event pointer to the Event to be analyzed. * @param ieve the event number. * @param loop the number of times this event has been presented. * If negative the event is now fully generated. * @param state a number different from zero if the event has been * manipulated in some way since it was last presented. */ virtual void analyze(tEventPtr event, long ieve, int loop, int state); /** * Analyze the given vector of particles. The default version calls * analyze(tPPtr) for each of the particles. * @param particles the vector of pointers to particles to be analyzed */ virtual void analyze(const tPVector & particles); using AnalysisHandler::analyze; //@} public: /** @name Functions used by the persistent I/O system. */ //@{ /** * Function used to write out object persistently. * @param os the persistent output stream written to. */ void persistentOutput(PersistentOStream & os) const; /** * Function used to read in object persistently. * @param is the persistent input stream read from. * @param version the version number of the object when written. */ void persistentInput(PersistentIStream & is, int version); //@} /** * The standard Init function used to initialize the interfaces. * Called exactly once for each class by the class description system * before the main function starts or * when this class is dynamically loaded. */ static void Init(); protected: /** @name Clone Methods. */ //@{ /** * Make a simple clone of this object. * @return a pointer to the new object. */ virtual IBPtr clone() const; /** Make a clone of this object, possibly modifying the cloned object * to make it sane. * @return a pointer to the new object. */ virtual IBPtr fullclone() const; //@} protected: /** @name Standard Interfaced functions. */ //@{ /** * Finalize this object. Called in the run phase just after a * run has ended. Used eg. to write out statistics. */ virtual void dofinish(); //@} private: /** - * The static object used to initialize the description of this class. - * Indicates that this is a concrete class with persistent data. - */ - static ClassDescription<LEPMultiplicityCount> initLEPMultiplicityCount; - - /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ LEPMultiplicityCount & operator=(const LEPMultiplicityCount &); private: /** * The PDG codes of the particles */ vector<long> _particlecodes; /** * The multiplcity */ vector<double> _multiplicity; /** * The error */ vector<double> _error; /** * Species of particle */ vector<unsigned int> _species; /** * Map of PDG codes to multiplicity info */ map<long,MultiplicityInfo> _data; /// Histograms for cluster mass dependence map<long,Histogram> _histograms; /** * Histograms of the clusters after cluster splitting */ map<int,Histogram> _clusters; /** * Histograms of the primary clusters */ map<int,Histogram> _primary; /** * Map of number of final-state particles to PDG code */ map<long,long> _finalstatecount; /** * Particles in hard process */ map<long,long> _collisioncount; /// Make histograms of cluster mass dependence bool _makeHistograms; }; } -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** This template specialization informs ThePEG about the - * base classes of LEPMultiplicityCount. */ -template <> -struct BaseClassTrait<Herwig::LEPMultiplicityCount,1> { - /** Typedef of the first base class of LEPMultiplicityCount. */ - typedef AnalysisHandler NthBase; -}; - -/** This template specialization informs ThePEG about the name of - * the LEPMultiplicityCount class and the shared object where it is defined. */ -template <> -struct ClassTraits<Herwig::LEPMultiplicityCount> - : public ClassTraitsBase<Herwig::LEPMultiplicityCount> { - /** Return a platform-independent class name */ - static string className() { return "Herwig::LEPMultiplicityCount"; } - /** Return the name(s) of the shared library (or libraries) be loaded to get - * access to the LEPMultiplicityCount class and any other class on which it depends - * (except the base class). */ - static string library() { return "HwAnalysis.so"; } -}; - -/** @endcond */ - -} - #endif /* HERWIG_LEPMultiplicityCount_H */ diff --git a/Analysis/LPairAnalysis.cc b/Analysis/LPairAnalysis.cc --- a/Analysis/LPairAnalysis.cc +++ b/Analysis/LPairAnalysis.cc @@ -1,156 +1,159 @@ // -*- C++ -*- // // This is the implementation of the non-inlined, non-templated member // functions of the LPairAnalysis class. // #include "LPairAnalysis.h" +#include "ThePEG/Utilities/DescribeClass.h" #include "ThePEG/Repository/EventGenerator.h" #include "ThePEG/EventRecord/Particle.h" #include "ThePEG/EventRecord/Event.h" #include "ThePEG/PDT/EnumParticles.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" using namespace Herwig; namespace { inline Lorentz5Momentum getMomentum(tcPPtr particle) { return particle->momentum(); } inline bool isLeptonPlus(tcPPtr p) { if ( p->id() == ParticleID::eplus || p->id() == ParticleID::muplus || p->id() == ParticleID::tauplus ) { return true; }else { return false; } } inline bool isLeptonMinus(tcPPtr p) { if ( p->id() == ParticleID::eminus || p->id() == ParticleID::muminus || p->id() == ParticleID::tauminus ) { return true; }else { return false; } } inline bool isFromTop(tcPPtr p) { while (p->parents()[0] && p->parents().size() == 1) { p = p->parents()[0]; if (abs(p->id()) == ParticleID::t) { return true; } } return false; } } LPairAnalysis::LPairAnalysis() : _ptp(0.,250.,100), _ptm(0.,250.,100), _ptpair(0.,250.,100), _etp(0.,250.,100), _etm(0.,250.,100), _etpair(0.,250.,100), _ep(0.,1000.,100), _em(1.,3000.,100), _epair(0.,1500.,100), _rapp(-5.,5.,100), _rapm(-5.,5.,100), _rappair(-5.,5.,100), _phip(-Constants::pi,Constants::pi,50), _phim(-Constants::pi,Constants::pi,50), _deltaphi(-Constants::pi,Constants::pi,100), _mpair(0,750,100), _etsum(0.,400.,100), _ptsum(0.,400.,100) {} void LPairAnalysis::dofinish() { AnalysisHandler::dofinish(); string fname = generator()->filename() + string("-") + name() + string(".top"); ofstream outfile(fname.c_str()); using namespace HistogramOptions; _ptp.topdrawOutput(outfile,Frame|Ylog,"RED","pt lp, lm"); _ptm.topdrawOutput(outfile,Ylog,"BLUE",""); _ptpair.topdrawOutput(outfile,Frame|Ylog,"BLACK","pt pair"); _etp.topdrawOutput(outfile,Frame|Ylog,"RED","Et lp, lm"); _etm.topdrawOutput(outfile,Ylog,"BLUE",""); _etpair.topdrawOutput(outfile,Frame|Ylog,"BLACK","Et pair"); _ep.topdrawOutput(outfile,Frame|Ylog,"RED","E lp, lm"); _em.topdrawOutput(outfile,Ylog,"BLUE",""); _epair.topdrawOutput(outfile,Frame|Ylog,"BLACK","E pair"); _rapp.topdrawOutput(outfile,Frame,"RED","y lp, lm"); _rapm.topdrawOutput(outfile,None,"BLUE",""); _rappair.topdrawOutput(outfile,Frame,"BLACK","y pair"); _phip.topdrawOutput(outfile,Frame,"RED","phi lp, lm"); _phim.topdrawOutput(outfile,None,"BLUE",""); _deltaphi.topdrawOutput(outfile,Frame,"BLACK","Delta phi"); _mpair.topdrawOutput(outfile,Frame|Ylog,"BLACK","M pair"); _etsum.topdrawOutput(outfile,Frame|Ylog,"BLACK","pt sum"); _ptsum.topdrawOutput(outfile,Frame|Ylog,"BLACK","Et sum"); } void LPairAnalysis::analyze(tEventPtr event, long, int, int) { Lorentz5Momentum ppair, plp, plm; bool foundlp = false; bool foundlm = false; set<tcPPtr> particles; event->selectFinalState(inserter(particles)); // find highest pt lepton+ and lepton- in the event resp. for(set<tcPPtr>::const_iterator it = particles.begin(); it != particles.end(); ++it) { if( isLeptonPlus(*it) ) { // if ( getMomentum(*it).perp() > plp.perp() ) { if (isFromTop(*it)) { plp = getMomentum(*it); foundlp = true; } } else if( isLeptonMinus(*it) ) { // if ( getMomentum(*it).perp() > plm.perp() ) { if (isFromTop(*it)) { plm = getMomentum(*it); foundlm = true; } } } if (foundlp && foundlm) { ppair = plp + plm; _ptp += plp.perp()/GeV; _ptm += plm.perp()/GeV; _ptpair += ppair.perp()/GeV; _etp += plp.et()/GeV; _etm += plm.et()/GeV; _etpair += ppair.et()/GeV; _ep += plp.e()/GeV; _em += plm.e()/GeV; _epair += ppair.e()/GeV; _rapp += plp.rapidity(); _rapm += plm.rapidity(); _rappair += ppair.rapidity(); _phip += plp.phi(); _phim += plm.phi(); _deltaphi += (plp.vect()).deltaPhi(plm.vect()); _mpair += ppair.m()/GeV; _etsum += (plp.et() + plm.et())/GeV; _ptsum += (plp.perp() + plm.perp())/GeV; } else { cerr << "Analysis/LPairAnalysis: did not find suitable lepton" << " pair in event " << event->number() << " (" << (foundlp ? "+" : "0") << (foundlm ? "-" : "0") << ").\n"; generator()->log() << "Analysis/LPairAnalysis: " << "Found no suitable lepton pair in event " << event->number() << ".\n" << *event; } } -NoPIOClassDescription<LPairAnalysis> LPairAnalysis::initLPairAnalysis; -// Definition of the static class description member. +// The following static variable is needed for the type +// description system in ThePEG. +DescribeNoPIOClass<LPairAnalysis,AnalysisHandler> +describeHerwigLPairAnalysis("Herwig::LPairAnalysis", "HwAnalysis.so"); void LPairAnalysis::Init() { static ClassDocumentation<LPairAnalysis> documentation ("There is no documentation for the LPairAnalysis class"); } diff --git a/Analysis/LPairAnalysis.h b/Analysis/LPairAnalysis.h --- a/Analysis/LPairAnalysis.h +++ b/Analysis/LPairAnalysis.h @@ -1,193 +1,156 @@ // -*- C++ -*- #ifndef HERWIG_LPairAnalysis_H #define HERWIG_LPairAnalysis_H // // This is the declaration of the LPairAnalysis class. // #include "ThePEG/Repository/CurrentGenerator.h" #include "ThePEG/Handlers/AnalysisHandler.h" #include "Herwig/Utilities/Histogram.h" namespace Herwig { using namespace ThePEG; /** \ingroup Analysis * The LPairAnalysis class is designed to analyse lepton pairs. * Therefore the lepton and antilepton with highest pt are selected from * the event and some observables are computed and booked into * histograms. The analysis is intended to anaylse top pair events * where both W's are decaying semileptonically. Therefore, only the * semileptonic top quark decay channels should be switched on. If no * pair of (opposite sign) leptons is found in the final state a warning * message is printed and nothing is booked. Output is created as * topdrawer file * * @see \ref LPairAnalysisInterfaces "The interfaces" * defined for LPairAnalysis. */ class LPairAnalysis: public AnalysisHandler { public: /** * The default constructor. */ LPairAnalysis(); /** @name Virtual functions required by the AnalysisHandler class. */ //@{ /** * Analyze a given Event. Note that a fully generated event * may be presented several times, if it has been manipulated in * between. The default version of this function will call transform * to make a lorentz transformation of the whole event, then extract * all final state particles and call analyze(tPVector) of this * analysis object and those of all associated analysis objects. The * default version will not, however, do anything on events which * have not been fully generated, or have been manipulated in any * way. * @param event pointer to the Event to be analyzed. * @param ieve the event number. * @param loop the number of times this event has been presented. * If negative the event is now fully generated. * @param state a number different from zero if the event has been * manipulated in some way since it was last presented. */ virtual void analyze(tEventPtr event, long ieve, int loop, int state); //@} public: /** * The standard Init function used to initialize the interfaces. * Called exactly once for each class by the class description system * before the main function starts or * when this class is dynamically loaded. */ static void Init(); protected: /** @name Clone Methods. */ //@{ /** * Make a simple clone of this object. * @return a pointer to the new object. */ virtual IBPtr clone() const {return new_ptr(*this);} /** Make a clone of this object, possibly modifying the cloned object * to make it sane. * @return a pointer to the new object. */ virtual IBPtr fullclone() const {return new_ptr(*this);} //@} protected: /** @name Standard Interfaced functions. */ //@{ /** * Finalize this object. Called in the run phase just after a * run has ended. Used eg. to write out statistics. */ virtual void dofinish(); private: /** - * The static object used to initialize the description of this class. - * Indicates that this is a concrete class without persistent data. - */ - static NoPIOClassDescription<LPairAnalysis> initLPairAnalysis; - - /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ LPairAnalysis & operator=(const LPairAnalysis &); private: /** * \f$p_T\f$ of the leptons */ Histogram _ptp; Histogram _ptm; Histogram _ptpair; /** * \f$E_T\f$ of the leptons */ Histogram _etp; Histogram _etm; Histogram _etpair; /** * Energy of the leptons */ Histogram _ep; Histogram _em; Histogram _epair; /** * Rapidity of the leptons */ Histogram _rapp; Histogram _rapm; Histogram _rappair; /** * Azimuth of the leptons */ Histogram _phip; Histogram _phim; Histogram _deltaphi; /** * Invariant mass of the pair */ Histogram _mpair; /** * scalar sums of Et, pt */ Histogram _etsum; Histogram _ptsum; }; } -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** This template specialization informs ThePEG about the - * base classes of LPairAnalysis. */ -template <> -struct BaseClassTrait<Herwig::LPairAnalysis,1> { - /** Typedef of the first base class of LPairAnalysis. */ - typedef AnalysisHandler NthBase; -}; - -/** This template specialization informs ThePEG about the name of - * the LPairAnalysis class and the shared object where it is defined. */ -template <> -struct ClassTraits<Herwig::LPairAnalysis> - : public ClassTraitsBase<Herwig::LPairAnalysis> { - /** Return a platform-independent class name */ - static string className() { return "Herwig::LPairAnalysis"; } - /** Return the name(s) of the shared library (or libraries) be loaded to get - * access to the LPairAnalysis class and any other class on which it depends - * (except the base class). */ - static string library() { return "HwAnalysis.so"; } -}; - -/** @endcond */ - -} - #endif /* HERWIG_LPairAnalysis_H */ diff --git a/Analysis/ParallelRunAnalysis.cc b/Analysis/ParallelRunAnalysis.cc --- a/Analysis/ParallelRunAnalysis.cc +++ b/Analysis/ParallelRunAnalysis.cc @@ -1,71 +1,74 @@ #include <fstream> +#include "ThePEG/Utilities/DescribeClass.h" #include "ParallelRunAnalysis.h" #include "ThePEG/Handlers/SamplerBase.h" #include "ThePEG/Repository/Repository.h" #include "ThePEG/Handlers/EventHandler.h" #include "ThePEG/Handlers/StandardEventHandler.h" #include "ThePEG/Repository/EventGenerator.h" #include "ThePEG/Repository/CurrentGenerator.h" #include "ThePEG/EventRecord/Event.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" #include <unistd.h> using namespace Herwig; ParallelRunAnalysis::ParallelRunAnalysis() {} void ParallelRunAnalysis::doinitrun() { string logfilename = generator()->runName() + ".parallel"; ofstream log(logfilename.c_str(),ofstream::app); string hostname; { char tmp[256]; const int err = gethostname(tmp, 256); tmp[255] = '\0'; hostname = ( err == 0 ) ? tmp : "[unknown host]"; } log << "hostname> " << hostname << "\n" << flush; log.close(); } void ParallelRunAnalysis::dofinish() { AnalysisHandler::dofinish(); } void ParallelRunAnalysis::analyze(tEventPtr, long currev, int, int) { long totev = generator()->N(); long i = currev; bool skip = currev%(max(totev/100, 1L)); if ( i > totev/2 ) i = totev-i; while ( skip && i >= 10 && !(i%10) ) i /= 10; if ( i == 1 || i == 2 || i == 5 ) skip = false; if ( skip && currev%5000!=0) return; tEHPtr curEvtHandler = generator()->currentEventHandler(); long attempts = (dynamic_ptr_cast<StdEHPtr>(curEvtHandler))->sampler()->attempts(); char str[128]; sprintf(str,"event> %lu/%lu/%lu xs = %.10E pb +/- %.10E pb\n", currev,attempts,totev, double(curEvtHandler->integratedXSec()/picobarn), double(curEvtHandler->integratedXSecErr()/picobarn)); string logfilename = generator()->runName() + ".parallel"; ofstream log(logfilename.c_str(),ofstream::app); log << str << flush; log.close(); } -NoPIOClassDescription<ParallelRunAnalysis> ParallelRunAnalysis::initParallelRunAnalysis; -// Definition of the static class description member. +// The following static variable is needed for the type +// description system in ThePEG. +DescribeNoPIOClass<ParallelRunAnalysis,AnalysisHandler> +describeHerwigParallelRunAnalysis("Herwig::ParallelRunAnalysis", "HwAnalysis.so"); void ParallelRunAnalysis::Init() { static ClassDocumentation<ParallelRunAnalysis> documentation ("Analysis for combining parallel runs with Herwig."); } diff --git a/Analysis/ParallelRunAnalysis.h b/Analysis/ParallelRunAnalysis.h --- a/Analysis/ParallelRunAnalysis.h +++ b/Analysis/ParallelRunAnalysis.h @@ -1,160 +1,123 @@ // -*- C++ -*- // // ParallelRunAnalysis.h is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #ifndef HERWIG_ParallelRunAnalysis_H #define HERWIG_ParallelRunAnalysis_H // // This is the declaration of the ParallelRunAnalysis class. // //#include "ThePEG/Repository/CurrentGenerator.h" #include "ThePEG/Handlers/AnalysisHandler.h" //#include "Herwig/Utilities/Histogram.h" namespace Herwig { using namespace ThePEG; /** \ingroup Analysis * This analysis prints out information necessary for the combination of multiple * Herwig runs during the run step. * * @see \ref ParallelRunAnalysisInterfaces "The interfaces" * defined for ParallelRunAnalysis. */ class ParallelRunAnalysis: public AnalysisHandler { public: /** @name Standard constructors and destructors. */ //@{ /** * The default constructor. */ ParallelRunAnalysis(); //@} public: /** @name Virtual functions required by the AnalysisHandler class. */ //@{ /** * Analyze a given Event. Note that a fully generated event * may be presented several times, if it has been manipulated in * between. The default version of this function will call transform * to make a lorentz transformation of the whole event, then extract * all final state particles and call analyze(tPVector) of this * analysis object and those of all associated analysis objects. The * default version will not, however, do anything on events which * have not been fully generated, or have been manipulated in any * way. * @param event pointer to the Event to be analyzed. * @param ieve the event number. * @param loop the number of times this event has been presented. * If negative the event is now fully generated. * @param state a number different from zero if the event has been * manipulated in some way since it was last presented. */ virtual void analyze(tEventPtr event, long ieve, int loop, int state); //@} public: /** * The standard Init function used to initialize the interfaces. * Called exactly once for each class by the class description system * before the main function starts or * when this class is dynamically loaded. */ static void Init(); protected: /** @name Clone Methods. */ //@{ /** * Make a simple clone of this object. * @return a pointer to the new object. */ virtual IBPtr clone() const {return new_ptr(*this);} /** Make a clone of this object, possibly modifying the cloned object * to make it sane. * @return a pointer to the new object. */ virtual IBPtr fullclone() const {return new_ptr(*this);} //@} protected: /** @name Standard Interfaced functions. */ //@{ /** * Initialize this object. Called in the run phase just before * a run begins. */ virtual void doinitrun(); /** * Finalize this object. Called in the run phase just after a * run has ended. Used eg. to write out statistics. */ virtual void dofinish(); private: /** - * The static object used to initialize the description of this class. - * Indicates that this is a concrete class without persistent data. - */ - static NoPIOClassDescription<ParallelRunAnalysis> initParallelRunAnalysis; - - /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ ParallelRunAnalysis & operator=(const ParallelRunAnalysis &); private: }; } -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** This template specialization informs ThePEG about the - * base classes of ParallelRunAnalysis. */ -template <> -struct BaseClassTrait<Herwig::ParallelRunAnalysis,1> { - /** Typedef of the first base class of ParallelRunAnalysis. */ - typedef AnalysisHandler NthBase; -}; - -/** This template specialization informs ThePEG about the name of - * the ParallelRunAnalysis class and the shared object where it is defined. */ -template <> -struct ClassTraits<Herwig::ParallelRunAnalysis> - : public ClassTraitsBase<Herwig::ParallelRunAnalysis> { - /** Return a platform-independent class name */ - static string className() { return "Herwig::ParallelRunAnalysis"; } - /** Return the name(s) of the shared library (or libraries) be loaded to get - * access to the ParallelRunAnalysis class and any other class on which it depends - * (except the base class). */ - static string library() { return "HwAnalysis.so"; } -}; - -/** @endcond */ - -} - #endif /* HERWIG_ParallelRunAnalysis_H */ diff --git a/Analysis/SimpleLHCAnalysis.cc b/Analysis/SimpleLHCAnalysis.cc --- a/Analysis/SimpleLHCAnalysis.cc +++ b/Analysis/SimpleLHCAnalysis.cc @@ -1,163 +1,166 @@ // -*- C++ -*- // // SimpleLHCAnalysis.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the SimpleLHCAnalysis class. // #include "SimpleLHCAnalysis.h" +#include "ThePEG/Utilities/DescribeClass.h" #include "ThePEG/Repository/EventGenerator.h" #include "ThePEG/EventRecord/Particle.h" #include "ThePEG/EventRecord/Event.h" #include "ThePEG/PDT/EnumParticles.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" using namespace Herwig; SimpleLHCAnalysis::SimpleLHCAnalysis() : _ptZ(4,Histogram(0.,250.,250)), _ptWp(4,Histogram(0.,250.,250)), _ptWm(4,Histogram(0.,250.,250)), _mZ(0.,250.,250), _mWp(0.,250.,250), _mWm(0.,250.,250), _rapZ(-10.,10.,100),_rapWp(-10.,10.,100),_rapWm(-10.,10.,100), _phiZ(-Constants::pi,Constants::pi,100), _phiWp(-Constants::pi,Constants::pi,100), _phiWm(-Constants::pi,Constants::pi,100) {} void sumMomenta(Lorentz5Momentum & psum, tPPtr parent) { if(!parent->children().empty()) { for(unsigned int ix=0;ix<parent->children().size();++ix) sumMomenta(psum,parent->children()[ix]); } else psum += parent->momentum(); } void SimpleLHCAnalysis::analyze(tEventPtr event, long, int, int) { // AnalysisHandler::analyze(event, ieve, loop, state); // Rotate to CMS, extract final state particles and call analyze(particles). // find the Z Lorentz5Momentum pz; StepVector::const_iterator sit =event->primaryCollision()->steps().begin(); StepVector::const_iterator stest =event->primaryCollision()->steps().end(); StepVector::const_iterator send=sit; ++send; if(send==stest) --send; ++send; if(send==stest) --send; ++send; for(;sit!=send;++sit) { ParticleSet part=(**sit).all(); ParticleSet::const_iterator iter = part.begin(), end = part.end(); for( ;iter!=end;++iter) { if((**iter).children().size()!=2) continue; if((**iter).id()==ParticleID::Z0||(**iter).id()==ParticleID::gamma) { pz=Lorentz5Momentum(); sumMomenta(pz,*iter); pz.rescaleMass(); double pt = pz.perp()/GeV; double mz = pz.m()/GeV; if(mz>20.&&mz<80.) _ptZ[1].addWeighted(pt,event->weight()); else if (mz>80.&&mz<100.) _ptZ[2].addWeighted(pt,event->weight()); else if (mz>100.) _ptZ[3].addWeighted(pt,event->weight()); _ptZ[0].addWeighted(pt ,event->weight()); _mZ .addWeighted(mz ,event->weight()); _rapZ .addWeighted(pz.rapidity(),event->weight()); _phiZ .addWeighted(pz.phi() ,event->weight()); } else if ((**iter).id()==ParticleID::Wplus) { pz=Lorentz5Momentum(); sumMomenta(pz,*iter); pz.rescaleMass(); double pt = pz.perp()/GeV; double mz = pz.m()/GeV; if(mz>20.&&mz<80.) _ptWp[1].addWeighted(pt,event->weight()); else if (mz>80.&&mz<100.) _ptWp[2].addWeighted(pt,event->weight()); else if (mz>100.) _ptWp[3].addWeighted(pt,event->weight()); _ptWp[0].addWeighted(pt ,event->weight()); _mWp .addWeighted(mz ,event->weight()); _rapWp .addWeighted(pz.rapidity(),event->weight()); _phiWp .addWeighted(pz.phi() ,event->weight()); } else if ((**iter).id()==ParticleID::Wminus) { pz=Lorentz5Momentum(); sumMomenta(pz,*iter); pz.rescaleMass(); double pt = pz.perp()/GeV; double mz = pz.m()/GeV; if(mz>20.&&mz<80.) (_ptWm[1]).addWeighted(pt,event->weight()); else if (mz>80.&&mz<100.) (_ptWm[2]).addWeighted(pt,event->weight()); else if (mz>100.) (_ptWm[3]).addWeighted(pt,event->weight()); _ptWm[0].addWeighted(pt ,event->weight()); _mWm .addWeighted(mz ,event->weight()); _rapWm .addWeighted(pz.rapidity(),event->weight()); _phiWm .addWeighted(pz.phi() ,event->weight()); } } } } -NoPIOClassDescription<SimpleLHCAnalysis> SimpleLHCAnalysis::initSimpleLHCAnalysis; -// Definition of the static class description member. +// The following static variable is needed for the type +// description system in ThePEG. +DescribeNoPIOClass<SimpleLHCAnalysis,AnalysisHandler> +describeHerwigSimpleLHCAnalysis("Herwig::SimpleLHCAnalysis", "HwAnalysis.so"); void SimpleLHCAnalysis::Init() { static ClassDocumentation<SimpleLHCAnalysis> documentation ("The SimpleLHCAnalysis class performs a simple analysis of W and" " Z production in hadron-hadron collisions"); } void SimpleLHCAnalysis::dofinish() { AnalysisHandler::dofinish(); string fname = generator()->filename() + string("-") + name() + string(".top"); ofstream outfile(fname.c_str()); string title; using namespace HistogramOptions; for(unsigned int ix=0;ix<4;++ix) { if(ix==0){title="pt of Z for all masses ";} else if(ix==1){title="pt of Z for mass 40-80 GeV";} else if(ix==2){title="pt of Z for mass 80-100 GeV";} else if(ix==3){title="pt of Z for mass 100- GeV";} _ptZ[ix].topdrawOutput(outfile,Frame,"BLACK",title); _ptZ[ix].topdrawOutput(outfile,Frame|Ylog,"BLACK",title); if(ix==0){title="pt of Wp for all masses ";} else if(ix==1){title="pt of Wp for mass 40-80 GeV";} else if(ix==2){title="pt of Wp for mass 80-100 GeV";} else if(ix==3){title="pt of Wp for mass 100- GeV";} _ptWp[ix].topdrawOutput(outfile,Frame,"BLACK",title); _ptWp[ix].topdrawOutput(outfile,Frame|Ylog,"BLACK",title); if(ix==0){title="pt of Wm for all masses ";} else if(ix==1){title="pt of Wm for mass 40-80 GeV";} else if(ix==2){title="pt of Wm for mass 80-100 GeV";} else if(ix==3){title="pt of Wm for mass 100- GeV";} _ptWm[ix].topdrawOutput(outfile,Frame,"BLACK",title); _ptWm[ix].topdrawOutput(outfile,Frame|Ylog,"BLACK",title); } _mZ.topdrawOutput(outfile,Frame,"BLACK","Mass of Z"); _mZ.topdrawOutput(outfile,Frame|Ylog,"BLACK", "Mass of Z"); _mWp.topdrawOutput(outfile,Frame,"BLACK","Mass of Wp"); _mWp.topdrawOutput(outfile,Frame|Ylog,"BLACK", "Mass of Wp"); _mWm.topdrawOutput(outfile,Frame,"BLACK","Mass of Wm"); _mWm.topdrawOutput(outfile,Frame|Ylog,"BLACK", "Mass of Wm"); _rapZ.topdrawOutput(outfile,Frame,"BLACK","Rapidity of Z"); _rapZ.topdrawOutput(outfile,Frame|Ylog,"BLACK","Rapidity of Z"); _rapWp.topdrawOutput(outfile,Frame,"BLACK","Rapidity of Wp"); _rapWp.topdrawOutput(outfile,Frame|Ylog,"BLACK","Rapidity of Wp"); _rapWm.topdrawOutput(outfile,Frame,"BLACK","Rapidity of Wm"); _rapWm.topdrawOutput(outfile,Frame|Ylog,"BLACK","Rapidity of Wm"); _phiZ.topdrawOutput(outfile,Frame,"BLACK","Azimuth of Z"); _phiWp.topdrawOutput(outfile,Frame,"BLACK","Azimuth of Wp"); _phiWm.topdrawOutput(outfile,Frame,"BLACK","Azimuth of Wm"); } diff --git a/Analysis/SimpleLHCAnalysis.h b/Analysis/SimpleLHCAnalysis.h --- a/Analysis/SimpleLHCAnalysis.h +++ b/Analysis/SimpleLHCAnalysis.h @@ -1,213 +1,176 @@ // -*- C++ -*- // // SimpleLHCAnalysis.h is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #ifndef HERWIG_SimpleLHCAnalysis_H #define HERWIG_SimpleLHCAnalysis_H // // This is the declaration of the SimpleLHCAnalysis class. // #include "ThePEG/Repository/CurrentGenerator.h" #include "ThePEG/Handlers/AnalysisHandler.h" #include "Herwig/Utilities/Histogram.h" namespace Herwig { using namespace ThePEG; /** \ingroup Analysis * The SimpleLHCAnalysis class is designed to perform some simple analysis of * gauge boson, W and Z, distributions in hadron-hadron collisions. The main * distriubtions are the transverse momentum and rapidities of the gauge bosons * which are of physical interest, and the azimuthal angle distribution for * testing purposes. * * @see \ref SimpleLHCAnalysisInterfaces "The interfaces" * defined for SimpleLHCAnalysis. */ class SimpleLHCAnalysis: public AnalysisHandler { public: /** * The default constructor. */ SimpleLHCAnalysis(); /** @name Virtual Functions required by the AnalysisHandler class. */ //@{ /** * Analyze a given Event. Note that a fully generated event * may be presented several times, if it has been manipulated in * between. The default version of this function will call transform * to make a lorentz transformation of the whole event, then extract * all final state particles and call analyze(tPVector) of this * analysis object and those of all associated analysis objects. The * default version will not, however, do anything on events which * have not been fully generated, or have been manipulated in any * way. * @param event pointer to the Event to be analyzed. * @param ieve the event number. * @param loop the number of times this event has been presented. * If negative the event is now fully generated. * @param state a number different from zero if the event has been * manipulated in some way since it was last presented. */ virtual void analyze(tEventPtr event, long ieve, int loop, int state); //@} public: /** * The standard Init function used to initialize the interfaces. * Called exactly once for each class by the class description system * before the main function starts or * when this class is dynamically loaded. */ static void Init(); protected: /** @name Clone Methods. */ //@{ /** * Make a simple clone of this object. * @return a pointer to the new object. */ virtual IBPtr clone() const {return new_ptr(*this);} /** Make a clone of this object, possibly modifying the cloned object * to make it sane. * @return a pointer to the new object. */ virtual IBPtr fullclone() const {return new_ptr(*this);} //@} protected: /** @name Standard Interfaced functions. */ //@{ /** * Finalize this object. Called in the run phase just after a * run has ended. Used eg. to write out statistics. */ virtual void dofinish(); //@} private: /** - * The static object used to initialize the description of this class. - * Indicates that this is a concrete class with persistent data. - */ - static NoPIOClassDescription<SimpleLHCAnalysis> initSimpleLHCAnalysis; - - /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ SimpleLHCAnalysis & operator=(const SimpleLHCAnalysis &); private: /** * \f$p_T\f$ of the Z boson */ vector<Histogram> _ptZ; /** * \f$p_T\f$ of the \f$W^+\f$ boson */ vector<Histogram> _ptWp; /** * \f$p_T\f$ of the \f$W^-\f$ boson */ vector<Histogram> _ptWm; /** * Mass of the Z boson */ Histogram _mZ; /** * Mass of the \f$W^+\f$ boson */ Histogram _mWp; /** * Mass of the \f$W^-\f$ boson */ Histogram _mWm; /** * Rapidity of Z */ Histogram _rapZ; /** * Rapidity of \f$W^+\f$ boson */ Histogram _rapWp; /** * Rapidity of \f$W^-\f$ boson */ Histogram _rapWm; /** * Azimuth of Z */ Histogram _phiZ; /** * Azimuth of \f$W^+\f$ boson */ Histogram _phiWp; /** * Azimuth of \f$W^-\f$ boson */ Histogram _phiWm; }; } -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** This template specialization informs ThePEG about the - * base classes of SimpleLHCAnalysis. */ -template <> -struct BaseClassTrait<Herwig::SimpleLHCAnalysis,1> { - /** Typedef of the first base class of SimpleLHCAnalysis. */ - typedef AnalysisHandler NthBase; -}; - -/** This template specialization informs ThePEG about the name of - * the SimpleLHCAnalysis class and the shared object where it is defined. */ -template <> -struct ClassTraits<Herwig::SimpleLHCAnalysis> - : public ClassTraitsBase<Herwig::SimpleLHCAnalysis> { - /** Return a platform-independent class name */ - static string className() { return "Herwig::SimpleLHCAnalysis"; } - /** Return the name(s) of the shared library (or libraries) be loaded to get - * access to the SimpleLHCAnalysis class and any other class on which it depends - * (except the base class). */ - static string library() { return "HwAnalysis.so"; } -}; - -/** @endcond */ - -} - #endif /* HERWIG_SimpleLHCAnalysis_H */ diff --git a/Analysis/TTbarAnalysis.cc b/Analysis/TTbarAnalysis.cc --- a/Analysis/TTbarAnalysis.cc +++ b/Analysis/TTbarAnalysis.cc @@ -1,145 +1,148 @@ // -*- C++ -*- // // TTbarAnalysis.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the TTbarAnalysis class. // #include "TTbarAnalysis.h" +#include "ThePEG/Utilities/DescribeClass.h" #include "ThePEG/Repository/EventGenerator.h" #include "ThePEG/EventRecord/Particle.h" #include "ThePEG/EventRecord/Event.h" #include "ThePEG/PDT/EnumParticles.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" using namespace Herwig; namespace { bool isLastInShower(const Particle & p) { return p.children().size() > 1 && p.children()[0]->id() != p.id() && p.children()[1]->id() != p.id(); } struct TTBar { static bool AllCollisions() { return false; } static bool AllSteps() { return true; } // === // pick the last instance from the shower static bool FinalState() { return false; } static bool Intermediate() { return true; } // === static bool Check(const Particle & p) { return abs(p.id()) == ParticleID::t && isLastInShower(p); } }; } TTbarAnalysis::TTbarAnalysis() : _pttop(0.,350.,100), _pttbar(0.,350.,100), _ptpair(0.,350.,100), _ettop(0.,350.,100), _ettbar(0.,350.,100), _etpair(0.,350.,100), _etop(0.,3000.,100), _etbar(0.,3000.,100), _epair(0.,6000.,100), _raptop(-5.,5.,100), _raptbar(-5.,5.,100), _rappair(-5.,5.,100), _phitop (-Constants::pi,Constants::pi,50), _phitbar (-Constants::pi,Constants::pi,50), _deltaphi(-Constants::pi,Constants::pi,100), _mpair(300,1500,100), _etsum(0.,700.,100), _ptsum(0.,700.,100) {} void TTbarAnalysis::dofinish() { AnalysisHandler::dofinish(); string fname = generator()->filename() + string("-") + name() + string(".top"); ofstream outfile(fname.c_str()); using namespace HistogramOptions; _pttop.topdrawOutput(outfile,Frame|Ylog,"RED","pt t, tbar"); _pttbar.topdrawOutput(outfile,Ylog,"BLUE","pt tbar"); _ptpair.topdrawOutput(outfile,Frame|Ylog,"BLACK","pt pair"); _ettop.topdrawOutput(outfile,Frame|Ylog,"RED","Et t, tbar"); _ettbar.topdrawOutput(outfile,Ylog,"BLUE","Et tbar"); _etpair.topdrawOutput(outfile,Frame|Ylog,"BLACK","Et pair"); _etop.topdrawOutput(outfile,Frame|Ylog,"RED","E t, tbar"); _etbar.topdrawOutput(outfile,Ylog,"BLUE","E tbar"); _epair.topdrawOutput(outfile,Frame|Ylog,"BLACK","E pair"); _raptop.topdrawOutput(outfile,Frame,"RED","y t, tbar"); _raptbar.topdrawOutput(outfile,None,"BLUE","y tbar"); _rappair.topdrawOutput(outfile,Frame,"BLACK","y pair"); _phitop.topdrawOutput(outfile,Frame,"RED","phi t, tbar"); _phitbar.topdrawOutput(outfile,None,"BLUE","phi tbar"); _deltaphi.topdrawOutput(outfile,Frame,"BLACK","Delta phi"); _mpair.topdrawOutput(outfile,Frame|Ylog,"BLACK","M pair"); _etsum.topdrawOutput(outfile,Frame|Ylog,"BLACK","pt sum"); _ptsum.topdrawOutput(outfile,Frame|Ylog,"BLACK","Et sum"); } void TTbarAnalysis::analyze(tEventPtr event, long, int, int) { Lorentz5Momentum ptop, ptbar, ppair; bool foundt = false; bool foundtbar = false; tcParticleSet particles; event->select(inserter(particles), ThePEG::ParticleSelector<TTBar>()); if ( particles.empty() ) return; for(tcParticleSet::const_iterator it = particles.begin(); it != particles.end(); ++it) { if((**it).id() == ParticleID::t) { ptop = (*it)->momentum(); foundt = true; } else if((**it).id() == ParticleID::tbar) { ptbar = (*it)->momentum(); foundtbar = true; } } if (foundt && foundtbar) { ppair = ptop + ptbar; _pttop += ptop.perp()/GeV; _pttbar += ptbar.perp()/GeV; _ptpair += ppair.perp()/GeV; _ettop += ptop.et()/GeV; _ettbar += ptbar.et()/GeV; _etpair += ppair.et()/GeV; _etop += ptop.e()/GeV; _etbar += ptbar.e()/GeV; _epair += ppair.e()/GeV; _raptop += ptop.rapidity(); _raptbar += ptbar.rapidity(); _rappair += ppair.rapidity(); _phitop += ptop.phi(); _phitbar += ptbar.phi(); _deltaphi += (ptop.vect()).deltaPhi(ptbar.vect()); _mpair += ppair.m()/GeV; _etsum += (ptop.et() + ptbar.et())/GeV; _ptsum += (ptop.perp() + ptbar.perp())/GeV; } else { cerr << "Analysis/TTbarAnalysis: did not find ttbar pair in event " << event->number() << ".\n"; generator()->log() << "Analysis/TTbarAnalysis: " << "Found no ttbar pair in event " << event->number() << ".\n" << *event; } } -NoPIOClassDescription<TTbarAnalysis> TTbarAnalysis::initTTbarAnalysis; -// Definition of the static class description member. +// The following static variable is needed for the type +// description system in ThePEG. +DescribeNoPIOClass<TTbarAnalysis,AnalysisHandler> +describeHerwigTTbarAnalysis("Herwig::TTbarAnalysis", "HwAnalysis.so"); void TTbarAnalysis::Init() { static ClassDocumentation<TTbarAnalysis> documentation ("Standard analysis of a t/tbar pair after showering."); } diff --git a/Analysis/TTbarAnalysis.h b/Analysis/TTbarAnalysis.h --- a/Analysis/TTbarAnalysis.h +++ b/Analysis/TTbarAnalysis.h @@ -1,197 +1,160 @@ // -*- C++ -*- // // TTbarAnalysis.h is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #ifndef HERWIG_TTbarAnalysis_H #define HERWIG_TTbarAnalysis_H // // This is the declaration of the TTbarAnalysis class. // #include "ThePEG/Repository/CurrentGenerator.h" #include "ThePEG/Handlers/AnalysisHandler.h" #include "Herwig/Utilities/Histogram.h" namespace Herwig { using namespace ThePEG; /** \ingroup Analysis * The TTbarAnalysis class tries to find a top antitop pair in the final * state and books a number of histograms. It only makes sense if * hadronization and decays are switched off. However, if there is is * no top quark pair in the final state then a warning is printed and * nothing is booked. Some of the histograms will be sensitive to the * initial state shower. * * @see \ref TTbarAnalysisInterfaces "The interfaces" * defined for TTbarAnalysis. */ class TTbarAnalysis: public AnalysisHandler { public: /** * The default constructor. */ TTbarAnalysis(); /** @name Virtual functions required by the AnalysisHandler class. */ //@{ /** * Analyze a given Event. Note that a fully generated event * may be presented several times, if it has been manipulated in * between. The default version of this function will call transform * to make a lorentz transformation of the whole event, then extract * all final state particles and call analyze(tPVector) of this * analysis object and those of all associated analysis objects. The * default version will not, however, do anything on events which * have not been fully generated, or have been manipulated in any * way. * @param event pointer to the Event to be analyzed. * @param ieve the event number. * @param loop the number of times this event has been presented. * If negative the event is now fully generated. * @param state a number different from zero if the event has been * manipulated in some way since it was last presented. */ virtual void analyze(tEventPtr event, long ieve, int loop, int state); //@} public: /** * The standard Init function used to initialize the interfaces. * Called exactly once for each class by the class description system * before the main function starts or * when this class is dynamically loaded. */ static void Init(); protected: /** @name Clone Methods. */ //@{ /** * Make a simple clone of this object. * @return a pointer to the new object. */ virtual IBPtr clone() const {return new_ptr(*this);} /** Make a clone of this object, possibly modifying the cloned object * to make it sane. * @return a pointer to the new object. */ virtual IBPtr fullclone() const {return new_ptr(*this);} //@} protected: /** @name Standard Interfaced functions. */ //@{ /** * Finalize this object. Called in the run phase just after a * run has ended. Used eg. to write out statistics. */ virtual void dofinish(); private: /** - * The static object used to initialize the description of this class. - * Indicates that this is a concrete class without persistent data. - */ - static NoPIOClassDescription<TTbarAnalysis> initTTbarAnalysis; - - /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ TTbarAnalysis & operator=(const TTbarAnalysis &); private: /** * \f$p_T\f$ of the tops */ Histogram _pttop; Histogram _pttbar; Histogram _ptpair; /** * \f$E_T\f$ of the tops */ Histogram _ettop; Histogram _ettbar; Histogram _etpair; /** * Energy of the tops */ Histogram _etop; Histogram _etbar; Histogram _epair; /** * Rapidity of the tops */ Histogram _raptop; Histogram _raptbar; Histogram _rappair; /** * Azimuth of the tops */ Histogram _phitop; Histogram _phitbar; Histogram _deltaphi; /** * Invariant mass of the pair */ Histogram _mpair; /** * scalar sums of Et, pt */ Histogram _etsum; Histogram _ptsum; }; } -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** This template specialization informs ThePEG about the - * base classes of TTbarAnalysis. */ -template <> -struct BaseClassTrait<Herwig::TTbarAnalysis,1> { - /** Typedef of the first base class of TTbarAnalysis. */ - typedef AnalysisHandler NthBase; -}; - -/** This template specialization informs ThePEG about the name of - * the TTbarAnalysis class and the shared object where it is defined. */ -template <> -struct ClassTraits<Herwig::TTbarAnalysis> - : public ClassTraitsBase<Herwig::TTbarAnalysis> { - /** Return a platform-independent class name */ - static string className() { return "Herwig::TTbarAnalysis"; } - /** Return the name(s) of the shared library (or libraries) be loaded to get - * access to the TTbarAnalysis class and any other class on which it depends - * (except the base class). */ - static string library() { return "HwAnalysis.so"; } -}; - -/** @endcond */ - -} - #endif /* HERWIG_TTbarAnalysis_H */