Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Interface for tools calculating hit count summaries for track.
More...
#include <MuonTruthSummaryTool.h>
|
| MuonTruthSummaryTool (const std::string &t, const std::string &n, const IInterface *p) |
| Constructor. More...
|
|
StatusCode | initialize () |
|
StatusCode | finalize () |
|
void | clear () |
| clear tool More...
|
|
void | init () const |
| init truth More...
|
|
int | getBarcode (const Identifier &id) const |
| get the associated barcode for the identifier, return -1 if the channel was not hit by a muon More...
|
|
int | getPdgId (int barcode) const |
| get the associated pdgId for a given barcode More...
|
|
void | add (const Identifier &id, int level) const |
| add identifier More...
|
|
void | add (const MuonSegment &seg, int level) const |
| add segment More...
|
|
void | add (const Trk::Track &track, int level) const |
| add track More...
|
|
std::string | printSummary () |
| print summary More...
|
|
void | handle (const Incident &inc) |
|
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 |
|
Interface for tools calculating hit count summaries for track.
Definition at line 39 of file MuonTruthSummaryTool.h.
◆ StoreGateSvc_t
◆ MuonTruthSummaryTool()
Muon::MuonTruthSummaryTool::MuonTruthSummaryTool |
( |
const std::string & |
t, |
|
|
const std::string & |
n, |
|
|
const IInterface * |
p |
|
) |
| |
◆ add() [1/4]
void Muon::MuonTruthSummaryTool::add |
( |
const Identifier & |
id, |
|
|
int |
level |
|
) |
| const |
|
virtual |
◆ add() [2/4]
void Muon::MuonTruthSummaryTool::add |
( |
const MuonSegment & |
seg, |
|
|
int |
level |
|
) |
| const |
|
virtual |
◆ add() [3/4]
add measurements
Definition at line 137 of file MuonTruthSummaryTool.cxx.
138 std::scoped_lock lock(
m_mutex);
139 for (std::vector<const Trk::MeasurementBase*>::const_iterator
it = measurements.begin();
it != measurements.end(); ++
it) {
◆ add() [4/4]
void Muon::MuonTruthSummaryTool::add |
( |
const Trk::Track & |
track, |
|
|
int |
level |
|
) |
| const |
|
virtual |
◆ clear()
void Muon::MuonTruthSummaryTool::clear |
( |
| ) |
|
|
virtual |
◆ clearChamberVariables()
void Muon::MuonTruthSummaryTool::clearChamberVariables |
( |
const unsigned int |
level | ) |
|
|
private |
◆ 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
◆ fillChamberVariables()
void Muon::MuonTruthSummaryTool::fillChamberVariables |
( |
const Identifier & |
chamberId, |
|
|
const unsigned int |
numMissedHits |
|
) |
| |
|
private |
◆ finalize()
StatusCode Muon::MuonTruthSummaryTool::finalize |
( |
| ) |
|
◆ getBarcode()
◆ getPdgId()
int Muon::MuonTruthSummaryTool::getPdgId |
( |
int |
barcode | ) |
const |
|
virtual |
◆ handle()
void Muon::MuonTruthSummaryTool::handle |
( |
const Incident & |
inc | ) |
|
◆ init()
void Muon::MuonTruthSummaryTool::init |
( |
| ) |
const |
|
virtual |
init truth
Implements Muon::IMuonTruthSummaryTool.
Definition at line 84 of file MuonTruthSummaryTool.cxx.
88 if (!
col.isValid() || !
col.isPresent())
continue;
90 PRD_MultiTruthCollection::const_iterator
it =
col->begin();
91 PRD_MultiTruthCollection::const_iterator it_end =
col->end();
92 for (;
it != it_end; ++
it) {
96 m_truthHits[
it->first] = bc;
97 m_pdgIdLookupFromBarcode[bc] = link.
cptr()->pdg_id();
103 ATH_MSG_DEBUG(
" Total collected muon truth hits " << m_truthHits.size());
◆ initChamberVariables()
void Muon::MuonTruthSummaryTool::initChamberVariables |
( |
const unsigned int |
levels | ) |
|
|
private |
◆ initialize()
StatusCode Muon::MuonTruthSummaryTool::initialize |
( |
| ) |
|
Definition at line 34 of file MuonTruthSummaryTool.cxx.
49 std::string treePathAndName(
"/");
51 treePathAndName +=
"/";
60 ATH_MSG_WARNING(
"SelectedPdgId should be positive, taking the absolute value");
68 return StatusCode::SUCCESS;
◆ 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()
static const InterfaceID& Muon::IMuonTruthSummaryTool::interfaceID |
( |
| ) |
|
|
inlinestaticinherited |
IAlgTool interface.
Definition at line 22 of file IMuonTruthSummaryTool.h.
23 static const InterfaceID IID_IMuonTruthSummaryTool(
"Muon::IMuonTruthSummaryTool", 1, 0);
24 return IID_IMuonTruthSummaryTool;
◆ 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.
◆ printSummary() [1/2]
std::string Muon::MuonTruthSummaryTool::printSummary |
( |
| ) |
|
|
virtual |
print summary
Implements Muon::IMuonTruthSummaryTool.
Definition at line 145 of file MuonTruthSummaryTool.cxx.
146 std::scoped_lock lock(
m_mutex);
147 if (m_truthHits.empty())
return "Event without truth hits";
148 if (m_truthDataPerLevel.empty())
return "No hits added";
149 std::ostringstream sout;
150 sout <<
"Have " << m_truthHits.size() <<
" truth hits and " << m_truthDataPerLevel.size() <<
" levels filled." << std::endl;
152 std::unordered_set<Identifier, IdentifierHash> truthHits;
153 for (
auto it = m_truthHits.begin();
it != m_truthHits.end(); ++
it) truthHits.insert(
it->first);
155 m_truthHitsTotal += truthHits.size();
156 sout <<
" Summarizing: truth hits " << truthHits.size() <<
" levels filled " << m_truthDataPerLevel.size() << std::endl;
157 for (
auto& pair : m_truthDataPerLevel) {
160 sout <<
" Comparing truth to level " <<
m_level << std::endl <<
printSummary(truthHits, pair.second);
164 std::cout <<
"About to try to fill try tree " <<
m_tree->GetName() << std::endl;
◆ printSummary() [2/2]
Definition at line 172 of file MuonTruthSummaryTool.cxx.
174 std::scoped_lock lock(
m_mutex);
175 std::ostringstream sout;
176 if (truth.size() !=
found.size()) {
177 sout <<
" Some truth hits not found: truth " << truth.size() <<
" found " <<
found.size() << std::endl;
178 std::set<Identifier> truthset(truth.begin(), truth.end());
179 std::set<Identifier> foundset(
found.begin(),
found.end());
180 std::vector<Identifier>
result(truth.size() -
found.size());
182 std::set_difference(truthset.begin(), truthset.end(), foundset.begin(), foundset.end(),
result.begin());
185 std::map<Identifier, unsigned int> chambers;
186 unsigned int hitNum = 0;
188 sout << hitNum++ <<
":\t" <<
m_idHelperSvc->toString(*
it) << std::endl;
192 if (nmm > 4) sout <<
" possible missing MM segment : " << nmm << std::endl;
194 sout << std::endl <<
"++++ Chamber summaries:" << std::endl;
195 for (
auto chamber : chambers) {
201 sout <<
" All hits found: truth " << truth.size() <<
" found " <<
found.size() << std::endl;
◆ renounce()
◆ renounceArray()
◆ 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()
◆ ATLAS_THREAD_SAFE [1/4]
std::unordered_map<int, int> m_pdgIdLookupFromBarcode Muon::MuonTruthSummaryTool::ATLAS_THREAD_SAFE |
|
mutableprivate |
◆ ATLAS_THREAD_SAFE [2/4]
◆ ATLAS_THREAD_SAFE [3/4]
std::unordered_map<int, std::unordered_set<Identifier, IdentifierHash> > m_truthDataPerLevel Muon::MuonTruthSummaryTool::ATLAS_THREAD_SAFE |
|
mutableprivate |
◆ ATLAS_THREAD_SAFE [4/4]
unsigned int m_truthHitsTotal Muon::MuonTruthSummaryTool::ATLAS_THREAD_SAFE |
|
mutableprivate |
◆ m_detStore
◆ m_edmHelperSvc
Initial value:{
this,
"edmHelper",
"Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
"Handle to the service providing the IMuonEDMHelperSvc interface",
}
Definition at line 89 of file MuonTruthSummaryTool.h.
◆ m_evtStore
◆ m_histStream
std::string Muon::MuonTruthSummaryTool::m_histStream |
|
private |
◆ m_idHelperSvc
Initial value:{
this,
"MuonIdHelperSvc",
"Muon::MuonIdHelperSvc/MuonIdHelperSvc",
}
Definition at line 84 of file MuonTruthSummaryTool.h.
◆ m_incidentSvc
ServiceHandle<IIncidentSvc> Muon::MuonTruthSummaryTool::m_incidentSvc |
|
private |
◆ m_level
unsigned int Muon::MuonTruthSummaryTool::m_level |
|
private |
◆ m_lossesPerLevel
std::unordered_map<int, unsigned int> Muon::MuonTruthSummaryTool::m_lossesPerLevel |
|
private |
◆ m_missedHitStationEta
std::vector<std::vector<int>*> Muon::MuonTruthSummaryTool::m_missedHitStationEta |
|
private |
◆ m_missedHitStationNameIndex
std::vector<std::vector<int>*> Muon::MuonTruthSummaryTool::m_missedHitStationNameIndex |
|
private |
◆ m_missedHitStationPhi
std::vector<std::vector<int>*> Muon::MuonTruthSummaryTool::m_missedHitStationPhi |
|
private |
◆ m_missedHitStationSector
std::vector<std::vector<int>*> Muon::MuonTruthSummaryTool::m_missedHitStationSector |
|
private |
◆ m_missedHitTechnologyIndex
std::vector<std::vector<uint8_t>*> Muon::MuonTruthSummaryTool::m_missedHitTechnologyIndex |
|
private |
◆ m_mutex
std::recursive_mutex Muon::MuonTruthSummaryTool::m_mutex |
|
mutableprivate |
◆ m_numChambers
std::vector<unsigned int> Muon::MuonTruthSummaryTool::m_numChambers |
|
private |
◆ m_numMissedHits
std::vector<std::vector<uint8_t>*> Muon::MuonTruthSummaryTool::m_numMissedHits |
|
private |
◆ m_printer
Initial value:{
this,
"Printer",
"Muon::MuonEDMPrinterTool/MuonEDMPrinterTool",
}
Definition at line 97 of file MuonTruthSummaryTool.h.
◆ m_selectedPdgId
int Muon::MuonTruthSummaryTool::m_selectedPdgId |
|
private |
◆ m_thistSvc
◆ m_tree
TTree* Muon::MuonTruthSummaryTool::m_tree |
|
private |
◆ m_treeName
std::string Muon::MuonTruthSummaryTool::m_treeName |
|
private |
◆ m_TruthNames
Initial value:{
this, "TruthNames", {"RPC_TruthMap", "TGC_TruthMap", "MDT_TruthMap"}, "truth names"}
Definition at line 105 of file MuonTruthSummaryTool.h.
◆ m_varHandleArraysDeclared
◆ m_vhka
◆ m_wasInit
std::atomic<bool> Muon::MuonTruthSummaryTool::m_wasInit |
|
mutableprivate |
◆ m_writeTree
bool Muon::MuonTruthSummaryTool::m_writeTree |
|
private |
The documentation for this class was generated from the following files:
JetConstituentVector::iterator iterator
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
#define ATH_MSG_VERBOSE(x)
virtual void setOwner(IDataHandleHolder *o)=0
HepMC::ConstGenParticlePtr cptr() const
Dereference.
a link optimized in size for a GenParticle in a McEventCollection
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
std::string to_string(const DetectorType &type)
const PtrVector & stdcont() const
Return the underlying std::vector of the container.
#define ATH_MSG_WARNING(x)
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>