Commit 925c2262 authored by Atlas-Software Librarian's avatar Atlas-Software Librarian Committed by Graeme Stewart
Browse files

'CMakeLists.txt' (TRT_StandaloneTrackFinder-01-00-05)

parent 2a2c5a1c
################################################################################
# Package: TRT_StandaloneTrackFinder
################################################################################
# Declare the package name:
atlas_subdir( TRT_StandaloneTrackFinder )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PUBLIC
Control/AthenaBaseComps
GaudiKernel
Tracking/TrkEvent/TrkSegment
Tracking/TrkEvent/TrkTrack
PRIVATE
InnerDetector/InDetRecTools/InDetRecToolInterfaces
Tracking/TrkEvent/TrkEventPrimitives
Tracking/TrkEvent/TrkParameters )
# Component(s) in the package:
atlas_add_component( TRT_StandaloneTrackFinder
src/*.cxx
src/components/*.cxx
LINK_LIBRARIES AthenaBaseComps GaudiKernel TrkSegment TrkTrack InDetRecToolInterfaces TrkEventPrimitives TrkParameters )
# Install files from the package:
atlas_install_headers( TRT_StandaloneTrackFinder )
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**********************************************************************************
Header file for class TRT_StandaloneTrackFinder
(c) ATLAS Detector software
Algorithm for Trk::Track production in TRT only
Version 1.0: 09/28/2007
Authors : Thomas Koffas, Markus Elsing
email : Thomas.Koffas@cern.ch
**********************************************************************************/
#ifndef TRT_StandaloneTrackFinder_H
#define TRT_StandaloneTrackFinder_H
#include <string>
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/ToolHandle.h"
///Track Collection to store the tracks
#include "TrkTrack/TrackCollection.h"
///Needed for the TRT track segments
#include "TrkSegment/SegmentCollection.h"
namespace InDet {
/**
@class TRT_StandaloneTrackFinder
InDet::TRT_StandaloneTrackFinde is an algorithm which produces tracks
from stand-alone TRT segments with no Si extension
@author Thomas.Koffas@cern.ch
*/
class ITRT_SegmentToTrackTool;
class TRT_StandaloneTrackFinder : public AthAlgorithm
{
///////////////////////////////////////////////////////////////////
// Public methods:
///////////////////////////////////////////////////////////////////
public:
///////////////////////////////////////////////////////////////////
/** Standard Algotithm methods */
///////////////////////////////////////////////////////////////////
TRT_StandaloneTrackFinder(const std::string &name, ISvcLocator *pSvcLocator);
virtual ~TRT_StandaloneTrackFinder();
StatusCode initialize();
StatusCode execute();
StatusCode finalize();
///////////////////////////////////////////////////////////////////
/** Print internal tool parameters and status */
///////////////////////////////////////////////////////////////////
MsgStream& dump (MsgStream& out) const;
std::ostream& dump (std::ostream& out) const;
private:
///////////////////////////////////////////////////////////////////
/* Private data */
///////////////////////////////////////////////////////////////////
int m_nprint ;
int m_ntracks ; //!< Number of tracks found
std::string m_inseglocation ; //!< Name of input TRT segments location
std::string m_outtracklocation ; //!< Name of output tracks location
int m_minNumDriftCircles ; //!< Minimum number of drift circles for TRT segment tracks
double m_minPt ; //!< Minimum pt cut for TRT only (used in preselection * 0.9)
bool m_resetPRD ; //!< Reset PRD association tool during the sub-detector pattern
int m_matEffects ; //!< Particle hypothesis for track fitting
bool m_oldLogic ; //!< use old transition region hit logic
ToolHandle< ITRT_SegmentToTrackTool > m_segToTrackTool; //!< Segment to track tool
const Trk::SegmentCollection* m_Segments ; //!< TRT segments to use
/**Tracks that will be passed out of AmbiProcessor.
Recreated anew each time process() is called*/
TrackCollection* m_finalTracks;
/** Global Counters for final algorithm statistics */
int m_nTrtSeg ; //!< Number of input TRT segments to be investigated per event
int m_nUsedSeg ; //!< Number of TRT segments excluded at input (by BackTracking tracks)
int m_nRejectedSeg ; //!< Number of segments rejected in selection at input
int m_nTrtSegGood ; //!< Number of input TRT segments after cuts per event
int m_nSegFailed ; //!< Number of segments failing to translate to a track (inclusing refit)
/** Total in counters */
int m_nTrtSegTotal ; //!< Number of input TRT segments to be investigated per event
int m_nUsedSegTotal ; //!< Number of TRT segments excluded at input (by BackTracking tracks)
int m_nRejectedSegTotal ; //!< Number of segments reduce in selection at input
int m_nTrtSegGoodTotal ; //!< Number of input TRT segments after cuts per event
int m_nSegFailedTotal ; //!< Number of segments failing to translate to a track
int m_nTrkScoreZeroTotal ; //!< Number of tracks rejected by score zero
int m_nTrkSegUsedTotal ; //!< Number of excluded segments by other TRT segments
int m_nTRTTrkTotal ; //!< Number of TRT-only tracks on output
MsgStream& dumptools(MsgStream& out) const;
MsgStream& dumpevent(MsgStream& out) const;
};
MsgStream& operator << (MsgStream& ,const TRT_StandaloneTrackFinder&);
std::ostream& operator << (std::ostream&,const TRT_StandaloneTrackFinder&);
}
#endif // TRT_StandaloneTrackFinder_H
package TRT_StandaloneTrackFinder
author Thomas Koffas <Thomas.Koffas@cern.ch>
private
use TrkParameters TrkParameters-* Tracking/TrkEvent
#TRT segment to track tool
use InDetRecToolInterfaces InDetRecToolInterfaces-* InnerDetector/InDetRecTools
#use TrkPseudoMeasurementOnTrack TrkPseudoMeasurementOnTrack-* Tracking/TrkEvent
#use InDetIdentifier InDetIdentifier-* InnerDetector/InDetDetDescr
#use InDetRIO_OnTrack InDetRIO_OnTrack-* InnerDetector/InDetRecEvent
#use TrkToolInterfaces TrkToolInterfaces-* Tracking/TrkTools
#use TrkExInterfaces TrkExInterfaces-* Tracking/TrkExtrapolation
#use TrkFitterInterfaces TrkFitterInterfaces-* Tracking/TrkFitter
#use MagFieldInterfaces MagFieldInterfaces-* MagneticField
use TrkEventPrimitives TrkEventPrimitives-* Tracking/TrkEvent
public
use AtlasPolicy AtlasPolicy-*
use GaudiInterface GaudiInterface-* External
use AthenaBaseComps AthenaBaseComps-* Control
use TrkTrack TrkTrack-* Tracking/TrkEvent
use TrkSegment TrkSegment-* Tracking/TrkEvent
library TRT_StandaloneTrackFinder *.cxx components/*.cxx
apply_pattern component_library
#private
#macro cppdebugflags '$(cppdebugflags_s)'
#macro_remove componentshr_linkopts "-Wl,-s"
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
@mainpage TRT_StandaloneTrackFinder
@author Thomas.Koffas@cern.ch
@section TRT_StandaloneTrackFinderIntro Introduction
This is an algorithm that deals with the TRT segments that have not
been assigned a Si extension. It runs after the TRT seeded back-tracking
is completed, including the ambiguity resolving of the resulting tracks.
The input are TRT track segments and the output are global ID tracks.
@section TRT_StandaloneTrackFinderDescription Description
This algorithm performs the following tasks:
1. Loops over the input TRT track segments and checks the number of
the segment's drift circles that have been already used by the Si
extended back-tracks, using the association tool after the later
has been updated during the ambiguity resolving of the back-tracks.
Only segments with more than 15 drift circles (configurable via the
algorithm's jobOptions) will be investigated. Those TRT track segments
that are found to share more than half (also configurable via the
algorithm's jobOptions) of their drift circles with previously
reconstructed back-tracks are dropped.
2. Each of the TRT track segments that pass the above criteria are then fitted
using the configured track fitter. Those that are successfully fitted are
then stored in a dedicated track collection.
@section TRT_StandaloneTrackFinderTools Used Tools
This algorithm uses the ITrackFitter, InDetAssociationTool tools.
@section TRT_StandaloneTrackFinderContents Algorithm Contents
The TRT_StandaloneTrackFinder contains the following classes/files:
- TRT_StandaloneTrackFinder.cxx...Main class calling all the necessary tools and producing the ouput track collection.
@section TRT_StandaloneTrackFinderPackages Used Packages
@htmlinclude used_packages.html
@section TRT_StandaloneTrackFinderReq Requirements file
@include requirements
*/
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// Implementation file for class InDet::TRT_StandaloneTrackFinder
///////////////////////////////////////////////////////////////////
// (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
// Version 1.0 09/28/2007 Thomas Koffas
// update by Markus Elsing
///////////////////////////////////////////////////////////////////
#include "TRT_StandaloneTrackFinder/TRT_StandaloneTrackFinder.h"
#include "TrkParameters/TrackParameters.h"
#include "TrkEventPrimitives/FitQualityOnSurface.h"
#include "TrkEventPrimitives/FitQuality.h"
///Track events
#include "TrkSegment/TrackSegment.h"
#include "InDetRecToolInterfaces/ITRT_SegmentToTrackTool.h"
using CLHEP::GeV;
///////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////
InDet::TRT_StandaloneTrackFinder::TRT_StandaloneTrackFinder
(const std::string& name, ISvcLocator* pSvcLocator)
: AthAlgorithm(name, pSvcLocator),
m_nprint(0),
m_segToTrackTool("InDet::TRT_SegmentToTrackTool")
{
m_inseglocation = "TRTSegments" ;
m_outtracklocation = "TRTStandaloneTracks" ;
m_minNumDriftCircles = 15 ; //Minimum number of drift circles for TRT segment tracks
m_minPt = 1.0 * GeV ; //pt cut
m_matEffects = 0 ;
m_resetPRD = false ; //Reset PRD association tool during sub-detector pattern
declareProperty("InputSegmentsLocation" ,m_inseglocation ); //Input track collection
declareProperty("OutputTracksLocation" ,m_outtracklocation ); //Output track collection
declareProperty("MinNumDriftCircles" ,m_minNumDriftCircles); //Minimum number of drift circles for TRT segment tracks
declareProperty("MinPt" ,m_minPt ); //Minimum Pt in preselection
declareProperty("MaterialEffects" ,m_matEffects ); //Particle hypothesis during track fitting
declareProperty("ResetPRD" ,m_resetPRD ); //Reset PRD association tool during sub-detector pattern
declareProperty("OldTransitionLogic" ,m_oldLogic = true ); //use old transition logic for hits
declareProperty("TRT_SegToTrackTool" ,m_segToTrackTool );
}
InDet::TRT_StandaloneTrackFinder::~TRT_StandaloneTrackFinder()
{}
///////////////////////////////////////////////////////////////////
// Initialisation
///////////////////////////////////////////////////////////////////
StatusCode InDet::TRT_StandaloneTrackFinder::initialize()
{
StatusCode sc;
msg(MSG::DEBUG) << "Initializing TRT_StandaloneTrackFinder" << endreq;
sc = m_segToTrackTool.retrieve();
if (sc.isFailure()) {
msg(MSG::FATAL) << "Failed to retrieve tool " << m_segToTrackTool << endreq;
return StatusCode::FAILURE;
}else{
msg() << MSG::INFO << "Retrieved tool " << m_segToTrackTool << endreq;
}
// Get output print level
//
if(msgLvl(MSG::DEBUG)) {
m_nprint=0; msg(MSG::DEBUG) << (*this) << endreq;
}
//Global counters. See the include file for definitions
m_nTrtSegTotal = 0;
m_nUsedSegTotal = 0;
m_nRejectedSegTotal = 0;
m_nTrtSegGoodTotal = 0;
m_nSegFailedTotal = 0;
m_nTrkScoreZeroTotal = 0;
m_nTrkSegUsedTotal = 0;
m_nTRTTrkTotal = 0;
return sc;
}
///////////////////////////////////////////////////////////////////
// Execute
///////////////////////////////////////////////////////////////////
StatusCode InDet::TRT_StandaloneTrackFinder::execute()
{
StatusCode sc;
//Counters. See the include file for definitions
m_nTrtSeg = 0;
m_nUsedSeg = 0;
m_nRejectedSeg = 0;
m_nTrtSegGood = 0;
m_nSegFailed = 0;
//Clear all caches
m_segToTrackTool->resetAll();
// Clear PRD association tool
if(m_resetPRD) m_segToTrackTool->resetAssoTool();
///Retrieve segments from StoreGate
//
sc = evtStore()->retrieve(m_Segments,m_inseglocation);
if(sc.isFailure()){
ATH_MSG_FATAL ("No segment with name " << m_inseglocation << " found in StoreGate!");
return sc;
}else{
ATH_MSG_DEBUG ("Found segments collection " << m_inseglocation << " in StoreGate!");
}
// statistics...
m_nTrtSeg = int(m_Segments->size());
ATH_MSG_DEBUG ("TRT track container size " << m_nTrtSeg);
// loop over segments
ATH_MSG_DEBUG ("Begin looping over all TRT segments in the event");
Trk::SegmentCollection::const_iterator iseg = m_Segments->begin();
Trk::SegmentCollection::const_iterator isegEnd = m_Segments->end();
for(; iseg != isegEnd; ++ iseg) {
// Get the track segment
const Trk::TrackSegment *trackTRT = dynamic_cast<const Trk::TrackSegment*>(*iseg);
if(!trackTRT) {
ATH_MSG_WARNING ("No pointer to segment, should not happen !");
continue;
} else {
ATH_MSG_DEBUG ("--> start evaluating new segment");
// start with pt preselection, get the segment parameters
const Amg::VectorX& p = trackTRT->localParameters();
if ( fabs(sin(p(3))/p(4)) < m_minPt*0.9 ) {
// Statistics...
m_nRejectedSeg++;
ATH_MSG_DEBUG ("Segment pt = " << fabs(sin(p(3))/p(4)) << " , fails pre-cut, drop it !");
continue;
}
// Check if segment has already been assigned to a BackTrack
if(m_segToTrackTool->segIsUsed(*trackTRT)) {
// Statistics...
m_nUsedSeg++;
ATH_MSG_DEBUG ("Segment excluded by BackTrack, drop it !");
continue;
}
// Get the number of the TRT track segment ROTs
int nROTs = trackTRT->numberOfMeasurementBases();
ATH_MSG_DEBUG ("Number Of ROTs " << nROTs);
// requited number of drift circles
int minDriftCircles = m_minNumDriftCircles;
bool is_toLower = false; // to handle special case
// Cases where the min number of required TRT drift circles drops to 10
if(nROTs <= minDriftCircles && m_oldLogic) {
ATH_MSG_DEBUG ("Few DCs, can we recover ?");
is_toLower = m_segToTrackTool->toLower(*trackTRT);
if (is_toLower) {
ATH_MSG_DEBUG ("We recovered this one, let's try...");
}
}
if((nROTs < m_minNumDriftCircles) && !is_toLower) {
// statistics...
m_nRejectedSeg++;
ATH_MSG_DEBUG ("Segment fails number of DC requirements, reject it");
}
else {
// statistics
m_nTrtSegGood++;
ATH_MSG_DEBUG ("Segment considered for further processing, enter into list");
// Transform the original TRT segment into a track
Trk::Track* trtSeg = m_segToTrackTool->segToTrack(*trackTRT);
if(!trtSeg){
// Statistics...
m_nSegFailed++;
ATH_MSG_DEBUG ("Failed to make a track out of the TRT segment!");
continue;
}
// get all TSOS
const DataVector<const Trk::MeasurementBase>* ttsos = trtSeg->measurementsOnTrack();
if((int)ttsos->size()<10) {
// Statistics...
m_nSegFailed++;
ATH_MSG_DEBUG ("Too few ROTs on track, reject !");
delete trtSeg;
continue;
}
// add the track to list
m_segToTrackTool->addNewTrack(trtSeg);
}
}
}
// now resolve tracks
m_finalTracks = m_segToTrackTool->resolveTracks();
// Update the total counters
m_nTrtSegTotal += m_nTrtSeg;
m_nUsedSegTotal += m_nUsedSeg;
m_nRejectedSegTotal += m_nRejectedSeg;
m_nTrtSegGoodTotal += m_nTrtSegGood;
m_nSegFailedTotal += m_nSegFailed;
m_nTrkScoreZeroTotal += m_segToTrackTool->GetnTrkScoreZero();
m_nTrkSegUsedTotal += m_segToTrackTool->GetnTrkSegUsed();
m_nTRTTrkTotal += m_segToTrackTool->GetnTRTTrk();
// store output
ATH_MSG_DEBUG ("Saving tracks in container ");
sc = evtStore()->record(m_finalTracks,m_outtracklocation,false);
if( sc.isFailure() ){
ATH_MSG_WARNING ("Could not save the reconstructed TRT seeded Si tracks!");
}
// Print common event information
if(msgLvl(MSG::DEBUG)) {
m_nprint=1; msg(MSG::DEBUG) << (*this) << endreq;
}
return StatusCode::SUCCESS;
}
///////////////////////////////////////////////////////////////////
// Finalize
///////////////////////////////////////////////////////////////////
StatusCode InDet::TRT_StandaloneTrackFinder::finalize()
{
m_nprint=2; msg(MSG::INFO)<<(*this)<<endreq;
return StatusCode::SUCCESS;
}
///////////////////////////////////////////////////////////////////
// Dumps relevant information into the MsgStream
///////////////////////////////////////////////////////////////////
MsgStream& InDet::TRT_StandaloneTrackFinder::dump( MsgStream& out ) const
{
// out<<std::endl;
if(m_nprint) return dumpevent(out);
return dumptools(out);
}
///////////////////////////////////////////////////////////////////
// Dumps conditions information into the MsgStream
///////////////////////////////////////////////////////////////////
MsgStream& InDet::TRT_StandaloneTrackFinder::dumptools( MsgStream& out ) const
{
int n = 65-m_inseglocation.size();
std::string s3; for(int i=0; i<n; ++i) s3.append(" "); s3.append("|");
n = 65-m_outtracklocation.size();
std::string s4; for(int i=0; i<n; ++i) s4.append(" "); s4.append("|");
out<<std::endl
<<"|----------------------------------------------------------------------"
<<"-------------------|"<<std::endl;
out<<"| Location of input tracks | "<<m_inseglocation <<s3<<std::endl;
out<<"| Location of output tracks | "<<m_outtracklocation <<s4<<std::endl;
out<<"|----------------------------------------------------------------------"
<<"-------------------|";
return out;
}
///////////////////////////////////////////////////////////////////
// Dumps event information into the MsgStream
///////////////////////////////////////////////////////////////////
MsgStream& InDet::TRT_StandaloneTrackFinder::dumpevent( MsgStream& out ) const
{
int nTrtSeg = m_nTrtSeg;
int nUsedSeg = m_nUsedSeg;
int nRejectedSeg = m_nRejectedSeg;
int nTrtSegGood = m_nTrtSegGood;
int nSegFailed = m_nSegFailed;
int nTrkScoreZero = m_segToTrackTool->GetnTrkScoreZero();
int nTrkSegUsed = m_segToTrackTool->GetnTrkSegUsed();
int nTRTTrk = m_segToTrackTool->GetnTRTTrk();
if (m_nprint > 1) {
nTrtSeg = m_nTrtSegTotal;
nUsedSeg = m_nUsedSegTotal;
nRejectedSeg = m_nRejectedSegTotal;
nTrtSegGood = m_nTrtSegGoodTotal;
nSegFailed = m_nSegFailedTotal;
nTrkScoreZero = m_nTrkScoreZeroTotal;
nTrkSegUsed = m_nTrkSegUsedTotal;
nTRTTrk = m_nTRTTrkTotal;
}
out<<std::endl
<<"|-------------------------------------------------------------------|" <<std::endl
<<"| Investigated : " <<std::endl
<<"| "<<std::setw(7)<<nTrtSeg <<" input TRT segments to be investigated" <<std::endl
<<"| "<<std::setw(7)<<nUsedSeg <<" TRT segments excluded at input (by BackTracking tracks)" <<std::endl
<<"| "<<std::setw(7)<<nRejectedSeg <<" segments rejected in selection at input" <<std::endl
<<"|-------------------------------------------------------------------|" <<std::endl
<<"| "<<std::setw(7)<<nTrtSegGood <<" input TRT segments after cuts" <<std::endl
<<"| "<<std::setw(7)<<nSegFailed <<" segments failing to translate to a track (including refit)" <<std::endl
<<"| "<<std::setw(7)<<nTrkScoreZero <<" tracks rejected by score zero" <<std::endl
<<"| "<<std::setw(7)<<nTrkSegUsed <<" excluded segments by other TRT segment" <<std::endl
<<"| "<<std::setw(7)<<nTRTTrk <<" TRT-only tracks on output" <<std::endl
<<"|-------------------------------------------------------------------|";
return out;
}
///////////////////////////////////////////////////////////////////
// Dumps relevant information into the ostream
///////////////////////////////////////////////////////////////////
std::ostream& InDet::TRT_StandaloneTrackFinder::dump( std::ostream& out ) const
{
return out;
}
///////////////////////////////////////////////////////////////////
// Overload of << operator MsgStream
///////////////////////////////////////////////////////////////////
MsgStream& InDet::operator <<