FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairGeoCompositeVolume.cxx
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 //*-- AUTHOR : Ilse Koenig
9 //*-- Modified : 20/04/99
10 
12 // FairGeoCompositeVolume
13 //
14 //
16 #include "FairGeoCompositeVolume.h"
17 
18 #include <TObjArray.h> // for TObjArray
19 
21 
23  : FairGeoVolume()
24  , components(nullptr)
25 {
26  if (nComp) {
27  components = new TObjArray(nComp);
28  for (Int_t i = 0; i < nComp; i++) {
29  components->AddAt(new FairGeoVolume(), i);
30  }
31  }
32 }
33 
35 {
36  if (components) {
37  components->Delete();
38  }
39  delete components;
40 }
41 
43 {
44  if (components) {
45  return components->GetSize();
46  } else {
47  return 0;
48  }
49 }
50 
52 {
53  return static_cast<FairGeoVolume*>(components->At(n));
54 }
55 
57 {
58  if (components) {
59  components->Delete();
60  } else {
61  components = new TObjArray();
62  }
63  components->Expand(n);
64 }
65 
67 {
68  if (components) {
69  components->AddAt(v, n);
70  } else {
71  Error("FairGeoCompositeVolume::setComponent", "no array of components");
72  }
73 }
74 
76 {
78  Int_t n = getNumComponents();
79  for (Int_t i = 0; i < n; i++) {
80  (static_cast<FairGeoVolume*>(components->At(i)))->clear();
81  }
82 }
83 
85 {
87  FairGeoVolume* v;
88  for (Int_t i = 0; i < components->GetSize(); i++) {
89  v = static_cast<FairGeoVolume*>(components->At(i));
90  if (v) {
91  v->print();
92  }
93  }
94 }
ClassImp(FairEventBuilder)
void setComponent(FairGeoVolume *, const Int_t)
void createComponents(const Int_t)
virtual void clear()
FairGeoVolume * getComponent(const Int_t)
virtual void print()