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

fix DDTrackCreatorBase::GetTrackStatesAtCalo #16

Merged
merged 2 commits into from
Oct 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions src/DDTrackCreatorBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ void DDTrackCreatorBase::GetTrackStatesAtCalo( EVENT::Track *track,

const auto* tsPosition = trackAtCalo->getReferencePoint();

if( tsPosition[2] < getTrackingRegionExtent()[2] ) {
if( std::fabs(tsPosition[2]) < getTrackingRegionExtent()[2] ) {
streamlog_out(DEBUG5) << "Original trackState is at Barrel" << std::endl;
pandora::InputTrackState pandoraTrackState;
this->CopyTrackState( trackAtCalo, pandoraTrackState );
Expand All @@ -421,16 +421,34 @@ void DDTrackCreatorBase::GetTrackStatesAtCalo( EVENT::Track *track,
auto marlintrk = std::unique_ptr<MarlinTrk::IMarlinTrack>(m_trackingSystem->createTrack());
const EVENT::TrackerHitVec& trkHits = track->getTrackerHits();
const int nHitsTrack = trkHits.size();

for (int iHit = 0; iHit < nHitsTrack; ++iHit) {
marlintrk->addHit(trkHits[iHit]);
EVENT::TrackerHit* trkHit = trkHits[iHit] ;
if( UTIL::BitSet32( trkHit->getType() )[ UTIL::ILDTrkHitTypeBit::COMPOSITE_SPACEPOINT ] ){ //it is a composite spacepoint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary, when we get all the hits from the original track? Weren't the hits of the track already added the same way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is what you have to do to pass an lcio::TrackerHit that is a spacepoint made from two strip hits to MarlinTrk - see here:
https://github.com/iLCSoft/MarlinTrk/blob/master/src/MarlinTrkUtils.cc#L236-L260

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it would be better to change this in the addHit function itself. Avoiding all this code duplication

//Split it up and add both hits to the MarlinTrk
const EVENT::LCObjectVec& rawObjects = trkHit->getRawHits();
for( unsigned k=0; k< rawObjects.size(); k++ ){
EVENT::TrackerHit* rawHit = static_cast< EVENT::TrackerHit* >( rawObjects[k] );
if( marlintrk->addHit( rawHit ) != MarlinTrk::IMarlinTrack::success ){
streamlog_out(DEBUG4) << "DDTrackCreatorBase::GetTrackStatesAtCalo failed to add strip hit " << *rawHit << std::endl;
}
}
} else {
if( marlintrk->addHit(trkHits[iHit]) != MarlinTrk::IMarlinTrack::success )
streamlog_out(DEBUG4) << "DDTrackCreatorBase::GetTrackStatesAtCalo failed to add tracker hit " << *trkHit<< std::endl;
}
}

bool tanL_is_positive = trackAtCalo->getTanLambda()>0;

auto trackState = TrackStateImpl(*trackAtCalo);
marlintrk->initialise(trackState, m_settings.m_bField, MarlinTrk::IMarlinTrack::modeForward);

int return_error = 0;
int return_error = marlintrk->initialise(trackState, m_settings.m_bField, MarlinTrk::IMarlinTrack::modeForward);
if (return_error != MarlinTrk::IMarlinTrack::success ) {
streamlog_out(DEBUG4) << "DDTrackCreatorBase::GetTrackStatesAtCalo failed to initialize track for endcap track : " << std::endl ;
return ;
}

double chi2 = -DBL_MAX;
int ndf = 0;

Expand Down