Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding track nholes to EDM #147

Merged
merged 12 commits into from
Jun 6, 2024
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ include(GNUInstallDirs)

# project version
SET( LCIO_VERSION_MAJOR 2 )
SET( LCIO_VERSION_MINOR 21 )
SET( LCIO_VERSION_PATCH 0 )
SET( LCIO_VERSION_MINOR 22 )
SET( LCIO_VERSION_PATCH 99 )

### set correct LCIO version in relevant files ############################

Expand Down
5 changes: 5 additions & 0 deletions cmake/lcio.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -594,11 +594,16 @@
<data type="int" name="ndf">ndf of fit</data>
<data type="float" name="dEdx">dEdx</data>
<data type="float" name="dEdxError">Error of dEdx</data>
<data type="int" name="Nholes">number of holes in track</data>
<data type="float" name="radiusOfInnermostHit">radius of innermost hit used in track fit</data>
<data type="int" name="nHitNumbers"></data>
<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
3 changes: 3 additions & 0 deletions src/aid/EVENT/Track.aid
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ public interface Track extends LCObject {
*/
public float getdEdxError() const ;

/** Number of holes.
*/
public int getNholes() const ;

/** The radius of the innermost hit that has been used in the track fit.
* Helps to detect V0 tracks with small impact paramters or heavy mesons.
Expand Down
22 changes: 21 additions & 1 deletion src/cpp/include/IMPL/TrackImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ namespace IMPL {
*/
virtual float getdEdxError() const;

/** Number of holes of the track.
*/
virtual int getNholes() const;

/** The radius of the innermost hit that has been used in the track fit.
* Helps to detect V0 tracks with small impact paramters or haevy mesons.
* To be used as convenient information or if hits are not stored in
Expand All @@ -128,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.
madbaron marked this conversation as resolved.
Show resolved Hide resolved
*/
virtual const EVENT::IntVec & getSubdetectorHoleNumbers() const ;

/** The tracks (as Track objects) that have been combined to this track.
*/
Expand Down Expand Up @@ -174,6 +185,7 @@ namespace IMPL {
virtual void setNdf( int ndf ) ;
virtual void setdEdx( float dEdx ) ;
virtual void setdEdxError( float dEdxError ) ;
virtual void setNholes( int nholes ) ;

virtual void addTrack( EVENT::Track* trk ) ;
virtual void addTrackState( EVENT::TrackState* trkstate ) ;
Expand All @@ -186,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 @@ -202,8 +220,10 @@ namespace IMPL {
int _ndf{0} ;
float _dEdx{0} ;
float _dEdxError{0} ;
int _nholes{0} ;
float _radiusOfInnermostHit{0} ;
EVENT::IntVec _subdetectorHitNumbers{} ;
EVENT::IntVec _subdetectorHoleNumbers{} ;

EVENT::TrackVec _tracks{} ;
EVENT::TrackerHitVec _hits{} ;
Expand Down
12 changes: 12 additions & 0 deletions src/cpp/include/pre-generated/EVENT/Track.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ class Track : public LCObject {
*/
virtual float getdEdxError() const = 0;

/** Number of holes.
*/
virtual int getNholes() const = 0;

/** The radius of the innermost hit that has been used in the track fit.
* Helps to detect V0 tracks with small impact paramters or heavy mesons.
* To be used as convenient information or if hits are not stored in
Expand All @@ -119,6 +123,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
6 changes: 6 additions & 0 deletions src/cpp/src/EXAMPLE/recjob.cc
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ class RunEventProcessor : public LCRunListener, public LCEventListener{
trk->setZ0( (i+1)*10. ) ;
trk->setChi2( 1.01 ) ;
trk->setNdf( 42 ) ;
trk->setNholes( 2 ) ;

trk->setRadiusOfInnermostHit( 3.141592 ) ;

Expand All @@ -212,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
17 changes: 17 additions & 0 deletions src/cpp/src/IMPL/TrackImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace IMPL {
_ndf(0),
_dEdx(0),
_dEdxError(0),
_nholes(0),
_radiusOfInnermostHit(0) {
}

Expand All @@ -34,9 +35,11 @@ namespace IMPL {
_ndf = o._ndf ;
_dEdx = o._dEdx ;
_dEdxError = o._dEdxError ;
_nholes = o._nholes ;
_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 @@ -110,6 +113,7 @@ namespace IMPL {
int TrackImpl::getNdf() const { return _ndf ;}
float TrackImpl::getdEdx() const { return _dEdx ; }
float TrackImpl::getdEdxError() const { return _dEdxError ; }
int TrackImpl::getNholes() const { return _nholes ; }


float TrackImpl::getRadiusOfInnermostHit() const {
Expand All @@ -119,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 @@ -337,6 +345,10 @@ namespace IMPL {
checkAccess("TrackImpl::setdEdxError") ;
_dEdxError = dEdxError ;
}
void TrackImpl::setNholes( int nholes ){
checkAccess("TrackImpl::setNholes") ;
_nholes = nholes ;
}

void TrackImpl::addHit( TrackerHit* hit) {
_hits.push_back( hit ) ;
Expand Down Expand Up @@ -369,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
18 changes: 18 additions & 0 deletions src/cpp/src/SIO/SIOTrackHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,24 @@ namespace SIO {
SIO_DATA( device , &(trk->_ndf) , 1 ) ;
SIO_DATA( device , &(trk->_dEdx) , 1 ) ;
SIO_DATA( device , &(trk->_dEdxError) , 1 ) ;
if (vers > SIO_VERSION_ENCODE(2, 21)) {
SIO_DATA( device , &(trk->_nholes) , 1 ) ;
}
SIO_DATA( device , &( trk->_radiusOfInnermostHit ) , 1 ) ;
int nHitNumbers ;
SIO_DATA( device, &nHitNumbers , 1 ) ;
trk->subdetectorHitNumbers().resize( nHitNumbers ) ;
for( int i=0 ; i<nHitNumbers ; i++ ) {
SIO_DATA( device , &(trk->_subdetectorHitNumbers[i] ), 1 ) ;
}
if (vers > SIO_VERSION_ENCODE(2, 21)) {
int nHoleNumbers ;
SIO_DATA( device, &nHoleNumbers , 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 @@ -100,13 +111,20 @@ namespace SIO {
SIO_SDATA( device, trk->getNdf() ) ;
SIO_SDATA( device, trk->getdEdx() ) ;
SIO_SDATA( device, trk->getdEdxError() ) ;
SIO_SDATA( device, trk->getNholes() ) ;
SIO_SDATA( device , trk->getRadiusOfInnermostHit() ) ;
auto hitNums = trk->getSubdetectorHitNumbers() ;
int nHitNumbers = hitNums.size() ;
SIO_DATA( device, &nHitNumbers , 1 ) ;
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
6 changes: 6 additions & 0 deletions src/cpp/src/TESTS/test_tracks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ int main(int /*argc*/, char** /*argv*/ ){
trk->setRadiusOfInnermostHit( 3.14159265 ) ;
trk->setdEdx( 3.14159265 ) ;
trk->setdEdxError( 42. ) ;
trk->setNholes( 2. ) ;

float cov[15] = { 1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.,15. } ;
trk->setCovMatrix( cov ) ;
Expand Down Expand Up @@ -113,6 +114,7 @@ int main(int /*argc*/, char** /*argv*/ ){
trk->setRadiusOfInnermostHit( 3.14159265 ) ;
trk->setdEdx( 3.14159265 ) ;
trk->setdEdxError( 42. ) ;
trk->setNholes( 2. ) ;

float cov[15] = { 1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.,15. } ;
trk->setCovMatrix( cov ) ;
Expand Down Expand Up @@ -203,6 +205,7 @@ int main(int /*argc*/, char** /*argv*/ ){
MYTEST( trk->getNdf(), 42 , "getNdf" ) ;
MYTEST( trk->getdEdx(), float(3.14159265) , "getdEdx" ) ;
MYTEST( trk->getdEdxError(), float(42.) , "getdEdxError" ) ;
MYTEST( trk->getNholes(), int(2.) , "getNholes" ) ;
MYTEST( trk->getRadiusOfInnermostHit(), float(3.14159265) , "getRadiusOfInnermostHit" ) ;

const FloatVec& cov = trk->getCovMatrix() ;
Expand Down Expand Up @@ -256,6 +259,7 @@ int main(int /*argc*/, char** /*argv*/ ){
MYTEST( trk->getNdf(), 42 , "getNdf" ) ;
MYTEST( trk->getdEdx(), float(3.14159265) , "getdEdx" ) ;
MYTEST( trk->getdEdxError(), float(42.) , "getdEdxError" ) ;
MYTEST( trk->getNholes(), int(2.) , "getNholes" ) ;
MYTEST( trk->getRadiusOfInnermostHit(), float(3.14159265) , "getRadiusOfInnermostHit" ) ;

const FloatVec& cov = trk->getCovMatrix() ;
Expand Down Expand Up @@ -304,6 +308,7 @@ int main(int /*argc*/, char** /*argv*/ ){
MYTEST( trk->getNdf(), 42 , "getNdf" ) ;
MYTEST( trk->getdEdx(), float(3.14159265) , "getdEdx" ) ;
MYTEST( trk->getdEdxError(), float(42.) , "getdEdxError" ) ;
MYTEST( trk->getNholes(), int(2.) , "getNholes" ) ;
MYTEST( trk->getRadiusOfInnermostHit(), float(3.14159265) , "getRadiusOfInnermostHit" ) ;

const FloatVec& cov = trk->getCovMatrix() ;
Expand Down Expand Up @@ -367,6 +372,7 @@ int main(int /*argc*/, char** /*argv*/ ){
MYTEST( trkc->getNdf(), 42 , "getNdf" ) ;
MYTEST( trkc->getdEdx(), float(3.14159265) , "getdEdx" ) ;
MYTEST( trkc->getdEdxError(), float(42.) , "getdEdxError" ) ;
MYTEST( trkc->getNholes(), int(2.) , "getNholes" ) ;
MYTEST( trkc->getRadiusOfInnermostHit(), float(3.14159265) , "getRadiusOfInnermostHit" ) ;

const FloatVec& covc = trkc->getCovMatrix() ;
Expand Down
6 changes: 4 additions & 2 deletions src/cpp/src/UTIL/Operators.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2420,12 +2420,12 @@ namespace UTIL{
//============================================================================

const std::string& header(const EVENT::Track *){ //hauke
static const std::string _h(" [ id ] | type | d0 | phi | omega | z0 | tan lambda| reference point(x,y,z) | dEdx | dEdxErr | chi2 | ndf \n");
static const std::string _h(" [ id ] | type | d0 | phi | omega | z0 | tan lambda| reference point(x,y,z) | dEdx | dEdxErr | nholes | chi2 | ndf \n");
return _h;
}

const std::string& tail(const EVENT::Track *){ //hauke
static const std::string _t("------------|----------|----------|----------|----------|-----------|-----------|---------------------------------|----------|----------|-------- \n");
static const std::string _t("------------|----------|----------|----------|----------|-----------|-----------|---------------------------------|----------|----------|----------|-------- \n");
return _t;
}

Expand All @@ -2449,6 +2449,7 @@ namespace UTIL{
out << " |(" << setprecision(2) << trk->getReferencePoint()[0] << ", " << trk->getReferencePoint()[1] << ", " <<trk->getReferencePoint()[2];
out << ")|" << trk->getdEdx();
out << " |" << trk->getdEdxError();
out << " |" << trk->getNholes();
out << " |" << trk->getChi2();
out << " |" << noshowpos << setw(5) << trk->getNdf() ;
out << endl;
Expand Down Expand Up @@ -2542,6 +2543,7 @@ namespace UTIL{
// out << setw(30) << setfill(' ') << left << "ReferencePoint" << right << setw(40) << tmp.str() << endl;
out << setw(30) << setfill(' ') << left << "dEdx" << right << setw(40) << part->getdEdx() << endl;
out << setw(30) << setfill(' ') << left << "dEdx Error" << right << setw(40) << part->getdEdxError() << endl;
out << setw(30) << setfill(' ') << left << "N holes" << right << setw(40) << part->getNholes() << endl;
out << setw(30) << setfill(' ') << left << "Chi2" << right << setw(40) << part->getChi2() << endl;
out << setw(30) << setfill(' ') << left << "Ndf" << right << setw(40) << noshowpos << part->getNdf() << endl;

Expand Down
Loading
Loading