ATLAS Offline Software
Loading...
Searching...
No Matches
FPGATrackSimTrackMonitor Class Reference

#include <FPGATrackSimTrackMonitor.h>

Inheritance diagram for FPGATrackSimTrackMonitor:
Collaboration diagram for FPGATrackSimTrackMonitor:

Public Member Functions

 FPGATrackSimTrackMonitor (const std::string &, const std::string &, const IInterface *)
virtual StatusCode initialize () override
void fillRoad (const std::vector< std::shared_ptr< const FPGATrackSimRoad > > &roads, const std::vector< FPGATrackSimTruthTrack > &truthTracks, size_t nLogicalLayers)
void fillTrack (const std::vector< const FPGATrackSimTrack * > &tracks, const std::vector< FPGATrackSimTruthTrack > &truthTracks, float chi2Cut)
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< GenericMonitoringToolm_monTool {this,"MonTool", "", "Monitoring tool"}
Gaudi::Property< std::string > m_dir {this, "dir", {"/TRACKMON/"}, "String name of output directory"}
ServiceHandle< ITHistSvc > m_tHistSvc {this, "THistSvc", "THistSvc/THistSvc", "Histogramming service"}
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 37 of file FPGATrackSimTrackMonitor.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ FPGATrackSimTrackMonitor()

FPGATrackSimTrackMonitor::FPGATrackSimTrackMonitor ( const std::string & algname,
const std::string & name,
const IInterface * ifc )

Definition at line 19 of file FPGATrackSimTrackMonitor.cxx.

19 :
20 AthAlgTool(algname, name, ifc)
21{
23 ATH_MSG_INFO("constructor");
24}
#define ATH_MSG_INFO(x)
AthAlgTool()
Default constructor:

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

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

◆ fillRoad()

void FPGATrackSimTrackMonitor::fillRoad ( const std::vector< std::shared_ptr< const FPGATrackSimRoad > > & roads,
const std::vector< FPGATrackSimTruthTrack > & truthTracks,
size_t nLogicalLayers )

Definition at line 51 of file FPGATrackSimTrackMonitor.cxx.

54{
55 // overall number of roads
56 auto nRoads = Monitored::Scalar<int>("nRoads", roads.size());
57 // push them into the monitoring tool (this->MonTool set in python)
58 Monitored::Group(m_monTool, nRoads);
59
60 // return if no roads
61 if ( roads.empty() ) return;
62
63 // loop over all roads in the event
64 for (const auto& road : roads) {
65 // layerIDs
66 unsigned bitmask = road->getHitLayers();
67 for (size_t l = 0; l < nLogicalLayers; l++) {
68 if (bitmask & (1 << l)) {
69 auto mon_layerIDs = Monitored::Scalar<unsigned>("layerIDs",l);
70 Monitored::Group(m_monTool,mon_layerIDs);
71 }
72 }
73 // number of layers represented in this road
74 auto nLayers = Monitored::Scalar<int>("nLayers", road->getNLayers());
75 // push all of the above scalars into the monitoring tool
76 Monitored::Group(m_monTool, nLayers);
77 }
78
79 // only monitor efficiency for events with truth tracks
80 if (truthTracks.size() > 0) {
81 // use the first truth track (the primary one)
82 const auto& truthTrack = truthTracks.front();
83 // efficiency monitor
84 auto mon_eff = Monitored::Scalar<bool>("eff_road", (roads.size() > 0));
85 auto mon_truth_pt_zoom = Monitored::Scalar<float>("pT_zoom", truthTrack.getPt()*0.001);
86 auto mon_truth_pt = Monitored::Scalar<float>("pT", truthTrack.getPt()*0.001);
87 auto mon_truth_eta = Monitored::Scalar<float>("eta", truthTrack.getEta());
88 auto mon_truth_phi = Monitored::Scalar<float>("phi", truthTrack.getPhi());
89 auto mon_truth_d0 = Monitored::Scalar<float>("d0", truthTrack.getD0());
90 auto mon_truth_z0 = Monitored::Scalar<float>("z0", truthTrack.getZ0());
91 Monitored::Group( m_monTool, mon_eff, mon_truth_pt_zoom, mon_truth_pt, mon_truth_eta, mon_truth_phi, mon_truth_d0, mon_truth_z0 );
92 }
93}
ToolHandle< GenericMonitoringTool > m_monTool
l
Printing final latex table to .tex output file.

◆ fillTrack()

void FPGATrackSimTrackMonitor::fillTrack ( const std::vector< const FPGATrackSimTrack * > & tracks,
const std::vector< FPGATrackSimTruthTrack > & truthTracks,
float chi2Cut )

Definition at line 97 of file FPGATrackSimTrackMonitor.cxx.

100{
101 // overall number of tracks
102 auto nTracks = Monitored::Scalar<int>("nTracks", tracks.size());
103 // push them into the monitoring tool (this->MonTool set in python)
104 Monitored::Group(m_monTool, nTracks);
105
106 // return if no tracks
107 if ( tracks.empty() ) return;
108
109 // monitor chi2 for all tracks and find the best
110 float bestChi2 = chi2Cut;
111 // loop over all tracks in the event
112 for (const auto& track : tracks) {
113 float chi2 = track->getChi2ndof();
114 // only monitor tracks below chi2 cut
115 if (chi2 < chi2Cut) {
116 auto mon_chi2 = Monitored::Scalar<float>("chi2_all", chi2);
117 Monitored::Group(m_monTool, mon_chi2);
118 // update best chi2
119 if (chi2 < bestChi2) {
120 bestChi2 = chi2;
121 }
122 }
123 }
124 // monitor the best chi2 found
125 if (bestChi2 < chi2Cut) {
126 auto mon_best_chi2 = Monitored::Scalar<float>("best_chi2", bestChi2);
127 Monitored::Group(m_monTool, mon_best_chi2);
128 }
129
130 // only monitor efficiency for events with truth tracks
131 if (truthTracks.size() > 0) {
132 // use the first truth track (the primary one)
133 const auto& truthTrack = truthTracks.front();
134 // efficiency monitor
135 auto mon_eff = Monitored::Scalar<bool>("eff_track", (tracks.size() > 0));
136 auto mon_truth_pt_zoom = Monitored::Scalar<float>("pT_zoom", truthTrack.getPt()*0.001);
137 auto mon_truth_pt = Monitored::Scalar<float>("pT", truthTrack.getPt()*0.001f);
138 auto mon_truth_eta = Monitored::Scalar<float>("eta", truthTrack.getEta());
139 auto mon_truth_phi = Monitored::Scalar<float>("phi", truthTrack.getPhi());
140 auto mon_truth_d0 = Monitored::Scalar<float>("d0", truthTrack.getD0());
141 auto mon_truth_z0 = Monitored::Scalar<float>("z0", truthTrack.getZ0());
142 Monitored::Group( m_monTool, mon_eff, mon_truth_pt_zoom, mon_truth_pt, mon_truth_eta, mon_truth_phi, mon_truth_d0, mon_truth_z0 );
143 }
144}
double chi2(TH1 *h0, TH1 *h1)

◆ initialize()

StatusCode FPGATrackSimTrackMonitor::initialize ( )
overridevirtual

Definition at line 27 of file FPGATrackSimTrackMonitor.cxx.

28{
29 // print all configured properties (debugging)
30 auto props = this->getProperties();
31 for( Gaudi::Details::PropertyBase* prop : props ) {
32 if (prop->ownerTypeName()==this->type()) {
33 ATH_MSG_DEBUG("Property:\t" << prop->name() << "\t : \t" << prop->toString());
34 }
35 }
36 ATH_MSG_INFO("Initialize Track Monitoring");
37
39 ATH_CHECK(m_tHistSvc.retrieve());
40
41 return StatusCode::SUCCESS;
42
43}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
ServiceHandle< ITHistSvc > m_tHistSvc

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

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.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

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()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_dir

Gaudi::Property<std::string> FPGATrackSimTrackMonitor::m_dir {this, "dir", {"/TRACKMON/"}, "String name of output directory"}
private

Definition at line 72 of file FPGATrackSimTrackMonitor.h.

72{this, "dir", {"/TRACKMON/"}, "String name of output directory"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_monTool

ToolHandle<GenericMonitoringTool> FPGATrackSimTrackMonitor::m_monTool {this,"MonTool", "", "Monitoring tool"}
private

Definition at line 69 of file FPGATrackSimTrackMonitor.h.

69{this,"MonTool", "", "Monitoring tool"};

◆ m_tHistSvc

ServiceHandle<ITHistSvc> FPGATrackSimTrackMonitor::m_tHistSvc {this, "THistSvc", "THistSvc/THistSvc", "Histogramming service"}
private

Definition at line 76 of file FPGATrackSimTrackMonitor.h.

76{this, "THistSvc", "THistSvc/THistSvc", "Histogramming service"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: