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
PndMagnet.cxx
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PndMagnet.cxx
1
/* Generated by Together */
2
3
#include "
PndMagnet.h
"
4
#include "
FairGeoLoader.h
"
5
#include "
FairGeoInterface.h
"
6
#include "
PndGeoMagnet.h
"
7
#include "
FairGeoRootBuilder.h
"
8
#include "
FairRuntimeDb.h
"
9
#include "
PndGeoPassivePar.h
"
10
#include "TObjArray.h"
11
#include "
FairRun.h
"
12
#include "
FairGeoVolume.h
"
13
#include "
FairGeoNode.h
"
14
15
PndMagnet::~PndMagnet
()
16
{
17
}
18
PndMagnet::PndMagnet
()
19
{
20
}
21
22
PndMagnet::PndMagnet
(
const
char
*
name
,
const
char
*Title)
23
:
FairModule
(name ,Title)
24
{
25
}
26
27
void
PndMagnet::ConstructGeometry
(){
28
29
TString fileName=
GetGeometryFileName
();
30
if
(fileName.EndsWith(
".geo"
)) {
31
ConstructASCIIGeometry
();
32
}
else
if
(fileName.EndsWith(
".root"
)) {
33
ConstructRootGeometry
();
34
}
else
{
35
std::cout<<
"Geometry format not supported "
<<std::endl;
36
}
37
}
38
39
Bool_t
PndMagnet::CheckIfSensitive
(std::string
name
){
40
// just to get rid of the warrning during run, not need this is a passive element!
41
return
kFALSE;
42
}
43
44
void
PndMagnet::ConstructASCIIGeometry
(){
45
FairGeoLoader
*
loader
=
FairGeoLoader::Instance
();
46
FairGeoInterface
*GeoInterface =loader->
getGeoInterface
();
47
PndGeoMagnet
*MGeo=
new
PndGeoMagnet
();
48
MGeo->
setGeomFile
(
GetGeometryFileName
());
49
GeoInterface->
addGeoModule
(MGeo);
50
Bool_t rc = GeoInterface->
readSet
(MGeo);
51
if
( rc ) MGeo->
create
(loader->
getGeoBuilder
());
52
53
TList* volList = MGeo->
getListOfVolumes
();
54
// store geo parameter
55
FairRun
*fRun =
FairRun::Instance
();
56
FairRuntimeDb
*rtdb=
FairRun::Instance
()->
GetRuntimeDb
();
57
PndGeoPassivePar
* par=(
PndGeoPassivePar
*)(rtdb->
getContainer
(
"PndGeoPassivePar"
));
58
TObjArray *fSensNodes = par->
GetGeoSensitiveNodes
();
59
TObjArray *fPassNodes = par->
GetGeoPassiveNodes
();
60
61
TListIter iter(volList);
62
FairGeoNode
* node = NULL;
63
FairGeoVolume
*aVol=NULL;
64
65
while
( (node = (
FairGeoNode
*)iter.Next()) ) {
66
aVol =
dynamic_cast<
FairGeoVolume
*
>
( node );
67
if
( node->
isSensitive
() ) {
68
fSensNodes->AddLast( aVol );
69
}
else
{
70
fPassNodes->AddLast( aVol );
71
}
72
}
73
ProcessNodes
( volList );
74
par->
setChanged
();
75
par->
setInputVersion
(fRun->
GetRunId
(),1);
76
}
77
78
ClassImp
(
PndMagnet
)
79
80
81
82
83
84
85
86
87
88
89
90
91
92
EicRoot
blob
master
passive
PndMagnet.cxx
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:37
using
1.8.2 with
EIC GitHub integration