[Rivet-svn] r3411 - in branches/2011-07-aida2yoda: . data/anainfo include/Rivet/Projections pyext src/Projections

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Thu Oct 6 13:55:38 BST 2011


Author: hoeth
Date: Thu Oct  6 13:55:37 2011
New Revision: 3411

Log:
merge r3338-3342 from trunk

Modified:
   branches/2011-07-aida2yoda/ChangeLog
   branches/2011-07-aida2yoda/data/anainfo/ALICE_2010_S8624100.info
   branches/2011-07-aida2yoda/include/Rivet/Projections/LeptonClusters.hh
   branches/2011-07-aida2yoda/pyext/lighthisto.py
   branches/2011-07-aida2yoda/src/Projections/LeptonClusters.cc
   branches/2011-07-aida2yoda/src/Projections/Spherocity.cc
   branches/2011-07-aida2yoda/src/Projections/ZFinder.cc

Modified: branches/2011-07-aida2yoda/ChangeLog
==============================================================================
--- branches/2011-07-aida2yoda/ChangeLog	Thu Oct  6 13:53:16 2011	(r3410)
+++ branches/2011-07-aida2yoda/ChangeLog	Thu Oct  6 13:55:37 2011	(r3411)
@@ -1,3 +1,7 @@
+2011-09-04  Andy Buckley  <andy at insectnation.org>
+
+	* lighthisto fixes from Christian Roehr.
+
 2011-08-26  Andy Buckley  <andy at insectnation.org>
 
 	* Removing deprecated setBeams method from Analysis, and the

Modified: branches/2011-07-aida2yoda/data/anainfo/ALICE_2010_S8624100.info
==============================================================================
--- branches/2011-07-aida2yoda/data/anainfo/ALICE_2010_S8624100.info	Thu Oct  6 13:53:16 2011	(r3410)
+++ branches/2011-07-aida2yoda/data/anainfo/ALICE_2010_S8624100.info	Thu Oct  6 13:55:37 2011	(r3411)
@@ -11,7 +11,7 @@
  - Jan Fiete Grosse-Oetringhaus at cern.ch <Jan.Fiete.Grosse-Oetringhaus at cern.ch>
 References:
  - Eur.Phys.J.C68:89-108,2010
- - arXiv:1004.3034 [hep-ex] 
+ - arXiv:1004.3034 [hep-ex]
 RunInfo:
   QCD and diffractive events at $\sqrt{s}=\unit{0.9}{\TeV}$ and $\sqrt{s}=\unit{2.36}{\TeV}$
 NumEvents: 1000000
@@ -19,13 +19,18 @@
 Energies: [900, 2360]
 PtCuts:
 Description:
-  'This is an ALICE analysis where charged particle multiplicities (including the zero bin) have been measured in three different pseudorapidity intervals ($|\eta|<0.5; |\eta|<1.0; |\eta|<1.3$. Only the INEL distributions have been considered here. The data were taken at 900 and 2360 GeV.'
+  'This is an ALICE analysis where charged particle multiplicities (including
+   the zero bin) have been measured in three different pseudorapidity intervals
+   ($|\eta|<0.5; |\eta|<1.0; |\eta|<1.3$. Only the INEL distributions have
+   been considered here, i.e. this analysis can only be meaningfully compared to
+   PYTHIA 6 with diffractive processes disabled. The data were taken at 900 and
+   2360 GeV.'
 BibKey: Aamodt:2010ft
 BibTeX: '@Article{Aamodt:2010ft,
      author    = "Aamodt, K. and others",
- collaboration = "ALICE",
+     collaboration = "ALICE",
      title     = "{Charged-particle multiplicity measurement in proton-proton
-                  collisions at sqrt(s) = 0.9 and 2.36 TeV with ALICE at
+                  collisions at $\sqrt{s} = 0.9$ and 2.36 TeV with ALICE at
                   LHC}",
      journal   = "Eur. Phys. J.",
      volume    = "C68",
@@ -37,5 +42,3 @@
      doi       = "10.1140/epjc/s10052-010-1339-x",
      SLACcitation  = "%%CITATION = 1004.3034;%%"
 }'
-ToDo:
- - NSD?

Modified: branches/2011-07-aida2yoda/include/Rivet/Projections/LeptonClusters.hh
==============================================================================
--- branches/2011-07-aida2yoda/include/Rivet/Projections/LeptonClusters.hh	Thu Oct  6 13:53:16 2011	(r3410)
+++ branches/2011-07-aida2yoda/include/Rivet/Projections/LeptonClusters.hh	Thu Oct  6 13:55:37 2011	(r3411)
@@ -12,22 +12,24 @@
 
 namespace Rivet {
 
-  class ClusteredLepton : public Particle {
 
+  class ClusteredLepton : public Particle {
   public:
+
     ClusteredLepton(Particle lepton) :
       Particle(lepton.pdgId(), lepton.momentum()),
       _constituentLepton(lepton) {}
 
     void addPhoton(const Particle& p, bool cluster) {
       _constituentPhotons.push_back(p);
-      if (cluster) setMomentum(momentum()+p.momentum());
+      if (cluster) setMomentum(momentum() + p.momentum());
     }
 
     const Particle& constituentLepton() const { return _constituentLepton; }
     const ParticleVector& constituentPhotons() const { return _constituentPhotons; }
 
   private:
+
     ParticleVector _constituentPhotons;
     Particle _constituentLepton;
   };
@@ -67,12 +69,12 @@
 
   private:
 
-    /// maximum cone radius to find photons in
+    /// Maximum cone radius to find photons in
     double _dRmax;
-    /// whether to actually add the photon momenta to clusteredLeptons
+    /// Whether to actually add the photon momenta to clusteredLeptons
     bool _cluster;
 
-    /// container which stores the clustered lepton objects
+    /// Container which stores the clustered lepton objects
     vector<ClusteredLepton> _clusteredLeptons;
   };
 

Modified: branches/2011-07-aida2yoda/pyext/lighthisto.py
==============================================================================
--- branches/2011-07-aida2yoda/pyext/lighthisto.py	Thu Oct  6 13:53:16 2011	(r3410)
+++ branches/2011-07-aida2yoda/pyext/lighthisto.py	Thu Oct  6 13:55:37 2011	(r3411)
@@ -163,10 +163,10 @@
             r += ind + '    path="%s" title="">\n' % (
                     self.path)
         if (self.xlabel!=''):
-            r += ind + '  <dimenstion dim="0" title="%s"/>\n' % (
+            r += ind + '  <dimension dim="0" title="%s"/>\n' % (
                     htmlescape(self.xlabel))
         if (self.ylabel!=''):
-            r += ind + '  <dimenstion dim="1" title="%s"/>\n' % (
+            r += ind + '  <dimension dim="1" title="%s"/>\n' % (
                     htmlescape(self.ylabel))
         r += ind + "  <annotation>\n"
         if (self.title!=''):
@@ -389,9 +389,9 @@
         if desc.has_key("Title"):
             new.title = desc["Title"]
         if desc.has_key("XLabel"):
-            new.title = desc["XLabel"]
+            new.xlabel = desc["XLabel"]
         if desc.has_key("YLabel"):
-            new.title = desc["YLabel"]
+            new.ylabel = desc["YLabel"]
         return new
 
 

Modified: branches/2011-07-aida2yoda/src/Projections/LeptonClusters.cc
==============================================================================
--- branches/2011-07-aida2yoda/src/Projections/LeptonClusters.cc	Thu Oct  6 13:53:16 2011	(r3410)
+++ branches/2011-07-aida2yoda/src/Projections/LeptonClusters.cc	Thu Oct  6 13:55:37 2011	(r3411)
@@ -6,6 +6,7 @@
 
 namespace Rivet {
 
+
   LeptonClusters::LeptonClusters(const FinalState& photons, const FinalState& signal,
                  double dRmax, bool cluster,
                  const std::vector<std::pair<double, double> >& etaRanges,
@@ -21,6 +22,7 @@
     addProjection(signal, "Signal");
   }
 
+
   int LeptonClusters::compare(const Projection& p) const {
     // Compare the two as final states (for pT and eta cuts)
     const LeptonClusters& other = dynamic_cast<const LeptonClusters&>(p);
@@ -42,11 +44,11 @@
     _clusteredLeptons.clear();
 
     const FinalState& signal = applyProjection<FinalState>(e, "Signal");
-    ParticleVector bareleptons=signal.particles();
-    if (bareleptons.size()==0) return;
+    ParticleVector bareleptons = signal.particles();
+    if (bareleptons.empty()) return;
 
     vector<ClusteredLepton> allClusteredLeptons;
-    for (size_t i=0; i<bareleptons.size(); ++i) {
+    for (size_t i = 0; i < bareleptons.size(); ++i) {
       allClusteredLeptons.push_back(ClusteredLepton(bareleptons[i]));
     }
 
@@ -54,8 +56,8 @@
     foreach (const Particle& photon, photons.particles()) {
       const FourMomentum p_P = photon.momentum();
       double dRmin=_dRmax;
-      int idx=-1;
-      for (size_t i=0; i<bareleptons.size(); ++i) {
+      int idx = -1;
+      for (size_t i = 0; i < bareleptons.size(); ++i) {
         FourMomentum p_l = bareleptons[i].momentum();
         // Only cluster photons around *charged* signal particles
         if (PID::threeCharge(bareleptons[i].pdgId()) == 0) continue;
@@ -63,10 +65,10 @@
         double dR=deltaR(p_l, p_P);
         if (dR < dRmin) {
           dRmin=dR;
-          idx=i;
+          idx = i;
         }
       }
-      if (idx>-1) {
+      if (idx > -1) {
         if (_cluster) allClusteredLeptons[idx].addPhoton(photon, _cluster);
       }
     }

Modified: branches/2011-07-aida2yoda/src/Projections/Spherocity.cc
==============================================================================
--- branches/2011-07-aida2yoda/src/Projections/Spherocity.cc	Thu Oct  6 13:53:16 2011	(r3410)
+++ branches/2011-07-aida2yoda/src/Projections/Spherocity.cc	Thu Oct  6 13:55:37 2011	(r3411)
@@ -41,25 +41,6 @@
   /////////////////////////////////////////////////
 
 
-  // Inline functions to avoid template hell
-  inline bool mod2Cmp(const Vector<2>& a, const Vector<2>& b) {
-    return a.mod2() > b.mod2();
-  }
-
-  inline double dot(const Vector<2>& a, const Vector<2>& b) {
-    return a[0]*b[0] + a[1]*b[1];
-  }
-
-  inline Vector<2> unit(const Vector<2>& v) {
-    assert(mod(v) > 0);
-    Vector<2> returnthis;
-    returnthis.set(0, v[0]/mod(v));
-    returnthis.set(1, v[1]/mod(v));
-    return returnthis;
-  }
-
-
-
   //// Do the general case spherocity calculation
   void _calcS(const vector<Vector3 >& perpmomenta, double& sphero, Vector3& saxis) {
     // According to the Salam paper, p5, footnote 4, the
@@ -71,50 +52,39 @@
     vector<Vector3> p = perpmomenta;
     vector<double> sval;
 
-
     // Prepare vector to store unit vector representation of all particle momenta
-    // and also calculate the transverse momentum sum
     vector<Vector3> units;
-    double sumperpmomenta = 0.0;
     foreach (const Vector3& p, perpmomenta) {
       units.push_back(Vector3(p.x(), p.y(), 0.0).unit());
-      sumperpmomenta += p.mod();
     }
 
     // Spherocity calculation
     //
+    // Pick the solution with the smallest spherocity
+    sphero = 99999.;
     // The outer loop is for iteration over all unit vectors
     foreach (const Vector3& u, units){
       double s =0.0;
-      for (unsigned int k=0 ; k<p.size() ; k++)
-        s += fabs(p[k].cross(u).mod()  );
-
-      sval.push_back(s);
-    }
-
-
-    // Pick the solution with the smallest spherocity
-    sphero = 999.;
-    for (unsigned int i=0 ; i<units.size() ; i++)
-      if (sval[i] < sphero){
-        sphero = sval[i];
-        saxis  = units[i];
+      for (unsigned int k=0 ; k<p.size() ; k++) {
+        s += fabs( p[k].cross(u).mod() );
       }
-
+      if (s < sphero) {
+        sphero = s;
+        saxis = u;
+      }
+    }
   }
 
-
-
   // Do the full calculation
   void Spherocity::_calcSpherocity(const vector<Vector3>& fsmomenta) {
 
     // Make a vector of the three-momenta in the final state
     // Explicitly set the z-component (parallel to beam axis) to zero
     // This creates a 3D-vector representation of the transverse momentum
-    // but take the full information momentum vectors as input
+    // but takes the full information momentum vectors as input
 
-    vector<Vector3> fsperpmomenta;
     // A small iteration over full momenta but set z-coord. to 0.0 to get transverse momenta
+    vector<Vector3> fsperpmomenta;
     foreach (const Vector3& p, fsmomenta) {
       fsperpmomenta.push_back(Vector3(p.x(), p.y(), 0.0));
     }
@@ -129,35 +99,6 @@
     _spherocities.clear();
     _spherocityAxes.clear();
 
-    // If there are fewer than 2 visible particles, we can't do much
-    // This is blindly copied from the Thrust projection
-    if (fsmomenta.size() < 2) {
-      for (int i = 0; i < 3; ++i) {
-        _spherocities.push_back(-1);
-        _spherocityAxes.push_back(Vector3(0,0,0));
-      }
-      return;
-    }
-
-    // Handle special case of spherocity = 1 if there are only 2 particles
-    // This is blindly copied from the Thrust projection
-    if (fsmomenta.size() == 2) {
-      Vector3 axis(0,0,0);
-      _spherocities.push_back(1.0);
-      _spherocities.push_back(0.0);
-      _spherocities.push_back(0.0);
-      axis = fsmomenta[0].unit();
-      if (axis.z() < 0) axis = -axis;
-      _spherocityAxes.push_back(axis);
-      /// @todo Improve this --- special directions bad...
-      /// (a,b,c) _|_ 1/(a^2+b^2) (b,-a,0) etc., but which combination minimises error?
-      if (axis.z() < 0.75)
-        _spherocityAxes.push_back( (axis.cross(Vector3(0,0,1))).unit() );
-      else
-        _spherocityAxes.push_back( (axis.cross(Vector3(0,1,0))).unit() );
-      _spherocityAxes.push_back( _spherocityAxes[0].cross(_spherocityAxes[1]) );
-      return;
-    }
 
     // Temporary variables for calcs
     Vector3 axis(0,0,0);
@@ -166,10 +107,10 @@
     // Get spherocity
     _calcS(fsperpmomenta, val, axis);
     MSG_DEBUG("Mom sum = " << perpmomentumSum);
-    double spherocity = PI*PI* val*val / (4 * perpmomentumSum*perpmomentumSum);
+    double spherocity = 0.25 * PI * PI * val * val / (perpmomentumSum * perpmomentumSum);
     _spherocities.push_back(spherocity);
 
-    // See if calclulated spherocity value makes sense
+    // See if calculated spherocity value makes sense
     if (spherocity < 0.0 || spherocity > 1.0) {
       MSG_WARNING("Spherocity = " << spherocity);
     }
@@ -181,33 +122,5 @@
     _spherocityAxes.push_back(axis);
 
 
-    //// Get spherocity minor
-    ////
-    ////
-    //// The Beam axis is eZ = (0, 0, 1)
-    ////
-    //double perpMinor = 0.0;
-    //const Vector3 ez = Vector3(0, 0, 1);
-    //foreach (const Vector3& v, fsperpmomenta) {
-      //Vector3 temp = Vector3(v[0], v[1], 0.0);
-      //perpMinor += mod(temp.cross(_spherocityAxes[0]));
-    //}
-    //_spherocitys.push_back(perpMinor / perpmomentumSum);
-
-
-    //// Manual check
-    //double test = 0.;
-    //Vector<2>  ex;
-    //ex.set(0, 1.0);
-    //ex.set(1, 0);
-    //foreach (const Vector<2> & v, fsperpmomenta2D) {
-      //test+=fabs(dot(ex, v));
-    //}
-    //if (test/perpmomentumSum < _spherocities[0]) {
-      //std::cout << "Warning: " << test/perpmomentumSum << " > " << _spherocitys[0] << "     " << _spherocityAxes[0] << endl;
-    //}
-
   }
-
-
 }

Modified: branches/2011-07-aida2yoda/src/Projections/ZFinder.cc
==============================================================================
--- branches/2011-07-aida2yoda/src/Projections/ZFinder.cc	Thu Oct  6 13:53:16 2011	(r3410)
+++ branches/2011-07-aida2yoda/src/Projections/ZFinder.cc	Thu Oct  6 13:55:37 2011	(r3411)
@@ -103,9 +103,9 @@
         << " + " << l2.momentum() << " " << l2.pdgId() << endl;
 
     _bosons.push_back(Particle(ZBOSON, pZ));
-    getLog() << Log::DEBUG << name() << " found one Z." << endl;
+    MSG_DEBUG(name() << " found one Z");
 
-    // find the LeptonClusters which survived the IMFS cut such that we can
+    // Find the LeptonClusters which survived the IMFS cut such that we can
     // extract their original particles
     foreach (const Particle& p, _constituents) {
       foreach (const ClusteredLepton& l, leptons.clusteredLeptons()) {


More information about the Rivet-svn mailing list