diff --git a/PhysicsAnalysis/TrackingID/InDetTrackSystematicsTools/InDetTrackSystematicsTools/InDetTrackTruthOriginDefs.h b/PhysicsAnalysis/TrackingID/InDetTrackSystematicsTools/InDetTrackSystematicsTools/InDetTrackTruthOriginDefs.h index a106b2c8a4338ee620425078748d08d5deb6f169..405f9bf3fbb1aee7e3591d3c52f2fd9e3572f182 100644 --- a/PhysicsAnalysis/TrackingID/InDetTrackSystematicsTools/InDetTrackSystematicsTools/InDetTrackTruthOriginDefs.h +++ b/PhysicsAnalysis/TrackingID/InDetTrackSystematicsTools/InDetTrackSystematicsTools/InDetTrackTruthOriginDefs.h @@ -103,7 +103,7 @@ namespace InDet { return false; } - /** from D but not from B-->D */ + /** not from B, D, or any secondary */ inline bool isFragmentation(int origin) { if (origin & (0x1 << Fragmentation)) return true; return false; diff --git a/PhysicsAnalysis/TrackingID/InDetTrackSystematicsTools/Root/InDetTrackTruthOriginTool.cxx b/PhysicsAnalysis/TrackingID/InDetTrackSystematicsTools/Root/InDetTrackTruthOriginTool.cxx index 29fb22b835343994cb680bea855f8a0aae7ae464..dbbcc0f611e79c64c7f7ed8d20f1c581bca27077 100644 --- a/PhysicsAnalysis/TrackingID/InDetTrackSystematicsTools/Root/InDetTrackTruthOriginTool.cxx +++ b/PhysicsAnalysis/TrackingID/InDetTrackSystematicsTools/Root/InDetTrackTruthOriginTool.cxx @@ -40,7 +40,7 @@ namespace InDet { static SG::AuxElement::ConstAccessor< Link_t > linkAcc( m_truthParticleLinkName.data() ); const Link_t& link = linkAcc( *track ); if( link.isValid() ) { - truth = *link; + truth = *link; } } @@ -49,86 +49,84 @@ namespace InDet { int origin = 0; - // not matched to truth: call it fake + // truth link is broken: call it from pileup (not true for < 100 MeV!) + if (!truth){ + origin = origin | (0x1 << InDet::TrkOrigin::Pileup); + } + + // low TruthMatchProbability: call it fake (also includes poorly reconstructed tracks) if(truthProb < m_matchingProbabilityCut) { origin = origin | (0x1 << InDet::TrkOrigin::Fake); } - // matched to truth: find truth origin - else{ - // matched but truth link is broken: call it from pileup (not true for < 100 MeV!) - if (!truth){ - origin = origin | (0x1 << InDet::TrkOrigin::Pileup); + + // truth link is present: find truth origin + if (truth) { + + // is it fragmentation? yes until proven otherwise + bool isFragmentation = true; + + // from B decay chain? + if(isFrom(truth, 5)) { + origin = origin | (0x1 << InDet::TrkOrigin::BHadronDecay); + isFragmentation = false; } - // matched and link is present: find trutn origin - else{ - - // is it fragmentation? yes until proven otherwise - bool isFragmentation = true; - - // from B decay chain? - if(isFrom(truth, 5)) { - origin = origin | (0x1 << InDet::TrkOrigin::BHadronDecay); - isFragmentation = false; - } - - // from D decay chain? - if(isFrom(truth, 4)) { - origin = origin | (0x1 << InDet::TrkOrigin::DHadronDecay); - isFragmentation = false; - } - - // Secondary? check based on barcode: secondaries are produced by G4. - int truthBarcode = truth->barcode(); - if (truthBarcode > m_barcodeG4) { - // sub-categorize secondaries... - int parentID = getParentID(truth); - - // photon conversions - if(parentID == 22) { - origin = origin | (0x1 << InDet::TrkOrigin::GammaConversion); - } - - // K-short - else if(parentID == 310) { - origin = origin | (0x1 << InDet::TrkOrigin::KshortDecay); - } - - // Lambda - else if(abs(parentID) == 3122){ - origin = origin | (0x1 << InDet::TrkOrigin::LambdaDecay); - } - - // other long living particle decays - else if(abs(parentID) > 3) { - origin = origin | (0x1 << InDet::TrkOrigin::OtherDecay); - } - - // hadronic interactions - else if(parentID == -1) { - origin = origin | (0x1 << InDet::TrkOrigin::HadronicInteraction); - } - - // other secondaries? - // ---> Not sure what if anything should be here... - else if(parentID == -2) { - origin = origin | (0x1 << InDet::TrkOrigin::OtherSecondary); - } - - // other unknown origin (e.g. parent not in the record:) - // ---> Not sure what if anything should be here... - else{ - origin = origin | (0x1 << InDet::TrkOrigin::OtherOrigin); - } - - isFragmentation = false; - } - - // uncategorized: call it fragmentation - if(isFragmentation) { - origin = origin | (0x1 << InDet::TrkOrigin::Fragmentation); - } + // from D decay chain? + if(isFrom(truth, 4)) { + origin = origin | (0x1 << InDet::TrkOrigin::DHadronDecay); + isFragmentation = false; + } + + // Secondary? check based on barcode: secondaries are produced by G4, + // and have barcodes > 2e5. + int truthBarcode = truth->barcode(); + if (truthBarcode > m_barcodeG4) { + // sub-categorize secondaries... + int parentID = getParentID(truth); + + // photon conversions + if(parentID == 22) { + origin = origin | (0x1 << InDet::TrkOrigin::GammaConversion); + } + + // K-short + else if(parentID == 310) { + origin = origin | (0x1 << InDet::TrkOrigin::KshortDecay); + } + + // Lambda + else if(abs(parentID) == 3122){ + origin = origin | (0x1 << InDet::TrkOrigin::LambdaDecay); + } + + // other long living particle decays + else if(abs(parentID) > 3) { + origin = origin | (0x1 << InDet::TrkOrigin::OtherDecay); + } + + // hadronic interactions + else if(parentID == -1) { + origin = origin | (0x1 << InDet::TrkOrigin::HadronicInteraction); + } + + // other secondaries? + // ---> Not sure what if anything should be here... + else if(parentID == -2) { + origin = origin | (0x1 << InDet::TrkOrigin::OtherSecondary); + } + + // other unknown origin (e.g. parent not in the record:) + // ---> Not sure what if anything should be here... + else{ + origin = origin | (0x1 << InDet::TrkOrigin::OtherOrigin); + } + + isFragmentation = false; + } + // uncategorized: call it fragmentation + if(isFragmentation) { + origin = origin | (0x1 << InDet::TrkOrigin::Fragmentation); } } @@ -141,8 +139,6 @@ namespace InDet { if( flav != 5 && flav != 4 ) return false; - if( ! part->isHadron() ) return false; - if( flav == 5 && part->isBottomHadron() ) return true; if( flav == 4 && part->isCharmHadron() ) return true;