12 modified files
lcio/doc
diff -u -r1.59.4.1 -r1.59.4.2
--- lcio.xml 15 Aug 2006 15:56:46 -0000 1.59.4.1
+++ lcio.xml 18 Aug 2006 13:39:13 -0000 1.59.4.2
@@ -432,6 +432,22 @@
<data type="ptag" name="this"></data>
</repeat>
</block>
+ <block name="Vertex" major="1" minor="8">
+ <include subroutine="namedParameters"/>
+ <data type="int" name="nVertex"></data>
+ <repeat count="nVertex">
+ <data type="bool" name="primary">primary vertex of the event</data>
+ <data type="float" name="chi2">chi**2 of vertex</data>
+ <data type="float" name="probability">?probability of the fit?</data>
+ <data type="float[3]" name="position">position of the vertex (px,py,pz)</data>
+ <data type="float[6]" name="covariance">covariance matrix</data>
+ <data type="int" name="npar"/>
+ <repeat count="npar">
+ <data type="float" name="parameter"/>
+ </repeat>
+ <data type="pntr" name="associatedParticle">reconstructed particle associated to the vertex</data>
+ </repeat>
+ </block>
<block name="ReconstructedParticle" major="1" minor="8">
<data type="int" name="flag"></data>
<include subroutine="namedParameters"/>
@@ -468,6 +484,10 @@
</repeat>
</if>
</repeat>
+ <if condition="1000*major+minor>1007">
+ <data type="pntr" name="startVertex">start vertex associated to the particle</data>
+ <data type="pntr" name="endVertex">end vertex associated to the particle</data>
+ </if>
<if condition="1000*major+minor>1002">
<data type="pntr" name="ParticleIDUsed"></data>
<data type="float" name="goodnessOfPID">overall quality of the particle
@@ -543,7 +563,7 @@
</if>
</repeat>
</block>
- <!-- generic block description for subset collections that hold references to exisitng objects -->
+ <!-- generic block description for subset collections that hold references to existing objects -->
<block name="References" major="1" minor="8">
<data type="int" name="flags"></data>
<include subroutine="namedParameters"/>
lcio/src/aid/EVENT
diff -u -r1.2.2.3 -r1.2.2.4
--- Vertex.aid 15 Aug 2006 13:01:09 -0000 1.2.2.3
+++ Vertex.aid 18 Aug 2006 13:39:14 -0000 1.2.2.4
@@ -14,7 +14,7 @@
* <p>UNDER DEVELOPMENT!</p>
*
* @author gaede, engels
- * @version $Id: Vertex.aid,v 1.2.2.3 2006/08/15 13:01:09 engels Exp $
+ * @version $Id: Vertex.aid,v 1.2.2.4 2006/08/18 13:39:14 engels Exp $
*/
public interface Vertex extends LCObject {
@@ -40,7 +40,7 @@
*/
public float getProbability() const ;
- /** Position of the cluster.//TODO:cluster?
+ /** Position of the vertex
*/
public const float3V getPosition() const;
lcio/src/cpp/include/IMPL
diff -u -r1.1.2.3 -r1.1.2.4
--- VertexImpl.h 15 Aug 2006 13:01:11 -0000 1.1.2.3
+++ VertexImpl.h 18 Aug 2006 13:39:14 -0000 1.1.2.4
@@ -7,7 +7,7 @@
#include "AccessChecked.h"
-#define NCOVARIANCE 10
+#define VTXCOVMATRIX 6
namespace IMPL {
lcio/src/cpp/include/UTIL
diff -u -r1.19 -r1.19.6.1
--- LCTOOLS.h 31 May 2005 07:43:26 -0000 1.19
+++ LCTOOLS.h 18 Aug 2006 13:39:15 -0000 1.19.6.1
@@ -96,6 +96,10 @@
*/
static void printClusters( const EVENT::LCCollection* col ) ;
+ /** Complete printout of all Vertices in the collection
+ */
+ static void printVertices( const EVENT::LCCollection* col ) ;
+
/** Complete printout of all ReconstructedParticles in the collection
*/
static void printReconstructedParticles( const EVENT::LCCollection* col ) ;
lcio/src/cpp/src/EXAMPLE
diff -u -r1.49 -r1.49.2.1
--- recjob.cc 4 Aug 2006 16:49:46 -0000 1.49
+++ recjob.cc 18 Aug 2006 13:39:15 -0000 1.49.2.1
@@ -17,6 +17,7 @@
#include "IMPL/TrackImpl.h"
#include "IMPL/ClusterImpl.h"
#include "IMPL/ReconstructedParticleImpl.h"
+#include "IMPL/VertexImpl.h"
#include "IMPL/ParticleIDImpl.h"
#include "IMPL/LCFlagImpl.h"
#include "UTIL/LCTOOLS.h"
@@ -471,8 +472,33 @@
evt->addCollection( clusterVec , "SomeClusters" ) ;
-
+ // add some vertices
+ LCCollectionVec* vertexVec = new LCCollectionVec( LCIO::VERTEX ) ;
+ for(int i=0; i < (nRecP+1); i++){
+ VertexImpl* vtx = new VertexImpl ;
+ 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. ;
+ cov[2] = 3. ;
+ cov[3] = 4. ;
+ cov[4] = 5. ;
+ cov[5] = 6. ;
+ vtx->setCovMatrix( cov ) ;
+ vertexVec->addElement ( vtx ) ;
+ }
+
+ evt->addCollection( vertexVec, "SomeVertices" ) ;
+
// add some reconstructed particles
LCCollectionVec* particleVec = new LCCollectionVec( LCIO::RECONSTRUCTEDPARTICLE ) ;
particleVec->parameters().setValues( "PIDAlgorithmTypeName" , algoNames ) ;
@@ -497,6 +523,13 @@
float x[3] = { 10.,20.,30. } ;
part->setReferencePoint( x ) ;
+ //associate vertices
+ part->setStartVertex( dynamic_cast<Vertex*>( vertexVec->getElementAt(i) ) ) ;
+ VertexImpl* v = dynamic_cast<VertexImpl*>( vertexVec->getElementAt(i+1) ) ;
+ part->setEndVertex( v ) ;
+ //associate particles to vertices
+ v->setAssociatedParticle( dynamic_cast<ReconstructedParticle*>( part ) ) ;
+
// add some particle ids
int nPID = 5 ;
for(int j=0;j<nPID;j++){
lcio/src/cpp/src/EXAMPLE
diff -u -r1.1.2.4 -r1.1.2.5
--- testvtx.cc 14 Aug 2006 16:13:16 -0000 1.1.2.4
+++ testvtx.cc 18 Aug 2006 13:39:15 -0000 1.1.2.5
@@ -1,129 +1,56 @@
#include "lcio.h"
-#include "IO/LCReader.h"
-#include "IMPL/LCTOOLS.h"
-#include "EVENT/LCRunHeader.h"
#include "EVENT/LCCollection.h"
#include "EVENT/ReconstructedParticle.h"
-
+#include "EVENT/Vertex.h"
+#include "IMPL/LCCollectionVec.h"
#include "IMPL/ReconstructedParticleImpl.h"
#include "IMPL/VertexImpl.h"
-static const char* FILEN = "recjob.slcio" ; // default file name
+#include "LCIOSTLTypes.h"
+#include "UTIL/LCTOOLS.h"
using namespace std ;
using namespace lcio ;
+
////////////////////////////////////////////////////////////////////////////////
// This file is temporary and ONLY for the purpose of testing the Vertex Class!!
////////////////////////////////////////////////////////////////////////////////
int main(int argc, char** argv ){
-
- LCReader* lcReader = LCFactory::getInstance()->createLCReader() ;
- lcReader->open( FILEN ) ;
-
- cout << " will open and read from file: " << FILEN << endl ;
-
- LCRunHeader *runHdr ;
-
- // use a try catch block here: if sth. went wrong with reading the run data we
- // still can try and read the event data - see below
- try{
- //read the first header
- runHdr = lcReader->readNextRunHeader();
- LCTOOLS::dumpRunHeader( runHdr ) ;
- /*
- // loop over all run headers
- while( ( runHdr = lcReader->readNextRunHeader() ) != 0 ){
-
- LCTOOLS::dumpRunHeader( runHdr ) ;
- // cout << " Run : " << runHdr->getRunNumber()
- // << " - " << runHdr->getDetectorName()
- // << ": " << runHdr->getDescription() << endl ;
+ 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);
+ }
+ 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. ;
+ cov[2] = 3. ;
+ cov[3] = 4. ;
+ cov[4] = 5. ;
+ cov[5] = 6. ;
+
+
+ vtx->setCovMatrix( cov ) ;
+
+ vertexVec->addElement ( vtx ) ;
+
}
- */
- }catch(IOException& e){
- cout << " io error when reading run data : " << e.what() << endl ;
- }
- cout << endl ;
-
- lcReader->close() ;
-
-
- // now loop over the file again and dump event data
-
- lcReader->open( FILEN ) ;
-
- cout << " reopened " << FILEN << " for reading " << endl ;
-
- LCEvent* evt ;
- //int nEvents = 0 ;
-
- //read an event
- evt = lcReader->readNextEvent(LCIO::UPDATE);
- LCTOOLS::dumpEvent( evt ) ;
- /*
- //----------- the event loop -----------
- while( (evt = lcReader->readNextEvent()) != 0 ) {
-
- //LCTOOLS::dumpEvent( evt ) ;
-
- nEvents ++ ;
- }
- // -------- end of event loop -----------
-
- cout << endl << " " << nEvents << " events read from file: " << FILEN << endl ;
- */
-
-
- LCCollection* col = evt->getCollection("ReconstructedParticle") ;
-
-
- if( col !=0 &&( col->getTypeName() == LCIO::RECONSTRUCTEDPARTICLE )
- && col->getNumberOfElements() > 0 ){
- cout << col->getTypeName();
+ LCTOOLS::printVertices( vertexVec ) ;
- ReconstructedParticleImpl* recP = dynamic_cast<ReconstructedParticleImpl*>( col->getElementAt( 0 ) ) ;
+ delete vertexVec ;
- VertexImpl* vtx = new VertexImpl ;
-
- vtx->setPrimary(true);
- vtx->setChi2(1.01);
- vtx->setProbability(0.0032);
- vtx->setPosition(0.3453,.45345354,2.345354);
- vtx->setAssociatedParticle(recP);
-
- Vertex* v;
- v=dynamic_cast<Vertex*>(vtx);
-
- cout << endl<<endl;
- cout << "Vertex Details:" << endl<<endl;
- cout << "Primary:\t" << v->isPrimary() << endl;
- cout << "Position:\tx:" << v->getPosition()[0] << "\ty: " << v->getPosition()[1] << "\tz: " << v->getPosition()[2] << endl;
- cout << "Chi2:\t\t" << v->getChi2() << endl;
- cout << "Probability:\t" << v->getProbability() << endl;
- cout << "AParticle:\t" << v->getAssociatedParticle()->getType() << endl;
-
- recP->setStartVertex( v );
-
- cout << "recP->getStartVertex()->getChi2() : " << recP->getStartVertex()->getChi2()<<endl;
- //cout << "recP->getEndVertex()->getChi2() : " << recP->getEndVertex()->getChi2()<<endl;
-
- // do not delete if vertex attached to collection and event !!!!
- delete vtx;
-
- }else{
-
- cout << " collection not of type " << LCIO::RECONSTRUCTEDPARTICLE << " or empty ! " << endl ;
- }
-
-
- lcReader->close() ;
- delete lcReader ;
-
return 0 ;
}
lcio/src/cpp/src/IMPL
diff -u -r1.1.2.3 -r1.1.2.4
--- VertexImpl.cc 15 Aug 2006 13:01:15 -0000 1.1.2.3
+++ VertexImpl.cc 18 Aug 2006 13:39:16 -0000 1.1.2.4
@@ -12,7 +12,7 @@
_par(0),
_aParticle(0)
{
- _cov.resize( NCOVARIANCE ) ;
+ _cov.resize( VTXCOVMATRIX ) ;
_vpos[0] = 0. ;
_vpos[1] = 0. ;
_vpos[2] = 0. ;
@@ -58,12 +58,12 @@
void VertexImpl::setCovMatrix( const float* cov ){
checkAccess("VertexImpl::setCovMatrix" );
- for(int i=0;i<NCOVARIANCE;i++) _cov[i] = cov[i] ;
+ for(int i=0;i<VTXCOVMATRIX;i++) _cov[i] = cov[i] ;
}
void VertexImpl::setCovMatrix( const EVENT::FloatVec& cov ){
checkAccess("VertexImpl::" );
- for(int i=0;i<NCOVARIANCE;i++) _cov[i] = cov[i] ;
+ for(int i=0;i<VTXCOVMATRIX;i++) _cov[i] = cov[i] ;
}
void VertexImpl::setAssociatedParticle( EVENT::ReconstructedParticle *aP ){
lcio/src/cpp/src/SIO
diff -u -r1.11.6.1 -r1.11.6.2
--- SIOReconstructedParticleHandler.cc 15 Aug 2006 15:56:47 -0000 1.11.6.1
+++ SIOReconstructedParticleHandler.cc 18 Aug 2006 13:39:16 -0000 1.11.6.2
@@ -111,7 +111,7 @@
SIO_PNTR( stream , &(recP->_clusters[i] ) ) ;
}
- if( _vers > SIO_VERSION_ENCODE( 1,8 ) ) {
+ if( _vers > SIO_VERSION_ENCODE( 1,7 ) ) {
//read pointers to start/end vertices
SIO_PNTR( stream , &(recP->_sv) ) ;
@@ -324,8 +324,8 @@
// write pointers to start/end vertices
EVENT::Vertex* sv = recP->getStartVertex() ;
- EVENT::Vertex* ev = recP->getEndVertex() ;
SIO_PNTR( stream , &sv ) ;
+ EVENT::Vertex* ev = recP->getEndVertex() ;
SIO_PNTR( stream , &ev ) ;
lcio/src/cpp/src/SIO
diff -u -r1.1.2.1 -r1.1.2.2
--- SIOVertexHandler.cc 15 Aug 2006 13:01:18 -0000 1.1.2.1
+++ SIOVertexHandler.cc 18 Aug 2006 13:39:16 -0000 1.1.2.2
@@ -33,8 +33,8 @@
SIO_DATA( stream , vtx->_vpos , 3 ) ;
//read covMatrix
- float cov[NCOVARIANCE] ;
- SIO_DATA( stream , cov , NCOVARIANCE ) ;
+ float cov[VTXCOVMATRIX] ;
+ SIO_DATA( stream , cov , VTXCOVMATRIX ) ;
vtx->setCovMatrix( cov ) ;
//read parameters
@@ -92,7 +92,7 @@
SIO_PNTR( stream , &recP ) ;
- // write a ptag in order to be able to point to vertexes
+ // write a ptag in order to be able to point to vertices
SIO_PTAG( stream , vtx ) ;
return ( SIO_BLOCK_SUCCESS ) ;
lcio/src/cpp/src/UTIL
diff -u -r1.49 -r1.49.4.1
--- LCTOOLS.cc 25 Apr 2006 08:47:20 -0000 1.49
+++ LCTOOLS.cc 18 Aug 2006 13:39:16 -0000 1.49.4.1
@@ -17,6 +17,7 @@
#include "EVENT/Track.h"
#include "EVENT/Cluster.h"
#include "EVENT/ReconstructedParticle.h"
+#include "EVENT/Vertex.h"
#include "EVENT/LCGenericObject.h"
#include "EVENT/LCRelation.h"
@@ -150,6 +151,11 @@
printReconstructedParticles( col ) ;
}
+ else if( evt->getCollection( *name )->getTypeName() == LCIO::VERTEX ){
+
+ printVertices( col ) ;
+
+ }
else if( evt->getCollection( *name )->getTypeName() == LCIO::LCGENERICOBJECT ){
printLCGenericObjects( col ) ;
@@ -1295,6 +1301,53 @@
<< endl ;
}
+ void LCTOOLS::printVertices( const EVENT::LCCollection* col ){
+ if( col->getTypeName() != LCIO::VERTEX ){
+
+ cout << " collection not of type " << LCIO::VERTEX << endl ;
+ return ;
+ }
+ cout << endl
+ << "--------------- " << "print out of " << LCIO::VERTEX << " collection "
+ << "--------------- " << endl << endl;
+
+ printParameters( col->getParameters() ) ;
+
+ 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 ;
+
+ 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 ;
+ }
+ cout << endl << "--------------------------------------------------------------------------------------- "
+ << endl ;
+ }
void LCTOOLS::printReconstructedParticles( const EVENT::LCCollection* col ){
@@ -1319,9 +1372,9 @@
int nPrint = nReconstructedParticles > MAX_HITS ? MAX_HITS : nReconstructedParticles ;
std::cout << endl
- << " [ id ] |com|type| momentum( px,py,pz) | energy | mass | charge | position ( x,y,z) | [pidUsed]"
+ << " [ id ] |com|type| momentum( px,py,pz) | energy | mass | charge | position ( x,y,z) | [pidUsed] | [startVtx] | [endVtx] "
<< endl
- << " ----------|---|----|---------------------------------|----------|----------|-----------|----------------------------------|----------"
+ << " ----------|---|----|---------------------------------|----------|----------|-----------|----------------------------------|-----------|------------|----------"
<< endl ;
for( int i=0 ; i< nPrint ; i++ ){
@@ -1343,7 +1396,7 @@
if( recP->getParticleIDUsed() != 0 )
pidUsed = recP->getParticleIDUsed()->id() ;
- printf(" [%8.8x] | %1d | %2d | (%5.3e,%5.3e,%5.3e) | %4.2e | %4.2e | %4.2e | (%5.3e,%5.3e,%5.3e) | [%8.8x] \n"
+ printf(" [%8.8x] | %1d | %2d | (%5.3e,%5.3e,%5.3e) | %4.2e | %4.2e | %4.2e | (%5.3e,%5.3e,%5.3e) | [%8.8x] | [%8.8x] | [%8.8x]\n"
// , reinterpret_cast<int> ( recP )
, recP->id()
, compound
@@ -1357,7 +1410,9 @@
, recP->getReferencePoint()[0]
, recP->getReferencePoint()[1]
, recP->getReferencePoint()[2]
- , pidUsed
+ , pidUsed
+ , recP->getStartVertex()->id()
+ , recP->getEndVertex()->id()
) ;
cout << " covariance( px,py,pz,E) : (" ;
for(int l=0;l<10;l++){
lcio/src/java/hep/lcio/example
diff -u -r1.19 -r1.19.2.1
--- SimJob.java 4 Aug 2006 17:24:40 -0000 1.19
+++ SimJob.java 18 Aug 2006 13:39:17 -0000 1.19.2.1
@@ -15,7 +15,7 @@
/**
*
* @author Tony Johnson
- * @version $Id: SimJob.java,v 1.19 2006/08/04 17:24:40 gaede Exp $
+ * @version $Id: SimJob.java,v 1.19.2.1 2006/08/18 13:39:17 engels Exp $
*/
public class SimJob
{
@@ -201,7 +201,7 @@
int tpcFlag = 0 ;
// store the cellId1
- tpcFlag = 1 << LCIO.TRAWBIT_ID1
+ tpcFlag = 1 << LCIO.TRAWBIT_ID1 ;
TPCVec.setFlag( tpcFlag ) ;
for(int j=0;j<NHITS;j++){
lcio/src/java/hep/lcio/implementation/event
diff -u -r1.12 -r1.12.6.1
--- IReconstructedParticle.java 3 Jun 2005 23:56:17 -0000 1.12
+++ IReconstructedParticle.java 18 Aug 2006 13:39:17 -0000 1.12.6.1
@@ -4,6 +4,8 @@
import hep.lcio.event.ParticleID;
import hep.lcio.event.ReconstructedParticle;
import hep.lcio.event.Track;
+import hep.lcio.event.Vertex ;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
@@ -169,6 +171,16 @@
return referencePoint;
}
+
+
+ /** FIXME: empty implemetation */
+ public Vertex getStartVertex() { return null ;}
+
+ /** FIXME: empty implemetation */
+ public Vertex getEndVertex() { return null ;}
+
+
+
public void setTracks(List tracks)
{
checkAccess();
CVSspam 0.2.8