-
Notifications
You must be signed in to change notification settings - Fork 0
/
geometry.pl
1873 lines (1649 loc) · 72.4 KB
/
geometry.pl
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
#!/usr/bin/perl
use strict;
use warnings;
use Math::Trig;
our %configuration;
###########################################################################################
###########################################################################################
# Define the relevant parameters of FT Geometry
#
# the FT geometry will be defined starting from these parameters
# and the position on the torus inner ring
#
# all dimensions are in mm
#
# the geometry parameters are divided in 4 groups:
# beamline and shield
# calorimeter
# hodoscope
# tracker
my $degrad = 57.27;
my $torus_z = 2663.; # position of the front face of the Torus ring (set the limit in z)
###########################################################################################
# CALORIMETER
#
# Define the number, dimensions and position of the crystals
my $Nx = 22; # Number of crystals in horizontal directions
my $Ny = 22; # Number of crystals in horizontal directions
my $Cfront = 1898.0; # Position of the front face of the crystals
my $Cwidth = 15.0; # Crystal width in mm (side of the squared front face)
my $Clength = 200.0; # Crystal length in mm
my $VM2000 = 0.130; # Thickness of the VM2000 wrapping
my $AGap = 0.170; # Air Gap between Crystals, total wodth of crystal including wrapping and air gap is 15.3 mm
my $Flength = 8.0; # Length of the crystal front support
my $Fwidth = $Cwidth; # Width of the crystal front support
my $Wwidth = $Cwidth+$VM2000; # Width of the wrapping volume
my $Vwidth = $Cwidth+$VM2000+$AGap; # Width of the crystal mother volume, total width of crystal including wrapping and air gap is 15.3 mm
my $Vlength = $Clength+$Flength; # Length of the crystal mother volume
my $Vfront = $Cfront-$Flength; # z position of the volume front face
my $Slength = 7.0; # Length of the sensor "box"
my $Swidth = $Cwidth; # Width of the sensor "box"
my $Sgap = 1.0; # Gap for flux detector
my $Sfront = $Vfront+$Vlength+$Sgap; # z position of the sensor front face
# Define the copper thermal shield parameters
# back disk
my $Bdisk_TN = 4.; # half thickness of the copper back disk
my $Bdisk_IR = 55.; # inner radius of the copper back disk
my $Bdisk_OR = 178.5; # outer radius of the copper back disk
my $Bdisk_Z = $Sfront+$Slength+$Bdisk_TN+0.1; # z position of the copper back disk
# front disk
my $Fdisk_TN = 1.; # half thickness of the copper front disk supporting the crystal assemblies
my $Fdisk_IR = $Bdisk_IR; # inner radius of the copper front disk
my $Fdisk_OR = $Bdisk_OR; # outer radius of the copper front disk
my $Fdisk_Z = $Vfront-$Fdisk_TN-0.1; # z position of the copper front disk
# space for preamps
my $BPlate_TN = 25.; # half thickness of the preamps volume
my $BPlate_IR = $Bdisk_IR; # inner radius of the preamps volume
my $BPlate_OR = $Bdisk_OR; # outer radius of the preamps volume
my $BPlate_Z = $Bdisk_Z+$Bdisk_TN+$BPlate_TN+0.1; # z position of the preamps volume
# inner copper tube
my $Idisk_LT = ($BPlate_Z+$BPlate_TN-$Fdisk_Z+$Fdisk_TN)/2.; # length of the inner copper tube
my $Idisk_TN = 4; # thickness of the inner copper tube
my $Idisk_OR = $Fdisk_IR; # outer radius of the inner copper tube matches inner radius of front and back disks
my $Idisk_IR = $Fdisk_IR-$Idisk_TN; # inner radius of the inner copper tube
my $Idisk_Z = ($BPlate_Z+$BPlate_TN+$Fdisk_Z-$Fdisk_TN)/2.; # z position of inner copper tube
# outer copper tube
my $Odisk_LT = ($BPlate_Z+$BPlate_TN-$Fdisk_Z+$Fdisk_TN)/2.; # length of the outer copper tube
my $Odisk_TN = 2; # thickness of the outer copper tube
my $Odisk_IR = $Fdisk_OR; # inner radius of the outer copper tube matches outer radius of front and back disks
my $Odisk_OR = $Fdisk_OR+$Odisk_TN; # outer radius of the outer copper tube
my $Odisk_Z = $Idisk_Z; # z position of the outer copper tube
# Define the motherboard parameters
my $Bmtb_TN = 1.; # half thickness of the motherboard
my $Bmtb_IR = $Idisk_IR; # inner radius of the motherboard
my $Bmtb_OR = $Odisk_OR; # outer radius of the motherboard
my $Bmtb_Z = $BPlate_Z + $BPlate_TN + $Bmtb_TN + 0.1; # z position of the motherboard
my $Bmtb_hear_WD = 80./2.; # half width of the motherboard extensions
my $Bmtb_hear_LN = 225./2; # half length of the motherboard extensions
my $Bmtb_hear_D0 = 0.; # displacement of the motherboard extensions
my @Bmtb_angle = ( 30., 150., 210., 330.); # angles of the motherboard extensions
# Define LED plate geometry parameters
my $LED_TN = 5.; # half thickness of the pcb and pastic plate hosting the LEDs
my $LED_IR = $Fdisk_IR; # inner radius of the pcb and pastic plate hosting the LEDs
my $LED_OR = $Fdisk_OR; # outer radius of the pcb and pastic plate hosting the LEDs
my $LED_Z = $Fdisk_Z - $Fdisk_TN - $LED_TN - 0.1; # z position of the pcb and pastic plate hosting the LEDs
# bline: tungsten pipe inside the ft_cal
my $BLine_IR = 30.; # pipe inner radius;
my $BLine_TN = 10.; # pipe thickness
my $BLine_FR = 59.; # radius in the front part, connecting to moller shield
my $BLine_OR = 100.; # radius of the back flange
my $BLine_BG = 1810.; # z location of the beginning of the beamline (to be matched to moller shield)
# back tungsten cup
my $BCup_tang = 0.0962; # tangent of 5.5 degrees
my $BCup_TN = 5.; # thickness of the flat part of the cup
my $BCup_ZM = $Bmtb_Z+$Bmtb_TN+0.1+42.2; # z of the downstream face of the cup
my $BCup_Z1 = $Bmtb_Z+$Bmtb_TN+0.1+1; # z of the side close to the motherboard (downstream)
my $BCup_Z2 = $Bmtb_Z-$Bmtb_TN-0.1-1; # z of the side close to the motherboard (upstream)
my $BCup_ZE = $BCup_ZM+$BCup_TN; # z of the downstream face of the cup
my $BCup_ZB = $BCup_ZM-120. ; # z beginning of the conical part
my $BCup_IRM = 190. ; # inner radius at the beginning of the cone
my $BCup_ORB = $BCup_ZB*$BCup_tang; # outer radius at the beginning of the cone
my $BCup_OR1 = $BCup_Z1*$BCup_tang; # outer radius close to the MTB
my $BCup_OR2 = $BCup_Z2*$BCup_tang; # outer radius close to the MTB
my $BCup_ORM = $BCup_ZM*$BCup_tang; # outer radius at the front face of the plate
my $BCup_ORE = $BCup_ZE*$BCup_tang; # outer radius at the back face of the plate
my $BCup_angle = int(atan($Bmtb_hear_WD/$Bmtb_OR)*$degrad*10)/10+0.5;
my @BCup_iangle = (30.+$BCup_angle, 150.+$BCup_angle, 210.+$BCup_angle, 330.+$BCup_angle);
my @BCup_dangle = ((90.-$BCup_iangle[0])*2., (180.-$BCup_iangle[1])*2., (90.-$BCup_iangle[0])*2.,(180.-$BCup_iangle[1])*2.);
my $BL_IR=30;
my $BL_TN=10;
###########################################################################################
# OUTER INSULATION
my $O_Ins_TN = 20.;
my $O_Ins_Z1 = $Fdisk_Z - $Fdisk_TN - 22.3 - $O_Ins_TN;
my $O_Ins_Z2 = $O_Ins_Z1 + $O_Ins_TN;
my $O_Ins_Z3 = $BCup_ZB;
my $O_Ins_Z4 = $BCup_Z2;
my $O_Ins_Z5 = $BCup_Z1;
my $O_Ins_Z6 = $BCup_ZM;
my $O_Ins_Z7 = $BCup_ZE;
my $O_Ins_Z8 = $BCup_ZE + 0.1;
my $O_Ins_Z9 = $O_Ins_Z8 + $O_Ins_TN;
my $O_Ins_I1 = $BL_IR + $BL_TN + 0.1;
my $O_Ins_I2 = $O_Ins_Z2*$BCup_tang +0.1;
my $O_Ins_I3 = $O_Ins_Z3*$BCup_tang +0.1;
my $O_Ins_I4 = $O_Ins_Z4*$BCup_tang +0.1;
my $O_Ins_I5 = $O_Ins_Z5*$BCup_tang +0.1;
my $O_Ins_I6 = $O_Ins_Z6*$BCup_tang +0.1;
my $O_Ins_I7 = $O_Ins_Z7*$BCup_tang +0.1;
my $O_Ins_I8 = $O_Ins_Z8*$BCup_tang +0.1;
my $O_Ins_I9 = $O_Ins_I1;
my $O_Ins_O1 = $O_Ins_Z1*$BCup_tang +0.1 + $O_Ins_TN;
my $O_Ins_O2 = $O_Ins_I2 + $O_Ins_TN;
my $O_Ins_O3 = $O_Ins_I3 + $O_Ins_TN;
my $O_Ins_O4 = $O_Ins_I4 + $O_Ins_TN;
my $O_Ins_O5 = $O_Ins_I5 + $O_Ins_TN;
my $O_Ins_O6 = $O_Ins_I6 + $O_Ins_TN;
my $O_Ins_O7 = $O_Ins_I7 + $O_Ins_TN;
my $O_Ins_O8 = $O_Ins_I8 + $O_Ins_TN;
my $O_Ins_O9 = $O_Ins_Z9*$BCup_tang +0.1 + $O_Ins_TN;
$O_Ins_I4 = $O_Ins_Z4*$BCup_tang +0.5;
$O_Ins_I5 = $O_Ins_Z5*$BCup_tang +0.5;
###########################################################################################
# INNER INSULATION
my $I_Ins_LT = ($BCup_ZE - $O_Ins_Z2 -0.1)/2.;
my $I_Ins_OR = $Idisk_IR - 0.1;
my $I_Ins_IR = $O_Ins_I1;
my $I_Ins_Z = ($BCup_ZE + $O_Ins_Z2)/2.;
###########################################################################################
# OUTER SHELL
my $O_Shell_TN = 1.;
my $O_Shell_Z1 = $O_Ins_Z1-$O_Shell_TN-0.1;
my $O_Shell_Z2 = $O_Shell_Z1+$O_Shell_TN;
my $O_Shell_Z3 = $O_Ins_Z3;
my $O_Shell_Z4 = $BCup_Z2;
my $O_Shell_Z5 = $BCup_Z1;
my $O_Shell_Z6 = $O_Ins_Z6 ;
my $O_Shell_Z7 = $O_Ins_Z7 ;
my $O_Shell_Z8 = $O_Ins_Z8 ;
my $O_Shell_Z9 = $O_Ins_Z9 ;
my $O_Shell_Z10 = $O_Ins_Z9 + 0.1;
my $O_Shell_Z11= $O_Shell_Z9+$O_Shell_TN;
my $O_Shell_I1 = $O_Ins_I1;
my $O_Shell_I2 = $O_Shell_Z2*$BCup_tang + $O_Ins_TN + 0.1;
my $O_Shell_I3 = $O_Shell_Z3*$BCup_tang + $O_Ins_TN + 0.1;
my $O_Shell_I4 = $O_Shell_Z4*$BCup_tang + $O_Ins_TN + 0.1;
my $O_Shell_I5 = $O_Shell_Z5*$BCup_tang + $O_Ins_TN + 0.1;
my $O_Shell_I6 = $O_Shell_Z6*$BCup_tang + $O_Ins_TN + 0.1;
my $O_Shell_I7 = $O_Shell_Z7*$BCup_tang + $O_Ins_TN + 0.1;
my $O_Shell_I8 = $O_Shell_Z8*$BCup_tang + $O_Ins_TN + 0.1;
my $O_Shell_I9 = $O_Shell_Z9*$BCup_tang + $O_Ins_TN + 0.1;
my $O_Shell_I10 = $O_Shell_Z10*$BCup_tang + $O_Ins_TN + 0.1;
my $O_Shell_I11 = $O_Ins_I1;
my $O_Shell_O1 = $O_Shell_Z1*$BCup_tang + $O_Ins_TN + 0.1 + $O_Shell_TN;
my $O_Shell_O2 = $O_Shell_I2 + $O_Shell_TN;
my $O_Shell_O3 = $O_Shell_I3 + $O_Shell_TN;
my $O_Shell_O4 = $O_Shell_I4 + $O_Shell_TN;
my $O_Shell_O5 = $O_Shell_I5 + $O_Shell_TN;
my $O_Shell_O6 = $O_Shell_I6 + $O_Shell_TN;
my $O_Shell_O7 = $O_Shell_I7 + $O_Shell_TN;
my $O_Shell_O8 = $O_Shell_I8 + $O_Shell_TN;
my $O_Shell_O9 = $O_Shell_I9 + $O_Shell_TN;
my $O_Shell_O10 = $O_Shell_I10 + $O_Shell_TN;
my $O_Shell_O11 = $O_Shell_Z11*$BCup_tang + $O_Ins_TN + 0.1 + $O_Shell_TN;
$O_Shell_I4 = $O_Shell_Z4*$BCup_tang + $O_Ins_TN + 0.7;
$O_Shell_I5 = $O_Shell_Z5*$BCup_tang + $O_Ins_TN + 0.7;
###########################################################################################
# FT BEAMLINE COMPONENTS
# ft to torus pipe
my $Tube_OR = 75.0;
my $back_flange_OR = 126.0;
my $front_flange_OR = 148.0;
my $flange_TN = 15.0;
my $TPlate_TN= 20.; # thickness of the tungsten plate on the back of the FT-Cal
my $TPlate_Z1 = $O_Shell_Z11 + 0.1;
my $TPlate_Z2 = $TPlate_Z1 + $TPlate_TN;
my $BLine_MR = $BLine_IR + $BLine_TN; # outer radius in the calorimeter section
my $BLine_Z1 = $BLine_BG;
my $BLine_Z2 = $O_Shell_Z1 - 0.1;
my $BLine_Z3 = $TPlate_Z2 + 0.1;
my $BLine_Z4 = $BLine_Z3 + 18.;
###########################################################################################
# Hodoscope Dimension and Parameters
my $VETO_TN = 38./2.; # thickness of the hodoscope volume
my $VETO_OR = 178.5; # outer radius
my $VETO_IR = 60.; # inner radius
my $VETO_Z = $O_Shell_Z1 - $VETO_TN - 1.0; # position along z
my $paint_thick = 0.075;
my @LS_TN= (0.5/2., 1.0/2., 0.5/2.); # thickness of three surrounding layers of Carbon fiber
my @LS_ZN= ($VETO_TN - 0.5/2. , $VETO_TN-0.5-7.5-15.0-1.0/2. , -$VETO_TN + 0.5/2.); # Position of 3 layers of carbon fiber, edit if you edit the thickness
my $p15_WW=15./2.;
my @p15_WT= (15./2. , 7./2.) ;
my @p_air_WT = (7.5/2. , 6.5/2.);
#
my $p30_WW=30./2.;
my @p30_WT= (15./2. , 7./2.) ;
#
my $p15_SW=$p15_WW-0.1;
#
my $p30_SW=$p30_WW-0.1;
#
my $p15_N = 11;
my @p15_X = ( 7.5, 22.5, 37.5, 52.5, 52.5, 67.5, 67.5, 67.5, 67.5, 97.5, 127.5);
my @p15_Y = ( 67.5, 67.5, 67.5, 52.5, 67.5, 7.5, 22.5, 37.5, 52.5, 127.5, 97.5);
#
my $p30_N = 18;
my @p30_X = ( 15., 15., 15., 45., 45., 45., 75., 75., 75., 90., 90., 105., 105., 120., 120., 135., 150., 150.);
my @p30_Y = ( 90., 120., 150., 90., 120., 150., 75., 105., 135., 15., 45., 75., 105., 15., 45., 75., 15., 45.);
my @q_X = (1., -1., -1., 1.);
my @q_Y = (1., 1., -1., -1.);
my $p_Ntiles = 29;
# 0.075mm paint thickness tyles
my @p_R = (16.2331,15.6642,16.2331,15.0076,13.0933,15.6642,13.0933,10.8102,7.5590,15.9022,15.3132,15.3132,15.9022,13.0258,12.2998,12.2998,13.0258,10.2395,9.2984,9.2984,10.2395,8.7322,7.8847,7.2650,6.9344,6.9344,7.2650,7.8847,8.7322) ;
my @p_theta = (-0.65294,-0.50511,-0.91786,-0.78540,-0.61741,-1.06568,-0.95339,-0.78540,-0.78540,-0.29005,-0.09916,0.09916,0.29005,-0.35667,-0.12357,0.12357,0.35667,-0.46024,-0.16377,0.16377,0.46024,-0.66118,-0.50722,-0.32184,-0.11069,0.11069,0.32184,0.50722,0.66118 ) ;
# 0.10mm paint thickness
#my @p_R = (16.1761,15.5952,16.1761,14.9581,13.0339,15.5952,13.0339,10.7466,7.5165,15.8261,15.2381,15.2381,15.8261,12.9596,12.2347,12.2347,12.9596,10.1835,9.2433,9.2433,10.1835,8.6752,7.8332,7.2176,6.8892,6.8892,7.2176,7.8332,8.6752);
#my @p_theta = (-0.65291,-0.50573,-0.91789,-0.78540,-0.61829,-1.06507,-0.95251,-0.78540,-0.78540,-0.29049,-0.09932,0.09932,0.29049,-0.35733,-0.12382,0.12382,0.35733,-0.46132,-0.16421,0.16421,0.46132,-0.66118,-0.50722,-0.32184,-0.11069,0.11069,0.32184,0.50722,0.66118);
# 0.15mm paint thickness
#my @p_R = (16.2331,15.6642,16.2331,15.0076,13.0933,15.6642,13.0933,10.8102,7.5590,15.9022,15.3132,15.3132,15.9022,13.0258,12.2998,12.2998,13.0258,10.2395,9.2984,9.2984,10.2395,8.7322,7.8847,7.2650,6.9344,6.9344,7.2650,7.8847,8.7322);
#my @p_theta = (-0.65294,-0.50511,-0.91786,-0.78540,-0.61741,-1.06568,-0.95339,-0.78540,-0.78540,-0.29005,-0.09916,0.09916,0.29005,-0.35667,-0.12357,0.12357,0.35667,-0.46024,-0.16377,0.16377,0.46024,-0.66118,-0.50722,-0.32184,-0.11069,0.11069,0.32184,0.50722,0.66118);
# 0.20mm paint thickness
#my @p_R = (16.2901,15.7331,16.2901,15.0571,13.1526,15.7331,13.1526,10.8739,7.6014,15.9784,15.3884,15.3884,15.9784,13.0919,12.3649,12.3649,13.0919,10.2954,9.3535,9.3535,10.2954,8.7892,7.9362,7.3125,6.9797,6.9797,7.3125,7.9362,8.7892);
#my @p_theta = (-0.65297,-0.50451,-0.91783,-0.78540,-0.61654,-1.06629,-0.95426,-0.78540,-0.78540,-0.28960,-0.09900,0.09900,0.28960,-0.35601,-0.12332,0.12332,0.35601,-0.45917,-0.16334,0.16334,0.45917,-0.66118,-0.50722,-0.32184,-0.11069,0.11069,0.32184,0.50722,0.66118);
my @p_size = (15.0,30.0,15.0,30.0,30.0,30.0,30.0,30.0,15.0,30.0,30.0,30.0,30.0,30.0,30.0,30.0,30.0,30.0,30.0,30.0,30.0,15.0,15.0,15.0,15.0,15.0,15.0,15.0,15.0);
###########################################################################################
# Tracker Dimension and Parameters
# Tracker
my @starting_point =();
my $ftm_ir = 64.0;
my $ftm_or = 161.0;
my $nlayer = 2;
$starting_point[0] = 1763.0;
$starting_point[1] = 1783.0;
my $InnerRadius = 65.0;
my $OuterRadius = 142.0;
my $Epoxy_Dz = 0.5*0.3;
my $PCB_Dz = 0.5*0.1;
my $Strips_Dz = 0.5*0.015;
my $Gas1_Dz = 0.5*0.128;
my $Mesh_Dz = 0.5*0.030;
my $Gas2_Dz = 0.5*5.350;
my $Drift_Dz = 0.5*0.1;
# G4 materials
my $epoxy_material = 'epoxy';
my $pcboard_material = 'epoxy';
my $strips_material = 'mmstrips';
my $gas_material = 'mmgas';
my $mesh_material = 'mmmesh';
my $drift_material = 'mmmylar';
# G4 colors
my $epoxy_color = 'e200e1';
my $pcboard_color = '0000ff';
my $strips_color = '353540';
my $gas_color = 'e10000';
my $mesh_color = '252020';
my $drift_color = 'fff600';
# FTM is a Tube containing all SLs
my $ftm_dz = ($starting_point[1] - $starting_point[0])/2.0 + $Epoxy_Dz*2.0 + $PCB_Dz*4.0 + $Strips_Dz*4.0 + $Gas1_Dz*4.0 + $Mesh_Dz*4.0 + $Gas2_Dz*4.0 + $Drift_Dz*4.0+1.0;
my $ftm_starting = ($starting_point[1] + $starting_point[0])/2.0;
# FTM FEE Boxes
my $FEE_Disk_OR = 200.;
my $FEE_Disk_LN = 2.;
my $FEE_ARM_LN = 530./2.;
my $FEE_ARM_WD = 90./2.;
# size of crate
my $FEE_WD = 91./2.;
my $FEE_HT = 265.5/2.;
my $FEE_LN = 242./2.;
my $FEE_TN = 1.5;
my $FEE_PVT_TN=10.;
my $FEE_PVT_WD = $FEE_WD+$FEE_PVT_TN;
my $FEE_PVT_HT = $FEE_HT+$FEE_PVT_TN;
my $FEE_PVT_LN = $FEE_LN+$FEE_PVT_TN;
my $FEE_A_WD = $FEE_WD-$FEE_TN;
my $FEE_A_HT = $FEE_HT-$FEE_TN;
my $FEE_A_LN = $FEE_LN-$FEE_TN;
my @FEE_azimuthal_angle = (210., 270., 330.);
my $FEE_polar_angle = -22.;
# define crystals mother volume
my $nplanes_FT_CRY = 2;
my @z_plane_FT_CRY = ( $Idisk_Z-$Idisk_LT, $Idisk_Z+$Idisk_LT);
my @iradius_FT_CRY = ( $Idisk_IR, $Idisk_IR);
my @oradius_FT_CRY = ( $Odisk_OR, $Odisk_OR);
###########################################################################################
# Define FTCAL Mother Volume
my $nplanes_FT = 7;
my @z_plane_FT = ($BLine_BG, $O_Shell_Z1, $O_Shell_Z1, 2098., 2276., 2276., $torus_z);
my @oradius_FT = ($BLine_FR, $BLine_FR, 700., 700., 238., 149., $back_flange_OR);
my @iradius_FT = ( 0., 0., 0., 0., 0., 0., 0.);
###########################################################################################
###########################################################################################
# Build FT-CAL Mother Volume
###########################################################################################
sub make_ft_cal_mother_volume
{
my %detector = init_det();
$detector{"name"} = "ft_cal";
$detector{"mother"} = "root";
$detector{"description"} = "ft calorimeter";
$detector{"color"} = "1437f4";
$detector{"type"} = "Polycone";
my $dimen = "0.0*deg 360*deg $nplanes_FT*counts";
for(my $i = 0; $i <$nplanes_FT; $i++) {$dimen = $dimen ." $iradius_FT[$i]*mm";}
for(my $i = 0; $i <$nplanes_FT; $i++) {$dimen = $dimen ." $oradius_FT[$i]*mm";}
for(my $i = 0; $i <$nplanes_FT; $i++) {$dimen = $dimen ." $z_plane_FT[$i]*mm";}
$detector{"dimensions"} = $dimen;
$detector{"material"} = "Air";
$detector{"style"} = 0;
print_det(\%configuration, \%detector);
}
###########################################################################################
# Build Crystal Volume and Assemble calorimeter
###########################################################################################
sub make_ft_cal_crystals_volume
{
my %detector = init_det();
$detector{"name"} = "ft_cal_crystal_volume";
$detector{"mother"} = "ft_cal";
$detector{"description"} = "ft calorimeter crystal volume";
$detector{"color"} = "1437f4";
$detector{"type"} = "Polycone";
my $dimen = "0.0*deg 360*deg $nplanes_FT_CRY*counts";
for(my $i = 0; $i <$nplanes_FT_CRY; $i++) {$dimen = $dimen ." $iradius_FT_CRY[$i]*mm";}
for(my $i = 0; $i <$nplanes_FT_CRY; $i++) {$dimen = $dimen ." $oradius_FT_CRY[$i]*mm";}
for(my $i = 0; $i <$nplanes_FT_CRY; $i++) {$dimen = $dimen ." $z_plane_FT_CRY[$i]*mm";}
$detector{"dimensions"} = $dimen;
$detector{"material"} = "Air";
$detector{"style"} = 0;
print_det(\%configuration, \%detector);
}
# Loop over all crystals and define their positions
sub make_ft_cal_crystals
{
my $centX = ( int $Nx/2 )+0.5;
my $centY = ( int $Ny/2 )+0.5;
my $locX=0.;
my $locY=0.;
my $locZ=0.;
my $dX=0.;
my $dY=0.;
my $dZ=0.;
for ( my $iX = 1; $iX <= $Nx; $iX++ )
{
for ( my $iY = 1; $iY <= $Ny; $iY++ )
{
$locX=($iX-$centX)*$Vwidth;
$locY=($iY-$centY)*$Vwidth;
my $locR=sqrt($locX*$locX+$locY*$locY);
if($locR>60. && $locR<$Vwidth*11)
{
# crystal mother volume
my %detector = init_det();
$detector{"name"} = "ft_cr_volume_" . $iX . "_" . $iY ;
$detector{"mother"} = "ft_cal_crystal_volume";
$detector{"description"} = "ft crystal mother volume (h:" . $iX . ", v:" . $iY . ")";
$locZ=$Vfront+$Vlength/2.;
$detector{"pos"} = "$locX*mm $locY*mm $locZ*mm";
$detector{"color"} = "838EDE";
$detector{"type"} = "Box" ;
$dX=$Vwidth/2.0;
$dY=$Vwidth/2.0;
$dZ=$Vlength/2.0;
$detector{"dimensions"} = "$dX*mm $dY*mm $dZ*mm";
$detector{"material"} = "G4_AIR";
print_det(\%configuration, \%detector);
# APD housing
%detector = init_det();
$detector{"name"} = "ft_cr_apd_" . $iX . "_" . $iY ;
$detector{"mother"} = "ft_cal_crystal_volume";
$detector{"description"} = "ft crystal apd (h:" . $iX . ", v:" . $iY . ")";
$locZ=$Sfront+$Slength/2.;
$detector{"pos"} = "$locX*mm $locY*mm $locZ*mm";
$detector{"color"} = "99CC66";
$detector{"type"} = "Box" ;
$dX=$Swidth/2.0;
$dY=$Swidth/2.0;
$dZ=$Slength/2.0;
$detector{"dimensions"} = "$dX*mm $dY*mm $dZ*mm";
$detector{"material"} = "peek";
$detector{"style"} = "1" ;
print_det(\%configuration, \%detector);
# Wrapping Volume;
%detector = init_det();
$detector{"name"} = "ft_cr_wr_" . $iX . "_" . $iY ;
$detector{"mother"} = "ft_cr_volume_" . $iX . "_" . $iY ;
$detector{"description"} = "ft wrapping (h:" . $iX . ", v:" . $iY . ")";
$locX=0.;
$locY=0.;
$locZ=0.;
$detector{"pos"} = "$locX*mm $locY*mm $locZ*mm";
$detector{"color"} = "838EDE";
$detector{"type"} = "Box" ;
$dX=$Wwidth/2.0;
$dY=$Wwidth/2.0;
$dZ=$Vlength/2.0;
$detector{"dimensions"} = "$dX*mm $dY*mm $dZ*mm";
$detector{"material"} = "G4_MYLAR";
$detector{"style"} = "1" ;
print_det(\%configuration, \%detector);
# PbWO4 Crystal;
%detector = init_det();
$detector{"name"} = "ft_cr_" . $iX . "_" . $iY ;
$detector{"mother"} = "ft_cr_wr_" . $iX . "_" . $iY ;
$detector{"description"} = "ft crystal (h:" . $iX . ", v:" . $iY . ")";
$locX=0.;
$locY=0.;
$locZ=$Flength/2.;
$detector{"pos"} = "$locX*mm $locY*mm $locZ*mm";
$detector{"color"} = "836FFF";
$detector{"type"} = "Box" ;
$dX=$Cwidth/2.0;
$dY=$Cwidth/2.0;
$dZ=$Clength/2.0;
$detector{"dimensions"} = "$dX*mm $dY*mm $dZ*mm";
$detector{"material"} = "G4_PbWO4";
$detector{"style"} = "1" ;
$detector{"sensitivity"} = "ft_cal";
$detector{"hit_type"} = "ft_cal";
$detector{"identifiers"} = "ih manual $iX iv manual $iY";
print_det(\%configuration, \%detector);
# LED housing
%detector = init_det();
$detector{"name"} = "ft_cr_led_" . $iX . "_" . $iY ;
$detector{"mother"} = "ft_cr_wr_" . $iX . "_" . $iY ;
$detector{"description"} = "ft crystal led (h:" . $iX . ", v:" . $iY . ")";
$locX=0.;
$locY=0.;
$locZ=-$Vlength/2.+$Flength/2.;
$detector{"pos"} = "$locX*mm $locY*mm $locZ*mm";
$detector{"color"} = "EEC900";
$detector{"type"} = "Box" ;
$dX=$Fwidth/2.0;
$dY=$Fwidth/2.0;
$dZ=$Flength/2.0;
$detector{"dimensions"} = "$dX*mm $dY*mm $dZ*mm";
$detector{"material"} = "peek";
$detector{"style"} = "1" ;
print_det(\%configuration, \%detector);
}
}
}
}
###########################################################################################
# Define the Flux Detector on the back of the crystals
sub make_ft_cal_flux
{
# flux on the back of the crystals
my $Flux_TN = $Sgap/2; # flux detector half thickness defined as a function of the gap between sensor and crystals
my $Flux_IR = $Bdisk_IR; # inner radius is defined equal to copper back disk
my $Flux_OR = $Bdisk_OR; # outer radius is defined equal to copper front disk
my $Flux_Z = $Vfront+$Vlength+$Flux_TN;
my %detector = init_det();
$detector{"name"} = "ft_cal_flux";
$detector{"mother"} = "ft_cal_crystal_volume";
$detector{"description"} = "ft flux";
$detector{"pos"} = "0.0*cm 0.0*cm $Flux_Z*mm";
$detector{"color"} = "aa0088";
$detector{"type"} = "Tube";
$detector{"dimensions"} = "$Flux_IR*mm $Flux_OR*mm $Flux_TN*mm 0.*deg 360.*deg";
$detector{"material"} = "G4_Galactic";
$detector{"style"} = 1;
$detector{"sensitivity"} = "flux";
$detector{"hit_type"} = "flux";
$detector{"identifiers"} = "id manual 3";
print_det(\%configuration, \%detector);
}
# Define the Flux Detectors in front of the Tagger
sub make_ft_moellerdisk
{
# flux in front of tagger
my @disk_zpos = ( 281.0 , 1809.6 );
my @disk_iradius = ( 2.0 , 56.0 );
my @disk_oradius = ( 150.0 , 150.0 );
for(my $n=0; $n<2; $n++)
{
my $idisk = $n +1;
my %detector = init_det();
$detector{"name"} = "moller_disk_$n";
$detector{"mother"} = "root";
$detector{"description"} = "Moller Disk $n";
$detector{"pos"} = "0*mm 0.0*mm $disk_zpos[$n]*mm";
$detector{"rotation"} = "0*deg 0*deg 0*deg";
$detector{"color"} = "aa0088";
$detector{"type"} = "Tube";
$detector{"dimensions"} = "$disk_iradius[$n]*mm $disk_oradius[$n]*mm 0.4*mm 0.0*deg 360*deg";
$detector{"material"} = "G4_Galactic";
$detector{"visible"} = 0;
$detector{"sensitivity"} = "flux";
$detector{"hit_type"} = "flux";
$detector{"identifiers"} = "id manual $idisk";
print_det(\%configuration, \%detector);
}
}
###########################################################################################
# Define the Copper Disk in front of the Crystals
sub make_ft_cal_copper
{
# back
my %detector = init_det();
$detector{"name"} = "ft_cal_back_copper";
$detector{"mother"} = "ft_cal_crystal_volume";
$detector{"description"} = "ft back_copper";
$detector{"pos"} = "0.0*cm 0.0*cm $Bdisk_Z*mm";
$detector{"color"} = "CC6600";
$detector{"type"} = "Tube";
$detector{"dimensions"} = "$Bdisk_IR*mm $Bdisk_OR*mm $Bdisk_TN*mm 0.*deg 360.*deg";
$detector{"material"} = "G4_Cu";
$detector{"style"} = 1;
print_det(\%configuration, \%detector);
# front
%detector = init_det();
$detector{"name"} = "ft_cal_front_copper";
$detector{"mother"} = "ft_cal_crystal_volume";
$detector{"description"} = "ft front_copper";
$detector{"pos"} = "0.0*cm 0.0*cm $Fdisk_Z*mm";
$detector{"color"} = "CC6600";
$detector{"type"} = "Tube";
$detector{"dimensions"} = "$Fdisk_IR*mm $Fdisk_OR*mm $Fdisk_TN*mm 0.*deg 360.*deg";
$detector{"material"} = "G4_Cu";
$detector{"style"} = 1;
print_det(\%configuration, \%detector);
# inner
%detector = init_det();
$detector{"name"} = "ft_cal_inner_copper";
$detector{"mother"} = "ft_cal_crystal_volume";
$detector{"description"} = "ft inner_copper";
$detector{"pos"} = "0.0*cm 0.0*cm $Idisk_Z*mm";
$detector{"color"} = "CC6600";
$detector{"type"} = "Tube";
$detector{"dimensions"} = "$Idisk_IR*mm $Idisk_OR*mm $Idisk_LT*mm 0.*deg 360.*deg";
$detector{"material"} = "G4_Cu";
$detector{"style"} = 1;
print_det(\%configuration, \%detector);
# outer
%detector = init_det();
$detector{"name"} = "ft_cal_outer_copper";
$detector{"mother"} = "ft_cal_crystal_volume";
$detector{"description"} = "ft outer_copper";
$detector{"pos"} = "0.0*cm 0.0*cm $Odisk_Z*mm";
$detector{"color"} = "CC6600";
$detector{"type"} = "Tube";
$detector{"dimensions"} = "$Odisk_IR*mm $Odisk_OR*mm $Odisk_LT*mm 0.*deg 360.*deg";
$detector{"material"} = "G4_Cu";
$detector{"style"} = 1;
print_det(\%configuration, \%detector);
# Preamp Space
%detector = init_det();
$detector{"name"} = "ft_cal_back_plate";
$detector{"mother"} = "ft_cal_crystal_volume";
$detector{"description"} = "ft back_plate";
$detector{"pos"} = "0.0*cm 0.0*cm $BPlate_Z*mm";
$detector{"color"} = "7F9A65";
$detector{"type"} = "Tube";
$detector{"dimensions"} = "$BPlate_IR*mm $BPlate_OR*mm $BPlate_TN*mm 0.*deg 360.*deg";
$detector{"material"} = "G4_AIR";
$detector{"style"} = 1;
print_det(\%configuration, \%detector);
}
###########################################################################################
# Define the Space for the Preamps and the MotherBoard on the back
sub make_ft_cal_motherboard
{
# MotherBoard
my %detector = init_det();
$detector{"name"} = "ft_cal_back_mtb";
$detector{"mother"} = "ft_cal";
$detector{"description"} = "ft back_mtb disk";
$detector{"pos"} = "0.0*cm 0.0*cm $Bmtb_Z*mm";
$detector{"color"} = "0B3B0B";
$detector{"type"} = "Tube";
$detector{"dimensions"} = "$Bmtb_IR*mm $Bmtb_OR*mm $Bmtb_TN*mm 0.*deg 360.*deg";
$detector{"material"} = "pcboard";
$detector{"style"} = 1;
print_det(\%configuration, \%detector);
for ( my $i = 0; $i < 4; $i++ ) {
my $Bmtb_hear_DX = ($Bmtb_OR+$Bmtb_hear_LN-$Bmtb_hear_D0)*cos($Bmtb_angle[$i]/$degrad);
my $Bmtb_hear_DY =-($Bmtb_OR+$Bmtb_hear_LN-$Bmtb_hear_D0)*sin($Bmtb_angle[$i]/$degrad);
%detector = init_det();
$detector{"name"} = "ft_back_mtb_h$i";
$detector{"mother"} = "ft_cal";
$detector{"description"} = "ft back_mtb hear$i";
$detector{"pos"} = "$Bmtb_hear_DX*mm $Bmtb_hear_DY*mm $Bmtb_Z*mm";
$detector{"rotation"} = "0*deg 0*deg $Bmtb_angle[$i]*deg";
$detector{"color"} = "0B3B0B";
$detector{"type"} = "Box";
$detector{"dimensions"} = "$Bmtb_hear_LN*mm $Bmtb_hear_WD*mm $Bmtb_TN*mm";
$detector{"material"} = "PCBoardM";
$detector{"style"} = 1;
print_det(\%configuration, \%detector);
}
}
###########################################################################################
# Define the LED assembly
sub make_ft_cal_led
{
my %detector = init_det();
$detector{"name"} = "ft_cal_led";
$detector{"mother"} = "ft_cal";
$detector{"description"} = "ft led";
$detector{"pos"} = "0.0*cm 0.0*cm $LED_Z*mm";
$detector{"color"} = "333333";
$detector{"type"} = "Tube";
$detector{"dimensions"} = "$LED_IR*mm $LED_OR*mm $LED_TN*mm 0.*deg 360.*deg";
$detector{"material"} = "G4_TEFLON";
$detector{"style"} = 1;
print_det(\%configuration, \%detector);
}
###########################################################################################
# Define the Back Tungsten Cup
sub make_ft_cal_tcup
{
my $nplanes_TCup = 4;
my @z_plane_TCup = ( $BCup_Z1, $BCup_ZM, $BCup_ZM, $BCup_ZE);
my @oradius_TCup = ( $BCup_OR1, $BCup_ORM, $BCup_ORM, $BCup_ORE,);
my @iradius_TCup = ( $BCup_IRM, $BCup_IRM, $I_Ins_OR, $I_Ins_OR);
my %detector = init_det();
$detector{"name"} = "ft_cal_tcup_back";
$detector{"mother"} = "ft_cal";
$detector{"description"} = "tungsten cup and cone at the back of the ft, back part";
$detector{"color"} = "ccff00";
$detector{"type"} = "Polycone";
my $dimen = "0.0*deg 360*deg $nplanes_TCup*counts";
for(my $i = 0; $i <$nplanes_TCup; $i++) {$dimen = $dimen ." $iradius_TCup[$i]*mm";}
for(my $i = 0; $i <$nplanes_TCup; $i++) {$dimen = $dimen ." $oradius_TCup[$i]*mm";}
for(my $i = 0; $i <$nplanes_TCup; $i++) {$dimen = $dimen ." $z_plane_TCup[$i]*mm";}
$detector{"dimensions"} = $dimen;
$detector{"material"} = "G4_W";
$detector{"style"} = 1;
print_det(\%configuration, \%detector);
$nplanes_TCup = 2;
@z_plane_TCup = ( $BCup_ZB, $BCup_Z2 );
@oradius_TCup = ( $BCup_ORB, $BCup_OR2);
@iradius_TCup = ( $BCup_IRM, $BCup_IRM);
%detector = init_det();
$detector{"name"} = "ft_cal_tcup_front";
$detector{"mother"} = "ft_cal";
$detector{"description"} = "tungsten cup and cone at the back of the ft, front part";
$detector{"color"} = "ccff00";
$detector{"type"} = "Polycone";
$dimen = "0.0*deg 360*deg $nplanes_TCup*counts";
for(my $i = 0; $i <$nplanes_TCup; $i++) {$dimen = $dimen ." $iradius_TCup[$i]*mm";}
for(my $i = 0; $i <$nplanes_TCup; $i++) {$dimen = $dimen ." $oradius_TCup[$i]*mm";}
for(my $i = 0; $i <$nplanes_TCup; $i++) {$dimen = $dimen ." $z_plane_TCup[$i]*mm";}
$detector{"dimensions"} = $dimen;
$detector{"material"} = "G4_W";
$detector{"style"} = 1;
print_det(\%configuration, \%detector);
$nplanes_TCup = 2;
@z_plane_TCup = ( $BCup_Z1, $BCup_Z2 );
@oradius_TCup = ( $BCup_OR1, $BCup_OR2);
@iradius_TCup = ( $BCup_IRM, $BCup_IRM);
for(my $i=0; $i<4 ; $i++)
{
my $s = $i + 1;
%detector = init_det();
$detector{"name"} = "ft_cal_tcup_m$s";
$detector{"mother"} = "ft_cal";
$detector{"description"} = "tungsten cup and cone at the back of the ft, medium part $s";
$detector{"color"} = "ccff00";
$detector{"type"} = "Polycone";
my $biangle=$BCup_iangle[$i];
my $bdangle=$BCup_dangle[$i];
$dimen = "$biangle*deg $bdangle*deg $nplanes_TCup*counts";
for(my $i = 0; $i <$nplanes_TCup; $i++) { $dimen = $dimen ." $iradius_TCup[$i]*mm";}
for(my $i = 0; $i <$nplanes_TCup; $i++) { $dimen = $dimen ." $oradius_TCup[$i]*mm";}
for(my $i = 0; $i <$nplanes_TCup; $i++) { $dimen = $dimen ." $z_plane_TCup[$i]*mm";}
$detector{"dimensions"} = $dimen;
$detector{"material"} = "G4_W";
$detector{"style"} = 1;
print_det(\%configuration, \%detector);
}
}
############################################################################################
## Define the Calorimeter Insulation
sub make_ft_cal_insulation
{
# inner
my %detector = init_det();
$detector{"name"} = "ft_cal_inner_ins";
$detector{"mother"} = "ft_cal";
$detector{"description"} = "ft inner_ins";
$detector{"pos"} = "0.0*cm 0.0*cm $I_Ins_Z*mm";
$detector{"color"} = "F5F6CE";
$detector{"type"} = "Tube";
$detector{"dimensions"} = "$I_Ins_IR*mm $I_Ins_OR*mm $I_Ins_LT*mm 0.*deg 360.*deg";
$detector{"material"} = "insfoam";
$detector{"style"} = 1;
print_det(\%configuration, \%detector);
# outer f
my $nplanes_O_Ins = 5;
my @z_plane_O_Ins = ($O_Ins_Z1, $O_Ins_Z2, $O_Ins_Z2, $O_Ins_Z3, $O_Ins_Z4);
my @iradius_O_Ins = ($O_Ins_I1, $O_Ins_I1, $O_Ins_I2, $O_Ins_I3, $O_Ins_I4);
my @oradius_O_Ins = ($O_Ins_O1, $O_Ins_O2, $O_Ins_O2, $O_Ins_O3, $O_Ins_O4);
%detector = init_det();
$detector{"name"} = "ft_cal_outer_ins_f";
$detector{"mother"} = "ft_cal";
$detector{"description"} = "ft outer_ins_f";
$detector{"color"} = "F5F6CE";
$detector{"type"} = "Polycone";
my $dimen = "0.0*deg 360*deg $nplanes_O_Ins*counts";
for(my $i = 0; $i <$nplanes_O_Ins ; $i++) { $dimen = $dimen ." $iradius_O_Ins[$i]*mm";}
for(my $i = 0; $i <$nplanes_O_Ins; $i++) { $dimen = $dimen ." $oradius_O_Ins[$i]*mm";}
for(my $i = 0; $i <$nplanes_O_Ins ; $i++) { $dimen = $dimen ." $z_plane_O_Ins[$i]*mm";}
$detector{"dimensions"} = $dimen;
$detector{"material"} = "insfoam";
$detector{"style"} = 1;
print_det(\%configuration, \%detector);
# outer b
$nplanes_O_Ins = 6;
@z_plane_O_Ins = ($O_Ins_Z5, $O_Ins_Z6, $O_Ins_Z7, $O_Ins_Z8, $O_Ins_Z8, $O_Ins_Z9);
@iradius_O_Ins = ($O_Ins_I5, $O_Ins_I6, $O_Ins_I7, $O_Ins_I8, $O_Ins_I9, $O_Ins_I9);
@oradius_O_Ins = ($O_Ins_O5, $O_Ins_O6, $O_Ins_O7, $O_Ins_O8, $O_Ins_O8, $O_Ins_O9);
%detector = init_det();
$detector{"name"} = "ft_cal_outer_ins_b";
$detector{"mother"} = "ft_cal";
$detector{"description"} = "ft outer_ins_b";
$detector{"color"} = "F5F6CE";
$detector{"type"} = "Polycone";
$dimen = "0.0*deg 360*deg $nplanes_O_Ins*counts";
for(my $i = 0; $i <$nplanes_O_Ins; $i++) {$dimen = $dimen ." $iradius_O_Ins[$i]*mm";}
for(my $i = 0; $i <$nplanes_O_Ins; $i++) {$dimen = $dimen ." $oradius_O_Ins[$i]*mm";}
for(my $i = 0; $i <$nplanes_O_Ins; $i++) {$dimen = $dimen ." $z_plane_O_Ins[$i]*mm";}
$detector{"dimensions"} = $dimen;
$detector{"material"} = "insfoam";
$detector{"style"} = 1;
print_det(\%configuration, \%detector);
# medium
$nplanes_O_Ins = 2;
@z_plane_O_Ins = ($O_Ins_Z5, $O_Ins_Z4);
@iradius_O_Ins = ($O_Ins_I5, $O_Ins_I4);
@oradius_O_Ins = ($O_Ins_O5, $O_Ins_O4);
for(my $i=0; $i<4 ; $i++)
{
my $s = $i + 1;
%detector = init_det();
$detector{"name"} = "ft_cal_outer_ins_m$s";
$detector{"mother"} = "ft_cal";
$detector{"description"} = "ft outer_ins_m$s";
$detector{"color"} = "F5F6CE";
$detector{"type"} = "Polycone";
my $biangle=$BCup_iangle[$i];
my $bdangle=$BCup_dangle[$i];
$dimen = "$biangle*deg $bdangle*deg $nplanes_O_Ins*counts";
for(my $i = 0; $i <$nplanes_O_Ins; $i++) {$dimen = $dimen ." $iradius_O_Ins[$i]*mm";}
for(my $i = 0; $i <$nplanes_O_Ins; $i++) {$dimen = $dimen ." $oradius_O_Ins[$i]*mm"; }
for(my $i = 0; $i <$nplanes_O_Ins; $i++) {$dimen = $dimen ." $z_plane_O_Ins[$i]*mm";}
$detector{"dimensions"} = $dimen;
$detector{"material"} = "insfoam";
$detector{"style"} = 1;
print_det(\%configuration, \%detector);
}
}
###########################################################################################
# Define the Outer Shell
sub make_ft_cal_shell
{
# outer front
my $nplanes_O_Shell = 5;
my @z_plane_O_Shell = ($O_Shell_Z1, $O_Shell_Z2, $O_Shell_Z2, $O_Shell_Z3, $O_Shell_Z4);
my @iradius_O_Shell = ($O_Shell_I1, $O_Shell_I1, $O_Shell_I2, $O_Shell_I3, $O_Shell_I4);
my @oradius_O_Shell = ($O_Shell_O1, $O_Shell_O2, $O_Shell_O2, $O_Shell_O3, $O_Shell_O4);
my %detector = init_det();
$detector{"name"} = "ft_cal_outer_shell_f";
$detector{"mother"} = "ft_cal";
$detector{"description"} = "ft outer_shell_f";
$detector{"color"} = "F5DA81";
$detector{"type"} = "Polycone";
my $dimen = "0.0*deg 360*deg $nplanes_O_Shell*counts";
for(my $i = 0; $i <$nplanes_O_Shell; $i++) {$dimen = $dimen ." $iradius_O_Shell[$i]*mm";}
for(my $i = 0; $i <$nplanes_O_Shell; $i++) {$dimen = $dimen ." $oradius_O_Shell[$i]*mm";}
for(my $i = 0; $i <$nplanes_O_Shell; $i++) {$dimen = $dimen ." $z_plane_O_Shell[$i]*mm";}
$detector{"dimensions"} = $dimen;
$detector{"material"} = "carbonFiber";
$detector{"style"} = 1;
print_det(\%configuration, \%detector);
# outer back
$nplanes_O_Shell = 8;
@z_plane_O_Shell = ($O_Shell_Z5, $O_Shell_Z6, $O_Shell_Z7, $O_Shell_Z8, $O_Shell_Z9, $O_Shell_Z10, $O_Shell_Z10, $O_Shell_Z11);
@iradius_O_Shell = ($O_Shell_I5, $O_Shell_I6, $O_Shell_I7, $O_Shell_I8, $O_Shell_I9, $O_Shell_I10, $O_Shell_I11, $O_Shell_I11);
@oradius_O_Shell = ($O_Shell_O5, $O_Shell_O6, $O_Shell_O7, $O_Shell_O8, $O_Shell_O9, $O_Shell_O10, $O_Shell_O10, $O_Shell_O11);
%detector = init_det();
$detector{"name"} = "ft_cal_outer_shell_b";
$detector{"mother"} = "ft_cal";
$detector{"description"} = "ft outer_shell_b";
$detector{"color"} = "F5DA81";
$detector{"type"} = "Polycone";
$dimen = "0.0*deg 360*deg $nplanes_O_Shell*counts";
for(my $i = 0; $i <$nplanes_O_Shell; $i++) {$dimen = $dimen ." $iradius_O_Shell[$i]*mm";}
for(my $i = 0; $i <$nplanes_O_Shell; $i++) {$dimen = $dimen ." $oradius_O_Shell[$i]*mm";}
for(my $i = 0; $i <$nplanes_O_Shell; $i++) {$dimen = $dimen ." $z_plane_O_Shell[$i]*mm";}
$detector{"dimensions"} = $dimen;
$detector{"material"} = "carbonFiber";
$detector{"style"} = 1;
print_det(\%configuration, \%detector);
# outer medium
$nplanes_O_Shell = 2;
@z_plane_O_Shell = ($O_Shell_Z5, $O_Shell_Z4);
@iradius_O_Shell = ($O_Shell_I5, $O_Shell_I4);
@oradius_O_Shell = ($O_Shell_O5, $O_Shell_O4);
for(my $i=0; $i<4 ; $i++)
{
my $s = $i + 1;
%detector = init_det();
$detector{"name"} = "ft_cal_outer_shell_m$s";
$detector{"mother"} = "ft_cal";
$detector{"description"} = "ft outer_shell $s";
$detector{"color"} = "F5DA81";
$detector{"type"} = "Polycone";
my $biangle=$BCup_iangle[$i];
my $bdangle=$BCup_dangle[$i];
$dimen = "$biangle*deg $bdangle*deg $nplanes_O_Shell*counts";
for(my $i = 0; $i <$nplanes_O_Shell; $i++) {$dimen = $dimen ." $iradius_O_Shell[$i]*mm";}
for(my $i = 0; $i <$nplanes_O_Shell; $i++) {$dimen = $dimen ." $oradius_O_Shell[$i]*mm"; }
for(my $i = 0; $i <$nplanes_O_Shell; $i++){$dimen = $dimen ." $z_plane_O_Shell[$i]*mm";}
$detector{"dimensions"} = $dimen;
$detector{"material"} = "carbonFiber";
$detector{"style"} = 1;
print_det(\%configuration, \%detector);
}
}
###########################################################################################
# Define the Calorimeter Beam line
sub make_ft_cal_beamline
{
# forward tagger tungsten beamline
my $nplanes_BLine = 6;
my @z_plane_BLine = ($BLine_Z1, $BLine_Z2, $BLine_Z2, $BLine_Z3, $BLine_Z3, $BLine_Z4);
my @oradius_BLine = ($BLine_MR, $BLine_MR, $BLine_MR, $BLine_MR, $BLine_OR, $BLine_OR);
my @iradius_BLine = ($BLine_IR, $BLine_IR, $BLine_IR, $BLine_IR, $BLine_IR, $BLine_IR);
my %detector = init_det();
$detector{"name"} = "ft_cal_bline";
$detector{"mother"} = "ft_cal";
$detector{"description"} = "ft beam line";
$detector{"color"} = "ccff00";
$detector{"type"} = "Polycone";
my $dimen = "0.0*deg 360*deg $nplanes_BLine*counts";
for(my $i = 0; $i <$nplanes_BLine ; $i++) {$dimen = $dimen ." $iradius_BLine[$i]*mm";}
for(my $i = 0; $i <$nplanes_BLine ; $i++) {$dimen = $dimen ." $oradius_BLine[$i]*mm";}
for(my $i = 0; $i <$nplanes_BLine ; $i++) {$dimen = $dimen ." $z_plane_BLine[$i]*mm";}
$detector{"dimensions"} = $dimen;
$detector{"material"} = "G4_W";
$detector{"style"} = 1;
print_det(\%configuration, \%detector);
my $TPlate_IR= $BLine_IR + $BLine_TN;
my $TPlate_OR= $BCup_ORE;
my $nplanes_TPlate = 2;
my @z_plane_TPlate = ($TPlate_Z1, $TPlate_Z2);
my @oradius_TPlate = ($TPlate_OR, $TPlate_OR);
my @iradius_TPlate = ($TPlate_IR, $TPlate_IR);
# tungsten plate on the back of the calorimeter
%detector = init_det();
$detector{"name"} = "ft_cal_tplate";
$detector{"mother"} = "ft_cal";
$detector{"description"} = "ft tungsten plate";
$detector{"color"} = "ccff00";
$detector{"type"} = "Polycone";
$dimen = "0.0*deg 360*deg $nplanes_TPlate*counts";
for(my $i = 0; $i <$nplanes_TPlate ; $i++) {$dimen = $dimen ." $iradius_TPlate[$i]*mm";}
for(my $i = 0; $i <$nplanes_TPlate ; $i++) {$dimen = $dimen ." $oradius_TPlate[$i]*mm";}
for(my $i = 0; $i <$nplanes_TPlate ; $i++) {$dimen = $dimen ." $z_plane_TPlate[$i]*mm";}
$detector{"dimensions"} = $dimen;
$detector{"material"} = "G4_W";
$detector{"style"} = 1;
print_det(\%configuration, \%detector);
# steel collar on the front
my $nplanes_TCollar = 2;