FairRoot/PandaRoot
Functions
create_HypSTxy3Cmic_RootGeo5LayExt.C File Reference

Go to the source code of this file.

Functions

TVector3 ComputeTransformation (const int copyNo, Double_t *par)
 
TVector3 ComputeDimensions (const int copyNo, Double_t *par)
 
TVector3 rotate (TVector3 vec, TGeoRotation *rotma)
 
int create_HypSTxy3Cmic_RootGeo5LayExt ()
 

Function Documentation

TVector3 ComputeDimensions ( const int  copyNo,
Double_t par 
)

Definition at line 17 of file create_HypSTxy3Cmic_RootGeo5LayExt.C.

References Double_t.

Referenced by create_HypSTxy3Cmic_RootGeo5LayExt().

18 {//ComputeDimensions(TVector3& Layer, const int copyNo,Double_t *par) const
19  TVector3 Layer;
20 
21  //Double_t fStartPosition = firstPosition;
22  //Double_t fHalfLayThick = 0.5*LayThick;
23  //Double_t fSpacing = LayThick;
24  //Double_t fHalfLengthFirst = 0.5 * firstLength;
25  //Double_t fHalfLengthIncr = 0.5 *(lastLength-firstLength)/20;
26  //Double_t fHalfLastLength = 0.5*lastLength;
27 
28  Double_t halfLength = par[3] + copyNo * par[4];
29  Layer.SetXYZ(par[5],halfLength,par[1]);
30  //Layer.SetX(par[5]);
31  //Layer.SetY(par[1]);
32  return Layer;
33 
34  //}
35 }
Double_t par[3]
Double_t
TVector3 ComputeTransformation ( const int  copyNo,
Double_t par 
)

Definition at line 3 of file create_HypSTxy3Cmic_RootGeo5LayExt.C.

References Double_t.

Referenced by create_HypSTxy3Cmic_RootGeo5LayExt().

4 {//{ComputeTransformation(const int copyNo, TVector3* origin,Double_t *par) const
5  TVector3 origin;
6 
7 
8  Double_t display= par[4]*( 20-copyNo);
9  Double_t position= par[0]+(copyNo)*par[2];
10 
11  origin.SetXYZ(0, display,position);
12 
13  return origin;
14 
15 }
Double_t par[3]
Double_t
int create_HypSTxy3Cmic_RootGeo5LayExt ( )

Definition at line 68 of file create_HypSTxy3Cmic_RootGeo5LayExt.C.

References CAMath::ASin(), ComputeDimensions(), ComputeTransformation(), cos(), d, Double_t, fAbsorberThickness, fi, geobuild, geoFace, geoLoad, gGeoMan, i, m, max(), Media, n, name, name1, name2, name4, outfile, Pi, pi, rot, rot2, rotate(), CAMath::Sin(), sin(), t, CAMath::Tan(), theta, top, trc1, trc2, trc3, TString, v2, and z.

69 {
70 
71  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
72 
73  // Load this libraries
74  gSystem->Load("libGeoBase");
75  gSystem->Load("libParBase");
76  gSystem->Load("libBase");
77  gSystem->Load("libPndData");
78  gSystem->Load("libPassive");
79 
80 
81  //TString outfile= "../../geometry/HYPST_assexy3C5Lay_test.root";
82  TString outfile= "../../geometry/HYPST_assexy3C5Lay_mvd.root";
83  TFile* fi = new TFile(outfile,"RECREATE");
84 
85  FairGeoLoader* geoLoad = new FairGeoLoader("TGeo","FairGeoLoader");
86  FairGeoInterface *geoFace = geoLoad->getGeoInterface();
87  geoFace->setMediaFile("../../geometry/media_pnd.geo");
88  geoFace->readMedia();
89  geoFace->print();
90 
91  FairGeoMedia *Media = geoFace->getMedia();
92  FairGeoBuilder *geobuild=geoLoad->getGeoBuilder();
93 
94  FairGeoMedium *medab = Media->getMedium("HYPdiamond");
95  Int_t nmedGe=geobuild->createMedium(medab);
96 
97  //Scintillator plate
98  FairGeoMedium *medsci = Media->getMedium("HYPsilicon");
99  Int_t nmedsci=geobuild->createMedium(medsci);
100 
101  FairGeoMedium *medcar = Media->getMedium("HYPcarbon");
102  Int_t nmedC=geobuild->createMedium(medcar);
103 
104 
105 
106  TGeoManager* gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
107 
108  TGeoVolume *top = new TGeoVolumeAssembly("hypst");
109 
110  gGeoMan->SetTopVolume(top);
111 
112  TGeoVolume *complex = new TGeoVolumeAssembly("complex");
113  TGeoVolume *outer = new TGeoVolumeAssembly("outer");
114  TGeoVolume *inner = new TGeoVolumeAssembly("inner");
115 
116  //936.4335456774155
117  const Int_t max = 80; // max. number of stations
118  Double_t xt[4]; // detector thickness [mm]
119  Double_t yt[4]; // inner radius [mm]
120  Double_t zt[4]; // outer radius [mm]
121  Double_t z[max]; // z position from target [mm]
122  Double_t dlt[max],dl[max]; // inner acceptance [deg]
123  Double_t hlt[max],hl[max]; // outer acceptance [deg]
124  Double_t zll[max],zlt[max]; // outer acceptance [deg]
125  Double_t xl[max]; // detector thickness [mm]
126  Double_t yl[max]; // inner radius [mm]
127  Double_t zl[max]; // outer radius [mm]
128 
129  Double_t da[max]; // inner acceptance [deg]
130  Double_t ha[max]; // outer acceptance [deg]
131  Double_t zla[max]; // outer acceptance [deg]
132  Double_t xa[max]; // detector thickness [mm]
133  Double_t ya[max]; // inner radius [mm]
134  Double_t za[max]; // outer radius [mm]
135 
136  Double_t dg[max]; // inner acceptance [deg]
137  Double_t hg[max]; // outer acceptance [deg]
138  Double_t zlg[max]; // outer acceptance [deg]
139  Double_t xg[max]; // detector thickness [mm]
140  Double_t yg[max]; // inner radius [mm]
141  Double_t zg[max]; // outer radius [mm]
142  Int_t n,nn,na,ng;
143 
144 
145  //ifstream geoin;
146  //geoin.open("secontarget.dat");
147  //ofstream geoout("nada.geo");
148 
149  Double_t fAbsorberThickness = 0.1; //Material mm
150  Double_t fGapThickness = 0.03; //Silicon mm
151  Int_t NbOfLayers = 20; //21
152 
153  Double_t lt = fAbsorberThickness + fGapThickness;
154  Double_t stt = NbOfLayers*lt;
155  Double_t stsyz = stt + 1.5;
156  Double_t hole = 0.75; //mm the radius of the hole(pipe)
157  Double_t SecTargThick = stt;
158  Double_t LayThick= lt;
159  Double_t SecTargSizeYZ = stsyz;
160  const Double_t pi = 3.1415926535;
161 
162  TVector3* v2;
163  TGeoRotation* rot = new TGeoRotation();
164  TGeoRotation* rotO = new TGeoRotation();
165  TGeoRotation* rot2 = new TGeoRotation();
166  char tempname[100];
167  char name4[100];
168 
169  TGeoVolume *BoxAsmb[4];
170 
171 
172  TGeoVolume *LayAsmb[80];
173  TGeoBBox *LayB;
174 
175  TGeoVolume *LayAO;
176  TGeoBBox *LayO;
177  TGeoVolume *LayAI;
178  TGeoBBox *LayI;
179 
180  Double_t side;
181  side = 9.5*TMath::Sin((9*pi)/180.);
182  double ang;
183  ang = 180*TMath::ASin(17.7/135)/pi;
184 
185  LayO = new TGeoBBox("stglOTile",side ,side ,0.03);
186 
187  LayAO = new TGeoVolume("stglSi",LayO, gGeoMan->GetMedium("HYPsilicon"));
188 
189  LayI = new TGeoBBox("stglITile",side ,side ,0.03);
190 
191  LayAI = new TGeoVolume("stglSi",LayI, gGeoMan->GetMedium("HYPsilicon"));
192 
193  // //creating Module
194 
195  // dy=0.;
196  // dx=0;
197  // dz=0.;
198  // Double_t Lx,Lz,g,d;
199  // d = 5.9;
200  // g = 0.1;
201  // Lx = 4*d +2*g;
202  // Lz = 30*d +29*g;
203 
204 
205  // for(int l=0;l<4;l++){
206  // dz = -0.5*Lz + (2*j + 1)*d*0.5 +j*g;
207  // dx = -0.5*Lx +(2*l + 1)*d*0.5 +l*g;
208 
209  // SModAssVol->AddNode(QuadAssVol,30*l+j,new TGeoCombiTrans(dx, 0.,dz, new TGeoRotation (0)));
210 
211  // }
212 
213 
214  Double_t dx_bbox, dy_bbox, dz_bbox, phi_curr;
215 
216  for(Int_t m = 0; m < 20; m ++){
217 
218  phi_curr = (m+1)*(18*pi)/180.;
219  rotO->SetAngles(0,0,0);
220  rotO->RotateX(90);
221  rotO->RotateZ( -(m)*18); //with -(m+1) it looks like a closed polygone.
222 
223  dx_bbox = 9.5* sin(phi_curr);
224  dy_bbox = 9.5* cos(phi_curr);
225 
226 
227  inner->AddNode(LayAO, m+80, new TGeoCombiTrans(dx_bbox, dy_bbox, 0, new TGeoRotation (*rotO)));
228 
229 
230  }
231  Double_t dx_bboxa, dy_bboxa, dz_bboxa, phi_curra;
232 
233  for(Int_t it = 0; it < 24; it ++){ //outer strip structure 26 layers 35 mm
234 
235  phi_curra = (it+1)*((2*ang)*pi)/180.;
236  rotO->SetAngles(0,0,0);
237  rotO->RotateX(90);
238  rotO->RotateZ( -(it)*(2*ang)); //with -(m+1) it looks like a closed polygone.
239 
240  dx_bboxa = 13.5* sin(phi_curra);
241  dy_bboxa = 13.5* cos(phi_curra);
242 
243 
244  outer->AddNode(LayAI, it+100, new TGeoCombiTrans(dx_bboxa, dy_bboxa, 0, new TGeoRotation (*rotO)));
245 
246 
247  }
248 
249 
250  TGeoBBox *BoxSi[80];
251  TGeoBBox *BoxAb[80];
252  TGeoVolume *LaySi[80];
253  TGeoVolume *LayAb[80];
254  TGeoTube *pipe;
255  TGeoVolume *hyppipe;
256  int d;
257  d=0;
258  for(int i=0;i<4;i++){
259 
260  //int i =0;
261  rot->SetAngles(0,0,0);
262  rot2->SetAngles(0,0,0);
263  rot->RotateX(90);
264  rot->RotateZ((-1*i)*90.0);
265  rot2->RotateZ(-1*i*90.0);
266  //cout<<" matr "<<-1*i*90.0<<endl;
267 
268  v2 = new TVector3(rotate(TVector3((stsyz/2)-hole,stsyz/2,0.),rot2));
269  sprintf(tempname,"stgQuad%d",i+1);
270  sprintf(name4,"transQuad%d",i+1);
271 
272  TGeoCombiTrans* trc5 = new TGeoCombiTrans(v2->x(), v2->y(), v2->z(),
273  new TGeoRotation (*rot));
274  trc5->SetName(name4);
275  trc5->RegisterYourself();
276 
277  BoxAsmb[d]= new TGeoVolumeAssembly(tempname);
278  complex->AddNode(BoxAsmb[d],0,trc5);
279 
280  d = d+1;
281  }
282 
283  string tmaterial[4]={"HYPdiamond","HYPdiamond","beryllium","aluminium"};
284  char tmp[100];
285  char tmplay[100],tmplayb[100],tmpAbs[100], tmpGap[100],tmpVAbs[100], tmpVGap[100];
286  char name[100], name1[100],name2[100];
287 
288  Double_t firstPosition = -0.5*SecTargThick + 0.5*LayThick;
289  Double_t theta = (40*TMath::Pi())/180.;
290  Double_t lengthpar = (hole+0.5*LayThick)/TMath::Tan(theta);
291  Double_t firstLength = 0.5*SecTargSizeYZ + lengthpar;
292  //Double_t firstLength = SecTargSizeYZ - ((SecTargThick)/TMath::Tan(theta));
293  //Double_t firstLength = SecTargSizeYZ - ((SecTargThick-0.5*LayThick)/TMath::Tan(theta));
294  Double_t lastLength = SecTargSizeYZ;
295 
296  TVector3 Lay;
297  TVector3 v_Pos;
298  TVector3 vecAbs,vecGap;
299 
300 
301 
302  //fNbOfLayers = NbOfLayers;
303 
304  Double_t fStartPosition = firstPosition;
305  Double_t fHalfLayThick = 0.5*LayThick;
306  Double_t fSpacing = LayThick;
307  Double_t fHalfLengthFirst = 0.5 * firstLength;
308  Double_t fHalfLengthIncr = 0.5 *(lastLength-firstLength)/NbOfLayers;
309  Double_t fHalfLastLength = 0.5*lastLength;
310 
311  Double_t param[6]={fStartPosition,fHalfLayThick,fSpacing,fHalfLengthFirst,
312  fHalfLengthIncr,fHalfLastLength};
313 
314  //for(Int_t k=0; k<4; k++)
315  //{
316  //geoin>>n>>dlt[k]>>hlt[k]>>zlt[k];
317  //cout<<"thick"<<dlt[k]<<endl;
318 
319  for(Int_t i=0; i<20; i++)
320  {
321 
322  //Lay.SetXYZ(0.,0.,0.);
323  //v_Pos.SetXYZ(0.,0.,0.);
324 
325 
326  v_Pos= ComputeTransformation(i,param);
327 
328  Lay = ComputeDimensions(i,param);
329 
330  v_Pos.SetY(-v_Pos.y());
331  //(k==0 ? v_Pos.SetZ(-v_Pos.z()): v_Pos.SetZ(v_Pos.z()));
332  v_Pos.SetZ(-v_Pos.z());
333 
334  dl[i] = Lay.X(); //length
335  hl[i] = Lay.Y(); //parametrised length
336  zll[i] = Lay.Z(); //thickness
337 
338  xl[i] = v_Pos.x();
339  yl[i] = v_Pos.y();
340  zl[i] = v_Pos.z();
341 
342  //absorver layer dimension//
343 
344  da[i]= dl[i];
345  ha[i]= hl[i];
346  zla[i]= fAbsorberThickness/2;
347 
348  //absorver layer placement
349 
350  //(k==0 ? vecAbs.SetZ(-fGapThickness/2.0) : vecAbs.SetZ(fGapThickness/2.0));
351  vecAbs.SetZ(-fGapThickness/2.0);
352 
353  xa[i] = vecAbs.x();
354  ya[i] = vecAbs.y();
355  za[i] = vecAbs.z();
356 
357  //Gap layer dimension//
358 
359  dg[i]= dl[i];
360  hg[i]= hl[i];
361  zlg[i]= fGapThickness/2.0;
362 
363  //Gap layer placement
364 
365  //(k==0 ? vecGap.SetZ(fAbsorberThickness/2) : vecGap.SetZ(-fAbsorberThickness/2));
366  vecGap.SetZ(fAbsorberThickness/2);
367 
368  xg[i] = vecGap.x();
369  yg[i] = vecGap.y();
370  zg[i] = vecGap.z();
371 
372 
373 
374  }
375  //}
376 
377 
378  int t,j;
379 
380 
381 
382  for(Int_t j=0; j<4;j++)
383  {
384 
385  if(j==0){
386  t=0;
387  for(Int_t k=0; k<20; k++)
388  {
389 
390  //sprintf(tmp,"stgQuad#0%d",j);
391  //sprintf(tmpAbs,"stglA%d%d%d#01",j,x,k);//target
392  //sprintf(tmpGap,"stglS%d%d%d#01",j,x,k);//silicon
393 
394  //sprintf(tmplayb,"stgLayB_%d",k);
395  sprintf(tmplay,"stgLay%d",k);
396  sprintf(tmpAbs,"stgBlAb%d",k);
397  sprintf(tmpGap,"stgBlSi%d",k);
398  sprintf(tmpVAbs,"stglAb%d",k);
399  sprintf(tmpVGap,"stglSi%d",k);
400 
401  sprintf(name,"transAb%d",k);
402  sprintf(name1,"transSi%d",k);
403  sprintf(name2,"transLay%d",k);
404 
405  LayAsmb[t]= new TGeoVolumeAssembly(tmplay);
406  // LayB=new TGeoBBox("stgLayB",dl[j][k],hl[j][k],zll[j][k]);
407  // LayAsmb= new TGeoVolume("stgLay",LayB,gGeoMan->GetMedium("vacuum"));
408 
409 
410 
411  BoxAb[t] = new TGeoBBox(tmpAbs,da[k],ha[k],zla[k]);
412  LayAb[t] = new TGeoVolume(tmpVAbs,BoxAb[t],gGeoMan->GetMedium("HYPdiamond"));
413  BoxSi[t] = new TGeoBBox(tmpGap,dg[k],hg[k],zlg[k]);
414  LaySi[t] = new TGeoVolume(tmpVGap,BoxSi[t],gGeoMan->GetMedium("HYPsilicon"));
415  LaySi[t]->SetLineColor(kPink);
416  LayAb[t]->SetLineColor(kYellow);
417 
418  if(k<2){
419  TGeoCombiTrans* trc1 = new TGeoCombiTrans(xa[k],ya[k],za[k],new TGeoRotation ());
420  trc1->SetName(name);
421  trc1->RegisterYourself();
422  LayAsmb[t]->AddNode(LayAb[t],k, trc1);
423  }
424 
425  if(k<2||(k==5||k==10||k==15)){
426  TGeoCombiTrans* trc2 = new TGeoCombiTrans(xg[k],yg[k],zg[k],new TGeoRotation ());
427  trc2->SetName(name1);
428  trc2->RegisterYourself();
429  LayAsmb[t]->AddNode(LaySi[t],k, trc2);
430  TGeoCombiTrans* trc3 = new TGeoCombiTrans(xl[k],yl[k],zl[k], new TGeoRotation ());
431  trc3->SetName(name2);
432  trc3->RegisterYourself();
433  BoxAsmb[j]->AddNode(LayAsmb[t],k,trc3);
434  }
435 
436  t = t+1;
437  }
438  }
439 
440  if(j==1){
441  t=20;
442  for(Int_t k=20; k<36; k++)
443  {
444 
445  //sprintf(tmp,"stgQuad#0%d",j);
446  //sprintf(tmpAbs,"stglA%d%d%d#01",j,x,k);//target
447  //sprintf(tmpGap,"stglS%d%d%d#01",j,x,k);//silicon
448 
449  // sprintf(tmplayb,"stgLayB_%d",k);
450  sprintf(tmplay,"stgLay%d",k);
451  sprintf(tmpAbs,"stgBlAb%d",k);
452  sprintf(tmpGap,"stgBlSi%d",k);
453  sprintf(tmpVAbs,"stglAb%d",k);
454  sprintf(tmpVGap,"stglSi%d",k);
455 
456  sprintf(name,"transAb%d",k);
457  sprintf(name1,"transSi%d",k);
458  sprintf(name2,"transLay%d",k);
459 
460  LayAsmb[t]= new TGeoVolumeAssembly(tmplay);
461  // LayB=new TGeoBBox("stgLayB",dl[j][k],hl[j][k],zll[j][k]);
462  // LayAsmb= new TGeoVolume("stgLay",LayB,gGeoMan->GetMedium("vacuum"));
463 
464 
465 
466  BoxAb[t] = new TGeoBBox(tmpAbs,da[k-20],ha[k-20],zla[k-20]);
467  LayAb[t] = new TGeoVolume(tmpVAbs,BoxAb[k],gGeoMan->GetMedium("HYPdiamond"));
468  BoxSi[t] = new TGeoBBox(tmpGap,dg[k-20],hg[k-20],zlg[k-20]);
469  LaySi[t] = new TGeoVolume(tmpVGap,BoxSi[t],gGeoMan->GetMedium("HYPsilicon"));
470  LaySi[t]->SetLineColor(kPink);
471  LayAb[t]->SetLineColor(kYellow);
472 
473  if(k<22){
474 
475  TGeoCombiTrans* trc1 = new TGeoCombiTrans(xa[k-20],ya[k-20],za[k-20],new TGeoRotation ());
476  trc1->SetName(name);
477  trc1->RegisterYourself();
478  LayAsmb[t]->AddNode(LayAb[t],k, trc1);
479  }
480 
481  if(k<22||(k==25||k==30||k==35)){
482 
483  TGeoCombiTrans* trc2 = new TGeoCombiTrans(xg[k-20],yg[k-20],zg[k-20],new TGeoRotation ());
484  trc2->SetName(name1);
485  trc2->RegisterYourself();
486  LayAsmb[t]->AddNode(LaySi[t],k, trc2);
487 
488 
489  TGeoCombiTrans* trc3 = new TGeoCombiTrans(xl[k-20],yl[k-20],zl[k-20], new TGeoRotation ());
490  trc3->SetName(name2);
491  trc3->RegisterYourself();
492  BoxAsmb[j]->AddNode(LayAsmb[t],k,trc3);
493  }
494 
495  t = t +1;
496  }
497  }
498 
499  if(j==2){
500  t=40;
501  for(Int_t k=40; k<56; k++)
502  {
503 
504  //sprintf(tmp,"stgQuad#0%d",j);
505  //sprintf(tmpAbs,"stglA%d%d%d#01",j,x,k);//target
506  //sprintf(tmpGap,"stglS%d%d%d#01",j,x,k);//silicon
507 
508  // sprintf(tmplayb,"stgLayB_%d",k);
509  sprintf(tmplay,"stgLay%d",k);
510  sprintf(tmpAbs,"stgBlAb%d",k);
511  sprintf(tmpGap,"stgBlSi%d",k);
512  sprintf(tmpVAbs,"stglAb%d",k);
513  sprintf(tmpVGap,"stglSi%d",k);
514 
515  sprintf(name,"transAb%d",k);
516  sprintf(name1,"transSi%d",k);
517  sprintf(name2,"transLay%d",k);
518 
519  LayAsmb[t]= new TGeoVolumeAssembly(tmplay);
520  // LayB=new TGeoBBox("stgLayB",dl[j][k],hl[j][k],zll[j][k]);
521  // LayAsmb= new TGeoVolume("stgLay",LayB,gGeoMan->GetMedium("vacuum"));
522 
523 
524 
525  BoxAb[t] = new TGeoBBox(tmpAbs,da[k-40],ha[k-40],zla[k-40]);
526  LayAb[t] = new TGeoVolume(tmpVAbs,BoxAb[t],gGeoMan->GetMedium("HYPdiamond"));
527  BoxSi[t] = new TGeoBBox(tmpGap,dg[k-40],hg[k-40],zlg[k-40]);
528  LaySi[t] = new TGeoVolume(tmpVGap,BoxSi[t],gGeoMan->GetMedium("HYPsilicon"));
529  LaySi[t]->SetLineColor(kPink);
530  LayAb[t]->SetLineColor(kYellow);
531 
532 
533 
534  if(k<42)
535  {
536  TGeoCombiTrans* trc1 = new TGeoCombiTrans(xa[k-40],ya[k-40],za[k-40],new TGeoRotation ());
537  trc1->SetName(name);
538  trc1->RegisterYourself();
539  LayAsmb[t]->AddNode(LayAb[t],k, trc1);
540  }
541  if(k<42||(k==45||k==50||k==55)){
542 
543  TGeoCombiTrans* trc2 = new TGeoCombiTrans(xg[k-40],yg[k-40],zg[k-40],new TGeoRotation ());
544  trc2->SetName(name1);
545  trc2->RegisterYourself();
546  LayAsmb[t]->AddNode(LaySi[t],k, trc2);
547 
548 
549  TGeoCombiTrans* trc3 = new TGeoCombiTrans(xl[k-40],yl[k-40],zl[k-40], new TGeoRotation ());
550  trc3->SetName(name2);
551  trc3->RegisterYourself();
552  BoxAsmb[j]->AddNode(LayAsmb[t],k,trc3);
553  }
554 
555  t = t +1;
556  }
557  }
558 
559  if(j==3){
560  t = 60;
561  for(Int_t k=60; k<76; k++)
562  {
563 
564  //sprintf(tmp,"stgQuad#0%d",j);
565  //sprintf(tmpAbs,"stglA%d%d%d#01",j,x,k);//target
566  //sprintf(tmpGap,"stglS%d%d%d#01",j,x,k);//silicon
567 
568  // sprintf(tmplayb,"stgLayB_%d",k);
569  sprintf(tmplay,"stgLay%d",k);
570  sprintf(tmpAbs,"stgBlAb%d",k);
571  sprintf(tmpGap,"stgBlSi%d",k);
572  sprintf(tmpVAbs,"stglAb%d",k);
573  sprintf(tmpVGap,"stglSi%d",k);
574 
575  sprintf(name,"transAb%d",k);
576  sprintf(name1,"transSi%d",k);
577  sprintf(name2,"transLay%d",k);
578 
579  LayAsmb[t]= new TGeoVolumeAssembly(tmplay);
580  // LayB=new TGeoBBox("stgLayB",dl[j][k],hl[j][k],zll[j][k]);
581  // LayAsmb= new TGeoVolume("stgLay",LayB,gGeoMan->GetMedium("vacuum"));
582 
583 
584 
585  BoxAb[t] = new TGeoBBox(tmpAbs,da[k-60],ha[k-60],zla[k-60]);
586  LayAb[t] = new TGeoVolume(tmpVAbs,BoxAb[t],gGeoMan->GetMedium("HYPdiamond"));
587  BoxSi[t] = new TGeoBBox(tmpGap,dg[k-60],hg[k-60],zlg[k-60]);
588  LaySi[t] = new TGeoVolume(tmpVGap,BoxSi[t],gGeoMan->GetMedium("HYPsilicon"));
589  LaySi[t]->SetLineColor(kPink);
590  LayAb[t]->SetLineColor(kYellow);
591 
592 
593  if(k<62){
594  TGeoCombiTrans* trc1 = new TGeoCombiTrans(xa[k-60],ya[k-60],za[k-60],new TGeoRotation ());
595  trc1->SetName(name);
596  trc1->RegisterYourself();
597  LayAsmb[t]->AddNode(LayAb[t],k, trc1);
598  }
599 
600  if(k<62||(k==65||k==70||k==75)){
601 
602  TGeoCombiTrans* trc2 = new TGeoCombiTrans(xg[k-60],yg[k-60],zg[k-60],new TGeoRotation ());
603  trc2->SetName(name1);
604  trc2->RegisterYourself();
605  LayAsmb[t]->AddNode(LaySi[t],k, trc2);
606 
607 
608 
609  TGeoCombiTrans* trc3 = new TGeoCombiTrans(xl[k-60],yl[k-60],zl[k-60], new TGeoRotation ());
610  trc3->SetName(name2);
611  trc3->RegisterYourself();
612  BoxAsmb[j]->AddNode(LayAsmb[t],k,trc3);
613  }
614 
615  t = t+1;
616  }
617 
618  }
619 
620  }
621 
622 
623  pipe = new TGeoTube("stghypPipe",0.69,0.7,10.);
624  hyppipe = new TGeoVolume("stglpipe",pipe,gGeoMan->GetMedium("HYPcarbon"));
625 
626  TGeoCombiTrans* trc4 = new TGeoCombiTrans(0., 0., 0., new TGeoRotation ());
627 
628  trc4->SetName("transpipe");
629  trc4->RegisterYourself();
630 
631  TGeoCombiTrans* trc6 = new TGeoCombiTrans(0., 0., 0., new TGeoRotation ());
632 
633  trc6->SetName("transouter");
634  trc6->RegisterYourself();
635 
636  TGeoCombiTrans* trc7 = new TGeoCombiTrans(0., 0., 0., new TGeoRotation ());
637 
638  trc7->SetName("transinner");
639  trc7->RegisterYourself();
640 
641  complex->AddNode(hyppipe, 0,trc4);
642  complex->AddNode(outer, 0,trc6);
643  complex->AddNode(inner, 0,trc7);
644 
645  //top->AddNode(complex,0,new TGeoCombiTrans(0., 0., -76.5, new TGeoRotation ()));
646  top->AddNode(complex,0,new TGeoCombiTrans(0., 0., -55.5, new TGeoRotation ()));
647 
648  gGeoMan->CloseGeometry();
649  top->Write();
650  fi->Close();
651  // top->Draw("ogl");
652  return 0;
653 }
static T ASin(const T &x)
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
TObjArray * d
FairGeoLoader * geoLoad
Int_t i
Definition: run_full.C:25
FairGeoMedia * Media
__m128 m
Definition: P4_F32vec4.h:28
TGeoManager * gGeoMan
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
static T Sin(const T &x)
Definition: PndCAMath.h:42
int n
float Tan(float x)
Definition: PndCAMath.h:165
#define pi
Definition: createSTT.C:60
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:26
TGeoVolume * top
Double_t const fAbsorberThickness
FairGeoBuilder * geobuild
TFile * fi
Double_t
TGeoRotation rot2
TGeoCombiTrans * trc3
Double_t z
TVector3 ComputeTransformation(const int copyNo, Double_t *par)
TString name
TGeoCombiTrans * trc1
TVector3 rotate(TVector3 vec, TGeoRotation *rotma)
TVector3 ComputeDimensions(const int copyNo, Double_t *par)
TVector3 v2
Definition: bump_analys.C:40
TGeoRotation rot
TTree * t
Definition: bump_analys.C:13
FairGeoInterface * geoFace
Double_t Pi
TGeoCombiTrans * trc2
TString outfile
TVector3 rotate ( TVector3  vec,
TGeoRotation *  rotma 
)

Definition at line 37 of file create_HypSTxy3Cmic_RootGeo5LayExt.C.

References CAMath::Abs(), b, Double_t, i, and v.

Referenced by create_HypSTxy3Cmic_RootGeo5LayExt().

38 {
39  TVector3 v;
40  v.SetXYZ(0,0,0);
41 
42  vec.Print();
43  const Double_t* b;
44  b = rotma->GetRotationMatrix();
45  //a = new TRotation(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8]);
46 
47  for (Int_t i=0; i<9; i++) {
48  if (TMath::Abs(b[i])<1E-10) b[i] = 0;
49  if (TMath::Abs(b[i]-1)<1E-10) b[i] = 1;
50  if (TMath::Abs(b[i]+1)<1E-10) b[i] = -1;
51  }
52  for(i=0;i<9;i++){
53  cout<<" matrix "<<b[i]<<endl;
54  }
55  v.SetX(b[0]*vec.X()+b[1]*vec.Y()+b[2]*vec.Z());
56  v.SetY(b[3]*vec.X()+b[4]*vec.Y()+b[5]*vec.Z());
57  v.SetZ(b[6]*vec.X()+b[7]*vec.Y()+b[8]*vec.Z());
58  //cout<<" rotate "<<v.X()<<" "<<v.Y()<<" "<<v.Z()<<endl;
59 
60  return v;
61 
62 
63 }
Int_t i
Definition: run_full.C:25
TTree * b
__m128 v
Definition: P4_F32vec4.h:4
static T Abs(const T &x)
Definition: PndCAMath.h:39
Double_t
dble_vec_t vec[12]
Definition: ranlxd.cxx:380