ATLAS Offline Software
Loading...
Searching...
No Matches
D3PD::RootD3PDSvc Class Reference

Service to create a root-based D3PD. More...

#include <RootD3PDSvc.h>

Inheritance diagram for D3PD::RootD3PDSvc:
Collaboration diagram for D3PD::RootD3PDSvc:

Public Member Functions

 RootD3PDSvc (const std::string &name, ISvcLocator *svcloc)
 Constructor.
virtual StatusCode initialize () override
 Standard Gaudi initialize method.
virtual StatusCode finalize () override
 Standard Gaudi finalize method.
virtual StatusCode stop () override
 Standard Gaudi stop method.

Detailed Description

Service to create a root-based D3PD.

Definition at line 37 of file RootD3PDSvc.h.

Constructor & Destructor Documentation

◆ RootD3PDSvc()

D3PD::RootD3PDSvc::RootD3PDSvc ( const std::string & name,
ISvcLocator * svcloc )

Constructor.

Parameters
nameService name.
svclocService locator.

Definition at line 32 of file RootD3PDSvc.cxx.

34 : base_class (name, svcloc),
35 m_histSvc ("THistSvc", name)
36{
37 // See comments on cleanup().
38 std::atexit (cleanup);
39
40 declareProperty ("HistSvc", m_histSvc);
41 declareProperty ("DoBranchRef", m_doBranchRef = true);
42 declareProperty ("MasterTree", m_masterTree = "CollectionTree");
43 declareProperty ("IndexMajor", m_indexMajor = "RunNumber");
44 declareProperty ("IndexMinor", m_indexMinor = "EventNumber");
45 declareProperty ("BasketSize", m_basketSize = 32768);
46 declareProperty ("EntryOffsetLen", m_entryOffsetLen = 512);
47 declareProperty ("AutoFlush", m_autoFlush = -1,
48 "Value to set for ROOT's AutoFlush parameter. "
49 "(Tells how often the tree baskets will be flushed.) "
50 "0 disables flushing. "
51 "-1 (default) makes no changes to what THistSvc did. "
52 "Any other negative number gives the number of bytes "
53 "after which to flush. "
54 "A positive number gives the number of entries after which "
55 "to flush.");
56 declareProperty ("AllowedNames", m_allowedNames,
57 "Variable names allowed in the output D3PDs. An empty list "
58 "means that all variable names are allowed. Regular expressions "
59 "are allowed.");
60 declareProperty ("VetoedNames", m_vetoedNames,
61 "Variable names that are not allowed to end up in the "
62 "created D3PDs. Regular expressions are allowed.");
63}

Member Function Documentation

◆ finalize()

StatusCode D3PD::RootD3PDSvc::finalize ( )
overridevirtual

Standard Gaudi finalize method.

Definition at line 106 of file RootD3PDSvc.cxx.

107{
108 return StatusCode::SUCCESS;
109}

◆ initialize()

StatusCode D3PD::RootD3PDSvc::initialize ( )
overridevirtual

Standard Gaudi initialize method.

Definition at line 95 of file RootD3PDSvc.cxx.

96{
97 CHECK( AthService::initialize() );
98 CHECK( m_histSvc.retrieve() );
99 return StatusCode::SUCCESS;
100}
#define CHECK(...)
Evaluate an expression and check for errors.

◆ stop()

StatusCode D3PD::RootD3PDSvc::stop ( )
overridevirtual

Standard Gaudi stop method.

Definition at line 115 of file RootD3PDSvc.cxx.

116{
117 // Run through all the trees we've made.
118 for (size_t i = 0; i < m_d3pds.size(); i++) {
119 RootD3PD* d3pd = m_d3pds[i].get();
120
121 // Make an index if requested.
122 if (!m_indexMajor.empty())
123 d3pd->tree()->BuildIndex (m_indexMajor.c_str(), m_indexMinor.c_str());
124
125 // Was there a master tree specified?
126 if (!d3pd->master().empty()) {
127 // Yes --- try to find it
128 TDirectory* dir = d3pd->tree()->GetDirectory();
129 TTree* master =
130 dynamic_cast<TTree*> (dir->Get (d3pd->master().c_str()));
131 if (!master && d3pd->tree()->GetEntries() > 0)
132 CHECK( m_histSvc->getTree (d3pd->master(), master) );
133 if (master) {
134 // Make an index for the master if needed.
135 if (!master->GetTreeIndex()) {
136 // AANTupleStream will leave branch addresses in the master
137 // tree pointing at dead objects.
138 master->ResetBranchAddresses();
139
140 master->BuildIndex (m_indexMajor.c_str(), m_indexMinor.c_str());
141 }
142
143 // Make this tree a friend of the master.
144 master->AddFriend (d3pd->tree());
145 }
146 }
147
148 {
149 TDirectory::TContext ctx (gDirectory, d3pd->tree()->GetDirectory());
150 d3pd->tree()->Write();
151 }
152 }
153
154 // Get rid of the RootD3PD wrappers.
155 // (Doesn't delete the root trees themselves.)
156 m_d3pds.clear();
157
158 return StatusCode::SUCCESS;
159}

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