KaliVeda
Toolkit for HIC analysis
KVGeoStrucElement.h
1 
4 #ifndef __KVGEOSTRUCELEMENT_H
5 #define __KVGEOSTRUCELEMENT_H
6 
7 #include "KVBase.h"
8 #include "KVUniqueNameList.h"
9 class KVDetector;
10 
18 class KVGeoStrucElement : public KVBase {
19  void init();
20 
21 protected:
25 
28 
29 public:
31  KVGeoStrucElement(const Char_t* name, const Char_t* type = "");
32  virtual ~KVGeoStrucElement();
33 
34  void SetOwnsDaughters(Bool_t yes = kTRUE)
35  {
38  fStructures.SetOwner(yes);
39  }
40 
41  void SetOwnsDetectors(Bool_t yes = kTRUE)
42  {
45  fDetectors.SetOwner(yes);
46  }
47 
48  bool OwnsDaughters() const
49  {
52  return fStructures.IsOwner();
53  }
54 
55  bool OwnsDetectors() const
56  {
59  return fDetectors.IsOwner();
60  }
61 
62  void Sort(Bool_t order = kSortAscending)
63  {
64  SortStructures(order);
65  SortDetectors(order);
66  }
67  void SortStructures(Bool_t order = kSortAscending)
68  {
69  fStructures.Sort(order);
70  }
71  void SortDetectors(Bool_t order = kSortAscending)
72  {
73  fDetectors.Sort(order);
74  }
75  void ClearDetectors(const Char_t* type = "");
76  void ClearStructures(const Char_t* type = "");
77 
78  virtual void Add(KVBase*);
79  virtual void Remove(KVBase*);
80 
81  void Clear(Option_t* opt = "");
82 
83  virtual Bool_t Contains(KVBase* name) const
84  {
87 
89  if (det != nullptr) return kTRUE;
90  return (GetStructures()->FindObject(name) != nullptr);
91  }
92 
94  {
97  }
98  KVGeoStrucElement* GetStructure(const Char_t* type, Int_t num) const;
99  KVGeoStrucElement* GetStructure(const Char_t* type, const Char_t* name) const;
100  KVSeqCollection* GetStructureTypeList(const Char_t* type) const;
101  KVDetector* GetDetector(const Char_t* name) const;
102 
103  KVDetector* GetDetectorByType(const Char_t* type) const;
104 
105  KVSeqCollection* GetDetectorTypeList(const Char_t* type) const;
106  KVSeqCollection* GetDetectorNameList(const Char_t* name) const;
107  KVDetector* GetDetectorAny(const Char_t* name);
108 
110  {
111  return &fDetectors;
112  }
114  {
115  return &fDetectors;
116  }
118  {
119  return &fStructures;
120  }
122  {
123  return &fParentStrucList;
124  }
125  virtual Bool_t Fired(Option_t* opt = "any") const;
126  KVGeoStrucElement* GetParentStructure(const Char_t* type, const Char_t* name = "") const;
127 
128  void Print(Option_t* option = "") const;
129 
130  ClassDef(KVGeoStrucElement, 1) //A multidetector array geometry structural element
131 };
132 
133 #endif
int Int_t
bool Bool_t
char Char_t
constexpr Bool_t kTRUE
const char Option_t
#define ClassDef(name, id)
char name[80]
Base class for KaliVeda framework.
Definition: KVBase.h:142
Base class for detector geometry description.
Definition: KVDetector.h:160
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.
KVSeqCollection * GetDetectorNameList(const Char_t *name) const
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.
KVSeqCollection * GetDetectors()
void Sort(Bool_t order=kSortAscending)
Definition: KVHashList.h:44
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