Skip to content

Commit 9fee2ba

Browse files
shahor02sawenzel
authored andcommitted
Fix: check for initDone was blocking next TF input
The mInitDone flag, set during 1st TF processeing, was preventing setting the input of following TFs. Introduced separate mWFInputAttached to flag that the DPL data was attached, in the DPL mode process directly with overloaded run method w/o wrong check for init.
1 parent 79024c4 commit 9fee2ba

3 files changed

Lines changed: 16 additions & 24 deletions

File tree

Detectors/GlobalTracking/include/GlobalTracking/MatchTOF.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ class MatchTOF
8484
///< perform all initializations
8585
void init();
8686

87-
///< perform all initializations
88-
void initWorkflow(const gsl::span<const o2::dataformats::TrackTPCITS>& trackArray, const gsl::span<const Cluster>& clusterArray, const o2::dataformats::MCTruthContainer<o2::MCCompLabel>& toflab, const gsl::span<const o2::MCCompLabel>& itslab, const gsl::span<const o2::MCCompLabel>& tpclab);
87+
///< attach DPL data and run
88+
void run(const gsl::span<const o2::dataformats::TrackTPCITS>& trackArray, const gsl::span<const Cluster>& clusterArray, const o2::dataformats::MCTruthContainer<o2::MCCompLabel>& toflab, const gsl::span<const o2::MCCompLabel>& itslab, const gsl::span<const o2::MCCompLabel>& tpclab);
8989

9090
///< set tree/chain containing tracks
9191
void setInputTreeTracks(TTree* tree) { mInputTreeTracks = tree; }
@@ -211,7 +211,8 @@ class MatchTOF
211211

212212
// Data members
213213

214-
bool mInitDone = false; ///< flag init already done
214+
bool mSAInitDone = false; ///< flag that standalone init already done
215+
bool mWFInputAttached = false; ///< flag that the standalone input is attached
215216

216217
float mXRef = Geo::RMIN; ///< reference radius to propage tracks for matching
217218

Detectors/GlobalTracking/src/MatchTOF.cxx

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ void MatchTOF::run()
4747
{
4848
///< running the matching
4949

50-
if (!mInitDone) {
51-
LOG(FATAL) << "init() was not done yet";
50+
if (!mWFInputAttached && !mSAInitDone) {
51+
LOG(ERROR) << "run called with mSAInitDone=" << mSAInitDone << " and mWFInputAttached=" << mWFInputAttached;
52+
throw std::runtime_error("standalone init was not done or workflow input was not yet attached");
5253
}
53-
5454
mTimerTot.Start();
5555

5656
// we load all TOF clusters (to be checked if we need to split per time frame)
@@ -143,6 +143,8 @@ void MatchTOF::run()
143143
mDBGOut.reset();
144144
#endif
145145

146+
mWFInputAttached = false;
147+
146148
mTimerTot.Stop();
147149
printf("Timing:\n");
148150
printf("Do Matching: ");
@@ -158,14 +160,8 @@ void MatchTOF::fill()
158160
}
159161

160162
//______________________________________________
161-
void MatchTOF::initWorkflow(const gsl::span<const o2::dataformats::TrackTPCITS>& trackArray, const gsl::span<const Cluster>& clusterArray, const o2::dataformats::MCTruthContainer<o2::MCCompLabel>& toflab, const gsl::span<const o2::MCCompLabel>& itslab, const gsl::span<const o2::MCCompLabel>& tpclab)
163+
void MatchTOF::run(const gsl::span<const o2::dataformats::TrackTPCITS>& trackArray, const gsl::span<const Cluster>& clusterArray, const o2::dataformats::MCTruthContainer<o2::MCCompLabel>& toflab, const gsl::span<const o2::MCCompLabel>& itslab, const gsl::span<const o2::MCCompLabel>& tpclab)
162164
{
163-
164-
if (mInitDone) {
165-
LOG(ERROR) << "Initialization was already done";
166-
return;
167-
}
168-
169165
mTracksArrayInp = trackArray;
170166
mTOFClustersArrayInp = clusterArray;
171167
mIsworkflowON = kTRUE;
@@ -174,20 +170,20 @@ void MatchTOF::initWorkflow(const gsl::span<const o2::dataformats::TrackTPCITS>&
174170
mITSLabels = itslab;
175171

176172
mMCTruthON = (mTOFClusLabels.getNElements() && mTPCLabels.size() && mITSLabels.size());
177-
178-
mInitDone = true;
173+
mWFInputAttached = true;
174+
mSAInitDone = true;
175+
run();
179176
}
180177

181178
//______________________________________________
182179
void MatchTOF::init()
183180
{
184181
///< initizalizations
185182

186-
if (mInitDone) {
183+
if (mSAInitDone) {
187184
LOG(ERROR) << "Initialization was already done";
188185
return;
189186
}
190-
191187
attachInputTrees();
192188

193189
// create output branch with track-tof matching
@@ -224,7 +220,7 @@ void MatchTOF::init()
224220
}
225221
#endif
226222

227-
mInitDone = true;
223+
mSAInitDone = true;
228224

229225
{
230226
mTimerTot.Stop();
@@ -240,10 +236,6 @@ void MatchTOF::print() const
240236
///< print the settings
241237

242238
LOG(INFO) << "****** component for the matching of tracks to TOF clusters ******";
243-
if (!mInitDone) {
244-
LOG(INFO) << "init is not done yet - nothing to print";
245-
return;
246-
}
247239

248240
LOG(INFO) << "MC truth: " << (mMCTruthON ? "on" : "off");
249241
LOG(INFO) << "Time tolerance: " << mTimeTolerance;

Detectors/GlobalTrackingWorkflow/tofworkflow/src/RecoWorkflowSpec.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ class TOFDPLRecoWorkflowTask
100100
toflab = std::move(*toflabel);
101101
}
102102

103-
mMatcher.initWorkflow(tracksRO, clustersRO, toflab, itslab, tpclab);
104-
mMatcher.run();
103+
mMatcher.run(tracksRO, clustersRO, toflab, itslab, tpclab);
105104

106105
// in run_match_tof aggiugnere esplicitamente la chiamata a fill del tree (nella classe MatchTOF) e il metodo per leggere i vettori di output
107106

0 commit comments

Comments
 (0)