17 modified files
lcio/src/aid/EVENT
diff -u -r1.2.2.7 -r1.2.2.8
--- Vertex.aid 31 Aug 2006 15:18:54 -0000 1.2.2.7
+++ Vertex.aid 11 Sep 2006 13:05:29 -0000 1.2.2.8
@@ -15,7 +15,7 @@
* <p>UNDER DEVELOPMENT!</p>
*
* @author gaede, engels
- * @version $Id: Vertex.aid,v 1.2.2.7 2006/08/31 15:18:54 engels Exp $
+ * @version $Id: Vertex.aid,v 1.2.2.8 2006/09/11 13:05:29 engels Exp $
*/
public interface Vertex extends LCObject {
@@ -36,7 +36,8 @@
/** Type code for the algorithm that has been used to create the vertex - check/set the
* collection parameters AlgorithmName and AlgorithmType.
*/
- public int getAlgorithmType() const ;
+ //public int getAlgorithmType() const ;
+ public const String& getAlgorithmType() const ;
/** Chi squared of the vertex fit.
*/
lcio/src/cpp/include/CPPFORT
diff -u -r1.1.2.3 -r1.1.2.4
--- lcvtx.h 31 Aug 2006 15:18:55 -0000 1.1.2.3
+++ lcvtx.h 11 Sep 2006 13:05:29 -0000 1.1.2.4
@@ -14,7 +14,7 @@
int lcvtxid( PTRTYPE vtx ) ;
bool lcvtxisprimary( PTRTYPE vtx ) ;
-int lcvtxgetalgorithmtype( PTRTYPE vtx ) ;
+char* lcvtxgetalgorithmtype( PTRTYPE vtx ) ;
float lcvtxgetchi2( PTRTYPE vtx ) ;
float lcvtxgetprobability( PTRTYPE vtx ) ;
int lcvtxgetposition( PTRTYPE vtx, float* pos ) ;
@@ -23,7 +23,7 @@
PTRTYPE lcvtxgetassociatedparticle( PTRTYPE vtx ) ;
int lcvtxsetprimary( PTRTYPE vtx, bool pri ) ;
-int lcvtxsetalgorithmtype( PTRTYPE vtx, int type ) ;
+int lcvtxsetalgorithmtype( PTRTYPE vtx, char* type ) ;
int lcvtxsetchi2( PTRTYPE vtx, float chi2 ) ;
int lcvtxsetprobability( PTRTYPE vtx, float prob ) ;
int lcvtxsetposition( PTRTYPE vtx, float* pos ) ;
@@ -40,7 +40,7 @@
FCALLSCFUN1(INT, lcvtxid, LCVTXID, lcvtxid, CFORTRANPNTR)
FCALLSCFUN1(LOGICAL, lcvtxisprimary, LCVTXISPRIMARY, lcvtxisprimary, CFORTRANPNTR)
-FCALLSCFUN1(INT, lcvtxgetalgorithmtype, LCVTXGETALGORITHMTYPE, lcvtxgetalgorithmtype, CFORTRANPNTR)
+FCALLSCFUN1(STRING, lcvtxgetalgorithmtype, LCVTXGETALGORITHMTYPE, lcvtxgetalgorithmtype, CFORTRANPNTR)
FCALLSCFUN1(FLOAT, lcvtxgetchi2, LCVTXGETCHI2, lcvtxgetchi2, CFORTRANPNTR)
FCALLSCFUN1(FLOAT, lcvtxgetprobability, LCVTXGETPROBABILITY, lcvtxgetprobability, CFORTRANPNTR)
FCALLSCFUN2(INT, lcvtxgetposition, LCVTXGETPOSITION, lcvtxgetposition, CFORTRANPNTR, FLOATV)
@@ -49,7 +49,7 @@
FCALLSCFUN1(CFORTRANPNTR, lcvtxgetassociatedparticle, LCVTXGETASSOCIATEDPARTICLE, lcvtxgetassociatedparticle, CFORTRANPNTR)
FCALLSCFUN2(INT, lcvtxsetprimary, LCVTXSETPRIMARY, lcvtxsetprimary, CFORTRANPNTR, LOGICAL)
-FCALLSCFUN2(INT, lcvtxsetalgorithmtype, LCVTXSETALGORITHMTYPE, lcvtxsetalgorithmtype, CFORTRANPNTR, INT)
+FCALLSCFUN2(INT, lcvtxsetalgorithmtype, LCVTXSETALGORITHMTYPE, lcvtxsetalgorithmtype, CFORTRANPNTR, STRING)
FCALLSCFUN2(INT, lcvtxsetchi2, LCVTXSETCHI2, lcvtxsetchi2, CFORTRANPNTR, FLOAT)
FCALLSCFUN2(INT, lcvtxsetprobability, LCVTXSETPROBABILITY, lcvtxsetprobability, CFORTRANPNTR, FLOAT)
FCALLSCFUN2(INT, lcvtxsetposition, LCVTXSETPOSITION, lcvtxsetposition, CFORTRANPNTR, FLOATV)
lcio/src/cpp/include/IMPL
diff -u -r1.1.2.6 -r1.1.2.7
--- VertexImpl.h 31 Aug 2006 15:18:55 -0000 1.1.2.6
+++ VertexImpl.h 11 Sep 2006 13:05:29 -0000 1.1.2.7
@@ -27,7 +27,7 @@
*/
VertexImpl() ;
- /// Destructor.
+ // Destructor.
virtual ~VertexImpl() ;
virtual int id() const { return simpleUID() ; }
@@ -40,7 +40,8 @@
/** Type code for the algorithm that has been used to create the vertex - check/set the
* collection parameters AlgorithmName and AlgorithmType.
*/
- virtual int getAlgorithmType() const ;
+ //virtual int getAlgorithmType() const ;
+ virtual const std::string& getAlgorithmType() const ;
/** Chi squared of the vertex fit.
*/
@@ -70,7 +71,8 @@
// setters
void setPrimary( bool primary ) ;
- void setAlgorithmType( int type ) ;
+ //void setAlgorithmType( int type ) ;
+ void setAlgorithmType( std::string type ) ;
void setChi2( float chi2 ) ;
void setProbability( float probability ) ;
void setPosition( float vpos[3] ) ;
@@ -82,7 +84,8 @@
protected:
int _primary ;
- int _type ;
+ //int _type ;
+ std::string _type ;
float _chi2 ;
float _probability ;
float _vpos[3] ;
lcio/src/cpp/include/SIO
diff -u -r1.1.2.1 -r1.1.2.2
--- SIOVertexHandler.h 15 Aug 2006 13:01:14 -0000 1.1.2.1
+++ SIOVertexHandler.h 11 Sep 2006 13:05:30 -0000 1.1.2.2
@@ -2,7 +2,11 @@
#define SIO_SIOVERTEXHANDLER_H 1
#include "SIO/SIOObjectHandler.h"
+#include "LCIOSTLTypes.h"
+#include <map>
+#include <set>
+#include <string>
namespace SIO {
@@ -10,23 +14,34 @@
/** Implementation of SIOObjectHandler to handle IO of Vertexes.
*
* @author gaede, engels
- * @version $Id: SIOVertexHandler.h,v 1.1.2.1 2006/08/15 13:01:14 engels Exp $
+ * @version $Id: SIOVertexHandler.h,v 1.1.2.2 2006/09/11 13:05:30 engels Exp $
*/
class SIOVertexHandler : public SIOObjectHandler {
public:
+
+ virtual ~SIOVertexHandler() ;
+
+ virtual unsigned int init( SIO_stream* stream,
+ SIO_operation op,
+ EVENT::LCCollection* col,
+ unsigned int vers ) ;
/** Reads lcio Vertex objects from an SIO stream.
*/
- virtual unsigned int read(SIO_stream* stream,
- EVENT::LCObject** objP) ;
+ virtual unsigned int read(SIO_stream* stream, EVENT::LCObject** objP) ;
/** Writes lcio Vertex objects to an SIO stream.
*/
- virtual unsigned int write(SIO_stream* stream,
- const EVENT::LCObject* obj) ;
-
+ virtual unsigned int write(SIO_stream* stream, const EVENT::LCObject* obj) ;
+
+ protected:
+ std::map<int,std::string> imr; //indexmap for reading
+ //std::map<std::string,int> imw; //indexmap for writing (used with FIFO)
+ std::set<std::string> _set;
+ EVENT::StringVec parameters; //needed for putting the collection parameters into the STL Containers
+
}; // class
} // namespace
lcio/src/cpp/include/UTIL
diff -u -r1.1.2.2 -r1.1.2.3
--- Operators.h 4 Sep 2006 10:30:13 -0000 1.1.2.2
+++ Operators.h 11 Sep 2006 13:05:30 -0000 1.1.2.3
@@ -1,9 +1,11 @@
#ifndef LCIO_OPERATORS_H
#define LCIO_OPERATORS_H 1
-#include "IMPL/VertexImpl.h"
-#include "IMPL/ReconstructedParticleImpl.h"
-#include "EVENT/LCCollection.h"
+//#include "EVENT/LCCollection.h"
+#include "EVENT/Vertex.h"
+#include "EVENT/ReconstructedParticle.h"
+
+//#include "UTIL/IndexMap.h"
#include <iostream>
#include <iomanip>
@@ -14,8 +16,8 @@
//
// EXP: UNDER DEVELOPMENT!!!
//
-// author engels
-// version Aug 24, 2006
+// @author engels
+// @version $Id: Operators.h,v 1.1.2.3 2006/09/11 13:05:30 engels Exp $
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
namespace UTIL{
lcio/src/cpp/src/CPPFORT
diff -u -r1.1.2.3 -r1.1.2.4
--- lcvtx.cc 31 Aug 2006 15:18:55 -0000 1.1.2.3
+++ lcvtx.cc 11 Sep 2006 13:05:30 -0000 1.1.2.4
@@ -33,9 +33,9 @@
return vtx->isPrimary() ;
}
-int lcvtxgetalgorithmtype ( PTRTYPE vertex ) {
+char* lcvtxgetalgorithmtype ( PTRTYPE vertex ) {
VertexImpl* vtx = f2c_pointer<VertexImpl,LCObject>( vertex ) ;
- return vtx->getAlgorithmType() ;
+ return const_cast<char*>( vtx->getAlgorithmType().c_str() );
}
float lcvtxgetchi2( PTRTYPE vertex ) {
@@ -90,7 +90,7 @@
return LCIO::SUCCESS ;
}
-int lcvtxsetalgorithmtype( PTRTYPE vertex, int type ) {
+int lcvtxsetalgorithmtype( PTRTYPE vertex, char* type ) {
VertexImpl* vtx = f2c_pointer<VertexImpl,LCObject>( vertex ) ;
vtx->setAlgorithmType( type ) ;
return LCIO::SUCCESS ;
lcio/src/cpp/src/EXAMPLE
diff -u -r1.49.2.4 -r1.49.2.5
--- recjob.cc 4 Sep 2006 10:30:14 -0000 1.49.2.4
+++ recjob.cc 11 Sep 2006 13:05:31 -0000 1.49.2.5
@@ -32,9 +32,7 @@
#define M_PI 3.14159265358979323846
#include <iostream>
-#include <map>
#include <algorithm>
-//#include <string>
using namespace std ;
using namespace lcio ;
@@ -496,6 +494,17 @@
default: break;
}
*/
+
+ //EXP: INDEX MAP V2 - UNDER DEVELOPMENT
+ switch(rand()%7){
+ case 0: vtx->setAlgorithmType( "ZvTop" ); break;
+ case 1: vtx->setAlgorithmType( "ZvKin" ); break;
+ case 2: vtx->setAlgorithmType( "42" ); break;
+ case 3: vtx->setAlgorithmType( "SimAnnealing" ); break;
+ case 5: vtx->setAlgorithmType( "_Test" ); break;
+ default: break;
+ }
+
vtx->setChi2(1+i*.01);
vtx->setProbability(0.0032+i*.01);
vtx->setPosition(0.3453+i*.01,.45345354+i*.01,2.345354+i*.01);
lcio/src/cpp/src/IMPL
diff -u -r1.1.2.6 -r1.1.2.7
--- VertexImpl.cc 31 Aug 2006 15:18:56 -0000 1.1.2.6
+++ VertexImpl.cc 11 Sep 2006 13:05:32 -0000 1.1.2.7
@@ -7,12 +7,12 @@
VertexImpl::VertexImpl() :
_primary(0),
- _type(0),
_chi2(0),
_probability(0),
_par(0),
_aParticle(0)
{
+ _type="Unknown";
_cov.resize( VTXCOVMATRIX ) ;
_vpos[0] = 0. ;
_vpos[1] = 0. ;
@@ -22,7 +22,8 @@
VertexImpl::~VertexImpl(){ }
bool VertexImpl::isPrimary() const { return _primary ; }
- int VertexImpl::getAlgorithmType() const { return _type ; }
+ //int VertexImpl::getAlgorithmType() const { return _type ; }
+ const std::string& VertexImpl::getAlgorithmType() const { return _type ; }
float VertexImpl::getChi2() const { return _chi2 ; }
float VertexImpl::getProbability() const { return _probability ; }
const float* VertexImpl::getPosition() const { return _vpos ; }
@@ -36,12 +37,17 @@
checkAccess("VertexImpl::setPrimary" );
_primary = (primary==0?0:1);
}
-
+/*
void VertexImpl::setAlgorithmType( int type ){
checkAccess("VertexImpl::setAlgorithmType");
_type = type;
}
-
+*/
+ void VertexImpl::setAlgorithmType( const std::string type ){
+ checkAccess("VertexImpl::setAlgorithmType");
+ _type = type;
+ }
+
void VertexImpl::setChi2(float chi2){
checkAccess("VertexImpl::setChi2" );
_chi2 = chi2 ;
lcio/src/cpp/src/SIO
diff -u -r1.1.2.3 -r1.1.2.4
--- SIOVertexHandler.cc 31 Aug 2006 15:18:56 -0000 1.1.2.3
+++ SIOVertexHandler.cc 11 Sep 2006 13:05:33 -0000 1.1.2.4
@@ -3,12 +3,16 @@
#include "SIO/LCSIO.h"
#include "EVENT/LCIO.h"
+#include "EVENT/Vertex.h"
#include "IOIMPL/VertexIOImpl.h"
#include "IMPL/LCFlagImpl.h"
#include "SIO_functions.h"
#include "SIO_block.h"
+#include "SIO/SIOLCParameters.h"
+//dbg
+#include <iostream>
using namespace EVENT ;
using namespace IMPL ;
@@ -16,11 +20,95 @@
namespace SIO{
-
- unsigned int SIOVertexHandler::read(SIO_stream* stream,
- LCObject** objP){
+
+ SIOVertexHandler::~SIOVertexHandler(){ }
+
+ unsigned int SIOVertexHandler::init( SIO_stream* stream,
+ SIO_operation op,
+ EVENT::LCCollection* col ,
+ unsigned int vers ) {
+
+ unsigned int status ;
+
+
+ if( op == SIO_OP_READ ) {
+
+
+ SIO_DATA( stream , &_flag , 1 ) ;
+
+ if( vers > SIO_VERSION_ENCODE( 1, 1) )
+ SIOLCParameters::read( stream , col->parameters() , vers ) ;
+
+ col->setFlag( _flag ) ;
+ _vers = vers ;
+
+ //get the parameters from the collection and initialize set/map with values
+ imr.clear();
+ //_set.clear();
+ parameters.clear();
+ col->getParameters().getStringVals("_lcio.VertexAlgorithmTypes",parameters);
+ for(unsigned int i=0; i<parameters.size(); i++){
+ //_set.insert(parameters[i]);
+ imr[i]=parameters[i];
+ }
+ }
+
+ else if( op == SIO_OP_WRITE ) {
+
+
+ _flag = col->getFlag() ;
+
+ LCSIO_WRITE( stream, _flag ) ;
+/*
+ //add parameters for vertex algorithm types using FIFO algorithm
+ parameters.clear();
+ Vertex* v;
+ v = dynamic_cast<Vertex*>( col->getElementAt( 0 ) ) ;
+ parameters.push_back( v->getAlgorithmType() );
+ bool found;
+ for(int i=0; i<col->getNumberOfElements(); i++){
+ found=0;
+ v = dynamic_cast<Vertex*>( col->getElementAt( i ) ) ;
+ for(unsigned int j=0; j<parameters.size(); j++){
+ if( parameters[j] == v->getAlgorithmType() ){
+ found=1;
+ break;
+ }
+ }
+ if(!found){ parameters.push_back( v->getAlgorithmType() ); }
+ }
+ col->parameters().setValues("_lcio.VertexAlgorithmTypes",parameters);
+
+ //initialize map with parameter values
+ imw.clear();
+ for(unsigned int i=0; i<parameters.size(); i++)
+ imw[parameters[i]]=i;
+*/
+ parameters.clear();
+ _set.clear();
+ Vertex* v;
+ for(int i=0; i<col->getNumberOfElements(); i++){
+ v = dynamic_cast<Vertex*>( col->getElementAt( i ) ) ;
+ _set.insert(v->getAlgorithmType());
+ }
+ for(std::set<std::string>::iterator it=_set.begin(); it!=_set.end(); it++){
+ parameters.push_back(*it);
+ }
+ //add parameters to collection
+ col->parameters().setValues("_lcio.VertexAlgorithmTypes",parameters);
+
+ SIOLCParameters::write( stream , col->getParameters() ) ;
+
+ _vers = vers ; // not really needed !?
+
+ }
+ return ( SIO_BLOCK_SUCCESS ) ;
+ }
+
+
+ unsigned int SIOVertexHandler::read(SIO_stream* stream, LCObject** objP){
+
unsigned int status ;
-
// create a new object :
VertexIOImpl* vtx = new VertexIOImpl ;
@@ -28,7 +116,17 @@
//read data
SIO_DATA( stream , &(vtx->_primary) , 1 ) ;
- SIO_DATA( stream , &(vtx->_type) , 1 ) ;
+ int algtype;
+ SIO_DATA( stream , &algtype , 1 ) ;
+ vtx->setAlgorithmType(imr[algtype]);
+ //std::set<std::string>::iterator it;
+ //advance(it=_set.begin(),algtype);
+ //vtx->setAlgorithmType(*it);
+
+ //dbg
+ //std::cout<<"Reading... (int)["<<algtype<<"] (string)["<<(*it)<<"]\n";
+ //std::cout<<"Reading... (int)["<<algtype<<"] (string)["<<imr[algtype]<<"]\n";
+
SIO_DATA( stream , &(vtx->_chi2) , 1 ) ;
SIO_DATA( stream , &(vtx->_probability) , 1 ) ;
SIO_DATA( stream , vtx->_vpos , 3 ) ;
@@ -56,8 +154,7 @@
}
- unsigned int SIOVertexHandler::write(SIO_stream* stream,
- const LCObject* obj){
+ unsigned int SIOVertexHandler::write(SIO_stream* stream, const LCObject* obj){
unsigned int status ;
@@ -68,7 +165,12 @@
//write data
LCSIO_WRITE( stream, vtx->isPrimary() ) ;
- LCSIO_WRITE( stream, vtx->getAlgorithmType() ) ;
+ //LCSIO_WRITE( stream, imw[vtx->getAlgorithmType()] ) ;
+ LCSIO_WRITE( stream, distance( _set.begin(),_set.find( vtx->getAlgorithmType() ))) ;
+
+ //dbg
+ //std::cout<<"Writing... (string)["<<vtx->getAlgorithmType()<<"] (int)["<<distance( _set.begin(),_set.find( vtx->getAlgorithmType() ))<<"]\n";
+
LCSIO_WRITE( stream, vtx->getChi2() ) ;
LCSIO_WRITE( stream, vtx->getProbability() ) ;
@@ -98,7 +200,6 @@
SIO_PTAG( stream , vtx ) ;
return ( SIO_BLOCK_SUCCESS ) ;
-
}
} // namespace
lcio/src/cpp/src/UTIL
diff -u -r1.1.2.5 -r1.1.2.6
--- Operators.cc 4 Sep 2006 10:30:20 -0000 1.1.2.5
+++ Operators.cc 11 Sep 2006 13:05:33 -0000 1.1.2.6
@@ -1,5 +1,4 @@
#include "UTIL/Operators.h"
-//#include "UTIL/IndexMap.h"
////////////////////////////////////////////////////////////////////////////////
// EXP: UNDER DEVELOPMENT!!!
@@ -24,7 +23,7 @@
out << " [" << setw(8) << hex << v->id() << "] | " << v->isPrimary()<< " | ";
out << setfill(' ') << setw(17) << left << im.decode( v->getAlgorithmType() ) << " | ";
- out << setfill('0') << scientific << right << setprecision(3) << v->getChi2() << " | " << v->getProbability() << " | " <<
+ out << setfill('0') << right << scientific << setprecision(3) << v->getChi2() << " | " << v->getProbability() << " | " <<
v->getPosition()[0] << "," <<
v->getPosition()[1] << "," <<
v->getPosition()[2] << " | [" ;
@@ -44,15 +43,13 @@
out << setfill('0');
out << " [" << setw(8) << hex << v->id() << "] | " << v->isPrimary()<< " | ";
- out << setw(7) << right << v->getAlgorithmType() << " | ";
+ out << setfill(' ') << setw(17) << left << v->getAlgorithmType() << " | ";
- out << scientific << setprecision(3) << v->getChi2() << " | " << v->getProbability() << " | " <<
+ out << setfill('0') << right << 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 << setw(3) << v->getParameters().size() << "] | [";
out << setw(8) << hex << (v->getAssociatedParticle()!=NULL?v->getAssociatedParticle()->id():0) << "]\n";
@@ -75,8 +72,8 @@
v->getPosition()[2] << endl;
out << "Covariance Matrix:\t";
- for(int i=0; i<VTXCOVMATRIX; i++)
- out << v->getCovMatrix()[i] << (i<(VTXCOVMATRIX-1)?", ":"\n");
+ for(unsigned int i=0; i<v->getCovMatrix().size(); i++)
+ out << v->getCovMatrix()[i] << (i<(v->getCovMatrix().size()-1)?", ":"\n");
out << "Parameters:";
if(v->getParameters().size()==0){
@@ -98,15 +95,15 @@
const std::string& header(const EVENT::Vertex* v){
static std::string _vtxh(
- "\n [id] |pri| al.type | chi2 | prob. | position ( x, y, z) | [par] | [idRecP] \n");
- _vtxh+=tail(new IMPL::VertexImpl());
+ "\n [id] |pri| alg. type | chi2 | prob. | position ( x, y, z) | [par] | [idRecP] \n");
+ _vtxh+=tail(v);
return _vtxh;
}
const std::string& tail(const EVENT::Vertex* v){
static std::string _vtxt(
- "------------|---|---------|-----------|-----------|-------------------------------|-------|------------\n");
+ "------------|---|-------------------|-----------|-----------|-------------------------------|-------|------------\n");
return _vtxt;
}
@@ -136,23 +133,5 @@
}
*/
-/*
- // EXP: INDEX MAP - UNDER DEVELOPMENT
-
- const std::string& header(const EVENT::Vertex* v){
-
- static std::string _vtxh(
- "\n [id] |pri| alg. type | chi2 | prob. | position ( x, y, z) | [par] | [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/f77
diff -u -r1.37.4.1 -r1.37.4.2
--- lciof77api.inc 29 Aug 2006 15:00:22 -0000 1.37.4.1
+++ lciof77api.inc 11 Sep 2006 13:05:34 -0000 1.37.4.2
@@ -12,7 +12,7 @@
* H. Vogt
* 05/06/2004 (reconstruction part added)
*
-* $Id: lciof77api.inc,v 1.37.4.1 2006/08/29 15:00:22 engels Exp $
+* $Id: lciof77api.inc,v 1.37.4.2 2006/09/11 13:05:34 engels Exp $
***************************************************
#include "lciof77pointer.inc"
@@ -219,13 +219,14 @@
integer lcvtxdelete, lcvtxid
logical lcvtxisprimary
+ character*80 lcvtxgetalgorithmtype
integer lcvtxgetposition, lcvtxgetcovmatrix, lcvtxgetparameters
real lcvtxgetchi2, lcvtxgetprobability
PTRTYPE lcvtxgetassociatedparticle
integer lcvtxsetprimary, lcvtxsetchi2, lcvtxsetprobability
integer lcvtxsetposition, lcvtxsetcovmatrix, lcvtxaddparameter
- integer lcvtxsetassociatedparticle
+ integer lcvtxsetalgorithmtype, lcvtxsetassociatedparticle
c-----the TrackerHit interface
PTRTYPE lctrhcreate, lctrhgetrawhits
lcio/src/f77
diff -u -r1.22.6.2 -r1.22.6.3
--- recjob.F 29 Aug 2006 15:22:18 -0000 1.22.6.2
+++ recjob.F 11 Sep 2006 13:05:34 -0000 1.22.6.3
@@ -591,6 +591,20 @@
if ( i .eq. 1 ) then
status = lcvtxsetprimary ( vtx, .true. )
end if
+
+ k=MOD(irand( 0 ), 7)
+ if ( k .eq. 0 ) then
+ status = lcvtxsetalgorithmtype(vtx, "ZvTop")
+ else if ( k .eq. 1 ) then
+ status = lcvtxsetalgorithmtype(vtx, "ZvKin")
+ else if ( k .eq. 2 ) then
+ status = lcvtxsetalgorithmtype(vtx, "42")
+ else if ( k .eq. 3 ) then
+ status = lcvtxsetalgorithmtype(vtx, "SimAnnealing")
+ else if ( k .eq. 5 ) then
+ status = lcvtxsetalgorithmtype(vtx, "_Test")
+ end if
+
status = lcvtxsetchi2 ( vtx, (i-1)*101.101 )
status = lcvtxsetprobability ( vtx, 0.511*(i-1) )
do j = 1, 6
lcio/src/java/hep/lcio/example
diff -u -r1.14.6.1 -r1.14.6.2
--- RecJob.java 28 Aug 2006 13:30:58 -0000 1.14.6.1
+++ RecJob.java 11 Sep 2006 13:05:36 -0000 1.14.6.2
@@ -14,7 +14,7 @@
/**
*
* @author Tony Johnson
- * @version $Id: RecJob.java,v 1.14.6.1 2006/08/28 13:30:58 engels Exp $
+ * @version $Id: RecJob.java,v 1.14.6.2 2006/09/11 13:05:36 engels Exp $
*/
public class RecJob implements LCRunListener, LCEventListener
{
@@ -132,6 +132,7 @@
evt.addCollection(calVec, "HCALReco");
LCTools.dumpEvent(evt);
+ System.out.println("------------------------------------");
// ****NEW*** Add some clusters
@@ -164,6 +165,16 @@
{
IVertex v = new IVertex();
v.setPrimary((j == 0 ? true : false));
+
+ switch((random.nextInt()%7)){
+ case 0: v.setAlgorithmType( "ZvTop" ); break;
+ case 1: v.setAlgorithmType( "ZvKin" ); break;
+ case 2: v.setAlgorithmType( "42" ); break;
+ case 3: v.setAlgorithmType( "SimAnnealing" ); break;
+ case 5: v.setAlgorithmType( "_Test" ); break;
+ default: break;
+ }
+
v.setChi2(j+1.0f);
v.setProbability(j+2.0f);
float f[] = {j+j*1.0f,j+j*2.0f,j+j*3.0f};
lcio/src/java/hep/lcio/implementation/event
diff -u -r1.1.2.2 -r1.1.2.3
--- IVertex.java 31 Aug 2006 15:18:57 -0000 1.1.2.2
+++ IVertex.java 11 Sep 2006 13:05:37 -0000 1.1.2.3
@@ -11,7 +11,7 @@
private static float[] null0 = new float[0];
protected int primary;
- protected int type;
+ protected String type = "Unknown";
protected float chi2;
protected float probability;
protected float[] position = new float[3];
@@ -84,11 +84,11 @@
this.primary = (primary == true ? 1 : 0 );
}
- public int getAlgorithmType() {
+ public String getAlgorithmType() {
return type;
}
- public void setAlgorithmType(int type) {
+ public void setAlgorithmType(String type) {
checkAccess();
this.type=type;
}
lcio/src/java/hep/lcio/implementation/sio
diff -u -r1.41.2.1 -r1.41.2.2
--- SIOEvent.java 28 Aug 2006 13:31:07 -0000 1.41.2.1
+++ SIOEvent.java 11 Sep 2006 13:05:37 -0000 1.41.2.2
@@ -11,11 +11,13 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.TreeMap;
+import java.util.TreeSet;
/**
*
* @author Tony Johnson
- * @version $Id: SIOEvent.java,v 1.41.2.1 2006/08/28 13:31:07 engels Exp $
+ * @version $Id: SIOEvent.java,v 1.41.2.2 2006/09/11 13:05:37 engels Exp $
*/
class SIOEvent extends ILCEvent
{
@@ -303,8 +305,12 @@
int n = in.readInt();
SIOLCCollection ilc = new SIOLCCollection(type, flags, n);
ilc.setParameters( colParameters ) ;
+
+ //index integers to strings (reading)
+ String[] keys=colParameters.getStringVals("_lcio.VertexAlgorithmTypes");
+
for (int i = 0; i < n; i++)
- ilc.add(new SIOVertex(in, this, major, minor));
+ ilc.add(new SIOVertex(in, this, keys, major, minor));
ilc.setOwner(this);
addCollection(ilc,name);
}
@@ -427,6 +433,23 @@
}
out.writeInt(flags);
+ //vertices need to add indexing parameters to collection
+ if ( type.equals(LCIO.VERTEX )){
+ TreeSet _set = new TreeSet();
+
+ for (int i=0; i < col.getNumberOfElements(); i++){
+ Vertex v = (Vertex) col.getElementAt(i);
+ _set.add(v.getAlgorithmType());
+ }
+ Object[] ob = _set.toArray() ;
+ String[] keys = new String[ ob.length ] ;
+ for (int i = 0; i < keys.length; i++){
+ keys[i] = (String) ob[i] ;
+ }
+ //add parameters to collection
+ col.getParameters().setValues( "_lcio.VertexAlgorithmTypes", keys );
+ }
+
SIOLCParameters.write( col.getParameters() , out ) ;
// fg20050302 add suport for subset collections
@@ -551,8 +574,23 @@
}
else if (type.equals(LCIO.VERTEX))
{
+ //index strings to integers (writing)
+
+ /* THIS DOES NOT WORK!!!
+ //add parameters to collection
+ col.getParameters().setValues( "_lcio.VertexAlgorithmTypes", keys );
+ SIOLCParameters.write( col.getParameters() , out ) ;
+ */
+
+ TreeMap _map = new TreeMap();
+ String[] keys = new String[ col.getParameters().getStringVals("_lcio.VertexAlgorithmTypes").length ] ;
+ keys=col.getParameters().getStringVals("_lcio.VertexAlgorithmTypes");
+ for (int i=0; i < keys.length; i++){
+ _map.put(keys[i],i);
+ }
+
for (int i=0; i < n; i++)
- SIOVertex.write((Vertex) col.getElementAt(i), out);
+ SIOVertex.write((Vertex) col.getElementAt(i), out, _map);
}
else if (type.equals(LCIO.LCRELATION))
{
lcio/src/java/hep/lcio/implementation/sio
diff -u -r1.1.2.2 -r1.1.2.3
--- SIOVertex.java 31 Aug 2006 15:18:57 -0000 1.1.2.2
+++ SIOVertex.java 11 Sep 2006 13:05:39 -0000 1.1.2.3
@@ -6,16 +6,24 @@
import hep.lcio.event.ReconstructedParticle;
import hep.lcio.implementation.event.IVertex;
+import java.util.TreeMap;
+
import java.io.IOException;
/**
* @author engels
*/
-public class SIOVertex extends IVertex{
- public SIOVertex(SIOInputStream in, SIOEvent owner, int major, int minor) throws IOException{
+class SIOVertex extends IVertex{
+ public SIOVertex(SIOInputStream in, SIOEvent owner, String[] keys, int major, int minor) throws IOException{
this.primary = in.readInt();
- this.type = in.readInt();
+
+ //dbg
+ //int t=in.readInt();
+ //this.type = keys[t];
+ //System.out.println("Reading... (int)["+t+"] (string)["+type+"]");
+
+ this.type = keys[in.readInt()];
this.chi2 = in.readFloat();
this.probability = in.readFloat();
for (int i=0; i<3; i++) this.position[i] = in.readFloat();
@@ -26,13 +34,20 @@
this.aRecP = (ReconstructedParticle) in.readPntr().getObject();
in.readPTag(this);
}
- static void write(Vertex v, SIOOutputStream out) throws IOException{
+ static void write(Vertex v, SIOOutputStream out, TreeMap keys) throws IOException{
if (v instanceof SIOVertex){
- ((SIOVertex) v).write(out);
+ ((SIOVertex) v).write(out, keys);
}
else{
out.writeInt(v.isPrimary()?1:0);
- out.writeInt(v.getAlgorithmType());
+ int at=(Integer)keys.get(v.getAlgorithmType());
+ out.writeInt(at);
+ //int[] at=(int[])keys.get(v.getAlgorithmType());
+ //out.writeInt(at[0]);
+
+ //dbg
+ //System.out.println("Writing... (string)["+v.getAlgorithmType()+"] (int)["+at+"]");
+
out.writeFloat(v.getChi2());
out.writeFloat(v.getProbability());
float[] pos = v.getPosition();
@@ -47,9 +62,10 @@
out.writePTag(v);
}
}
- private void write(SIOOutputStream out) throws IOException{
+ private void write(SIOOutputStream out, TreeMap keys) throws IOException{
out.writeInt(primary);
- out.writeInt(type);
+ int at=(Integer)keys.get(type);
+ out.writeInt(at);
out.writeFloat(chi2);
out.writeFloat(probability);
for (int i=0; i<3; i++) out.writeFloat(position[i]);
lcio/src/java/hep/lcio/util
diff -u -r1.1.2.2 -r1.1.2.3
--- Printer.java 31 Aug 2006 15:18:57 -0000 1.1.2.2
+++ Printer.java 11 Sep 2006 13:05:40 -0000 1.1.2.3
@@ -773,11 +773,11 @@
}
class VertexPrinter extends LCTypePrinter{
void print(LCCollection coll, int nprint){
- ps.println(" [ id ] | pri | alg. type | chi2 | prob. | position ( x,y,z) | [assRecP]");
+ ps.println(" [ id ] | pri | alg. type | chi2 | prob. | position ( x,y,z) | [assRecP]");
for (int i=0; i<nprint; i++){
Vertex v = (Vertex)coll.getElementAt(i);
- ps.format(" [%08x] | %3s | %d | %4.2e | %4.2e | (%5.3e,%5.3e,%5.3e) | %4.2e | %4.2e | %4.2e | (%5.3e,%5.3e,%5.3e) | [%08x] \n",
+ ps.format(" [%08x] | %3s | %15s | %4.2e | %4.2e | (%5.3e,%5.3e,%5.3e) | %4.2e | %4.2e | %4.2e | (%5.3e,%5.3e,%5.3e) | [%08x] \n",
new Object[] {
Integer.valueOf(v.hashCode()),
v.isPrimary() ? "yes" : "no",
CVSspam 0.2.8