|
ATLAS Offline Software
|
Go to the documentation of this file.
7 #include <GaudiKernel/ConcurrencyFlags.h>
14 vec.erase (itr,
vec.end());
36 if (friend_tree->registerBranch(
branch)) {
43 std::vector<std::shared_ptr<IMuonTesterBranch>>::const_iterator itr = std::find_if(
45 [&
branch](
const std::shared_ptr<IMuonTesterBranch>&
known) {
46 return known == branch || known->name() == branch->name();
49 if (
typeid((*itr).get()) !=
typeid(
branch.get())) {
75 if (friend_tree->addBranch(
branch))
return true;
106 if (!friend_tree->fill(ctx))
return false;
123 return StatusCode::FAILURE;
128 return StatusCode::FAILURE;
131 std::stringstream full_path{};
133 if (!hist_svc->regTree(full_path.str(),
tree()).isSuccess()) {
return StatusCode::FAILURE; }
137 return StatusCode::FAILURE;
143 if (!friend_tree->init(hist_svc).isSuccess())
return StatusCode::FAILURE;
159 return StatusCode::FAILURE;
162 std::vector<DataDependency> data_dep =
branch->data_dependencies();
171 [
br](
const std::shared_ptr<IMuonTesterBranch>& owned) {
172 return owned.get() == br; }) ==
m_branches.end();
175 return StatusCode::SUCCESS;
181 ATH_MSG_ERROR(__func__<<
"() --- Failed to put the tree "<<
name()<<
" out of the HistService");
182 return StatusCode::FAILURE;
185 if (!friend_tree->write().isSuccess())
return StatusCode::FAILURE;
186 if (!
tree()->AddFriend(friend_tree->tree())) {
187 ATH_MSG_ERROR(
"Failed to establish the Friendship between "<<
name()<<
" & "<<friend_tree->tree());
188 return StatusCode::FAILURE;
197 return StatusCode::SUCCESS;
213 if (friend_tree->isActive(
branch))
return true;
219 return known == branch || known->name() == branch->name();
227 ATH_MSG_WARNING(
"Common TTree mechanism only supported in single thread environment");
239 ATH_MSG_WARNING(
"Common TTree mechanism only supported in single thread environment");
246 if (common_tree->fileStream() !=
fileStream()) {
247 ATH_MSG_ERROR(
"The common tree "<<common_tree->name()<<
" and "<<
name()<<
" have to be written into the same file");
260 return common_tree->addClient(
this);
269 m_tree{std::make_unique<TTree>(tree_name.c_str(),
"MuonTesterTree")}, m_stream(
stream) {}
std::vector< std::shared_ptr< IMuonTesterBranch > > m_branches
JetConstituentVector::iterator iterator
bool initialized() const
Has the init method been called and the tree is connected with the output file.
char data[hepevt_bytes_allocation_ATLAS]
bool m_init
Flag to avoid double initialization with the StoreGate.
bool m_written
Flag to indicate whether the TTree is written to the file or not.
std::shared_ptr< MuonTesterTree > FriendTreePtr
Appends the other tester Tree as friend to this instance.
StatusCode init(OWNER *instance)
Initialize method.
MuonTesterTree(const std::string &tree_name, const std::string &stream)
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 registerBranch(std::shared_ptr< IMuonTesterBranch > branch)
This method adds the branch to the tree and hands over the ownership to the MuonAnalysisTree instance...
TTree * operator->()
Operator to the TTree object.
std::vector< size_t > vec
#define ATH_MSG_VERBOSE(x)
bool addClient(MuonTesterTree *client)
Adds the other TTree as a Client and declares this instance as a Common Tree.
std::unique_ptr< TTree > m_tree
const std::string & fileStream() const
file_stream of the analysis to which the tree belongs
std::vector< IMuonTesterBranch * > m_branches_to_init
bool isCommonTree() const
Returns Whether the Tree is a common tree or not.
void disableBranch(const std::string &br_name)
Skips the branch from being added to the tree.
::StatusCode StatusCode
StatusCode definition for legacy code.
std::set< MuonTesterTree * > m_commonClients
List of all other MuonTesterTree instances using this instance as a common Tree If the Tree has one c...
Class to provide easy MsgStream access and capabilities.
std::reverse_iterator< DataModel_detail::iterator< DVL > > remove_if(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, Predicate pred)
Specialization of remove_if for DataVector/List.
Class to store array like branches into the n-tuples.
std::string name() const
Name of the tree.
std::vector< DataDependency > m_dependencies
void setPath(const std::string &new_path)
Save the TTree in a subfolder of the TFile.
A property holding a SG store/key/clid from which a VarHandle is made.
std::shared_ptr< EventHashBranch > m_hash_br
bool addCommonTree(FriendTreePtr common_tree)
std::vector< FriendTreePtr > m_friendLinks
List of all other common instances that are acting as friends.
std::set< IMuonTesterBranch * > m_initialized_br
Set of branches that were already initialized.
ServiceHandle< ITHistSvc > m_hist_svc
#define ATH_MSG_WARNING(x)
bool fill(const EventContext &ctx)
Fills the tree per call.
const std::string & path() const
sub directory in the TFile
StatusCode write()
Finally write the TTree objects.
const std::vector< FriendTreePtr > & getFriends() const
Most basic interface class used by the MuonTester tree.
TTree * tree()
TTree object.
void removeBranch(IMuonTesterBranch *branch)
In case instances of a certain branch type are destroyed before hand.
std::set< std::string > m_excludedBranches
bool addBranch(std::shared_ptr< IMuonTesterBranch > branch)
Branch is added to the tree without transferring the ownership.