Skip to content
Snippets Groups Projects
Commit 3923a54f authored by fhzhb's avatar fhzhb
Browse files

Added the 2021 test-beam automatic configuration settings

parent 2c9e2040
No related branches found
No related tags found
1 merge request!8Added the 2021 test-beam automatic configuration settings
Showing
with 2809 additions and 964 deletions
No preview for this file type
...@@ -92,6 +92,12 @@ class Alignment { ...@@ -92,6 +92,12 @@ class Alignment {
double x_table; double x_table;
/** Y position of the Desy Table **/ /** Y position of the Desy Table **/
double y_table; double y_table;
/** Energy of the beam **/
double beam_energy;
/** Scan name of the beam **/
std::string beam_scan;
/** Type of the beam **/
std::string beam_type;
/** First detector met by the beam **/ /** First detector met by the beam **/
std::string upstream_Det; std::string upstream_Det;
/** Second detector met by the beam **/ /** Second detector met by the beam **/
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
# Descriptions of commands can be found in the UI command tree # Descriptions of commands can be found in the UI command tree
################################# #################################
/beam/type lhc /beam/type TB2021
/beam/pos 0. 0. -140. /beam/pos 0. 0. -140.
/beam/projectBeam -80. mm /beam/projectBeam -80. mm
/beam/nPrimaries 1 /beam/nPrimaries 1
......
...@@ -549,7 +549,7 @@ if(isTrigger){ ...@@ -549,7 +549,7 @@ if(isTrigger){
void DetectorConstruction::LoadConfigurationFile( G4String _inFile ){ void DetectorConstruction::LoadConfigurationFile( G4String _inFile ){
if(_inFile = ""){ if(_inFile == ""){
_inFile = std::getenv("JZCaPA"); _inFile = std::getenv("JZCaPA");
_inFile += "/Utils/Survey_2018.xml"; _inFile += "/Utils/Survey_2018.xml";
} }
...@@ -603,7 +603,7 @@ void DetectorConstruction::LoadConfigurationFile( G4String _inFile ){ ...@@ -603,7 +603,7 @@ void DetectorConstruction::LoadConfigurationFile( G4String _inFile ){
void DetectorConstruction::LoadAlignmentFile( G4String _inFile ){ void DetectorConstruction::LoadAlignmentFile( G4String _inFile ){
bool debug = false; bool debug = false;
if( _inFile = ""){ if( _inFile == ""){
_inFile = std::getenv("JZCaPA"); _inFile = std::getenv("JZCaPA");
_inFile += "/Utils/Alignment_2018.xml"; _inFile += "/Utils/Alignment_2018.xml";
} }
...@@ -633,6 +633,9 @@ void DetectorConstruction::LoadAlignmentFile( G4String _inFile ){ ...@@ -633,6 +633,9 @@ void DetectorConstruction::LoadAlignmentFile( G4String _inFile ){
if(debug){ if(debug){
std::cout << "Found Run Entry in Alignment file for run " << m_runNumber << std::endl; std::cout << "Found Run Entry in Alignment file for run " << m_runNumber << std::endl;
} }
m_XMLparser->getChildValue("Alignment",i,"beam_scan",m_alignment->beam_scan);
m_XMLparser->getChildValue("Alignment",i,"beam_type",m_alignment->beam_type);
m_XMLparser->getChildValue("Alignment",i,"beam_energy",m_alignment->beam_energy);
m_XMLparser->getChildValue("Alignment",i,"x_table",m_alignment->x_table); m_XMLparser->getChildValue("Alignment",i,"x_table",m_alignment->x_table);
m_XMLparser->getChildValue("Alignment",i,"y_table",m_alignment->y_table); m_XMLparser->getChildValue("Alignment",i,"y_table",m_alignment->y_table);
m_XMLparser->getChildValue("Alignment",i,"upstream_Det",m_alignment->upstream_Det); m_XMLparser->getChildValue("Alignment",i,"upstream_Det",m_alignment->upstream_Det);
......
...@@ -64,35 +64,50 @@ void TestBeam2021PrimaryGenerator::GeneratePrimaryVertex(G4Event* event) ...@@ -64,35 +64,50 @@ void TestBeam2021PrimaryGenerator::GeneratePrimaryVertex(G4Event* event)
DetectorConstruction* dC DetectorConstruction* dC
= (DetectorConstruction*)G4RunManager::GetRunManager()->GetUserDetectorConstruction(); = (DetectorConstruction*)G4RunManager::GetRunManager()->GetUserDetectorConstruction();
if(event->GetEventID() == 0){ if(event->GetEventID() == 0){
G4String _inFile = (std::string)std::getenv("JZCaPA") + "/Utils/Survey_2021.xml"; G4String _inFile = (std::string)std::getenv("JZCaPA") + "/Utils/Alignment_2021.xml"; // I added corresponding scan name in each run
dC->LoadAlignmentFile( _inFile.c_str() ); dC->LoadAlignmentFile( _inFile.c_str() );
m_alignment = dC->GetAlignment(); m_alignment = dC->GetAlignment();
} }
G4cout << "This doesn't do anything yet" << G4endl; // Define the position of the particle
G4String _profile = (std::string)std::getenv("JZCaPA") + "/Utils/2021testbeam_scan/" + m_alignment.beam_scan + ".txt"; //Select the corresponding scan file according to run number
if (m_alignment.beam_scan == ""){
G4cout << " ==== This Run does not belong to any processed Scan ==== " << G4endl; // You can check ("JZCaPA")/Utils/2021testbeam_scan/README.md
}
const int WireChamberSize = 101;
G4double probListX[WireChamberSize],
probListY[WireChamberSize];
// Put the X and Y beam profile into two arrays
std::ifstream _scanfile(_profile);
for(int j = 0; j < 2; ++j){
for(int i = 0; i < WireChamberSize; ++i){
if (!j){
_scanfile >> probListX[i];
}
_scanfile >> probListY[i];
}
}
_scanfile.close();
// // Define the position of the particle G4RandGeneral RandX(probListX, WireChamberSize); //Generate the random number, range (0, 1)
// G4double x = yourRandomDistributionX; //x position G4RandGeneral RandY(probListY, WireChamberSize);
// G4double y = yourRandomDistributionY; //y position G4double x = RandX.shoot()*(WireChamberSize-1)-(WireChamberSize-1)/2; //Map (0, 1) to (-50, 50), RandNum * 100 - 50
// G4ThreeVector position(x,y,0); //Insert x and y into a vector. Beam will be at zero G4double y = RandY.shoot()*(WireChamberSize-1)-(WireChamberSize-1)/2;
// G4double time = 0*s; //Time is always zero for us G4ThreeVector position(x, y, 0);
// // G4double time = 0*s;
// G4PrimaryVertex* vertex = new G4PrimaryVertex(position, time); //Insert the position and time into a primary vertex G4PrimaryVertex* vertex = new G4PrimaryVertex(position, time);
//
// G4cout << "Beam scan & type & energy ==> (" << m_alignment.beam_scan << m_alignment.beam_type << ", " << m_alignment.beam_energy << ")" << G4endl;
// // A note for Hongbo: G4cout << "Particle Position ==> (" << position.x() << ", " << position.y() << ", " << position.z() << ")" << G4endl;
// // I think for now we can use the particle type as defined by the .xml file
// // but for future work it might be good for us to simulate an impure beam. G4ParticleDefinition* particleDefinition
// // What I've written below should work fine. You just need to worry about x and y above = G4ParticleTable::GetParticleTable()->FindParticle(m_alignment.beam_type.c_str()); // about the definition of the ParticleTable, I changed the Alignment_2021.xml file, "e" to "e-", "p" to "proton"
// G4PrimaryParticle* particle = new G4PrimaryParticle(particleDefinition);
// G4ParticleDefinition* particleDefinition particle->SetMomentumDirection(G4ThreeVector(0,0,1));
// = G4ParticleTable::GetParticleTable()->FindParticle(alignment.beam_type.c_str()); //get the particle definition for this beam particle->SetKineticEnergy(m_alignment.beam_energy*GeV); //I'm not sure if I need units here
// G4PrimaryParticle* particle = new G4PrimaryParticle(particleDefinition); //create a particle with the given definition vertex->SetPrimary(particle);
// particle->SetMomentumDirection(G4ThreeVector(0,0,1)); //set the momentum to be purely in Z
// particle->SetKineticEnergy(alignment.beam_energy); //get the beam energy from the alignment file event->AddPrimaryVertex(vertex);
// vertex->SetPrimary(particle); //add the particle to the vertex created above
//
// event->AddPrimaryVertex(vertex); //add the vertex to this event for geant to simulate
} }
......
# Each processed scan data of 2021 test beam has two column,
# First column is the profile of X, the second is Y
# The relation between Scans and Runs are as follows:
scan1: run12-15
scan2: run54-98
scan3: run117-136
scan4: run139-157
scan5: run161-178
scan6: run180-197
scan7: run203-220
scan8: run268-326
scan9: run337-364
scan10: run490-600
scan11: run601-638
scan12: run639-682
scan13: run689-761
(Scan up to 757, 758-761 additional statistics in the center (5,5))
\ No newline at end of file
0 0
0 0
0 0
0 0
1 1
1 1
1 1
1 1
2 1
3 1
4 2
6 2
7 3
8 3
10 4
11 4
11 6
12 8
12 10
12 11
16 16
15 20
19 27
21 28
26 40
29 48
39 65
43 61
54 87
63 88
83 102
98 85
116 110
147 103
202 119
248 106
296 147
393 176
498 247
581 291
623 472
768 618
882 828
961 886
972 1193
1098 1283
1173 1414
1138 1281
1028 1436
1031 1301
931 1196
790 948
659 872
604 649
512 498
401 356
322 302
284 215
235 171
170 131
140 120
117 98
94 84
71 70
61 63
56 50
48 42
40 37
35 33
31 29
25 25
24 20
26 17
17 13
20 10
18 8
8 7
7 5
5 4
5 3
4 3
4 2
3 2
4 1
3 2
2 1
2 1
2 1
1 1
2 1
2 1
2 1
1 1
1 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 1
1 1
1 1
2 2
2 2
2 3
3 3
5 4
7 4
9 5
12 5
15 7
16 8
18 10
20 11
21 15
23 18
26 23
27 24
33 36
32 43
40 59
44 59
54 86
61 103
82 139
91 131
107 187
130 190
172 218
208 186
244 238
314 226
428 262
525 236
626 329
827 394
1046 557
1213 658
1305 1058
1599 1365
1835 1797
1993 1894
2006 2512
2262 2662
2392 2905
2317 2614
2110 2911
2114 2631
1922 2413
1638 1904
1367 1755
1250 1306
1062 1013
847 729
681 626
599 453
498 366
364 283
303 263
252 214
206 184
156 154
135 140
122 113
106 95
84 85
74 78
67 67
56 59
47 47
43 42
38 32
29 26
25 20
18 17
16 13
15 11
12 9
11 8
10 7
10 6
10 5
8 5
6 4
6 4
6 4
6 4
7 3
5 3
4 2
3 2
2 2
1 1
1 1
1 1
0 1
0 1
0 0
0 0
0 1
0 0
0 1
1 1
1 1
2 2
2 2
3 3
4 4
5 4
7 5
9 5
12 6
12 7
16 8
19 8
24 11
20 13
21 16
20 16
25 24
23 28
29 37
30 38
38 54
43 64
58 87
62 82
74 117
87 118
115 137
138 115
159 149
202 141
274 164
334 147
398 203
525 240
662 336
770 396
822 633
1005 817
1153 1081
1248 1142
1248 1526
1408 1628
1492 1787
1439 1619
1301 1815
1301 1651
1183 1519
1002 1210
837 1118
768 834
649 650
519 470
417 402
371 292
309 237
227 183
189 171
158 140
128 119
97 100
85 91
78 73
67 62
55 55
48 51
45 44
38 40
34 33
34 29
30 22
23 19
20 15
14 14
14 11
13 10
12 8
10 8
10 7
11 6
10 5
8 6
6 5
6 5
7 4
7 4
9 3
7 3
5 3
3 2
2 2
1 1
1 1
0 1
0 1
0 1
0 0
0 0
1 2
1 1
1 1
1 1
2 2
3 2
3 3
4 3
6 5
8 5
10 6
14 6
17 8
18 9
22 11
24 11
30 16
28 18
31 24
30 24
37 35
35 43
45 58
48 58
59 83
65 100
88 136
95 128
113 182
134 185
178 215
216 181
252 234
320 221
438 257
537 230
640 320
847 382
1064 539
1235 634
1315 1015
1611 1313
1844 1732
1990 1826
1990 2436
2240 2597
2364 2843
2272 2569
2049 2880
2048 2617
1859 2404
1569 1907
1307 1761
1195 1308
1012 1015
809 733
649 628
576 453
480 368
354 285
294 263
246 215
201 185
154 155
133 141
121 113
105 96
86 84
76 78
71 67
59 59
51 48
48 43
44 33
34 27
29 21
21 19
21 15
19 13
17 10
14 10
14 8
14 7
14 6
12 6
9 6
9 5
9 5
10 4
11 4
10 4
7 3
4 3
3 2
2 2
1 1
1 1
0 1
0 1
0 1
0 1
0 1
0 0
0 1
1 1
1 1
2 2
2 2
3 2
4 3
4 3
4 4
5 4
6 5
6 5
11 6
12 5
16 6
14 7
14 8
13 8
16 10
15 11
17 14
17 15
21 18
24 20
34 25
33 24
37 31
38 33
46 39
49 36
49 48
51 50
59 63
63 63
69 100
80 190
90 551
101 1044
109 2077
137 2568
202 2940
313 2573
455 2999
764 2924
1214 3051
1695 2699
2226 3132
3246 3016
4205 2976
4702 2504
4729 2301
4877 1465
4342 803
3220 349
2174 180
1434 103
780 87
355 73
198 75
130 67
100 62
78 55
69 53
67 44
60 38
52 35
46 33
45 30
40 28
38 25
39 24
36 21
28 19
26 16
19 15
20 13
19 11
16 10
14 9
14 8
15 7
14 6
11 6
9 5
10 5
9 4
9 4
11 4
9 3
7 3
4 3
3 2
2 2
1 1
1 1
0 1
0 1
0 0
0 0
0 1
0 0
0 0
1 1
1 1
1 1
1 1
2 1
4 2
5 2
6 3
8 3
10 4
11 5
15 6
16 6
15 9
15 11
17 14
17 15
23 23
21 28
31 38
30 38
36 56
41 66
54 91
59 85
74 122
87 124
117 144
135 120
162 154
205 146
282 169
347 150
415 209
550 249
697 350
811 412
869 665
1071 865
1230 1150
1339 1224
1350 1647
1528 1772
1620 1953
1569 1771
1423 1993
1433 1815
1299 1674
1104 1330
926 1229
851 917
719 706
569 506
457 430
404 308
334 246
242 188
200 173
167 140
135 120
106 100
93 90
79 72
68 60
55 54
48 49
43 42
35 36
35 29
42 25
25 19
22 15
21 12
13 10
11 7
8 6
7 5
6 4
6 3
6 3
5 2
4 2
3 2
3 2
2 1
3 2
4 1
3 1
2 1
1 1
1 1
1 1
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 1
1 1
1 1
1 2
2 2
2 3
3 3
5 3
7 4
8 5
11 5
13 7
15 8
18 10
20 10
19 15
21 18
25 23
25 24
32 35
30 43
40 58
42 60
53 85
60 100
79 136
89 128
107 181
127 185
168 213
202 180
241 232
309 219
423 258
523 236
627 335
831 409
1050 591
1222 707
1314 1150
1611 1493
1853 1962
2012 2052
2027 2696
2288 2820
2418 3022
2346 2670
2134 2933
2141 2601
1951 2347
1671 1830
1398 1664
1276 1224
1083 938
862 672
690 570
608 411
505 334
368 259
308 244
253 201
207 173
160 145
139 132
120 106
105 89
84 79
73 73
66 62
61 56
50 44
46 39
37 30
29 24
25 19
18 16
15 12
12 11
11 8
9 7
9 6
8 5
8 4
6 4
5 4
6 4
5 3
4 3
4 3
3 2
2 2
2 2
1 2
1 1
1 1
1 1
0 1
0 1
0 0
0 0
0 1
0 0
0 0
0 1
0 1
1 1
1 2
1 2
2 2
3 3
2 3
3 3
4 5
5 5
10 5
10 5
10 6
11 7
14 8
14 9
19 12
20 14
28 19
30 21
39 28
46 33
63 44
72 45
91 62
109 67
146 83
175 83
215 112
282 120
401 158
500 161
607 247
793 331
985 529
1113 704
1178 1277
1450 1817
1672 2543
1833 2735
1841 3616
2074 3687
2165 3745
2104 3068
1932 3062
1950 2385
1801 1835
1576 1205
1326 931
1218 592
1045 420
830 293
675 254
605 192
521 164
380 130
328 118
275 91
222 75
167 60
145 54
119 44
99 40
76 36
61 36
54 30
57 28
43 23
38 21
30 16
21 14
20 11
14 10
12 8
9 7
8 5
7 5
7 4
7 3
6 3
4 3
4 3
8 3
5 2
4 2
4 2
2 2
2 1
1 1
1 1
1 1
0 0
0 0
0 0
0 0
0 0
0 0
1 2
1 1
1 1
1 1
1 2
1 2
2 3
2 3
4 4
5 4
5 5
6 5
9 7
9 7
14 8
15 8
17 10
20 11
27 12
30 13
39 18
44 21
59 27
67 28
82 38
97 42
124 55
143 56
173 75
208 80
265 101
315 101
367 138
457 153
588 210
690 225
775 362
930 502
1062 783
1133 985
1162 1618
1320 2095
1434 2690
1520 2820
1514 3540
1653 3542
1696 3573
1687 2986
1593 3008
1639 2422
1580 1983
1471 1407
1316 1158
1272 793
1160 584
1008 410
877 348
831 257
757 216
596 167
528 152
454 118
382 98
292 76
256 67
214 54
182 49
137 42
113 40
93 35
78 33
63 28
56 26
46 21
35 19
29 15
22 13
19 11
17 9
14 8
15 7
13 6
11 5
10 5
7 5
6 4
7 4
7 3
6 3
5 3
4 2
3 2
2 2
3 1
2 1
1 1
1 1
1 1
0 1
0 1
1 0
4 4
2 2
3 3
3 3
4 4
5 5
6 6
8 6
12 8
16 9
21 10
25 10
30 13
36 13
45 15
51 15
57 19
67 20
80 24
94 25
109 34
122 38
145 48
168 51
192 70
221 81
259 113
291 119
324 181
374 215
432 292
486 306
526 454
600 519
683 687
744 700
785 1008
868 1186
920 1493
948 1542
954 2002
1006 2108
1037 2244
1065 2087
1054 2332
1110 2185
1133 2151
1145 1848
1108 1938
1143 1701
1117 1557
1094 1283
1032 1220
1037 976
1014 832
948 641
862 588
862 462
840 400
738 313
688 291
634 229
567 186
471 144
418 126
378 95
333 79
274 66
237 61
204 53
171 48
137 41
118 39
96 32
79 28
64 24
51 22
42 19
38 17
32 14
27 14
24 11
23 11
20 9
17 10
14 8
13 8
12 7
12 7
12 6
10 5
8 4
6 5
6 4
5 3
4 3
3 3
3 2
2 2
2 2
2 2
0 1
0 0
0 1
1 1
1 1
1 2
2 2
2 2
3 3
4 4
4 4
4 4
5 5
6 5
11 6
10 5
9 6
10 7
11 8
11 8
14 11
13 12
16 16
16 15
20 20
22 22
31 26
30 25
35 33
36 36
41 43
44 40
46 53
49 56
57 73
60 78
66 158
77 375
86 1018
95 1594
108 2615
129 2890
180 3134
278 2669
406 3108
693 3036
1102 3157
1555 2781
2082 3182
3086 3001
4087 2874
4682 2245
4800 1809
5074 970
4689 451
3601 189
2487 123
1709 90
976 82
448 70
242 73
150 68
109 62
86 56
78 53
70 43
62 37
53 35
46 33
45 31
41 28
37 25
39 24
33 21
27 18
25 16
19 15
17 13
16 11
14 10
13 9
12 8
13 7
12 6
10 6
7 5
8 5
7 4
7 4
8 4
6 3
5 3
4 3
3 2
3 2
1 1
1 2
0 1
0 1
0 0
0 0
1 1
1 1
1 1
1 1
2 2
2 2
2 3
3 3
5 4
7 4
8 5
12 5
14 7
15 8
18 10
19 10
19 15
20 18
25 24
26 24
33 37
31 45
39 61
43 62
54 89
61 105
83 142
92 134
110 189
133 191
174 221
209 187
251 239
323 227
442 269
543 246
648 350
858 432
1081 621
1256 739
1352 1183
1651 1513
1884 1958
2032 2027
2044 2637
2290 2744
2407 2944
2319 2606
2102 2857
2096 2544
1896 2305
1612 1806
1342 1646
1223 1215
1040 940
826 678
661 579
583 421
485 345
355 269
296 253
246 209
201 180
155 152
135 138
119 111
103 94
83 83
73 77
66 66
55 58
46 47
42 41
36 31
27 25
24 19
17 17
15 13
12 11
11 9
9 8
9 6
8 5
8 5
6 5
5 4
4 4
4 3
4 3
5 3
4 2
3 2
2 2
1 1
1 1
1 1
1 1
0 1
0 1
0 0
0 0
0 1
0 0
0 0
1 1
1 1
1 1
1 1
2 2
2 2
2 2
2 3
3 3
4 4
5 4
8 4
7 4
6 5
7 5
10 6
10 6
11 8
10 9
12 12
13 12
16 15
18 16
26 21
27 20
30 27
31 27
36 33
37 31
38 41
41 42
48 53
52 52
57 79
67 135
74 383
84 768
98 1648
122 2157
179 2537
278 2262
409 2634
687 2557
1080 2683
1503 2375
1972 2756
2861 2666
3694 2658
4134 2276
4155 2166
4260 1468
3781 864
2811 394
1902 197
1250 100
678 79
309 64
172 66
112 58
86 54
71 48
65 46
56 38
51 33
44 30
38 29
38 26
34 25
30 21
31 21
26 18
21 16
20 13
16 13
14 11
13 9
10 8
10 7
10 6
10 5
10 4
8 5
6 4
5 4
4 3
5 3
6 3
5 2
4 2
2 2
2 2
1 1
1 1
1 1
0 1
0 1
0 0
0 0
Source diff could not be displayed: it is too large. Options to address this: view the blob.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment