FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairGeoNode.h
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 #ifndef FAIRGEONODE_H
9 #define FAIRGEONODE_H
10 
11 #include "FairGeoBasicShape.h" // for FairGeoBasicShape
12 #include "FairGeoMedium.h" // for FairGeoMedium
13 #include "FairGeoTransform.h" // for FairGeoTransform
14 #include "FairGeoVolume.h" // for FairGeoVolume
15 
16 #include <Rtypes.h> // for Bool_t, FairGeoNode::Class, etc
17 #include <TObjArray.h> // for TObjArray
18 #include <TString.h> // for TString
19 #include <iosfwd> // for fstream
20 
21 class FairGeoVector;
22 class TArrayD;
23 class TGeoVolume;
24 class TList;
25 
27 {
33 };
34 
39 class FairGeoNode : public FairGeoVolume
40 {
41  private:
42  FairGeoNode(const FairGeoNode&);
43  FairGeoNode& operator=(const FairGeoNode&);
44 
45  protected:
46  Bool_t active;
49  Bool_t created;
51  TGeoVolume* rootVolume;
56  TObjArray* fDaughterList;
57  // const char* fTruncName; //
58  TString fTruncName;
59 
60  public:
61  FairGeoNode();
63  virtual ~FairGeoNode();
64  void AddDaughter(FairGeoNode* fNode) { fDaughterList->AddLast(fNode); }
65  TObjArray* GetListOfDaughters() { return fDaughterList; }
67  Bool_t isTopNode() { return static_cast<Bool_t>((volumeType == kFairGeoTopNode)); }
68  Bool_t isRefNode() { return static_cast<Bool_t>((volumeType == kFairGeoRefNode)); }
69  Bool_t isKeepin() { return static_cast<Bool_t>((volumeType == kFairGeoKeepin)); }
70  Bool_t isModule() { return static_cast<Bool_t>((volumeType == kFairGeoModule)); }
71  Int_t getCopyNo();
75  Bool_t isActive() { return active; }
77  TArrayD* getParameters();
81  TGeoVolume* getRootVolume() { return rootVolume; }
82  TList* getTree();
83  Bool_t isSensitive();
84  Bool_t isCreated() { return created; }
85  void setCreated() { created = kTRUE; }
86  void setName(const Text_t* s);
89  void setShape(FairGeoBasicShape* s);
90  void setMother(FairGeoNode* s);
91  void setMedium(FairGeoMedium* med) { medium = med; }
92  void setActive(Bool_t a = kTRUE) { active = a; }
93  void setCenterPosition(const FairGeoTransform& t) { center = t; }
94  void setCopyNode(FairGeoNode* p) { copyNode = p; }
95  void setRootVolume(TGeoVolume* p) { rootVolume = p; }
99  Bool_t calcRefPos(FairGeoVector&);
100  void clear();
101  void print();
102  Bool_t write(std::fstream&);
103  Int_t compare(FairGeoNode&);
104 
105  void setTruncName(const char* aName) { fTruncName = aName; }
106  const char* getTruncName()
107  {
108  if (fTruncName.Length() > 0) {
109  return fTruncName.Data();
110  } else {
111  return GetName();
112  }
113  }
114 
115  ClassDef(FairGeoNode, 1); //
116 };
117 
118 // -------------------- inlines --------------------------
119 
120 inline void FairGeoNode::setName(const Text_t* s)
121 {
122  // Sets the name of the volume
123  fName = s;
124  fName.ToUpper();
125 }
126 
128 {
129  // Sets the shape of the volume
130  if (s) {
131  pShape = s;
132  shape = pShape->GetName();
133  }
134 }
135 
137 {
138  // Sets the mother of the volume
139  if (moth) {
140  pMother = moth;
141  mother = pMother->GetName();
142  pMother->AddDaughter(this);
143  }
144 }
145 
147 {
148  if (medium) {
149  return medium->isSensitive();
150  } else {
151  return kFALSE;
152  }
153 }
154 
155 #endif /* !FAIRGEONODE_H */
FairGeoNode * copyNode
Definition: FairGeoNode.h:50
void setTruncName(const char *aName)
Definition: FairGeoNode.h:105
void setCreated()
Definition: FairGeoNode.h:85
FairGeoNode * getMotherNode()
Definition: FairGeoNode.h:73
Bool_t active
Definition: FairGeoNode.h:46
TString fTruncName
Definition: FairGeoNode.h:58
TObjArray * GetListOfDaughters()
Definition: FairGeoNode.h:65
FairGeoTransform * calcLabTransform()
ClassDef(FairGeoNode, 1)
void setCopyNode(FairGeoNode *p)
Definition: FairGeoNode.h:94
void setActive(Bool_t a=kTRUE)
Definition: FairGeoNode.h:92
TString mother
Definition: FairGeoVolume.h:32
Bool_t isSensitive()
Definition: FairGeoNode.h:146
Bool_t isActive()
Definition: FairGeoNode.h:75
TArrayD * getParameters()
Int_t getCopyNo()
FairGeoTransform & getCenterPosition()
Definition: FairGeoNode.h:76
TGeoVolume * getRootVolume()
Definition: FairGeoNode.h:81
Bool_t isCreated()
Definition: FairGeoNode.h:84
void setRootVolume(TGeoVolume *p)
Definition: FairGeoNode.h:95
FairGeoNode * getCopyNode()
Definition: FairGeoNode.h:80
TObjArray * fDaughterList
Definition: FairGeoNode.h:56
Bool_t isKeepin()
Definition: FairGeoNode.h:69
void setMother(FairGeoNode *s)
Definition: FairGeoNode.h:136
void setShape(FairGeoBasicShape *s)
Definition: FairGeoNode.h:127
Bool_t calcModuleTransform(FairGeoTransform &)
FairGeoTransform center
Definition: FairGeoNode.h:47
Bool_t isTopNode()
Definition: FairGeoNode.h:67
virtual ~FairGeoNode()
Definition: FairGeoNode.cxx:82
FairGeoTransform * getPosition()
Bool_t calcRefPos(FairGeoVector &)
EFairGeoNodeType getVolumeType()
Definition: FairGeoNode.h:66
Bool_t write(std::fstream &)
Bool_t created
Definition: FairGeoNode.h:49
EFairGeoNodeType volumeType
Definition: FairGeoNode.h:48
Bool_t isRefNode()
Definition: FairGeoNode.h:68
void setVolumePar(FairGeoNode &)
FairGeoBasicShape * pShape
Definition: FairGeoNode.h:52
void setVolumeType(EFairGeoNodeType t)
Definition: FairGeoNode.h:87
TList * getTree()
void setMedium(FairGeoMedium *med)
Definition: FairGeoNode.h:91
void setLabTransform(FairGeoTransform &)
FairGeoMedium * getMedium()
Definition: FairGeoNode.h:74
Bool_t isModule()
Definition: FairGeoNode.h:70
TGeoVolume * rootVolume
Definition: FairGeoNode.h:51
EFairGeoNodeType
Definition: FairGeoNode.h:26
const char * getTruncName()
Definition: FairGeoNode.h:106
void setName(const Text_t *s)
Definition: FairGeoNode.h:120
FairGeoNode * pMother
Definition: FairGeoNode.h:53
FairGeoMedium * medium
/** pointer to the mother volume */
Definition: FairGeoNode.h:54
void AddDaughter(FairGeoNode *fNode)
Definition: FairGeoNode.h:64
FairGeoTransform * getLabTransform()
FairGeoTransform * labTransform
Definition: FairGeoNode.h:55
Int_t compare(FairGeoNode &)
void setCenterPosition(const FairGeoTransform &t)
Definition: FairGeoNode.h:93
FairGeoBasicShape * getShapePointer()
Definition: FairGeoNode.h:72
Bool_t isSensitive()
Definition: FairGeoMedium.h:92