BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcRecROOTGeo Class Reference

#include <EmcRecROOTGeo.h>

Public Member Functions

 EmcRecROOTGeo ()
 
 ~EmcRecROOTGeo ()
 
void InitFromXML ()
 
void FillCrystalMap (EmcRecCrystal &, const int, const int, const int)
 
EmcRecCrystal GetCrystal (const Identifier &id) const
 
HepPoint3D GetCCenter (const Identifier &id) const
 
HepPoint3D GetCFrontCenter (const Identifier &id) const
 
void ComputeThetaPhi (const int part, const int theta, const int phi, int &newTheta, int &newPhi)
 

Detailed Description

Definition at line 21 of file EmcRecROOTGeo.h.

Constructor & Destructor Documentation

◆ EmcRecROOTGeo()

EmcRecROOTGeo::EmcRecROOTGeo ( )

Definition at line 20 of file EmcRecROOTGeo.cxx.

21{
22 m_crystalMap.clear();
23}

◆ ~EmcRecROOTGeo()

EmcRecROOTGeo::~EmcRecROOTGeo ( )

Definition at line 25 of file EmcRecROOTGeo.cxx.

26{
27 m_crystalMap.clear();
28}

Member Function Documentation

◆ ComputeThetaPhi()

void EmcRecROOTGeo::ComputeThetaPhi ( const int part,
const int theta,
const int phi,
int & newTheta,
int & newPhi )

Definition at line 179 of file EmcRecROOTGeo.cxx.

181{
182 int sector = phi;
183 if((sector>=0)&&(sector<3))
184 sector+=16;
185 //if((sector!=7)&&(sector!=15))
186 {
187 if((theta>=0)&&(theta<4))
188 {
189 newTheta = 0;
190 newPhi = (sector-3)*4+theta;
191 }
192 else if((theta>=4)&&(theta<8))
193 {
194 newTheta = 1;
195 newPhi = (sector-3)*4+theta-4;
196 }
197 else if((theta>=8)&&(theta<13))
198 {
199 newTheta = 2;
200 newPhi = (sector-3)*5+theta-8;
201 }
202 else if((theta>=13)&&(theta<18))
203 {
204 newTheta = 3;
205 newPhi = (sector-3)*5+theta-13;
206 }
207 else if((theta>=18)&&(theta<24))
208 {
209 newTheta = 4;
210 newPhi = (sector-3)*6+theta-18;
211 }
212 else if((theta>=24)&&(theta<30))
213 {
214 newTheta = 5;
215 newPhi = (sector-3)*6+theta-24;
216 }
217 }
218
219 if(part==2)
220 {
221 switch(newTheta)
222 {
223 case 0:
224 if(newPhi<32)
225 newPhi = 31-newPhi;
226 else
227 newPhi = 95-newPhi;
228 break;
229 case 1:
230 if(newPhi<32)
231 newPhi = 31-newPhi;
232 else
233 newPhi = 95-newPhi;
234 break;
235 case 2:
236 if(newPhi<40)
237 newPhi = 39-newPhi;
238 else
239 newPhi = 119-newPhi;
240 break;
241 case 3:
242 if(newPhi<40)
243 newPhi = 39-newPhi;
244 else
245 newPhi = 119-newPhi;
246 break;
247 case 4:
248 if(newPhi<48)
249 newPhi = 47-newPhi;
250 else
251 newPhi = 143-newPhi;
252 break;
253 case 5:
254 if(newPhi<48)
255 newPhi = 47-newPhi;
256 else
257 newPhi = 143-newPhi;
258 default:
259 ;
260 }
261 }
262
263}

Referenced by FillCrystalMap(), and InitFromXML().

◆ FillCrystalMap()

void EmcRecROOTGeo::FillCrystalMap ( EmcRecCrystal & aCrystal,
const int part,
const int theta,
const int phi )

Definition at line 149 of file EmcRecROOTGeo.cxx.

151{
152 Identifier id;
153 if(part==1) { //barrel
154 id = EmcID::crystal_id(EmcID::getBARREL(),theta,phi);
155 m_crystalMap[id]=aCrystal;
156 } else { //endcap
157 int newTheta, newPhi;
158 ComputeThetaPhi(part,theta,phi,newTheta,newPhi);
159 id = EmcID::crystal_id(part,newTheta,newPhi);
160 m_crystalMap[id]=aCrystal;
161 }
162}
static Identifier crystal_id(const unsigned int barrel_ec, const unsigned int theta_module, const unsigned int phi_module)
For a single crystal.
Definition EmcID.cxx:71
static unsigned int getBARREL()
Definition EmcID.cxx:146
void ComputeThetaPhi(const int part, const int theta, const int phi, int &newTheta, int &newPhi)

Referenced by InitFromXML().

◆ GetCCenter()

HepPoint3D EmcRecROOTGeo::GetCCenter ( const Identifier & id) const

Definition at line 169 of file EmcRecROOTGeo.cxx.

170{
171 return GetCrystal(id).Center();
172}
HepPoint3D Center() const
EmcRecCrystal GetCrystal(const Identifier &id) const

Referenced by EmcRecGeoSvc::GetCCenter(), and main().

◆ GetCFrontCenter()

HepPoint3D EmcRecROOTGeo::GetCFrontCenter ( const Identifier & id) const

Definition at line 174 of file EmcRecROOTGeo.cxx.

175{
176 return GetCrystal(id).FrontCenter();
177}
HepPoint3D FrontCenter() const

Referenced by EmcRecGeoSvc::GetCFrontCenter(), and main().

◆ GetCrystal()

EmcRecCrystal EmcRecROOTGeo::GetCrystal ( const Identifier & id) const

Definition at line 164 of file EmcRecROOTGeo.cxx.

165{
166 return m_crystalMap.find(id)->second;
167}

Referenced by GetCCenter(), GetCFrontCenter(), EmcRecGeoSvc::GetCrystal(), EmcRecGeoSvc::GetCrystalPoint(), and main().

◆ InitFromXML()

void EmcRecROOTGeo::InitFromXML ( )

Definition at line 30 of file EmcRecROOTGeo.cxx.

31{
32 if(!gGeoManager) gGeoManager = new TGeoManager("BesGeo", "Bes geometry");
33
34 EmcROOTGeo *fEmcROOTGeo = new EmcROOTGeo();
35 fEmcROOTGeo->SetPhysicalNode();
36
37 //get physical node
38 for (int part = 0; part < fEmcROOTGeo->GetPartNb(); part++) {
39 for (int phi = 0; phi < fEmcROOTGeo->GetPhiNb(part); phi++) {
40 for (int theta = 0; theta < fEmcROOTGeo->GetThetaNb(part); theta++) {
41 TGeoPhysicalNode *crystalPhysicalNode
42 = fEmcROOTGeo->GetPhysicalCrystal(part,phi,theta);
43
44 TGeoArb8 *arb = (TGeoArb8*)crystalPhysicalNode->GetShape();
45 //TGeoTrap *arb = (TGeoTrap*)crystalPhysicalNode->GetShape();
46
47 double *pRot;
48 pRot = crystalPhysicalNode->GetMatrix()->GetRotationMatrix();
49 Hep3Vector rotX(pRot[0], pRot[3], pRot[6]);
50 Hep3Vector rotY(pRot[1], pRot[4], pRot[7]);
51 Hep3Vector rotZ(pRot[2], pRot[5], pRot[8]);
52 HepRotation rotateCrystalToGlobal(rotX, rotY, rotZ);
53 //cout<<"\nrotation: "<<rotateCrystalToGlobal<<"\n"<<endl;
54
55 Hep3Vector rotTX(pRot[0], pRot[1], pRot[2]);
56 Hep3Vector rotTY(pRot[3], pRot[4], pRot[5]);
57 Hep3Vector rotTZ(pRot[6], pRot[7], pRot[8]);
58 HepRotation rotateGlobalToCrystal(rotTX, rotTY, rotTZ);
59
60 double *pTrans;
61 pTrans = crystalPhysicalNode->GetMatrix()->GetTranslation();
62 Hep3Vector translateCrystalToGlobal(pTrans[0], pTrans[1], pTrans[2]);
63
64 Hep3Vector fPnt[10];
65 for(int i=0;i<8;i++) {
66 if(i<4) {
67 fPnt[i] = Hep3Vector(arb->GetVertices()[i*2],
68 arb->GetVertices()[i*2+1],
69 -arb->GetDz());
70 } else {
71 fPnt[i] = Hep3Vector(arb->GetVertices()[i*2],
72 arb->GetVertices()[i*2+1],
73 arb->GetDz());
74 }
75
76 fPnt[i] *= rotateCrystalToGlobal;
77 fPnt[i] += translateCrystalToGlobal;
78 }
79
80 EmcRecCrystal aCrystal;
81 aCrystal.Type(EmcRecCrystal::SixPlane());
82
83 Hep3Vector tempVec;
84 if(part==1) {
85 tempVec = fPnt[3];
86 fPnt[3] = fPnt[0];
87 fPnt[0] = fPnt[1];
88 fPnt[1] = fPnt[2];
89 fPnt[2] = tempVec;
90 tempVec = fPnt[7];
91 fPnt[7] = fPnt[4];
92 fPnt[4] = fPnt[5];
93 fPnt[5] = fPnt[6];
94 fPnt[6] = tempVec;
95
96 for(int i=0;i<8;i++) {
97 aCrystal.Set(i,fPnt[i]);
98 }
99 FillCrystalMap(aCrystal,part,theta,phi);
100
101 } else {
102 for(int i=0;i<8;i++) {
103 if(i%2==0) {
104 tempVec = fPnt[i];
105 fPnt[i] = fPnt[i+1];
106 fPnt[i+1] = tempVec;
107 }
108 aCrystal.Set(i,fPnt[i]);
109 }
110
111 int sector, nb;
112 if(theta<30) {
113 sector = phi;
114 nb = theta;
115 } else {
116 sector = phi;
118 if(theta>=30&&theta<32) {
119 nb = theta-25;
120 } else {
121 nb = theta-18;
122 }
123 int newTheta, newPhi;
124 ComputeThetaPhi(part,nb,sector,newTheta,newPhi);
125 Identifier id = EmcID::crystal_id(part,newTheta,newPhi);
126 EmcRecCrystal tempCrystal = m_crystalMap[id];
127
128 aCrystal.Set(0,tempCrystal.Get(0));
129 aCrystal.Set(1,fPnt[0]);
130 aCrystal.Set(2,fPnt[1]);
131 aCrystal.Set(3,tempCrystal.Get(2));
132 aCrystal.Set(4,tempCrystal.Get(3));
133 aCrystal.Set(5,tempCrystal.Get(4));
134 aCrystal.Set(6,fPnt[4]);
135 aCrystal.Set(7,fPnt[5]);
136 aCrystal.Set(8,tempCrystal.Get(6));
137 aCrystal.Set(9,tempCrystal.Get(7));
138 }
139
140 FillCrystalMap(aCrystal,part,nb,sector);
141 }
142 } //theta
143 } //phi
144 } //part
145
146 delete fEmcROOTGeo;
147}
int GetPhiNb(int part)
Get number of phi on part;.
void SetPhysicalNode()
Set the pointers to the physical nodes;.
int GetThetaNb(int part)
Get number of theta on part;.
TGeoPhysicalNode * GetPhysicalCrystal(int part, int phi, int theta)
Get crystal physical node;.
HepPoint3D Get(int index) const
static int SixPlane()
int Type() const
static int SevenPlane()
void Set(int index, const HepPoint3D &aPoint)
void FillCrystalMap(EmcRecCrystal &, const int, const int, const int)

Referenced by EmcRecGeoSvc::initialize(), and main().


The documentation for this class was generated from the following files: