[Rivet-svn] r1853 - trunk/src/Analyses

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Sun Oct 4 16:49:39 BST 2009


Author: buckley
Date: Sun Oct  4 16:49:38 2009
New Revision: 1853

Log:
Moving projection registration into init for PDG analyses

Modified:
   trunk/src/Analyses/PDG_Hadron_Multiplicities.cc
   trunk/src/Analyses/PDG_Hadron_Multiplicities_Ratios.cc

Modified: trunk/src/Analyses/PDG_Hadron_Multiplicities.cc
==============================================================================
--- trunk/src/Analyses/PDG_Hadron_Multiplicities.cc	Sun Oct  4 16:49:15 2009	(r1852)
+++ trunk/src/Analyses/PDG_Hadron_Multiplicities.cc	Sun Oct  4 16:49:38 2009	(r1853)
@@ -16,13 +16,9 @@
   public:
     
     /// Constructor
-    PDG_HADRON_MULTIPLICITIES() 
-      : Analysis("PDG_HADRON_MULTIPLICITIES")
+    PDG_HADRON_MULTIPLICITIES() : Analysis("PDG_HADRON_MULTIPLICITIES")
     {
       setBeams(ELECTRON, POSITRON); 
-      addProjection(Beam(), "Beams");
-      addProjection(ChargedFinalState(), "FS");
-      addProjection(UnstableFinalState(), "UFS");
     }
 
 
@@ -48,15 +44,15 @@
       const ParticlePair& beams = applyProjection<Beam>(e, "Beams").beams();
       const double meanBeamMom = ( beams.first.momentum().vector3().mod() + 
                                    beams.second.momentum().vector3().mod() ) / 2.0;
-      getLog() << Log::DEBUG << "Avg beam momentum = " << meanBeamMom << endl;
+      getLog() << Log::DEBUG << "Avg beam momentum = " << meanBeamMom/GeV << " GeV" << endl;
 
       // Final state of unstable particles to get particle spectra
       const UnstableFinalState& ufs = applyProjection<UnstableFinalState>(e, "UFS");
 
 
-      if (2*meanBeamMom >= 9.5 && 2*meanBeamMom <= 10.5) {
-        for (ParticleVector::const_iterator p = ufs.particles().begin(); p != ufs.particles().end(); ++p) {
-          int id = abs(p->pdgId());
+      if (2*meanBeamMom/GeV >= 9.5 && 2*meanBeamMom/GeV <= 10.5) {
+        foreach (const Particle& p, ufs.particles()) {
+          const PdgId id = abs(p.pdgId());
           switch (id) {
              case 211:
                 _hist10MeanMultiPiPlus->fill(_hist10MeanMultiPiPlus->binMean(0), weight);
@@ -162,9 +158,9 @@
         }
       }
 
-      if (2*meanBeamMom >= 29 && 2*meanBeamMom <= 35) {
-        for (ParticleVector::const_iterator p = ufs.particles().begin(); p != ufs.particles().end(); ++p) {
-          int id = abs(p->pdgId());
+      if (2*meanBeamMom/GeV >= 29 && 2*meanBeamMom/GeV <= 35) {
+        foreach (const Particle& p, ufs.particles()) {
+          const PdgId id = abs(p.pdgId());
           switch (id) {
              case 211:
                 _hist32MeanMultiPiPlus->fill(_hist32MeanMultiPiPlus->binMean(0), weight);
@@ -253,9 +249,9 @@
 
 
 
-      if (2*meanBeamMom >= 89.5 && 2*meanBeamMom <= 91.8) {
-        for (ParticleVector::const_iterator p = ufs.particles().begin(); p != ufs.particles().end(); ++p) {
-          int id = abs(p->pdgId());
+      if (2*meanBeamMom/GeV >= 89.5 && 2*meanBeamMom/GeV <= 91.8) {
+        foreach (const Particle& p, ufs.particles()) {
+          const PdgId id = abs(p.pdgId());
           switch (id) {
              case 211:
                 _hist91MeanMultiPiPlus->fill(_hist91MeanMultiPiPlus->binMean(0), weight);
@@ -421,9 +417,9 @@
 
 
 
-      if (2*meanBeamMom >= 130 && 2*meanBeamMom <= 200) {
-        for (ParticleVector::const_iterator p = ufs.particles().begin(); p != ufs.particles().end(); ++p) {
-          int id = abs(p->pdgId());
+      if (2*meanBeamMom/GeV >= 130 && 2*meanBeamMom/GeV <= 200) {
+        foreach (const Particle& p, ufs.particles()) {
+          const PdgId id = abs(p.pdgId());
           switch (id) {
              case 211:
                 _hist165MeanMultiPiPlus->fill(_hist165MeanMultiPiPlus->binMean(0), weight);
@@ -451,6 +447,10 @@
 
 
     void init() {
+      addProjection(Beam(), "Beams");
+      addProjection(ChargedFinalState(), "FS");
+      addProjection(UnstableFinalState(), "UFS");
+
       _hist10MeanMultiPiPlus             = bookHistogram1D( 1, 1, 1);
       _hist10MeanMultiPi0                = bookHistogram1D( 2, 1, 1);
       _hist10MeanMultiKPlus              = bookHistogram1D( 3, 1, 1);

Modified: trunk/src/Analyses/PDG_Hadron_Multiplicities_Ratios.cc
==============================================================================
--- trunk/src/Analyses/PDG_Hadron_Multiplicities_Ratios.cc	Sun Oct  4 16:49:15 2009	(r1852)
+++ trunk/src/Analyses/PDG_Hadron_Multiplicities_Ratios.cc	Sun Oct  4 16:49:38 2009	(r1853)
@@ -16,13 +16,10 @@
   public:
     
     /// Constructor
-    PDG_HADRON_MULTIPLICITIES_RATIOS() 
-      : Analysis("PDG_HADRON_MULTIPLICITIES_RATIOS")
+    PDG_HADRON_MULTIPLICITIES_RATIOS() : Analysis("PDG_HADRON_MULTIPLICITIES_RATIOS")
     {
       setBeams(ELECTRON, POSITRON); 
-      addProjection(Beam(), "Beams");
-      addProjection(ChargedFinalState(), "FS");
-      addProjection(UnstableFinalState(), "UFS");
+
       _weightedTotalNumPiPlus10 = 0;
       _weightedTotalNumPiPlus32 = 0;
       _weightedTotalNumPiPlus91 = 0;
@@ -52,15 +49,14 @@
       const ParticlePair& beams = applyProjection<Beam>(e, "Beams").beams();
       const double meanBeamMom = ( beams.first.momentum().vector3().mod() + 
                                    beams.second.momentum().vector3().mod() ) / 2.0;
-      getLog() << Log::DEBUG << "Avg beam momentum = " << meanBeamMom << endl;
+      getLog() << Log::DEBUG << "Avg beam momentum = " << meanBeamMom/GeV << " GeV" << endl;
 
       // Final state of unstable particles to get particle spectra
       const UnstableFinalState& ufs = applyProjection<UnstableFinalState>(e, "UFS");
 
-
-      if (2*meanBeamMom >= 9.5 && 2*meanBeamMom <= 10.5) {
-        for (ParticleVector::const_iterator p = ufs.particles().begin(); p != ufs.particles().end(); ++p) {
-          int id = abs(p->pdgId());
+      if (2*meanBeamMom/GeV >= 9.5 && 2*meanBeamMom/GeV <= 10.5) {
+        foreach (const Particle& p, ufs.particles()) {
+          const PdgId id = abs(p.pdgId());
           switch (id) {
              case 211:
                 _weightedTotalNumPiPlus10 += weight;
@@ -166,9 +162,9 @@
         }
       }
 
-      if (2*meanBeamMom >= 29 && 2*meanBeamMom <= 35) {
-        for (ParticleVector::const_iterator p = ufs.particles().begin(); p != ufs.particles().end(); ++p) {
-          int id = abs(p->pdgId());
+      if (2*meanBeamMom/GeV >= 29 && 2*meanBeamMom/GeV <= 35) {
+        foreach (const Particle& p, ufs.particles()) {
+          const PdgId id = abs(p.pdgId());
           switch (id) {
              case 211:
                 _weightedTotalNumPiPlus32 += weight;
@@ -257,9 +253,9 @@
 
 
 
-      if (2*meanBeamMom >= 89.5 && 2*meanBeamMom <= 91.8) {
-        for (ParticleVector::const_iterator p = ufs.particles().begin(); p != ufs.particles().end(); ++p) {
-          int id = abs(p->pdgId());
+      if (2*meanBeamMom/GeV >= 89.5 && 2*meanBeamMom/GeV <= 91.8) {
+        foreach (const Particle& p, ufs.particles()) {
+          const PdgId id = abs(p.pdgId());
           switch (id) {
              case 211:
                 _weightedTotalNumPiPlus91 += weight;
@@ -425,9 +421,9 @@
 
 
 
-      if (2*meanBeamMom >= 130 && 2*meanBeamMom <= 200) {
-        for (ParticleVector::const_iterator p = ufs.particles().begin(); p != ufs.particles().end(); ++p) {
-          int id = abs(p->pdgId());
+      if (2*meanBeamMom/GeV >= 130 && 2*meanBeamMom/GeV <= 200) {
+        foreach (const Particle& p, ufs.particles()) {
+          const PdgId id = abs(p.pdgId());
           switch (id) {
              case 211:
                 _weightedTotalNumPiPlus165 += weight;
@@ -453,6 +449,12 @@
 
 
     void init() {
+      // Projections
+      addProjection(Beam(), "Beams");
+      addProjection(ChargedFinalState(), "FS");
+      addProjection(UnstableFinalState(), "UFS");
+
+      // Histos
       _hist10MeanMultiPi0                = bookHistogram1D( 2, 1, 1);
       _hist10MeanMultiKPlus              = bookHistogram1D( 3, 1, 1);
       _hist10MeanMultiK0                 = bookHistogram1D( 4, 1, 1);


More information about the Rivet-svn mailing list