22 gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
25 gSystem->Load(
"libGeoBase");
26 gSystem->Load(
"libParBase");
27 gSystem->Load(
"libBase");
28 gSystem->Load(
"libPndData");
29 gSystem->Load(
"libPassive");
33 TFile*
fi =
new TFile(outfile,
"RECREATE");
35 FairGeoLoader*
geoLoad =
new FairGeoLoader(
"TGeo",
"FairGeoLoader");
36 FairGeoInterface *
geoFace = geoLoad->getGeoInterface();
37 geoFace->setMediaFile(
"../../geometry/media_pnd.geo");
41 FairGeoMedia *
Media = geoFace->getMedia();
42 FairGeoBuilder *
geobuild=geoLoad->getGeoBuilder();
44 FairGeoMedium *medGe = Media->getMedium(
"germanium");
45 Int_t nmedGe=geobuild->createMedium(medGe);
48 FairGeoMedium *medsci = Media->getMedium(
"polypropylene");
49 Int_t nmedsci=geobuild->createMedium(medsci);
52 FairGeoMedium *medcap = Media->getMedium(
"HYPaluminium");
53 Int_t nmedcap=geobuild->createMedium(medcap);
57 TGeoManager*
gGeoMan = (TGeoManager*)gROOT->FindObject(
"FAIRGeom");
59 TGeoVolume *
top =
new TGeoVolumeAssembly(
"hpge");
61 gGeoMan->SetTopVolume(top);
65 TGeoVolume *sphere =
new TGeoVolumeAssembly(
"sphere");
67 TGeoTube* Crystal_Tube =
new TGeoTube(
"tube",0.,7.0/2.,7.8/2.);
69 TGeoPgon* Crystal_Polyhedra =
new TGeoPgon(
"Pgon",0., 360., 6,2);
71 Crystal_Polyhedra->DefineSection(0,-3.9,0.,3.50*
cos(30.*deg));
72 Crystal_Polyhedra->DefineSection(1,3.9,0.,(3.50));
75 TGeoPgon* lay_sci =
new TGeoPgon(
"PgLay",0., 360., 6,2);
78 lay_sci->DefineSection(0,-0.25,0.,3.50*
cos(30.*deg));
79 lay_sci->DefineSection(1,0.25,0.,(3.50)*
cos(30.*deg));
83 TGeoPgon* lay_capl =
new TGeoPgon(
"PgcapL",0., 360., 6,2);
86 lay_capl->DefineSection(0,-4.2,0.,3.144);
87 lay_capl->DefineSection(1,4.2,0.,(3.627));
89 TGeoPgon* lay_caps =
new TGeoPgon(
"PgcapS",0., 360., 6,2);
92 lay_caps->DefineSection(0,-3.95,0.,3.078);
93 lay_caps->DefineSection(1,3.95,0.,(3.553));
99 TGeoPgon* logicCrystal_test;
100 logicCrystal_test = Crystal_Polyhedra ;
101 TGeoCompositeShape* lay_cap =
new TGeoCompositeShape(
"test",
"(PgcapL)-(PgcapS)");
109 30.0, 168.0, 90., 2.0,1000,fcrl,fclr);
111 30.0, 168.0,18, 2.0,1200,fcrl,fclr);
114 30.1, 168.0, 162, 2.0,400,fcrl,fclr);
117 30.3, 168.0, 234, 2.0,600,fcrl,fclr);
120 30., 168.0, 306., 2.0,1400,fcrl,fclr);
122 CreateCluster(logicCrystal_test,lay_sci,lay_cap,*sphere,32.2,
123 148.0, 54.0, 2.0,1100,fcrl,fclr);
124 CreateCluster(logicCrystal_test,lay_sci,lay_cap,*sphere,32.9,
125 148.0, 126.0, 2.0,300,fcrl,fclr);
126 CreateCluster(logicCrystal_test,lay_sci,lay_cap,*sphere,31.4,
127 148.0, 198.0, 2.0,500,fcrl,fclr);
128 CreateCluster(logicCrystal_test,lay_sci,lay_cap,*sphere,32.6,
129 148.0, 270.0, 2.0,1500,fcrl,fclr);
130 CreateCluster(logicCrystal_test,lay_sci,lay_cap,*sphere,30.3,
131 148.0, 342.0, 2.0,1300,fcrl,fclr);
133 30.0, 140.0, 90., 2.0,700,fcrl,fclr);
135 30.2, 140.0,18., 2.0,800,fcrl,fclr);
138 30.15, 140.0, 162., 2.0,100,fcrl,fclr);
141 30.15, 140.0, 234., 2.0,200,fcrl,fclr);
144 30.2, 140.0, 306., 2.0,900,fcrl,fclr);
148 top->AddNode(sphere, 0,
new TGeoCombiTrans(0., 0., -78.,
new TGeoRotation (0)));
151 gGeoMan->CloseGeometry();
160 TGeoCompositeShape* lay_cap,
166 int id_start,
int fnum_crystal,
int fnum_cluster)
168 char cluster_name[10];
169 if(id_start==800) sprintf(cluster_name,
"J");
170 if(id_start==700) sprintf(cluster_name,
"G");
171 if(id_start==100) sprintf(cluster_name,
"A");
172 if(id_start==200) sprintf(cluster_name,
"B");
173 if(id_start==900) sprintf(cluster_name,
"K");
175 if(id_start==1100) sprintf(cluster_name,
"M");
176 if(id_start==300) sprintf(cluster_name,
"C");
177 if(id_start==500) sprintf(cluster_name,
"E");
178 if(id_start==1500) sprintf(cluster_name,
"R");
179 if(id_start==1300) sprintf(cluster_name,
"P");
181 if(id_start== 400) sprintf(cluster_name,
"D");
182 if(id_start== 600) sprintf(cluster_name,
"F");
183 if(id_start==1000) sprintf(cluster_name,
"L");
184 if(id_start==1200) sprintf(cluster_name,
"N");
186 if(id_start==1400) sprintf(cluster_name,
"Q");
194 distance = distance + 2.5;
198 if(phi1 >360.0*deg) phi1 = phi1 - 360.0*deg;
199 if(phi1>=0.0 && phi1 <=180.0*deg) phi1 = 180.0*deg - phi1;
200 if(phi1>180.0*deg && phi1 <360.0*deg) phi1 = 540.0*deg - phi1;
201 phi1 = phi1+90.0*deg;
203 if(phi >360.0) phi = phi - 360.0;
204 if(phi>=0.0 && phi <=180.0) phi = 180.0 -
phi;
205 if(phi>180.0 && phi <360.0) phi = 540.0 -
phi;
208 TGeoRotation* rot3D =
new TGeoRotation();
210 TVector3* rotatedPos;
213 TGeoVolume* crystal_centre[60];
214 TGeoVolume* laySci[60];
219 TGeoRotation* rot3D2 =
new TGeoRotation();
220 TVector3* rotatedPos2;
223 rot3D2->SetAngles(0, 0, 0);
224 rot3D2->RotateX(theta);
225 rot3D2->RotateZ(phi);
228 rot3D->SetAngles(0, 0, 0);
229 rot3D->RotateX(theta);
233 rotatedPos =
new TVector3(
rotate(TVector3(0.,0.,62.22-8.05/2.0),rot3D)
234 -
rotate(TVector3(0.,0.,62.22-8.05),rot3D2)
235 +
rotate(TVector3(0.,0.,distance),rot3D2));
239 rotatedPos2 =
new TVector3(
rotate(TVector3(0.,0.,62.22-8.05/2.0),rot3D)
240 -
rotate(TVector3(0.,0.,62.22-8.05),rot3D2)
241 +
rotate(TVector3(0.,0.,distance-5.0),rot3D2));
243 TGeoMedium *Ge =
gGeoManager->GetMedium(
"germanium");
245 TGeoMedium *sci =
gGeoManager->GetMedium(
"polypropylene");
247 TGeoMedium *cap =
gGeoManager->GetMedium(
"HYPaluminium");
249 std::cout<<
"material "<<Ge<<
" "<<sci<<
" "<<cap<<std::endl;
252 char name_crystal[13];
253 sprintf (name_crystal,
"GeCrystal%02d",id_start+6);
259 sprintf (name_lay,
"laySci%02d",id_start+6);
261 sprintf (name_cap,
"Cap%02d",id_start+6);
264 crystal_centre[fnum_crystal] =
new TGeoVolume(name_crystal,
265 (
const TGeoShape *)logicCrystal_test,
266 (
const TGeoMedium *)Ge );
268 laySci[fnum_crystal] =
new TGeoVolume(name_lay,
269 (
const TGeoShape *)lay_sci,
270 (
const TGeoMedium *)sci );
272 Cap[fnum_crystal] =
new TGeoVolume(name_cap,(
const TGeoShape *)lay_cap,
273 (
const TGeoMedium *)cap );
284 sphere.AddNode(crystal_centre[fnum_crystal],id_start+6,
285 new TGeoCombiTrans(rotatedPos->x(),
288 new TGeoRotation (*rot3D)));
290 sphere.AddNode(Cap[fnum_crystal],id_start+6,
291 new TGeoCombiTrans(rotatedPos->x(),
294 new TGeoRotation (*rot3D)));
301 sphere.AddNode(laySci[fnum_crystal],id_start+6,
302 new TGeoCombiTrans(rotatedPos2->x(),
305 new TGeoRotation (*rot3D)));
317 cout << id_start+6 <<
" " <<rotatedPos->x()<<
" "
318 <<rotatedPos->y()<<
" "
319 <<rotatedPos->z()<<endl;
327 fnum_crystal = fnum_crystal + 1;
335 TGeoVolume* crystal[60];
336 TGeoVolume* laySci_peri[60];
337 TGeoVolume* Cap_peri[60];
339 TGeoRotation* rot3D3 =
new TGeoRotation();
340 TGeoRotation* rot3D4 =
new TGeoRotation();
347 for(
int iii=0;iii<=1;iii++)
351 rot3D3->SetAngles(0., 0., 0.);
352 rot3D3->RotateX(-6.66);
353 rot3D3->RotateZ((-1*iii+1)*60.0);
354 rot3D3->RotateX(theta);
355 rot3D3->RotateZ(phi);
360 v1 =
new TVector3(
rotate(TVector3(0.,0.,62.22-8.05/2.0),rot3D3)
361 -
rotate(TVector3(0.,0.,62.22-8.05),rot3D2)
362 +
rotate(TVector3(0.,0.,distance),rot3D2));
367 v2 =
new TVector3(
rotate(TVector3(0.,0.,62.22-8.05/2.0),rot3D3)
368 -
rotate(TVector3(0.,0.,62.22-8.05),rot3D2)
369 +
rotate(TVector3(0.,0.,distance-5.0),rot3D2));
374 sprintf(tempname,
"GeCrystal%04d",id_start+iii);
378 sprintf (periname,
"laySci%04d",id_start+iii);
380 sprintf (cappname,
"Cap%04d",id_start+iii);
382 crystal[fnum_crystal] =
new TGeoVolume(tempname,
383 (
const TGeoShape *)logicCrystal_test,
384 (
const TGeoMedium *)Ge);
386 laySci_peri[fnum_crystal] =
new TGeoVolume(periname,
387 (
const TGeoShape *)lay_sci,
388 (
const TGeoMedium *)sci);
390 Cap_peri[fnum_crystal] =
new TGeoVolume(cappname,
391 (
const TGeoShape *)lay_cap,
392 (
const TGeoMedium *)cap);
402 sphere.AddNode(crystal[fnum_crystal],id_start+iii,
403 new TGeoCombiTrans(v1->x(),v1->y(),v1->z(),
404 new TGeoRotation (*rot3D3)));
407 sphere.AddNode(Cap_peri[fnum_crystal],id_start+iii,
408 new TGeoCombiTrans(v1->x(),v1->y(),v1->z(),
409 new TGeoRotation (*rot3D3)));
415 sphere.AddNode(laySci_peri[fnum_crystal],id_start+iii,
416 new TGeoCombiTrans(v2->x(),v2->y(),v2->z(),
417 new TGeoRotation (*rot3D)));
427 cout << id_start+iii <<
" " <<v1->x()<<
" " <<v1->y()<<
" " <<v1->z()<<endl;
429 fnum_crystal = fnum_crystal + 1;
433 fnum_cluster = fnum_cluster + 1;
447 b = rotma->GetRotationMatrix();
450 for (Int_t
i=0;
i<9;
i++) {
458 v.SetX(b[0]*vec.X()+b[1]*vec.Y()+b[2]*vec.Z());
459 v.SetY(b[3]*vec.X()+b[4]*vec.Y()+b[5]*vec.Z());
460 v.SetZ(b[6]*vec.X()+b[7]*vec.Y()+b[8]*vec.Z());
friend F32vec4 cos(const F32vec4 &a)
TGeoManager * gGeoManager
void CreateCluster(TGeoPgon *logicCrystal_test, TGeoPgon *lay_sci, TGeoCompositeShape *lay_cap, TGeoVolume &sphere, Double_t distance, Double_t theta, Double_t phi, Double_t depth_first_interaction, int id_start, int fnum_crystal, int fnum_cluster)
FairGeoBuilder * geobuild
TVector3 rotate(TVector3 vec, TGeoRotation *rotma)
FairGeoInterface * geoFace