12#include "GaudiKernel/TypeNameString.h"
13#include "GaudiKernel/SystemOfUnits.h"
25#include "Identifier/Identifier.h"
96 "Track selection will be applied:"
99 <<
"\n pT > " <<
m_selPtMin/Gaudi::Units::GeV <<
" GeV"
109 return StatusCode::SUCCESS;
114 return StatusCode::SUCCESS;
121 auto outputtracks = std::make_unique<ConstDataVector<TrackCollection> >(
SG::VIEW_ELEMENTS ) ;
122 for (
const auto it : *inputtracks){
125 ATH_MSG_DEBUG(
"kinematic requirements not passed, skip track") ;
132 outputtracks->push_back( track ) ;
134 ATH_MSG_DEBUG(
"addTRTMomentumConstraint(.) returned 0 pointer, skip track") ;
146 return StatusCode::SUCCESS;
164 float ptInv = std::abs( mesp->parameters()[
Trk::qOverP] ) / std::sin(
theta ) ;
174 float eta = -std::log( std::tan(
theta/2. ) ) ;
179 float chisqpdof = track.fitQuality()->chiSquared() / track.fitQuality()->numberDoF() ;
181 std::unique_ptr<const Trk::TrackSummary> summary
193 if( isInTransitionRegion ) {
207 <<
"\n\t passed : " <<
rc
208 <<
"\n\t Pt = " << pt
209 <<
"\n\t phi = " << mesp->parameters()[
Trk::phi]
210 <<
"\n\t eta = " <<
eta
220 ATH_MSG_VERBOSE (
"Inside findouterscthit: " << track->trackStateOnSurfaces()->size());
225 tsos->measurementOnTrack() &&
226 tsos->trackParameters() ) {
232 double r = std::sqrt(pos.x()*pos.x() + pos.y()*pos.y()) ;
233 if(
rc==
nullptr ||
r>rmax) {
240 ATH_MSG_VERBOSE (
"Returning surface with adress: " <<
rc <<
" at radius " << rmax);
245 ATH_MSG_VERBOSE (
"Inside findinnerscthit: " << track->trackStateOnSurfaces()->size() );
246 double rmin=9999999. ;
250 tsos->measurementOnTrack() &&
251 tsos->trackParameters() ) {
257 double r = sqrt(pos.x()*pos.x() + pos.y()*pos.y()) ;
258 if(
rc==
nullptr ||
r<rmin) {
265 ATH_MSG_VERBOSE (
"Returning surface with adress: " <<
rc <<
" at radius " << rmin );
272 std::array<Trk::DefinedParameter, 2> defPar = {z0,
theta};
273 if( !mp->covariance() )
return nullptr;
294 if( !mpSi->covariance() || !mpTRT->covariance() )
return nullptr;
300 std::array<Trk::DefinedParameter, 3> parFromTRT_vec = {z0TRT, thetaTRT,
331 sortedMS.push_back( pm ) ;
332 for(
int i=0, i_max=ms.size() ; i!=i_max ; ++i ) {
333 sortedMS.push_back( ms[i] ) ;
342 for (
const auto it:*(track->measurementsOnTrack())){
347 setSi.push_back ( it ) ;
350 setTRT.push_back ( it ) ;
354 ATH_MSG_DEBUG(
"TRTMomConstr() : Found " << setSi.size() <<
" Si measurm's!" ) ;
355 ATH_MSG_DEBUG(
"TRTMomConstr() : Found " << setTRT.size() <<
" TRT measurm's!") ;
357 ATH_MSG_DEBUG(
"TRTMomConstr() : fewer TRT measurements than required: "
366 const Trk::Perigee* perTrk = track->perigeeParameters();
375 ATH_MSG_ERROR(
"TRTMomConstr() : PseudoMeasurementOnTrack creation failed! " );
382 for(
int i=0, i_max=setTRTPM.size() ; i!=i_max ; ++i ) {
390 Gaudi::Hive::currentContext(), setTRTPM, *perTrk,
true,
Trk::pion
395 ATH_MSG_DEBUG(
"TRTMomConstr() : Fit of TRT part of the track failed! ");
402 / std::sin( perTRT->parameters()[
Trk::theta] ) ;
408 ATH_MSG_ERROR(
"TRTMomConstr() : PseudoMeasurementOnTrack creation failed! " );
411 ATH_MSG_DEBUG(
"TRTMomConstr() : pmFromTRT " << *pmFromTRT ) ;
417 ->fit(Gaudi::Hive::currentContext(), setSiPM, *perTrk,
true,
Trk::pion
422 ATH_MSG_DEBUG(
"TRTMomConstr() : Si+TRT-p_T Track fit failed !" ) ;
426 ATH_MSG_DEBUG(
"TRTMomConstr() : Si+PM(TRT) track parameteres @ perigee: " << *perSi ) ;
433 return alg.dump( outst ) ;
437 outst <<
"\n|-------------------------------------------------------------------";
438 outst <<
"-----------------------------|\n" ;
439 outst <<
"| processed : "
442 outst <<
"| accepted by track presel. : "
445 outst <<
"| accepted by track presel. + PM : "
448 outst <<
"| ------------------------------------------------------------------";
449 outst <<
"---------------------------- |\n" ;
450 outst <<
"| reject by # PIX hits : "
453 outst <<
"| reject by # SCT hits : "
456 outst <<
"| reject by # TRT hits : "
459 outst <<
"| ------------------------------------------------------------------";
460 outst <<
"---------------------------- |\n" ;
461 outst <<
"| reject by exist. PM(TRT) : "
465 outst <<
"|-------------------------------------------------------------------";
466 outst <<
"-----------------------------|\n" ;
MsgStream & operator<<(MsgStream &outst, const AddTRTMomConstr &alg)
Scalar eta() const
pseudorapidity method
Scalar theta() const
theta method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
DataVector adapter that acts like it holds const pointers.
#define AmgSymMatrix(dim)
This is an Identifier helper class for the TRT subdetector.
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
size_t m_nRejectPM
Counter for number of tracks failing the addition of a pseudo-measurement (PM)
Trk::Track * addTRTMomentumConstraint(const Trk::Track *track)
Strips of all TRT hits from the track and replaces them with a TRT momentum constraint from a the TRT...
std::string m_trackListInput
Name of the TrackCollection (input)
double m_selPtMin
minimal pT cut value for the TrackSelection
bool m_useThetaCorrection
correct theta after TRT+PM(z0,theta) refit, small diff.
StatusCode finalize()
finalize method of this algorithm.
size_t m_nRejectSCT
Counter for number of tracks failing the min number of SCT hits req.
size_t m_nTracksProcessed
Counter for number of tracks processed.
const Trk::TrackStateOnSurface * findouterscthit(const Trk::Track *track)
Returns the outermost SCT TSOS on the given Track.
double m_selEtaCrackMax
maximum |eta| to define the transition region
const Trk::PseudoMeasurementOnTrack * createPMfromSi(const Trk::Perigee *mp)
creates a PseudoMeasurement with (z0, theta) from extended track perigee parameters
bool accept(const Trk::Track &track)
Verifies if the given track passes the track selection criteria specified via the jobOptions.
MsgStream & dump(MsgStream &outst) const
size_t m_nTracksAccepted
Counter for number of tracks passing the preselection and with PM.
std::string m_trackListOutput
Name of the TrackCollection (Output)
ToolHandle< Trk::ITrackFitter > m_trackFitter
The TrackFitter to refit the tracks (segment, momentum constraint)
AddTRTMomConstr(const std::string &name, ISvcLocator *pSvcLocator)
The AddTRTMomConstr is an implementation to add the so-called TRT momentum constraint on a track.
int m_selNHitPIXMin
minimal number of PIX hits cut value for the TrackSelection
const TRT_ID * m_trtid
Identifier helper class for the TRT.
double m_selEtaMax
maximal eta cut value for the TrackSelection
int m_selNHitTRTMinCrack
minimal number of TRT hits cut value in trans.
double m_selEtaMin
minimal eta cut value for the TrackSelection
StatusCode execute()
execute method of this algorithm that is called for each event
int m_selNHitSCTMin
minimal number of SCT hits cut value for the TrackSelection
ToolHandle< Trk::ITrackSummaryTool > m_trackSummaryTool
The summary tool to make the track selection.
double m_selEtaCrackMin
minimum |eta| to define the transition region
int m_selNHitTRTMin
minimal number of TRT hits cut value for the TrackSelection
const Trk::PseudoMeasurementOnTrack * createPMfromTRT(const Trk::Perigee *mpSi, const Trk::Perigee *mpTRT)
creates a PseudoMeasurement with (z0, theta, q/p) from TRT track perigee parameters
double m_selChiSqPerDOFMin
maximal Chisquare per degree of freedom cut value for the TrackSelection
StatusCode initialize()
initialize method of this algorithm.
size_t m_nTracksPresel
Counter for number of tracks passing the preselection.
double m_thetaCorr
theta can be different after TRT+PM fit by < o(10e-4).
bool m_applyTrkSel
apply a selection on tracks or not
size_t m_nRejectTRT
Counter for number of tracks failing the min number of TRT hits req.
size_t m_nRejectPIX
Counter for number of tracks failing the min number of PIX hits req.
const Trk::TrackStateOnSurface * findinnertrthit(const Trk::Track *track)
Returns the innermost TRT TSOS on the given Track.
const AtlasDetectorID * m_idHelper
Detector ID helper.
const Trk::MeasurementSet addPM(Trk::MeasurementSet &ms, const Trk::PseudoMeasurementOnTrack *pm)
adds a PseudoMeasurement to a MeasurementSet
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
const ServiceHandle< StoreGateSvc > & detStore() const
size_type size() const noexcept
Returns the number of elements in the collection.
Specific class to represent the SCT measurements.
virtual const Amg::Vector3D & globalPosition() const override
returns global position (gathered through Surface constraint)
Represents 'corrected' measurements from the TRT (for example, corrected for wire sag).
virtual const Amg::Vector3D & globalPosition() const override final
return the global position of this RIO_OnTrack
virtual const S & associatedSurface() const override final
Access to the Surface method.
Class to handle pseudo-measurements in fitters and on track objects.
Class to handle RIO On Tracks ROT) for InDet and Muons, it inherits from the common MeasurementBase.
Identifier identify() const
return the identifier -extends MeasurementBase
Abstract Base Class for tracking surfaces.
represents the track state (measurement, material, fit parameters and quality) at a surface.
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
const Perigee * perigeeParameters() const
return Perigee.
Eigen::Matrix< double, 3, 1 > Vector3D
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
std::vector< const MeasurementBase * > MeasurementSet
vector of fittable measurements
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
std::pair< double, ParamDefs > DefinedParameter
Typedef to of a std::pair<double, ParamDefs> to identify a passed-through double as a specific type o...
@ numberOfSCTHits
number of SCT holes
@ numberOfPixelHits
number of pixel layers on track with absence of hits
@ numberOfTRTHits
number of TRT outliers
hold the test vectors and ease the comparison