From 0c15acbaa090b45823e9ddfb79ef92385bb6deb2 Mon Sep 17 00:00:00 2001
From: Bertram Kopf <bertram@pc14.ep1.rub.de>
Date: Thu, 23 May 2013 12:30:00 +0200
Subject: [PATCH] moved some histogramming parts to AbsEnv

---
 PwaUtils/AbsEnv.cc     | 66 +++++++++++++++++++++++++++++++++++
 epemUtils/epemEnv.cc   | 78 ------------------------------------------
 pbarpUtils/pbarpEnv.cc | 45 ------------------------
 3 files changed, 66 insertions(+), 123 deletions(-)

diff --git a/PwaUtils/AbsEnv.cc b/PwaUtils/AbsEnv.cc
index eb7480fd..131379d4 100644
--- a/PwaUtils/AbsEnv.cc
+++ b/PwaUtils/AbsEnv.cc
@@ -243,5 +243,71 @@ void AbsEnv::setup(ParserBase* theParser){
     }
     counter++;
   }
+
+ // hist angles
+  std::vector<std::string> theHistAngleNames=theParser->histAngleNames();
+//fill vector histMassSystems
+  for ( itStr = theHistAngleNames.begin(); itStr != theHistAngleNames.end(); ++itStr){
+    std::stringstream stringStr;
+    stringStr << (*itStr);
+    
+    std::string tmpName;
+    std::vector<std::string> currentStringDecVec;
+    std::vector<std::string> currentStringDecVec2;
+    std::vector<std::string> currentStringMotherVec;
+    bool isDecParticle=true;
+    bool isFirstDecParticle=true;
+    short nBodyDecay=2;
+    while(stringStr >> tmpName){
+      if(tmpName=="from") {
+	isDecParticle=false;
+	continue;
+      }
+      else if(tmpName=="and") {
+	isFirstDecParticle=false;
+	nBodyDecay=3;
+	continue;
+      }
+      if(isDecParticle && isFirstDecParticle) currentStringDecVec.push_back(tmpName);
+      else if(isDecParticle && !isFirstDecParticle) currentStringDecVec2.push_back(tmpName);
+      else currentStringMotherVec.push_back(tmpName);
+    }
+    boost::shared_ptr<angleHistData> currentAngleHistData(new angleHistData(currentStringMotherVec, currentStringDecVec, currentStringDecVec2, nBodyDecay));
+    _angleHistDataVec.push_back(currentAngleHistData);
+  }
+
+  // 2D hists
+  std::vector<std::string> theHistAngleNames2D=theParser->histAngleNames2D();
+  for ( itStr = theHistAngleNames2D.begin(); itStr != theHistAngleNames2D.end(); ++itStr){
+    std::stringstream stringStr;
+    stringStr << (*itStr);
+
+    std::string tmpName;
+    std::vector<std::string> currentStringDecVec;
+    std::vector<std::string> currentStringMotherVec;
+    std::vector<std::string> currentStringDecVec_2;
+    std::vector<std::string> currentStringMotherVec_2;
+    bool isDecParticle=true;
+    bool isFirstAxes=true;
+    while(stringStr >> tmpName){
+      if(tmpName=="from") {
+        isDecParticle=false;
+	std::cout << tmpName << std::endl;
+        continue;
+      }
+      else if(tmpName=="versus") {
+        isFirstAxes=false;
+	isDecParticle=true;
+        continue;
+      }
+      if(isDecParticle && isFirstAxes) currentStringDecVec.push_back(tmpName);
+      else if (!isDecParticle && isFirstAxes) currentStringMotherVec.push_back(tmpName);
+      else if(isDecParticle && !isFirstAxes) currentStringDecVec_2.push_back(tmpName);
+      else currentStringMotherVec_2.push_back(tmpName);
+    }
+    boost::shared_ptr<angleHistData2D> currentAngleHistData2D(new angleHistData2D(currentStringMotherVec, currentStringDecVec, currentStringMotherVec_2, currentStringDecVec_2));
+    _angleHistDataVec2D.push_back(currentAngleHistData2D);
+  }
+
 }
 
diff --git a/epemUtils/epemEnv.cc b/epemUtils/epemEnv.cc
index a7caeaf9..086a14f6 100644
--- a/epemUtils/epemEnv.cc
+++ b/epemUtils/epemEnv.cc
@@ -154,84 +154,6 @@ _cmsMass=theEpEmParser->cmsMass();
     }
   }
 
-  // std::vector<std::string> theHistMassNames=theEpEmParser->histMassNames();
-  // //fill vector histMassSystems
-  // for ( itStr = theHistMassNames.begin(); itStr != theHistMassNames.end(); ++itStr){
-  //   std::stringstream stringStr;
-  //   stringStr << (*itStr);
-    
-  //   std::string tmpName;
-  //   std::vector<std::string> currentStringVec;
-  //   while(stringStr >> tmpName){
-  //     currentStringVec.push_back(tmpName);
-  //   } 
-  //   _histMassSystems.push_back(currentStringVec);
-  // }
-
-  std::vector<std::string> theHistAngleNames=theEpEmParser->histAngleNames();
-  //fill vector histMassSystems
-  for ( itStr = theHistAngleNames.begin(); itStr != theHistAngleNames.end(); ++itStr){
-    std::stringstream stringStr;
-    stringStr << (*itStr);
-    
-    std::string tmpName;
-    std::vector<std::string> currentStringDecVec;
-    std::vector<std::string> currentStringDecVec2;
-    std::vector<std::string> currentStringMotherVec;
-    bool isDecParticle=true;
-    bool isFirstDecParticle=true;
-    short nBodyDecay=2;
-    while(stringStr >> tmpName){
-      if(tmpName=="from") {
-	isDecParticle=false;
-	continue;
-      }
-      else if(tmpName=="and") {
-	isFirstDecParticle=false;
-	nBodyDecay=3;
-	continue;
-      }
-      if(isDecParticle && isFirstDecParticle) currentStringDecVec.push_back(tmpName);
-      else if(isDecParticle && !isFirstDecParticle) currentStringDecVec2.push_back(tmpName);
-      else currentStringMotherVec.push_back(tmpName);
-    }
-    boost::shared_ptr<angleHistData> currentAngleHistData(new angleHistData(currentStringMotherVec, currentStringDecVec, currentStringDecVec2, nBodyDecay));
-    _angleHistDataVec.push_back(currentAngleHistData);
-  }
-
-  std::vector<std::string> theHistAngleNames2D=theEpEmParser->histAngleNames2D();
-  for ( itStr = theHistAngleNames2D.begin(); itStr != theHistAngleNames2D.end(); ++itStr){
-    std::stringstream stringStr;
-    stringStr << (*itStr);
-
-    std::string tmpName;
-    std::vector<std::string> currentStringDecVec;
-    std::vector<std::string> currentStringMotherVec;
-    std::vector<std::string> currentStringDecVec_2;
-    std::vector<std::string> currentStringMotherVec_2;
-    bool isDecParticle=true;
-    bool isFirstAxes=true;
-    while(stringStr >> tmpName){
-      if(tmpName=="from") {
-        isDecParticle=false;
-	std::cout << tmpName << std::endl;
-        continue;
-      }
-      else if(tmpName=="versus") {
-        isFirstAxes=false;
-	isDecParticle=true;
-        continue;
-      }
-      if(isDecParticle && isFirstAxes) currentStringDecVec.push_back(tmpName);
-      else if (!isDecParticle && isFirstAxes) currentStringMotherVec.push_back(tmpName);
-      else if(isDecParticle && !isFirstAxes) currentStringDecVec_2.push_back(tmpName);
-      else currentStringMotherVec_2.push_back(tmpName);
-    }
-    boost::shared_ptr<angleHistData2D> currentAngleHistData2D(new angleHistData2D(currentStringMotherVec, currentStringDecVec, currentStringMotherVec_2, currentStringDecVec_2));
-    _angleHistDataVec2D.push_back(currentAngleHistData2D);
-  }
-
-
 }
 
 
diff --git a/pbarpUtils/pbarpEnv.cc b/pbarpUtils/pbarpEnv.cc
index bd9902e7..5f320e58 100644
--- a/pbarpUtils/pbarpEnv.cc
+++ b/pbarpUtils/pbarpEnv.cc
@@ -193,51 +193,6 @@ void pbarpEnv::setup(pbarpParser* thePbarpParser){
     }
   }
 
-  // std::vector<std::string> theHistMassNames=thePbarpParser->histMassNames();
-  // //fill vector histMassSystems
-  // for ( itStr = theHistMassNames.begin(); itStr != theHistMassNames.end(); ++itStr){
-  //   std::stringstream stringStr;
-  //   stringStr << (*itStr);
-    
-  //   std::string tmpName;
-  //   std::vector<std::string> currentStringVec;
-  //   while(stringStr >> tmpName){
-  //     currentStringVec.push_back(tmpName);
-  //   } 
-  //   _histMassSystems.push_back(currentStringVec);
-  // }
-
-  std::vector<std::string> theHistAngleNames=thePbarpParser->histAngleNames();
-  //fill vector histMassSystems
-  for ( itStr = theHistAngleNames.begin(); itStr != theHistAngleNames.end(); ++itStr){
-    std::stringstream stringStr;
-    stringStr << (*itStr);
-    
-    std::string tmpName;
-    std::vector<std::string> currentStringDecVec;
-    std::vector<std::string> currentStringDecVec2;
-    std::vector<std::string> currentStringMotherVec;
-    bool isDecParticle=true;
-    bool isFirstDecParticle=true;
-    short nBodyDecay=2;
-    while(stringStr >> tmpName){
-      if(tmpName=="from") {
-	isDecParticle=false;
-	continue;
-      }
-      else if(tmpName=="and") {
-	isFirstDecParticle=false;
-	nBodyDecay=3;
-	continue;
-      }
-      if(isDecParticle && isFirstDecParticle) currentStringDecVec.push_back(tmpName);
-      else if(isDecParticle && !isFirstDecParticle) currentStringDecVec2.push_back(tmpName);
-      else currentStringMotherVec.push_back(tmpName);
-    }
-    boost::shared_ptr<angleHistData> currentAngleHistData(new angleHistData(currentStringMotherVec, currentStringDecVec, currentStringDecVec2, nBodyDecay));
-    _angleHistDataVec.push_back(currentAngleHistData);
-  }
-
   // spin density particles
   _spinDensity = thePbarpParser->spinDensityNames();
 
-- 
GitLab