Print

Print


Commit in lcio/src/cpp/src/UTIL on MAIN
LCTOOLS.cc+97-761.62 -> 1.63
prevent against seg fault for missing algorithm type with ParticleID

lcio/src/cpp/src/UTIL
LCTOOLS.cc 1.62 -> 1.63
diff -u -r1.62 -r1.63
--- LCTOOLS.cc	18 Nov 2008 10:57:47 -0000	1.62
+++ LCTOOLS.cc	2 Jun 2009 15:48:35 -0000	1.63
@@ -1172,6 +1172,13 @@
 		printf("%4.2e, ",  clusters[l]->getEnergy() ) ; 
       }
       cout << endl ;
+      cout <<" subdetector energies : " ;
+      const FloatVec& sdE = clu->getSubdetectorEnergies() ;
+      for(unsigned int l=0;l<sdE.size();l++){
+		printf("%4.2e, ",  sdE[l] ) ; 
+      }
+
+
       if( flag.bitSet( LCIO::CLBIT_HITS ) ) {
 	cout << " hits ->";
 // 	const StringVec& hitColNames = clu->getHitCollectionNames() ;
@@ -1212,24 +1219,29 @@
     
     PIDHandler pidH( col )  ;
     
-    const IntVec& ids =  pidH.getAlgorithmIDs() ;
-
-    for(unsigned i=0; i<ids.size() ; ++i){
-
-      cout << "   [id: " << ids[i] << "]   " 
-	   <<  pidH.getAlgorithmName( ids[i] ) 
-	   << " - params: " ;
+    try{ 
+      const IntVec& ids =  pidH.getAlgorithmIDs() ;
       
-      const StringVec& pNames = pidH.getParameterNames( ids[i] ) ;
- 
-      for( StringVec::const_iterator it = pNames.begin() ; it != pNames.end() ; ++it ){
-
-	cout << " " << *it  ;
+      for(unsigned i=0; i<ids.size() ; ++i){
+	
+	cout << "   [id: " << ids[i] << "]   " 
+	     <<  pidH.getAlgorithmName( ids[i] ) 
+	     << " - params: " ;
+	
+	const StringVec& pNames = pidH.getParameterNames( ids[i] ) ;
+	
+	for( StringVec::const_iterator it = pNames.begin() ; it != pNames.end() ; ++it ){
+	  
+	  cout << " " << *it  ;
+	}
+	cout << endl ;
       }
       cout << endl ;
     }
-    cout << endl ;
-
+    catch( UnknownAlgorithm &e ){
+      cout << "- NA - ";
+    }
+    
     std::cout << endl
 	      << "   [cluster ] |  PDG   | likelihood |  type  |  algoId  | parameters : " << endl
 	      << "              |        |            |        |          |              "
@@ -1248,33 +1260,33 @@
 	
 	if( l!=0)
 	  printf("              " ) ;
-
+	
 	ParticleID* pid = clu->getParticleIDs()[l] ;
+	try{	
+	  printf("| %6d | %6.4e | %6.6d | %8d | [",  
+		 pid->getPDG() , 
+		 pid->getLikelihood()  ,
+		 pid->getType() ,
+		 pid->getAlgorithmType() 
+		 ) ;
+	  
+	  
+	  const StringVec& pNames = pidH.getParameterNames(  pid->getAlgorithmType() ) ;
+	  
+	  for(unsigned j=0;j< pNames.size() ;++j){
+	    
+	    cout << " " <<  pNames[j]
+		 << " : " <<  pid->getParameters()[j] << "," ; 
+	    
+	  }
+	}
+	catch( UnknownAlgorithm &e ){
+	  cout << "- NA - ";
+	}
 	
-	printf("| %6d | %6.4e | %6.6d | %8d | [",  
-	       pid->getPDG() , 
-	       pid->getLikelihood()  ,
-	       pid->getType() ,
-	       pid->getAlgorithmType() 
-	       ) ;
-
-    try{
-        const StringVec& pNames = pidH.getParameterNames(  pid->getAlgorithmType() ) ;
-        
-        for(unsigned j=0;j< pNames.size() ;++j){
-
-          cout << " " <<  pNames[j]
-               << " : " <<  pid->getParameters()[j] << "," ; 
-
-        }
-    }
-    catch( UnknownAlgorithm &e ){
-        cout << "- NA - ";
-    }
-    
 	cout << "]"<< endl ;
 	
-
+	
       }
       cout << endl ;
       
@@ -1282,11 +1294,11 @@
     
     
     
-      cout << endl 
-	   << "-------------------------------------------------------------------------------- " 
-	   << endl ;
+    cout << endl 
+	 << "-------------------------------------------------------------------------------- " 
+	 << endl ;
   }
-
+  
   void LCTOOLS::printVertices( const EVENT::LCCollection* col ){
     if( col->getTypeName() != LCIO::VERTEX ){
       
@@ -1464,30 +1476,35 @@
     
     PIDHandler pidH( col )  ;
     
-    const IntVec& ids =  pidH.getAlgorithmIDs() ;
-
-    for(unsigned i=0; i<ids.size() ; ++i){
-
-      cout << "   [id: " << ids[i] << "]   " 
-	   <<  pidH.getAlgorithmName( ids[i] ) 
-	   << " - params: " ;
+    try{  
+      const IntVec& ids =  pidH.getAlgorithmIDs() ;
       
-      const StringVec& pNames = pidH.getParameterNames( ids[i] ) ;
- 
-      for( StringVec::const_iterator it = pNames.begin() ; it != pNames.end() ; ++it ){
-
-	cout << " " << *it  ;
+      for(unsigned i=0; i<ids.size() ; ++i){
+	
+	cout << "   [id: " << ids[i] << "]   " 
+	     <<  pidH.getAlgorithmName( ids[i] ) 
+	     << " - params: " ;
+	
+	const StringVec& pNames = pidH.getParameterNames( ids[i] ) ;
+	
+	for( StringVec::const_iterator it = pNames.begin() ; it != pNames.end() ; ++it ){
+	  
+	  cout << " " << *it  ;
+	}
+	cout << endl ;
       }
       cout << endl ;
     }
-    cout << endl ;
-
+    catch( UnknownAlgorithm &e ){
+      cout << "- NA - ";
+    }
+    
     std::cout << endl
 	      << "   [particle] |  PDG   | likelihood |  type  |  algoId  | parameters : " << endl
 	      << "              |        |            |        |          |              "
       	      << endl ;
-
-
+    
+    
     for( int i=0 ; i< nPrint ; i++ ){
       
       ReconstructedParticle* recP = 
@@ -1502,31 +1519,35 @@
 	  printf("              " ) ;
 
 	ParticleID* pid = recP->getParticleIDs()[l] ;
-	
-	printf("| %6d | %6.4e | %6.6d | %8d | [",  
-	       pid->getPDG() , 
-	       pid->getLikelihood()  ,
-	       pid->getType() ,
-	       pid->getAlgorithmType() 
-	       ) ;
-
-	const StringVec& pNames = pidH.getParameterNames(  pid->getAlgorithmType() ) ;
-	
-	for(unsigned j=0;j< pNames.size() ;++j){
-
-	  cout << " " <<  pNames[j]
-	       << " : " <<  pid->getParameters()[j] << "," ; 
-
+	try{	
+	  printf("| %6d | %6.4e | %6.6d | %8d | [",  
+		 pid->getPDG() , 
+		 pid->getLikelihood()  ,
+		 pid->getType() ,
+		 pid->getAlgorithmType() 
+		 ) ;
+	  
+	  const StringVec& pNames = pidH.getParameterNames(  pid->getAlgorithmType() ) ;
+	  
+	  for(unsigned j=0;j< pNames.size() ;++j){
+	    
+	    cout << " " <<  pNames[j]
+		 << " : " <<  pid->getParameters()[j] << "," ; 
+	    
+	  }
+	  cout << "]"<< endl ;
+	  
+        }
+	catch( UnknownAlgorithm &e ){
+	  cout << "- NA - ";
 	}
-	cout << "]"<< endl ;
 	
-
       }
       cout << endl ;
       
-    }
-    
+    } 
     
+
     
     cout << endl 
 	 << "-------------------------------------------------------------------------------- " 
CVSspam 0.2.8