ATLAS Offline Software
LArCalorimeter
LArG4
LArG4ShowerLib
src
IShowerLib.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
// header file
7
#include "
LArG4ShowerLib/IShowerLib.h
"
8
#include "TTree.h"
9
#include "G4Track.hh"
10
#include "
AtlasHepMC/GenParticle.h
"
11
12
#include <sstream>
13
14
namespace
ShowerLib
{
15
16
bool
IShowerLib::readMeta
(TTree*
source
) {
17
char
detector
[40];
18
char
release
[40];
19
char
geometry
[40];
20
char
geant[40];
21
char
physics[40];
22
char
comment
[100];
23
source
->SetBranchAddress(
"detector"
,&
detector
);
24
source
->SetBranchAddress(
"particle"
,&
m_particle
);
25
source
->SetBranchAddress(
"release"
,&
release
);
26
source
->SetBranchAddress(
"geometry"
,&
geometry
);
27
source
->SetBranchAddress(
"geantVersion"
,&geant);
28
source
->SetBranchAddress(
"physicsList"
,&physics);
29
source
->SetBranchAddress(
"comment"
,&
comment
);
30
source
->GetEntry(0);
31
m_detector
=
detector
;
32
m_release
=
release
;
33
m_geometry
=
geometry
;
34
m_geantVersion
= geant;
35
m_physicsList
= physics;
36
m_comment
=
comment
;
37
return
true
;
38
}
39
40
bool
IShowerLib::writeMeta
(TTree*
source
)
const
{
41
char
detector
[40];
42
char
release
[40];
43
char
geometry
[40];
44
char
geant[40];
45
char
physics[40];
46
char
comment
[100];
47
int
particle
(
m_particle
);
48
m_detector
.copy(
detector
,39,0);
49
detector
[
m_detector
.length()] =
'\0'
;
50
m_release
.copy(
release
,39,0);
51
release
[
m_release
.length()] =
'\0'
;
52
m_geometry
.copy(
geometry
,39,0);
53
geometry
[
m_geometry
.length()] =
'\0'
;
54
m_geantVersion
.copy(geant,39,0);
55
geant[
m_geantVersion
.length()] =
'\0'
;
56
m_physicsList
.copy(physics,39,0);
57
physics[
m_physicsList
.length()] =
'\0'
;
58
m_comment
.copy(
comment
,99,0);
59
comment
[
m_comment
.length()] =
'\0'
;
60
source
->Branch(
"detector"
,&
detector
,
"detector/C"
);
61
source
->Branch(
"particle"
,&
particle
,
"particle/I"
);
62
source
->Branch(
"release"
,&
release
,
"release/C"
);
63
source
->Branch(
"geometry"
,&
geometry
,
"geometry/C"
);
64
source
->Branch(
"geantVersion"
,&geant,
"geantVersion/C"
);
65
source
->Branch(
"physicsList"
,&physics,
"physicsList/C"
);
66
source
->Branch(
"comment"
,&
comment
,
"comment/C"
);
67
source
->Fill();
68
return
true
;
69
}
70
71
const
std::string
IShowerLib::statistics
()
const
{
72
73
if
(
m_filled
) {
74
std::stringstream
out
;
75
76
out
<<
"======================================================"
<< std::endl;
77
out
<<
" Statistics of the shower library "
<< std::endl;
78
out
<<
"======================================================"
<< std::endl;
79
out
<<
"Library Type: "
<<
getName
() <<
" PARTICLE: "
<<
m_particle
<<
" DETECTOR: "
<<
m_detector
<< std::endl;
80
out
<<
m_release
<<
" "
<<
m_geometry
<<
" "
<<
m_geantVersion
<<
" "
<<
m_physicsList
<< std::endl;
81
if
(
printParameters
().
length
() > 0)
82
out
<<
printParameters
() << std::endl;
83
out
<<
m_comment
<< std::endl;
84
return
out
.str();
85
}
else
{
//statistics for the genlib, shorter version
86
std::stringstream
out
;
87
out
<<
getName
() <<
" PARTICLE: "
<<
m_particle
<<
" DETECTOR: "
<<
m_detector
<<
", "
;
88
out
<<
m_release
<<
" "
<<
m_geometry
<<
" "
<<
m_geantVersion
<<
" "
<<
m_physicsList
<< std::endl;
89
if
(
printParameters
().
length
() > 0)
90
out
<<
printParameters
() << std::endl;
91
out
<<
m_comment
<< std::endl;
92
return
out
.str();
93
}
94
}
95
96
}
// namespace IShowerLib
ShowerLib::IShowerLib::m_detector
std::string m_detector
name of the detector
Definition:
IShowerLib.h:106
ShowerLib::IShowerLib::release
virtual const std::string release() const
get Release tag
Definition:
IShowerLib.h:127
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition:
ParticleHypothesis.h:76
ShowerLib::IShowerLib::detector
virtual const std::string detector() const
get detector tag
Definition:
IShowerLib.h:121
ShowerLib::IShowerLib::statistics
const std::string statistics() const
print library statistics
Definition:
IShowerLib.cxx:71
ShowerLib::IShowerLib::m_release
std::string m_release
atlas software release
Definition:
IShowerLib.h:108
ShowerLib::IShowerLib::printParameters
virtual const std::string printParameters() const =0
ShowerLib::IShowerLib::m_comment
std::string m_comment
comment
Definition:
IShowerLib.h:112
python.AthDsoLogger.out
out
Definition:
AthDsoLogger.py:71
ShowerLib::IShowerLib::getName
virtual const std::string getName() const
Definition:
IShowerLib.h:93
ShowerLib::IShowerLib::m_filled
bool m_filled
is the library read from ROOT or from structure file
Definition:
IShowerLib.h:114
GenParticle.h
ShowerLib::IShowerLib::writeMeta
bool writeMeta(TTree *dest) const
write metadata to the given TTree
Definition:
IShowerLib.cxx:40
ShowerLib::IShowerLib::m_particle
int m_particle
ID of the generated particles.
Definition:
IShowerLib.h:107
ShowerLib::IShowerLib::m_geometry
std::string m_geometry
atlas geometry version
Definition:
IShowerLib.h:109
ShowerLib::IShowerLib::readMeta
bool readMeta(TTree *source)
read metadata from the given TTree
Definition:
IShowerLib.cxx:16
ShowerLib::IShowerLib::m_geantVersion
std::string m_geantVersion
geant 4 version
Definition:
IShowerLib.h:110
ShowerLib::IShowerLib::geometry
virtual const std::string geometry() const
get Geometry tag
Definition:
IShowerLib.h:130
IShowerLib.h
ShowerLib::IShowerLib::comment
virtual const std::string comment() const
get comment
Definition:
IShowerLib.h:139
ShowerLib::IShowerLib::m_physicsList
std::string m_physicsList
used geant 4 physics list
Definition:
IShowerLib.h:111
ShowerLib
Namespace for the ShowerLib related classes.
Definition:
LArG4GenShowerLib.h:19
copySelective.source
string source
Definition:
copySelective.py:32
length
double length(const pvec &v)
Definition:
FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
Generated on Thu Nov 7 2024 21:17:28 for ATLAS Offline Software by
1.8.18