Skip to content

Commit 4049065

Browse files
pnwkwshahor02
authored andcommitted
Add Sources mask -> Detector mask function; Fix detector list in overlay
1 parent 5f4493f commit 4049065

5 files changed

Lines changed: 16 additions & 45 deletions

File tree

DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class DetID
116116
// we need default c-tor only for root persistency, code must use c-tor with argument
117117
DetID() : mID(First) {}
118118

119-
/// get derector id
119+
/// get detector id
120120
GPUdi() ID getID() const { return mID; }
121121
/// get detector mask
122122
GPUdi() mask_t getMask() const { return getMask(mID); }

DataFormats/Reconstruction/include/ReconstructionDataFormats/GlobalTrackID.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class GlobalTrackID : public AbstractRef<25, 5, 2>
8383

8484
// methods for detector level manipulations
8585
GPUd() static constexpr DetID::mask_t getSourceDetectorsMask(int i);
86+
GPUd() static constexpr DetID::mask_t getSourcesDetectorsMask(GlobalTrackID::mask_t srcm);
8687
GPUd() static bool includesDet(DetID id, GlobalTrackID::mask_t srcm);
8788
GPUdi() auto getSourceDetectorsMask() const { return getSourceDetectorsMask(getSource()); }
8889
GPUdi() bool includesDet(DetID id) const { return (getSourceDetectorsMask() & DetID::getMask(id)).any(); }
@@ -175,6 +176,17 @@ GPUdi() bool GlobalTrackID::includesDet(DetID id, GlobalTrackID::mask_t srcm)
175176
return false;
176177
}
177178

179+
GPUd() constexpr GlobalTrackID::DetID::mask_t GlobalTrackID::getSourcesDetectorsMask(GlobalTrackID::mask_t srcm)
180+
{
181+
GlobalTrackID::DetID::mask_t mdet;
182+
for (int i = 0; i < NSources; i++) {
183+
if (srcm[i]) {
184+
mdet |= getSourceDetectorsMask(i);
185+
}
186+
}
187+
return mdet;
188+
}
189+
178190
} // namespace dataformats
179191
} // namespace o2
180192

EventVisualisation/Base/src/DataSourceOnline.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ Int_t DataSourceOnline::getCurrentEvent()
8888

8989
o2::detectors::DetID::mask_t DataSourceOnline::getDetectorsMask()
9090
{
91-
auto mask = o2::dataformats::GlobalTrackID{0, static_cast<o2::dataformats::GlobalTrackID::Src_t>(mTrackMask)};
92-
return mask.getSourceDetectorsMask();
91+
return o2::dataformats::GlobalTrackID::getSourcesDetectorsMask(mTrackMask);
9392
}
9493

9594
} // namespace event_visualisation

EventVisualisation/View/src/EventManager.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void EventManager::displayCurrentEvent()
8888
}
8989
}
9090
multiView->getAnnotationTop()->SetText(TString::Format("Run %d\n%s", dataSource->getRunNumber(), dataSource->getCollisionTime().c_str()));
91-
auto detectors = dataformats::GlobalTrackID::getSourcesNames(dataSource->getDetectorsMask());
91+
auto detectors = detectors::DetID::getNames(dataSource->getDetectorsMask());
9292
multiView->getAnnotationBottom()->SetText(TString::Format("TFOrbit: %d\nDetectors: %s", dataSource->getFirstTForbit(), detectors.c_str()));
9393
}
9494
multiView->redraw3D();

EventVisualisation/View/src/EventManagerFrame.cxx

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,6 @@ void EventManagerFrame::DoScreenshot()
233233
const char* backgroundColor = "#000000"; // "#19324b";
234234
const char* outDirectory = "Screenshots";
235235

236-
std::string detectorsString;
237-
238236
std::string runString = "Run:";
239237
std::string timestampString = "Timestamp:";
240238
std::string collidingsystemString = "Colliding system:";
@@ -318,45 +316,7 @@ void EventManagerFrame::DoScreenshot()
318316

319317
o2::dataformats::GlobalTrackID::mask_t detectorsMask;
320318

321-
int noEvent = this->mEventManager->getDataSource()->getCurrentEvent();
322-
323-
auto displayList = this->mEventManager->getDataSource()->getVisualisationList(noEvent, EventManagerFrame::getInstance().getMinTimeFrameSliderValue(),
324-
EventManagerFrame::getInstance().getMaxTimeFrameSliderValue(), EventManagerFrame::MaxRange);
325-
326-
const uint8_t possibleDetectors[] =
327-
{
328-
o2::dataformats::GlobalTrackID::Source::ITS,
329-
o2::dataformats::GlobalTrackID::Source::TPC,
330-
o2::dataformats::GlobalTrackID::Source::TRD,
331-
o2::dataformats::GlobalTrackID::Source::TOF,
332-
o2::dataformats::GlobalTrackID::Source::CPV,
333-
o2::dataformats::GlobalTrackID::Source::EMC,
334-
o2::dataformats::GlobalTrackID::Source::HMP,
335-
o2::dataformats::GlobalTrackID::Source::MFT,
336-
o2::dataformats::GlobalTrackID::Source::MCH,
337-
o2::dataformats::GlobalTrackID::Source::MID,
338-
o2::dataformats::GlobalTrackID::Source::ZDC,
339-
o2::dataformats::GlobalTrackID::Source::FT0,
340-
o2::dataformats::GlobalTrackID::Source::FV0,
341-
o2::dataformats::GlobalTrackID::Source::FDD,
342-
};
343-
344-
const std::string possibleDetectorsNames[] = {
345-
"ITS", "TPC", "TRD", "TOF", "CPV", "EMC", "HMP",
346-
"MFT", "MCH", "MID", "ZDC", "FT0", "FV0", "FDD"};
347-
348-
for (auto it = displayList.begin(); it != displayList.end(); ++it) {
349-
detectorsMask.set(it->first.getTrkMask());
350-
}
351-
352-
for (int detID = 0; detID < (sizeof(possibleDetectors) / sizeof(possibleDetectors[0])); detID++) {
353-
if (o2::dataformats::GlobalTrackID::includesDet(possibleDetectors[detID], detectorsMask)) {
354-
if (!detectorsString.empty()) {
355-
detectorsString += ',';
356-
}
357-
detectorsString += possibleDetectorsNames[detID];
358-
}
359-
}
319+
auto detectorsString = dataformats::GlobalTrackID::getSourcesNames(this->mEventManager->getDataSource()->getDetectorsMask());
360320

361321
std::vector<std::string> lines;
362322
std::ifstream input("screenshot.txt");

0 commit comments

Comments
 (0)