BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
EventDisplay/BesVisLib/BesVisLib-00-06-02/BesVisLib/EmcROOTGeo.h
Go to the documentation of this file.
1//$id$
2/*
3 * 2004/11/29 Zhengyun You Peking University
4 * Emc Geometry General for EventDisplay
5 *
6 * 2004/12/11 Zhengyun You Peking University
7 * named from EmcGeo to EmcROOTGeo
8 * inherit from class SubDetectorROOTGeo
9 *
10 * 2005/04/04 Zhengyun You Peking University
11 * Emc End geometry added
12 */
13
14#ifndef Emc_ROOT_GEO_H
15#define Emc_ROOT_GEO_H
16
17#include <TGeoVolume.h>
18#include <TGeoNode.h>
19#include <TGeoPhysicalNode.h>
20
21#include "SubDetectorROOTGeo.h"
22#include "Emc2DCrystal.h"
23
24/**
25 * Class EmcGeo contains all of the objects necessary to describe the
26 * emc geometry.
27 *
28 * @author Zhengyun You \URL{mailto:[email protected]}
29 *
30 */
31
32class EmcROOTGeo : public SubDetectorROOTGeo
33{
34 public:
35
36 /// Constructor.
38
39 /// Destructor.
41
42 /// Initialize ROOTGeo from GDML.
43 void InitFromGDML( const char *gdmlFile, const char *setupName );
44
45 /// Initialize ROOTGeo from TGeoVolume logicalEmc.
46 void InitFromROOT( TGeoVolume *vol );
47
48 /// Initialize 2D Geometry
49 void Init2DGeometry();
50
51 /// Set the pointers to theirs nodes;
52 void SetNode();
53
54 /// Set default visual attributes;
56
57 /// Set default visual attributes;
59
60 /// Set all visible;
62
63 /// Set quater visible;
65
66 /// Set half visible;
67 void SetHalfVisible();
68
69 /// Set noend visible;
70 void SetNoEndVisible();
71
72 /// Set the pointers to the physical nodes;
74
75 /// Set default physical node attributes;
76 void SetPhysicalDefaultVis(); //Long Peixun's update: Remove annotation
77
78 /// Set Detecor (what is detector depends on you)
79 void SetDetector();
80
81 /// Set all physicalNodes corresponding to digiCol;
82 void SetHits();
83
84 /// Set Emc detector visibility;
85 void SetVisEmcDetector();
86
87 /// Set Emc hits visibility;
88 void SetVisEmcHits();
89
90 /// Get number of part;
91 int GetPartNb();
92
93 /// Get number of theta on part;
94 int GetThetaNb(int part);
95
96 /// Get number of phi on part;
97 int GetPhiNb(int part, int theta);
98
99 /// Set Emc volume, while initializing from ROOT;
100 void SetVolumeEmc(TGeoVolume *vol) { m_Emc = vol; }
101
102 /// Get Emc volume;
103 TGeoVolume *GetVolumeEmc() { return m_Emc; }
104
105 /// Get part volume;
106 TGeoVolume *GetVolumePart( int part );
107
108 /// Get phi volume;
109 TGeoVolume *GetVolumePhi( int part, int phi );
110
111 /// Get theta volume;
112 TGeoVolume *GetVolumeTheta( int part, int phi, int theta );
113
114 /// Get crystal volume;
115 TGeoVolume *GetVolumeCrystal( int part, int phi, int theta );
116
117 /// Get part node;
118 TGeoNode *GetPart( int part );
119
120 /// Get phi node;
121 TGeoNode *GetPhi( int part, int phi );
122
123 /// Get theta node;
124 TGeoNode *GetTheta( int part, int phi, int theta );
125
126 /// Get theta2 node;
127 TGeoNode *GetTheta2( int part, int phi, int theta );
128
129 /// Get crystal one;
130 TGeoNode *GetCrystal( int part, int phi, int theta );
131
132 /// Get crystal2 one;
133 TGeoNode *GetCrystal2( int part, int phi, int theta );
134
135 /// Get crystal physical node; all part,phi,theta has a physicalNode
136 TGeoPhysicalNode *GetPhysicalCrystal( int part, int phi, int theta);
137
138 /// Get crystal physical node2; EC nb 5,6,14,15,16 in any sector has two physicalNode
139 TGeoPhysicalNode *GetPhysicalCrystal2( int part, int phi, int theta);
140
141 /// Whether this id is combined of two nodes
142 bool HasTwoNodes( int part, int phi, int theta );
143
144 /// Compute theta, phi from sector, nb
145 void ComputeThetaPhi( int id, int sector, int nb, int &CryNumberTheta, int &CryNumberPhi);
146
147 /// Compute copyNb, copyNb 5,6,14,15,16 corresponding to two volume
148 int ComputeEndCopyNb(int num);
149
150 /// Get Emc2DCrystal;
151 Emc2DCrystal *Get2DCrystal( Int_t part, Int_t phi, Int_t theta );
152
153 /// Get part no of a crystal physcial node
154 Int_t GetPart(TGeoPhysicalNode* phyNode);
155
156 /// Draw function
157 void Draw(Option_t *option);
158
159 /// Draw 2D hits
160 void DrawHits(Option_t *option);
161
162 /// Align a physical node, change its position and shape
163 void Align(TGeoPhysicalNode *phyNode, TGeoMatrix *newmat=0, TGeoShape *newshape=0, Bool_t check=kFALSE);
164
165 /// Restore the physical node to original shape
166 void RestorePhyNode(TGeoPhysicalNode *phyNode, TGeoNode *node);
167
168 private:
169 static const int m_kPart = 3;
170 static const int m_kPhiBr = 120;
171 static const int m_kThetaBr = 44;
172
173 int m_kPhiEc;
174 int m_kThetaEc;
175 int m_kSectorEc;
176 int m_kNbEc;
177 int m_kRealNbEc;
178
179 int m_EmcColor;
180 int m_partColor;
181 int m_phiColor;
182 int m_thetaColor;
183 int m_brCrystalColor;
184 int m_ecCrystalColor;
185
186 static const int EMC_TIME_FACTOR = 1;
187 static const int EMC_CHARGE_FACTOR = 1000;
188
189 TGeoVolume *m_Emc;
190 TGeoNode *m_NodePart[m_kPart];
191 TGeoNode *m_NodePhi[m_kPart][m_kPhiBr];
192 TGeoNode *m_NodeTheta[m_kPart][m_kPhiBr][m_kThetaBr]; // m_kPhiBr > m_kPhiEc, m_kThetaBr > m_kThetaEc
193 TGeoNode *m_NodeTheta2[m_kPart][m_kPhiBr][m_kThetaBr]; // contains theta phi has tow nodes
194 TGeoPhysicalNode *m_PhysicalCrystal[m_kPart][m_kPhiBr][m_kThetaBr];
195 TGeoPhysicalNode *m_PhysicalCrystal2[m_kPart][m_kPhiBr][m_kThetaBr];
196
197 TObjArray *m_PhyNodeOrgArray;
198
199 // Volume refer to logicalVolume, only refer to the one exists.
200 // Node refer to physicalVolume, each real theta has a corresponding physical volume, althought they may be the same one.
201 // PhysicalNode gives the path combined by physical volume, it's unique for each real theta.
202
203 const TObjArray *m_EmcDigiCol;
204
205 // 2D
206 Emc2DCrystal *m_Emc2DCrystal[m_kPart][m_kPhiBr][m_kThetaBr];
207
208};
209
210#endif /* Emc_ROOT_GEO_H */
legend Draw()
TGeoVolume * GetVolumeCrystal(int part, int phi, int theta)
Get crystal volume;.
int ComputeEndCopyNb(int num)
Compute copyNb, copyNb 5,6,14,15,16 corresponding to two volume.
void SetVisEmcDetector()
Set Emc detector visibility;.
TGeoNode * GetCrystal(int part, int phi, int theta)
Get crystal one;.
TGeoVolume * GetVolumeTheta(int part, int phi, int theta)
Get theta volume;.
TGeoNode * GetTheta(int part, int phi, int theta)
Get theta node;.
int GetPartNb()
Get number of part;.
void SetPhysicalDefaultVis()
Set default physical node attributes;.
TGeoVolume * GetVolumePart(int part)
Get part volume;.
TGeoNode * GetCrystal2(int part, int phi, int theta)
Get crystal2 one;.
void Align(TGeoPhysicalNode *phyNode, TGeoMatrix *newmat=0, TGeoShape *newshape=0, Bool_t check=kFALSE)
Align a physical node, change its position and shape.
void ComputeThetaPhi(int id, int sector, int nb, int &CryNumberTheta, int &CryNumberPhi)
Compute theta, phi from sector, nb.
TGeoNode * GetPart(int part)
Get part node;.
~EmcROOTGeo()
Destructor.
Emc2DCrystal * Get2DCrystal(Int_t part, Int_t phi, Int_t theta)
Get Emc2DCrystal;.
TGeoPhysicalNode * GetPhysicalCrystal2(int part, int phi, int theta)
Get crystal physical node2; EC nb 5,6,14,15,16 in any sector has two physicalNode.
int GetPhiNb(int part)
Get number of phi on part;.
void InitFromROOT(TGeoVolume *vol)
Initialize ROOTGeo from TGeoVolume logicalEmc.
void SetAllVisible()
Set all visible;.
TGeoVolume * GetVolumePhi(int part, int phi)
Get phi volume;
void InitFromGDML(const char *gdmlFile, const char *setupName)
Initialize ROOTGeo from GDML.
EmcROOTGeo()
Constructor.
void SetPhysicalNode()
Set the pointers to the physical nodes;.
void SetVolumeAppendInVis()
Set default visual attributes;.
void SetNode()
Set the pointers to theirs nodes;.
int GetThetaNb(int part)
Get number of theta on part;.
bool HasTwoNodes(int part, int phi, int theta)
Whether this id is combined of two nodes.
TGeoNode * GetPhi(int part, int phi)
Get phi node;.
void RestorePhyNode(TGeoPhysicalNode *phyNode, TGeoNode *node)
Restore the physical node to original shape.
TGeoPhysicalNode * GetPhysicalCrystal(int part, int phi, int theta)
Get crystal physical node; all part,phi,theta has a physicalNode.
TGeoNode * GetTheta2(int part, int phi, int theta)
Get theta2 node;.
void SetDetector()
Set Detecor (what is detector depends on you)
void SetVolumeEmc(TGeoVolume *vol)
Set Emc volume, while initializing from ROOT;.
void SetVolumeDefaultVis()
Set default visual attributes;.
void SetQuarterVisible()
Set quater visible;.
void SetHits()
Set all physicalNodes corresponding to digiCol;.