Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
makeGeom.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file makeGeom.C
1 void makeGeom()
2 {
3  //--- Definition of a simple geometry
4  // gSystem->Load("libGeom");
5  new TGeoManager("genfitGeom", "GENFIT geometry");
6 
7 
8  unsigned int medInd(0);
9  Double_t mPar[10];
10  //TAG sollte wieder 0 werden sens flag
11  mPar[0]=0.;//sensitive volume flag
12  mPar[1]=1.;//magnetic field flag
13  mPar[2]=30.;//max fiel in kGauss
14  mPar[3]=0.1;//maximal angular dev. due to field
15  mPar[4]=0.01;//max step allowed (in cm)
16  mPar[5]=1.e-5;//max fractional energy loss
17  mPar[6]=1.e-3;//boundary crossing accuracy
18  mPar[7]=1.e-5;//minimum step
19  mPar[8]=0.;//not defined
20  mPar[9]=0.;//not defined
21 
22  TGeoMaterial *_siliconMat = new TGeoMaterial("siliconMat",28.0855,14.,2.329);
23  _siliconMat->SetRadLen(1.);//calc automatically, need this for elemental mats.
24  // cppcheck-suppress unreadVariable
25  TGeoMedium *_silicon = new TGeoMedium("silicon",medInd++,_siliconMat,mPar);
26 
27  TGeoMixture *_airMat = new TGeoMixture("airMat",3);
28  _airMat->AddElement(14.01,7.,.78);
29  _airMat->AddElement(16.00,8.,.21);
30  _airMat->AddElement(39.95,18.,.01);
31  _airMat->SetDensity(1.2e-3);
32  // cppcheck-suppress unreadVariable
33  TGeoMedium *_air = new TGeoMedium("air",medInd++,_airMat,mPar);
34 
35  TGeoMixture *_vacuumMat = new TGeoMixture("vacuumMat",3);
36  _vacuumMat->AddElement(14.01,7.,.78);
37  _vacuumMat->AddElement(16.00,8.,.21);
38  _vacuumMat->AddElement(39.95,18.,.01);
39  _vacuumMat->SetDensity(1.2e-15);
40  // cppcheck-suppress unreadVariable
41  TGeoMedium *_vacuum = new TGeoMedium("vacuum",medInd++,_vacuumMat,mPar);
42 
43 
44 
45 
46  TGeoMedium *vacuum = gGeoManager->GetMedium("vacuum");
47  assert(vacuum!=NULL);
48  TGeoMedium *air = gGeoManager->GetMedium("air");
49  assert(air!=NULL);
50  TGeoMedium *sil = gGeoManager->GetMedium("silicon");
51  assert(sil!=NULL);
52 
53  TGeoVolume *top = gGeoManager->MakeBox("TOPPER", air, 1000., 1000., 1000.);
54  gGeoManager->SetTopVolume(top); // mandatory !
55 
56  double thickness(0.05);
57  double distance = 1;
58 
59  for (unsigned int i=1; i<5; ++i){
60  TGeoVolume *redBullCan = gGeoManager->MakeTube("redBullCan", sil, i*distance, i*distance+thickness, 20.);//, 90., 270.);
61  redBullCan->SetLineColor(kRed);
62  top->AddNode(redBullCan, 1, gGeoIdentity);
63  }
64 
65 
66  //--- close the geometry
67  gGeoManager->CloseGeometry();
68 
69  //--- draw the ROOT box
70  gGeoManager->SetVisLevel(10);
71  //top->Draw("ogl");
72  TFile *outfile = TFile::Open("genfitGeom.root","RECREATE");
73  gGeoManager->Write();
74  outfile->Close();
75 }