ATLAS Offline Software
RootConnection.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // RootConnection.h
8 // Header file for class Athena::RootConnection
9 // Author: Peter van Gemmeren <gemmeren@anl.gov>
11 #ifndef ATHENAROOTCOMPS_ROOTCONNECTION_H
12 #define ATHENAROOTCOMPS_ROOTCONNECTION_H 1
13 
19 // STL includes
20 #include <string>
21 
22 // fwk includes
23 #include "GaudiKernel/StatusCode.h"
24 
25 // fwd declares
26 class IInterface;
27 class TFile;
28 class TTree;
29 class TBranch;
30 
31 namespace Athena {
36 {
37 public:
39  RootConnection(const IInterface* own, const std::string& pfn);
41  virtual ~RootConnection();
42 
44  // Public methods:
46 
50  StatusCode connectWrite(const std::string& mode);
56  bool isConnected() const;
58  StatusCode read(void* const data, size_t len);
60  StatusCode write(const void* data, unsigned long& len);
62  StatusCode setContainer(const std::string& container, const std::string& type);
63 
65  // Private data:
67 private:
69  std::string m_fid;
71  std::string m_pfn;
73  //int m_age;
75  //const IInterface* m_owner;
76 
78  TFile* m_file;
80  TTree* m_tree;
82  TBranch* m_branch;
85 
86  //FIXME: use a RootConnectionSetup class to
87  // gather this kind of configuration
88  // -> autoflush, split, buffersize,...
89 };
90 
91 } //> namespace Athena
92 
93 #endif /* !ATHENAROOTCOMPS_ROOTCONNECTION_H */
Athena::RootConnection
This class provides the implementation of Athena::RootConnection class, similar to Gaudi IDataConnect...
Definition: RootConnection.h:36
Athena::RootConnection::disconnect
StatusCode disconnect()
Release data stream and release implementation dependent resources.
Definition: RootConnection.cxx:110
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
Athena::RootConnection::connectRead
StatusCode connectRead()
Open data stream in read mode.
Definition: RootConnection.cxx:74
Athena::RootConnection::m_pfn
std::string m_pfn
Physical file name of the connection.
Definition: RootConnection.h:71
Athena::RootConnection::commit
StatusCode commit()
Commit data stream to ROOT.
Definition: RootConnection.cxx:96
Athena::RootConnection::~RootConnection
virtual ~RootConnection()
Standard destructor.
Definition: RootConnection.cxx:71
Athena::RootConnection::isConnected
bool isConnected() const
Check if connected to data source.
Definition: RootConnection.cxx:122
Athena::RootConnection::write
StatusCode write(const void *data, unsigned long &len)
Write root byte buffer to output stream.
Definition: RootConnection.cxx:130
Athena::RootConnection::m_fid
std::string m_fid
File ID of the connection.
Definition: RootConnection.h:69
Athena::RootConnection::m_file
TFile * m_file
Age counter.
Definition: RootConnection.h:78
Athena
Some weak symbol referencing magic...
Definition: AthLegacySequence.h:21
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Preparation.mode
mode
Definition: Preparation.py:94
Athena::RootConnection::RootConnection
RootConnection(const IInterface *own, const std::string &pfn)
Standard constructor.
Definition: RootConnection.cxx:62
Athena::RootConnection::connectWrite
StatusCode connectWrite(const std::string &mode)
Open data stream in write mode.
Definition: RootConnection.cxx:85
Athena::RootConnection::read
StatusCode read(void *const data, size_t len)
Read root byte buffer from input stream.
Definition: RootConnection.cxx:126
Athena::RootConnection::m_tree
TTree * m_tree
Pointer to the main event data tree.
Definition: RootConnection.h:80
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Athena::RootConnection::setContainer
StatusCode setContainer(const std::string &container, const std::string &type)
Set the container name and type, creating TTree and TBranch as needed.
Definition: RootConnection.cxx:148
Athena::RootConnection::m_branch
TBranch * m_branch
Pointer to the current data branch.
Definition: RootConnection.h:82
Athena::RootConnection::m_branchTypeCode
char m_branchTypeCode
Branch typecode for branch we are asked to write out.
Definition: RootConnection.h:84