|
15 | 15 | #include "Field/MagFieldFast.h" |
16 | 16 | #include "ITSBase/GeometryTGeo.h" |
17 | 17 |
|
18 | | -#include "SimulationDataFormat/MCTruthContainer.h" |
19 | | - |
20 | 18 | #include "DetectorsBase/Propagator.h" |
21 | 19 | #include "CommonUtils/TreeStream.h" |
22 | 20 |
|
|
35 | 33 | #include <TFile.h> |
36 | 34 | #include <TGeoGlobalMagField.h> |
37 | 35 | #include "DataFormatsParameters/GRPObject.h" |
38 | | - |
| 36 | +#include "SimulationDataFormat/MCTruthContainer.h" |
39 | 37 | #include "GlobalTracking/MatchTPCITS.h" |
40 | 38 |
|
41 | 39 | using namespace o2::globaltracking; |
@@ -131,9 +129,15 @@ void MatchTPCITS::init() |
131 | 129 |
|
132 | 130 | // create output branch |
133 | 131 | if (mOutputTree) { |
| 132 | + LOG(INFO) << "ITS-TPC Matching results will be stored in the tree " << mOutputTree->GetName(); |
134 | 133 | mOutputTree->Branch(mOutTPCITSTracksBranchName.data(), &mMatchedTracks); |
135 | | - LOG(INFO) << "Matched tracks will be stored in " << mOutTPCITSTracksBranchName << " branch of tree " |
136 | | - << mOutputTree->GetName() << FairLogger::endl; |
| 134 | + LOG(INFO) << "Matched tracks branch: " << mOutTPCITSTracksBranchName; |
| 135 | + if (mMCTruthON) { |
| 136 | + mOutputTree->Branch(mOutTPCMCTruthBranchName.data(), &mOutITSLabels); |
| 137 | + LOG(INFO) << "ITS Tracks Labels branch: " << mOutITSMCTruthBranchName; |
| 138 | + mOutputTree->Branch(mOutITSMCTruthBranchName.data(), &mOutTPCLabels); |
| 139 | + LOG(INFO) << "TPC Tracks Labels branch: " << mOutTPCMCTruthBranchName; |
| 140 | + } |
137 | 141 | } else { |
138 | 142 | LOG(ERROR) << "Output tree is not attached, matched tracks will not be stored" << FairLogger::endl; |
139 | 143 | } |
@@ -1068,39 +1072,48 @@ void MatchTPCITS::refitWinners() |
1068 | 1072 | mWinnerChi2Refit.resize(mITSWork.size(), -1.f); |
1069 | 1073 | mCurrITSTracksTreeEntry = -1; |
1070 | 1074 | mCurrITSClustersTreeEntry = -1; |
1071 | | - for (int i = 0; i < mITSWork.size(); i++) { |
1072 | | - const auto& its = mITSWork[i]; |
1073 | | - if (!refitTrackITSTPC(its)) { |
| 1075 | + for (int iITS = 0; iITS < mITSWork.size(); iITS++) { |
| 1076 | + if (!refitTrackITSTPC(iITS)) { |
1074 | 1077 | continue; |
1075 | 1078 | } |
1076 | | - mWinnerChi2Refit[i] = mMatchedTracks.back().getChi2Refit(); |
| 1079 | + mWinnerChi2Refit[iITS] = mMatchedTracks.back().getChi2Refit(); |
1077 | 1080 | if (mMatchedTracks.size() == mMaxOutputTracksPerEntry) { |
1078 | 1081 | if (mOutputTree) { |
1079 | 1082 | mTimerRefit.Stop(); |
1080 | 1083 | mOutputTree->Fill(); |
1081 | 1084 | mTimerRefit.Start(false); |
1082 | 1085 | } |
1083 | 1086 | mMatchedTracks.clear(); |
| 1087 | + if (mMCTruthON) { |
| 1088 | + mOutITSLabels.clear(); |
| 1089 | + mOutTPCLabels.clear(); |
| 1090 | + } |
1084 | 1091 | } |
1085 | 1092 | } |
1086 | 1093 | // flush last tracks |
1087 | 1094 | if (mMatchedTracks.size() && mOutputTree) { |
1088 | 1095 | mOutputTree->Fill(); |
1089 | 1096 | } |
1090 | 1097 | mMatchedTracks.clear(); |
| 1098 | + if (mMCTruthON) { |
| 1099 | + mOutITSLabels.clear(); |
| 1100 | + mOutTPCLabels.clear(); |
| 1101 | + } |
1091 | 1102 | mTimerRefit.Stop(); |
1092 | 1103 | } |
1093 | 1104 |
|
1094 | 1105 | //______________________________________________ |
1095 | | -bool MatchTPCITS::refitTrackITSTPC(const TrackLocITS& tITS) |
| 1106 | +bool MatchTPCITS::refitTrackITSTPC(int iITS) |
1096 | 1107 | { |
1097 | 1108 | ///< refit in inward direction the pair of TPC and ITS tracks |
| 1109 | + const auto& tITS = mITSWork[iITS]; |
1098 | 1110 | if (tITS.matchID < 0 || isDisabledITS(mMatchesITS[tITS.matchID])) { |
1099 | 1111 | return false; // no match |
1100 | 1112 | } |
1101 | 1113 | const auto& itsMatch = mMatchesITS[tITS.matchID]; |
1102 | 1114 | const auto& itsMatchRec = mMatchRecordsITS[itsMatch.first]; |
1103 | | - const auto& tTPC = mTPCWork[mTPCMatch2Track[itsMatchRec.matchID]]; |
| 1115 | + int iTPC = mTPCMatch2Track[itsMatchRec.matchID]; |
| 1116 | + const auto& tTPC = mTPCWork[iTPC]; |
1104 | 1117 |
|
1105 | 1118 | loadITSClustersChunk(tITS.source.getEvent()); |
1106 | 1119 | loadITSTracksChunk(tITS.source.getEvent()); |
@@ -1162,6 +1175,12 @@ bool MatchTPCITS::refitTrackITSTPC(const TrackLocITS& tITS) |
1162 | 1175 | trfit.setTimeMUS(time, timeErr); |
1163 | 1176 | trfit.setRefTPC(tTPC.source); |
1164 | 1177 | trfit.setRefITS(tITS.source); |
| 1178 | + |
| 1179 | + if (mMCTruthON) { // store MC info |
| 1180 | + mOutITSLabels.emplace_back(mITSLblWork[iITS]); |
| 1181 | + mOutTPCLabels.emplace_back(mTPCLblWork[iTPC]); |
| 1182 | + } |
| 1183 | + |
1165 | 1184 | return true; |
1166 | 1185 | } |
1167 | 1186 |
|
|
0 commit comments