|
ATLAS Offline Software
|
Tool to calculate track truth.
More...
#include <MuonTrackTruthTool.h>
|
| MuonTrackTruthTool (const std::string &, const std::string &, const IInterface *) |
| constructor More...
|
|
| ~MuonTrackTruthTool ()=default |
| destructor More...
|
|
StatusCode | initialize () |
| AlgTool initilize. More...
|
|
ResultVec | match (const TruthTree &truth_tree, const TrackCollection &tracks) const |
| perform truth matching for a given set of tracks More...
|
|
SegmentResultVec | match (const TruthTree &truth_tree, const std::vector< const MuonSegment * > &segments) const |
| perform truth matching for a given set of segments More...
|
|
MuonTrackTruth | getTruth (const TruthTree &truth_tree, const Trk::Track &track, bool restrictedTruth=false) const |
| get track truth More...
|
|
MuonTrackTruth | getTruth (const TruthTree &truth_tree, const std::vector< const MuonSegment * > &segments, bool restrictedTruth=false) const |
| get segment truth for a list of segments, the segments will be considered to belong to the same muon More...
|
|
MuonTrackTruth | getTruth (const TruthTree &truth_tree, const Muon::MuonSegment &segment) const |
| get segment truth More...
|
|
MuonTrackTruth | getTruth (const TruthTree &truth_tree, const std::vector< const Trk::MeasurementBase * > &measurements, bool restrictedTruth=false) const |
| get truth for a give set of hits. More...
|
|
const TruthTree | createTruthTree (const TrackRecordCollection *truthTrackCol, const McEventCollection *mcEventCollection, const std::vector< const MuonSimDataCollection * > &muonSimData, const CscSimDataCollection *cscSimDataMap) const |
| create truth tree from sim data More...
|
|
HepMC::ConstGenParticlePtr | getMother (const TruthTrajectory &traj, const int barcodeIn) const |
| Returns the mother particle of the particle with barcodeIn if it is found in the truth trajectory. More...
|
|
HepMC::ConstGenParticlePtr | getAncestor (const TruthTrajectory &traj, const int barcodeIn) const |
| Returns the ancestor particle of the particle with barcodeIn if it is found in the truth trajectory. More...
|
|
HepMC::ConstGenParticlePtr | getInitial (const TruthTrajectory &traj, const int barcodeIn) const |
| Returns the initial particle of the particle with barcodeIn if it is found in the truth trajectory. More...
|
|
unsigned int | getNumberOfScatters (const TruthTrajectory &traj, const int barcodeIn) const |
| Returns the number of steps a particle took while maintaining its PDG ID. More...
|
|
ServiceHandle< StoreGateSvc > & | evtStore () |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysInitialize () override |
| Perform system initialization for an algorithm. More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
|
MuonTrackTruth | getTruth (const std::vector< const Trk::MeasurementBase * > &measurements, const TruthTreeEntry &truthEntry, bool restrictedTruth) const |
|
void | addSimDataToTree (TruthTree &truth_tree, std::map< int, int > &barcode_map, const MuonSimDataCollection *simDataCol) const |
|
void | addCscSimDataToTree (TruthTree &truth_tree, std::map< int, int > &barcode_map, const CscSimDataCollection *simDataCol) const |
|
void | addMdtTruth (MuonTechnologyTruth &trackTruth, const Identifier &id, const Trk::MeasurementBase &meas, const MuonSimDataCollection &simCol) const |
|
void | addClusterTruth (MuonTechnologyTruth &trackTruth, const Identifier &id, const Trk::MeasurementBase &meas, const MuonSimDataCollection &simCol) const |
|
void | addClusterTruth (MuonTechnologyTruth &trackTruth, const Identifier &id, const Trk::MeasurementBase &meas, const CscSimDataCollection &simCol) const |
|
void | addMissedHits (MuonTechnologyTruth &truth, const std::set< Identifier > &ids, const std::set< Identifier > &chids, const MuonSimDataCollection &simCol, bool restrictedTruth) const |
|
void | addMissedHits (MuonTechnologyTruth &truth, const std::set< Identifier > &ids, const std::set< Identifier > &chids, const CscSimDataCollection &simCol, bool restrictedTruth) const |
|
int | manipulateBarCode (int barcode) const |
|
bool | selectPdg (int pdg) const |
|
const std::pair< HepMC::ConstGenParticlePtr, unsigned int > | getInitialPair (const TruthTrajectory &traj, const int barcodeIn) const |
| Returns the initial particle of the particle with barcodeIn if it is found in the truth trajectory. More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKey> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &) |
| specialization for handling Gaudi::Property<SG::VarHandleBase> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &) |
| specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
|
|
|
const MuonGM::MuonDetectorManager * | m_detMgr |
|
ServiceHandle< Muon::IMuonIdHelperSvc > | m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"} |
|
PublicToolHandle< Muon::MuonEDMPrinterTool > | m_printer {this, "Printer", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"} |
|
ToolHandle< Trk::ITruthTrajectoryBuilder > | m_truthTrajectoryBuilder |
|
Gaudi::Property< bool > | m_manipulateBarCode {this, "ManipulateBarCode", false} |
|
Gaudi::Property< bool > | m_doSummary {this, "DoSummary", false} |
|
Gaudi::Property< bool > | m_matchAllParticles {this, "MatchAllParticles", true} |
|
Gaudi::Property< unsigned int > | m_minHits {this, "MinHits", 4} |
|
Gaudi::Property< std::vector< int > > | m_pdgsToBeConsidered {this, "ConsideredPDGs", {}} |
|
std::set< int > | m_selectedPdgs |
|
StoreGateSvc_t | m_evtStore |
| Pointer to StoreGate (event store by default) More...
|
|
StoreGateSvc_t | m_detStore |
| Pointer to StoreGate (detector store by default) More...
|
|
std::vector< SG::VarHandleKeyArray * > | m_vhka |
|
bool | m_varHandleArraysDeclared |
|
Tool to calculate track truth.
Definition at line 47 of file MuonTrackTruthTool.h.
◆ MatchResult
◆ ResultVec
◆ SegmentMatchResult
◆ SegmentResultVec
◆ StoreGateSvc_t
◆ TruthTree
◆ TruthTreeConstIt
◆ TruthTreeIt
◆ MuonTrackTruthTool()
Muon::MuonTrackTruthTool::MuonTrackTruthTool |
( |
const std::string & |
ty, |
|
|
const std::string & |
na, |
|
|
const IInterface * |
pa |
|
) |
| |
◆ ~MuonTrackTruthTool()
Muon::MuonTrackTruthTool::~MuonTrackTruthTool |
( |
| ) |
|
|
default |
◆ addClusterTruth() [1/2]
Definition at line 647 of file MuonTrackTruthTool.cxx.
652 CscSimDataCollection::const_iterator
it = simCol.find(
id);
653 if (
it == simCol.end()) {
654 truth.wrongHits.insert(layid);
655 truth.wrongChambers.insert(chid);
659 std::vector<CscSimData::Deposit>::const_iterator dit =
it->second.getdeposits().begin();
660 std::vector<CscSimData::Deposit>::const_iterator dit_end =
it->second.getdeposits().end();
661 for (; dit != dit_end; ++dit) {
662 truth.matchedHits.insert(layid);
663 truth.matchedChambers.insert(chid);
◆ addClusterTruth() [2/2]
Definition at line 591 of file MuonTrackTruthTool.cxx.
596 MuonSimDataCollection::const_iterator
it = simCol.end();
598 bool goodCluster =
false;
599 const CompetingMuonClustersOnTrack* crot =
dynamic_cast<const CompetingMuonClustersOnTrack*
>(&meas);
601 for (
unsigned int i = 0;
i < crot->numberOfContainedROTs(); ++
i) {
602 const MuonClusterOnTrack* cluster = &crot->rioOnTrack(
i);
603 if (!cluster)
continue;
605 it = simCol.find(cluster->identify());
606 if (
it != simCol.end()) {
618 const std::vector<Identifier> &rdoList = prd->
rdoList();
619 std::vector<Identifier>::const_iterator rit = rdoList.begin();
620 std::vector<Identifier>::const_iterator rit_end = rdoList.end();
621 for (; rit != rit_end; ++rit) {
622 it = simCol.find(*rit);
623 if (
it != simCol.end()) {
629 it = simCol.find(
id);
630 if (
it != simCol.end()) goodCluster =
true;
634 if (!goodCluster ||
it == simCol.end()) {
635 truth.wrongHits.insert(
id);
639 std::vector<MuonSimData::Deposit>::const_iterator dit =
it->second.getdeposits().begin();
640 std::vector<MuonSimData::Deposit>::const_iterator dit_end =
it->second.getdeposits().end();
641 for (; dit != dit_end; ++dit) {
642 truth.matchedHits.insert(layid);
643 truth.matchedChambers.insert(chid);
◆ addCscSimDataToTree()
Definition at line 350 of file MuonTrackTruthTool.cxx.
353 CscSimDataCollection::const_iterator
it = simDataCol->begin();
354 CscSimDataCollection::const_iterator it_end = simDataCol->end();
355 for (;
it != it_end; ++
it) {
359 std::vector<CscSimData::Deposit>::const_iterator dit =
it->second.getdeposits().begin();
360 std::vector<CscSimData::Deposit>::const_iterator dit_end =
it->second.getdeposits().end();
361 for (; dit != dit_end; ++dit) {
363 std::map<int, int>::const_iterator bit = barcode_map.find(barcodeIn);
364 if (bit == barcode_map.end()) {
366 <<
" " <<
m_idHelperSvc->toString(
id) <<
" barcode " << barcodeIn);
383 eit->second.cscHits.insert(*
it);
◆ addMdtTruth()
Definition at line 556 of file MuonTrackTruthTool.cxx.
558 const MdtDriftCircleOnTrack* mdt =
dynamic_cast<const MdtDriftCircleOnTrack*
>(&meas);
567 MuonSimDataCollection::const_iterator
it = simCol.find(
id);
568 if (
it == simCol.end()) {
569 truth.wrongHits.insert(
id);
570 truth.wrongChambers.insert(chid);
574 std::vector<MuonSimData::Deposit>::const_iterator dit =
it->second.getdeposits().begin();
575 std::vector<MuonSimData::Deposit>::const_iterator dit_end =
it->second.getdeposits().end();
576 for (; dit != dit_end; ++dit) {
577 double radius = dit->second.firstEntry();
580 double checkSign = fabs(mdt->driftRadius()) > 0.3 ?
radius * mdt->driftRadius() : 1;
581 if (checkSign >= 0) {
582 truth.matchedHits.insert(
id);
583 truth.matchedChambers.insert(chid);
585 truth.wrongHits.insert(
id);
586 truth.wrongChambers.insert(chid);
◆ addMissedHits() [1/2]
Definition at line 529 of file MuonTrackTruthTool.cxx.
532 CscSimDataCollection::const_iterator
it = simCol.begin();
533 CscSimDataCollection::const_iterator it_end = simCol.end();
534 for (;
it != it_end; ++
it) {
537 int isOnTrack =
ids.count(
id);
538 if (isOnTrack)
continue;
542 bool chamberHasHits = chids.count(chid);
543 if (restrictedTruth && !chamberHasHits)
continue;
546 std::vector<CscSimData::Deposit>::const_iterator dit =
it->second.getdeposits().begin();
547 std::vector<CscSimData::Deposit>::const_iterator dit_end =
it->second.getdeposits().end();
548 for (; dit != dit_end; ++dit) {
549 truth.missedHits.insert(
id);
551 if (!chamberHasHits) truth.missedChambers.insert(chid);
◆ addMissedHits() [2/2]
Definition at line 500 of file MuonTrackTruthTool.cxx.
503 MuonSimDataCollection::const_iterator
it = simCol.begin();
504 MuonSimDataCollection::const_iterator it_end = simCol.end();
505 for (;
it != it_end; ++
it) {
510 int isOnTrack =
ids.count(
id);
511 if (isOnTrack)
continue;
515 bool chamberHasHits = chids.count(chid);
516 if (restrictedTruth && !chamberHasHits)
continue;
519 std::vector<MuonSimData::Deposit>::const_iterator dit =
it->second.getdeposits().begin();
520 std::vector<MuonSimData::Deposit>::const_iterator dit_end =
it->second.getdeposits().end();
521 for (; dit != dit_end; ++dit) {
522 truth.missedHits.insert(
id);
524 if (!chamberHasHits) truth.missedChambers.insert(chid);
◆ addSimDataToTree()
Definition at line 271 of file MuonTrackTruthTool.cxx.
274 MuonSimDataCollection::const_iterator
it = simDataCol->begin();
275 MuonSimDataCollection::const_iterator it_end = simDataCol->end();
276 for (;
it != it_end; ++
it) {
280 std::vector<MuonSimData::Deposit>::const_iterator dit =
it->second.getdeposits().begin();
281 std::vector<MuonSimData::Deposit>::const_iterator dit_end =
it->second.getdeposits().end();
282 for (; dit != dit_end; ++dit) {
283 int barcodeIn = dit->first.barcode();
284 std::map<int, int>::const_iterator bit = barcode_map.find(barcodeIn);
285 if (bit == barcode_map.end()) {
287 <<
" " <<
m_idHelperSvc->toString(
id) <<
" barcode " << barcodeIn);
306 eit->second.mdtHits.insert(*
it);
319 eit->second.rpcHits.insert(*
it);
326 eit->second.tgcHits.insert(*
it);
333 eit->second.stgcHits.insert(*
it);
340 eit->second.mmHits.insert(*
it);
◆ createTruthTree()
create truth tree from sim data
Implements Muon::IMuonTrackTruthTool.
Definition at line 115 of file MuonTrackTruthTool.cxx.
119 std::map<int, int> barcode_map;
121 if (truthTrackCol->
empty()) {
126 const HepMC::GenEvent* genEvent =
nullptr;
127 if (!mcEventCollection->
empty()) {
129 if (mcEventCollection->
size() == 1) genEvent = mcEventCollection->
front();
136 for (; tr_it != tr_it_end; ++tr_it) {
137 int PDGCode((*tr_it).GetPDGCode());
138 int barcode = (*tr_it).barcode();
145 if (barcode_map.count(
barcode)) {
151 std::unique_ptr<TruthTrajectory> truthTrajectory;
156 truthTrajectory = std::make_unique<TruthTrajectory>();
158 if (!truthTrajectory->empty()) {
160 barcode = truthTrajectory->front().barcode();
163 auto particle = truthTrajectory->front().cptr();
165 if (
particle->production_vertex()) {
167 <<
particle->production_vertex()->position().z());
172 std::vector<HepMcParticleLink>::const_iterator pit = truthTrajectory->begin();
173 std::vector<HepMcParticleLink>::const_iterator pit_end = truthTrajectory->end();
174 for (; pit != pit_end; ++pit) {
175 int code = (*pit).barcode();
182 <<
particle->production_vertex()->position().z());
205 entry.truthTrack = &(*tr_it);
207 entry.truthTrajectory = std::move(truthTrajectory);
215 unsigned int ngood(0);
216 std::vector<int> badBarcodes;
221 unsigned int nhits =
it->second.mdtHits.size() +
it->second.rpcHits.size() +
it->second.tgcHits.size() +
222 it->second.cscHits.size() +
it->second.stgcHits.size() +
it->second.mmHits.size();
223 if (!
it->second.truthTrack) erase =
true;
227 ATH_MSG_VERBOSE(
" Erasing entry: barcode " <<
it->second.truthTrack->barcode() <<
" manip "
229 badBarcodes.push_back(
it->first);
232 ATH_MSG_VERBOSE(
" Keeping entry: barcode " <<
it->second.truthTrack->barcode() <<
" manip "
239 for (; badIt != badIt_end; ++badIt)
truth_tree.erase(*badIt);
249 for (;
it != it_end; ++
it) {
250 if (!
it->second.truthTrack)
253 ATH_MSG_INFO(
" PDG " <<
it->second.truthTrack->GetPDGCode() <<
" barcode " <<
it->second.truthTrack->barcode()
256 if (!
it->second.mdtHits.empty())
ATH_MSG_INFO(
" mdt " <<
it->second.mdtHits.size());
257 if (!
it->second.rpcHits.empty())
ATH_MSG_INFO(
" rpc " <<
it->second.rpcHits.size());
258 if (!
it->second.tgcHits.empty())
ATH_MSG_INFO(
" tgc " <<
it->second.tgcHits.size());
259 if (!
it->second.cscHits.empty())
ATH_MSG_INFO(
" csc " <<
it->second.cscHits.size());
260 if (!
it->second.stgcHits.empty())
ATH_MSG_INFO(
" stgc " <<
it->second.stgcHits.size());
261 if (!
it->second.mmHits.empty())
ATH_MSG_INFO(
" mm " <<
it->second.mmHits.size());
262 if (
it->second.mdtHits.empty() &&
it->second.rpcHits.empty() &&
it->second.tgcHits.empty() &&
it->second.cscHits.empty() &&
263 it->second.stgcHits.empty() &&
it->second.mmHits.empty())
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
253 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
229 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
338 return PBASE::declareProperty(
name, property,
doc);
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ detStore()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ extraDeps_update_handler()
Add StoreName to extra input/output deps as needed.
use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given
◆ getAncestor()
Returns the ancestor particle of the particle with barcodeIn if it is found in the truth trajectory.
Ancestor here means the last particle at generator level that has a status code different from final state, e.g. Z
Implements Muon::IMuonTrackTruthTool.
Definition at line 689 of file MuonTrackTruthTool.cxx.
690 bool foundBC =
false;
691 for (
const auto& pit : traj) {
693 if (pit.barcode() == barcodeIn || foundBC) {
◆ getInitial()
Returns the initial particle of the particle with barcodeIn if it is found in the truth trajectory.
For example a mu undergoing a mubrem would create a second mu, in which case this method returns the mu prior to bremsstrahlung. This interface calls the method getInitialPair.
Implements Muon::IMuonTrackTruthTool.
Definition at line 768 of file MuonTrackTruthTool.cxx.
◆ getInitialPair()
Returns the initial particle of the particle with barcodeIn if it is found in the truth trajectory.
For example a mu undergoing a mubrem would create a second mu, in which case this method returns the mu prior to bremsstrahlung. The number of such scatters is returned in the .second.
Definition at line 708 of file MuonTrackTruthTool.cxx.
710 std::pair<HepMC::ConstGenParticlePtr, unsigned int> thePair(
nullptr, 0);
711 unsigned int scat = 0;
713 bool foundBC =
false;
717 for (
auto pit = traj.begin(); pit != traj.end(); ++pit) {
718 if ((*pit).barcode() == barcodeIn || foundBC) {
726 if (
particle->pdg_id() == pdgFinal) {
727 const auto& pit_p = *pit;
728 if ((theFirst != pit_p.scptr()) && (
particle->momentum().t() != ePrev))
733 theFirst = (*pit).scptr();
740 theFirst = (*pit).cptr();
741 pdgFinal = (*pit)->pdg_id();
743 if ((*pit)->pdg_id() == pdgFinal) {
745 if ((theFirst != pit_p.cptr()) && ((*pit).cptr()->momentum().t() != ePrev))
750 theFirst = (*pit).cptr();
760 if (theFirst && theFirst->pdg_id() != pdgFinal)
ATH_MSG_ERROR(
"Wrong pdgId association in getFirst()");
761 ATH_MSG_DEBUG(
"Number of scatters = " << scat <<
" pdgId = " << pdgFinal);
763 thePair.first = theFirst;
764 thePair.second = scat;
◆ getMother()
Returns the mother particle of the particle with barcodeIn if it is found in the truth trajectory.
It traces the decay chain until if finds the first particle that is different flavor from the starting one.
Implements Muon::IMuonTrackTruthTool.
Definition at line 667 of file MuonTrackTruthTool.cxx.
669 int pdgFinal = ((traj.empty()) ? -999 : traj.front().cptr()->pdg_id());
670 bool foundBC =
false;
671 for (
const auto& pit : traj) {
673 if (pit.barcode() == barcodeIn || foundBC) {
681 if (
particle->pdg_id() != pdgFinal) {
◆ getNumberOfScatters()
◆ getTruth() [1/5]
Definition at line 452 of file MuonTrackTruthTool.cxx.
454 MuonTrackTruth trackTruth;
455 trackTruth.truthTrack = truthEntry.truthTrack;
456 trackTruth.truthTrajectory = truthEntry.truthTrajectory;
458 std::vector<const Trk::MeasurementBase*>::const_iterator mit = measurements.begin();
459 std::vector<const Trk::MeasurementBase*>::const_iterator mit_end = measurements.end();
460 for (; mit != mit_end; ++mit) {
463 if (!meas) {
continue; }
472 if (!
id.is_valid() || !
m_idHelperSvc->mdtIdHelper().is_muon(
id))
continue;
475 addMdtTruth(trackTruth.mdts,
id, *meas, truthEntry.mdtHits);
489 addMissedHits(trackTruth.mdts, trackTruth.mdts.matchedHits, trackTruth.mdts.matchedChambers, truthEntry.mdtHits, restrictedTruth);
490 addMissedHits(trackTruth.cscs, trackTruth.cscs.matchedHits, trackTruth.cscs.matchedChambers, truthEntry.cscHits, restrictedTruth);
491 addMissedHits(trackTruth.rpcs, trackTruth.rpcs.matchedHits, trackTruth.rpcs.matchedChambers, truthEntry.rpcHits, restrictedTruth);
492 addMissedHits(trackTruth.tgcs, trackTruth.tgcs.matchedHits, trackTruth.tgcs.matchedChambers, truthEntry.tgcHits, restrictedTruth);
493 addMissedHits(trackTruth.stgcs, trackTruth.stgcs.matchedHits, trackTruth.stgcs.matchedChambers, truthEntry.stgcHits,
495 addMissedHits(trackTruth.mms, trackTruth.mms.matchedHits, trackTruth.mms.matchedChambers, truthEntry.mmHits, restrictedTruth);
◆ getTruth() [2/5]
◆ getTruth() [3/5]
get segment truth for a list of segments, the segments will be considered to belong to the same muon
Implements Muon::IMuonTrackTruthTool.
Definition at line 397 of file MuonTrackTruthTool.cxx.
399 std::set<Identifier>
ids;
400 std::vector<const Trk::MeasurementBase*> measurements;
401 std::vector<const MuonSegment*>::const_iterator sit = segments.begin();
402 std::vector<const MuonSegment*>::const_iterator sit_end = segments.end();
403 for (; sit != sit_end; ++sit) {
404 std::vector<const Trk::MeasurementBase*>::const_iterator mit = (*sit)->containedMeasurements().begin();
405 std::vector<const Trk::MeasurementBase*>::const_iterator mit_end = (*sit)->containedMeasurements().end();
406 for (; mit != mit_end; ++mit) {
415 if (!
id.is_valid() || !
m_idHelperSvc->mdtIdHelper().is_muon(
id))
continue;
416 if (
ids.count(
id))
continue;
417 measurements.push_back(meas);
◆ getTruth() [4/5]
get truth for a give set of hits.
If restrictedTruth is set to true only missed hits in chambers with hits will be counted.
Implements Muon::IMuonTrackTruthTool.
Definition at line 424 of file MuonTrackTruthTool.cxx.
426 MuonTrackTruth bestMatch;
427 bestMatch.truthTrack =
nullptr;
428 bestMatch.truthTrajectory =
nullptr;
430 unsigned int nmatchedHitsBest = 0;
434 for (;
tit != tit_end; ++
tit) {
435 unsigned int nhits =
tit->second.mdtHits.size() +
tit->second.cscHits.size() +
tit->second.rpcHits.size() +
436 tit->second.tgcHits.size() +
tit->second.stgcHits.size() +
tit->second.mmHits.size();
437 if (nhits == 0)
continue;
439 MuonTrackTruth trackTruth =
getTruth(measurements,
tit->second, restrictedTruth);
440 unsigned int nmatchedHits = trackTruth.numberOfMatchedHits();
441 ATH_MSG_DEBUG(
" performed truth match for particle with barcode: " <<
tit->first <<
" overlap " << nmatchedHits <<
" fraction "
442 << (
double)nmatchedHits / (
double)nhits);
443 if (nmatchedHits > 0 && nmatchedHits > nmatchedHitsBest) {
444 bestMatch = trackTruth;
445 nmatchedHitsBest = nmatchedHits;
◆ getTruth() [5/5]
◆ initialize()
StatusCode Muon::MuonTrackTruthTool::initialize |
( |
| ) |
|
◆ inputHandles()
Return this algorithm's input handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ interfaceID()
const InterfaceID & Muon::IMuonTrackTruthTool::interfaceID |
( |
| ) |
|
|
inlinestaticinherited |
◆ manipulateBarCode()
int Muon::MuonTrackTruthTool::manipulateBarCode |
( |
int |
barcode | ) |
const |
|
private |
◆ match() [1/2]
perform truth matching for a given set of segments
Implements Muon::IMuonTrackTruthTool.
Definition at line 96 of file MuonTrackTruthTool.cxx.
99 result.reserve(segments.size());
102 std::vector<const MuonSegment*>::const_iterator sit = segments.begin();
103 std::vector<const MuonSegment*>::const_iterator sit_end = segments.end();
104 for (; sit != sit_end; ++sit) {
◆ match() [2/2]
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ outputHandles()
Return this algorithm's output handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ renounce()
◆ renounceArray()
◆ selectPdg()
bool Muon::MuonTrackTruthTool::selectPdg |
( |
int |
pdg | ) |
const |
|
inlineprivate |
◆ sysInitialize()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
◆ m_detMgr
◆ m_detStore
◆ m_doSummary
Gaudi::Property<bool> Muon::MuonTrackTruthTool::m_doSummary {this, "DoSummary", false} |
|
private |
◆ m_evtStore
◆ m_idHelperSvc
◆ m_manipulateBarCode
Gaudi::Property<bool> Muon::MuonTrackTruthTool::m_manipulateBarCode {this, "ManipulateBarCode", false} |
|
private |
◆ m_matchAllParticles
Gaudi::Property<bool> Muon::MuonTrackTruthTool::m_matchAllParticles {this, "MatchAllParticles", true} |
|
private |
◆ m_minHits
Gaudi::Property<unsigned int> Muon::MuonTrackTruthTool::m_minHits {this, "MinHits", 4} |
|
private |
◆ m_pdgsToBeConsidered
Gaudi::Property<std::vector<int> > Muon::MuonTrackTruthTool::m_pdgsToBeConsidered {this, "ConsideredPDGs", {}} |
|
private |
◆ m_printer
◆ m_selectedPdgs
std::set<int> Muon::MuonTrackTruthTool::m_selectedPdgs |
|
private |
◆ m_truthTrajectoryBuilder
Initial value:{
this, "TruthTrajectoryBuilder", "Muon::MuonDecayTruthTrajectoryBuilder/MuonDecayTruthTrajectoryBuilder"}
Definition at line 144 of file MuonTrackTruthTool.h.
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
def retrieve(aClass, aKey=None)
JetConstituentVector::iterator iterator
const RpcReadoutElement * getRpcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Const iterator class for DataVector/DataList.
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)
bool msgLvl(const MSG::Level lvl) const
#define ATH_MSG_VERBOSE(x)
AtlasHitsVector< TrackRecord >::const_iterator TrackRecordConstIterator
const_iterator begin() const
void stable_sort(std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, std::reverse_iterator< DataModel_detail::iterator< DVL > > end, Compare comp)
Specialization of stable_sort for DataVector/List.
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual void setOwner(IDataHandleHolder *o)=0
const TgcReadoutElement * getTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Class to handle pseudo-measurements in fitters and on track objects.
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
GenParticle * barcode_to_particle(const GenEvent *e, int id)
const T * front() const
Access the first element in the collection as an rvalue.
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
const GenParticle * ConstGenParticlePtr
virtual const Trk::PrepRawData * prepRawData() const =0
returns the PrepRawData (also known as RIO) object to which this RIO_OnTrack is associated.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
#define ATH_MSG_WARNING(x)
const_iterator end() const
const MMReadoutElement * getMMReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Identifier identify() const
return the identifier -extends MeasurementBase
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
const sTgcReadoutElement * getsTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
size_type size() const noexcept
Returns the number of elements in the collection.
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
bool empty() const noexcept
Returns true if the collection is empty.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)