KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVGeoStrucElement.h
Go to the documentation of this file.
1 
4 #ifndef __KVGEOSTRUCELEMENT_H
5 #define __KVGEOSTRUCELEMENT_H
6 
7 #include "KVBase.h"
8 #include "KVUniqueNameList.h"
9 class KVDetector;
10 
17 class KVGeoStrucElement : public KVBase {
18  void init();
19 
20 protected:
24 
27 
28 public:
30  KVGeoStrucElement(const Char_t* name, const Char_t* type = "");
31  virtual ~KVGeoStrucElement();
32 
33  void SetOwnsDaughters(Bool_t yes = kTRUE)
34  {
37  fStructures.SetOwner(yes);
38  }
39 
40  void SetOwnsDetectors(Bool_t yes = kTRUE)
41  {
44  fDetectors.SetOwner(yes);
45  }
46 
47  bool OwnsDaughters() const
48  {
51  return fStructures.IsOwner();
52  }
53 
54  bool OwnsDetectors() const
55  {
58  return fDetectors.IsOwner();
59  }
60 
61  void Sort(Bool_t order = kSortAscending)
62  {
63  SortStructures(order);
64  SortDetectors(order);
65  }
66  void SortStructures(Bool_t order = kSortAscending)
67  {
68  fStructures.Sort(order);
69  }
70  void SortDetectors(Bool_t order = kSortAscending)
71  {
72  fDetectors.Sort(order);
73  }
74  void ClearDetectors(const Char_t* type = "");
75  void ClearStructures(const Char_t* type = "");
76 
77  virtual void Add(KVBase*);
78  virtual void Remove(KVBase*);
79 
80  void Clear(Option_t* opt = "");
81 
82  virtual Bool_t Contains(KVBase* name) const
83  {
86 
87  TObject* det = GetDetectors()->FindObject(name);
88  if (det != nullptr) return kTRUE;
89  return (GetStructures()->FindObject(name) != nullptr);
90  }
91 
93  {
96  }
97  KVGeoStrucElement* GetStructure(const Char_t* type, Int_t num) const;
98  KVGeoStrucElement* GetStructure(const Char_t* type, const Char_t* name) const;
99  KVSeqCollection* GetStructureTypeList(const Char_t* type) const;
100  KVDetector* GetDetector(const Char_t* name) const;
101 
102  KVDetector* GetDetectorByType(const Char_t* type) const;
103 
104  KVSeqCollection* GetDetectorTypeList(const Char_t* type) const;
105  KVDetector* GetDetectorAny(const Char_t* name);
106 
108  {
109  return &fDetectors;
110  }
112  {
113  return &fStructures;
114  }
116  {
117  return &fParentStrucList;
118  }
119  virtual Bool_t Fired(Option_t* opt = "any") const;
120  KVGeoStrucElement* GetParentStructure(const Char_t* type, const Char_t* name = "") const;
121 
122  void Print(Option_t* option = "") const;
123 
124  ClassDef(KVGeoStrucElement, 1) //A multidetector array geometry structural element
125 };
126 
127 #endif
int Int_t
char Char_t
bool Bool_t
const Bool_t kTRUE
const char Option_t
#define ClassDef(name, id)
Base class for KaliVeda framework.
Definition: KVBase.h:135
Base class for detector geometry description, interface to energy-loss calculations.
Definition: KVDetector.h:121
Base class describing elements of array geometry.
virtual Bool_t Fired(Option_t *opt="any") const
void SortStructures(Bool_t order=kSortAscending)
void SetOwnsDetectors(Bool_t yes=kTRUE)
void RemoveParentStructure(KVGeoStrucElement *)
KVUniqueNameList fDetectors
detectors in this structure element
virtual Bool_t Contains(KVBase *name) const
void Sort(Bool_t order=kSortAscending)
void Print(Option_t *option="") const
void SortDetectors(Bool_t order=kSortAscending)
void AddParentStructure(KVGeoStrucElement *)
KVDetector * GetDetector(const Char_t *name) const
Return detector in this structure with given name.
KVUniqueNameList fStructures
daughter structures
const KVSeqCollection * GetDetectors() const
bool OwnsDetectors() const
virtual void Remove(KVBase *)
KVSeqCollection * GetDetectorTypeList(const Char_t *type) const
KVUniqueNameList fParentStrucList
parent structures
const KVSeqCollection * GetStructures() const
KVDetector * GetDetectorAny(const Char_t *name)
void SetOwnsDaughters(Bool_t yes=kTRUE)
KVGeoStrucElement()
Default constructor.
virtual void Add(KVBase *)
virtual ~KVGeoStrucElement()
Destructor.
KVSeqCollection * GetStructureTypeList(const Char_t *type) const
KVGeoStrucElement * GetStructure(const Char_t *name) const
void Clear(Option_t *opt="")
Empty lists of detectors, daughter structures, and parent structures.
void ClearStructures(const Char_t *type="")
void init()
Default initialisations.
KVGeoStrucElement * GetParentStructure(const Char_t *type, const Char_t *name="") const
bool OwnsDaughters() const
void ClearDetectors(const Char_t *type="")
const KVSeqCollection * GetParents() const
KVDetector * GetDetectorByType(const Char_t *type) const
Return detector in this structure with given type.
void Sort(Bool_t order=kSortAscending)
Definition: KVHashList.h:43
KaliVeda extensions to ROOT collection classes.
virtual void SetOwner(Bool_t enable=kTRUE)
virtual TObject * FindObject(const char *name) const
Optimised list in which named objects can only be placed once.
Bool_t IsOwner() const
virtual TObject * FindObject(const char *name) const