ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::EventPropertyNtupleTool Class Reference

#include <EventPropertyNtupleTool.h>

Inheritance diagram for Trk::EventPropertyNtupleTool:
Collaboration diagram for Trk::EventPropertyNtupleTool:

Public Member Functions

 EventPropertyNtupleTool (const std::string &, const std::string &, const IInterface *)
 ~EventPropertyNtupleTool ()
StatusCode initialize ()
StatusCode finalize ()
virtual void registerTrackCollections (const std::vector< std::string > &, bool)
 method not active in this tool
virtual void setTrackTreeIndices (unsigned int, int, int)
 method not active in this tool
virtual void setGenParticleTreeIndices (int, int)
 method not active in this tool
virtual StatusCode addNtupleItems (TTree *, const std::string &)
 add branches to the tree Should be called once dunring the initialisation phase by the calling algorithm (usually Trk::TrackValidationNtupleWriter)
virtual StatusCode fillEventData ()
 calculate event-wide data and copy into TTree branches, but don't write the record yet.
virtual StatusCode resetVariables ()
 reset ntuple variables (mainly for vectors which need to be cleared)
virtual bool isTrackLinkTool () const
 is True if instance is Tool which links events property to Trk::Tracks
virtual bool isTrkParticleLinkTool () const
 is True if instance is Tool which links events property to Rec::TrkParticle
virtual bool isTrkParticleTrigLinkTool () const
 is True if instance is Tool which links events property to Rec::TrkParticle recieved useing TrigDecTool
virtual bool isInDetTrackTrigLinkTool () const
 is True if instance is Tool which links events property to Rec::TrkParticle recieved useing TrigDecTool
virtual bool isEvtPropertyTool () const
 is True if instance is EventPropertyTool
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

Static Public Member Functions

static const InterfaceID & interfaceID ()
 Interface ID, declared here, and defined below*‍/.

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

bool m_doTriggerInfo
bool m_doTrtPhase
std::string m_comTimeName
int m_runNumber
 run number this event belongs to
int m_eventNumber
 event number
float m_tdc_phase
 event phase in cosmic events (optional) UNIT:nsec
int m_trigLvl1Type
 level 1 trigger type bitted word (2008: equivalent with stream) UNIT:8-bit
std::vector< unsigned int > * m_trigLvl1TAV
 level 1 trigger-after-veto info (256 bits in vector) UNIT:bitted
int m_lumiBlock
 lumi block number of current event
int m_timeStamp
 time stamp of current event
int m_bCID
 bunch crossing ID for current event
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 30 of file EventPropertyNtupleTool.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

◆ EventPropertyNtupleTool()

EventPropertyNtupleTool::EventPropertyNtupleTool ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 26 of file EventPropertyNtupleTool.cxx.

30 :
31 AthAlgTool(t,n,p),
32 m_doTriggerInfo(true),
33 m_doTrtPhase(false),
34 m_comTimeName("TRT_Phase"),
35 m_runNumber(0),
37 m_tdc_phase(0),
39 m_trigLvl1TAV(nullptr),
40 m_lumiBlock(0),
41 m_timeStamp(0),
42 m_bCID (0)
43
44{
45 declareInterface<IEventPropertyNtupleTool>(this);
46 declareProperty("FillTrtPhase",m_doTrtPhase);
47 declareProperty("FillTrigger",m_doTriggerInfo);
48}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
int m_trigLvl1Type
level 1 trigger type bitted word (2008: equivalent with stream) UNIT:8-bit
std::vector< unsigned int > * m_trigLvl1TAV
level 1 trigger-after-veto info (256 bits in vector) UNIT:bitted
float m_tdc_phase
event phase in cosmic events (optional) UNIT:nsec
int m_lumiBlock
lumi block number of current event
int m_runNumber
run number this event belongs to
int m_timeStamp
time stamp of current event
int m_bCID
bunch crossing ID for current event

◆ ~EventPropertyNtupleTool()

EventPropertyNtupleTool::~EventPropertyNtupleTool ( )
default

Member Function Documentation

◆ addNtupleItems()

StatusCode EventPropertyNtupleTool::addNtupleItems ( TTree * tree,
const std::string &  )
virtual

add branches to the tree Should be called once dunring the initialisation phase by the calling algorithm (usually Trk::TrackValidationNtupleWriter)

Implements Trk::IEventPropertyNtupleTool.

Definition at line 66 of file EventPropertyNtupleTool.cxx.

66 {
67 if (!tree) return StatusCode::FAILURE;
68 //-----------------
69 // add items
70 tree->Branch("RunNumber", &m_runNumber, "RunNumber/I");
71 tree->Branch("EventNumber", &m_eventNumber, "EventNumber/I");
72 tree->Branch("LumiBlockN", &m_lumiBlock, "LumiBlockN/I");
73 tree->Branch("TimeStamp", &m_timeStamp, "TimeStamp/I");
74 tree->Branch("BCID", &m_bCID, "BCID/I");
75 if (m_doTrtPhase) {
76 tree->Branch("TRT_Phase", &m_tdc_phase, "TRT_Phase/F");
77 }
78 if (m_doTriggerInfo) {
79 tree->Branch("Trig_LVL1StreamType", &m_trigLvl1Type,"Trig_LVL1StreamType/I");
80 tree->Branch("Trig_LVL1InfoTAV", &m_trigLvl1TAV);
81 }
82 return StatusCode::SUCCESS;
83}
TChain * tree

◆ 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 }

◆ 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

◆ fillEventData()

StatusCode EventPropertyNtupleTool::fillEventData ( )
virtual

calculate event-wide data and copy into TTree branches, but don't write the record yet.

Implements Trk::IEventPropertyNtupleTool.

Definition at line 85 of file EventPropertyNtupleTool.cxx.

85 {
86 const EventInfo* eventInfo;
87 if ((evtStore()->retrieve(eventInfo)).isFailure()) {
88 msg(MSG::WARNING) << "Could not retrieve event info" << endmsg;
89 m_runNumber = -999;
90 m_eventNumber = -999;
91 m_timeStamp = -999;
92 m_lumiBlock = -999;
93 m_bCID = -999;
94 return StatusCode::SUCCESS;
95 } else {
96 const EventID* myEventID=eventInfo->event_ID();
97 m_runNumber = myEventID->run_number();
98 m_eventNumber = myEventID->event_number();
99 m_timeStamp = myEventID->time_stamp() ;
100 m_lumiBlock = myEventID->lumi_block() ;
101 m_bCID = myEventID->bunch_crossing_id() ;
102 }
103
104 if (m_doTrtPhase) {
105 const ComTime* comtime=nullptr;
106
108 StatusCode sc = evtStore()->retrieve(comtime,m_comTimeName);
109 if (sc.isFailure() || !comtime) {
110 ATH_MSG_WARNING ("Could not find the ComTime object with name "<< m_comTimeName);
111 } else {
112 m_tdc_phase = comtime->getTime();
113 }
114 } else {
115 ATH_MSG_WARNING ("Could not find the ComTime object with name "<< m_comTimeName);
116 return StatusCode::FAILURE;
117 }
118 }
119
120 if (m_doTriggerInfo) {
121 const TriggerInfo* myTriggerInfo=eventInfo->trigger_info();
122 if (myTriggerInfo!=nullptr) {
123 m_trigLvl1Type = myTriggerInfo->level1TriggerType();
124 std::vector<unsigned int> l1trigger = myTriggerInfo->level1TriggerInfo();
125 if (l1trigger.size() == 24) { // size is 0 if trigger not simulated.
126 m_trigLvl1TAV->resize(8);
127 for (int i=0; i<8; ++i) {
128 m_trigLvl1TAV->at(i) = l1trigger.at(i+16);
129 }
130 }
131 } else m_trigLvl1Type = -1000;
132 }
133
134 return StatusCode::SUCCESS;
135
136 // remember calling algo is the one to record the content on the tree.
137}
#define endmsg
#define ATH_MSG_WARNING(x)
static Double_t sc
ServiceHandle< StoreGateSvc > & evtStore()
MsgStream & msg() const
double getTime() const
Definition ComTime.h:44
EventID * event_ID()
the unique identification of the event.
TriggerInfo * trigger_info()
trigger information (ptr may be NULL)
number_type level1TriggerType() const
get level1 trigger type
const std::vector< number_type > & level1TriggerInfo() const
get level1 trigger info
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:114
::StatusCode StatusCode
StatusCode definition for legacy code.
retrieve(aClass, aKey=None)
Definition PyKernel.py:110
EventInfo_v1 EventInfo
Definition of the latest event info version.

◆ finalize()

StatusCode EventPropertyNtupleTool::finalize ( )

Definition at line 59 of file EventPropertyNtupleTool.cxx.

59 {
60 delete m_trigLvl1TAV;
61 ATH_MSG_DEBUG ("finalize successfull in "<<name());
62 return StatusCode::SUCCESS;
63}
#define ATH_MSG_DEBUG(x)

◆ initialize()

StatusCode EventPropertyNtupleTool::initialize ( )

Definition at line 53 of file EventPropertyNtupleTool.cxx.

53 {
54 m_trigLvl1TAV = new std::vector<unsigned int>();
55 ATH_MSG_DEBUG ("initialise successful in "<<name());
56 return AthAlgTool::initialize();
57}

◆ 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.

◆ interfaceID()

const InterfaceID & Trk::IEventPropertyNtupleTool::interfaceID ( )
inlinestaticinherited

Interface ID, declared here, and defined below*‍/.

Definition at line 77 of file IEventPropertyNtupleTool.h.

77 {
79}
static const InterfaceID IID_IEventPropertyNtupleTool("IEventPropertyNtupleTool", 1, 0)

◆ isEvtPropertyTool()

virtual bool Trk::EventPropertyNtupleTool::isEvtPropertyTool ( ) const
inlinevirtual

is True if instance is EventPropertyTool

Implements Trk::IEventPropertyNtupleTool.

Definition at line 67 of file EventPropertyNtupleTool.h.

67{return true;}

◆ isInDetTrackTrigLinkTool()

virtual bool Trk::EventPropertyNtupleTool::isInDetTrackTrigLinkTool ( ) const
inlinevirtual

is True if instance is Tool which links events property to Rec::TrkParticle recieved useing TrigDecTool

Implements Trk::IEventPropertyNtupleTool.

Definition at line 65 of file EventPropertyNtupleTool.h.

65{return false;}

◆ isTrackLinkTool()

virtual bool Trk::EventPropertyNtupleTool::isTrackLinkTool ( ) const
inlinevirtual

is True if instance is Tool which links events property to Trk::Tracks

Implements Trk::IEventPropertyNtupleTool.

Definition at line 59 of file EventPropertyNtupleTool.h.

59{ return false;}

◆ isTrkParticleLinkTool()

virtual bool Trk::EventPropertyNtupleTool::isTrkParticleLinkTool ( ) const
inlinevirtual

is True if instance is Tool which links events property to Rec::TrkParticle

Implements Trk::IEventPropertyNtupleTool.

Definition at line 61 of file EventPropertyNtupleTool.h.

61{return false;}

◆ isTrkParticleTrigLinkTool()

virtual bool Trk::EventPropertyNtupleTool::isTrkParticleTrigLinkTool ( ) const
inlinevirtual

is True if instance is Tool which links events property to Rec::TrkParticle recieved useing TrigDecTool

Implements Trk::IEventPropertyNtupleTool.

Definition at line 63 of file EventPropertyNtupleTool.h.

63{return false;}

◆ 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.

◆ registerTrackCollections()

virtual void Trk::EventPropertyNtupleTool::registerTrackCollections ( const std::vector< std::string > & ,
bool  )
inlinevirtual

method not active in this tool

Implements Trk::IEventPropertyNtupleTool.

Definition at line 41 of file EventPropertyNtupleTool.h.

41{};

◆ 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 }

◆ resetVariables()

StatusCode EventPropertyNtupleTool::resetVariables ( )
virtual

reset ntuple variables (mainly for vectors which need to be cleared)

Implements Trk::IEventPropertyNtupleTool.

Definition at line 139 of file EventPropertyNtupleTool.cxx.

139 {
140 m_eventNumber = 0;
141 m_runNumber = 0;
142 m_tdc_phase = 0.0;
143 m_lumiBlock = 0;
144 m_tdc_phase = 0;
145 m_bCID = 0;
146 if (m_doTriggerInfo) {
147 m_trigLvl1Type = 0;
148 m_trigLvl1TAV->clear();
149 }
150 return StatusCode::SUCCESS;
151}

◆ setGenParticleTreeIndices()

virtual void Trk::EventPropertyNtupleTool::setGenParticleTreeIndices ( int ,
int  )
inlinevirtual

method not active in this tool

Implements Trk::IEventPropertyNtupleTool.

Definition at line 45 of file EventPropertyNtupleTool.h.

45{};

◆ setTrackTreeIndices()

virtual void Trk::EventPropertyNtupleTool::setTrackTreeIndices ( unsigned int ,
int ,
int  )
inlinevirtual

method not active in this tool

Implements Trk::IEventPropertyNtupleTool.

Definition at line 43 of file EventPropertyNtupleTool.h.

43{};

◆ 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_bCID

int Trk::EventPropertyNtupleTool::m_bCID
private

bunch crossing ID for current event

Definition at line 84 of file EventPropertyNtupleTool.h.

◆ m_comTimeName

std::string Trk::EventPropertyNtupleTool::m_comTimeName
private

Definition at line 72 of file EventPropertyNtupleTool.h.

◆ 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_doTriggerInfo

bool Trk::EventPropertyNtupleTool::m_doTriggerInfo
private

Definition at line 70 of file EventPropertyNtupleTool.h.

◆ m_doTrtPhase

bool Trk::EventPropertyNtupleTool::m_doTrtPhase
private

Definition at line 71 of file EventPropertyNtupleTool.h.

◆ m_eventNumber

int Trk::EventPropertyNtupleTool::m_eventNumber
private

event number

Definition at line 76 of file EventPropertyNtupleTool.h.

◆ 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_lumiBlock

int Trk::EventPropertyNtupleTool::m_lumiBlock
private

lumi block number of current event

Definition at line 82 of file EventPropertyNtupleTool.h.

◆ m_runNumber

int Trk::EventPropertyNtupleTool::m_runNumber
private

run number this event belongs to

Definition at line 75 of file EventPropertyNtupleTool.h.

◆ m_tdc_phase

float Trk::EventPropertyNtupleTool::m_tdc_phase
private

event phase in cosmic events (optional) UNIT:nsec

Definition at line 77 of file EventPropertyNtupleTool.h.

◆ m_timeStamp

int Trk::EventPropertyNtupleTool::m_timeStamp
private

time stamp of current event

Definition at line 83 of file EventPropertyNtupleTool.h.

◆ m_trigLvl1TAV

std::vector<unsigned int>* Trk::EventPropertyNtupleTool::m_trigLvl1TAV
private

level 1 trigger-after-veto info (256 bits in vector) UNIT:bitted

Definition at line 81 of file EventPropertyNtupleTool.h.

◆ m_trigLvl1Type

int Trk::EventPropertyNtupleTool::m_trigLvl1Type
private

level 1 trigger type bitted word (2008: equivalent with stream) UNIT:8-bit

Definition at line 80 of file EventPropertyNtupleTool.h.

◆ 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: