[Rivet-svn] r3516 - branches/2011-07-aida2yoda/src/Analyses trunk/src/Analyses

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Dec 6 16:26:07 GMT 2011


Author: hoeth
Date: Tue Dec  6 16:26:07 2011
New Revision: 3516

Log:
simplify code in ALEPH_1999_S4193598

Modified:
   branches/2011-07-aida2yoda/src/Analyses/ALEPH_1999_S4193598.cc
   trunk/src/Analyses/ALEPH_1999_S4193598.cc

Modified: branches/2011-07-aida2yoda/src/Analyses/ALEPH_1999_S4193598.cc
==============================================================================
--- branches/2011-07-aida2yoda/src/Analyses/ALEPH_1999_S4193598.cc	Tue Dec  6 16:11:16 2011	(r3515)
+++ branches/2011-07-aida2yoda/src/Analyses/ALEPH_1999_S4193598.cc	Tue Dec  6 16:26:07 2011	(r3516)
@@ -8,11 +8,9 @@
 #include "Rivet/Projections/ChargedFinalState.hh"
 #include "Rivet/Projections/UnstableFinalState.hh"
 
-bool hasDecayedTo(const Rivet::Particle& p, int id1, int id2) {
+bool hasDecayedTo(const HepMC::GenParticle* p, int id1, int id2) {
   bool decision = false;
-  const HepMC::GenParticle& genp = p.genParticle();
-  //HepMC::GenVertex* prodV = genp.production_vertex();
-  HepMC::GenVertex* decV  = genp.end_vertex();
+  HepMC::GenVertex* decV  = p->end_vertex();
   std::vector<int> decids;
   if (decV->particles_out_size() == 2) {
     for (HepMC::GenVertex::particles_out_const_iterator pp = decV->particles_out_const_begin() ;
@@ -25,24 +23,8 @@
   return decision;
 }
 
-bool hasDecayedTo(const HepMC::GenParticle* p, int id1, int id2) {
-  bool decision = false;
-  HepMC::GenVertex* decV  = p->end_vertex();
-  std::vector<int> decids;
-  std::vector<int> decids2;
-  if (decV->particles_out_size() == 2) {
-    for (HepMC::GenVertex::particles_out_const_iterator pp = decV->particles_out_const_begin() ;
-         pp != decV->particles_out_const_end() ; ++pp) {
-      decids.push_back(fabs((*pp)->pdg_id()));
-      decids2.push_back((*pp)->pdg_id());
-    }
-    if ( (decids[0] == fabs(id1) && decids[1] == fabs(id2)) || (decids[1] == fabs(id1) && decids[0] == fabs(id2)) ) {
-      decision = true;
-      std::cout << decids2[0] <<  " " << decids2[1] << std::endl;
-    }
-
-  };
-  return decision;
+bool hasDecayedTo(const Rivet::Particle& p, int id1, int id2) {
+  return hasDecayedTo(p.genParticle(), id1, id2);
 }
 
 namespace Rivet {

Modified: trunk/src/Analyses/ALEPH_1999_S4193598.cc
==============================================================================
--- trunk/src/Analyses/ALEPH_1999_S4193598.cc	Tue Dec  6 16:11:16 2011	(r3515)
+++ trunk/src/Analyses/ALEPH_1999_S4193598.cc	Tue Dec  6 16:26:07 2011	(r3516)
@@ -8,11 +8,9 @@
 #include "Rivet/Projections/ChargedFinalState.hh"
 #include "Rivet/Projections/UnstableFinalState.hh"
 
-bool hasDecayedTo(const Rivet::Particle& p, int id1, int id2) {
+bool hasDecayedTo(const HepMC::GenParticle* p, int id1, int id2) {
   bool decision = false;
-  const HepMC::GenParticle& genp = p.genParticle();
-  //HepMC::GenVertex* prodV = genp.production_vertex();
-  HepMC::GenVertex* decV  = genp.end_vertex();
+  HepMC::GenVertex* decV  = p->end_vertex();
   std::vector<int> decids;
   if (decV->particles_out_size() == 2) {
     for (HepMC::GenVertex::particles_out_const_iterator pp = decV->particles_out_const_begin() ;
@@ -25,24 +23,8 @@
   return decision;
 }
 
-bool hasDecayedTo(const HepMC::GenParticle* p, int id1, int id2) {
-  bool decision = false;
-  HepMC::GenVertex* decV  = p->end_vertex();
-  std::vector<int> decids;
-  std::vector<int> decids2;
-  if (decV->particles_out_size() == 2) {
-    for (HepMC::GenVertex::particles_out_const_iterator pp = decV->particles_out_const_begin() ;
-         pp != decV->particles_out_const_end() ; ++pp) {
-      decids.push_back(fabs((*pp)->pdg_id()));
-      decids2.push_back((*pp)->pdg_id());
-    }
-    if ( (decids[0] == fabs(id1) && decids[1] == fabs(id2)) || (decids[1] == fabs(id1) && decids[0] == fabs(id2)) ) {
-      decision = true;
-      std::cout << decids2[0] <<  " " << decids2[1] << std::endl;
-    }
-
-  };
-  return decision;
+bool hasDecayedTo(const Rivet::Particle& p, int id1, int id2) {
+  return hasDecayedTo(p.genParticle(), id1, id2);
 }
 
 namespace Rivet {


More information about the Rivet-svn mailing list