ATLAS Offline Software
Loading...
Searching...
No Matches
InDetAlignment::RefitSiOnlyTool Class Reference

#include <RefitSiOnlyTool.h>

Inheritance diagram for InDetAlignment::RefitSiOnlyTool:
Collaboration diagram for InDetAlignment::RefitSiOnlyTool:

Public Member Functions

virtual ~RefitSiOnlyTool ()
virtual StatusCode initialize ()
 Athena Tool methods.
virtual StatusCode finalize ()
 Athena Tool methods.
virtual StatusCode configure ()
 does necessary configuration to the tool
virtual const DataVector< Trk::Track > * processTrackCollection (const DataVector< Trk::Track > *trks)
 main processing of track collection - refits a track using only filtered hits (e.g.
void dumpTrackCol (DataVector< Trk::Track > *tracks)

Public Attributes

const AtlasDetectorID * m_idHelper {}

Private Member Functions

Trk::Track * refit (const Trk::Track *tr) const
 refits a track not using non-silicon hits
bool filterHit (const Identifier &id) const
 determines from flags, if this hit should be included in the fit or not

Private Attributes

PublicToolHandle< Trk::ITrackFitter > m_ITrkFitter {this, "FitterTool", "Trk::KalmanFitter"}
Trk::TrkParametersComparisonFunction * m_comPar {nullptr}
Gaudi::Property< bool > m_doCosmic {this, "Cosmic", false}
 Flag for cosmics.
Gaudi::Property< bool > m_OutlierRemoval {this, "OutlierRemoval", true}
 flag for outlier removal
Gaudi::Property< bool > m_stripSCTHits {this, "StripSCTHits", false}
 flag to not consider SCT hits in the refit
Gaudi::Property< bool > m_stripPixelHits {this, "StripPixelHits", false}
 flag to not consider Pixel hits in the refit
Gaudi::Property< bool > m_stripTRTHits {this, "StripTRTHits", true}
 flag to not consider TRT hits in the refit
Gaudi::Property< int > m_ParticleNumber {this, "ParticleNumber", 2}
Trk::ParticleHypothesis m_ParticleHypothesis {Trk::nonInteracting}
int m_trkindex {}

Detailed Description

Definition at line 35 of file RefitSiOnlyTool.h.

Constructor & Destructor Documentation

◆ ~RefitSiOnlyTool()

InDetAlignment::RefitSiOnlyTool::~RefitSiOnlyTool ( )
virtual

Definition at line 40 of file RefitSiOnlyTool.cxx.

40{}

Member Function Documentation

◆ configure()

StatusCode InDetAlignment::RefitSiOnlyTool::configure ( )
virtual

does necessary configuration to the tool

Definition at line 82 of file RefitSiOnlyTool.cxx.

83 {
84 ATH_MSG_DEBUG( "nothing to configure - everything has already been configured in initialize()" );
85 return StatusCode::SUCCESS;
86 }
#define ATH_MSG_DEBUG(x,...)

◆ dumpTrackCol()

void InDetAlignment::RefitSiOnlyTool::dumpTrackCol ( DataVector< Trk::Track > * tracks)

Definition at line 211 of file RefitSiOnlyTool.cxx.

211 {
212 ATH_MSG_DEBUG( "In dumpTrackCol() with size=" << tracks->size() );
213
214 int itrk = 0;
216 it!=tracks->end();++it) {
217
218 if(*it!=nullptr){
219
220 const Trk::Perigee* aMeasPer = (*it)->perigeeParameters();
221 if (aMeasPer==nullptr){
222 ATH_MSG_ERROR( "Could not get Trk::MeasuredPerigee" );}
223 else {
224 double d0 = aMeasPer->parameters()[Trk::d0];
225 double z0 = aMeasPer->parameters()[Trk::z0];
226 double phi0 = aMeasPer->parameters()[Trk::phi0];
227 double theta = aMeasPer->parameters()[Trk::theta];
228 double qOverP = aMeasPer->parameters()[Trk::qOverP];
229 if (msgLvl(MSG::DEBUG)) {
230 msg(MSG::DEBUG) << itrk << ". Track Parameters (d0,z0,phi0,theta,qOverP)" << endmsg;
231 msg(MSG::DEBUG) << " " << d0 << ", " << z0 << ", "
232 << phi0 << ", " << theta << ", " << qOverP << endmsg;
233 msg(MSG::DEBUG) << " - momentum: "
234 << aMeasPer->momentum().mag() / CLHEP::GeV << " CLHEP::GeV/c" << endmsg;
235 }
236 }
237 }
238 itrk++;
239 }
240 }
Scalar theta() const
theta method
#define endmsg
#define ATH_MSG_ERROR(x,...)
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
Definition DataVector.h:861
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
const Amg::Vector3D & momentum() const
Access method for the momentum.
@ qOverP
perigee
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
@ phi0
Definition ParamDefs.h:65
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
@ d0
Definition ParamDefs.h:63
@ z0
Definition ParamDefs.h:64
MsgStream & msg
Definition testRead.cxx:32

◆ filterHit()

bool InDetAlignment::RefitSiOnlyTool::filterHit ( const Identifier & id) const
private

determines from flags, if this hit should be included in the fit or not

Definition at line 201 of file RefitSiOnlyTool.cxx.

202 {
203 if (m_idHelper->is_sct(id) && m_stripSCTHits) {return true;}
204 else if (m_idHelper->is_pixel(id) && m_stripPixelHits) {return true;}
205 else if (m_idHelper->is_trt(id) && m_stripTRTHits) {return true;}
206 else {return false;}
207 }
Gaudi::Property< bool > m_stripSCTHits
flag to not consider SCT hits in the refit
Gaudi::Property< bool > m_stripTRTHits
flag to not consider TRT hits in the refit
Gaudi::Property< bool > m_stripPixelHits
flag to not consider Pixel hits in the refit
const AtlasDetectorID * m_idHelper

◆ finalize()

StatusCode InDetAlignment::RefitSiOnlyTool::finalize ( )
virtual

Athena Tool methods.

Definition at line 76 of file RefitSiOnlyTool.cxx.

77 {
78 ATH_MSG_DEBUG("Finalize() of RefitSiOnlyTool" );
79 return StatusCode::SUCCESS;
80 }

◆ initialize()

StatusCode InDetAlignment::RefitSiOnlyTool::initialize ( )
virtual

Athena Tool methods.

Definition at line 43 of file RefitSiOnlyTool.cxx.

44 {
46 ATH_MSG_DEBUG( "Initialize() of RefitSiOnlyTool" );
47
48 // make for cosmic tracks new reference point
49 Amg::Vector3D refGP(0.,15000.,0.);
51
52 //ID Helper
53 ATH_CHECK (detStore()->retrieve(m_idHelper,"AtlasID"));
54
55 //Fitter
56 ATH_CHECK(m_ITrkFitter.retrieve());
57
65
66 if (msgLvl(MSG::DEBUG)) {
67 msg(MSG::DEBUG) << "ParticleNumber: " << m_ParticleNumber.value() << endmsg;
68 msg(MSG::DEBUG) << "ParticleHypothesis: " << m_ParticleHypothesis << endmsg;
69 msg(MSG::DEBUG) << "Initialize() of RefitSiOnlyTool successful" << endmsg;
70 }
71
72 return StatusCode::SUCCESS;
73 }
#define ATH_CHECK
Evaluate an expression and check for errors.
static Double_t sc
Trk::TrkParametersComparisonFunction * m_comPar
PublicToolHandle< Trk::ITrackFitter > m_ITrkFitter
Trk::ParticleHypothesis m_ParticleHypothesis
Gaudi::Property< int > m_ParticleNumber
Eigen::Matrix< double, 3, 1 > Vector3D
::StatusCode StatusCode
StatusCode definition for legacy code.
ComparisonFunction< TrackParameters > TrkParametersComparisonFunction

◆ processTrackCollection()

const DataVector< Trk::Track > * InDetAlignment::RefitSiOnlyTool::processTrackCollection ( const DataVector< Trk::Track > * trks)
virtual

main processing of track collection - refits a track using only filtered hits (e.g.

only silicon hits)

Definition at line 88 of file RefitSiOnlyTool.cxx.

88 {
89 ATH_MSG_DEBUG( "processTrackCollection() of RefitSiOnlyTool" );
90
91 m_trkindex=0;
92 DataVector<Trk::Track>* newTrks = new DataVector<Trk::Track>;
93
94 for (DataVector<Trk::Track>::const_iterator t=trks->begin(); t!=trks->end();++t) {
95 if (*t) {
96 Trk::Track* refittedTrack = refit(*t);
97
98 if (refittedTrack==nullptr)
99 ATH_MSG_DEBUG( " Refit of the track " << m_trkindex << " did not work. Track skipped." );
100
101 newTrks->push_back(refittedTrack);
102 } else {
103 newTrks->push_back(nullptr);
104 ATH_MSG_DEBUG( " Track " << m_trkindex << " is empty." );
105 }
106
107 m_trkindex++;
108 }
109
110 if (msgLvl(MSG::DEBUG)) {
111 dumpTrackCol(newTrks);
112 }
113
114 return newTrks;
115 }
value_type push_back(value_type pElem)
Add an element to the end of the collection.
Trk::Track * refit(const Trk::Track *tr) const
refits a track not using non-silicon hits
void dumpTrackCol(DataVector< Trk::Track > *tracks)

◆ refit()

Trk::Track * InDetAlignment::RefitSiOnlyTool::refit ( const Trk::Track * tr) const
private

refits a track not using non-silicon hits

containsGangedPixels

Definition at line 118 of file RefitSiOnlyTool.cxx.

118 {
119 // Step through all hits on a Trk::Track, pushback SiliconHits into RIO_Collection
120 // and Refit Track with SiliconHits
121 ATH_MSG_DEBUG( "Entering RefitSiOnlyTool::refit() for track #" << m_trkindex );
122
123 const Trk::Perigee* initialPerigee = tr->perigeeParameters();
124 if (initialPerigee) {
125 ATH_MSG_DEBUG( "Track # " << m_trkindex << " has momentum before refit: "
126 << initialPerigee->momentum().mag() / CLHEP::GeV << " CLHEP::GeV/c" );
127 }
128 else { ATH_MSG_WARNING( "Track # " << m_trkindex << " without perigee" ); }
129
130 Trk::Track* SiOnlyTrack = nullptr;
131 bool containsGangedPixels = false;
132 std::vector<const Trk::MeasurementBase*> MeasurementBase_Collection;
133
134 ATH_MSG_DEBUG( "Building stripped RIO_Collection" );
136 measBase !=tr->measurementsOnTrack()->end(); ++measBase) {
137
138 const Trk::RIO_OnTrack* rio = dynamic_cast <const Trk::RIO_OnTrack*>(*measBase);
139 if (rio != nullptr) {
140 const Identifier& surfaceID = (rio->identify());
141 if(filterHit(surfaceID)==false) {
142 MeasurementBase_Collection.push_back(*measBase);
143
144 // protect against ganged Pixel Hits
145 if (rio->prepRawData()) {
146 const InDet::SiCluster* siHit = dynamic_cast <const InDet::SiCluster*>(rio->prepRawData());
147 if (siHit) {
148 if (siHit->gangedPixel()) {
149 containsGangedPixels = true;
150 ATH_MSG_DEBUG( " Reject track # " << m_trkindex
151 << " because it contains ganged pixel hits" );
152 }
153 }
154 }
155
156 }
157 }
158 }
159
160 // Do Silicon only Refit with Silicon only HitCollection and TrackParameters
161 // at StartingPoint of track
162 if (!containsGangedPixels) {
163 if (m_doCosmic) {
164 ATH_MSG_DEBUG("Refitting using Cosmic reference point");
165
166 // order the parameters according to the Cosmics reference points
167 // works only for Si, not for TRT!
168 const Trk::TrackParameters* minPar =
169 *(std::min_element(tr->trackParameters()->begin(),
170 tr->trackParameters()->end(),
171 *m_comPar));
172
173 SiOnlyTrack = m_ITrkFitter
174 ->fit(Gaudi::Hive::currentContext(),
175 MeasurementBase_Collection,
176 *minPar,
179 .release();
180 } // m_doCosmic
181 else {
182 SiOnlyTrack = m_ITrkFitter
183 ->fit(Gaudi::Hive::currentContext(),
184 MeasurementBase_Collection,
185 *(tr->trackParameters()->front()),
188 .release();
189 }
190 }
191 else {
192 ATH_MSG_DEBUG(" No refit was done for track # " << m_trkindex);
193 return nullptr;
194 }
195
196 return SiOnlyTrack;
197 }
#define ATH_MSG_WARNING(x,...)
Gaudi::Property< bool > m_OutlierRemoval
flag for outlier removal
Gaudi::Property< bool > m_doCosmic
Flag for cosmics.
bool filterHit(const Identifier &id) const
determines from flags, if this hit should be included in the fit or not
bool gangedPixel() const
return the flag of this cluster containing a gangedPixel
virtual const Trk::PrepRawData * prepRawData() const =0
returns the PrepRawData (also known as RIO) object to which this RIO_OnTrack is associated.
Identifier identify() const
return the identifier -extends MeasurementBase
const DataVector< const MeasurementBase > * measurementsOnTrack() const
return a pointer to a vector of MeasurementBase (NOT including any that come from outliers).
const DataVector< const TrackParameters > * trackParameters() const
Return a pointer to a vector of TrackParameters.
const Perigee * perigeeParameters() const
return Perigee.
ParametersBase< TrackParametersDim, Charged > TrackParameters

Member Data Documentation

◆ m_comPar

Trk::TrkParametersComparisonFunction* InDetAlignment::RefitSiOnlyTool::m_comPar {nullptr}
private

Definition at line 63 of file RefitSiOnlyTool.h.

63{nullptr};

◆ m_doCosmic

Gaudi::Property<bool> InDetAlignment::RefitSiOnlyTool::m_doCosmic {this, "Cosmic", false}
private

Flag for cosmics.

Definition at line 65 of file RefitSiOnlyTool.h.

65{this, "Cosmic", false};

◆ m_idHelper

const AtlasDetectorID* InDetAlignment::RefitSiOnlyTool::m_idHelper {}

Definition at line 49 of file RefitSiOnlyTool.h.

49{};

◆ m_ITrkFitter

PublicToolHandle<Trk::ITrackFitter> InDetAlignment::RefitSiOnlyTool::m_ITrkFitter {this, "FitterTool", "Trk::KalmanFitter"}
private

Definition at line 61 of file RefitSiOnlyTool.h.

61{this, "FitterTool", "Trk::KalmanFitter"};

◆ m_OutlierRemoval

Gaudi::Property<bool> InDetAlignment::RefitSiOnlyTool::m_OutlierRemoval {this, "OutlierRemoval", true}
private

flag for outlier removal

Definition at line 66 of file RefitSiOnlyTool.h.

66{this, "OutlierRemoval", true};

◆ m_ParticleHypothesis

Trk::ParticleHypothesis InDetAlignment::RefitSiOnlyTool::m_ParticleHypothesis {Trk::nonInteracting}
private

Definition at line 73 of file RefitSiOnlyTool.h.

◆ m_ParticleNumber

Gaudi::Property<int> InDetAlignment::RefitSiOnlyTool::m_ParticleNumber {this, "ParticleNumber", 2}
private

Definition at line 72 of file RefitSiOnlyTool.h.

72{this, "ParticleNumber", 2};

◆ m_stripPixelHits

Gaudi::Property<bool> InDetAlignment::RefitSiOnlyTool::m_stripPixelHits {this, "StripPixelHits", false}
private

flag to not consider Pixel hits in the refit

Definition at line 69 of file RefitSiOnlyTool.h.

69{this, "StripPixelHits", false};

◆ m_stripSCTHits

Gaudi::Property<bool> InDetAlignment::RefitSiOnlyTool::m_stripSCTHits {this, "StripSCTHits", false}
private

flag to not consider SCT hits in the refit

Definition at line 68 of file RefitSiOnlyTool.h.

68{this, "StripSCTHits", false};

◆ m_stripTRTHits

Gaudi::Property<bool> InDetAlignment::RefitSiOnlyTool::m_stripTRTHits {this, "StripTRTHits", true}
private

flag to not consider TRT hits in the refit

Definition at line 70 of file RefitSiOnlyTool.h.

70{this, "StripTRTHits", true};

◆ m_trkindex

int InDetAlignment::RefitSiOnlyTool::m_trkindex {}
private

Definition at line 74 of file RefitSiOnlyTool.h.

74{};

The documentation for this class was generated from the following files: