BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EventDisplay/BesVisLib/include/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 <TGeoNode.h>
18#include <TGeoPhysicalNode.h>
19#include <TGeoVolume.h>
20
21#include "Emc2DCrystal.h"
22#include "SubDetectorROOTGeo.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:youzy@hep.pku.cn}
29 *
30 */
31
32class EmcROOTGeo : public SubDetectorROOTGeo {
33public:
34 /// Constructor.
36
37 /// Destructor.
39
40 /// Initialize ROOTGeo from GDML.
41 void InitFromGDML( const char* gdmlFile, const char* setupName );
42
43 /// Initialize ROOTGeo from TGeoVolume logicalEmc.
44 void InitFromROOT( TGeoVolume* vol );
45
46 /// Initialize 2D Geometry
47 void Init2DGeometry();
48
49 /// Set the pointers to theirs nodes;
50 void SetNode();
51
52 /// Set default visual attributes;
54
55 /// Set default visual attributes;
57
58 /// Set all visible;
60
61 /// Set quater visible;
63
64 /// Set half visible;
65 void SetHalfVisible();
66
67 /// Set noend visible;
68 void SetNoEndVisible();
69
70 /// Set the pointers to the physical nodes;
72
73 /// Set default physical node attributes;
74 void SetPhysicalDefaultVis(); // Long Peixun's update: Remove annotation
75
76 /// Set Detecor (what is detector depends on you)
77 void SetDetector();
78
79 /// Set all physicalNodes corresponding to digiCol;
80 void SetHits();
81
82 /// Set Emc detector visibility;
83 void SetVisEmcDetector();
84
85 /// Set Emc hits visibility;
86 void SetVisEmcHits();
87
88 /// Get number of part;
89 int GetPartNb();
90
91 /// Get number of theta on part;
92 int GetThetaNb( int part );
93
94 /// Get number of phi on part;
95 int GetPhiNb( int part, int theta );
96
97 /// Set Emc volume, while initializing from ROOT;
98 void SetVolumeEmc( TGeoVolume* vol ) { m_Emc = vol; }
99
100 /// Get Emc volume;
101 TGeoVolume* GetVolumeEmc() { return m_Emc; }
102
103 /// Get part volume;
104 TGeoVolume* GetVolumePart( int part );
105
106 /// Get phi volume;
107 TGeoVolume* GetVolumePhi( int part, int phi );
108
109 /// Get theta volume;
110 TGeoVolume* GetVolumeTheta( int part, int phi, int theta );
111
112 /// Get crystal volume;
113 TGeoVolume* GetVolumeCrystal( int part, int phi, int theta );
114
115 /// Get part node;
116 TGeoNode* GetPart( int part );
117
118 /// Get phi node;
119 TGeoNode* GetPhi( int part, int phi );
120
121 /// Get theta node;
122 TGeoNode* GetTheta( int part, int phi, int theta );
123
124 /// Get theta2 node;
125 TGeoNode* GetTheta2( int part, int phi, int theta );
126
127 /// Get crystal one;
128 TGeoNode* GetCrystal( int part, int phi, int theta );
129
130 /// Get crystal2 one;
131 TGeoNode* GetCrystal2( int part, int phi, int theta );
132
133 /// Get crystal physical node; all part,phi,theta has a physicalNode
134 TGeoPhysicalNode* GetPhysicalCrystal( int part, int phi, int theta );
135
136 /// Get crystal physical node2; EC nb 5,6,14,15,16 in any sector has two physicalNode
137 TGeoPhysicalNode* GetPhysicalCrystal2( int part, int phi, int theta );
138
139 /// Whether this id is combined of two nodes
140 bool HasTwoNodes( int part, int phi, int theta );
141
142 /// Compute theta, phi from sector, nb
143 void ComputeThetaPhi( int id, int sector, int nb, int& CryNumberTheta, int& CryNumberPhi );
144
145 /// Compute copyNb, copyNb 5,6,14,15,16 corresponding to two volume
146 int ComputeEndCopyNb( int num );
147
148 /// Get Emc2DCrystal;
149 Emc2DCrystal* Get2DCrystal( Int_t part, Int_t phi, Int_t theta );
150
151 /// Get part no of a crystal physcial node
152 Int_t GetPart( TGeoPhysicalNode* phyNode );
153
154 /// Draw function
155 void Draw( Option_t* option );
156
157 /// Draw 2D hits
158 void DrawHits( Option_t* option );
159
160 /// Align a physical node, change its position and shape
161 void Align( TGeoPhysicalNode* phyNode, TGeoMatrix* newmat = 0, TGeoShape* newshape = 0,
162 Bool_t check = kFALSE );
163
164 /// Restore the physical node to original shape
165 void RestorePhyNode( TGeoPhysicalNode* phyNode, TGeoNode* node );
166
167private:
168 static const int m_kPart = 3;
169 static const int m_kPhiBr = 120;
170 static const int m_kThetaBr = 44;
171
172 int m_kPhiEc;
173 int m_kThetaEc;
174 int m_kSectorEc;
175 int m_kNbEc;
176 int m_kRealNbEc;
177
178 int m_EmcColor;
179 int m_partColor;
180 int m_phiColor;
181 int m_thetaColor;
182 int m_brCrystalColor;
183 int m_ecCrystalColor;
184
185 static const int EMC_TIME_FACTOR = 1;
186 static const int EMC_CHARGE_FACTOR = 1000;
187
188 TGeoVolume* m_Emc;
189 TGeoNode* m_NodePart[m_kPart];
190 TGeoNode* m_NodePhi[m_kPart][m_kPhiBr];
191 TGeoNode* m_NodeTheta[m_kPart][m_kPhiBr][m_kThetaBr]; // m_kPhiBr > m_kPhiEc, m_kThetaBr >
192 // 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,
201 // althought they may be the same one. PhysicalNode gives the path combined by physical
202 // volume, it's unique for each real theta.
203
204 const TObjArray* m_EmcDigiCol;
205
206 // 2D
207 Emc2DCrystal* m_Emc2DCrystal[m_kPart][m_kPhiBr][m_kThetaBr];
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 SetVisEmcHits()
Set Emc hits visibility;.
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.
TGeoVolume * GetVolumeEmc()
Get Emc volume;.
void SetHalfVisible()
Set half visible;.
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 SetNoEndVisible()
Set noend visible;.
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.
void DrawHits(Option_t *option)
Draw 2D hits.
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 Init2DGeometry()
Initialize 2D Geometry.
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;.