FairRoot/PandaRoot
NEW/createDesySetupAli.C
Go to the documentation of this file.
1  // Tracking station for the MVD of PANDA
2  // Setup Nr. 1 used in Beamtime Feb/02 to Feb/06/2010
3  // setup was used at Feb/02 and from Feb/04 until Feb/06
4 
5  // Simone Bianco 15/12/2009
6 
7  {
8  // Sizes of the detectors
9 
10  // Detectors defined as TGeoBBoxes, so the following kDx,kDy and kDz
11  // are half of the real sizes of the boxes
12 
13  const Double_t kDx = 0.96; // in cm!!
14  const Double_t kDy = 0.96; // in cm!!
15  const Double_t kDz = 0.015; // in cm!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16 
17  // Positions of the detector
18 
19  // Sensors displaced along z, laying on perpendicular xy plane,
20  // there centered in (0,0)
21 
22  // 2 double sided sensors
23 
24  const Double_t kPos1 = 5.; // (cm) Box 1
25  const Double_t kPos2 = 185.5; // (cm) Box 4
26 
27  // single sided sensors
28  // this is the position of the center of the system
29  // containing the two single sides detectors
30 
31  const Double_t kPos3 = 86.; // (cm) Box 2
32  const Double_t kPos4 = 145.; // (cm) Box 3
33 
34  // Gap between the two single sided sensors
35 
36  const Double_t kGap3 = 0.45; // (cm)
37  const Double_t kGap4 = 0.45; // (cm)
38 
39  // positional corrections (displacement) of each sensor
40  // these values are obtained by the software alignment procedure
41  const Double_t offs1x = +0..; // box1
42  const Double_t offs1y = +0.;
43 
44  const Double_t offs2x = +0.; // box2 (sensor 2-3)
45  const Double_t offs2y = +0.;
46 
47  const Double_t offs3x = +0.; // box3 (sensor 4-5)
48  const Double_t offs3y = +0.;
49 
50  const Double_t offs4x = +0.; // box4 (sensor 6)
51  const Double_t offs4y = +0.;
52 
53 
54  //##################################################
55 
56 
57  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
58 
59  // Load this libraries
60  gSystem->Load("libGeoBase");
61  gSystem->Load("libParBase");
62  gSystem->Load("libBase");
63  gSystem->Load("libPndData");
64  gSystem->Load("libPassive");
65 
66  TString outfile= "TrackingStationDesyAli.root";
67  //TFile* fi = new TFile(outfile,"RECREATE");
68 
69  FairGeoLoader* geoLoad = new FairGeoLoader("TGeo","FairGeoLoader");
70  FairGeoInterface *geoFace = geoLoad->getGeoInterface();
71  geoFace->setMediaFile("../../../geometry/media_pnd.geo");
72  geoFace->readMedia();
73  geoFace->print();
74 
75  //##################################################
76 
77  FairGeoMedia *Media = geoFace->getMedia();
78  FairGeoBuilder *geobuild=geoLoad->getGeoBuilder();
79 
80  FairGeoMedium *CbmMediumAir = Media->getMedium("air");
81  FairGeoMedium *CbmMediumSilicon = Media->getMedium("silicon");
82 
83  Int_t nmed=geobuild->createMedium(CbmMediumAir);
84  nmed=geobuild->createMedium(CbmMediumSilicon);
85 
86  TGeoManager* gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
87 
88  TGeoVolume *top = new TGeoVolumeAssembly("TrackingStation");
89 
90  gGeoMan->SetTopVolume(top);
91 
92  TGeoShape *BoxDouble1 = new TGeoBBox("StripActiveTD1", kDx, kDy, kDz);
93  TGeoShape *BoxDouble2 = new TGeoBBox("StripActiveTD2", kDx, kDy, kDz);
94  TGeoShape *BoxSingle1 = new TGeoBBox("StripActiveTS1", kDx, kDy, kDz);
95  TGeoShape *BoxSingle2 = new TGeoBBox("StripActiveTS2", kDx, kDy, kDz);
96  TGeoShape *BoxSingle3 = new TGeoBBox("StripActiveTS3", kDx, kDy, kDz);
97  TGeoShape *BoxSingle4 = new TGeoBBox("StripActiveTS4", kDx, kDy, kDz);
98 
99  TGeoVolume* BoxVolDouble1 = new TGeoVolume("StripActiveTD1",BoxDouble1,gGeoMan->GetMedium("silicon"));
100  TGeoVolume* BoxVolDouble2 = new TGeoVolume("StripActiveTD2",BoxDouble2,gGeoMan->GetMedium("silicon"));
101  TGeoVolume* BoxVolSingle3a = new TGeoVolume("StripActiveTS3a",BoxSingle1,gGeoMan->GetMedium("silicon"));
102  TGeoVolume* BoxVolSingle3b = new TGeoVolume("StripActiveTS3b",BoxSingle2,gGeoMan->GetMedium("silicon"));
103  TGeoVolume* BoxVolSingle4a = new TGeoVolume("StripActiveTS4a",BoxSingle3,gGeoMan->GetMedium("silicon"));
104  TGeoVolume* BoxVolSingle4b = new TGeoVolume("StripActiveTS4b",BoxSingle4,gGeoMan->GetMedium("silicon"));
105 
106 
107  TGeoTranslation* trt1 = new TGeoTranslation(offs1x,offs1y,kPos1);
108  TGeoTranslation* trt2 = new TGeoTranslation(offs4x,offs4y,kPos2);
109  TGeoTranslation* trt3a = new TGeoTranslation(offs2x,0.,kPos3 - 0.5*kGap3 - kDz/2.);
110  TGeoTranslation* trt3b = new TGeoTranslation(0.,offs2y,kPos3 + 0.5*kGap3 + kDz/2.);
111  TGeoTranslation* trt4a = new TGeoTranslation(offs3x,0.,kPos4 - 0.5*kGap4 + kDz/2.);
112  TGeoTranslation* trt4b = new TGeoTranslation(0.,offs3y,kPos4 + 0.5*kGap4 - kDz/2.);
113 
114  TGeoRotation* dummyrot = new TGeoRotation();
115  TGeoRotation* rot1 = new TGeoRotation("",-90.,0.,0.);
116 
117 
118  // TO COMBINE DIFFERENT TILTS
119 
120  TGeoRotation rot2;
121  rot2.SetAngles(0.,-45.,0.);
122  TGeoRotation rot3;
123  rot3.SetAngles(90.,0.,0.);
124 
125  TGeoHMatrix h = rot2 * rot3;
126 
127  TGeoRotation *rot4 = new TGeoRotation(h);
128 
129  TGeoCombiTrans* trc1= new TGeoCombiTrans(*trt1,*dummyrot);
130  trc1->SetName("Sensor1");
131  trc1->RegisterYourself();
132 
133  TGeoCombiTrans* trc2= new TGeoCombiTrans(*trt2,*dummyrot);
134  trc2->SetName("Sensor2");
135  trc2->RegisterYourself();
136 
137  TGeoCombiTrans* trc3a= new TGeoCombiTrans(*trt3a,*dummyrot);
138  trc3a->SetName("Sensor3a");
139  trc3a->RegisterYourself();
140 
141  // TGeoCombiTrans* trc3b= new TGeoCombiTrans(*trt3b,*rot1);
142  TGeoCombiTrans* trc3b= new TGeoCombiTrans(*trt3b,*rot1);
143  trc3b->SetName("Sensor3b");
144  trc3b->RegisterYourself();
145 
146  TGeoCombiTrans* trc4a= new TGeoCombiTrans(*trt4a,*dummyrot);
147  trc4a->SetName("Sensor4a");
148  trc4a->RegisterYourself();
149 
150  // TGeoCombiTrans* trc4b= new TGeoCombiTrans(*trt4b,*dummyrot);
151  TGeoCombiTrans* trc4b= new TGeoCombiTrans(*trt4b,*rot1);
152  trc4b->SetName("Sensor4b");
153  trc4b->RegisterYourself();
154 
155  TGeoVolumeAssembly* SubunitVol = new TGeoVolumeAssembly("TTVol");
156 
157  TGeoVolumeAssembly* SubunitDouble = new TGeoVolumeAssembly("TrDouble");
158 
159  SubunitDouble->AddNode(BoxVolDouble1,0,trc1);
160  SubunitDouble->AddNode(BoxVolDouble2,0,trc2);
161 
162  TGeoVolumeAssembly* SubunitSingle = new TGeoVolumeAssembly("TrSingle");
163 
164  SubunitSingle->AddNode(BoxVolSingle3a,0,trc3a);
165  SubunitSingle->AddNode(BoxVolSingle3b,0,trc3b);
166  SubunitSingle->AddNode(BoxVolSingle4a,0,trc4a);
167  SubunitSingle->AddNode(BoxVolSingle4b,0,trc4b);
168 
169  SubunitVol->AddNode(SubunitDouble,0,new TGeoCombiTrans());
170  SubunitVol->AddNode(SubunitSingle,0,new TGeoCombiTrans());
171 
172  top->AddNode(SubunitVol,0,new TGeoCombiTrans());
173 
174  gGeoMan->CloseGeometry();
175  gGeoMan->Export(outfile.Data());
176  //top->Write();
177  //fi->Close();
178  //gGeoManager->Export(outfile);
179  top->Draw("ogl");
180 }
181 
TGeoTranslation * trt4a
const Double_t kPos4
TGeoVolume * top
TGeoShape * BoxDouble2
Int_t nmed
TGeoCombiTrans * trc2
FairGeoMedium * CbmMediumAir
TGeoTranslation * trt3b
TGeoShape * BoxDouble1
TGeoRotation rot2
TGeoTranslation * trt4b
const Double_t kPos3
TGeoVolume * BoxVolDouble2
TGeoVolumeAssembly * SubunitVol
TGeoVolumeAssembly * SubunitSingle
TGeoHMatrix h
TGeoCombiTrans * trc4b
TGeoVolume * BoxVolDouble1
TGeoTranslation * trt2
const Double_t kGap4
TGeoCombiTrans * trc4a
const Double_t kDy
TGeoRotation rot3
const Double_t offs4y
TGeoRotation * rot4
const Double_t offs4x
TGeoShape * BoxSingle4
TGeoVolume * BoxVolSingle4b
TGeoCombiTrans * trc3b
Double_t
FairGeoLoader * geoLoad
TGeoVolume * BoxVolSingle3b
TGeoVolume * BoxVolSingle4a
const Double_t offs2x
TGeoCombiTrans * trc1
TGeoRotation * rot1
FairGeoMedium * CbmMediumSilicon
TGeoShape * BoxSingle1
TGeoTranslation * trt1
const Double_t offs2y
TString outfile
TGeoShape * BoxSingle3
TGeoManager * gGeoMan
const Double_t kPos2
const Double_t offs3x
TGeoCombiTrans * trc3a
const Double_t offs1x
TGeoRotation * dummyrot
FairGeoBuilder * geobuild
const Double_t kDz
const Double_t kPos1
FairGeoInterface * geoFace
TGeoVolumeAssembly * SubunitDouble
const Double_t kGap3
const Double_t offs3y
TGeoTranslation * trt3a
TGeoVolume * BoxVolSingle3a
TGeoShape * BoxSingle2
const Double_t offs1y
FairGeoMedia * Media