From fcf719ae82e96f997bc9ddb12467e08fbc813955 Mon Sep 17 00:00:00 2001
From: Julian Pychy <julian@pc17.ep1.rub.de>
Date: Mon, 6 May 2013 12:18:47 +0200
Subject: [PATCH] cleaned up qft++ fix, improvements in server and pbarpApp

---
 Examples/pbarp/Jamfile             |  2 +-
 Examples/pbarp/pbarpReactionApp.cc |  2 +-
 Particle/pdtNew.table              |  2 +
 PwaUtils/NetworkServer.cc          |  6 ++-
 PwaUtils/PwaFcnBase.cc             |  1 -
 PwaUtils/PwaFcnBase.hh             |  1 -
 qft++/tensor/TensorIndex.cc        | 30 -----------
 qft++/tensor/TensorIndex.hh        | 24 ---------
 qft++/tensor/TensorIndexOrder.cc   | 22 --------
 qft++/tensor/TensorIndexOrder.hh   | 84 +-----------------------------
 10 files changed, 9 insertions(+), 165 deletions(-)

diff --git a/Examples/pbarp/Jamfile b/Examples/pbarp/Jamfile
index 1c8bd877..4b26f8cd 100644
--- a/Examples/pbarp/Jamfile
+++ b/Examples/pbarp/Jamfile
@@ -14,4 +14,4 @@ lib pbarp :
         :   ;
 
 exe pbarpStatesApp : pbarpStatesApp.cc pbarp : ;
-exe pbarpReactionApp : pbarpReactionApp.cc pbarp : ;
\ No newline at end of file
+exe pbarpReactionApp : pbarpReactionApp.cc pbarp : ;
diff --git a/Examples/pbarp/pbarpReactionApp.cc b/Examples/pbarp/pbarpReactionApp.cc
index 76ef5fa7..d8457d3b 100644
--- a/Examples/pbarp/pbarpReactionApp.cc
+++ b/Examples/pbarp/pbarpReactionApp.cc
@@ -365,7 +365,7 @@ if(mode == "client"){
     std::ofstream serializationStream(serializationFileName.str().c_str());
     boost::archive::text_oarchive boostOutputArchive(serializationStream);
 
-    if(min.IsValid()){
+    if(min.HasValidCovariance()){
        PwaCovMatrix thePwaCovMatrix(theCovMatrix, finalUsrParameters, finalFitParams);
        boostOutputArchive << thePwaCovMatrix;
     }
diff --git a/Particle/pdtNew.table b/Particle/pdtNew.table
index 41e8a798..42610c8e 100644
--- a/Particle/pdtNew.table
+++ b/Particle/pdtNew.table
@@ -135,6 +135,8 @@ Meson K(1460) 		K(1460)  		0  0 -1  0  0   0  0  0  0  	1.460 	0.250   relBW	[PD
 Meson K2(1580) 		K_2(1580)  		0  4 -1  0  0   0  0  0  0  	1.580 	0.110   relBW	[PDG no idea]
 Meson K1(1650) 		K_1(1650)  		0  2  1  0  0   0  0  0  0  	1.650 	0.150   relBW	[PDG no idea]
 Meson K*1(1680) 	K_1^\ast(1680)  	0  2 -1  0  0   0  0  0  0  	1.714 	0.323   relBW	[PDG nonett 3^3D_1]
+Meson K*1(1680)+ 	K_1^\ast(1680)^+  	3  2 -1  0  0   0  0  0  0  	1.714 	0.323   relBW	[PDG nonett 3^3D_1]
+Meson K*1(1680)- 	K_1^\ast(1680)^-  	-1 2 -1  0  0   0  0  0  0  	1.714 	0.323   relBW	[PDG nonett 3^3D_1]
 Meson K2(1770) 		K_2(1770)  		0  4 -1  0  0   0  0  0  0  	1.773 	0.186   relBW	[PDG nonett 3^1D_2]
 Meson K*3(1780) 	K_3^\ast(1780)  	0  6 -1  0  0   0  0  0  0  	1.770 	0.164   relBW	[PDG nonett 3^3D_3]
 Meson K2(1820) 		K_2(1820)  		0  4 -1  0  0   0  0  0  0  	1.816 	0.276   relBW	[PDG no idea]
diff --git a/PwaUtils/NetworkServer.cc b/PwaUtils/NetworkServer.cc
index f78b2d61..58e93696 100644
--- a/PwaUtils/NetworkServer.cc
+++ b/PwaUtils/NetworkServer.cc
@@ -115,8 +115,10 @@ void NetworkServer::AcceptHandler(const boost::system::error_code& err){
 void NetworkServer::Timeout(const boost::system::error_code& err){
 
    if (err != boost::asio::error::operation_aborted){
-      Alert << "Timeout" << endmsg;
+      Alert << "Client timeout!" << endmsg;
+      _timeout = 9999999;
       theAcceptor->cancel();
+      SendClosingMessage();
    }
 }
 
@@ -139,7 +141,7 @@ bool NetworkServer::WaitForLH(double& llh_data, double& weightSum, double& lh_mc
 				boost::bind(&NetworkServer::AcceptHandler, this,
 					    boost::asio::placeholders::error));
       theIOService->run();
-      theIOService->reset();         
+      theIOService->reset();
 
       short connectionPurpose;
       *theStreams.at(i) >> connectionPurpose;
diff --git a/PwaUtils/PwaFcnBase.cc b/PwaUtils/PwaFcnBase.cc
index 6254d8a8..032ac430 100644
--- a/PwaUtils/PwaFcnBase.cc
+++ b/PwaUtils/PwaFcnBase.cc
@@ -29,7 +29,6 @@
 
 #include "PwaUtils/PwaFcnBase.hh"
 #include "PwaUtils/AbsLh.hh"
-#include "PwaUtils/NetworkServer.hh"
 #include "ErrLogger/ErrLogger.hh"
 
 using namespace ROOT::Minuit2;
diff --git a/PwaUtils/PwaFcnBase.hh b/PwaUtils/PwaFcnBase.hh
index 9451e779..87aee689 100644
--- a/PwaUtils/PwaFcnBase.hh
+++ b/PwaUtils/PwaFcnBase.hh
@@ -32,7 +32,6 @@
 #include "PwaUtils/AbsFcn.hh"
 
 class AbsLh;
-class NetworkServer;
 
 namespace ROOT {
   namespace Minuit2 {
diff --git a/qft++/tensor/TensorIndex.cc b/qft++/tensor/TensorIndex.cc
index 67f03110..a6c9ef02 100644
--- a/qft++/tensor/TensorIndex.cc
+++ b/qft++/tensor/TensorIndex.cc
@@ -23,36 +23,6 @@
  */
 //_____________________________________________________________________________
 
-TensorIndex& TensorIndex::Permute() {
-
-  if(_rank < 1) return *this;
-  int level;
-  bool valid = false;
-  while(valid == false){
-    level = _rank - 1;
-    _index += (1 << (level << 1));
-    while(((*this)[level] > (int)_rank - 1) && (level >= 0)){
-      this->SetIndex(level,0);
-      if(level > 0){
-	this->SetIndex(level-1,(*this)[level-1] + 1);
-	level--; 
-      }
-      else{
-	_index = -1;
-	level--;
-      }
-    }
-    valid = true;
-    for(unsigned int i = 0; i < _rank; ++i){
-      for(unsigned int j = 0; j < i; ++j){			  
-	if((j < i) && (*this)[i] == (*this)[j]) valid = false;
-      }
-    }
-  }
-  return (*this); 
-}
-//_____________________________________________________________________________
-
 void TensorIndex::Print(ostream &__os){
   __os << "(" ;
   for(unsigned int i = 0; i < _rank; i++){
diff --git a/qft++/tensor/TensorIndex.hh b/qft++/tensor/TensorIndex.hh
index 499a2c04..8f3cafe6 100644
--- a/qft++/tensor/TensorIndex.hh
+++ b/qft++/tensor/TensorIndex.hh
@@ -121,30 +121,6 @@ public:
     return (--(*this));
   }
 
-  // permutation functions:
-
-  /** Obtains the next valid permuation of the current stored index.
-   *
-   * This function is NOT to be used when the TensorIndex object is being
-   * used to get elements from a tensor (the normal use). 
-   * This function is meant to be used on a TensorIndex object declared for 
-   * the sole purpose of performing permutations on the indicies of a Tensor.
-   */
-  TensorIndex& Permute();
-
-  /** Checks to see if the current index permutation is valid.
-   *
-   * Valid means all indicies are between 0 and Rank-1. The function doesn't 
-   * actually check if any 2 indicies are equal, this is done in 
-   * TensorIndex::Permutation.
-   */
-  bool PermIsValid() const {
-    for(int i = 0; i < this->Size(); i++){
-      if(((*this)[i] < 0)||((*this)[i] >= this->Size())) return false;
-    }
-    return true;
-  }
-
   // functions:
 
   /// Returns the number of entries (coresponds to tensor rank)
diff --git a/qft++/tensor/TensorIndexOrder.cc b/qft++/tensor/TensorIndexOrder.cc
index 1843a7a5..1ea9b6f1 100644
--- a/qft++/tensor/TensorIndexOrder.cc
+++ b/qft++/tensor/TensorIndexOrder.cc
@@ -24,18 +24,6 @@
  */
 //_____________________________________________________________________________
 
-// void print(int _index){
-
-//    for(int i=31; i>=0;i--){
-
-//       int r = 1 & (_index >> i);
-//       std::cout << r;
-
-//    }
-//    std::cout << std::endl;
-
-
-// }
 
 
 TensorIndexOrder& TensorIndexOrder::Permute() {
@@ -67,14 +55,4 @@ TensorIndexOrder& TensorIndexOrder::Permute() {
   }
   return (*this); 
 }
-//_____________________________________________________________________________
 
-void TensorIndexOrder::Print(ostream &__os){
-  __os << "(" ;
-  for(unsigned int i = 0; i < _rank; i++){
-    __os << (*this)[i];
-    if(i < (_rank - 1)) cout << "," ;
-  }
-  __os << ")" << endl;
-}
-//_____________________________________________________________________________
diff --git a/qft++/tensor/TensorIndexOrder.hh b/qft++/tensor/TensorIndexOrder.hh
index 4f2f93b7..fb82cde5 100644
--- a/qft++/tensor/TensorIndexOrder.hh
+++ b/qft++/tensor/TensorIndexOrder.hh
@@ -31,32 +31,7 @@ using namespace std;
  *  @brief TensorIndexOrder class definition file.
  */
 //_____________________________________________________________________________
-/** @class TensorIndexOrder
- *  @author Mike Williams
- *  @author Matt Shepherd
- *
- *  @brief A class that converts \f$(\mu,\nu,...)\f$ to an index for Tensor.
- *
- * This class is a utility class used by Tensor. Its current implementation is
- * limited to tensors of rank 15 or less (well above current memory 
- * capacities).
- * The elements of Tensor<type> T(rank) can be accessed via           
- * TensorIndexOrder index(rank) by simply calling T(index). 
- *
- * <b> Example Usage </b>
- *
- * <!--
- *      TensorIndexOrder index(this->Rank());              
- *      while(index.IsValid()){                       
- *        (*this)(index) "some operations ...";       
- *        ++index;                                                      
- *      }                                                              
- * -->
- * \include TensorIndexOrder.ex
- *
- * Note: Indicies are t = 0, x = 1, y = 2 and z = 3 
- */
-//_____________________________________________________________________________
+
 #include <iostream>
 class TensorIndexOrder {
 
@@ -68,7 +43,6 @@ private:
 public:
 
   // create/copy/destroy
-
   TensorIndexOrder() : _rank(0),_index(0){/** Default Constructor */}
 
   /// Constructor (connect with rank @a rank tensor)
@@ -86,41 +60,6 @@ public:
     return ((_index >> (__level << 2 ) ) & 0xF);
   }
 
-  /// Returns the current index
-  inline int operator()() const {return _index;}
-
-  /** Prefix step up incrementer.
-   *
-   * If TensorIndexOrder index(rank) is defined, then ++index steps up index
-   * to the next valid tensor index.
-   *
-   * Example: If TensorIndexOrder index(3) = (0,2,1), then ++index = (0,2,2)). 
-   *
-   * note: Postfix incrementer, index++, is also defined.
-   */
-  TensorIndexOrder& operator++(){ _index++; return (*this); }
-
-  /// Postfix step up incrementer (see operator++()).
-  inline TensorIndexOrder& operator++(int){
-    return (++(*this));
-  }
-
-  /** Prefix step down incrementer.
-   *
-   * If TensorIndexOrder index(rank) is defined, then --index steps down index
-   * to the next valid tensor index.
-   *
-   * Example: For TensorIndexOrder index(3) = (0,2,1), --index = (0,2,0). 
-   *
-   * note: Postfix incrementer, index--, is also defined.
-   */
-  TensorIndexOrder& operator--(){ _index--; return (*this);}
-
-  /// Postfix step down incrementer (see operator--()).
-  inline TensorIndexOrder& operator--(int){
-    return (--(*this));
-  }
-
   // permutation functions:
 
   /** Obtains the next valid permuation of the current stored index.
@@ -150,32 +89,11 @@ public:
   /// Returns the number of entries (coresponds to tensor rank)
   inline int Size() const {return _rank;}
 
-  /// Adjust the rank
-  inline void Resize(unsigned int __rank) {     
-     std::cout << "rcreated tio " << __rank << std::endl;
-    assert(__rank < 8 ); 
-    _rank = __rank; 
-  }
-
   /// Set the index value
   inline void SetIndex(unsigned int __i,unsigned int __value){
      //    assert(__value < 16 && __i < _rank );
     _index = (_index & ~(0xF << (__i << 2))) + (__value << (__i << 2));
   }
-
-  /// Checks to see if the current tensor index stored is a valid index.
-  inline bool IsValid() const {
-    if( ( _index >> ( _rank << 2 ) ) != 0 ) return false;
-    return true;
-  }
-
-  /// Resets all indicies in this object to 0.
-  inline void Reset() {_index = 0;}
-
-  /** Print to screen the current set of indicies.
-   *  Format is: \f$ (\mu,\nu,\rho,...,\pi) \f$ 
-   */
-  void Print(ostream &__os = cout);
 };
 //_____________________________________________________________________________
 
-- 
GitLab