FairRoot/PandaRoot
Functions
create_lumi.C File Reference

Go to the source code of this file.

Functions

int create_lumi ()
 

Function Documentation

int create_lumi ( )

Definition at line 2 of file create_lumi.C.

References angle, cos(), Double_t, fi, geobuild, geoFace, geoLoad, gGeoMan, i, kHalfFoilThickness, Media, move, name, nmed, num, outfile, Pi, rot, sin(), SubunitVol, top, and TString.

Referenced by createRootGeometry_beampipe().

2  {
3  // Lumi Si-Set Parameter
4  //-----------------------------
5  const Double_t kTrapInnerDist = 3.; // (cm) //Dimension of Trapezoid
6  const Double_t kTrapOuterDist = 10.; // (cm)
7  const Int_t kNumTraps= 8;
8 
9  const Double_t kTrapHalfAngle = TMath::Pi()/(Double_t)kNumTraps; // (rad)
10  const Double_t kTrapHigh = kTrapOuterDist - kTrapInnerDist;
11 
12  //vars for trap-builder
13  const Double_t kShortSide = kTrapInnerDist * tan(kTrapHalfAngle);
14  const Double_t kLongSide = kTrapOuterDist * tan(kTrapHalfAngle);
15 
16  Double_t kPlaneZPosition[4];
17  kPlaneZPosition[0] = 0.0; // (cm) //Dist to IP before rotating
18  kPlaneZPosition[1] = 10.0; // (cm) //
19  kPlaneZPosition[2] = 20.0; // (cm) //
20  kPlaneZPosition[3] = 30.0; // (cm) //
21 
22  const Double_t kHalfFoilThickness = 0.0075; // Thickness of sensitive foil (cm)
23  // const Double_t kHalfFoilThickness = 0.0035; // Thickness of sensitive foil (cm) TEST
24 
25  const Double_t kRot = 2.326; //(deg) //Rotate to dipol
26  const Double_t kRotUmZ = 476.03; //(cm) //z-point to rotate
27  // const Double_t kRot = 0; //(deg) //Rotate to dipol TEST
28  // const Double_t kRotUmZ = 0; //(cm) //z-point to rotate TEST
29 
30  const Double_t kTransZ = 1100; //(cm) //move at z-position
31 
32  const Double_t kTransX = 25; //(cm) //move at x-position
33 
34  //--------------------------------------------------------------------
35  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
36 
37  // Load this libraries
38  gSystem->Load("libGeoBase");
39  gSystem->Load("libParBase");
40  gSystem->Load("libBase");
41  gSystem->Load("libPndData");
42  gSystem->Load("libPassive");
43 
44  TString outfile= "geo/Test-Dipol-Design.root";
45  TFile* fi = new TFile(outfile,"RECREATE");
46 
47  FairGeoLoader* geoLoad = new FairGeoLoader("TGeo","FairGeoLoader");
48  FairGeoInterface *geoFace = geoLoad->getGeoInterface();
49  geoFace->setMediaFile("../../geometry/media_pnd.geo");
50  geoFace->readMedia();
51  geoFace->print();
52 
53  FairGeoMedia *Media = geoFace->getMedia();
54  FairGeoBuilder *geobuild=geoLoad->getGeoBuilder();
55 
56  FairGeoMedium *FairMediumSilicon = Media->getMedium("silicon");
57 
58  Int_t nmed=geobuild->createMedium(FairMediumSilicon);
59 
60  TGeoManager* gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
61 
62  TGeoVolume *top = new TGeoVolumeAssembly("Gem");
63 
64  gGeoMan->SetTopVolume(top);
65 
66  // TGeoShape *Trap1Shape = new TGeoTrd1("trap1shape",kShortSide,kLongSide,kHalfFoilThickness,kTrapHigh/2.);
67  TGeoShape *Trap1Shape =
68  new TGeoTrap("trap1shape",kHalfFoilThickness, 0, -90, kTrapHigh/2.,kShortSide,kLongSide,0,
69  kTrapHigh/2.,kShortSide,kLongSide,0);
70 
71 
72  //rotations and translations for all 4*8 traps
73  TList trc;
74  TList vol;
75  Double_t move = (kTrapHigh/2.+kTrapInnerDist);
76 
77  for(Int_t j=0; j<4; ++j){
78  std::stringstream plane;
79  plane << (j+1);
80  for(Int_t i=0; i<8; ++i){
81  std::stringstream num;
82  num << (i+1);
83  TString name = ("LumActiveTrap"+plane.str()+"_"+num.str());
84  TString rotname = ("rot"+plane.str()+"_"+num.str());
85  Double_t angle = i*TMath::Pi()/4.;
86  TGeoVolume* tmpvol = new TGeoVolume(name,Trap1Shape,gGeoMan->GetMedium("silicon"));
87  // TGeoBBox* actBox1 = (TGeoBBox*)(tmpvol->GetShape());
88  // cout<<"tmpvol.X="<<actBox1->GetDX()<<" "<<"tmpvol.Y="<<actBox1->GetDY()<<" "<<"tmpvol.Z="<<actBox1->GetDZ()<<endl;
89  Double_t dreh = -i*45.;
90  if(j==1) {dreh += 22.5; angle-=TMath::Pi()/8.;} //sort out ambiguities
91  if(j==3) {dreh += 22.5; angle-=TMath::Pi()/8.;} //sort out ambiguities
92  //TGeoRotation* rot = new TGeoRotation(rotname,dreh,-90,0);
93  TGeoRotation* rot = new TGeoRotation(rotname,dreh,0,0);
94  TGeoTranslation* trt = new TGeoTranslation(sin(angle)*move, cos(angle)*move, 1100+kPlaneZPosition[j]-kRotUmZ);
95  TGeoCombiTrans* trctmp = new TGeoCombiTrans(*trt,*rot);
96  trctmp->SetName(name);
97  trctmp->RegisterYourself();
98 
99  trc.Add( trctmp );
100  vol.Add( tmpvol );
101  delete rot; delete trt;
102  }
103  }
104 
105  TGeoVolumeAssembly* SubunitVol = new TGeoVolumeAssembly("Lumi_Strip_Disks");
106  for(Int_t i=0; i<(8*4); i++)
107  SubunitVol->AddNode((TGeoVolume*)vol.At(i),0,(TGeoCombiTrans*)trc.At(i));
108  TGeoRotation* rotf = new TGeoRotation("final",90,kRot,0);
109  TGeoTranslation* trtf = new TGeoTranslation(0, 0, kRotUmZ);
110  TGeoCombiTrans *trcf = new TGeoCombiTrans(*trtf,*rotf);
111  top->AddNode(SubunitVol,0,trcf);
112 
113  gGeoMan->CloseGeometry();
114  top->Write();
115  fi->Close();
116 // gGeoManager->Export(outfile);
117 
118  top->Draw("ogl");
119  return 0;
120 }
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
int num[96]
Definition: ranlxd.cxx:381
FairGeoLoader * geoLoad
Int_t i
Definition: run_full.C:25
FairGeoMedia * Media
TGeoManager * gGeoMan
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
TGeoVolume * top
std::string move
TGeoVolume * SubunitVol
FairGeoBuilder * geobuild
TFile * fi
Double_t
TString name
TGeoRotation rot
FairGeoInterface * geoFace
Double_t angle
const Double_t kHalfFoilThickness
Double_t Pi
TString outfile