Newer
Older

David Emschermann
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* Copyright (C) 2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Florian Uhlig, Shreya Roy [committer] */
///
/// \file Create_TOF_Geometry_v24a_mcbm.C
/// \brief Generates TOF geometry in Root format.
///
// Changelog
// 2024-03-26 - v24a - DE - March 2024 setup by NH, script patched by DE in lines 1000 and 1004 to show only 2 STAR modules
// 2021-11-17 - v24a - QZ - Modified v20d to fit the logic of digibdf.par
// 2020-04-14 - v20b - NH - swapped double stack layer 2 with STAR2 moodule, buc kept as dummy
// 2020-04-01 - v20a - NH - move mTOF +20 cm in x direction for the Mar 2020 run
// 2019-11-28 - v19b - DE - move mTOF +12 cm in x direction for the Nov 2019 run
// 2019-07-31 - v19a - DE - this TOF March 2019 geometry is also known as v18m
// 2017-11-03 - v18i - DE - shift mTOF to z=298 cm for acceptance matching with mSTS
// 2017-10-06 - v18h - DE - put v18f into vertical position to fit into the mCBM cave
// 2017-07-15 - v18g - DE - swap the z-position of TOF modules: 2 in the front, 3 in the back
// 2017-07-14 - v18f - DE - reduce vertical gap between TOF modules to fix the gap between modules 1-2 and 4-5
// 2017-05-17 - v18e - DE - rotate electronics away from beam, shift 16 cm away from beam along x-axis
// 2017-05-17 - v18d - DE - change geometry name to v18d
// in root all sizes are given in cm
#include "TFile.h"
#include "TGeoCompositeShape.h"
#include "TGeoManager.h"
#include "TGeoMaterial.h"
#include "TGeoMatrix.h"
#include "TGeoMedium.h"
#include "TGeoPgon.h"
#include "TGeoVolume.h"
#include "TList.h"
#include "TMath.h"
#include "TROOT.h"
#include "TString.h"
#include "TSystem.h"
#include <iostream>
// Name of geometry version and output file
const TString geoVersion = "tof_v24a_mcbm"; // do not change
const TString geoVersionStand = geoVersion + "Stand";
//
const TString fileTag = "tof_v24a";
const TString FileNameSim = fileTag + "_mcbm.geo.root";
const TString FileNameGeo = fileTag + "_mcbm_geo.root";
const TString FileNameInfo = fileTag + "_mcbm.geo.info";
// TOF_Z_Front corresponds to front cover of outer super module towers
const Float_t TOF_Z_Front_Stand = 250.; // = z=298 mCBM@SIS18
const Float_t TOF_Z_Front = 0; // = z=298 mCBM@SIS18
//const Float_t TOF_Z_Front = 130; // = z=225 mCBM@SIS18
//const Float_t TOF_Z_Front = 250; // SIS 100 hadron
//const Float_t TOF_Z_Front = 450; // SIS 100 hadron
//const Float_t TOF_Z_Front = 600; // SIS 100 electron
//const Float_t TOF_Z_Front = 650; // SIS 100 muon
//const Float_t TOF_Z_Front = 880; // SIS 300 electron
//const Float_t TOF_Z_Front = 1020; // SIS 300 muon
//
//const Float_t TOF_Z_Front = 951.5; // Wall_Z_Position = 1050 cm
// Names of the different used materials which are used to build the modules
// The materials are defined in the global media.geo file
const TString KeepingVolumeMedium = "air";
const TString BoxVolumeMedium = "aluminium";
const TString NoActivGasMedium = "RPCgas_noact";
const TString ActivGasMedium = "RPCgas";
const TString GlasMedium = "RPCglass";
const TString ElectronicsMedium = "carbon";
// Counters:
// 0 MRPC3a
// 1 MRPC3b
// 2
// 3
// 4 Diamond
//
// 6 Buc 2019
// 7 CERN 20gap
// 8 Ceramic Pad
const Int_t NumberOfDifferentCounterTypes = 9;
const Float_t Glass_X[NumberOfDifferentCounterTypes] = {32., 32., 32., 32., 0.2, 32., 28.8, 20., 2.4};
const Float_t Glass_Y[NumberOfDifferentCounterTypes] = {26.9, 53., 20., 10., 0.2, 10., 6., 20., 2.4};
const Float_t Glass_Z[NumberOfDifferentCounterTypes] = {0.1, 0.1, 0.1, 0.1, 0.01, 0.1, 0.1, 0.1, 0.1};
const Float_t GasGap_X[NumberOfDifferentCounterTypes] = {32., 32., 32., 32., 0.2, 32., 28.8, 20., 2.4};
const Float_t GasGap_Y[NumberOfDifferentCounterTypes] = {26.9, 53., 20., 10., 0.2, 10., 6., 20., 2.4};
const Float_t GasGap_Z[NumberOfDifferentCounterTypes] = {0.025, 0.025, 0.025, 0.025, 0.01, 0.02, 0.02, 0.02, 0.025};
const Int_t NumberOfGaps[NumberOfDifferentCounterTypes] = {8, 8, 8, 8, 1, 8, 10, 20, 4};
//const Int_t NumberOfGaps[NumberOfDifferentCounterTypes] = {1,1,1,1}; //deb
const Int_t NumberOfReadoutStrips[NumberOfDifferentCounterTypes] = {32, 32, 32, 32, 16, 32, 32, 20, 1};
//const Int_t NumberOfReadoutStrips[NumberOfDifferentCounterTypes] = {1,1,1,1}; //deb
const Float_t SingleStackStartPosition_Z[NumberOfDifferentCounterTypes] = {-0.6, -0.6, -0.6, -0.6, -0.1,
-0.6, -0.6, -0.6, -1.};
const Float_t Electronics_X[NumberOfDifferentCounterTypes] = {34.0, 34.0, 32.0, 32., 0.3, 0.1, 28.8, 20., 0.1};
const Float_t Electronics_Y[NumberOfDifferentCounterTypes] = {5.0, 5.0, 1.0, 1., 0.1, 0.1, 1.0, 1.0, 0.1};
const Float_t Electronics_Z[NumberOfDifferentCounterTypes] = {0.3, 0.3, 0.3, 0.3, 0.1, 0.1, 0.1, 0.1, 0.1};
const Int_t NofModuleTypes = 10;
// 5 Diamond
// 6 Buc
// 7 CERN 20 gap
// 8 Ceramic
// 9 Star2
// Aluminum box for all module types
const Float_t Module_Size_X[NofModuleTypes] = {180., 180., 180., 180., 180., 5., 40., 30., 22.5, 100.};
const Float_t Module_Size_Y[NofModuleTypes] = {49., 49., 74., 28., 18., 5., 12., 30., 11., 49.};
const Float_t Module_Over_Y[NofModuleTypes] = {11.5, 11.5, 11., 4.5, 4.5, 0., 0., 0., 0., 0.};
const Float_t Module_Size_Z[NofModuleTypes] = {11., 11., 11., 11., 11., 1., 12., 6., 6.2, 11.2};
const Float_t Module_Thick_Alu_X_left = 0.1;
const Float_t Module_Thick_Alu_X_right = 1.0;
const Float_t Module_Thick_Alu_Y = 0.1;
const Float_t Module_Thick_Alu_Z = 0.1;
// Distance to the center of the TOF wall [cm];
const Float_t Wall_Z_Position = 400.;
const Float_t MeanTheta = 0.;
//Type of Counter for module
const Int_t CounterTypeInModule[NofModuleTypes] = {0, 0, 1, 2, 3, 4, 6, 7, 8, 0};
const Int_t NCounterInModule[NofModuleTypes] = {5, 5, 5, 5, 5, 1, 2, 1, 8, 2};
// Placement of the counter inside the module
const Float_t CounterXStartPosition[NofModuleTypes] = {-63.0, -66.0, -60.0, -60.0, -60.0, 0.0, 0., 0., -7., 0.};
const Float_t CounterXDistance[NofModuleTypes] = {31.5, 32.0, 30.0, 30.0, 30.0, 0.0, 0., 0., 2., 0.};
const Float_t CounterYStartPosition[NofModuleTypes] = {0.0, 0.0, 0.0, 0.0, 0.0, 0., 0., -4., -1.3, 0.};
const Float_t CounterYDistance[NofModuleTypes] = {0.0, 0.0, 0.0, 0.0, 0.0, 0., 0., 8., 0., 0.};
const Float_t CounterZDistance[NofModuleTypes] = {-2.5, 0.0, 0.0, 2.5, 2.5, 0., 6., 0., 0.1, 4.};
const Float_t CounterZStartPosition[NofModuleTypes] = {0.0, 0.0, 0.0, 0.0, 0.0, 0., -3., 0., 0.0, -2.};
const Float_t CounterRotationAngle[NofModuleTypes] = {0., 8.7, 10.0, 0., 0., 0., 0., 0., 0., 0.};
// Pole (support structure)
const Int_t MaxNumberOfPoles = 20;
Float_t Pole_ZPos[MaxNumberOfPoles];
Float_t Pole_Col[MaxNumberOfPoles];
Int_t NumberOfPoles = 0;
const Float_t Pole_Size_X = 20.;
const Float_t Pole_Size_Y = 300.;
const Float_t Pole_Size_Z = 10.;
const Float_t Pole_Thick_X = 5.;
const Float_t Pole_Thick_Y = 5.;
const Float_t Pole_Thick_Z = 5.;
// Bars (support structure)
const Float_t Bar_Size_X = 20.;
const Float_t Bar_Size_Y = 20.;
Float_t Bar_Size_Z = 100.;
const Int_t MaxNumberOfBars = 20;
Float_t Bar_ZPos[MaxNumberOfBars];
Float_t Bar_XPos[MaxNumberOfBars];
Int_t NumberOfBars = 0;
const Float_t ChamberOverlap = 40;
const Float_t DxColl = 158.0; //Module_Size_X-ChamberOverlap;
//const Float_t Pole_Offset=Module_Size_X/2.+Pole_Size_X/2.;
const Float_t Pole_Offset = 90.0 + Pole_Size_X / 2.;
// Position for module placement
const Float_t Inner_Module_First_Y_Position = 16.;
const Float_t Inner_Module_Last_Y_Position = 480.;
const Float_t Inner_Module_X_Offset = 0.; // centered position in x/y
//const Float_t Inner_Module_X_Offset=18; // shift by 16 cm in x
const Int_t Inner_Module_NTypes = 3;
const Float_t Inner_Module_Types[Inner_Module_NTypes] = {4., 3., 0.};
//const Float_t Inner_Module_Number[Inner_Module_NTypes] = {2.,2.,6.}; //V13_3a
const Float_t Inner_Module_Number[Inner_Module_NTypes] = {2., 2., 1.}; //V13_3a
//const Float_t Inner_Module_Number[Inner_Module_NTypes] = {0.,0.,0.}; //debugging
const Float_t InnerSide_Module_X_Offset = 51.;
const Float_t InnerSide_Module_NTypes = 1;
const Float_t InnerSide_Module_Types[Inner_Module_NTypes] = {5.};
const Float_t InnerSide_Module_Number[Inner_Module_NTypes] = {2.}; //v13_3a
//const Float_t InnerSide_Module_Number[Inner_Module_NTypes] = {0.}; //debug
const Float_t Outer_Module_First_Y_Position = 0.;
const Float_t Outer_Module_Last_Y_Position = 480.;
const Float_t Outer_Module_X_Offset = 3.;
const Int_t Outer_Module_Col = 4;
const Int_t Outer_Module_NTypes = 2;
const Float_t Outer_Module_Types[Outer_Module_NTypes][Outer_Module_Col] = {1., 1., 1., 1., 2., 2., 2., 2.};
const Float_t Outer_Module_Number[Outer_Module_NTypes][Outer_Module_Col] = {9., 9., 2., 0., 0., 0., 3., 4.}; //V13_3a
//const Float_t Outer_Module_Number[Outer_Module_NTypes][Outer_Module_Col] = {1.,1.,0.,0., 0.,0.,0.,0.};//debug
const Float_t Star2_First_Z_Position = TOF_Z_Front + 36.;
const Float_t Star2_Delta_Z_Position = 16.;
const Float_t Star2_First_Y_Position = 0.; //
const Float_t Star2_Delta_Y_Position = 0.; //
const Float_t Star2_rotate_Z = 90.;
const Int_t Star2_NTypes = 1;
const Float_t Star2_Types[Star2_NTypes] = {9.};
const Float_t Star2_Number[Star2_NTypes] = {1.}; //debugging, V16b
const Float_t Star2_X_Offset[Star2_NTypes] = {0.}; //{62.};
const Float_t Buc_First_Z_Position = TOF_Z_Front + 36.;
const Float_t Buc_Delta_Z_Position = 0.;
const Float_t Buc_First_Y_Position = 40; //
const Float_t Buc_Delta_Y_Position = 0.; //
const Float_t Buc_rotate_Z = 180.;
const Int_t Buc_NTypes = 1;
const Float_t Buc_Types[Buc_NTypes] = {6.};
const Float_t Buc_Number[Buc_NTypes] = {1.}; //debugging, V16b
const Float_t Buc_X_Offset[Buc_NTypes] = {53.5};
const Int_t Cer_NTypes = 3;
const Float_t Cer_Z_Position[Cer_NTypes] = {(float) (TOF_Z_Front + 13.2), (float) (TOF_Z_Front + 45.),
(float) (TOF_Z_Front + 45.)};
const Float_t Cer_X_Position[Cer_NTypes] = {0., 49.8, 49.8};
const Float_t Cer_Y_Position[Cer_NTypes] = {-1., 5., 5.};
const Float_t Cer_rotate_Z[Cer_NTypes] = {0., 0., 0.};
const Float_t Cer_Types[Cer_NTypes] = {5., 8., 8.};
const Float_t Cer_Number[Cer_NTypes] = {1., 1., 1.}; //V16b
const Float_t CERN_Z_Position = TOF_Z_Front + 50; // 20 gap
const Float_t CERN_First_Y_Position = 36.;
const Float_t CERN_X_Offset = 46.; //65.5;
const Float_t CERN_rotate_Z = 90.;
const Int_t CERN_NTypes = 1;
const Float_t CERN_Types[CERN_NTypes] = {7.}; // this is the SmType!
const Float_t CERN_Number[CERN_NTypes] = {1.}; // evtl. double for split signals
// some global variables
TGeoManager* gGeoMan = NULL; // Pointer to TGeoManager instance
TGeoVolume* gModules[NofModuleTypes]; // Global storage for module types
TGeoVolume* gCounter[NumberOfDifferentCounterTypes];
TGeoVolume* gPole;
TGeoVolume* gBar[MaxNumberOfBars];
const Float_t Dia_Z_Position = -0.5 - TOF_Z_Front_Stand;
const Float_t Dia_First_Y_Position = 0.;
const Float_t Dia_X_Offset = 3.;
const Float_t Dia_rotate_Z = 0.;
const Int_t Dia_NTypes = 1;
const Float_t Dia_Types[Dia_NTypes] = {5.};
const Float_t Dia_Number[Dia_NTypes] = {1.};
Float_t Last_Size_Y = 0.;
Float_t Last_Over_Y = 0.;
// Forward declarations
void create_materials_from_media_file();
TGeoVolume* create_counter(Int_t);
TGeoVolume* create_new_counter(Int_t);
TGeoVolume* create_tof_module(Int_t);
TGeoVolume* create_new_tof_module(Int_t);
TGeoVolume* create_tof_pole();
TGeoVolume* create_tof_bar();
void position_tof_poles(Int_t);
void position_tof_bars(Int_t);
void position_inner_tof_modules(Int_t);
void position_side_tof_modules(Int_t);
void position_outer_tof_modules(Int_t);
void position_Dia(Int_t);
void position_Star2(Int_t);
void position_Buc(Int_t);
void position_cer_modules(Int_t);
void position_CERN(Int_t);
void dump_info_file();
void Create_TOF_Geometry_v24a_mcbm()
{
// Load needed material definition from media.geo file
create_materials_from_media_file();
// Get the GeoManager for later usage
gGeoMan = (TGeoManager*) gROOT->FindObject("FAIRGeom");
gGeoMan->SetVisLevel(5); // 2 = super modules
gGeoMan->SetVisOption(0);
// Create the top volume
/*
TGeoBBox* topbox= new TGeoBBox("", 1000., 1000., 1000.);
TGeoVolume* top = new TGeoVolume("top", topbox, gGeoMan->GetMedium("air"));
gGeoMan->SetTopVolume(top);
*/
TGeoVolume* top = new TGeoVolumeAssembly("TOP");
gGeoMan->SetTopVolume(top);
TGeoRotation* tof_rotation = new TGeoRotation();
tof_rotation->RotateY(0.); // angle with respect to beam axis
//tof_rotation->RotateZ( 0 ); // electronics on 9 o'clock position = +x
// tof_rotation->RotateZ( 0 ); // electronics on 9 o'clock position = +x
// tof_rotation->RotateZ( 90 ); // electronics on 12 o'clock position (top)
// tof_rotation->RotateZ( 180 ); // electronics on 3 o'clock position = -x
// tof_rotation->RotateZ( 270 ); // electronics on 6 o'clock position (bottom)
TGeoVolume* tof = new TGeoVolumeAssembly(geoVersion);
// top->AddNode(tof, 1, tof_rotation);
top->AddNode(tof, 1);
TGeoVolume* tofstand = new TGeoVolumeAssembly(geoVersionStand);
// Mar 2020 run
TGeoTranslation* stand_trans = new TGeoTranslation("", 0., 0., TOF_Z_Front_Stand);
// Nov 2019 run
// TGeoTranslation* stand_trans = new TGeoTranslation("", 12., 0., TOF_Z_Front_Stand);
// TGeoTranslation* stand_trans = new TGeoTranslation("", 0., 0., TOF_Z_Front_Stand);
TGeoRotation* stand_rot = new TGeoRotation();
stand_rot->RotateY(0.0);
TGeoCombiTrans* stand_combi_trans = new TGeoCombiTrans(*stand_trans, *stand_rot);
// tof->AddNode(tofstand, 1, stand_combi_trans);
tof->AddNode(tofstand, 1);
for (Int_t counterType = 0; counterType < NumberOfDifferentCounterTypes; counterType++) {
gCounter[counterType] = create_new_counter(counterType);
}
for (Int_t moduleType = 0; moduleType < NofModuleTypes; moduleType++) {
gModules[moduleType] = create_new_tof_module(moduleType);
gModules[moduleType]->SetVisContainers(1);
}
// no pole
// gPole = create_tof_pole();
// position_side_tof_modules(1); // keep order !!
// position_inner_tof_modules(2);
position_inner_tof_modules(3);
position_Dia(1);
position_Star2(2);
// position_cer_modules(3);
// position_CERN(1);
position_Buc(1);
cout << "Outer Types " << Outer_Module_Types[0][0] << ", " << Outer_Module_Types[1][0]
<< ", col=1: " << Outer_Module_Types[0][1] << ", " << Outer_Module_Types[1][1] << endl;
cout << "Outer Number " << Outer_Module_Number[0][0] << ", " << Outer_Module_Number[1][0]
<< ", col=1: " << Outer_Module_Number[0][1] << ", " << Outer_Module_Number[1][1] << endl;
// position_outer_tof_modules(4);
// position_tof_poles(0);
// position_tof_bars(0);
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.001);
gGeoMan->PrintOverlaps();
gGeoMan->CheckOverlaps(0.001, "s");
gGeoMan->PrintOverlaps();
gGeoMan->Test();
tof->Export(FileNameSim);
TFile* geoFile = new TFile(FileNameSim, "UPDATE");
stand_combi_trans->Write();
geoFile->Close();
/*
TFile* outfile1 = new TFile(FileNameSim,"RECREATE");
top->Write();
//gGeoMan->Write();
outfile1->Close();
*/
TFile* outfile2 = new TFile(FileNameGeo, "RECREATE");
gGeoMan->Write();
outfile2->Close();
dump_info_file();
top->SetVisContainers(1);
gGeoMan->SetVisLevel(5);
top->Draw("ogl");
//top->Draw();
//gModules[0]->Draw("ogl");
// gModules[0]->Draw("");
gModules[0]->SetVisContainers(1);
// gModules[1]->Draw("");
gModules[1]->SetVisContainers(1);
//gModules[5]->Draw("");
// top->Raytrace();
}
void create_materials_from_media_file()
{
// Use the FairRoot geometry interface to load the media which are already defined
FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader");
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
TString geoPath = gSystem->Getenv("VMCWORKDIR");
TString geoFile = geoPath + "/geometry/media.geo";
geoFace->setMediaFile(geoFile);
geoFace->readMedia();
// Read the required media and create them in the GeoManager
FairGeoMedia* geoMedia = geoFace->getMedia();
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
FairGeoMedium* air = geoMedia->getMedium("air");
FairGeoMedium* aluminium = geoMedia->getMedium("aluminium");
FairGeoMedium* RPCgas = geoMedia->getMedium("RPCgas");
FairGeoMedium* RPCgas_noact = geoMedia->getMedium("RPCgas_noact");
FairGeoMedium* RPCglass = geoMedia->getMedium("RPCglass");
FairGeoMedium* carbon = geoMedia->getMedium("carbon");
// include check if all media are found
geoBuild->createMedium(air);
geoBuild->createMedium(aluminium);
geoBuild->createMedium(RPCgas);
geoBuild->createMedium(RPCgas_noact);
geoBuild->createMedium(RPCglass);
geoBuild->createMedium(carbon);
}
TGeoVolume* create_counter(Int_t modType)
{
//glass
Float_t gdx = Glass_X[modType];
Float_t gdy = Glass_Y[modType];
Float_t gdz = Glass_Z[modType];
//gas gap
Int_t nstrips = NumberOfReadoutStrips[modType];
Int_t ngaps = NumberOfGaps[modType];
Float_t ggdx = GasGap_X[modType];
Float_t ggdy = GasGap_Y[modType];
Float_t ggdz = GasGap_Z[modType];
Float_t gsdx = ggdx / float(nstrips);
//single stack
Float_t dzpos = gdz + ggdz;
Float_t startzpos = SingleStackStartPosition_Z[modType];
// electronics
//pcb dimensions
Float_t dxe = Electronics_X[modType];
Float_t dye = Electronics_Y[modType];
Float_t dze = Electronics_Z[modType];
Float_t yele = (gdy + 0.1) / 2. + dye / 2.;
// needed materials
TGeoMedium* glassPlateVolMed = gGeoMan->GetMedium(GlasMedium);
TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium);
TGeoMedium* activeGasVolMed = gGeoMan->GetMedium(ActivGasMedium);
TGeoMedium* electronicsVolMed = gGeoMan->GetMedium(ElectronicsMedium);
// Single glass plate
TGeoBBox* glass_plate = new TGeoBBox("", gdx / 2., gdy / 2., gdz / 2.);
TGeoVolume* glass_plate_vol = new TGeoVolume("tof_glass", glass_plate, glassPlateVolMed);
glass_plate_vol->SetLineColor(kMagenta); // set line color for the glass plate
glass_plate_vol->SetTransparency(20); // set transparency for the TOF
TGeoTranslation* glass_plate_trans = new TGeoTranslation("", 0., 0., 0.);
// Single gas gap
TGeoBBox* gas_gap = new TGeoBBox("", ggdx / 2., ggdy / 2., ggdz / 2.);
//TGeoVolume* gas_gap_vol =
//new TGeoVolume("tof_gas_gap", gas_gap, noActiveGasVolMed);
TGeoVolume* gas_gap_vol = new TGeoVolume("tof_gas_active", gas_gap, activeGasVolMed);
gas_gap_vol->Divide("Strip", 1, nstrips, -ggdx / 2., 0);
gas_gap_vol->SetLineColor(kRed); // set line color for the gas gap
gas_gap_vol->SetTransparency(70); // set transparency for the TOF
TGeoTranslation* gas_gap_trans = new TGeoTranslation("", 0., 0., (gdz + ggdz) / 2.);
// Single subdivided active gas gap
/*
TGeoBBox* gas_active = new TGeoBBox("", gsdx/2., ggdy/2., ggdz/2.);
TGeoVolume* gas_active_vol =
new TGeoVolume("tof_gas_active", gas_active, activeGasVolMed);
gas_active_vol->SetLineColor(kBlack); // set line color for the gas gap
gas_active_vol->SetTransparency(70); // set transparency for the TOF
*/
// Add glass plate, inactive gas gap and active gas gaps to a single stack
TGeoVolume* single_stack = new TGeoVolumeAssembly("single_stack");
single_stack->AddNode(glass_plate_vol, 0, glass_plate_trans);
single_stack->AddNode(gas_gap_vol, 0, gas_gap_trans);
/*
for (Int_t l=0; l<nstrips; l++){
TGeoTranslation* gas_active_trans
= new TGeoTranslation("", -ggdx/2+(l+0.5)*gsdx, 0., 0.);
gas_gap_vol->AddNode(gas_active_vol, l, gas_active_trans);
// single_stack->AddNode(gas_active_vol, l, gas_active_trans);
}
*/
// Add 8 single stacks + one glass plate at the e09.750nd to a multi stack
TGeoVolume* multi_stack = new TGeoVolumeAssembly("multi_stack");
Int_t l;
for (l = 0; l < ngaps; l++) {
TGeoTranslation* single_stack_trans = new TGeoTranslation("", 0., 0., startzpos + l * dzpos);
multi_stack->AddNode(single_stack, l, single_stack_trans);
}
TGeoTranslation* single_glass_back_trans = new TGeoTranslation("", 0., 0., startzpos + ngaps * dzpos);
multi_stack->AddNode(glass_plate_vol, l, single_glass_back_trans);
// Add electronics above and below the glass stack to build a complete counter
TGeoVolume* counter = new TGeoVolumeAssembly("counter");
TGeoTranslation* multi_stack_trans = new TGeoTranslation("", 0., 0., 0.);
counter->AddNode(multi_stack, l, multi_stack_trans);
TGeoBBox* pcb = new TGeoBBox("", dxe / 2., dye / 2., dze / 2.);
TGeoVolume* pcb_vol = new TGeoVolume("pcb", pcb, electronicsVolMed);
pcb_vol->SetLineColor(kCyan); // set line color for the gas gap
pcb_vol->SetTransparency(10); // set transparency for the TOF
for (Int_t l = 0; l < 2; l++) {
yele *= -1.;
TGeoTranslation* pcb_trans = new TGeoTranslation("", 0., yele, 0.);
counter->AddNode(pcb_vol, l, pcb_trans);
}
return counter;
}
TGeoVolume* create_new_counter(Int_t modType)
{
//glass
Float_t gdx = Glass_X[modType];
Float_t gdy = Glass_Y[modType];
Float_t gdz = Glass_Z[modType];
//gas gap
Int_t nstrips = NumberOfReadoutStrips[modType];
Int_t ngaps = NumberOfGaps[modType];
Float_t ggdx = GasGap_X[modType];
Float_t ggdy = GasGap_Y[modType];
Float_t ggdz = GasGap_Z[modType];
Float_t gsdx = ggdx / (Float_t)(nstrips);
// electronics
//pcb dimensions
Float_t dxe = Electronics_X[modType];
Float_t dye = Electronics_Y[modType];
Float_t dze = Electronics_Z[modType];
Float_t yele = gdy / 2. + dye / 2.;
// counter size (calculate from glas, gap and electronics sizes)
Float_t cdx = TMath::Max(gdx, ggdx);
cdx = TMath::Max(cdx, dxe) + 0.2;
Float_t cdy = TMath::Max(gdy, ggdy) + 2 * dye + 0.2;
Float_t cdz = ngaps * ggdz + (ngaps + 1) * gdz + 0.2; // ngaps * (gdz+ggdz) + gdz + 0.2; // ok
//calculate thickness and first position in counter of single stack
Float_t dzpos = gdz + ggdz;
Float_t startzposglas = -ngaps * (gdz + ggdz) / 2.; // -cdz/2.+0.1+gdz/2.; // ok // (-cdz+gdz)/2.; // not ok
Float_t startzposgas = startzposglas + gdz / 2. + ggdz / 2.; // -cdz/2.+0.1+gdz +ggdz/2.; // ok
// needed materials
TGeoMedium* glassPlateVolMed = gGeoMan->GetMedium(GlasMedium);
TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium);
TGeoMedium* activeGasVolMed = gGeoMan->GetMedium(ActivGasMedium);
TGeoMedium* electronicsVolMed = gGeoMan->GetMedium(ElectronicsMedium);
// define counter volume
TGeoBBox* counter_box = new TGeoBBox("", cdx / 2., cdy / 2., cdz / 2.);
TGeoVolume* counter = new TGeoVolume("counter", counter_box, noActiveGasVolMed);
counter->SetLineColor(kRed); // set line color for the counter
counter->SetTransparency(70); // set transparency for the TOF
// define single glass plate volume
TGeoBBox* glass_plate = new TGeoBBox("", gdx / 2., gdy / 2., gdz / 2.);
TGeoVolume* glass_plate_vol = new TGeoVolume("tof_glass", glass_plate, glassPlateVolMed);
glass_plate_vol->SetLineColor(kMagenta); // set line color for the glass plate
glass_plate_vol->SetTransparency(20); // set transparency for the TOF
// define single gas gap volume
TGeoBBox* gas_gap = new TGeoBBox("", ggdx / 2., ggdy / 2., ggdz / 2.);
TGeoVolume* gas_gap_vol = new TGeoVolume("Gap", gas_gap, activeGasVolMed);
gas_gap_vol->Divide("Cell", 1, nstrips, -ggdx / 2., 0);
gas_gap_vol->SetLineColor(kRed); // set line color for the gas gap
gas_gap_vol->SetTransparency(99); // set transparency for the TOF
// place 8 gas gaps and 9 glas plates in the counter
for (Int_t igap = 0; igap <= ngaps; igap++) {
// place (ngaps+1) glass plates
Float_t zpos_glas = startzposglas + igap * dzpos;
TGeoTranslation* glass_plate_trans = new TGeoTranslation("", 0., 0., zpos_glas);
counter->AddNode(glass_plate_vol, igap, glass_plate_trans);
// place ngaps gas gaps
if (igap < ngaps) {
Float_t zpos_gas = startzposgas + igap * dzpos;
TGeoTranslation* gas_gap_trans = new TGeoTranslation("", 0., 0., zpos_gas);
counter->AddNode(gas_gap_vol, igap, gas_gap_trans);
}
// cout <<"Zpos(Glas): "<< zpos_glas << endl;
// cout <<"Zpos(Gas): "<< zpos_gas << endl;
}
// create and place the electronics above and below the glas stack
TGeoBBox* pcb = new TGeoBBox("", dxe / 2., dye / 2., dze / 2.);
TGeoVolume* pcb_vol = new TGeoVolume("pcb", pcb, electronicsVolMed);
pcb_vol->SetLineColor(kYellow); // kCyan); // set line color for electronics
pcb_vol->SetTransparency(10); // set transparency for the TOF
for (Int_t l = 0; l < 2; l++) {
yele *= -1.;
TGeoTranslation* pcb_trans = new TGeoTranslation("", 0., yele, 0.);
counter->AddNode(pcb_vol, l, pcb_trans);
}
return counter;
}
TGeoVolume* create_tof_module(Int_t modType)
{
Int_t cType = CounterTypeInModule[modType];
Float_t dx = Module_Size_X[modType];
Float_t dy = Module_Size_Y[modType];
Float_t dz = Module_Size_Z[modType];
Float_t width_aluxl = Module_Thick_Alu_X_left;
Float_t width_aluxr = Module_Thick_Alu_X_right;
Float_t width_aluy = Module_Thick_Alu_Y;
Float_t width_aluz = Module_Thick_Alu_Z;
Float_t shift_gas_box = (Module_Thick_Alu_X_right - Module_Thick_Alu_X_left) / 2;
Float_t dxpos = CounterXDistance[modType];
Float_t startxpos = CounterXStartPosition[modType];
Float_t dzoff = CounterZDistance[modType];
Float_t rotangle = CounterRotationAngle[modType];
TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium);
TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium);
TString moduleName = Form("module_%d", modType);
TGeoVolume* module = new TGeoVolumeAssembly(moduleName);
TGeoBBox* alu_box = new TGeoBBox("", dx / 2., dy / 2., dz / 2.);
TGeoVolume* alu_box_vol = new TGeoVolume("alu_box", alu_box, boxVolMed);
alu_box_vol->SetLineColor(kGreen); // set line color for the alu box
alu_box_vol->SetTransparency(20); // set transparency for the TOF
TGeoTranslation* alu_box_trans = new TGeoTranslation("", 0., 0., 0.);
module->AddNode(alu_box_vol, 0, alu_box_trans);
TGeoBBox* gas_box =
new TGeoBBox("", (dx - (width_aluxl + width_aluxr)) / 2., (dy - 2 * width_aluy) / 2., (dz - 2 * width_aluz) / 2.);
TGeoVolume* gas_box_vol = new TGeoVolume("gas_box", gas_box, noActiveGasVolMed);
gas_box_vol->SetLineColor(kYellow); // set line color for the gas box
gas_box_vol->SetTransparency(70); // set transparency for the TOF
TGeoTranslation* gas_box_trans = new TGeoTranslation("", shift_gas_box, 0., 0.);
alu_box_vol->AddNode(gas_box_vol, 0, gas_box_trans);
for (Int_t j = 0; j < 5; j++) { //loop over counters (modules)
Float_t zpos;
if (0 == modType) { zpos = dzoff *= -1; }
else {
zpos = 0.;
}
//cout << "counter z position " << zpos << endl;
TGeoTranslation* counter_trans = new TGeoTranslation("", startxpos + j * dxpos, 0.0, zpos);
TGeoRotation* counter_rot = new TGeoRotation();
counter_rot->RotateY(rotangle);
TGeoCombiTrans* counter_combi_trans = new TGeoCombiTrans(*counter_trans, *counter_rot);
gas_box_vol->AddNode(gCounter[cType], j, counter_combi_trans);
}
return module;
}
TGeoVolume* create_new_tof_module(Int_t modType)
{
Int_t cType = CounterTypeInModule[modType];
Float_t dx = Module_Size_X[modType];
Float_t dy = Module_Size_Y[modType];
Float_t dz = Module_Size_Z[modType];
Float_t width_aluxl = Module_Thick_Alu_X_left;
Float_t width_aluxr = Module_Thick_Alu_X_right;
Float_t width_aluy = Module_Thick_Alu_Y;
Float_t width_aluz = Module_Thick_Alu_Z;
Float_t shift_gas_box = (Module_Thick_Alu_X_right - Module_Thick_Alu_X_left) / 2;
Float_t dxpos = CounterXDistance[modType];
Float_t startxpos = CounterXStartPosition[modType];
Float_t dypos = CounterYDistance[modType];
Float_t startypos = CounterYStartPosition[modType];
Float_t dzoff = CounterZDistance[modType];
Float_t rotangle = CounterRotationAngle[modType];
TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium);
TGeoMedium* noActiveGasVolMed = gGeoMan->GetMedium(NoActivGasMedium);
TString moduleName = Form("module_%d", modType);
TGeoBBox* module_box = new TGeoBBox("", dx / 2., dy / 2., dz / 2.);
TGeoVolume* module = new TGeoVolume(moduleName, module_box, boxVolMed);
module->SetLineColor(kGreen); // set line color for the alu box
module->SetTransparency(20); // set transparency for the TOF
TGeoBBox* gas_box =
new TGeoBBox("", (dx - (width_aluxl + width_aluxr)) / 2., (dy - 2 * width_aluy) / 2., (dz - 2 * width_aluz) / 2.);
TGeoVolume* gas_box_vol = new TGeoVolume("gas_box", gas_box, noActiveGasVolMed);
gas_box_vol->SetLineColor(kBlue); // set line color for the alu box
gas_box_vol->SetTransparency(50); // set transparency for the TOF
TGeoTranslation* gas_box_trans = new TGeoTranslation("", shift_gas_box, 0., 0.);
module->AddNode(gas_box_vol, 0, gas_box_trans);
for (Int_t j = 0; j < NCounterInModule[modType]; j++) { //loop over counters (modules)
//for (Int_t j=0; j< 1; j++){ //loop over counters (modules)
Float_t xpos, ypos, zpos;
if (0 == modType || 3 == modType || 4 == modType || 5 == modType) { zpos = dzoff *= -1; }
else {
zpos = CounterZStartPosition[modType] + j * dzoff;
}
//cout << "counter z position " << zpos << endl;
xpos = startxpos + j * dxpos;
ypos = startypos + j * dypos;
TGeoTranslation* counter_trans = new TGeoTranslation("", xpos, ypos, zpos);
TGeoRotation* counter_rot = new TGeoRotation();
counter_rot->RotateY(rotangle);
TGeoCombiTrans* counter_combi_trans = new TGeoCombiTrans(*counter_trans, *counter_rot);
gas_box_vol->AddNode(gCounter[cType], j, counter_combi_trans);
}
return module;
}
TGeoVolume* create_tof_pole()
{
// needed materials
TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium);
TGeoMedium* airVolMed = gGeoMan->GetMedium(KeepingVolumeMedium);
Float_t dx = Pole_Size_X;
Float_t dy = Pole_Size_Y;
Float_t dz = Pole_Size_Z;
Float_t width_alux = Pole_Thick_X;
Float_t width_aluy = Pole_Thick_Y;
Float_t width_aluz = Pole_Thick_Z;
TGeoVolume* pole = new TGeoVolumeAssembly("Pole");
TGeoBBox* pole_alu_box = new TGeoBBox("", dx / 2., dy / 2., dz / 2.);
TGeoVolume* pole_alu_vol = new TGeoVolume("pole_alu", pole_alu_box, boxVolMed);
pole_alu_vol->SetLineColor(kGreen); // set line color for the alu box
pole_alu_vol->SetTransparency(20); // set transparency for the TOF
TGeoTranslation* pole_alu_trans = new TGeoTranslation("", 0., 0., 0.);
pole->AddNode(pole_alu_vol, 0, pole_alu_trans);
Float_t air_dx = dx / 2. - width_alux;
Float_t air_dy = dy / 2. - width_aluy;
Float_t air_dz = dz / 2. - width_aluz;
// cout << "My pole." << endl;
if (air_dx <= 0.) cout << "ERROR - No air volume in pole X, size: " << air_dx << endl;
if (air_dy <= 0.) cout << "ERROR - No air volume in pole Y, size: " << air_dy << endl;
if (air_dz <= 0.) cout << "ERROR - No air volume in pole Z, size: " << air_dz << endl;
if ((air_dx > 0.) && (air_dy > 0.) && (air_dz > 0.)) // crate air volume only, if larger than zero
{
TGeoBBox* pole_air_box = new TGeoBBox("", air_dx, air_dy, air_dz);
// TGeoBBox* pole_air_box = new TGeoBBox("", dx/2.-width_alux, dy/2.-width_aluy, dz/2.-width_aluz);
TGeoVolume* pole_air_vol = new TGeoVolume("pole_air", pole_air_box, airVolMed);
pole_air_vol->SetLineColor(kYellow); // set line color for the alu box
pole_air_vol->SetTransparency(70); // set transparency for the TOF
TGeoTranslation* pole_air_trans = new TGeoTranslation("", 0., 0., 0.);
pole_alu_vol->AddNode(pole_air_vol, 0, pole_air_trans);
}
else
cout << "Skipping pole_air_vol, no thickness: " << air_dx << " " << air_dy << " " << air_dz << endl;
return pole;
}
TGeoVolume* create_tof_bar(Float_t dx, Float_t dy, Float_t dz)
{
// needed materials
TGeoMedium* boxVolMed = gGeoMan->GetMedium(BoxVolumeMedium);
TGeoMedium* airVolMed = gGeoMan->GetMedium(KeepingVolumeMedium);
Float_t width_alux = Pole_Thick_X;
Float_t width_aluy = Pole_Thick_Y;
Float_t width_aluz = Pole_Thick_Z;
TGeoVolume* bar = new TGeoVolumeAssembly("Bar");
TGeoBBox* bar_alu_box = new TGeoBBox("", dx / 2., dy / 2., dz / 2.);
TGeoVolume* bar_alu_vol = new TGeoVolume("bar_alu", bar_alu_box, boxVolMed);
bar_alu_vol->SetLineColor(kGreen); // set line color for the alu box
bar_alu_vol->SetTransparency(20); // set transparency for the TOF
TGeoTranslation* bar_alu_trans = new TGeoTranslation("", 0., 0., 0.);
bar->AddNode(bar_alu_vol, 0, bar_alu_trans);
TGeoBBox* bar_air_box = new TGeoBBox("", dx / 2. - width_alux, dy / 2. - width_aluy, dz / 2. - width_aluz);
TGeoVolume* bar_air_vol = new TGeoVolume("bar_air", bar_air_box, airVolMed);
bar_air_vol->SetLineColor(kYellow); // set line color for the alu box
bar_air_vol->SetTransparency(70); // set transparency for the TOF
TGeoTranslation* bar_air_trans = new TGeoTranslation("", 0., 0., 0.);
bar_alu_vol->AddNode(bar_air_vol, 0, bar_air_trans);
return bar;
}
void position_tof_poles(Int_t modType)
{
TGeoTranslation* pole_trans = NULL;
Int_t numPoles = 0;
for (Int_t i = 0; i < NumberOfPoles; i++) {
if (i < 2) {
pole_trans = new TGeoTranslation("", -Pole_Offset + 2.0, 0., Pole_ZPos[i]);
gGeoMan->GetVolume(geoVersionStand)->AddNode(gPole, numPoles, pole_trans);
numPoles++;
}
else {
Float_t xPos = Pole_Offset + Pole_Size_X / 2. + Pole_Col[i] * DxColl;
Float_t zPos = Pole_ZPos[i];
pole_trans = new TGeoTranslation("", xPos, 0., zPos);
gGeoMan->GetVolume(geoVersionStand)->AddNode(gPole, numPoles, pole_trans);
numPoles++;
pole_trans = new TGeoTranslation("", -xPos, 0., zPos);
gGeoMan->GetVolume(geoVersionStand)->AddNode(gPole, numPoles, pole_trans);
numPoles++;
}
cout << " Position Pole " << numPoles << " at z=" << Pole_ZPos[i] << endl;
}
}
void position_tof_bars(Int_t modType)
{
TGeoTranslation* bar_trans = NULL;
Int_t numBars = 0;
Int_t i;
Float_t xPos;
Float_t yPos;
Float_t zPos;
for (i = 0; i < NumberOfBars; i++) {
xPos = Bar_XPos[i];
zPos = Bar_ZPos[i];
yPos = Pole_Size_Y / 2. + Bar_Size_Y / 2.;
bar_trans = new TGeoTranslation("", xPos, yPos, zPos);
gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans);
numBars++;
bar_trans = new TGeoTranslation("", xPos, -yPos, zPos);
gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans);
numBars++;
bar_trans = new TGeoTranslation("", -xPos, yPos, zPos);
gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans);
numBars++;
bar_trans = new TGeoTranslation("", -xPos, -yPos, zPos);
gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans);
numBars++;
}
cout << " Position Bar " << numBars << " at z=" << Bar_ZPos[i] << endl;
// horizontal frame bars
i = NumberOfBars;
NumberOfBars++;
// no bar
// gBar[i]=create_tof_bar(2.*xPos+Pole_Size_X,Bar_Size_Y,Bar_Size_Y);
zPos = Pole_ZPos[0] + Pole_Size_Z / 2.;
bar_trans = new TGeoTranslation("", 0., yPos, zPos);
gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans);
numBars++;
bar_trans = new TGeoTranslation("", 0., -yPos, zPos);
gGeoMan->GetVolume(geoVersionStand)->AddNode(gBar[i], numBars, bar_trans);
numBars++;
}
void position_inner_tof_modules(Int_t modNType)
{
TGeoTranslation* module_trans = NULL;
// Int_t numModules=(Int_t)( (Inner_Module_Last_Y_Position-Inner_Module_First_Y_Position)/Module_Size_Y[modType])+1;
Float_t yPos = Inner_Module_First_Y_Position;
Int_t ii = 0;
Float_t xPos = Inner_Module_X_Offset;
Float_t zPos = Wall_Z_Position;
Pole_ZPos[NumberOfPoles] = zPos;
Pole_Col[NumberOfPoles] = 0;
NumberOfPoles++;
Float_t DzPos = 0.;
for (Int_t j = 0; j < modNType; j++) {
if (Module_Size_Z[j] > DzPos) { DzPos = Module_Size_Z[j]; }
}
Pole_ZPos[NumberOfPoles] = zPos + DzPos;
Pole_Col[NumberOfPoles] = 0;
NumberOfPoles++;
// Mar2019 setup
Int_t modNum[4] = {4 * 0};
const Int_t NModules = 6;
xPos = 0.;
yPos = 0.;
zPos = TOF_Z_Front;
const Int_t ModType[NModules] = {0, 0, 0, 0, 0, 2};
const Double_t ModDx[NModules] = {0., 0., 0., 0., 0., 0.};
//const Double_t ModDx[NModules]= { 1.5, 0., -1.5, 49.8, 55.8};
const Double_t ModDy[NModules] = {49.8, 0., -49.8, 28.5, -28.5, 37.5};
const Double_t ModDz[NModules] = {0., 0, 0, 20., 20., 72.};
const Double_t ModAng[NModules] = {0., 0., 0., 0., 0.0, 0.0};
TGeoRotation* module_rot = NULL;
TGeoCombiTrans* module_combi_trans = NULL;
/*
for (Int_t iMod = 0; iMod < NModules; iMod++) {
module_trans = new TGeoTranslation("", xPos + ModDx[iMod], yPos + ModDy[iMod], zPos + ModDz[iMod]);
module_rot = new TGeoRotation();
module_rot->RotateZ(ModAng[iMod]);
module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot);
if (iMod < 5) { gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[0], modNum, module_combi_trans); }
else {
gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[2], modNum, module_combi_trans);
}
modNum++;
}
*/
for (Int_t iMod = 0; iMod < NModules; iMod++) {
module_trans = new TGeoTranslation("", xPos + ModDx[iMod], yPos + ModDy[iMod], zPos + ModDz[iMod]);
module_rot = new TGeoRotation();
module_rot->RotateZ(ModAng[iMod]);
module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot);
gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[ModType[iMod]], modNum[ModType[iMod]], module_combi_trans);
cout << "Placed Module " << modNum[ModType[iMod]] << ", Type " << ModType[iMod] << endl;
modNum[ModType[iMod]]++;
}
/*
module_trans = new TGeoTranslation("", xPos, 0, zPos+16.5);
gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans);
modNum++;
// module_trans = new TGeoTranslation("", xPos, 49+3, zPos);
module_trans = new TGeoTranslation("", xPos, 0, zPos+16.5+17.5);
gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans);
modNum++;
// module_trans = new TGeoTranslation("", xPos,-26, zPos+Module_Size_Z[modType]);
module_trans = new TGeoTranslation("", xPos, -49.8, zPos);
gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans);
modNum++;
// module_trans = new TGeoTranslation("", xPos, 26, zPos+Module_Size_Z[modType]);
module_trans = new TGeoTranslation("", xPos, -49.8, zPos+16.5);
gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_trans);
modNum++;
*/
}
void position_Dia(Int_t modNType)
{
TGeoTranslation* module_trans = NULL;
TGeoRotation* module_rot = new TGeoRotation();
module_rot->RotateZ(Dia_rotate_Z);
TGeoCombiTrans* module_combi_trans = NULL;
// Int_t numModules=(Int_t)( (Inner_Module_Last_Y_Position-Inner_Module_First_Y_Position)/Module_Size_Y[modType])+1;
Float_t yPos = Dia_First_Y_Position;
Int_t ii = 0;
Float_t xPos = Dia_X_Offset;
Float_t zPos = Dia_Z_Position;
Int_t modNum = 0;
for (Int_t j = 0; j < modNType; j++) {
Int_t modType = Dia_Types[j];
for (Int_t i = 0; i < Dia_Number[j]; i++) {
ii++;
module_trans = new TGeoTranslation("", xPos, yPos, zPos);
module_combi_trans = new TGeoCombiTrans(*module_trans, *module_rot);
gGeoMan->GetVolume(geoVersionStand)->AddNode(gModules[modType], modNum, module_combi_trans);
modNum++;
}
}
}
void position_Star2(Int_t modNType)
{
TGeoTranslation* module_trans = NULL;
TGeoRotation* module_rot = new TGeoRotation();
module_rot->RotateZ(Star2_rotate_Z);
TGeoCombiTrans* module_combi_trans = NULL;
Float_t yPos = Star2_First_Y_Position;
Float_t zPos = Star2_First_Z_Position;
Int_t ii = 0;
Int_t modNum = 0;
// for (Int_t j = 0; j < modNType; j++) { // DE