Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:23:58

0001 // -*- C++ -*-
0002 //
0003 // MultiplicityInfo.h is a part of Herwig - A multi-purpose Monte Carlo event generator
0004 // Copyright (C) 2002-2019 The Herwig Collaboration
0005 //
0006 // Herwig is licenced under version 3 of the GPL, see COPYING for details.
0007 // Please respe
0008 #include "Herwig/Utilities/Statistic.h"
0009 
0010 namespace Herwig {
0011 using namespace ThePEG;
0012 
0013 /** \ingroup Analysis
0014  *  Enumeration for species of particle
0015  */
0016 enum ParticleSpecies {
0017   lightMeson=0,strangeMeson,lightBaryon,other
0018 };
0019 
0020 /** \ingroup Analysis
0021  *  Struct for the multiplcity data
0022  */
0023 struct MultiplicityInfo {
0024 
0025   /**
0026    *  Default constructor
0027    * @param mult  The observed multiplcity.
0028    * @param error The error on the observed multiplicity
0029    * @param type  The type of particle
0030    */
0031   MultiplicityInfo(double mult=0.,double error=0.,
0032            ParticleSpecies type=other)
0033     : obsMultiplicity(mult), obsError(error), type(type) {};
0034 
0035   /**
0036    *  The observed multiplicity
0037    */
0038   double obsMultiplicity;
0039 
0040   /**
0041    *  The error on the observed multiplicity
0042    */
0043   double obsError;
0044 
0045   /**
0046    *  The type of particle
0047    */
0048   ParticleSpecies type;
0049 
0050   /**
0051    *  Simulation statistics for particles of this type
0052    */
0053   Statistic count;
0054 
0055   /**
0056    *  The average number per event
0057    */
0058   double simMultiplicity() { return count.mean();}
0059 
0060   /**
0061    *  The error on the average number per event
0062    */
0063   double simError() { return count.mean_stdDev();}
0064 
0065   /**
0066    *  Is the result more than \f$3\sigma\f$ from the experimental result
0067    */
0068   double nSigma() {
0069     return obsMultiplicity == 0.0 ? 0.0 :
0070       (simMultiplicity() - obsMultiplicity) 
0071       / sqrt(sqr(simError()) + sqr(obsError));
0072   }
0073 
0074   /**
0075    * Plot standard error in a simple barchart
0076    */
0077   string bargraph() {
0078     if (obsMultiplicity == 0.0) return "     ?     ";
0079     else if (nSigma() >= 6.0)   return "-----|---->";
0080     else if (nSigma() >= 5.0)   return "-----|----*";
0081     else if (nSigma() >= 4.0)   return "-----|---*-";
0082     else if (nSigma() >= 3.0)   return "-----|--*--";
0083     else if (nSigma() >= 2.0)   return "-----|-*---";
0084     else if (nSigma() >= 1.0)   return "-----|*----";
0085     else if (nSigma() > -1.0)   return "-----*-----";
0086     else if (nSigma() > -2.0)   return "----*|-----";
0087     else if (nSigma() > -3.0)   return "---*-|-----";
0088     else if (nSigma() > -4.0)   return "--*--|-----";
0089     else if (nSigma() > -5.0)   return "-*---|-----";
0090     else if (nSigma() > -6.0)   return "*----|-----";
0091     else                        return "<----|-----";
0092   }
0093 };
0094 }