|
ATLAS Offline Software
|
Tool to fill basic information about the truth record.
More...
#include <TruthNtupleTool.h>
|
| TruthNtupleTool (const std::string &, const std::string &, const IInterface *) |
|
| ~TruthNtupleTool () |
|
StatusCode | initialize () |
|
StatusCode | finalize () |
| finalize More...
|
|
virtual StatusCode | writeTruthData (const std::vector< Trk::ValidationTrackTruthData > &truthData) |
| write track data to ntuple More...
|
|
virtual unsigned int | getNumberOfTreeRecords () const |
|
virtual StatusCode | initBranches (const std::vector< const Trk::ITrackTruthClassifier * > &classifiers, bool, const std::vector< std::string > &trackCollectionNames) |
|
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 |
|
Tool to fill basic information about the truth record.
It is called directly by the ntuple writer but provides information also
for particles which have failed to be reconstructed. Furthermore it manages
indices to link to ntuple entries of the associated reconstructed particles.
- Author
- Sebastian.Fleischmann -at- cern.ch, Wolfgang.Liebig -at- cern.ch
Definition at line 46 of file TruthNtupleTool.h.
◆ StoreGateSvc_t
◆ TruthNtupleTool()
Trk::TruthNtupleTool::TruthNtupleTool |
( |
const std::string & |
t, |
|
|
const std::string & |
n, |
|
|
const IInterface * |
p |
|
) |
| |
◆ ~TruthNtupleTool()
Trk::TruthNtupleTool::~TruthNtupleTool |
( |
| ) |
|
|
default |
◆ 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
◆ finalize()
StatusCode Trk::TruthNtupleTool::finalize |
( |
| ) |
|
finalize
Definition at line 189 of file TruthNtupleTool.cxx.
197 for (
unsigned int clIndex = 0; clIndex <
m_trackTruthClassifiers[classifierIndex]->numberOfClassifiers(); clIndex++) {
200 msg() << std::resetiosflags(std::ios::right) << std::setiosflags(std::ios::left) << std::setw(15) <<
m_trackTruthClassifiers[classifierIndex]->classificationAsString(clIndex);
201 msg() << std::resetiosflags(std::ios::left) << std::setiosflags(std::ios::right);
205 msg() << std::resetiosflags(std::ios::fixed | std::ios::showpoint) << std::setprecision(8) << std::setw(8) <<
reco <<
"/" << std::setw(8) << truth;
206 msg() << std::setiosflags(std::ios::fixed | std::ios::showpoint | std::ios::right ) << std::setw(7)
207 <<
" (" << std::setprecision(4) << (truth>0. ?
reco/truth : 0.) <<
")";
212 std::string graphName =
"trackEff_" +
m_trackTruthClassifiers[classifierIndex]->classificationAsString(clIndex);
213 effPlot->SetNameTitle(graphName.c_str(), graphName.c_str());
229 for (
unsigned int trackColIndex = 0; trackColIndex <
m_TrackLinkIndex.size(); ++trackColIndex ) {
233 return StatusCode::SUCCESS;
◆ getNumberOfTreeRecords()
unsigned int Trk::TruthNtupleTool::getNumberOfTreeRecords |
( |
| ) |
const |
|
virtual |
◆ initBranches()
Implements Trk::ITruthNtupleTool.
Definition at line 125 of file TruthNtupleTool.cxx.
139 for (
unsigned int classifierIndex = 0; classifierIndex < classifiers.size(); ++classifierIndex ) {
140 if (!(classifiers[classifierIndex])) {
141 ATH_MSG_ERROR (
"Got NULL pointer to truth classifier tool!");
142 return StatusCode::FAILURE;
144 std::string classifierName = classifiers[classifierIndex]->nameOfClassifier();
147 std::string branchName =
"Class_" + classifierName;
148 std::string branchDescription =
"Class_" + classifierName +
"/I";
151 for (
unsigned int clIndex = 0; clIndex < classifiers[classifierIndex]->numberOfClassifiers(); clIndex++) {
153 (
"true"+classifiers[classifierIndex]->classificationAsString(clIndex)).c_str(),
154 (
"true"+classifiers[classifierIndex]->classificationAsString(clIndex)).c_str(),
160 (
"reco"+classifiers[classifierIndex]->classificationAsString(clIndex)).c_str(),
161 (
"reco"+classifiers[classifierIndex]->classificationAsString(clIndex)).c_str(),
170 ATH_MSG_ERROR (
"Track links seem to be already initialized! Do NOT call initBranches() twice!");
171 return StatusCode::FAILURE;
174 m_mc_prob.resize(trackCollectionNames.size(),
nullptr);
175 for (
unsigned int trackColIndex = 0; trackColIndex < trackCollectionNames.size(); ++trackColIndex ) {
177 std::string branchName =
"TrackLinkIndex_" + trackCollectionNames[trackColIndex];
179 m_mc_prob[trackColIndex] =
new std::vector<float>();
180 branchName =
"truth_prob_" + trackCollectionNames[trackColIndex];
181 m_nt->Branch(branchName.c_str(), &(
m_mc_prob[trackColIndex]));
183 return StatusCode::SUCCESS;
◆ initialize()
StatusCode Trk::TruthNtupleTool::initialize |
( |
| ) |
|
Definition at line 81 of file TruthNtupleTool.cxx.
87 return StatusCode::FAILURE;
121 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()
const InterfaceID & Trk::ITruthNtupleTool::interfaceID |
( |
| ) |
|
|
inlinestaticinherited |
Interface ID, declared here, and defined below.
Definition at line 71 of file ITruthNtupleTool.h.
72 return IID_ITruthNtupleTool;
◆ 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()
◆ 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()
◆ writeTruthData()
write track data to ntuple
Implements Trk::ITruthNtupleTool.
Definition at line 239 of file TruthNtupleTool.cxx.
242 ATH_MSG_DEBUG (
"in writeTruthData(...) with ValTrackTruthData size = "<<truthData.size());
246 if (!
evt.isValid()) {
248 return StatusCode::FAILURE;
257 genParticle = truthData[
index].genParticle;
258 truePerigee = truthData[
index].truthPerigee;
259 if (genParticle==
nullptr || truePerigee==
nullptr) {
261 ", problem with truth selection logic?");
264 for (
unsigned int trackColIndex = 0; trackColIndex <
m_mc_prob.size(); ++trackColIndex ) {
293 m_mc_prodR = fabs(genParticle->production_vertex()->position().perp());
294 m_mc_prodz = fabs(genParticle->production_vertex()->position().z());
296 for (
unsigned int trackColIndex = 0; trackColIndex < truthData[
index].truthToTrackIndices.size(); ++trackColIndex ) {
298 (*(
m_mc_prob[trackColIndex])) = truthData[
index].truthToTrackMatchingProbabilities[trackColIndex];
307 for (
unsigned int classIndex = 0; classIndex <
m_classifications.size(); ++classIndex ) {
309 if (!truthData[
index].truthToTrackIndices[0].
empty()) {
321 return StatusCode::SUCCESS;
◆ m_classifications
std::vector<unsigned int> Trk::TruthNtupleTool::m_classifications |
|
private |
◆ m_detStore
◆ m_etaBins
std::vector<double> Trk::TruthNtupleTool::m_etaBins |
|
private |
◆ m_eventNumber
int Trk::TruthNtupleTool::m_eventNumber |
|
private |
◆ m_evt
◆ m_evtStore
◆ m_fillJets
bool Trk::TruthNtupleTool::m_fillJets |
|
private |
◆ m_histSvc
◆ m_mc_d0
float Trk::TruthNtupleTool::m_mc_d0 |
|
private |
◆ m_mc_energy
float Trk::TruthNtupleTool::m_mc_energy |
|
private |
◆ m_mc_eta
float Trk::TruthNtupleTool::m_mc_eta |
|
private |
◆ m_mc_jetLinkIndex
int Trk::TruthNtupleTool::m_mc_jetLinkIndex |
|
private |
link to jet this particle belongs to (if jet tree is ON)
Definition at line 97 of file TruthNtupleTool.h.
◆ m_mc_particleID
int Trk::TruthNtupleTool::m_mc_particleID |
|
private |
◆ m_mc_phi0
float Trk::TruthNtupleTool::m_mc_phi0 |
|
private |
◆ m_mc_prob
std::vector< std::vector<float>* > Trk::TruthNtupleTool::m_mc_prob |
|
private |
◆ m_mc_prodR
float Trk::TruthNtupleTool::m_mc_prodR |
|
private |
◆ m_mc_prodz
float Trk::TruthNtupleTool::m_mc_prodz |
|
private |
◆ m_mc_qOverP
float Trk::TruthNtupleTool::m_mc_qOverP |
|
private |
◆ m_mc_qOverPt
float Trk::TruthNtupleTool::m_mc_qOverPt |
|
private |
◆ m_mc_theta
float Trk::TruthNtupleTool::m_mc_theta |
|
private |
◆ m_mc_uniqueID
int Trk::TruthNtupleTool::m_mc_uniqueID |
|
private |
◆ m_mc_z0
float Trk::TruthNtupleTool::m_mc_z0 |
|
private |
◆ m_nt
TTree* Trk::TruthNtupleTool::m_nt |
|
private |
◆ m_ntupleFileName
std::string Trk::TruthNtupleTool::m_ntupleFileName |
|
private |
◆ m_ntupleTreeName
std::string Trk::TruthNtupleTool::m_ntupleTreeName |
|
private |
◆ m_numberOfTreeEntries
unsigned int Trk::TruthNtupleTool::m_numberOfTreeEntries |
|
private |
◆ m_recoTrackCounts
std::vector< std::vector<TH1D*> > Trk::TruthNtupleTool::m_recoTrackCounts |
|
private |
◆ m_runNumber
int Trk::TruthNtupleTool::m_runNumber |
|
private |
◆ m_TrackLinkIndex
std::vector< std::vector<unsigned int>* > Trk::TruthNtupleTool::m_TrackLinkIndex |
|
private |
◆ m_trackTruthClassifiers
◆ m_truthTrackCounts
std::vector< std::vector<TH1D*> > Trk::TruthNtupleTool::m_truthTrackCounts |
|
private |
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
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
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin
::StatusCode StatusCode
StatusCode definition for legacy code.
void fillJets(JetContainer &jetCont, const std::vector< xAOD::JetFourMom_t > &jet4moms)
Fill input JetContainer with new jets which 4-momentum are given by jet4moms.
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
virtual void renounce()=0
constexpr int UNDEFINED_ID
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
const GenParticle * ConstGenParticlePtr
#define ATH_MSG_WARNING(x)
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
double eta() const
Access method for pseudorapidity - from momentum.
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>