EIC Software
 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 
17  :TObject(),
18  fData(new TObjArray())
19 {
20  //
21 
22 }
23 
24 //_____________________________________________________________________________
26 {
27  if (fData) {
28  fData->Delete();
29  delete fData;
30  }
31 }
32 
33 //_____________________________________________________________________________
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 //_____________________________________________________________________________
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 //_____________________________________________________________________________
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 //_____________________________________________________________________________
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 
84 
85 
86