Skip to content

Commit d2b0c3d

Browse files
nburmasosawenzel
authored andcommitted
Fix for MCTruth label checks
1 parent 1584aff commit d2b0c3d

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -534,16 +534,21 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
534534
// bit 13 -- ITS and TPC labels are not equal
535535
// bit 14 -- isNoise() == true
536536
// bit 15 -- isFake() == true
537+
// labelID = std::numeric_limits<uint32_t>::max() -- label is not set
538+
539+
uint32_t labelID;
540+
uint32_t labelITS;
541+
uint32_t labelTPC;
542+
uint16_t labelMask;
537543

538544
if (mFillTracksITS) {
539545
fillTracksTable(tracksITS, vCollRefsITS, tracksCursor, o2::vertexing::GIndex::Source::ITS); // fTrackType = 1
540546
for (auto& mcTruthITS : tracksITSMCTruth) {
541-
uint32_t labelID = std::numeric_limits<uint32_t>::max();
547+
labelID = std::numeric_limits<uint32_t>::max();
542548
// TODO:
543549
// fill label mask
544-
uint16_t labelMask = 0;
545-
int nEventsITS = mcReader.getNEvents(mcTruthITS.getSourceID());
546-
if (mcTruthITS.getEventID() < mcReader.getNEvents(mcTruthITS.getSourceID())) {
550+
labelMask = 0;
551+
if (mcTruthITS.isValid()) {
547552
labelID = mIDsToIndex.at(std::make_tuple(mcTruthITS.getSourceID(), mcTruthITS.getEventID(), mcTruthITS.getTrackID()));
548553
}
549554
if (mcTruthITS.isFake()) {
@@ -561,12 +566,11 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
561566
if (mFillTracksTPC) {
562567
fillTracksTable(tracksTPC, vCollRefsTPC, tracksCursor, o2::vertexing::GIndex::Source::TPC); // fTrackType = 2
563568
for (auto& mcTruthTPC : tracksTPCMCTruth) {
564-
uint32_t labelID = std::numeric_limits<uint32_t>::max();
569+
labelID = std::numeric_limits<uint32_t>::max();
565570
// TODO:
566571
// fill label mask
567-
uint16_t labelMask = 0;
568-
int nEventsTPC = mcReader.getNEvents(mcTruthTPC.getSourceID());
569-
if (mcTruthTPC.getEventID() < nEventsTPC) {
572+
labelMask = 0;
573+
if (mcTruthTPC.isValid()) {
570574
labelID = mIDsToIndex.at(std::make_tuple(mcTruthTPC.getSourceID(), mcTruthTPC.getEventID(), mcTruthTPC.getTrackID()));
571575
}
572576
if (mcTruthTPC.isFake()) {
@@ -586,16 +590,14 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
586590
for (int i = 0; i < tracksITSTPC.size(); i++) {
587591
auto& mcTruthITS = tracksITSTPC_ITSMC[i];
588592
auto& mcTruthTPC = tracksITSTPC_TPCMC[i];
589-
uint32_t labelID = std::numeric_limits<uint32_t>::max();
590-
uint32_t labelITS = std::numeric_limits<uint32_t>::max();
591-
uint32_t labelTPC = std::numeric_limits<uint32_t>::max();
593+
labelID = std::numeric_limits<uint32_t>::max();
594+
labelITS = std::numeric_limits<uint32_t>::max();
595+
labelTPC = std::numeric_limits<uint32_t>::max();
592596
// TODO:
593597
// fill label mask
594598
// currently using label mask to indicate labelITS != labelTPC
595-
uint16_t labelMask = 0;
596-
int nEventsITS = mcReader.getNEvents(mcTruthITS.getSourceID());
597-
int nEventsTPC = mcReader.getNEvents(mcTruthTPC.getSourceID());
598-
if (mcTruthITS.getEventID() < nEventsITS && mcTruthTPC.getEventID() < nEventsTPC) {
599+
labelMask = 0;
600+
if (mcTruthITS.isValid() && mcTruthTPC.isValid()) {
599601
labelITS = mIDsToIndex.at(std::make_tuple(mcTruthITS.getSourceID(), mcTruthITS.getEventID(), mcTruthITS.getTrackID()));
600602
labelTPC = mIDsToIndex.at(std::make_tuple(mcTruthTPC.getSourceID(), mcTruthTPC.getEventID(), mcTruthTPC.getTrackID()));
601603
labelID = labelITS;

0 commit comments

Comments
 (0)