40 , m_trackSumTool(
"Trk::TrackSummaryTool/TrackSummaryTool", this)
42 , m_storeNormalRefittedOnly{
false}
43 , m_storeConstrainedOnly{
true}
45 , m_matchProbability{0.8}
48 , m_trackCollection{
"Tracks"}
49 , m_tracksTruthName{
"TrackTruthCollection"} {
50 declareInterface<Trk::IFillNtupleTool>(
this);
52 declareProperty(
"FileName", m_filename =
"IDAlign.root");
53 declareProperty(
"FilePath", m_filepath =
"./");
54 declareProperty(
"TrackCollection", m_trackCollection);
55 declareProperty(
"TracksTruthName", m_tracksTruthName);
56 declareProperty(
"TrackSummaryTool", m_trackSumTool);
57 declareProperty(
"AlignModuleTool", m_alignModuleTool);
58 declareProperty(
"MatchProbability", m_matchProbability);
59 declareProperty(
"StoreTruth", m_storeTruth);
60 declareProperty(
"MatchProbability", m_matchProbability);
61 declareProperty(
"StoreNormalRefittedOnly", m_storeNormalRefittedOnly);
62 declareProperty(
"StoreConstrainedOnly", m_storeConstrainedOnly);
82 ATH_MSG_FATAL(
"m_alignModuleTool is empty in DetailedIDNtupleTool::initialize()");
83 return StatusCode::FAILURE;
87 return StatusCode::SUCCESS;
96 return StatusCode::SUCCESS;
102 return StatusCode::SUCCESS;
109 const EventContext& ctx = Gaudi::Hive::currentContext();
128 constexpr
double invalidParameterValue{-999.};
129 m_d0 = invalidParameterValue;
130 m_z0 = invalidParameterValue;
131 m_phi0 = invalidParameterValue;
132 m_theta = invalidParameterValue;
134 m_pt = invalidParameterValue;
135 m_eta = invalidParameterValue;
136 constexpr
double invalidChiSq{-1e12};
139 constexpr
int invalidDegreesOfFreedom{-999};
141 m_ndof = invalidDegreesOfFreedom;
142 m_xvtx = invalidParameterValue;
143 m_yvtx = invalidParameterValue;
144 m_zvtx = invalidParameterValue;
199 ATH_MSG_ERROR(
"Could not get Trk::Perigee of the alignTrack");
208 const AmgSymMatrix(5) * locCov = aMeasPer->covariance();
216 std::sqrt((aMeasPer->momentum().x()) * (aMeasPer->momentum().x()) + (aMeasPer->momentum().y()) *
217 (aMeasPer->momentum().y()));
218 m_eta = aMeasPer->eta();
220 m_xvtx = aMeasPer->position().x();
221 m_yvtx = aMeasPer->position().y();
222 m_zvtx = aMeasPer->position().z();
228 if (not fitQual)
ATH_MSG_ERROR(
"No fit quality assigned to the track");
230 if (fitQual->chiSquared() > 0. && fitQual->numberDoF() > 0) {
231 m_chi2 = fitQual->chiSquared();
232 m_ndof = fitQual->numberDoF();
247 ATH_MSG_ERROR(
" Seems the pseudo-measuremnt in the alignTrack not exist!");
248 ATH_MSG_ERROR(
" this pseudo-measurement has been rejected as outlier in the refitting!");
254 ATH_MSG_DEBUG(
" the pseudo-measurement position: " << refPoint);
258 if (!originalMeasPer) {
267 const AmgSymMatrix(5) * locError = originalMeasPer->covariance();
283 if (not originalFitQual)
ATH_MSG_ERROR(
"No fit quality assigned to the track");
285 if (originalFitQual->chiSquared() > 0. && originalFitQual->numberDoF() > 0) {
301 if (!originalPerigeeAtRef) {
303 if (originalTrackPerigee && ((originalTrackPerigee->
associatedSurface())) == persf) {
304 ATH_MSG_DEBUG(
"Perigee of Track is already expressed to given vertex, a copy is returned.");
305 originalPerigeeAtRef = originalTrackPerigee->
clone();
306 }
else ATH_MSG_DEBUG(
"Extrapolation to Perigee failed, NULL pointer is returned.");
309 if (originalPerigeeAtRef) {
310 std::unique_ptr<const Trk::Perigee > originalMeasPerAtRef(originalPerigeeAtRef);
323 ATH_MSG_DEBUG(
"Perigee of AlignTrack is already expressed to given vertex, a copy is returned.");
324 PerigeeAtRef = alignTrackPerigee->
clone();
325 }
else ATH_MSG_DEBUG(
"Extrapolation to Perigee failed, NULL pointer is returned.");
330 std::unique_ptr<const Trk::Perigee > MeasPerAtRef((PerigeeAtRef));
363 " reconstructed tracks from storegate");
365 ATH_MSG_WARNING(
"RecCollection is null pointer in DetailedIDNtupleTool::retrieveTruthInfo");
377 "Track Truth Collection with name " <<
m_tracksTruthName <<
" with size " << TruthMap->size() <<
378 " found in StoreGate");
385 if (measPer ==
nullptr) {
386 ATH_MSG_DEBUG(
"No measured perigee parameters assigned to the track");
395 TrackTruthCollection::const_iterator
found = TruthMap->find(tracklink2);
408 if (genparptr->production_vertex()) {
409 if (genparptr->pdg_id() == 0) {
410 ATH_MSG_INFO(
"PDG ID is zero in DetailedIDNtupleTool::retrieveTruthInfo");
413 if (!generatedTrackPerigee)
ATH_MSG_WARNING(
"Unable to extrapolate genparticle to perigee!");
417 generatedTrackPerigee->parameters()[
Trk::theta]);
428 delete generatedTrackPerigee;
450 aMeasPer = (
i->trackParameters());
455 ATH_MSG_ERROR(
"Could not get Trk::MeasuredPerigee of the alignTrack");
478 m_tree =
new TTree(
"IDAlign",
"Inner Detector Alignment Ntuple");