BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
create_geom_bmnecal.C
Go to the documentation of this file.
1/*************************************************************************************
2 * Project: BMN (git.jinr.ru/nica/bmnroot)
3 * Author: Elena Litvinenko (EL)
4 * Adopted for BMN using the code written by Boiana Marinova (BM)
5 * Version: 16-Feb-2016
6 ************************************************************************************/
7
8#include "mpdshape.class.C"
9
10void addnum(char* name)
11{
12 if (name) {
13 int len = strlen(name);
14 if (len) {
15 name[len] = '#';
16 name[len + 1] = '1';
17 name[len + 2] = '\0';
18 }
19 }
20}
21
22void create_geom_bmnecal(const char* filename = "",
23 const char* detector_name = "ecal",
24 const char* version_index = "1_0")
25{
26 char mothername[30] = Form("%s01", detector_name); // "ecal"
27
28 TString Filename = filename;
29 if (Filename == "")
30 Filename = Form("%s_v%s\.geo", detector_name, version_index);
31
32 // output file
33 ofstream* f;
34 f = new ofstream(Filename.Data(), ios::out | ios::trunc);
35
36 cout << "filename: " << Filename.Data() << endl;
37
38 *f << "//*****************************************************" << endl;
39 *f << "// ECAL detector for BMN project," << endl;
40 *f << "// geometry version " << version_index << endl;
41 *f << "// generated " << __DATE__ << " by macro create_geom_bmnecal.C" << endl;
42 *f << "//*****************************************************" << endl;
43
44 Int_t number_of_modules_in_one_segment_along_X = 8, number_of_modules_in_one_segment_along_Y = 10,
45 number_of_layers = 220;
46
48
49 thickness_lead = 0.3, // mm
50 thickness_scint = 1.5, // mm
51 half_thickness_layer = (thickness_lead + thickness_scint) / 2, thickness_module_front_cover = 2,
52
53 size_xy_scint = 40, // 4x4 cm^2
54 size_xy_module = 120, // == size_xy_lead
55 size_z_module = 400,
56 size_z_module_delta = 150, // 150, // 15 cm reserved for PMT and FEE // EL
57 size_x_segment = size_xy_module * number_of_modules_in_one_segment_along_X,
58 size_y_segment = size_xy_module * number_of_modules_in_one_segment_along_Y,
59 size_z_segment = size_z_module + size_z_module_delta,
60
61 pos_x_segment_center = -300 - size_x_segment / 2, pos_y_segment_center = 0,
62 pos_z_segment_center = 7200, // 720 cm
63 pos_x_beam_in_ecal_place = 300 // 30 cm
64 ;
65
66 // helper streams
67 std::string points, position, rotation;
68 points = "0.0 0.0 0.0";
69 position = "0.0 0.0 0.0";
70 rotation = "1. 0. 0. 0. 1. 0. 0. 0. 1.";
71
72 //__________________________One ECAL segment (chamber) _______________________________________
73
74 char mothername[30] = Form("%s01", detector_name); // "ecal01"
75
76 Mpdshape* mother = new Mpdshape(f, mothername, "cave", "BOX", "air", points, position, rotation, 1);
77 mother->Fill_BOX(size_x_segment / 2, size_y_segment / 2, size_z_segment / 2);
78 mother->SetPosition(pos_x_beam_in_ecal_place + pos_x_segment_center, pos_y_segment_center, pos_z_segment_center);
79 mother->DumpWithIncrement();
80 addnum(mothername);
81
82 //__________________________One ECAL module (120x120) _______________________________________
83
84 char modulename[30] = Form("%s01mod", detector_name); // "ecal01mod"
85
86 Mpdshape* module = new Mpdshape(f, modulename, mothername, "BOX", "air", points, position, rotation, 1);
87 module->Fill_BOX(size_xy_module / 2, size_xy_module / 2, size_z_module / 2);
88 module->SetPosition(size_x_segment / 2 - size_xy_module / 2, size_y_segment / 2 - size_xy_module / 2,
89 -size_z_module_delta / 2);
90 module->DumpWithIncrement();
91 addnum(modulename);
92
93 //_____________ Front cover in one module _____________
94
95 Mpdshape* front_cover = new Mpdshape(f, "ecal01front", modulename, "BOX", "steel", points, position, rotation, 1);
96 front_cover->Fill_BOX(size_xy_module / 2, size_xy_module / 2, thickness_module_front_cover / 2);
97 front_cover->SetPosition(0, 0, -size_z_module / 2 + thickness_module_front_cover / 2);
98 front_cover->DumpWithIncrement();
99
100 //_____________ One ECAL layer (120x120) _____________
101
102 char layername[30] = Form("%s01lay", detector_name); // "ecal01lay"
103
104 Mpdshape* layer = new Mpdshape(f, layername, modulename, "BOX", "air", points, position, rotation, 1);
105 layer->Fill_BOX(size_xy_module / 2, size_xy_module / 2, half_thickness_layer);
106 layer->SetPosition(0, 0, -size_z_module / 2 + thickness_module_front_cover + half_thickness_layer);
107 layer->DumpWithIncrement();
108 addnum(layername);
109
110 Mpdshape* lead = new Mpdshape(f, "ecal01lead", layername, "BOX", "lead", points, position, rotation, 1);
111 lead->Fill_BOX(size_xy_module / 2, size_xy_module / 2, thickness_lead / 2);
112 lead->SetPosition(0, 0, -thickness_scint / 2);
113 lead->DumpWithIncrement();
114
115 Mpdshape* scint = new Mpdshape(f, "ecal01scint", layername, "BOX", "FscScint", points, position, rotation, 1);
116 scint->Fill_BOX(size_xy_scint / 2, size_xy_scint / 2, thickness_scint / 2);
117 scint->SetPosition(size_xy_module / 2 - size_xy_scint / 2, size_xy_module / 2 - size_xy_scint / 2,
118 thickness_lead / 2);
119 scint->DumpWithIncrement();
120
121 for (int i = 0; i < 3; i++) {
122 for (int j = 0; j < 3; j++) {
123 if (i || j) {
124 scint->SetPosition(size_xy_module / 2 - size_xy_scint / 2 - size_xy_scint * i,
125 size_xy_module / 2 - size_xy_scint / 2 - size_xy_scint * j, thickness_lead / 2);
126 scint->DumpWithIncrement();
127 }
128 }
129 }
130
131 //_________Other ECAL layers (120x120) __________________
132
133 for (int i = 1; i < number_of_layers; i++) {
134 layer->SetPosition(0, 0,
135 -size_z_module / 2 + thickness_module_front_cover + half_thickness_layer
136 + i * 2 * half_thickness_layer);
137 layer->DumpWithIncrement();
138 }
139
140 //__________________________Other ECAL modules (120x120) _______________________________________
141
142 for (int i = 0; i < number_of_modules_in_one_segment_along_X; i++) {
143 for (int j = 0; j < number_of_modules_in_one_segment_along_Y; j++) {
144 if (i || j) {
145 module->SetPosition(size_x_segment / 2 - size_xy_module / 2 - size_xy_module * i,
146 size_y_segment / 2 - size_xy_module / 2 - size_xy_module * j,
147 -size_z_module_delta / 2);
148 module->DumpWithIncrement();
149 }
150 }
151 }
152
153 //__________________________Second ECAL segment (chamber) _______________________________________
154
155 mother->SetPosition(pos_x_beam_in_ecal_place - pos_x_segment_center, pos_y_segment_center, pos_z_segment_center);
156 // mother->SetRotation("-1. 0. 0. 0. 1. 0. 0. 0. 1.");
157 mother->DumpWithIncrement();
158
159 f->close();
160}
int i
Definition P4_F32vec4.h:22
int Int_t
double Double_t
char * Form(const char *fmt,...)
void SetPosition(std::string position)
void Fill_BOX(Double_t xWidth, Double_t yWidth, Double_t zWidth)
void DumpWithIncrement()
const char * Data() const
void addnum(char *name)
void create_geom_bmnecal(const char *filename="", const char *detector_name="ecal", const char *version_index="1_0")