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