Skip to content

Commit 4e17997

Browse files
mpucciofmazzasc
authored andcommitted
Add ITS cluster size to the AO2D
1 parent 5901752 commit 4e17997

File tree

7 files changed

+40
-2
lines changed

7 files changed

+40
-2
lines changed

DataFormats/Detectors/ITSMFT/ITS/include/DataFormatsITS/TrackITS.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,30 @@ class TrackITS : public o2::track::TrackParCov
122122
void setNextROFbit(bool toggle = true) { setUserField((getUserField() & ~kNextROF) | (-toggle & kNextROF)); }
123123
bool hasHitInNextROF() const { return getUserField() & kNextROF; }
124124

125+
void setClusterSize(int l, int size) {
126+
if (l >= 8) return;
127+
if (size > 15) size = 15;
128+
mClusterSizes &= ~(0xf << (l * 4));
129+
mClusterSizes |= (size << (l * 4));
130+
}
131+
132+
int getClusterSize(int l) {
133+
if (l >= 8) return 0;
134+
return (mClusterSizes >> (l * 4)) & 0xf;
135+
}
136+
137+
int getClusterSizes() const {
138+
return mClusterSizes;
139+
}
140+
125141
private:
126142
o2::track::TrackParCov mParamOut; ///< parameter at largest radius
127143
ClusRefs mClusRef; ///< references on clusters
128144
float mChi2 = 0.; ///< Chi2 for this track
129145
uint32_t mPattern = 0; ///< layers pattern
146+
unsigned int mClusterSizes = 0u;
130147

131-
ClassDefNV(TrackITS, 5);
148+
ClassDefNV(TrackITS, 6);
132149
};
133150

134151
class TrackITSExt : public TrackITS

Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ class AODProducerWorkflowDPL : public Task
356356
struct TrackExtraInfo {
357357
float tpcInnerParam = 0.f;
358358
uint32_t flags = 0;
359+
uint32_t itsClusterSizes = 0u;
359360
uint8_t itsClusterMap = 0;
360361
uint8_t tpcNClsFindable = 0;
361362
int8_t tpcNClsFindableMinusFound = 0;

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ void AODProducerWorkflowDPL::addToTracksExtraTable(TracksExtraCursorType& tracks
320320
tracksExtraCursor(truncateFloatFraction(extraInfoHolder.tpcInnerParam, mTrack1Pt),
321321
extraInfoHolder.flags,
322322
extraInfoHolder.itsClusterMap,
323+
extraInfoHolder.itsClusterSizes,
323324
extraInfoHolder.tpcNClsFindable,
324325
extraInfoHolder.tpcNClsFindableMinusFound,
325326
extraInfoHolder.tpcNClsFindableMinusCrossedRows,
@@ -2371,6 +2372,7 @@ AODProducerWorkflowDPL::TrackExtraInfo AODProducerWorkflowDPL::processBarrelTrac
23712372
float chi2 = itsTrack.getChi2();
23722373
extraInfoHolder.itsChi2NCl = nClusters != 0 ? chi2 / (float)nClusters : 0;
23732374
extraInfoHolder.itsClusterMap = itsTrack.getPattern();
2375+
extraInfoHolder.itsClusterSizes = itsTrack.getClusterSizes();
23742376
if (src == GIndex::ITS) { // standalone ITS track should set its time from the ROF
23752377
const auto& rof = data.getITSTracksROFRecords()[mITSROFs[trackIndex.getIndex()]];
23762378
double t = rof.getBCData().differenceInBC(mStartIR) * o2::constants::lhc::LHCBunchSpacingNS + mITSROFrameHalfLengthNS;
@@ -2729,6 +2731,9 @@ DataProcessorSpec getAODProducerWorkflowSpec(GID::mask_t src, bool enableSV, boo
27292731
dataRequest->requestStrangeTracks(useMC);
27302732
LOGF(info, "requestStrangeTracks Finish");
27312733
}
2734+
if (src[GID::ITS]) {
2735+
dataRequest->requestClusters(GIndex::getSourcesMask("ITS"), false);
2736+
}
27322737
if (src[GID::TPC]) {
27332738
dataRequest->requestClusters(GIndex::getSourcesMask("TPC"), false); // no need to ask for TOF clusters as they are requested with TOF tracks
27342739
}

Detectors/ITSMFT/ITS/tracking/include/ITStracking/TimeFrame.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ class TimeFrame
129129
const gsl::span<const MCCompLabel> getClusterLabels(int layerId, const Cluster& cl) const;
130130
const gsl::span<const MCCompLabel> getClusterLabels(int layerId, const int clId) const;
131131
int getClusterExternalIndex(int layerId, const int clId) const;
132+
int getClusterSize(int clusterId);
132133

133134
std::vector<MCCompLabel>& getTrackletsLabel(int layer) { return mTrackletLabels[layer]; }
134135
std::vector<MCCompLabel>& getCellsLabel(int layer) { return mCellLabels[layer]; }
@@ -244,6 +245,7 @@ class TimeFrame
244245
std::vector<float> mMSangles;
245246
std::vector<float> mPhiCuts;
246247
std::vector<float> mPositionResolution;
248+
std::vector<int> mClusterSize;
247249
std::vector<bool> mMultiplicityCutMask;
248250
std::vector<std::array<float, 2>> mPValphaX; /// PV x and alpha for track propagation
249251
std::vector<std::vector<Cluster>> mUnsortedClusters;
@@ -424,6 +426,10 @@ inline const gsl::span<const MCCompLabel> TimeFrame::getClusterLabels(int layerI
424426
return mClusterLabels->getLabels(mClusterExternalIndices[layerId][clId]);
425427
}
426428

429+
inline int TimeFrame::getClusterSize(int clusterId) {
430+
return mClusterSize[clusterId];
431+
}
432+
427433
inline int TimeFrame::getClusterExternalIndex(int layerId, const int clId) const
428434
{
429435
return mClusterExternalIndices[layerId][clId];

Detectors/ITSMFT/ITS/tracking/src/TimeFrame.cxx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ int TimeFrame::loadROFrameData(gsl::span<o2::itsmft::ROFRecord> rofs,
175175
geom->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::T2L, o2::math_utils::TransformType::L2G));
176176

177177
mNrof = 0;
178+
mClusterSize.clear();
179+
mClusterSize.reserve(clusters.size());
178180
for (auto& rof : rofs) {
179181
for (int clusterId{rof.getFirstEntry()}; clusterId < rof.getFirstEntry() + rof.getNEntries(); ++clusterId) {
180182
auto& c = clusters[clusterId];
@@ -184,19 +186,24 @@ int TimeFrame::loadROFrameData(gsl::span<o2::itsmft::ROFRecord> rofs,
184186
auto pattID = c.getPatternID();
185187
o2::math_utils::Point3D<float> locXYZ;
186188
float sigmaY2 = DefClusError2Row, sigmaZ2 = DefClusError2Col, sigmaYZ = 0; // Dummy COG errors (about half pixel size)
189+
int clusterSize{0};
187190
if (pattID != itsmft::CompCluster::InvalidPatternID) {
188191
sigmaY2 = dict->getErr2X(pattID);
189192
sigmaZ2 = dict->getErr2Z(pattID);
190193
if (!dict->isGroup(pattID)) {
191194
locXYZ = dict->getClusterCoordinates(c);
195+
clusterSize = dict->getNpixels(pattID);
192196
} else {
193197
o2::itsmft::ClusterPattern patt(pattIt);
194198
locXYZ = dict->getClusterCoordinates(c, patt);
199+
clusterSize = patt.getNPixels();
195200
}
196201
} else {
197202
o2::itsmft::ClusterPattern patt(pattIt);
198203
locXYZ = dict->getClusterCoordinates(c, patt, false);
204+
clusterSize = patt.getNPixels();
199205
}
206+
mClusterSize.push_back(clusterSize);
200207
auto sensorID = c.getSensorID();
201208
// Inverse transformation to the local --> tracking
202209
auto trkXYZ = geom->getMatrixT2L(sensorID) ^ locXYZ;

Detectors/ITSMFT/ITS/workflow/src/TrackerSpec.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ void TrackerDPL::run(ProcessingContext& pc)
297297
for (int ic = TrackITSExt::MaxClusters; ic--;) { // track internally keeps in->out cluster indices, but we want to store the references as out->in!!!
298298
auto clid = trc.getClusterIndex(ic);
299299
if (clid >= 0) {
300+
trc.setClusterSize(ic, mTimeFrame->getClusterSize(clid));
300301
allClusIdx.push_back(clid);
301302
nclf++;
302303
}

Framework/Core/include/Framework/AnalysisDataModel.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ DECLARE_SOA_EXPRESSION_COLUMN(C1Pt21Pt2, c1Pt21Pt2, float, //!
222222
DECLARE_SOA_COLUMN(TPCInnerParam, tpcInnerParam, float); //! Momentum at inner wall of the TPC
223223
DECLARE_SOA_COLUMN(Flags, flags, uint32_t); //! Track flags. Run 2: see TrackFlagsRun2Enum | Run 3: see TrackFlags
224224
DECLARE_SOA_COLUMN(ITSClusterMap, itsClusterMap, uint8_t); //! ITS cluster map, one bit per a layer, starting from the innermost
225+
DECLARE_SOA_COLUMN(ITSClusterSizes, itsClusterSizes, uint32_t); //! Clusters sizes, four bits per a layer, starting from the innermost
225226
DECLARE_SOA_COLUMN(TPCNClsFindable, tpcNClsFindable, uint8_t); //! Findable TPC clusters for this track geometry
226227
DECLARE_SOA_COLUMN(TPCNClsFindableMinusFound, tpcNClsFindableMinusFound, int8_t); //! TPC Clusters: Findable - Found
227228
DECLARE_SOA_COLUMN(TPCNClsFindableMinusCrossedRows, tpcNClsFindableMinusCrossedRows, int8_t); //! TPC Clusters: Findable - crossed rows
@@ -391,7 +392,7 @@ DECLARE_SOA_EXTENDED_TABLE(TracksCovIU, StoredTracksCovIU, "TRACKCOV_IU", //! Tr
391392
aod::track::C1Pt21Pt2);
392393

393394
DECLARE_SOA_TABLE_FULL(StoredTracksExtra, "TracksExtra", "AOD", "TRACKEXTRA", //! On disk version of TracksExtra
394-
track::TPCInnerParam, track::Flags, track::ITSClusterMap,
395+
track::TPCInnerParam, track::Flags, track::ITSClusterMap, track::ITSClusterSizes,
395396
track::TPCNClsFindable, track::TPCNClsFindableMinusFound, track::TPCNClsFindableMinusCrossedRows,
396397
track::TPCNClsShared, track::TRDPattern, track::ITSChi2NCl,
397398
track::TPCChi2NCl, track::TRDChi2, track::TOFChi2,

0 commit comments

Comments
 (0)