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
FairVolumeList.cxx
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file FairVolumeList.cxx
1
// -------------------------------------------------------------------------
2
// ----- FairVolumeList source file -----
3
// ----- Created 12/01/04 by M. Al-Turany -----
4
// -------------------------------------------------------------------------
5
6
7
#include "
FairVolumeList.h
"
8
#include "
FairVolume.h
"
9
10
using
std::cout;
11
using
std::cerr;
12
using
std::endl;
13
14
//_____________________________________________________________________________
15
16
FairVolumeList::FairVolumeList
()
17
:
TObject
(),
18
fData(new TObjArray())
19
{
20
//
21
22
}
23
24
//_____________________________________________________________________________
25
FairVolumeList::~FairVolumeList
()
26
{
27
if
(
fData
) {
28
fData
->Delete();
29
delete
fData
;
30
}
31
}
32
33
//_____________________________________________________________________________
34
FairVolume
*
FairVolumeList::getVolume
(TString*
name
)
35
{
36
37
TObject
* obj =
findObject
(* name);
38
if
(obj) { cout <<
"-I FairVolume getVolume "
<< name->Data() <<
"found"
<< endl; }
39
return
(
FairVolume
*) obj;
40
}
41
42
//_____________________________________________________________________________
43
Int_t
FairVolumeList::getVolumeId
(TString*
name
)
44
{
45
46
TObject
* obj =
findObject
(* name);
47
if
(obj) { cout <<
"-I FairVolume getVolume "
<< name->Data() <<
"found"
<< endl; }
48
FairVolume
* vol = (
FairVolume
*) obj;
49
return
vol->
getVolumeId
();
50
}
51
52
53
54
//_____________________________________________________________________________
55
FairVolume
*
FairVolumeList::findObject
(TString
name
)
56
{
57
FairVolume
* obj = NULL;
58
for
(
int
i = 0; i <
fData
->GetEntriesFast(); i++) {
59
obj = (
FairVolume
*)
fData
->At(i);
60
if
(obj ) {
61
62
if
(obj->GetName() ==
name
) {
return
(
FairVolume
*) obj; }
63
}
64
65
}
66
return
NULL;
67
}
68
69
//_____________________________________________________________________________
70
void
FairVolumeList::addVolume
(
FairVolume
* elem)
71
{
72
73
FairVolume
*
v
= (
FairVolume
*)
findObject
(elem->GetName());
74
75
if
(v) {
76
if
(gDebug>0) { cerr <<
"-I FairVolumeList element: "
<< elem->GetName() <<
" VolId : "
<< elem->
getVolumeId
() <<
" already defined "
<< v->
getVolumeId
()<< endl; }
77
}
else
{
78
79
fData
->Add(elem);
80
}
81
}
82
83
ClassImp
(
FairVolumeList
)
84
85
86
EicRoot
blob
master
base
FairVolumeList.cxx
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:32
using
1.8.2 with
EIC GitHub integration