2 added + 5 modified, total 7 files
lcio/doc
diff -u -r1.5.4.1 -r1.5.4.2
--- index.html 15 Aug 2006 15:56:46 -0000 1.5.4.1
+++ index.html 24 Aug 2006 14:20:35 -0000 1.5.4.2
@@ -4,7 +4,7 @@
<body>
<hr>
-<h1>Documentation for LCIO v01-088888888</h1>
+<h1>Documentation for LCIO v01-08</h1>
<hr>
lcio/src/cpp/include/IMPL
diff -u -r1.1.2.4 -r1.1.2.5
--- VertexImpl.h 18 Aug 2006 13:39:14 -0000 1.1.2.4
+++ VertexImpl.h 24 Aug 2006 14:20:36 -0000 1.1.2.5
@@ -6,7 +6,6 @@
#include "EVENT/Vertex.h"
#include "AccessChecked.h"
-
#define VTXCOVMATRIX 6
@@ -20,7 +19,8 @@
* @version Aug 09, 2006
*/
class VertexImpl : public EVENT::Vertex, public AccessChecked {
-
+
+
public:
/** Default constructor, initializes values to 0.
lcio/src/cpp/include/UTIL
diff -N Operators.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Operators.h 24 Aug 2006 14:20:36 -0000 1.1.2.1
@@ -0,0 +1,51 @@
+#ifndef LCIO_OPERATORS_H
+#define LCIO_OPERATORS_H 1
+
+#include "IMPL/VertexImpl.h"
+#include "IMPL/ReconstructedParticleImpl.h"
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// override some operators to enable one to send objects to the output stream (e.g. cout << vertexObj << endl;
+//
+// EXP: UNDER DEVELOPMENT!!!
+//
+// author engels
+// version Aug 24, 2006
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace UTIL{
+
+ //template to enable the use of the operator << for a "one-line" output of an object.
+ //since there are two ostream& << operators for sending an object to the output stream this
+ //template works like a "wrapper class" so that the correct operator can be triggered for the
+ //respective detailed/short output
+ template <class T> struct lcio_short{
+ const T* obj;
+ lcio_short(const T* t) : obj(t) {}
+ };
+
+ //template to enable a "one-line" output of a vertex object
+ template <class T> lcio_short<T> lcshort( const T* t){ return lcio_short<T>(t); }
+
+ /** operator for detailed output of a vertex object (e.g. cout << vertexObj << endl; ) */
+ std::ostream& operator<<( std::ostream& out, const EVENT::Vertex* v);
+
+ /** operator for short output of a vertex object (e.g. cout << lcshort(vertexObj) << endl; ) */
+ std::ostream& operator<<( std::ostream& out, const UTIL::lcio_short<EVENT::Vertex>& sV);
+
+ //deprecated
+ //std::string brief( const EVENT::Vertex* v);
+
+ /** for printing the header of a vertex object (e.g. cout << header(vertexObj) << endl; ) */
+ const std::string& header( const EVENT::Vertex* v);
+
+ /** for printing the tail of a vertex object (e.g. cout << tail(vertexObj) << endl; ) */
+ const std::string& tail( const EVENT::Vertex* v);
+
+}//namespace
+
+#endif /* ifndef LCIO_OPERATORS_H */
lcio/src/cpp/src/EXAMPLE
diff -u -r1.1.2.5 -r1.1.2.6
--- testvtx.cc 18 Aug 2006 13:39:15 -0000 1.1.2.5
+++ testvtx.cc 24 Aug 2006 14:20:36 -0000 1.1.2.6
@@ -9,6 +9,7 @@
#include "LCIOSTLTypes.h"
#include "UTIL/LCTOOLS.h"
+#include "UTIL/Operators.h"
using namespace std ;
using namespace lcio ;
@@ -19,19 +20,23 @@
////////////////////////////////////////////////////////////////////////////////
int main(int argc, char** argv ){
+
+ LCCollectionVec* vertexVec = new LCCollectionVec( LCIO::VERTEX ) ;
+
+ //gives a warnig...
+ //cout<<header(&VertexImpl());
+
+ for(int i=0; i < 10; i++){
- LCCollectionVec* vertexVec = new LCCollectionVec( LCIO::VERTEX ) ;
- for(int i=0; i < (10); i++){
VertexImpl* vtx = new VertexImpl ;
- if(i==0){
- vtx->setPrimary(true);
- }else{
- vtx->setPrimary(false);
- }
+
+ if( i==0 ){ vtx->setPrimary(true); }
+ else{ vtx->setPrimary(false); }
+
vtx->setChi2(1+i*.01);
vtx->setProbability(0.0032+i*.01);
vtx->setPosition(0.3453+i*.01,.45345354+i*.01,2.345354+i*.01);
-
+
FloatVec cov(6) ;
cov[0] = 1. ;
cov[1] = 2. ;
@@ -40,18 +45,24 @@
cov[4] = 5. ;
cov[5] = 6. ;
-
vtx->setCovMatrix( cov ) ;
-
+
+ //Vertex* v=vtx;
+ //cout<<lcshort(v);
+
vertexVec->addElement ( vtx ) ;
-
- }
- LCTOOLS::printVertices( vertexVec ) ;
+ }
+ //gives a warnig...
+ //cout<<tail(&VertexImpl());
+
+ cout<<&IMPL::VertexImpl()<<endl;
+
+ LCTOOLS::printVertices( vertexVec ) ;
+
delete vertexVec ;
return 0 ;
}
-
lcio/src/cpp/src/IMPL
diff -u -r1.1.2.4 -r1.1.2.5
--- VertexImpl.cc 18 Aug 2006 13:39:16 -0000 1.1.2.4
+++ VertexImpl.cc 24 Aug 2006 14:20:37 -0000 1.1.2.5
@@ -18,7 +18,7 @@
_vpos[2] = 0. ;
}
- VertexImpl::~VertexImpl(){ /*TODO*/ }
+ VertexImpl::~VertexImpl(){ }
bool VertexImpl::isPrimary() const { return _primary ;}
float VertexImpl::getChi2() const { return _chi2 ; }
@@ -75,7 +75,9 @@
checkAccess("VertexImpl::addParameter") ;
_par.push_back( p ) ;
}
-
} // end namespace
+
+
+
lcio/src/cpp/src/UTIL
diff -N Operators.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Operators.cc 24 Aug 2006 14:20:40 -0000 1.1.2.1
@@ -0,0 +1,92 @@
+#include "UTIL/Operators.h"
+
+////////////////////////////////////////////////////////////////////////////////
+// EXP: UNDER DEVELOPMENT!!!
+////////////////////////////////////////////////////////////////////////////////
+
+using namespace std;
+
+namespace UTIL{
+
+ std::ostream& operator<<( std::ostream& out, const UTIL::lcio_short<EVENT::Vertex>& sV){
+ const EVENT::Vertex* v=sV.obj;
+ out << " [" << setfill('0') << setw(8) << hex << v->id() << "] | " << v->isPrimary()<< " | ";
+ out << scientific << setprecision(3) << v->getChi2() << " | " << v->getProbability() << " | " <<
+ v->getPosition()[0] << ", " <<
+ v->getPosition()[1] << ", " <<
+ v->getPosition()[2] << " | " ;
+
+ for(int i=0;i<VTXCOVMATRIX;i++)
+ out << v->getCovMatrix()[i] << (i<(VTXCOVMATRIX-1)?", ":" | [");
+ out << setfill('0') << setw(8) << hex << (v->getAssociatedParticle()!=NULL?v->getAssociatedParticle()->id():0) << "]\n";
+
+ return out;
+
+ }
+
+ std::ostream& operator<<( std::ostream& out, const EVENT::Vertex* v){
+
+ out << "Vertex ID:\t\t[" << setfill('0') << setw(8) << hex << v->id() << "]" << endl;
+ out << "Is Primary Vertex:\t" << (v->isPrimary() ? "true":"false") << endl;
+ out << scientific << setprecision(5);
+ out << "Chi2:\t\t\t" << v->getChi2() << endl;
+ out << "Probability:\t\t" << v->getProbability() << endl;
+ out << "Position (x, y, z):\t" <<
+ v->getPosition()[0] <<", "<<
+ v->getPosition()[1] <<", "<<
+ v->getPosition()[2] << endl;
+
+ out << "Covariance Matrix:\t";
+ for(int i=0;i<VTXCOVMATRIX;i++)
+ out << v->getCovMatrix()[i] << (i<(VTXCOVMATRIX-1)?", ":"\n");
+ out << "Associated Reconstructed Particle ID:\t[";
+ out << setfill('0') << setw(8) << hex << (v->getAssociatedParticle()!=NULL?v->getAssociatedParticle()->id():0) <<"]\n\n";
+
+ return out;
+ }
+
+//deprecated
+/*
+ std::string brief(const EVENT::Vertex* v){
+ std::string str;
+ char buffer[256];
+
+ sprintf( buffer, " [%8.8x] | %1d | %4.2e | %4.2e | %5.3e, %5.3e, %5.3e | "
+ , v->id()
+ , v->isPrimary()
+ , v->getChi2()
+ , v->getProbability()
+ , v->getPosition()[0]
+ , v->getPosition()[1]
+ , v->getPosition()[2]
+ ) ;
+
+ for(int i=0; i<VTXCOVMATRIX; i++)
+ sprintf( buffer, "%s%5.3e%s", buffer, v->getCovMatrix()[i], (i<(VTXCOVMATRIX-1) ? ", ":" |") ) ;
+
+ sprintf( buffer, "%s [%8.8x]\n", buffer, (v->getAssociatedParticle()!=NULL? v->getAssociatedParticle()->id(): 0) ) ;
+
+ str = buffer;
+ return str;
+ }
+*/
+
+ const std::string& header(const EVENT::Vertex* v){
+
+ static std::string _vtxh(
+ "\n [id] |pri| chi2 | prob. | position ( x, y, z) |"
+ " covariance matrix (px, py, pz) | [idRecP] \n");
+ _vtxh+=tail(new IMPL::VertexImpl());
+ return _vtxh;
+ }
+
+ const std::string& tail(const EVENT::Vertex* v){
+
+ static std::string _vtxt(
+ "------------|---|----------|----------|---------------------------------|"
+ "------------------------------------------------------------------|------------\n");
+ return _vtxt;
+ }
+
+} // namespace
+
lcio/src/cpp/src/UTIL
diff -u -r1.49.4.1 -r1.49.4.2
--- LCTOOLS.cc 18 Aug 2006 13:39:16 -0000 1.49.4.1
+++ LCTOOLS.cc 24 Aug 2006 14:20:37 -0000 1.49.4.2
@@ -1,4 +1,5 @@
#include "UTIL/LCTOOLS.h"
+#include "UTIL/Operators.h"
#include "EVENT/LCCollection.h"
#include "EVENT/SimCalorimeterHit.h"
@@ -1316,37 +1317,40 @@
int nVertices = col->getNumberOfElements() ;
int nPrint = nVertices > MAX_HITS ? MAX_HITS : nVertices ;
- std::cout << endl
-
- << " [ id ] |pri| chi2 | probability | position ( x,y,z) | [idRecP] "
- << endl
- << " ----------|---|--------|-------------|----------------------------------|----------"
- << endl ;
+
+ /*
+ cout << "\n [id] |pri| chi2 | prob. | position ( x, y, z) |"
+ " covariance matrix (px, py, pz) | [idRecP] \n"
+ "------------|---|----------|----------|---------------------------------|"
+ "------------------------------------------------------------------|-----------\n";
+ */
for( int i=0 ; i< nPrint ; i++ ){
Vertex* v = dynamic_cast<Vertex*>( col->getElementAt( i ) ) ;
-
- printf(" [%8.8x] | %1d | %4.2e | %4.2e | (%5.3e,%5.3e,%5.3e) | [%8.8x] \n"
- , v->id()
- , v->isPrimary()
- , v->getChi2()
- , v->getProbability()
- , v->getPosition()[0]
- , v->getPosition()[1]
- , v->getPosition()[2]
- , (v->getAssociatedParticle()!=NULL?v->getAssociatedParticle()->id():0)
- ) ;
- cout << " covariance( px,py,pz) : (" ;
- for(int l=0;l<6;l++){
- printf("%4.2e, ", v->getCovMatrix()[l] ) ;
- }
- cout << ")" << endl ;
-
- cout << " ----------|---|--------|-------------|----------------------------------|----------"
- << endl ;
+
+ if( i==0) { cout<<header(v); }
+ cout<<lcshort(v);
+ if(i==nPrint-1){ cout<<tail(v); }
+ /*
+ printf(" [%8.8x] | %1d | %4.2e | %4.2e | %5.3e, %5.3e, %5.3e | "
+ , v->id()
+ , v->isPrimary()
+ , v->getChi2()
+ , v->getProbability()
+ , v->getPosition()[0]
+ , v->getPosition()[1]
+ , v->getPosition()[2]
+ ) ;
+
+ for(int j=0; j<6; j++)
+ printf("%5.3e%s", v->getCovMatrix()[j], (j<(6-1) ? ", ":" | ") ) ;
+
+ printf("[%8.8x]\n", (v->getAssociatedParticle()!=NULL? v->getAssociatedParticle()->id(): 0) ) ;
+
+ cout << "------------|---|----------|----------|---------------------------------|"
+ "------------------------------------------------------------------|-----------\n";
+ */
}
- cout << endl << "--------------------------------------------------------------------------------------- "
- << endl ;
}
void LCTOOLS::printReconstructedParticles( const EVENT::LCCollection* col ){
CVSspam 0.2.8