BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
create_geom_bmnbd_run7.C
Go to the documentation of this file.
1/*************************************************************************************
2 * Project: BMN (git.jinr.ru/nica/bmnroot)
3 * Author: Elena Litvinenko (EL)
4 * Version: 17-Feb-2016
5 ************************************************************************************/
6
7#include "mpdshape.class.C"
8
9void addnum(char* name)
10{
11 if (name) {
12 int len = strlen(name);
13 if (len) {
14 name[len] = '#';
15 name[len + 1] = '1';
16 name[len + 2] = '\0';
17 }
18 }
19}
20
21void create_geom_bmnbd(const char* filename = "", const char* detector_name = "bd", const char* version_index = "1_0")
22{
23 char mothername[30] = Form("%s01", detector_name); // "bd"
24
25 TString Filename = filename;
26 if (Filename == "")
27 Filename = Form("%s_v%s\.geo", detector_name, version_index);
28
29 // output file
30 ofstream* f;
31 f = new ofstream(Filename.Data(), ios::out | ios::trunc);
32
33 cout << "filename: " << Filename.Data() << endl;
34
35 *f << "//*****************************************************" << endl;
36 *f << "// BD (BARREL) detector for BMN project," << endl;
37 *f << "// geometry version " << version_index << endl;
38 *f << "// generated " << __DATE__ << " by macro create_geom_bmnbd.C" << endl;
39 *f << "//*****************************************************" << endl;
40
41 Int_t number_of_scint_strips = 40;
42
43 Double_t thickness_steel_tube = 0.5, // mm
44 radius_external_steel_tube = 80 / 2,
45 // AZ size_z_steel_tube = 500 , // mm // ? suggested by EL
46 size_z_steel_tube = 160, // mm // ? suggested by EL
47
48 size_xy_scint_strip = 7, // mm
49 // AZ size_z_scint_strip = 150, // mm
50 size_z_scint_strip = 160, // mm
51
52 radius_internal_active_zone = 93. / 2,
53 // AZ pos_z_begin_of_active_zone_from_target_center = 80,
54 pos_z_begin_of_active_zone_from_target_center = -80,
55
56 size_z_delta_between_active_zone_and_external_cover = 7, // ? suggested by EL
57 radius_delta_between_active_zone_and_external_cover = 5, // ? suggested by EL
58
59 radius_external_mother_volume =
60 radius_internal_active_zone + size_xy_scint_strip + radius_delta_between_active_zone_and_external_cover,
61 size_z_mother_volume = size_z_steel_tube,
62 pos_z_mother_volume = pos_z_begin_of_active_zone_from_target_center + size_z_scint_strip
63 + size_z_delta_between_active_zone_and_external_cover - size_z_mother_volume / 2;
64
65 // pos_z_mother_volume = -219; //AZ - target position
66 pos_z_mother_volume = -30.; // AZ - target position
67 Double_t pos_x_mother_volume = 0; // AZ - target position
68 Double_t pos_y_mother_volume = 8.8; // AZ - target position
69
70 // helper streams
71 std::string points, position, rotation;
72 points = "0.0 0.0 0.0";
73 position = "0.0 0.0 0.0";
74 rotation = "1. 0. 0. 0. 1. 0. 0. 0. 1.";
75
76 //__________________________ BD mother volume _______________________________________
77
78 char mothername[30] = Form("%s01", detector_name); // "bd01"
79
80 Mpdshape* mother = new Mpdshape(f, mothername, "cave", "TUBE", "air", points, position, rotation, 1);
81 mother->Fill_TUBE(size_z_mother_volume / 2, radius_external_steel_tube - thickness_steel_tube,
82 radius_external_mother_volume);
83 // AZ mother->SetPosition(0,0,pos_z_mother_volume);
84 mother->SetPosition(pos_x_mother_volume, pos_y_mother_volume, pos_z_mother_volume);
85 mother->DumpWithIncrement();
86 addnum(mothername);
87
88 //__________________________ BD steel tube _______________________________________
89
90 char steel_tube_name[30] = Form("%s01steel", detector_name); // "bd01steel"
91
92 Mpdshape* steel_tube = new Mpdshape(f, steel_tube_name, mothername, "TUBE", "steel", points, position, rotation, 1);
93 steel_tube->Fill_TUBE(size_z_steel_tube / 2, radius_external_steel_tube - thickness_steel_tube,
94 radius_external_steel_tube);
95 steel_tube->SetPosition(0, 0, 0);
96 steel_tube->DumpWithIncrement();
97 addnum(steel_tube_name);
98
99 //__________________________ one scintillator strip _______________________________________
100
101 char scint_strip_name[30] = Form("%s01strip", detector_name); // "bd01strip"
102
103 TGeoRotation* rot = new TGeoRotation();
104 Double_t* rotm = rot->GetRotationMatrix();
105 Double_t coord[3];
106
107 Mpdshape* scint_strip =
108 new Mpdshape(f, scint_strip_name, mothername, "BOX", "FscScint", points, position, rotation, 1);
109 scint_strip->Fill_BOX(size_xy_scint_strip / 2, size_xy_scint_strip / 2, size_z_scint_strip / 2);
110 coord[0] = 0;
111 coord[1] = radius_internal_active_zone + size_xy_scint_strip / 2;
112 // AZ coord[2] = pos_z_begin_of_active_zone_from_target_center+size_z_scint_strip/2-pos_z_mother_volume;
113 coord[2] = 0;
114 scint_strip->SetPosition(coord[0], coord[1], coord[2]);
115 scint_strip->SetRotation(rotm[0], rotm[1], rotm[2], rotm[3], rotm[4], rotm[5], rotm[6], rotm[7], rotm[8]);
116 scint_strip->DumpWithIncrement();
117
118 //__________________________ other scintillator strips _______________________________________
119
120 Double_t phi = 90 * TMath::DegToRad(), delta_phi = 360. / number_of_scint_strips,
121 dphi = delta_phi * TMath::DegToRad();
122
123 for (int i = 1; i < number_of_scint_strips; i++) {
124 rot->RotateZ(-delta_phi);
125 rotm = rot->GetRotationMatrix();
126 scint_strip->SetRotation(rotm[0], rotm[1], rotm[2], rotm[3], rotm[4], rotm[5], rotm[6], rotm[7], rotm[8]);
127 phi -= dphi;
128 scint_strip->SetPosition(coord[1] * TMath::Cos(phi), coord[1] * TMath::Sin(phi), coord[2]);
129 scint_strip->DumpWithIncrement();
130 }
131
132 f->close();
133}
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 Fill_TUBE(Double_t length_z, Double_t r_max, Double_t r_min)
void SetRotation(std::string rotation)
void DumpWithIncrement()
const Double_t * GetRotationMatrix() const override
void RotateZ(Double_t angle) override
const char * Data() const
void addnum(char *name)
void create_geom_bmnbd(const char *filename="", const char *detector_name="bd", const char *version_index="1_0")
constexpr Double_t DegToRad()
Double_t Cos(Double_t)
Double_t Sin(Double_t)