FairRoot/PandaRoot
create_half_geo.C
Go to the documentation of this file.
1 int create_half_geo(Double_t distance = 750){
2  // Forward tof geometry parameters
3  //-----------------------------
4  //-- macro created by Alicia S. based on step file
5  //-- barrel-SciTil_18122012
6  //-- edited by D. Steinschaden
7  //-- last update 08.2015
8 
9 
10  //--------------------------------------------------------------------
11  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
12 
13  // Load this libraries
14  gSystem->Load("libGeoBase");
15  gSystem->Load("libParBase");
16  gSystem->Load("libBase");
17  gSystem->Load("libPndData");
18  gSystem->Load("libPassive");
19 
20  TString outfile= "half_geo.root";
21  //TString outfile= "../../../geometry/SciTil_test.root";
22  TFile* fi = new TFile(outfile,"RECREATE");
23 
24  FairGeoLoader* geoLoad = new FairGeoLoader("TGeo","FairGeoLoader");
25  FairGeoInterface *geoFace = geoLoad->getGeoInterface();
26  geoFace->setMediaFile("../../../geometry/media_pnd.geo");
27  geoFace->readMedia();
28  geoFace->print();
29 
30  FairGeoMedia *Media = geoFace->getMedia();
31  FairGeoBuilder *geobuild=geoLoad->getGeoBuilder();
32 
33  FairGeoMedium *MediumSci = Media->getMedium("polyvinyltoluene");
34  FairGeoMedium *MediumSiPm = Media->getMedium("silicon");
35  FairGeoMedium *MediumCard = Media->getMedium("pcbmvd");
36 
37  const Double_t pi = 3.1415926535;
38  Int_t nmed=geobuild->createMedium(MediumSci); // ----why is the return value saved?
39  nmed=geobuild->createMedium(MediumSiPm);
40  nmed=geobuild->createMedium(MediumCard);
41 
42  TGeoManager* gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
43  TGeoVolume *top = new TGeoVolumeAssembly("SciT");
44 
45 
46  gGeoMan->SetTopVolume(top);
47 
48 
49 //-------------------- creating Tile and SiPm and Readout Card --------------------
50 
51  //Volumes containing SENSOR in the name will be taken into account in the MC hit production
52  //check PndSciT.h and PndSciT.cxx and the listofsensitives
53 
54  TGeoBBox* TileShape;
55  TileShape = new TGeoBBox("SciTil_logicTile", 4.3475, 0.25, 1.47);// dimension is always given from the mid to the end e.g. only the half length
56 
57  TGeoVolume* TileVol;
58  TileVol = new TGeoVolume("SciTil_SENSOR",TileShape, gGeoMan->GetMedium("polyvinyltoluene"));
59  TileVol->SetLineColor(kBlue);
60 
61  TGeoBBox* SiPmShape= new TGeoBBox("SiPm_logicSiPm",0.215,0.1925,0.0725);
62  TGeoVolume* SiPmVol= new TGeoVolume("SiPm",SiPmShape, gGeoMan->GetMedium("silicon"));
63  SiPmVol->SetLineColor(kRed);
64 
65  TGeoBBox* CardShape= new TGeoBBox("Card_logicCard",0.005,0.25,1.4);
66  TGeoVolume* CardVol= new TGeoVolume("SciTil_Card",CardShape, gGeoMan->GetMedium("pcbmvd"));
67  CardVol->SetLineColor(kYellow);
68 
69  TGeoBBox* CardOutShape= new TGeoBBox("CardOut_logicCard",0.5,0.075,90.);
70  TGeoVolume* CardOutVol= new TGeoVolume("SciTil_CardOut",CardOutShape, gGeoMan->GetMedium("pcbmvd"));
71  CardOutVol->SetLineColor(kGreen);
72 
73 
74  TGeoSphere* CenterShape;
75  CenterShape = new TGeoSphere("logicCenter", 0, 3);// dimension is always given from the mid to the end e.g. only the half length
76 
77  TGeoVolume* CenterVol;
78  CenterVol = new TGeoVolume("Center",CenterShape, gGeoMan->GetMedium("polyvinyltoluene"));
79  CenterVol->SetLineColor(kYellow);
80 
81  // --------------creating module (Line)-------------
82 
83  TGeoVolumeAssembly* LineAssVol = new TGeoVolumeAssembly("SciTil_Line");// 2 tiles + 16 SiPm + 3 connection cards
84 
85  TGeoRotation* rot_SiPm = new TGeoRotation;
86  LineAssVol->AddNode(TileVol,0,new TGeoCombiTrans(4.4975, 0., 0., new TGeoRotation (0)));
87  LineAssVol->AddNode(TileVol,1,new TGeoCombiTrans(-4.4975, 0., 0., new TGeoRotation (0)));
88 
89  rot_SiPm->SetAngles(90.,90.,90.);
90  LineAssVol->AddNode(SiPmVol,0,new TGeoCombiTrans(8.9175, 0., 1.06875, rot_SiPm));
91  LineAssVol->AddNode(SiPmVol,1,new TGeoCombiTrans(8.9175, 0., 0.35625, rot_SiPm));
92  LineAssVol->AddNode(SiPmVol,2,new TGeoCombiTrans(8.9175, 0., -0.35625, rot_SiPm));
93  LineAssVol->AddNode(SiPmVol,3,new TGeoCombiTrans(8.9175, 0., -1.06875, rot_SiPm));
94 
95  LineAssVol->AddNode(SiPmVol,4,new TGeoCombiTrans(0.0775, 0., 1.06875, rot_SiPm));
96  LineAssVol->AddNode(SiPmVol,5,new TGeoCombiTrans(0.0775, 0., 0.35625, rot_SiPm));
97  LineAssVol->AddNode(SiPmVol,6,new TGeoCombiTrans(0.0775, 0., -0.35625, rot_SiPm));
98  LineAssVol->AddNode(SiPmVol,7,new TGeoCombiTrans(0.0775, 0., -1.06875, rot_SiPm));
99 
100  LineAssVol->AddNode(SiPmVol,8,new TGeoCombiTrans(-0.0775, 0., 1.06875, rot_SiPm));
101  LineAssVol->AddNode(SiPmVol,9,new TGeoCombiTrans(-0.0775, 0., 0.35625, rot_SiPm));
102  LineAssVol->AddNode(SiPmVol,10,new TGeoCombiTrans(-0.0775, 0., -0.35625, rot_SiPm));
103  LineAssVol->AddNode(SiPmVol,11,new TGeoCombiTrans(-0.0775, 0., -1.06875, rot_SiPm));
104 
105  LineAssVol->AddNode(SiPmVol,12,new TGeoCombiTrans(-8.9175, 0., 1.06875, rot_SiPm));
106  LineAssVol->AddNode(SiPmVol,13,new TGeoCombiTrans(-8.9175, 0., 0.35625, rot_SiPm));
107  LineAssVol->AddNode(SiPmVol,14,new TGeoCombiTrans(-8.9175, 0., -0.35625, rot_SiPm));
108  LineAssVol->AddNode(SiPmVol,15,new TGeoCombiTrans(-8.9175, 0., -1.06875, rot_SiPm));
109 
110  LineAssVol->AddNode(CardVol,0,new TGeoCombiTrans(8.995, 0., 0., new TGeoRotation (0)));
111  LineAssVol->AddNode(CardVol,1,new TGeoCombiTrans(0., 0., 0., new TGeoRotation (0)));
112  LineAssVol->AddNode(CardVol,2,new TGeoCombiTrans(-8.995, 0., 0., new TGeoRotation (0)));
113 
114  // eines mit farbe:
115  TGeoVolume* TileVol2;
116  TileVol2 = new TGeoVolume("SciTil_SENSOR_2",TileShape, gGeoMan->GetMedium("polyvinyltoluene"));
117  TileVol2->SetLineColor(kRed);
118 
119 
120  TGeoVolumeAssembly* LineAssVol2 = new TGeoVolumeAssembly("SciTil_Line");// 2 tiles + 16 SiPm + 3 connection cards
121 
122  LineAssVol2->AddNode(TileVol2,0,new TGeoCombiTrans(4.4975, 0., 0., new TGeoRotation (0)));
123  LineAssVol2->AddNode(TileVol2,1,new TGeoCombiTrans(-4.4975, 0., 0., new TGeoRotation (0)));
124 
125  rot_SiPm->SetAngles(90.,90.,90.);
126  LineAssVol2->AddNode(SiPmVol,0,new TGeoCombiTrans(8.9175, 0., 1.06875, rot_SiPm));
127  LineAssVol2->AddNode(SiPmVol,1,new TGeoCombiTrans(8.9175, 0., 0.35625, rot_SiPm));
128  LineAssVol2->AddNode(SiPmVol,2,new TGeoCombiTrans(8.9175, 0., -0.35625, rot_SiPm));
129  LineAssVol2->AddNode(SiPmVol,3,new TGeoCombiTrans(8.9175, 0., -1.06875, rot_SiPm));
130 
131  LineAssVol2->AddNode(SiPmVol,4,new TGeoCombiTrans(0.0775, 0., 1.06875, rot_SiPm));
132  LineAssVol2->AddNode(SiPmVol,5,new TGeoCombiTrans(0.0775, 0., 0.35625, rot_SiPm));
133  LineAssVol2->AddNode(SiPmVol,6,new TGeoCombiTrans(0.0775, 0., -0.35625, rot_SiPm));
134  LineAssVol2->AddNode(SiPmVol,7,new TGeoCombiTrans(0.0775, 0., -1.06875, rot_SiPm));
135 
136  LineAssVol2->AddNode(SiPmVol,8,new TGeoCombiTrans(-0.0775, 0., 1.06875, rot_SiPm));
137  LineAssVol2->AddNode(SiPmVol,9,new TGeoCombiTrans(-0.0775, 0., 0.35625, rot_SiPm));
138  LineAssVol2->AddNode(SiPmVol,10,new TGeoCombiTrans(-0.0775, 0., -0.35625, rot_SiPm));
139  LineAssVol2->AddNode(SiPmVol,11,new TGeoCombiTrans(-0.0775, 0., -1.06875, rot_SiPm));
140 
141  LineAssVol2->AddNode(SiPmVol,12,new TGeoCombiTrans(-8.9175, 0., 1.06875, rot_SiPm));
142  LineAssVol2->AddNode(SiPmVol,13,new TGeoCombiTrans(-8.9175, 0., 0.35625, rot_SiPm));
143  LineAssVol2->AddNode(SiPmVol,14,new TGeoCombiTrans(-8.9175, 0., -0.35625, rot_SiPm));
144  LineAssVol2->AddNode(SiPmVol,15,new TGeoCombiTrans(-8.9175, 0., -1.06875, rot_SiPm));
145 
146  LineAssVol2->AddNode(CardVol,0,new TGeoCombiTrans(8.995, 0., 0., new TGeoRotation (0)));
147  LineAssVol2->AddNode(CardVol,1,new TGeoCombiTrans(0., 0., 0., new TGeoRotation (0)));
148  LineAssVol2->AddNode(CardVol,2,new TGeoCombiTrans(-8.995, 0., 0., new TGeoRotation (0)));
149 
150  //-----------------creating Super-Module----------------
151 
152  TGeoVolumeAssembly* SModAssVol = new TGeoVolumeAssembly("SciTil_Mod");//60 Lines
153 
154  Double_t dz=0;
155  for(int j=0;j<40;j++){
156  dz = -90+1.5+j*3;
157  SModAssVol->AddNode(LineAssVol, j, new TGeoCombiTrans(0., 0., dz, new TGeoRotation (0)));
158  }
159  for(int j=41;j<60;j++){
160  dz = -90+1.5+j*3;
161  SModAssVol->AddNode(LineAssVol, j, new TGeoCombiTrans(0., 0., dz, new TGeoRotation (0)));
162  }
163  j=40;
164  dz = -90+1.5+j*3;
165  SModAssVol->AddNode(LineAssVol2, j, new TGeoCombiTrans(0., 0., dz, new TGeoRotation (0)));
166 
167  SModAssVol->AddNode(CardOutVol, 0, new TGeoCombiTrans(8.995, 0.325, 0., new TGeoRotation (0)));
168  SModAssVol->AddNode(CardOutVol, 1, new TGeoCombiTrans(0., 0.325, 0., new TGeoRotation (0)));
169  SModAssVol->AddNode(CardOutVol, 2, new TGeoCombiTrans(-8.995, 0.325, 0., new TGeoRotation (0)));
170 
171 
172  // -----------------creating Barrel --------------------------------------------
173  TGeoVolumeAssembly* BarrelAssVol = new TGeoVolumeAssembly("SciTil_barrel");
174 
175  // ------------Values of Dirc Detector------------
176  Double_t radius = 50.55 ; // 50. radius in middle of the barbox (x and y)
177  Double_t hthick = 1.7/2.; // 1.7/2. half thickness of the bars
178  Double_t barnum = 6; // 6 number of bars per barbox
179  Int_t bbnum = 16; //16. total number of sides = barboxes
180  Double_t bbGap = 1.5; //1.5 gap btw the neighboring barboxes (at the middle height)
181  Double_t pipehAngle = 3.6; //3.6 [degrees] half of the angular space needed for the target pipe
182 
183 
184  Double_t phi0 = (180.-2.*pipehAngle)/bbnum + pipehAngle;
185  Double_t dphi = (180.-2.*pipehAngle)/bbnum*2.;
186 
187 //taking angles from dirc geometry
188  Double_t dx_bbox, dy_bbox, dz_bbox, phi_curr;
189 
190  for(Int_t m = 0; m < 8; m ++){ //nur die hälfte wird erstellt
191  phi_curr = (90. - phi0 - dphi*m)/180.*pi;
192  if(m > bbnum/2-1){ phi_curr = (90. - phi0 - dphi*m - 2.*pipehAngle)/180.*pi; }
193  dx_bbox = radius * cos(phi_curr);
194  dy_bbox = radius * sin(phi_curr);
195 
196  TGeoRotation rot_bbox;
197  rot_bbox.RotateZ( -phi0 - m*dphi - (TMath::Floor(2.*m/bbnum))*(2.*pipehAngle));
198  BarrelAssVol->AddNode(SModAssVol, m, new TGeoCombiTrans(dx_bbox, dy_bbox, 0, new TGeoRotation(rot_bbox)));
199  }
200 
201 
202  top->AddNode(BarrelAssVol,0, new TGeoCombiTrans(0.,0.,32.,new TGeoRotation()));
203  top->AddNode(CenterVol, 0);
204  //top->AddNode(SModAssVol,0, new TGeoCombiTrans(0.,0.,32.,new TGeoRotation()));
205  //top->AddNode(LineAssVol,0, new TGeoCombiTrans(0.,0.,32.,new TGeoRotation()));
206 
207  gGeoMan->SetVisLevel(5);
208  gGeoMan->CloseGeometry();
209  //top->Write();
210  fi->Close();
211  // gGeoManager->Export(outfile);
212  top->Draw("ogl");
213 
214  return 0;
215  }
216 
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
FairGeoLoader * geoLoad
FairGeoMedia * Media
__m128 m
Definition: P4_F32vec4.h:28
TGeoManager * gGeoMan
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
#define pi
Definition: createSTT.C:60
TGeoVolume * top
FairGeoBuilder * geobuild
TFile * fi
Double_t
Double_t phi0
Definition: checkhelixhit.C:60
int create_half_geo(Double_t distance=750)
FairGeoInterface * geoFace
TString outfile