BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
ExtBesCrystalParameterisation.cxx
Go to the documentation of this file.
1//---------------------------------------------------------------------------//
2// BOOST --- BESIII Object_Oreiented Simulation Tool //
3//---------------------------------------------------------------------------//
4//Descpirtion: EMC detector
5//Author: Fu Chengdong
6//Created: Sep 4, 2003
7//Comment:
8//---------------------------------------------------------------------------//
9//
11
14//#include "BesDetectorConstruction.hh"
15
16#include "G4VPhysicalVolume.hh"
17#include "G4LogicalVolume.hh"
18#include "G4ThreeVector.hh"
19#include "G4Trap.hh"
20#include "G4SystemOfUnits.hh"
21
22//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
23
25 const G4int startID,
26 const G4int endID,
27 const G4int thetaAllCrystals,
28 ExtBesEmcGeometry* besEMCGeometry,
29 const G4int verboseLevel
30 ):fVerboseLevel(0)
31{
32 //for debug
33 //G4Exception("ExtBesCrystalParameterisation::ExtBesCrystalParameterisation() starting........");
34 fBesEmcGeometry = besEMCGeometry;
35 fVerboseLevel = verboseLevel; //if need to debug this class,open it
36 fStartID = startID;
37 fAllCrystals = thetaAllCrystals;
38 fCrystalID = 0;
39 fFlagLeft = true;
40 if (startID>endID||endID>thetaAllCrystals||startID<1)
41 {
42 G4cout<<"ExtBesCrystalParameterisation construction: ID of crystal>No avaible!"<<G4endl; exit(-1);
43 }
44
45}
46
47//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48
51
52//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53
55(const G4int copyNo, G4VPhysicalVolume* physVol) const
56{
57 //for debug
58 //G4Exception("ExtBesCrystalParameterisation::ComputeTransformation() starting........");
59 ComputeIDAndSide(physVol);
60
61 if(fVerboseLevel>3)
62 {
63 G4cout<<"*ExtBesCrystalParameterisation::ComputeTransformation()*"<<G4endl;
64 G4cout << "copyNo(transfered)=" << copyNo << G4endl
65 << "copyNo(gotten) =" << physVol->GetCopyNo() << G4endl
66 << "fStartID =" << fStartID << G4endl
67 << "fCrystalID =" << fCrystalID << G4endl;
68 G4cout << "point of fBesEmcGeometry=" << fBesEmcGeometry << G4endl;
69 }
70
71 G4double xPosition= fBesEmcGeometry->GetXPosition(fCrystalID);
72 G4double yPosition= fBesEmcGeometry->GetYPosition(fCrystalID);
73 G4double zPosition= fBesEmcGeometry->GetZPosition(fCrystalID);
74 //G4Exception("ExtBesCrystalParameterisation::ComputeTransformation() running........");
75 //G4double xPosition=0,yPosition=0,zPosition=0;
76 if(fFlagLeft) zPosition=-zPosition;
77 G4ThreeVector origin(xPosition,yPosition,zPosition);
78 physVol->SetTranslation(origin);
79
80 //G4double thetaPosition=fBesEmcGeometry->GetThetaPosition(fCrystalID);
81 //G4RotationMatrix *rotateMatrix;
82 //rotateMatrix = new G4RotationMatrix();
83 //if(fFlagLeft)
84 // {
85 // rotateMatrix->rotateZ(-90*deg);
86 // rotateMatrix->rotateX(-180*deg+thetaPosition);
87 // }
88 //else
89 // {
90 // rotateMatrix->rotateZ(-90*deg);
91 // rotateMatrix->rotateX(-thetaPosition);
92 // }
93 //G4double delta = 0*deg;
94 //G4ThreeVector axis = G4ThreeVector(0,0,0);
95 //rotateMatrix->getAngleAxis(delta, axis);
96 if(fVerboseLevel>5)
97 {
98 G4cout << "The crystals are at the position:" << G4endl
99 << origin/cm <<"(cm)" << G4endl;
100 //G4cout << thetaPosition/deg <<"(deg)." << G4endl
101 //<< "The axis of crystals in the world system is: " << G4endl
102 //<< delta/deg << "(deg)(delta) " << G4endl
103 //<< axis << "(Z axis)" << G4endl;
104 }
105 //physVol->SetRotation(rotateMatrix);
106
107}
108
109//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
110
112(G4Trap& trackerChamber, const G4int copyNo,
113 const G4VPhysicalVolume* physVol) const
114{
115 //for debug
116 //G4Exception("ExtBesCrystalParameterisation::ComputeDimensions() starting........");
117 ComputeIDAndSide(physVol);
118
119 G4double zHalfLength = fBesEmcGeometry->GetZHalfLength(fCrystalID);
120 G4double thetaAxis = fBesEmcGeometry->GetThetaAxis(fCrystalID);
121 G4double phiAxis = fBesEmcGeometry->GetPhiAxis(fCrystalID);
122 G4double yHalfLength1 = fBesEmcGeometry->GetYHalfLength1(fCrystalID);
123 G4double xHalfLength1 = fBesEmcGeometry->GetXHalfLength1(fCrystalID);
124 G4double xHalfLength2 = fBesEmcGeometry->GetXHalfLength2(fCrystalID);
125 G4double tanAlpha1 = fBesEmcGeometry->GetTanAlpha1(fCrystalID);
126 G4double yHalfLength2 = fBesEmcGeometry->GetYHalfLength2(fCrystalID);
127 G4double xHalfLength3 = fBesEmcGeometry->GetXHalfLength3(fCrystalID);
128 G4double xHalfLength4 = fBesEmcGeometry->GetXHalfLength4(fCrystalID);
129 G4double tanAlpha2 = fBesEmcGeometry->GetTanAlpha2(fCrystalID);
130
131 if(!fFlagLeft)
132 {
133 phiAxis=-phiAxis;
134 tanAlpha1=-tanAlpha1;
135 tanAlpha2=-tanAlpha2;
136 G4double tmp;
137 tmp=xHalfLength1;
138 xHalfLength1=xHalfLength2;
139 xHalfLength2=tmp;
140 tmp=xHalfLength3;
141 xHalfLength3=xHalfLength4;
142 xHalfLength4=tmp;
143 }
144 if(fVerboseLevel>5)
145 G4cout << "The size of No." << copyNo << " crystal(placed) are:" << G4endl
146 << "zHalfLength =" << zHalfLength/cm << "(cm), " << G4endl
147 << "thetaAxis =" << thetaAxis/deg << "(degree), " << G4endl
148 << "phiAxis =" << phiAxis/deg << "(degree), " << G4endl
149 << "yHalfLength1=" << yHalfLength1/cm << "(cm), " << G4endl
150 << "xHalfLength1=" << xHalfLength1/cm << "(cm), " << G4endl
151 << "xHalfLength2=" << xHalfLength2/cm << "(cm), " << G4endl
152 << "tanAlpha1 =" << tanAlpha1 << "(), " << G4endl
153 << "yHalfLength2=" << yHalfLength2/cm << "(cm), " << G4endl
154 << "xHalfLength3=" << xHalfLength3/cm << "(cm), " << G4endl
155 << "xHalfLength4=" << xHalfLength4/cm << "(cm)." << G4endl
156 << "tanAlpha2 =" << tanAlpha2 << "(), " << G4endl
157 << "(x4-x3)*y1/(x2-x1)/y2="
158 << (xHalfLength4-xHalfLength3)*yHalfLength1/(xHalfLength2-xHalfLength1)/yHalfLength2 << G4endl
159 << "tanAlpha2/tanAlpha1=" << tanAlpha2/tanAlpha1 <<G4endl;
160 //G4cout << fStartID << "-->This is an output sentence for debug." << G4endl;
161
162 trackerChamber.SetAllParameters(
163 zHalfLength,
164 thetaAxis,
165 phiAxis,
166 yHalfLength1,
167 xHalfLength1,
168 xHalfLength2,
169 tanAlpha1,
170 yHalfLength2,
171 xHalfLength3,
172 xHalfLength4,
173 tanAlpha2);
174
175}
176
177//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
179 G4VPhysicalVolume *pPhysicalVol)
180{
181 ComputeIDAndSide(pPhysicalVol);
182 return pPhysicalVol->GetLogicalVolume()->GetSolid();
183}
184
186 G4VPhysicalVolume *pPhysicalVol)
187{
188 ComputeIDAndSide(pPhysicalVol);
189 G4int nBSCTheta=fBesEmcGeometry->GetBSCNbTheta();
190 //if(fVerboseLevel>5)
191 //G4cout <<"******ExtBesCrystalParameterisation::ComputeMaterial******"<<G4endl
192 // <<"Number of all crystals=" << nBSCTheta << G4endl
193 // <<"No of current crystal =" << pPhysicalVol->GetCopyNo() << G4endl
194 // <<"*******************************************************"<<G4endl;
195 if(pPhysicalVol->GetCopyNo()>2*nBSCTheta)
197 else
199}
200
202 const G4VPhysicalVolume* pPhyVol)const
203{
204 //for debug
205 //G4Exception("ExtBesCrystalParameterisation::ComputeIDAndSide() starting......");
206 G4int* pCrystalID=const_cast<G4int*>(&fCrystalID);
207 G4bool* pFlagLeft=const_cast<G4bool*>(&fFlagLeft);
208 G4int* pVerboseLevel=const_cast<G4int*>(&fVerboseLevel);
209
210 *pVerboseLevel=
212
213 //*pCrystalID=pPhyVol->GetMotherPhysical()->GetCopyNo();
214 *pCrystalID=-1;
215 for(G4int i=fStartID;i<=fAllCrystals;i++)
216 {
217 //G4cout << fBesEmcGeometry->GetPhysiBSCCrystal(i) << ".vs."
218 // << pPhyVol << G4endl;
219 if(fBesEmcGeometry->GetPhysiBSCCrystal(i)==pPhyVol)
220 {
221 *pCrystalID=i;
222 }
223 }
224 if(*pCrystalID==-1)
225 {
226 G4cout<<"The point of PhysicCrystal error!!!!!!!!!!!"<<G4endl;
227 exit(-1);
228 }
229
230 //*pCrystalID=pPhyVol->GetCopyNo();
231 //if(fVerboseLevel>6)
232 //G4cout<<"******ExtBesCrystalParameterisation::ComputeIDAndSide******"<<G4endl
233 // <<"point of pPhyVol =" << pPhyVol << G4endl
234 // <<"point of mother =" << pPhyVol->GetMother() << G4endl
235 // <<"CopyNo of pPhyVol=" << pPhyVol->GetCopyNo() << G4endl
236 // <<"CopyNo of mother =" << pPhyVol->GetMother()->GetCopyNo() << G4endl
237 // <<"********************************************************"<<G4endl;
238
239 if(fCrystalID>fAllCrystals/2)
240 {
241 *pFlagLeft=false;
242 *pCrystalID=fCrystalID-fAllCrystals/2;
243 }
244 else
245 {
246 *pFlagLeft=true;
247 *pCrystalID=fAllCrystals/2-fCrystalID+1;
248 }
249 *pCrystalID=*pCrystalID-1;
250}
const DifPoint origin
ExtBesCrystalParameterisation(const G4int, const G4int, const G4int, ExtBesEmcGeometry *, const G4int)
G4Material * ComputeMaterial(const G4int, G4VPhysicalVolume *)
G4VSolid * ComputeSolid(const G4int, G4VPhysicalVolume *)
void ComputeTransformation(const G4int, G4VPhysicalVolume *) const
void ComputeDimensions(G4Trap &, const G4int, const G4VPhysicalVolume *) const
void ComputeIDAndSide(const G4VPhysicalVolume *) const
static ExtBesEmcConstruction * GetBesEmcConstruction()
G4double GetXHalfLength1(G4int NbCrystal)
G4double GetThetaAxis(G4int NbCrystal)
G4double GetTanAlpha2(G4int NbCrystal)
G4double GetPhiAxis(G4int NbCrystal)
G4double GetTanAlpha1(G4int NbCrystal)
G4double GetYHalfLength2(G4int NbCrystal)
G4double GetYPosition(G4int NbCrystal)
G4double GetZPosition(G4int NbCrystal)
G4double GetXHalfLength3(G4int NbCrystal)
G4VPhysicalVolume * GetPhysiBSCCrystal(G4int NbCrystal)
G4double GetZHalfLength(G4int NbCrystal)
G4double GetXHalfLength2(G4int NbCrystal)
G4double GetXHalfLength4(G4int NbCrystal)
G4double GetXPosition(G4int NbCrystal)
G4double GetYHalfLength1(G4int NbCrystal)