Print

Print


Commit in lcio/src on v01-07-vtx
aid/EVENT/Vertex.aid+11-341.2 -> 1.2.2.1
cpp/include/IMPL/VertexImpl.h+90added 1.1.2.1
cpp/src/EXAMPLE/testvtx.cc+122added 1.1.2.1
               /GNUmakefile+21.10 -> 1.10.4.1
cpp/src/IMPL/VertexImpl.cc+93added 1.1.2.1
+318-34
3 added + 2 modified, total 5 files
initial version of vertex

lcio/src/aid/EVENT
Vertex.aid 1.2 -> 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- Vertex.aid	3 Aug 2006 16:53:35 -0000	1.2
+++ Vertex.aid	11 Aug 2006 10:54:03 -0000	1.2.2.1
@@ -13,8 +13,8 @@
  *
  *  <p>UNDER DEVELOPMENT!</p>
  *  
- * @author gaede
- * @version $Id: Vertex.aid,v 1.2 2006/08/03 16:53:35 gaede Exp $
+ * @author gaede, engels
+ * @version $Id: Vertex.aid,v 1.2.2.1 2006/08/11 10:54:03 engels Exp $
  */
 
 public interface Vertex extends LCObject {
@@ -26,19 +26,12 @@
     typedef Vertex lcobject_type ;
 }
 @endif
-    
-    /** The vertex' 3-momentum, i.e. the sum of all track momenta.
-     */
-    public const float3V getMomentum() const ;	
-    
-    /** Mass of the  vertex
-     */
-    public float getMass() const ;	
-    
-    /** Charge of the vertex.
+
+    /** Checks if the Vertex is the primary vertex of the event.
+     *  Only one primary vertex per event is allowed
      */
-    public float getCharge() const ;	
-    
+    public boolean isPrimary() const ;
+
     /** Position of the cluster.
      */
     public const float3V getPosition() const;
@@ -46,7 +39,7 @@
     /** Covariance matrix of the position (stored as lower triangle matrix, i.e. 
      *  cov(xx),cov(y,x),cov(y,y) ).
      */
-    public const FloatVec& getCovMatrix() const ;
+    public const FloatVec & getCovMatrix() const ;
 
     /** Chi squared of the vertex fit.
      */
@@ -56,29 +49,13 @@
      */
     public float getProbability() const ;	
 
-    /** Link to previous vertex in chain of vertices.
-     */
-    public Vertex* getPreviousVertex() const; 
-
     /** Additional parameters related to this vertex - check/set the collection
      *  parameter "VertexParameterNames" for the parameters' meaning.
      */
-    public const FloatVec& getParameters() const ;
+    public const FloatVec & getParameters() const ;
 
-    /** The tracks that have been used for this vertex.
+    /** Returns Reconstructed Particle associated to the Vertex
      */
-    public const TrackVec& getTracks() const ; 
-    
-    /** Add a track to this vertex.
-     */
-    public void addTrack( Track* track ) ;
-
-//     /** Distance to previous vertex - computed from  getPreviousVertex().getPosition() ???
-//      */
-//     public float getDistanceToPreviousVertex() const ;
-//     /** Error of distance to previous vertex - computed from  getPreviousVertex().getPosition() ??
-//      */
-//     public float getErrorOfDistance() const ;
-
+    public const ReconstructedParticle * getAssociatedParticle() const;
 }
 

lcio/src/cpp/include/IMPL
VertexImpl.h added at 1.1.2.1
diff -N VertexImpl.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ VertexImpl.h	11 Aug 2006 10:54:06 -0000	1.1.2.1
@@ -0,0 +1,90 @@
+// -*- C++ -*-
+#ifndef IMPL_VERTEXIMPL_H
+#define IMPL_VERTEXIMPL_H 1
+
+
+#include "EVENT/Vertex.h"
+#include "AccessChecked.h"
+
+
+#define NCOVARIANCE 10
+
+
+namespace IMPL {
+
+
+/** Implementation of Vertex Class.
+ *
+ * @see Vertex
+ * @author gaede, engels
+ * @version Aug 09, 2006
+ */
+  class VertexImpl : public EVENT::Vertex, public AccessChecked {
+    
+  public: 
+    
+    /** Default constructor, initializes values to 0.
+     */
+    VertexImpl() ;
+    
+    /// Destructor.
+    virtual ~VertexImpl() ; 
+
+    virtual int id() const { return simpleUID() ; }
+    
+    /** Checks if the Vertex is the primary vertex of the event.
+     *  Only one primary vertex per event is allowed
+     */
+    virtual bool isPrimary() const ;
+    
+    /** Position of the vertex 
+     */
+    virtual const float* getPosition() const;
+                                                                                                         
+    /** Covariance matrix of the position (stored as lower triangle matrix, i.e.
+     *  cov(xx),cov(y,x),cov(y,y) ).
+     */
+    virtual const EVENT::FloatVec & getCovMatrix() const;
+                                                                                                         
+    /** Chi squared of the vertex fit.
+     */
+    virtual float getChi2() const;
+                                                                                                         
+    /** Probability of the vertex fit.
+     */
+    virtual float getProbability() const;
+                                                                                                         
+    /** Additional parameters related to this vertex - check/set the collection
+     *  parameter "VertexParameterNames" for the parameters' meaning.
+     */
+    virtual const EVENT::FloatVec & getParameters() const;
+
+    /** Returns Reconstructed Particle associated to the Vertex
+     */
+    virtual const EVENT::ReconstructedParticle * getAssociatedParticle() const;
+
+    // setters
+    void setPrimary(bool primary) ;
+    void setPosition( float vpos[3] ) ;
+    void setPosition( float px, float py, float pz ) ;
+    void setChi2( float chi2 ) ;
+    void setProbability( float probability ) ;
+    void setCovMatrix( const float* cov ) ;
+    void setCovMatrix( const EVENT::FloatVec & ) ;
+    void setParameters( const float* par ) ;
+    void setParameters( const EVENT::FloatVec& ) ;
+    void setAssociatedParticle( const EVENT::ReconstructedParticle * aP ) ;
+
+  protected:
+    bool _primary ;
+    float _vpos[3] ;
+    float _chi2 ;
+    float _probability ;
+    EVENT::FloatVec _cov ;
+    EVENT::FloatVec _par ;
+    const EVENT::ReconstructedParticle * _aParticle ;
+   
+}; // class
+
+} // namespace IMPL
+#endif /* ifndef IMPL_VERTEXIMLP_H */

lcio/src/cpp/src/EXAMPLE
testvtx.cc added at 1.1.2.1
diff -N testvtx.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testvtx.cc	11 Aug 2006 10:54:07 -0000	1.1.2.1
@@ -0,0 +1,122 @@
+#include "lcio.h"
+
+#include "IO/LCReader.h"
+#include "IMPL/LCTOOLS.h"
+#include "EVENT/LCRunHeader.h"
+#include "EVENT/LCCollection.h"
+#include "EVENT/ReconstructedParticle.h"
+#include "IMPL/ReconstructedParticleImpl.h"
+#include "IMPL/VertexImpl.h"
+
+static const char* FILEN = "recjob.slcio" ; // default file name 
+
+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 ;
+
+    }
+*/    
+  }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();
+  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") ;
+  cout << col->getTypeName();
+  
+  if( col->getTypeName() != LCIO::RECONSTRUCTEDPARTICLE ){
+    cout << " collection not of type " << LCIO::RECONSTRUCTEDPARTICLE << endl ;
+  }
+  else{
+
+#ifdef USE_CLHEP
+      ReconstructedParticle4V recP( col->getElementAt( 0 ) ) ;
+#else
+      ReconstructedParticle* recP =
+        dynamic_cast<ReconstructedParticle*>( col->getElementAt( 0 ) ) ;
+#endif
+  
+
+  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);
+  
+  cout << endl<<endl;
+  cout << "Vertex Details:" << endl<<endl;
+  cout << "Primary:\t" << vtx->isPrimary() << endl;
+  cout << "Position:\tx:" << vtx->getPosition()[0] << "\ty: " << vtx->getPosition()[1] << "\tz: " << vtx->getPosition()[2] << endl;
+  cout << "Chi2:\t\t" << vtx->getChi2() << endl;
+  cout << "Probability:\t" << vtx->getProbability() << endl;
+  cout << "AParticle:\t" << vtx->getAssociatedParticle()->getCharge() << endl;
+  
+  delete vtx;
+
+  }
+  
+  lcReader->close() ;
+  delete lcReader ;
+
+  return 0 ;
+}
+
+  

lcio/src/cpp/src/EXAMPLE
GNUmakefile 1.10 -> 1.10.4.1
diff -u -r1.10 -r1.10.4.1
--- GNUmakefile	29 Mar 2006 14:09:14 -0000	1.10
+++ GNUmakefile	11 Aug 2006 10:54:06 -0000	1.10.4.1
@@ -72,3 +72,5 @@
 $(BINDIR)/testcopy: testcopy.cc $(INSTALL)/liblcio.a
 	$(CXX) -o $(BINDIR)/testcopy $(CPPFLAGS) testcopy.cc  $(LIBS) 
 
+$(BINDIR)/testvtx: testvtx.cc $(INSTALL)/liblcio.a
+	$(CXX) -o $(BINDIR)/testvtx $(CPPFLAGS) testvtx.cc  $(LIBS) 

lcio/src/cpp/src/IMPL
VertexImpl.cc added at 1.1.2.1
diff -N VertexImpl.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ VertexImpl.cc	11 Aug 2006 10:54:08 -0000	1.1.2.1
@@ -0,0 +1,93 @@
+#include "IMPL/VertexImpl.h"
+#include <algorithm>
+
+using namespace EVENT ;
+
+namespace IMPL{
+
+  VertexImpl::VertexImpl() :
+    _primary(0),
+    _chi2(0),
+    _probability(0)
+  {
+    _cov.resize( NCOVARIANCE ) ;
+    //     for(int i=0 ; i < NCOVARIANCE ; i++ ) { _cov.push_back( 0.0 ) ;  }
+    _vpos[0] = 0. ;
+    _vpos[1] = 0. ;
+    _vpos[2] = 0. ;
+  }
+
+  VertexImpl::~VertexImpl(){	  
+	  
+    /*
+    // delete the pids owned by this particle
+    for(  ParticleIDVec::iterator iter = _pid.begin() ; iter != _pid.end() ; iter++){
+      delete *iter ;
+    }
+    */
+  }
+ 
+  const float* VertexImpl::getPosition() const { return  _vpos ; }
+  const EVENT::FloatVec & VertexImpl::getCovMatrix() const { return _cov ; }
+  float VertexImpl::getChi2() const { return _chi2 ; }
+  float VertexImpl::getProbability() const { return _probability ; }
+  const EVENT::FloatVec & VertexImpl::getParameters() const { return _par ; }
+  const EVENT::ReconstructedParticle * VertexImpl::getAssociatedParticle() const { return _aParticle  ; }
+  
+  bool VertexImpl::isPrimary() const { return _primary ;}
+
+
+  //setters
+  void VertexImpl::setPrimary(bool primary){
+    checkAccess("VertexImpl::setPrimary" );
+    _primary = primary ;
+  }
+  
+  void VertexImpl::setChi2(float chi2){
+    checkAccess("VertexImpl::setChi2" );
+    _chi2 = chi2 ;
+  }
+  
+  void VertexImpl::setProbability(float probability){
+    checkAccess("VertexImpl::setProbability" );
+    _probability = probability ;
+  }
+ 
+  void VertexImpl::setPosition( float vpos[3] ){
+    setPosition( vpos[0], vpos[1], vpos[2] ) ;
+  }
+
+  void VertexImpl::setPosition( float px, float py, float pz ){
+    checkAccess("VertexImpl::setPosition" );
+    _vpos[0]  = px ;
+    _vpos[1]  = py ;
+    _vpos[2]  = pz ;
+  }
+                                                                                                                                        
+  void VertexImpl::setCovMatrix( const float* cov ){
+    checkAccess("VertexImpl::setCovMatrix" );
+    for(int i=0;i<NCOVARIANCE;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] ;
+  }
+  
+  void VertexImpl::setParameters( const float* par ){
+    checkAccess("VertexImpl::setParameters" );
+    //_par = par;
+  }
+  
+  void VertexImpl::setParameters( const EVENT::FloatVec& par ){
+    checkAccess("VertexImpl::" );
+    //_par = par;
+  }
+
+  void VertexImpl::setAssociatedParticle( const EVENT::ReconstructedParticle *aP ){
+    checkAccess("VertexImpl::setAssociatedParticle" );
+    _aParticle = aP;
+  }
+ 
+} // end namespace
+
CVSspam 0.2.8