BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
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
10
16
17int readGeomSupport(char* geomfile);
18
20{
21
22 // ------- Geometry text file name (input) ----------------------------------
23 readGeomSupport((char*)"TOF700_geometry_support.txt");
24
25 TGeoTranslation* ChannelPosTOF2_trans[TOF2_MAX_UBEAMS] = {NULL};
26 TGeoTranslation* AirPosTOF2_trans[4] = {NULL};
27 char name[64];
28 for (int i = 0; i < TOF2_MAX_UBEAMS; i++) {
29 sprintf(name, "Channel_%d_PosTOF2_trans", i + 1);
30 ChannelPosTOF2_trans[i] =
32 }
33 AirPosTOF2_trans[0] = new TGeoTranslation("AirPos0", 0., +Support_TOF2_thickness, 0.);
34 AirPosTOF2_trans[1] = new TGeoTranslation("AirPos1", 0., -Support_TOF2_thickness, 0.);
35 AirPosTOF2_trans[2] = new TGeoTranslation("AirPos2", +Support_TOF2_thickness, 0., 0.);
36 AirPosTOF2_trans[3] = new TGeoTranslation("AirPos3", -Support_TOF2_thickness, 0., 0.);
37
38 char nTOF2ChannelS[TOF2_MAX_UBEAMS][32];
39 char nTOF2ChannelAirS[TOF2_MAX_UBEAMS][32];
40 char nTOF2ChannelV[TOF2_MAX_UBEAMS][32];
41 char nTOF2ChannelAirV[TOF2_MAX_UBEAMS][32];
42 TGeoBBox* TOF2ChannelS[TOF2_MAX_UBEAMS];
43 TGeoBBox* TOF2ChannelAirS[TOF2_MAX_UBEAMS];
44 TGeoVolume* TOF2ChannelV[TOF2_MAX_UBEAMS];
45 TGeoVolume* TOF2ChannelAirV[TOF2_MAX_UBEAMS];
46
47 for (int i = 0; i < TOF2_MAX_UBEAMS; i++) {
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);
52 switch (Support_TOF2_orientation[i]) {
53 case 0:
54 TOF2ChannelS[i] =
56 TOF2ChannelAirS[i] = new TGeoBBox(nTOF2ChannelAirS[i], Support_TOF2_length[i] / 2.,
59
60 // Volumes
61
62 TOF2ChannelV[i] = new TGeoVolume(nTOF2ChannelV[i], TOF2ChannelS[i]);
63 TOF2ChannelV[i]->SetMedium(medAl);
64 TOF2ChannelV[i]->SetLineColor(kYellow);
65 TOF2ChannelV[i]->SetVisibility(kTRUE);
66 // TOF2ChannelV[i]->SetTransparency(80);
67
68 TOF2ChannelAirV[i] = new TGeoVolume(nTOF2ChannelAirV[i], TOF2ChannelAirS[i]);
69 TOF2ChannelAirV[i]->SetMedium(pMedAir);
70 // TOF2ChannelAirV[i]->SetVisibility(kFALSE);
71 // TOF2ChannelAirV[i]->SetLineColor(kGreen);
72 TOF2ChannelAirV[i]->SetVisibility(kTRUE);
73 TOF2ChannelAirV[i]->SetLineColor(kWhite);
74
75 TOF2ChannelV[i]->AddNode(TOF2ChannelAirV[i], 1, AirPosTOF2_trans[0]);
76 break;
77 case 1:
78 TOF2ChannelS[i] =
80 TOF2ChannelAirS[i] = new TGeoBBox(nTOF2ChannelAirS[i], Support_TOF2_length[i] / 2.,
83
84 // Volumes
85
86 TOF2ChannelV[i] = new TGeoVolume(nTOF2ChannelV[i], TOF2ChannelS[i]);
87 TOF2ChannelV[i]->SetMedium(medAl);
88 TOF2ChannelV[i]->SetLineColor(kYellow);
89 TOF2ChannelV[i]->SetVisibility(kTRUE);
90 // TOF2ChannelV[i]->SetTransparency(80);
91
92 TOF2ChannelAirV[i] = new TGeoVolume(nTOF2ChannelAirV[i], TOF2ChannelAirS[i]);
93 TOF2ChannelAirV[i]->SetMedium(pMedAir);
94 // TOF2ChannelAirV[i]->SetVisibility(kFALSE);
95 // TOF2ChannelAirV[i]->SetLineColor(kGreen);
96 TOF2ChannelAirV[i]->SetVisibility(kTRUE);
97 TOF2ChannelAirV[i]->SetLineColor(kWhite);
98
99 TOF2ChannelV[i]->AddNode(TOF2ChannelAirV[i], 1, AirPosTOF2_trans[1]);
100 break;
101 case 2:
102 TOF2ChannelS[i] =
104 TOF2ChannelAirS[i] =
105 new TGeoBBox(nTOF2ChannelAirS[i], Support_TOF2_short - Support_TOF2_thickness,
107
108 // Volumes
109
110 TOF2ChannelV[i] = new TGeoVolume(nTOF2ChannelV[i], TOF2ChannelS[i]);
111 TOF2ChannelV[i]->SetMedium(medAl);
112 TOF2ChannelV[i]->SetLineColor(kYellow);
113 TOF2ChannelV[i]->SetVisibility(kTRUE);
114 // TOF2ChannelV[i]->SetTransparency(80);
115
116 TOF2ChannelAirV[i] = new TGeoVolume(nTOF2ChannelAirV[i], TOF2ChannelAirS[i]);
117 TOF2ChannelAirV[i]->SetMedium(pMedAir);
118 // TOF2ChannelAirV[i]->SetVisibility(kFALSE);
119 // TOF2ChannelAirV[i]->SetLineColor(kGreen);
120 TOF2ChannelAirV[i]->SetVisibility(kTRUE);
121 TOF2ChannelAirV[i]->SetLineColor(kWhite);
122
123 TOF2ChannelV[i]->AddNode(TOF2ChannelAirV[i], 1, AirPosTOF2_trans[2]);
124 break;
125 case 3:
126 TOF2ChannelS[i] =
128 TOF2ChannelAirS[i] =
129 new TGeoBBox(nTOF2ChannelAirS[i], Support_TOF2_short - Support_TOF2_thickness,
131
132 // Volumes
133
134 TOF2ChannelV[i] = new TGeoVolume(nTOF2ChannelV[i], TOF2ChannelS[i]);
135 TOF2ChannelV[i]->SetMedium(medAl);
136 TOF2ChannelV[i]->SetLineColor(kYellow);
137 TOF2ChannelV[i]->SetVisibility(kTRUE);
138 // TOF2ChannelV[i]->SetTransparency(80);
139
140 TOF2ChannelAirV[i] = new TGeoVolume(nTOF2ChannelAirV[i], TOF2ChannelAirS[i]);
141 TOF2ChannelAirV[i]->SetMedium(pMedAir);
142 // TOF2ChannelAirV[i]->SetVisibility(kFALSE);
143 // TOF2ChannelAirV[i]->SetLineColor(kGreen);
144 TOF2ChannelAirV[i]->SetVisibility(kTRUE);
145 TOF2ChannelAirV[i]->SetLineColor(kWhite);
146
147 TOF2ChannelV[i]->AddNode(TOF2ChannelAirV[i], 1, AirPosTOF2_trans[3]);
148 break;
149 default:
150 break;
151 }
152 }
153
154 // Adding volumes to the TOP Volume
155 for (int i = 0; i < TOF2_MAX_UBEAMS; i++) {
156 TOF2Top->AddNode(TOF2ChannelV[i], i + 1, ChannelPosTOF2_trans[i]);
157 }
158}
159
160int readGeomSupport(char* geomfile)
161{
162 char fname[128];
163 FILE* fg = 0;
164 int n = 0;
165 if (strlen(geomfile) == 0) {
166 printf("TOF700 geometry file name not defined!\n");
167 return 0;
168 }
169 TString dir = getenv("VMCWORKDIR");
170 sprintf(fname, "%s/geometry/%s", dir.Data(), geomfile);
171 fg = fopen(fname, "r");
172 if (fg == NULL) {
173 printf("TOF700 geometry file %s open error!\n", fname);
174 return 0;
175 }
176
177 int c = 0;
178 while (fscanf(fg, "%d %lf %lf %lf %lf %d\n", &n, &Support_TOF2_X_center[c], &Support_TOF2_Y_center[c],
180 == 6)
181 {
182 Support_TOF2_X_center[c] += xoffs;
183 Support_TOF2_Y_center[c] += yoffs;
184 Support_TOF2_Z_center[c] += zoffs;
185 c++;
186 if (c >= TOF2_MAX_UBEAMS)
187 break;
188 }
189 fclose(fg);
190 return 1;
191}
int i
Definition P4_F32vec4.h:22
int Int_t
double Double_t
constexpr Bool_t kTRUE
kWhite
kYellow
void SetVisibility(Bool_t vis=kTRUE) override
virtual TGeoNode * AddNode(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat=nullptr, Option_t *option="")
virtual void SetMedium(TGeoMedium *medium)
void SetLineColor(Color_t lcolor) override
const char * Data() const
Double_t Support_TOF2_long
Double_t Support_TOF2_Z_center[TOF2_MAX_UBEAMS]
Double_t Support_TOF2_X_center[TOF2_MAX_UBEAMS]
Double_t Support_TOF2_thickness
Double_t Support_TOF2_Y_center[TOF2_MAX_UBEAMS]
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]
*brief user defined string literal for JSON values *sa std::size_t n
Definition json.hpp:20362
int readGeomSupport(char *geomfile)
void create_rootgeom_TOF700_support()