Skip to content

Commit

Permalink
Add subdetectorHoleNumbers to count holes by subdetector.
Browse files Browse the repository at this point in the history
  • Loading branch information
kkrizka committed Jun 30, 2022
1 parent 55ca0e8 commit 2be9be0
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 4 deletions.
4 changes: 4 additions & 0 deletions cmake/lcio.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,10 @@
<repeat count="nHitNumbers">
<data type="int" name="subdetectorHitNumbers">number of hits in particular subdetectors. TODO need way to define mapping in run/event header</data>
</repeat>
<data type="int" name="nHoleNumbers"></data>
<repeat count="nHoleNumbers">
<data type="int" name="subdetectorHoleNumbers">number of holes in particular subdetectors. TODO need way to define mapping in run/event header</data>
</repeat>
<data type="int" name="nTracks"></data>
<repeat count="nTracks">
<data type="pntr" name="Track">tracks that have been combined to this track</data>
Expand Down
16 changes: 15 additions & 1 deletion src/cpp/include/IMPL/TrackImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -191,11 +198,17 @@ namespace IMPL {
virtual void setRadiusOfInnermostHit( float r ) ;

/** Allows modification of the subdetectorHitNumbers, e.g. <br>
* track->subdetectorHitNumbers().resize(5) ; <br>
* track->subdetectorHitNumbers().resize(5) ; <br>
* track->subdetectorHitNumbers()[4] = 42 ;
*/
virtual EVENT::IntVec & subdetectorHitNumbers() ;

/** Allows modification of the subdetectorHoleNumbers, e.g. <br>
* track->subdetectorHoleNumbers().resize(5) ; <br>
* track->subdetectorHoleNumbers()[4] = 42 ;
*/
virtual EVENT::IntVec & subdetectorHoleNumbers() ;

protected:

virtual void setType( int type ) ;
Expand All @@ -210,6 +223,7 @@ namespace IMPL {
int _nholes{0} ;
float _radiusOfInnermostHit{0} ;
EVENT::IntVec _subdetectorHitNumbers{} ;
EVENT::IntVec _subdetectorHoleNumbers{} ;

EVENT::TrackVec _tracks{} ;
EVENT::TrackerHitVec _hits{} ;
Expand Down
8 changes: 8 additions & 0 deletions src/cpp/include/pre-generated/EVENT/Track.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
26 changes: 26 additions & 0 deletions src/cpp/src/CPPFORT/lctrk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<TrackImpl,LCObject>( 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<n;j++) {
intv[j] = intVec[j] ;
}
*nintv = n ;
return LCIO::SUCCESS ;
}

PTRTYPE lctrkgettracks( PTRTYPE track ) {
TrackImpl* trk = f2c_pointer<TrackImpl,LCObject>( track ) ;
const TrackVec& idvect = trk->getTracks();
Expand Down Expand Up @@ -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<TrackImpl,LCObject>( track ) ;
IntVec& intVec = trk->subdetectorHoleNumbers() ;
intVec.resize( nintv ) ;
for(int j=0;j<nintv;j++) {
intVec[j] = intv[j] ;
}
return LCIO::SUCCESS ;
}

5 changes: 5 additions & 0 deletions src/cpp/src/EXAMPLE/recjob.cc
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ class RunEventProcessor : public LCRunListener, public LCEventListener{
trk->subdetectorHitNumbers()[ 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. } ;
Expand Down
10 changes: 10 additions & 0 deletions src/cpp/src/IMPL/TrackImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) ;

Expand Down Expand Up @@ -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 ;
}
Expand Down Expand Up @@ -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 ;
Expand Down
10 changes: 10 additions & 0 deletions src/cpp/src/SIO/SIOTrackHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ namespace SIO {
for( int i=0 ; i<nHitNumbers ; i++ ) {
SIO_DATA( device , &(trk->_subdetectorHitNumbers[i] ), 1 ) ;
}
trk->subdetectorHoleNumbers().resize( nHoleNumbers ) ;
for( int i=0 ; i<nHoleNumbers ; i++ ) {
SIO_DATA( device , &(trk->_subdetectorHoleNumbers[i] ), 1 ) ;
}
int nTracks ;
SIO_DATA( device, &nTracks , 1 ) ;
trk->_tracks.resize( nTracks ) ;
Expand Down Expand Up @@ -109,6 +113,12 @@ namespace SIO {
for( int i=0 ; i<nHitNumbers ; i++ ) {
SIO_SDATA( device , hitNums[i] ) ;
}
auto holeNums = trk->getSubdetectorHoleNumbers() ;
int nHoleNumbers = holeNums.size() ;
SIO_DATA( device, &nHoleNumbers , 1 ) ;
for( int i=0 ; i<nHoleNumbers ; i++ ) {
SIO_SDATA( device , holeNums[i] ) ;
}
auto tracks = trk->getTracks() ;
int nTracks = tracks.size() ;
SIO_DATA( device, &nTracks , 1 ) ;
Expand Down
18 changes: 15 additions & 3 deletions src/java/hep/lcio/implementation/event/ITrack.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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;
}
}
7 changes: 7 additions & 0 deletions src/java/hep/lcio/implementation/sio/SIOTrack.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/latex/manual/f77summary.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand All @@ -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 )
Expand Down

0 comments on commit 2be9be0

Please sign in to comment.