ATLAS Offline Software
Loading...
Searching...
No Matches
MuonVal::MuonTesterTree Class Reference

#include <MuonTesterTree.h>

Inheritance diagram for MuonVal::MuonTesterTree:

Public Types

using FriendTreePtr = std::shared_ptr<MuonTesterTree>
 Appends the other tester Tree as friend to this instance.

Public Member Functions

 MuonTesterTree (const std::string &tree_name, const std::string &stream)
 ~MuonTesterTree ()
TTree * tree ()
 TTree object.
const TTree * tree () const
TTree * operator-> ()
 Operator to the TTree object.
const TTree * operator-> () const
bool initialized () const
 Has the init method been called and the tree is connected with the output file.
bool fill (const EventContext &ctx)
 Fills the tree per call.
std::string name () const
 Name of the tree.
const std::string & fileStream () const
 file_stream of the analysis to which the tree belongs
const std::string & path () const
 sub directory in the TFile
void setPath (const std::string &new_path)
 Save the TTree in a subfolder of the TFile.
void setFileStream (const std::string &new_stream)
 Set the file stream post creation.
template<detail::hasHistSvc OWNER>
StatusCode init (OWNER *instance)
 Initialize method.
StatusCode write ()
 Finally write the TTree objects.
bool registerBranch (std::shared_ptr< IMuonTesterBranch > branch)
 This method adds the branch to the tree and hands over the ownership to the MuonAnalysisTree instance IF the second argument is set to false the branch is not added to the active list of branches i.e.
bool addBranch (std::shared_ptr< IMuonTesterBranch > branch)
 Branch is added to the tree without transferring the ownership.
bool addBranch (IMuonTesterBranch &branch)
bool addBranch (IMuonTesterBranch *branch)
void removeBranch (IMuonTesterBranch *branch)
 In case instances of a certain branch type are destroyed before hand.
void removeBranch (IMuonTesterBranch &branch)
void disableBranch (const std::string &br_name)
 Skips the branch from being added to the tree.
void disableBranch (const std::vector< std::string > &br_names)
template<class T>
std::shared_ptr< T > getBranch (const std::string &str) const
 Retrieves the branches owned by the muon_tree.
template<typename T>
VectorBranch< T > & newVector (const std::string &name)
 Creates new branches and returns their reference.
template<typename T>
ScalarBranch< T > & newScalar (const std::string &name)
template<typename T>
MatrixBranch< T > & newMatrix (const std::string &name)
template<typename T>
SetBranch< T > & newSet (const std::string &name)
template<typename T>
VectorBranch< T > & newVector (const std::string &name, const T def_val)
 Creates and returns branches with a default value.
template<typename T>
ScalarBranch< T > & newScalar (const std::string &name, const T def_val)
template<typename T>
MatrixBranch< T > & newMatrix (const std::string &name, const T def_val)
template<typename T>
T & newBranch (std::shared_ptr< T > br)
 returns the reference of the branch
bool isActive (const IMuonTesterBranch *branch) const
 Returns a boolean whether the branch is already part of the tree or one of the deligated friends.
bool isCommonTree () const
 Returns Whether the Tree is a common tree or not.
bool addCommonTree (FriendTreePtr common_tree)
const std::vector< FriendTreePtr > & getFriends () const
bool msgLvl (const MSG::Level lvl) const
 Test the output level.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.
void setLevel (MSG::Level lvl)
 Change the current logging level.

Private Types

using DataDependency = IMuonTesterBranch::DataDependency

Private Member Functions

bool addClient (MuonTesterTree *client)
 Adds the other TTree as a Client and declares this instance as a Common Tree.
StatusCode init (const ServiceHandle< ITHistSvc > &hist_svc)
 Initialze the tree with the output file.
void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

std::vector< DataDependencym_dependencies {}
unsigned int m_depCounter {0}
std::unique_ptr< TTree > m_tree {nullptr}
std::string m_stream {}
std::string m_path {}
bool m_init {false}
 Flag to avoid double initialization with the StoreGate.
bool m_written {false}
 Flag to indicate whether the TTree is written to the file or not.
std::vector< IMuonTesterBranch * > m_branches_to_init {}
std::vector< std::shared_ptr< IMuonTesterBranch > > m_branches {}
std::set< IMuonTesterBranch * > m_initialized_br {}
 Set of branches that were already initialized.
std::set< std::string > m_excludedBranches {}
TDirectory * m_directory {nullptr}
bool m_filled {false}
ServiceHandle< ITHistSvc > m_hist_svc {"", ""}
std::vector< FriendTreePtrm_friendLinks {}
 List of all other common instances that are acting as friends.
std::set< MuonTesterTree * > m_commonClients {}
 List of all other MuonTesterTree instances using this instance as a common Tree If the Tree has one client it is declared as a common Tree.
std::shared_ptr< EventHashBranchm_hash_br
std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels).
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging).

Detailed Description

Definition at line 38 of file MuonTesterTree.h.

Member Typedef Documentation

◆ DataDependency

◆ FriendTreePtr

Appends the other tester Tree as friend to this instance.

Definition at line 119 of file MuonTesterTree.h.

Constructor & Destructor Documentation

◆ MuonTesterTree()

MuonVal::MuonTesterTree::MuonTesterTree ( const std::string & tree_name,
const std::string & stream )

Definition at line 278 of file MuonTesterTree.cxx.

278 :
279 AthMessaging{"MuonTesterTree"},
280 m_tree{std::make_unique<TTree>(tree_name.c_str(), "MuonTesterTree")}, m_stream(stream) {}
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
std::unique_ptr< TTree > m_tree

◆ ~MuonTesterTree()

MuonVal::MuonTesterTree::~MuonTesterTree ( )

Definition at line 282 of file MuonTesterTree.cxx.

282 {
283 m_branches_to_init.clear();
284}
std::vector< IMuonTesterBranch * > m_branches_to_init

Member Function Documentation

◆ addBranch() [1/3]

bool MuonVal::MuonTesterTree::addBranch ( IMuonTesterBranch & branch)

Definition at line 64 of file MuonTesterTree.cxx.

64{ return addBranch(&branch); }
bool addBranch(std::shared_ptr< IMuonTesterBranch > branch)
Branch is added to the tree without transferring the ownership.

◆ addBranch() [2/3]

bool MuonVal::MuonTesterTree::addBranch ( IMuonTesterBranch * branch)

Definition at line 65 of file MuonTesterTree.cxx.

65 {
66 if (isActive(branch))
67 return true;
68 else if (!branch) {
69 ATH_MSG_ERROR("Nullptr given");
70 return false;
71 } else if (m_filled) {
72 ATH_MSG_ERROR("Tree structure is already finalized. Cannot add " << branch->name());
73 return false;
74 }
75 if (branch->tree() != tree()) {
76 for (const FriendTreePtr& friend_tree : getFriends()) {
77 if (friend_tree->addBranch(branch)) return true;
78 }
79 return false;
80 }
81 m_branches_to_init.push_back(branch);
82 return true;
83}
#define ATH_MSG_ERROR(x)
const std::vector< FriendTreePtr > & getFriends() const
std::shared_ptr< MuonTesterTree > FriendTreePtr
Appends the other tester Tree as friend to this instance.
bool isActive(const IMuonTesterBranch *branch) const
Returns a boolean whether the branch is already part of the tree or one of the deligated friends.
TTree * tree()
TTree object.

◆ addBranch() [3/3]

bool MuonVal::MuonTesterTree::addBranch ( std::shared_ptr< IMuonTesterBranch > branch)

Branch is added to the tree without transferring the ownership.

Definition at line 63 of file MuonTesterTree.cxx.

63{ return registerBranch(branch) && addBranch(branch.get()); }
bool registerBranch(std::shared_ptr< IMuonTesterBranch > branch)
This method adds the branch to the tree and hands over the ownership to the MuonAnalysisTree instance...

◆ addClient()

bool MuonVal::MuonTesterTree::addClient ( MuonTesterTree * client)
private

Adds the other TTree as a Client and declares this instance as a Common Tree.

Definition at line 236 of file MuonTesterTree.cxx.

236 {
237 if (Gaudi::Concurrency::ConcurrencyFlags::numThreads() > 1) {
238 ATH_MSG_WARNING("Common TTree mechanism only supported in single thread environment");
239 return false;
240 }
241 if (!m_hash_br) {
242 m_hash_br = std::make_shared<EventHashBranch>(tree());
243 if (!addBranch(m_hash_br)) return false;
244 }
245 m_commonClients.insert(client);
246 return true;
247}
#define ATH_MSG_WARNING(x)
std::set< MuonTesterTree * > m_commonClients
List of all other MuonTesterTree instances using this instance as a common Tree If the Tree has one c...
std::shared_ptr< EventHashBranch > m_hash_br

◆ addCommonTree()

bool MuonVal::MuonTesterTree::addCommonTree ( FriendTreePtr common_tree)

Ensure that the event entries are synchronized

Definition at line 248 of file MuonTesterTree.cxx.

248 {
249 if (Gaudi::Concurrency::ConcurrencyFlags::numThreads() > 1) {
250 ATH_MSG_WARNING("Common TTree mechanism only supported in single thread environment");
251 return false;
252 }
253 if (!common_tree) {
254 ATH_MSG_ERROR("Nullptr given");
255 return false;
256 }
257 if (common_tree->fileStream() != fileStream()) {
258 ATH_MSG_ERROR("The common tree "<<common_tree->name()<<" and "<<name()<<" have to be written into the same file");
259 return false;
260 }
261 if (m_commonClients.count(common_tree.get())) {
262 ATH_MSG_ERROR(name()<<" is already a friend of "<<common_tree->name());
263 return false;
264 }
266 if (!m_hash_br) {
267 m_hash_br = std::make_shared<EventHashBranch>(tree());
268 if (!addBranch(m_hash_br)) return false;
269 }
270 m_friendLinks.push_back(common_tree);
271 return common_tree->addClient(this);
272}
std::vector< FriendTreePtr > m_friendLinks
List of all other common instances that are acting as friends.
std::string name() const
Name of the tree.
const std::string & fileStream() const
file_stream of the analysis to which the tree belongs

◆ disableBranch() [1/2]

void MuonVal::MuonTesterTree::disableBranch ( const std::string & br_name)

Skips the branch from being added to the tree.

Definition at line 210 of file MuonTesterTree.cxx.

210 {
211 if (!m_filled) m_excludedBranches.insert(b_name);
212}
std::set< std::string > m_excludedBranches

◆ disableBranch() [2/2]

void MuonVal::MuonTesterTree::disableBranch ( const std::vector< std::string > & br_names)

Definition at line 213 of file MuonTesterTree.cxx.

213 {
214 if (!m_filled) m_excludedBranches.insert(br_names.begin(), br_names.end());
215}

◆ fileStream()

const std::string & MuonVal::MuonTesterTree::fileStream ( ) const

file_stream of the analysis to which the tree belongs

Definition at line 216 of file MuonTesterTree.cxx.

216{ return m_stream; }

◆ fill()

bool MuonVal::MuonTesterTree::fill ( const EventContext & ctx)

Fills the tree per call.

Remove the information that is no longer of value

Common trees arecan only be filled once in an event

Call the fill method on all friends

These branches are actually initialized

Definition at line 91 of file MuonTesterTree.cxx.

91 {
92 if (!initialized()) {
93 ATH_MSG_ERROR("The TTree has not been initialized yet");
94 return false;
95 }
97 if (!m_filled) {
98 m_excludedBranches.clear();
99 m_initialized_br.clear();
100 m_dependencies.clear();
101 }
103 if (isCommonTree() && m_hash_br->is_dumped(ctx)) {
104 return true;
105 }
107 for (const FriendTreePtr& friend_tree : getFriends()){
108 if (!friend_tree->fill(ctx)) return false;
109 }
111 for (auto& branch : m_branches_to_init) {
112 ATH_MSG_VERBOSE("Try to fill "<<branch->name());
113 if (!branch->fill(ctx)) {
114 ATH_MSG_ERROR("fill() --- Failed to fill branch " << branch->name() << " in tree " << name() );
115 return false;
116 }
117 }
118 m_tree->Fill();
119 m_filled = true;
120 return true;
121}
#define ATH_MSG_VERBOSE(x)
bool initialized() const
Has the init method been called and the tree is connected with the output file.
std::vector< DataDependency > m_dependencies
bool isCommonTree() const
Returns Whether the Tree is a common tree or not.
std::set< IMuonTesterBranch * > m_initialized_br
Set of branches that were already initialized.

◆ getBranch()

template<class T>
std::shared_ptr< T > MuonVal::MuonTesterTree::getBranch ( const std::string & str) const

Retrieves the branches owned by the muon_tree.

◆ getFriends()

const std::vector< MuonTesterTree::FriendTreePtr > & MuonVal::MuonTesterTree::getFriends ( ) const

Definition at line 273 of file MuonTesterTree.cxx.

273 {
274 return m_friendLinks;
275}

◆ init() [1/2]

StatusCode MuonVal::MuonTesterTree::init ( const ServiceHandle< ITHistSvc > & hist_svc)
private

Initialze the tree with the output file.

The stream corresponds to the stream of the file e.g MDTTester HighEtaTester

push back the ds id index

Sort by alphabet

Kick everything that is not owned by the class itself

Definition at line 122 of file MuonTesterTree.cxx.

122 {
123 if (fileStream().empty()) {
124 ATH_MSG_ERROR("The file stream of " << name() << " has not been set yet" );
125 return StatusCode::FAILURE;
126 }
127 if (!initialized()) {
128 if (!m_tree) {
129 ATH_MSG_FATAL("No TTree object");
130 return StatusCode::FAILURE;
131 }
133 std::stringstream full_path{};
134 full_path<<"/"<<fileStream()<<"/"<<path()<<(path().empty() ? "" : "/")<<name();
135 if (!hist_svc->regTree(full_path.str(), tree()).isSuccess()) { return StatusCode::FAILURE; }
136 m_directory = m_tree->GetDirectory();
137 if (!m_directory) {
138 ATH_MSG_ERROR("Where is my directory to write later?");
139 return StatusCode::FAILURE;
140 }
141 m_hist_svc = hist_svc;
142 m_init = true;
143 }
144 for (const FriendTreePtr& friend_tree : getFriends()){
145 if (!friend_tree->init(hist_svc).isSuccess()) return StatusCode::FAILURE;
146 }
147
148 Remove(m_branches_to_init, [this](const IMuonTesterBranch* br) {
149 return !br || m_excludedBranches.count(br->name());
150 });
153 [](IMuonTesterBranch* a, IMuonTesterBranch* b) { return a->name() < b->name(); });
154 for (IMuonTesterBranch* branch : m_branches_to_init) {
155 if (m_initialized_br.count(branch)) {
156 ATH_MSG_VERBOSE("Do not count the initialize function on "<<branch->name()<<" twice.");
157 continue;
158 }
159 if (!branch->init()) {
160 ATH_MSG_ERROR("Failed to initialize branch " << branch->name());
161 return StatusCode::FAILURE;
162 }
163 ATH_MSG_DEBUG(" Branch " << branch->name() << " has been initialized");
164 std::vector<DataDependency> data_dep = branch->data_dependencies();
165 for (const DataDependency& data : data_dep) {
166 m_dependencies.emplace_back(data);
167 }
168 m_initialized_br.insert(branch);
169 }
171 Remove(m_branches_to_init, [this](const IMuonTesterBranch* br) {
172 return std::find_if(m_branches.begin(), m_branches.end(),
173 [br](const std::shared_ptr<IMuonTesterBranch>& owned) {
174 return owned.get() == br; }) == m_branches.end();
175 });
176 ATH_MSG_INFO("Initialization of "<<name()<<" successfully completed");
177 return StatusCode::SUCCESS;
178}
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
static Double_t a
static const Attributes_t empty
bool m_init
Flag to avoid double initialization with the StoreGate.
IMuonTesterBranch::DataDependency DataDependency
std::vector< std::shared_ptr< IMuonTesterBranch > > m_branches
ServiceHandle< ITHistSvc > m_hist_svc
const std::string & path() const
sub directory in the TFile
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ init() [2/2]

template<detail::hasHistSvc OWNER>
StatusCode MuonVal::MuonTesterTree::init ( OWNER * instance)

Initialize method.

◆ initialized()

bool MuonVal::MuonTesterTree::initialized ( ) const

Has the init method been called and the tree is connected with the output file.

Definition at line 90 of file MuonTesterTree.cxx.

90{ return m_init; }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40{
42 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ isActive()

bool MuonVal::MuonTesterTree::isActive ( const IMuonTesterBranch * branch) const

Returns a boolean whether the branch is already part of the tree or one of the deligated friends.

Definition at line 217 of file MuonTesterTree.cxx.

217 {
218 if (!branch) {
219 ATH_MSG_ERROR("Nullptr was given");
220 return false;
221 }
222 if (branch->tree() != tree()) {
223 for (const FriendTreePtr& friend_tree : getFriends()){
224 if (friend_tree->isActive(branch)) return true;
225 }
226 return false;
227 }
228 return std::find_if(m_branches_to_init.begin(), m_branches_to_init.end(),
229 [&branch](const IMuonTesterBranch* known) {
230 return known == branch || known->name() == branch->name();
231 }) != m_branches_to_init.end();
232}

◆ isCommonTree()

bool MuonVal::MuonTesterTree::isCommonTree ( ) const

Returns Whether the Tree is a common tree or not.

Definition at line 276 of file MuonTesterTree.cxx.

276{return !m_commonClients.empty(); }

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 167 of file AthMessaging.h.

168{
169 MsgStream* ms = m_msg_tls.get();
170 if (!ms) {
171 if (!m_initialized.test_and_set()) initMessaging();
172 ms = new MsgStream(m_imsg,m_nm);
173 m_msg_tls.reset( ms );
174 }
175
176 ms->setLevel (m_lvl);
177 return *ms;
178}
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels).
void initMessaging() const
Initialize our message level and MessageSvc.

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 182 of file AthMessaging.h.

183{ return msg() << lvl; }
MsgStream & msg() const
The standard message stream.

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152{
153 // If user did not set explicit message level we have to initialize
154 // the messaging and retrieve the default via the MessageSvc.
155 if (m_lvl==MSG::NIL && !m_initialized.test_and_set()) initMessaging();
156
157 if (m_lvl <= lvl) {
158 msg() << lvl;
159 return true;
160 } else {
161 return false;
162 }
163}

◆ name()

std::string MuonVal::MuonTesterTree::name ( ) const

Name of the tree.

Definition at line 22 of file MuonTesterTree.cxx.

22{ return m_tree->GetName(); }

◆ newBranch()

template<typename T>
T & MuonVal::MuonTesterTree::newBranch ( std::shared_ptr< T > br)

returns the reference of the branch

◆ newMatrix() [1/2]

template<typename T>
MatrixBranch< T > & MuonVal::MuonTesterTree::newMatrix ( const std::string & name)

◆ newMatrix() [2/2]

template<typename T>
MatrixBranch< T > & MuonVal::MuonTesterTree::newMatrix ( const std::string & name,
const T def_val )

◆ newScalar() [1/2]

template<typename T>
ScalarBranch< T > & MuonVal::MuonTesterTree::newScalar ( const std::string & name)

◆ newScalar() [2/2]

template<typename T>
ScalarBranch< T > & MuonVal::MuonTesterTree::newScalar ( const std::string & name,
const T def_val )

◆ newSet()

template<typename T>
SetBranch< T > & MuonVal::MuonTesterTree::newSet ( const std::string & name)

◆ newVector() [1/2]

template<typename T>
VectorBranch< T > & MuonVal::MuonTesterTree::newVector ( const std::string & name)

Creates new branches and returns their reference.

◆ newVector() [2/2]

template<typename T>
VectorBranch< T > & MuonVal::MuonTesterTree::newVector ( const std::string & name,
const T def_val )

Creates and returns branches with a default value.

◆ operator->() [1/2]

TTree * MuonVal::MuonTesterTree::operator-> ( )

Operator to the TTree object.

Definition at line 25 of file MuonTesterTree.cxx.

25{ return m_tree.get(); }

◆ operator->() [2/2]

const TTree * MuonVal::MuonTesterTree::operator-> ( ) const

Definition at line 27 of file MuonTesterTree.cxx.

27{ return m_tree.get(); }

◆ path()

const std::string & MuonVal::MuonTesterTree::path ( ) const

sub directory in the TFile

Definition at line 234 of file MuonTesterTree.cxx.

234{ return m_path; }

◆ registerBranch()

bool MuonVal::MuonTesterTree::registerBranch ( std::shared_ptr< IMuonTesterBranch > branch)

This method adds the branch to the tree and hands over the ownership to the MuonAnalysisTree instance IF the second argument is set to false the branch is not added to the active list of branches i.e.

no fill and initialize function is called on it

Check whether the branch belongs to the same TTree

Definition at line 30 of file MuonTesterTree.cxx.

30 {
31 if (!branch) {
32 ATH_MSG_ERROR("Nullptr given");
33 return false;
34 }
36 if (branch->tree() != tree()) {
37 for (const FriendTreePtr& friend_tree : getFriends()){
38 if (friend_tree->registerBranch(branch)) {
39 m_branches.push_back(std::move(branch));
40 return true;
41 }
42 }
43 return false;
44 }
45 std::vector<std::shared_ptr<IMuonTesterBranch>>::const_iterator itr = std::find_if(
46 m_branches.begin(), m_branches.end(),
47 [&branch](const std::shared_ptr<IMuonTesterBranch>& known) {
48 return known == branch || known->name() == branch->name();
49 });
50 if (itr != m_branches.end()) {
51 if (typeid((*itr).get()) != typeid(branch.get())) {
52 ATH_MSG_FATAL("Different branches have been added here under " << branch->name());
53 return false;
54 }
55 return true;
56 } else if (m_filled) {
57 ATH_MSG_FATAL("Tree structure is already finalized");
58 return false;
59 }
60 m_branches.push_back(std::move(branch));
61 return true;
62}

◆ removeBranch() [1/2]

void MuonVal::MuonTesterTree::removeBranch ( IMuonTesterBranch & branch)

Definition at line 88 of file MuonTesterTree.cxx.

88{ removeBranch(&branch); }
void removeBranch(IMuonTesterBranch *branch)
In case instances of a certain branch type are destroyed before hand.

◆ removeBranch() [2/2]

void MuonVal::MuonTesterTree::removeBranch ( IMuonTesterBranch * branch)

In case instances of a certain branch type are destroyed before hand.

Definition at line 85 of file MuonTesterTree.cxx.

85 {
86 Remove(m_branches_to_init, [branch](const IMuonTesterBranch* br) { return br == branch; });
87}

◆ setFileStream()

void MuonVal::MuonTesterTree::setFileStream ( const std::string & new_stream)

Set the file stream post creation.

Definition at line 180 of file MuonTesterTree.cxx.

180 {
181 if (isCommonTree() || initialized()) {
182 ATH_MSG_WARNING("Cannot change file stream");
183 return;
184 }
185 ATH_MSG_DEBUG("Update stream "<<m_stream<<" to "<<new_stream);
186 m_stream = new_stream;
187
188}

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29{
30 m_lvl = lvl;
31}

◆ setPath()

void MuonVal::MuonTesterTree::setPath ( const std::string & new_path)

Save the TTree in a subfolder of the TFile.

Definition at line 233 of file MuonTesterTree.cxx.

233{ m_path = new_path; }

◆ tree() [1/2]

TTree * MuonVal::MuonTesterTree::tree ( )

TTree object.

Definition at line 24 of file MuonTesterTree.cxx.

24{ return m_tree.get(); }

◆ tree() [2/2]

const TTree * MuonVal::MuonTesterTree::tree ( ) const

Definition at line 26 of file MuonTesterTree.cxx.

26{ return m_tree.get(); }

◆ write()

StatusCode MuonVal::MuonTesterTree::write ( )

Finally write the TTree objects.

Definition at line 189 of file MuonTesterTree.cxx.

189 {
190 if (!initialized() || !m_tree || m_written) { return StatusCode::SUCCESS; }
191 if (!m_hist_svc->deReg(tree()).isSuccess()) {
192 ATH_MSG_ERROR(__func__<<"() --- Failed to put the tree "<<name()<<" out of the HistService");
193 return StatusCode::FAILURE;
194 }
195 for (const FriendTreePtr& friend_tree : getFriends()) {
196 if (!friend_tree->write().isSuccess()) return StatusCode::FAILURE;
197 if (!tree()->AddFriend(friend_tree->tree())) {
198 ATH_MSG_ERROR("Failed to establish the Friendship between "<<name()<<" & "<<friend_tree->tree());
199 return StatusCode::FAILURE;
200 }
201 }
202 m_directory->WriteObject(tree(), tree()->GetName(), "overwrite");
203 if (!isCommonTree()) m_tree.reset();
204 m_branches_to_init.clear();
205 m_branches.clear();
206 m_friendLinks.clear();
207 m_written = true;
208 return StatusCode::SUCCESS;
209}
bool m_written
Flag to indicate whether the TTree is written to the file or not.

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging).

Definition at line 141 of file AthMessaging.h.

◆ m_branches

std::vector<std::shared_ptr<IMuonTesterBranch> > MuonVal::MuonTesterTree::m_branches {}
private

Definition at line 155 of file MuonTesterTree.h.

155{};

◆ m_branches_to_init

std::vector<IMuonTesterBranch*> MuonVal::MuonTesterTree::m_branches_to_init {}
private

Definition at line 153 of file MuonTesterTree.h.

153{};

◆ m_commonClients

std::set<MuonTesterTree*> MuonVal::MuonTesterTree::m_commonClients {}
private

List of all other MuonTesterTree instances using this instance as a common Tree If the Tree has one client it is declared as a common Tree.

It can then only be filled once in an event

Definition at line 170 of file MuonTesterTree.h.

170{};

◆ m_depCounter

unsigned int MuonVal::MuonTesterTree::m_depCounter {0}
private

Definition at line 135 of file MuonTesterTree.h.

135{0};

◆ m_dependencies

std::vector<DataDependency> MuonVal::MuonTesterTree::m_dependencies {}
private

Definition at line 134 of file MuonTesterTree.h.

134{};

◆ m_directory

TDirectory* MuonVal::MuonTesterTree::m_directory {nullptr}
private

Definition at line 161 of file MuonTesterTree.h.

161{nullptr};

◆ m_excludedBranches

std::set<std::string> MuonVal::MuonTesterTree::m_excludedBranches {}
private

Definition at line 159 of file MuonTesterTree.h.

159{};

◆ m_filled

bool MuonVal::MuonTesterTree::m_filled {false}
private

Definition at line 162 of file MuonTesterTree.h.

162{false};

◆ m_friendLinks

std::vector<FriendTreePtr> MuonVal::MuonTesterTree::m_friendLinks {}
private

List of all other common instances that are acting as friends.

Definition at line 166 of file MuonTesterTree.h.

166{};

◆ m_hash_br

std::shared_ptr<EventHashBranch> MuonVal::MuonTesterTree::m_hash_br
private

Definition at line 172 of file MuonTesterTree.h.

◆ m_hist_svc

ServiceHandle<ITHistSvc> MuonVal::MuonTesterTree::m_hist_svc {"", ""}
private

Definition at line 163 of file MuonTesterTree.h.

163{"", ""};

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_init

bool MuonVal::MuonTesterTree::m_init {false}
private

Flag to avoid double initialization with the StoreGate.

Definition at line 141 of file MuonTesterTree.h.

141{false};

◆ m_initialized_br

std::set<IMuonTesterBranch*> MuonVal::MuonTesterTree::m_initialized_br {}
private

Set of branches that were already initialized.

Definition at line 157 of file MuonTesterTree.h.

157{};

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels).

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_path

std::string MuonVal::MuonTesterTree::m_path {}
private

Definition at line 139 of file MuonTesterTree.h.

139{};

◆ m_stream

std::string MuonVal::MuonTesterTree::m_stream {}
private

Definition at line 138 of file MuonTesterTree.h.

138{};

◆ m_tree

std::unique_ptr<TTree> MuonVal::MuonTesterTree::m_tree {nullptr}
private

Definition at line 137 of file MuonTesterTree.h.

137{nullptr};

◆ m_written

bool MuonVal::MuonTesterTree::m_written {false}
private

Flag to indicate whether the TTree is written to the file or not.

Definition at line 143 of file MuonTesterTree.h.

143{false};

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