Skip to content

Commit 3555308

Browse files
authored
fix for TOF cosmic calib (#5895)
* fix for TOF cosmic calib * suppress unneeded dereferencing, [] instead of at()
1 parent d676898 commit 3555308

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

Detectors/TOF/reconstruction/src/CosmicProcessor.cxx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@ using namespace o2::tof;
2222
void CosmicProcessor::clear()
2323
{
2424
mCosmicInfo.clear();
25-
for (int i = 0; i < Geo::NCHANNELS; i++) {
26-
mCounters[i] = 0;
27-
}
25+
mCosmicInfo.reserve(5200);
26+
27+
memset(mCounters, 0, sizeof(int) * Geo::NCHANNELS);
2828
}
2929
//__________________________________________________
3030
void CosmicProcessor::process(DigitDataReader& reader, bool fill)
3131
{
32+
if (mCosmicInfo.size() > 5000) {
33+
return;
34+
}
35+
3236
TStopwatch timerProcess;
3337
timerProcess.Start();
3438

@@ -39,13 +43,18 @@ void CosmicProcessor::process(DigitDataReader& reader, bool fill)
3943
int ndig = array->size();
4044
int ndig2 = ndig * fill;
4145

46+
int npair = 0;
47+
4248
int bcdist = 200;
4349
float thr = 5000000; // in ps
4450

4551
int volID1[5], volID2[5];
4652
float pos1[3], pos2[3];
4753

4854
for (int i = 0; i < ndig; i++) {
55+
if (npair >= 150) {
56+
break;
57+
}
4958
auto& dig1 = (*array)[i];
5059
int ch1 = dig1.getChannel();
5160
mCounters[ch1]++;
@@ -100,6 +109,7 @@ void CosmicProcessor::process(DigitDataReader& reader, bool fill)
100109
continue;
101110
}
102111

112+
npair++;
103113
mCosmicInfo.emplace_back(ch1, ch2, dtime, tot1, tot2, l, tm1, tm2);
104114
}
105115
}

Detectors/TOF/workflow/src/TOFClusterizerSpec.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class TOFDPLClustererTask
7575
mTimer.Start(false);
7676
// get digit data
7777
auto digits = pc.inputs().get<gsl::span<o2::tof::Digit>>("tofdigits");
78-
auto row = pc.inputs().get<std::vector<o2::tof::ReadoutWindowData>*>("readoutwin");
78+
auto row = pc.inputs().get<gsl::span<o2::tof::ReadoutWindowData>>("readoutwin");
7979

8080
const auto* dh = o2::header::get<o2::header::DataHeader*>(pc.inputs().getByPos(0).header);
8181
mClusterer.setFirstOrbit(dh->firstTForbit);
@@ -128,9 +128,9 @@ class TOFDPLClustererTask
128128
mCosmicProcessor.clear();
129129
}
130130

131-
for (int i = 0; i < row->size(); i++) {
132-
//printf("# TOF readout window for clusterization = %d/%lu (N digits = %d)\n", i, row->size(), row->at(i).size());
133-
auto digitsRO = row->at(i).getBunchChannelData(digits);
131+
for (int i = 0; i < row.size(); i++) {
132+
//printf("# TOF readout window for clusterization = %d/%lu (N digits = %d)\n", i, row.size(), row[i].size());
133+
auto digitsRO = row[i].getBunchChannelData(digits);
134134
mReader.setDigitArray(&digitsRO);
135135

136136
if (mIsCosmic) {

0 commit comments

Comments
 (0)