BmnRoot
Loading...
Searching...
No Matches
create_rootgeom_TOF700_support.h
Go to the documentation of this file.
1//---------------------------
2
3#define TOF2_MAX_UBEAMS 42
4#define TOF2_UBEAMS_ORIENTATIONS 4
5
6//Detector's construct parameters
7Double_t Support_TOF2_long = 3.;
8Double_t Support_TOF2_short = 2.;
9Double_t Support_TOF2_thickness = 0.15;
10
16
17int readGeomSupport(char *geomfile);
18
20
21 // ------- Geometry text file name (input) ----------------------------------
22 readGeomSupport((char *)"TOF700_geometry_support.txt");
23
24 TGeoTranslation *ChannelPosTOF2_trans[TOF2_MAX_UBEAMS] = {NULL};
25 TGeoTranslation *AirPosTOF2_trans[4] = {NULL};
26 char name[64];
27 for (int i = 0; i < TOF2_MAX_UBEAMS; i++)
28 {
29 sprintf(name,"Channel_%d_PosTOF2_trans", i+1);
30 ChannelPosTOF2_trans[i] = new TGeoTranslation(name, Support_TOF2_X_center[i], Support_TOF2_Y_center[i], Support_TOF2_Z_center[i]);
31 }
32 AirPosTOF2_trans[0] = new TGeoTranslation("AirPos0", 0., +Support_TOF2_thickness, 0.);
33 AirPosTOF2_trans[1] = new TGeoTranslation("AirPos1", 0., -Support_TOF2_thickness, 0.);
34 AirPosTOF2_trans[2] = new TGeoTranslation("AirPos2", +Support_TOF2_thickness, 0., 0.);
35 AirPosTOF2_trans[3] = new TGeoTranslation("AirPos3", -Support_TOF2_thickness, 0., 0.);
36
37 char nTOF2ChannelS[TOF2_MAX_UBEAMS][32];
38 char nTOF2ChannelAirS[TOF2_MAX_UBEAMS][32];
39 char nTOF2ChannelV[TOF2_MAX_UBEAMS][32];
40 char nTOF2ChannelAirV[TOF2_MAX_UBEAMS][32];
41 TGeoBBox *TOF2ChannelS[TOF2_MAX_UBEAMS];
42 TGeoBBox *TOF2ChannelAirS[TOF2_MAX_UBEAMS];
43 TGeoVolume *TOF2ChannelV[TOF2_MAX_UBEAMS];
44 TGeoVolume *TOF2ChannelAirV[TOF2_MAX_UBEAMS];
45
46 for (int i = 0; i<TOF2_MAX_UBEAMS; i++)
47 {
48 sprintf(nTOF2ChannelS[i],"TOF2ChannelS%d",i+1);
49 sprintf(nTOF2ChannelAirS[i],"TOF2ChannelAirS%d",i+1);
50 sprintf(nTOF2ChannelV[i],"TOF2ChannelV%d",i+1);
51 sprintf(nTOF2ChannelAirV[i],"TOF2ChannelAirV%d",i+1);
53 {
54 case 0:
55 TOF2ChannelS[i] = new TGeoBBox(nTOF2ChannelS[i], Support_TOF2_length[i]/2., Support_TOF2_short, Support_TOF2_long);
56 TOF2ChannelAirS[i] = new TGeoBBox(nTOF2ChannelAirS[i], Support_TOF2_length[i]/2., Support_TOF2_short-Support_TOF2_thickness, Support_TOF2_long-Support_TOF2_thickness);
57
58 //Volumes
59
60 TOF2ChannelV[i] = new TGeoVolume(nTOF2ChannelV[i], TOF2ChannelS[i]);
61 TOF2ChannelV[i]->SetMedium(medAl);
62 TOF2ChannelV[i]->SetLineColor(kYellow);
63 TOF2ChannelV[i]->SetVisibility(kTRUE);
64 //TOF2ChannelV[i]->SetTransparency(80);
65
66 TOF2ChannelAirV[i] = new TGeoVolume(nTOF2ChannelAirV[i], TOF2ChannelAirS[i]);
67 TOF2ChannelAirV[i]->SetMedium(pMedAir);
68// TOF2ChannelAirV[i]->SetVisibility(kFALSE);
69// TOF2ChannelAirV[i]->SetLineColor(kGreen);
70 TOF2ChannelAirV[i]->SetVisibility(kTRUE);
71 TOF2ChannelAirV[i]->SetLineColor(kWhite);
72
73 TOF2ChannelV[i]->AddNode(TOF2ChannelAirV[i], 1, AirPosTOF2_trans[0]);
74 break;
75 case 1:
76 TOF2ChannelS[i] = new TGeoBBox(nTOF2ChannelS[i], Support_TOF2_length[i]/2., Support_TOF2_short, Support_TOF2_long);
77 TOF2ChannelAirS[i] = new TGeoBBox(nTOF2ChannelAirS[i], Support_TOF2_length[i]/2., Support_TOF2_short-Support_TOF2_thickness, Support_TOF2_long-Support_TOF2_thickness);
78
79 //Volumes
80
81 TOF2ChannelV[i] = new TGeoVolume(nTOF2ChannelV[i], TOF2ChannelS[i]);
82 TOF2ChannelV[i]->SetMedium(medAl);
83 TOF2ChannelV[i]->SetLineColor(kYellow);
84 TOF2ChannelV[i]->SetVisibility(kTRUE);
85 //TOF2ChannelV[i]->SetTransparency(80);
86
87 TOF2ChannelAirV[i] = new TGeoVolume(nTOF2ChannelAirV[i], TOF2ChannelAirS[i]);
88 TOF2ChannelAirV[i]->SetMedium(pMedAir);
89// TOF2ChannelAirV[i]->SetVisibility(kFALSE);
90// TOF2ChannelAirV[i]->SetLineColor(kGreen);
91 TOF2ChannelAirV[i]->SetVisibility(kTRUE);
92 TOF2ChannelAirV[i]->SetLineColor(kWhite);
93
94 TOF2ChannelV[i]->AddNode(TOF2ChannelAirV[i], 1, AirPosTOF2_trans[1]);
95 break;
96 case 2:
97 TOF2ChannelS[i] = new TGeoBBox(nTOF2ChannelS[i], Support_TOF2_short, Support_TOF2_length[i]/2., Support_TOF2_long);
98 TOF2ChannelAirS[i] = new TGeoBBox(nTOF2ChannelAirS[i], Support_TOF2_short-Support_TOF2_thickness, Support_TOF2_length[i]/2., Support_TOF2_long-Support_TOF2_thickness);
99
100 //Volumes
101
102 TOF2ChannelV[i] = new TGeoVolume(nTOF2ChannelV[i], TOF2ChannelS[i]);
103 TOF2ChannelV[i]->SetMedium(medAl);
104 TOF2ChannelV[i]->SetLineColor(kYellow);
105 TOF2ChannelV[i]->SetVisibility(kTRUE);
106 //TOF2ChannelV[i]->SetTransparency(80);
107
108 TOF2ChannelAirV[i] = new TGeoVolume(nTOF2ChannelAirV[i], TOF2ChannelAirS[i]);
109 TOF2ChannelAirV[i]->SetMedium(pMedAir);
110// TOF2ChannelAirV[i]->SetVisibility(kFALSE);
111// TOF2ChannelAirV[i]->SetLineColor(kGreen);
112 TOF2ChannelAirV[i]->SetVisibility(kTRUE);
113 TOF2ChannelAirV[i]->SetLineColor(kWhite);
114
115 TOF2ChannelV[i]->AddNode(TOF2ChannelAirV[i], 1, AirPosTOF2_trans[2]);
116 break;
117 case 3:
118 TOF2ChannelS[i] = new TGeoBBox(nTOF2ChannelS[i], Support_TOF2_short, Support_TOF2_length[i]/2., Support_TOF2_long);
119 TOF2ChannelAirS[i] = new TGeoBBox(nTOF2ChannelAirS[i], Support_TOF2_short-Support_TOF2_thickness, Support_TOF2_length[i]/2., Support_TOF2_long-Support_TOF2_thickness);
120
121 //Volumes
122
123 TOF2ChannelV[i] = new TGeoVolume(nTOF2ChannelV[i], TOF2ChannelS[i]);
124 TOF2ChannelV[i]->SetMedium(medAl);
125 TOF2ChannelV[i]->SetLineColor(kYellow);
126 TOF2ChannelV[i]->SetVisibility(kTRUE);
127 //TOF2ChannelV[i]->SetTransparency(80);
128
129 TOF2ChannelAirV[i] = new TGeoVolume(nTOF2ChannelAirV[i], TOF2ChannelAirS[i]);
130 TOF2ChannelAirV[i]->SetMedium(pMedAir);
131// TOF2ChannelAirV[i]->SetVisibility(kFALSE);
132// TOF2ChannelAirV[i]->SetLineColor(kGreen);
133 TOF2ChannelAirV[i]->SetVisibility(kTRUE);
134 TOF2ChannelAirV[i]->SetLineColor(kWhite);
135
136 TOF2ChannelV[i]->AddNode(TOF2ChannelAirV[i], 1, AirPosTOF2_trans[3]);
137 break;
138 default: break;
139 }
140 }
141
142 //Adding volumes to the TOP Volume
143 for (int i = 0; i < TOF2_MAX_UBEAMS; i++)
144 {
145 TOF2Top->AddNode(TOF2ChannelV[i], i+1, ChannelPosTOF2_trans[i]);
146 }
147}
148
149int readGeomSupport(char *geomfile)
150{
151 char fname[128];
152 FILE *fg = 0;
153 int n = 0;
154 if (strlen(geomfile) == 0)
155 {
156 printf("TOF700 geometry file name not defined!\n");
157 return 0;
158 }
159 TString dir = getenv("VMCWORKDIR");
160 sprintf(fname,"%s/geometry/%s",dir.Data(),geomfile);
161 fg = fopen(fname,"r");
162 if (fg == NULL)
163 {
164 printf("TOF700 geometry file %s open error!\n", fname);
165 return 0;
166 }
167
168 int c = 0;
169 while(fscanf(fg,"%d %lf %lf %lf %lf %d\n", &n,
171 {
172 Support_TOF2_X_center[c] += xoffs;
173 Support_TOF2_Y_center[c] += yoffs;
174 Support_TOF2_Z_center[c] += zoffs;
175 c++;
176 if (c >= TOF2_MAX_UBEAMS) break;
177 }
178 fclose(fg);
179 return 1;
180}
int i
Definition P4_F32vec4.h:22
Double_t Support_TOF2_long
Double_t Support_TOF2_Z_center[TOF2_MAX_UBEAMS]
int readGeomSupport(char *geomfile)
Double_t Support_TOF2_X_center[TOF2_MAX_UBEAMS]
Double_t Support_TOF2_thickness
Double_t Support_TOF2_Y_center[TOF2_MAX_UBEAMS]
void create_rootgeom_TOF700_support()
Int_t Support_TOF2_orientation[TOF2_MAX_UBEAMS]
Double_t Support_TOF2_short
#define TOF2_MAX_UBEAMS
Double_t Support_TOF2_length[TOF2_MAX_UBEAMS]