From 2be9be0b808aba835e9db07aa8a22322b86cbdb5 Mon Sep 17 00:00:00 2001 From: Karol Krizka Date: Thu, 30 Jun 2022 14:40:33 -0700 Subject: [PATCH] Add subdetectorHoleNumbers to count holes by subdetector. --- cmake/lcio.xml.in | 4 +++ src/cpp/include/IMPL/TrackImpl.h | 16 +++++++++++- src/cpp/include/pre-generated/EVENT/Track.h | 8 ++++++ src/cpp/src/CPPFORT/lctrk.cc | 26 +++++++++++++++++++ src/cpp/src/EXAMPLE/recjob.cc | 5 ++++ src/cpp/src/IMPL/TrackImpl.cc | 10 +++++++ src/cpp/src/SIO/SIOTrackHandler.cc | 10 +++++++ .../hep/lcio/implementation/event/ITrack.java | 18 ++++++++++--- .../hep/lcio/implementation/sio/SIOTrack.java | 7 +++++ src/latex/manual/f77summary.tex | 2 ++ 10 files changed, 102 insertions(+), 4 deletions(-) diff --git a/cmake/lcio.xml.in b/cmake/lcio.xml.in index 0aa50c038..c4e72aa52 100644 --- a/cmake/lcio.xml.in +++ b/cmake/lcio.xml.in @@ -599,6 +599,10 @@ number of hits in particular subdetectors. TODO need way to define mapping in run/event header + + + number of holes in particular subdetectors. TODO need way to define mapping in run/event header + tracks that have been combined to this track diff --git a/src/cpp/include/IMPL/TrackImpl.h b/src/cpp/include/IMPL/TrackImpl.h index f56e25271..f1c06a5de 100644 --- a/src/cpp/include/IMPL/TrackImpl.h +++ b/src/cpp/include/IMPL/TrackImpl.h @@ -132,6 +132,13 @@ namespace IMPL { */ virtual const EVENT::IntVec & getSubdetectorHitNumbers() const ; + /** A vector that holds the number of holes in particular subdetectors. + * The mapping of indices to subdetectors is implementation dependent. + * To be used as convenient information or if holes are not stored in + * the data set, e.g. DST or FastMC. + * TODO: Provide way to store mapping in event/run header. + */ + virtual const EVENT::IntVec & getSubdetectorHoleNumbers() const ; /** The tracks (as Track objects) that have been combined to this track. */ @@ -191,11 +198,17 @@ namespace IMPL { virtual void setRadiusOfInnermostHit( float r ) ; /** Allows modification of the subdetectorHitNumbers, e.g.
- * track->subdetectorHitNumbers().resize(5) ;
+ * track->subdetectorHitNumbers().resize(5) ;
* track->subdetectorHitNumbers()[4] = 42 ; */ virtual EVENT::IntVec & subdetectorHitNumbers() ; + /** Allows modification of the subdetectorHoleNumbers, e.g.
+ * track->subdetectorHoleNumbers().resize(5) ;
+ * track->subdetectorHoleNumbers()[4] = 42 ; + */ + virtual EVENT::IntVec & subdetectorHoleNumbers() ; + protected: virtual void setType( int type ) ; @@ -210,6 +223,7 @@ namespace IMPL { int _nholes{0} ; float _radiusOfInnermostHit{0} ; EVENT::IntVec _subdetectorHitNumbers{} ; + EVENT::IntVec _subdetectorHoleNumbers{} ; EVENT::TrackVec _tracks{} ; EVENT::TrackerHitVec _hits{} ; diff --git a/src/cpp/include/pre-generated/EVENT/Track.h b/src/cpp/include/pre-generated/EVENT/Track.h index 1486ec13b..ee3ed497d 100644 --- a/src/cpp/include/pre-generated/EVENT/Track.h +++ b/src/cpp/include/pre-generated/EVENT/Track.h @@ -124,6 +124,14 @@ class Track : public LCObject { */ virtual const IntVec & getSubdetectorHitNumbers() const = 0; + /** A vector that holds the number of holes in particular subdetectors. + * The mapping of indices to subdetectors is implementation dependent. + * To be used as convenient information or if holes are not stored in + * the data set, e.g. DST or FastMC. + * Check/set collection variable TrackSubdetectorNames for decoding the indices. + */ + virtual const IntVec & getSubdetectorHoleNumbers() const = 0; + /** The tracks that have been combined to this track. */ virtual const TrackVec & getTracks() const = 0; diff --git a/src/cpp/src/CPPFORT/lctrk.cc b/src/cpp/src/CPPFORT/lctrk.cc index 18a974d10..8cf2ebf90 100644 --- a/src/cpp/src/CPPFORT/lctrk.cc +++ b/src/cpp/src/CPPFORT/lctrk.cc @@ -138,6 +138,22 @@ int lctrkgetsubdetectorhitnumbers( PTRTYPE track, int* intv, int* nintv ) { return LCIO::SUCCESS ; } +int lctrkgetsubdetectorholenumbers( PTRTYPE track, int* intv, int* nintv ) { + TrackImpl* trk = f2c_pointer( track ) ; + IntVec& intVec = trk->subdetectorHoleNumbers() ; + int n = intVec.size() ; + if (n > *nintv) { + std::cerr << "Warning in lctrkgetsubdetectorholenumbers: vector size " << n + << " larger then target array size " << *nintv << std::endl ; + n = *nintv ; + } + for(int j=0;j( track ) ; const TrackVec& idvect = trk->getTracks(); @@ -274,3 +290,13 @@ int lctrksetsubdetectorhitnumbers( PTRTYPE track, int* intv, const int nintv return LCIO::SUCCESS ; } +int lctrksetsubdetectorholenumbers( PTRTYPE track, int* intv, const int nintv ) { + TrackImpl* trk = f2c_pointer( track ) ; + IntVec& intVec = trk->subdetectorHoleNumbers() ; + intVec.resize( nintv ) ; + for(int j=0;jsubdetectorHitNumbers()[ SITINDEX ] = 24 ; trk->subdetectorHitNumbers()[ TPCINDEX ] = 36 ; + trk->subdetectorHoleNumbers().resize( NTRACKER ) ; + trk->subdetectorHoleNumbers()[ VTXINDEX ] = 0 ; + trk->subdetectorHoleNumbers()[ SITINDEX ] = 0 ; + trk->subdetectorHoleNumbers()[ TPCINDEX ] = 0 ; + trk->setdEdx( 3.14159 ) ; trk->setdEdxError( 42. ) ; float cov[15] = { 1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.,15. } ; diff --git a/src/cpp/src/IMPL/TrackImpl.cc b/src/cpp/src/IMPL/TrackImpl.cc index 47633f0d6..6db811c03 100644 --- a/src/cpp/src/IMPL/TrackImpl.cc +++ b/src/cpp/src/IMPL/TrackImpl.cc @@ -39,6 +39,7 @@ namespace IMPL { _radiusOfInnermostHit = o._radiusOfInnermostHit ; std::copy( o._subdetectorHitNumbers.begin() , o._subdetectorHitNumbers.end() , std::back_inserter( _subdetectorHitNumbers ) ) ; + std::copy( o._subdetectorHoleNumbers.begin() , o._subdetectorHoleNumbers.end() , std::back_inserter( _subdetectorHoleNumbers ) ) ; std::copy( o._hits.begin() , o._hits.end() , std::back_inserter( _hits ) ) ; @@ -122,6 +123,10 @@ namespace IMPL { const IntVec & TrackImpl::getSubdetectorHitNumbers() const { return _subdetectorHitNumbers ; } + const IntVec & TrackImpl::getSubdetectorHoleNumbers() const { + return _subdetectorHoleNumbers ; + } + const TrackerHitVec & TrackImpl::getTrackerHits() const { return _hits ; } @@ -376,6 +381,11 @@ namespace IMPL { return _subdetectorHitNumbers ; } + IntVec & TrackImpl::subdetectorHoleNumbers(){ + checkAccess("TrackImpl::subdetectorHoleNumbers") ; + return _subdetectorHoleNumbers ; + } + void TrackImpl::setRadiusOfInnermostHit( float r ){ checkAccess("TrackImpl::setRadiusOfInnermostHit") ; _radiusOfInnermostHit = r ; diff --git a/src/cpp/src/SIO/SIOTrackHandler.cc b/src/cpp/src/SIO/SIOTrackHandler.cc index c06cedf49..45795f992 100644 --- a/src/cpp/src/SIO/SIOTrackHandler.cc +++ b/src/cpp/src/SIO/SIOTrackHandler.cc @@ -58,6 +58,10 @@ namespace SIO { for( int i=0 ; i_subdetectorHitNumbers[i] ), 1 ) ; } + trk->subdetectorHoleNumbers().resize( nHoleNumbers ) ; + for( int i=0 ; i_subdetectorHoleNumbers[i] ), 1 ) ; + } int nTracks ; SIO_DATA( device, &nTracks , 1 ) ; trk->_tracks.resize( nTracks ) ; @@ -109,6 +113,12 @@ namespace SIO { for( int i=0 ; igetSubdetectorHoleNumbers() ; + int nHoleNumbers = holeNums.size() ; + SIO_DATA( device, &nHoleNumbers , 1 ) ; + for( int i=0 ; igetTracks() ; int nTracks = tracks.size() ; SIO_DATA( device, &nTracks , 1 ) ; diff --git a/src/java/hep/lcio/implementation/event/ITrack.java b/src/java/hep/lcio/implementation/event/ITrack.java index 12092eedc..04924166c 100644 --- a/src/java/hep/lcio/implementation/event/ITrack.java +++ b/src/java/hep/lcio/implementation/event/ITrack.java @@ -40,6 +40,7 @@ public class ITrack extends ILCObject implements Track //public final static int BITISREFERENCEPOINTPCA = 31; protected int[] subdetectorHitNumbers = null0; + protected int[] subdetectorHoleNumbers = null0; public float getD0() { @@ -321,21 +322,32 @@ public float getRadiusOfInnermostHit() { return radiusOfInnermostHit; } - + public void setRadiusOfInnermostHit(float f) { checkAccess(); radiusOfInnermostHit = f; } - + public int[] getSubdetectorHitNumbers() { return subdetectorHitNumbers ; } - + public void setSubdetectorHitNumbers(int[] is) { checkAccess(); subdetectorHitNumbers = is; } + + public int[] getSubdetectorHoleNumbers() + { + return subdetectorHoleNumbers ; + } + + public void setSubdetectorHoleNumbers(int[] is) + { + checkAccess(); + subdetectorHoleNumbers = is; + } } diff --git a/src/java/hep/lcio/implementation/sio/SIOTrack.java b/src/java/hep/lcio/implementation/sio/SIOTrack.java index ec887cfdd..e889e0959 100644 --- a/src/java/hep/lcio/implementation/sio/SIOTrack.java +++ b/src/java/hep/lcio/implementation/sio/SIOTrack.java @@ -87,6 +87,13 @@ class SIOTrack extends ITrack hitNumbers[i] = in.readInt() ; } setSubdetectorHitNumbers(hitNumbers) ; + int nHoleNumbers = in.readInt() ; + int[] holeNumbers = new int[nHoleNumbers] ; + for (int i = 0; i < nHoleNumbers; i++) + { + holeNumbers[i] = in.readInt() ; + } + setSubdetectorHoleNumbers(holeNumbers) ; int nTracks = in.readInt(); tempTracks = new ArrayList(nTracks); tracks = null; diff --git a/src/latex/manual/f77summary.tex b/src/latex/manual/f77summary.tex index d08721ec2..e7bd75935 100644 --- a/src/latex/manual/f77summary.tex +++ b/src/latex/manual/f77summary.tex @@ -293,6 +293,7 @@ addTrack -> status = lctrkaddtrack( ptrk, ptrack ) addHit -> status = lctrkaddhit( ptrk, phit ) subdetectorHitNumbers -> status = lctrksetsubdetectorhitnumbers( ptrk, intv, nintv) (not in C++ API) +subdetectorHoleNumbers -> status = lctrksetsubdetectorholenumbers( ptrk, intv, nintv) (not in C++ API) id -> id = lctrkid( ptrk ) getType -> itype = lctrkgettype( ptrk ) @@ -310,6 +311,7 @@ getNholes -> nholes = lctrkgetnholes( ptrk ) getRadiusOfInnermostHit-> radius = lctrkgetradiusofinnermosthit( ptrk ) subdetectorHitNumbers -> status = lctrkgetsubdetectorhitnumbers( ptrk, intv, nintv) +subdetectorHoleNumbers -> status = lctrkgetsubdetectorholenumbers( ptrk, intv, nintv) getTracks -> ptrackv = lctrkgettracks( ptrk ) getTrackerHits -> ptrhitv = lctrkgettrackerhits( ptrk )