41 , m_trackSumTool(
"Trk::TrackSummaryTool/TrackSummaryTool", this)
43 , m_storeNormalRefittedOnly{
false}
44 , m_storeConstrainedOnly{
true}
46 , m_matchProbability{0.8}
49 , m_trackCollection{
"Tracks"}
50 , m_tracksTruthName{
"TrackTruthCollection"} {
51 declareInterface<Trk::IFillNtupleTool>(
this);
53 declareProperty(
"FileName", m_filename =
"IDAlign.root");
54 declareProperty(
"FilePath", m_filepath =
"./");
55 declareProperty(
"TrackCollection", m_trackCollection);
56 declareProperty(
"TracksTruthName", m_tracksTruthName);
57 declareProperty(
"TrackSummaryTool", m_trackSumTool);
58 declareProperty(
"AlignModuleTool", m_alignModuleTool);
59 declareProperty(
"MatchProbability", m_matchProbability);
60 declareProperty(
"StoreTruth", m_storeTruth);
61 declareProperty(
"MatchProbability", m_matchProbability);
62 declareProperty(
"StoreNormalRefittedOnly", m_storeNormalRefittedOnly);
63 declareProperty(
"StoreConstrainedOnly", m_storeConstrainedOnly);
83 ATH_MSG_FATAL(
"m_alignModuleTool is empty in DetailedIDNtupleTool::initialize()");
84 return StatusCode::FAILURE;
88 return StatusCode::SUCCESS;
97 return StatusCode::SUCCESS;
103 return StatusCode::SUCCESS;
110 const EventContext& ctx = Gaudi::Hive::currentContext();
129 constexpr
double invalidParameterValue{-999.};
130 m_d0 = invalidParameterValue;
131 m_z0 = invalidParameterValue;
132 m_phi0 = invalidParameterValue;
133 m_theta = invalidParameterValue;
135 m_pt = invalidParameterValue;
136 m_eta = invalidParameterValue;
137 constexpr
double invalidChiSq{-1e12};
140 constexpr
int invalidDegreesOfFreedom{-999};
142 m_ndof = invalidDegreesOfFreedom;
143 m_xvtx = invalidParameterValue;
144 m_yvtx = invalidParameterValue;
145 m_zvtx = invalidParameterValue;
200 ATH_MSG_ERROR(
"Could not get Trk::Perigee of the alignTrack");
209 const AmgSymMatrix(5) * locCov = aMeasPer->covariance();
217 std::sqrt((aMeasPer->momentum().x()) * (aMeasPer->momentum().x()) + (aMeasPer->momentum().y()) *
218 (aMeasPer->momentum().y()));
219 m_eta = aMeasPer->eta();
221 m_xvtx = aMeasPer->position().x();
222 m_yvtx = aMeasPer->position().y();
223 m_zvtx = aMeasPer->position().z();
229 if (not fitQual)
ATH_MSG_ERROR(
"No fit quality assigned to the track");
231 if (fitQual->chiSquared() > 0. && fitQual->numberDoF() > 0) {
232 m_chi2 = fitQual->chiSquared();
233 m_ndof = fitQual->numberDoF();
248 ATH_MSG_ERROR(
" Seems the pseudo-measuremnt in the alignTrack not exist!");
249 ATH_MSG_ERROR(
" this pseudo-measurement has been rejected as outlier in the refitting!");
255 ATH_MSG_DEBUG(
" the pseudo-measurement position: " << refPoint);
259 if (!originalMeasPer) {
268 const AmgSymMatrix(5) * locError = originalMeasPer->covariance();
284 if (not originalFitQual)
ATH_MSG_ERROR(
"No fit quality assigned to the track");
286 if (originalFitQual->chiSquared() > 0. && originalFitQual->numberDoF() > 0) {
302 if (!originalPerigeeAtRef) {
304 if (originalTrackPerigee && ((originalTrackPerigee->
associatedSurface())) == persf) {
305 ATH_MSG_DEBUG(
"Perigee of Track is already expressed to given vertex, a copy is returned.");
306 originalPerigeeAtRef = originalTrackPerigee->
clone();
307 }
else ATH_MSG_DEBUG(
"Extrapolation to Perigee failed, NULL pointer is returned.");
310 if (originalPerigeeAtRef) {
311 std::unique_ptr<const Trk::Perigee > originalMeasPerAtRef(originalPerigeeAtRef);
324 ATH_MSG_DEBUG(
"Perigee of AlignTrack is already expressed to given vertex, a copy is returned.");
325 PerigeeAtRef = alignTrackPerigee->
clone();
326 }
else ATH_MSG_DEBUG(
"Extrapolation to Perigee failed, NULL pointer is returned.");
331 std::unique_ptr<const Trk::Perigee > MeasPerAtRef((PerigeeAtRef));
364 " reconstructed tracks from storegate");
366 ATH_MSG_WARNING(
"RecCollection is null pointer in DetailedIDNtupleTool::retrieveTruthInfo");
378 "Track Truth Collection with name " <<
m_tracksTruthName <<
" with size " << TruthMap->size() <<
379 " found in StoreGate");
386 if (measPer ==
nullptr) {
387 ATH_MSG_DEBUG(
"No measured perigee parameters assigned to the track");
397 TrackTruthCollection::const_iterator
found = TruthMap->find(tracklink2);
410 if (genparptr->production_vertex()) {
411 if (genparptr->pdg_id() == 0) {
412 ATH_MSG_INFO(
"PDG ID is zero in DetailedIDNtupleTool::retrieveTruthInfo");
415 if (!generatedTrackPerigee)
ATH_MSG_WARNING(
"Unable to extrapolate genparticle to perigee!");
419 generatedTrackPerigee->parameters()[
Trk::theta]);
430 delete generatedTrackPerigee;
453 aMeasPer = (
i->trackParameters());
458 ATH_MSG_ERROR(
"Could not get Trk::MeasuredPerigee of the alignTrack");
481 m_tree =
new TTree(
"IDAlign",
"Inner Detector Alignment Ntuple");