FairRoot/PandaRoot
hypGeGeoCOSYSiPm.C
Go to the documentation of this file.
1 #include "TGeoManager.h"
2 double Pi = TMath::Pi();
3 
4 
6 {
7  TString outfileWithoutPath = "hypGeGeoCOSYSiPm.root";
8  return outfileWithoutPath;
9 }
10 
12 {
13 
14  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
15 
16  // Load this libraries
17  gSystem->Load("libGeoBase");
18  gSystem->Load("libParBase");
19  gSystem->Load("libBase");
20  gSystem->Load("libPndData");
21  gSystem->Load("libPassive");
22  gSystem->Load("libHypGe");
23 
24  TString outfileWithoutPath =BuildOutputNameSiPm();
25  TString outfile= "../../../../geometry/";
26  outfile += outfileWithoutPath;
27 
28  cout << outfile << endl;
29 
30  TFile* fi = new TFile(outfile,"RECREATE");
31 
32  FairGeoLoader* geoLoad = new FairGeoLoader("TGeo","FairGeoLoader");
33  FairGeoInterface *geoFace = geoLoad->getGeoInterface();
34  geoFace->setMediaFile("../../../../geometry/media_pnd.geo");
35  geoFace->readMedia();
36  //geoFace->print();
37 
38  FairGeoMedia *Media = geoFace->getMedia();
39  FairGeoBuilder *geobuild=geoLoad->getGeoBuilder();
40 
41  FairGeoMedium *medSilicon = Media->getMedium("HYPsilicon");
42  Int_t nmedcap=geobuild->createMedium(medSilicon);
43 
44  TGeoMedium *Silicon = gGeoManager->GetMedium("HYPsilicon");
45 
46  TGeoManager *geom = (TGeoManager*)gROOT->FindObject("FAIRGeom");
47  TGeoVolume *top = new TGeoVolumeAssembly("hpGe");
48  TGeoVolume *Realtop = new TGeoVolumeAssembly("Realtop");
49 
50  geom->SetTopVolume(top);
51 
52  TGeoVolume* SiPm = geom->MakeBox("CrystalSiPm_1",Silicon,0.15,0.15,0.005);
53  SiPm->SetLineColor(kYellow);
54  SiPm->SetFillColor(kYellow);
55  TGeoRotation *SiPmRot = new TGeoRotation("SiPmRot",0,0,0);
56  Realtop->AddNode(SiPm,20000,new TGeoCombiTrans(60,0,10,SiPmRot));
57 
58  TGeoVolume* SiPm2 = geom->MakeBox("CrystalSiPm_2",Silicon,0.15,0.15,0.005);
59  SiPm2->SetLineColor(kYellow);
60  SiPm2->SetFillColor(kYellow);
61  Realtop->AddNode(SiPm2,20001,new TGeoCombiTrans(-25,0,20,SiPmRot));
62 
63 
64  top->AddNode(Realtop,0);
65  geom->CloseGeometry();
66  cout << "# of Nodes: " << Realtop->CountNodes(10,1) << endl;
67 
68  top->Write();
69  fi->Close();
70 
71  Realtop->Draw("ogl");
72 
73 
74 
75 
76 
77 
78  return outfileWithoutPath; // returns the name of the created geometry file
79 }
80 
81 
TString hypGeGeoCOSYSiPm(Double_t Angle=0)
TGeoMedium * medSilicon
FairGeoLoader * geoLoad
FairGeoMedia * Media
TString BuildOutputNameSiPm()
TGeoManager * gGeoManager
TGeoVolume * top
FairGeoBuilder * geobuild
TFile * fi
Double_t
FairGeoInterface * geoFace
Double_t Pi
TString outfile