EIC Software
Reference for
EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
DetUtils.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file DetUtils.h
1
2
#ifndef DetUtils_h
3
#define DetUtils_h
4
5
// helper fuctions for detectors
6
7
#include <Geant4/globals.hh>
8
#include <TTree.h>
9
10
//_____________________________________________________________________________
11
class
DetUtils
{
12
13
public
:
14
15
//_____________________________________________________________________________
16
DetUtils
(G4String nam=
""
, TTree *
t
=0x0):
fNam
(nam),
fTree
(
t
) {}
17
18
//_____________________________________________________________________________
19
template
<
class
par>
void
AddBranch
(std::string nam, par *addr, std::string type) {
20
21
//add branch for variable of type 'par' to the tree
22
23
std::string
name
=
fNam
+ nam;
// branch name from detector name and variable name
24
std::string leaf = name +
"/"
+ type;
// leaflist for the variable
25
26
fTree
->Branch(name.c_str(), addr, leaf.c_str());
// create the branch
27
28
//G4cout << name << " " << leaf << G4endl;
29
30
}
//AddBranch
31
32
private
:
33
34
G4String
fNam
;
// detector name
35
TTree *
fTree
;
// tree for output functions
36
37
};
38
39
#endif
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Fun4All-lmon
blob
master
source
DetUtils.h
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:24
using
1.8.2 with
EIC GitHub integration