forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathV3Cage.cxx
More file actions
1796 lines (1483 loc) · 65.1 KB
/
V3Cage.cxx
File metadata and controls
1796 lines (1483 loc) · 65.1 KB
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 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \file V3Cage.cxx
/// \brief Implementation of the V3Cage class
/// \author Mario Sitta <sitta@to.infn.it>
#include "ITSSimulation/V3Cage.h"
#include "ITSSimulation/V11Geometry.h"
#include "ITSBase/GeometryTGeo.h"
#include <fairlogger/Logger.h> // for LOG
#include <TGeoArb8.h> // for TGeoArb8
#include <TGeoBBox.h> // for TGeoBBox
#include <TGeoCone.h> // for TGeoConeSeg, TGeoCone
#include <TGeoPcon.h> // for TGeoPcon
#include <TGeoManager.h> // for TGeoManager, gGeoManager
#include <TGeoMatrix.h> // for TGeoCombiTrans, TGeoRotation, etc
// #include <TGeoTrd1.h> // for TGeoTrd1
#include <TGeoTube.h> // for TGeoTube, TGeoTubeSeg
#include <TGeoVolume.h> // for TGeoVolume, TGeoVolumeAssembly
#include <TGeoXtru.h> // for TGeoXtru
#include <TGeoCompositeShape.h> // for TGeoCompositeShape
#include <TMathBase.h> // for Abs
#include <TMath.h> // for Sin, RadToDeg, DegToRad, Cos, Tan, etc
#include <cstdio> // for snprintf
class TGeoMedium;
using namespace TMath;
using namespace o2::its;
// Parameters
const Double_t V3Cage::sCageYInBarrel = 30. * sCm; // This is hardcoded in Detector.cxx
// Cover element (each)
const Double_t V3Cage::sCageCoverZLength = 586.0 * sMm;
const Double_t V3Cage::sCageCoverRint = 540.0 * sMm;
const Double_t V3Cage::sCageCoverRext = 550.0 * sMm;
const Double_t V3Cage::sCageCoverXWidth = 982.0 * sMm;
const Double_t V3Cage::sCageCoverXBaseInt = 944.0 * sMm;
const Double_t V3Cage::sCageCoverXBaseExt = 948.0 * sMm;
const Double_t V3Cage::sCageCoverYBaseHeight = 245.0 * sMm;
const Double_t V3Cage::sCageCoverCoreRint = 541.0 * sMm;
const Double_t V3Cage::sCageCoverCoreRext = 549.0 * sMm;
const Double_t V3Cage::sCageCoverSheetThick = 2 * sMm;
const Double_t V3Cage::sCageCoverRibZLength = 25.0 * sMm;
const Double_t V3Cage::sCageCoverRibRint = 540.0 * sMm;
const Double_t V3Cage::sCageCoverRibRext = 548.0 * sMm;
const Double_t V3Cage::sCageCoverRibXWidth = 984.8 * sMm;
const Double_t V3Cage::sCageCoverRibXBaseInt = 944.0 * sMm;
const Double_t V3Cage::sCageCoverRibYBaseHi = 245.0 * sMm;
const Double_t V3Cage::sCageCoverRibFoldHi = 31.5 * sMm;
const Double_t V3Cage::sCageSidePanelLength = 3457.0 * sMm;
const Double_t V3Cage::sCageSidePanelWidth = 490.0 * sMm;
const Double_t V3Cage::sCageSidePanelFoilThick = 1.0 * sMm;
const Double_t V3Cage::sCageSidePanelCoreThick = 20.0 * sMm;
const Double_t V3Cage::sCageSidePanelXDist = 988.0 * sMm;
const Double_t V3Cage::sCageSidePanelRail1Len = 3320.0 * sMm;
const Double_t V3Cage::sCageSidePanelRail2Len = 1550.0 * sMm;
const Double_t V3Cage::sCageSidePanelRail3Len = 302.0 * sMm;
const Double_t V3Cage::sCageSidePanelRailWidth = 25.0 * sMm;
const Double_t V3Cage::sCageSidePanelRailSpan = 20.0 * sMm;
const Double_t V3Cage::sCageSidePanelRailHThik = 5.0 * sMm;
const Double_t V3Cage::sCageSidePanelRailVThik = 2.5 * sMm;
const Double_t V3Cage::sCageSidePanelGuideLen = 3587.0 * sMm;
const Double_t V3Cage::sCageSidePanelGuideInHi = 204.0 * sMm;
const Double_t V3Cage::sCageSidePanelGuideWide = 44.0 * sMm;
const Double_t V3Cage::sCageSidePanelGuidThik1 = 6.0 * sMm;
const Double_t V3Cage::sCageSidePanelGuidThik2 = 8.0 * sMm;
const Double_t V3Cage::sCageSidePanelMidBarWid = 15.0 * sMm;
const Double_t V3Cage::sCageSidePanelSidBarWid = 15.0 * sMm;
const Double_t V3Cage::sCageSidePanelRail1Ypos[2] = {226.5 * sMm, 147.5 * sMm};
const Double_t V3Cage::sCageSidePanelRail2Ypos = 74.5 * sMm;
const Double_t V3Cage::sCageSidePanelRail3Ypos[3] = {180.0 * sMm, 107.0 * sMm, 24.0 * sMm};
const Double_t V3Cage::sCageEndCapDext = 1096.0 * sMm;
const Double_t V3Cage::sCageEndCapDint = 304.0 * sMm;
const Double_t V3Cage::sCageEndCapFoamThick = 8.0 * sMm;
const Double_t V3Cage::sCageEndCapFabThick = 1.0 * sMm;
const Double_t V3Cage::sCageEndCapXWidth = 988.0 * sMm;
const Double_t V3Cage::sCageEndCapSideHoleR = 32.0 * sMm;
const Double_t V3Cage::sCageEndCapSideHoleX = 532.0 * sMm;
const Double_t V3Cage::sCageEndCapCableCutWid = 268.0 * sMm;
const Double_t V3Cage::sCageEndCapCableCutR = 408.5 * sMm;
const Double_t V3Cage::sCageEndCapCableCutPhi = 25.0; // Deg
const Double_t V3Cage::sCageECRoundCrossDmin = 300 * sMm;
const Double_t V3Cage::sCageECRoundCrossDmid = 303 * sMm;
const Double_t V3Cage::sCageECRoundCrossDmax = 312 * sMm;
const Double_t V3Cage::sCageECRoundCrossZext = 6 * sMm;
const Double_t V3Cage::sCageECRoundCrossZint = 5 * sMm;
const Double_t V3Cage::sCageECCableCrosTotHi = 139.0 * sMm;
const Double_t V3Cage::sCageECCableCrosTotZ = 12 * sMm;
const Double_t V3Cage::sCageECCableCrosInXWid = 266.8 * sMm;
const Double_t V3Cage::sCageECCableCrosInThik = 4 * sMm;
const Double_t V3Cage::sCageECCableCrosInZLen = 10.2 * sMm;
const Double_t V3Cage::sCageECCableCrosSidWid = 8 * sMm;
const Double_t V3Cage::sBPSuppCollarIntD = 53 * sMm;
const Double_t V3Cage::sBPSuppCollarExtD = 57 * sMm;
const Double_t V3Cage::sBPSuppCollarBushD = 52 * sMm;
const Double_t V3Cage::sBPSuppUpperCollarLen = 78 * sMm;
const Double_t V3Cage::sBPSuppUpperCollarHei = 4 * sMm;
const Double_t V3Cage::sBPSuppLowerCollarLen = 151 * sMm;
const Double_t V3Cage::sBPSuppLowerCollarTlX = 40.5 * sMm;
const Double_t V3Cage::sBPSuppLowCollHolDist = 100 * sMm;
const Double_t V3Cage::sBPSuppLowCollTailHei = 6 * sMm;
const Double_t V3Cage::sBPSuppCollarBeamLen = 370 * sMm;
const Double_t V3Cage::sBPSuppCollarBeamWid = 40 * sMm;
const Double_t V3Cage::sBPSuppCollarBeamHei = 12 * sMm;
const Double_t V3Cage::sBPSuppBracketTotLen = 57 * sMm;
const Double_t V3Cage::sBPSuppBracketWidth = 25 * sMm;
const Double_t V3Cage::sBPSuppBracketInLen = 20 * sMm;
const Double_t V3Cage::sBPSuppBracketInHei = 8 * sMm;
const Double_t V3Cage::sBPSuppBracketTailLen = 18.5 * sMm;
const Double_t V3Cage::sBPSuppBracketTailHei = 3 * sMm;
const Double_t V3Cage::sBPSuppBrktCentHoleX = 31.5 * sMm;
const Double_t V3Cage::sBPSuppBrktCentHoleD = 6 * sMm;
const Double_t V3Cage::sBPSuppBrktLatHoleX = 24.5 * sMm;
const Double_t V3Cage::sBPSuppBrktLatHoleD = 3.2 * sMm;
const Double_t V3Cage::sBPSuppBrktLatHoleW = 4 * sMm;
const Double_t V3Cage::sBPSuppBrktLatHoleH = 2.5 * sMm;
const Double_t V3Cage::sBPSuppBrktHolesY = 0.5 * sMm;
const Double_t V3Cage::sBPSuppCollarM4High = 2.2 * sMm;
const Double_t V3Cage::sBPSuppCollarM4Diam = 7.5 * sMm;
const Double_t V3Cage::sBPSuppCollarM4XDist = 68 * sMm;
const Double_t V3Cage::sBPSuppCollarM4ZPos = 7 * sMm;
const Double_t V3Cage::sBPSuppClampTotLen = 55 * sMm;
const Double_t V3Cage::sBPSuppClampTotWid = 23 * sMm;
const Double_t V3Cage::sBPSuppClampTotHei = 13 * sMm;
const Double_t V3Cage::sBPSuppClampLatThick = 5 * sMm;
const Double_t V3Cage::sBPSuppClampShelfLen = 25 * sMm;
const Double_t V3Cage::sBPSuppClampShelfHei = 4.5 * sMm;
const Double_t V3Cage::sBPSuppClampsXDist = 944 * sMm;
const Double_t V3Cage::sBPSuppClampInsDmin = 7 * sMm;
const Double_t V3Cage::sBPSuppClampInsDmax = 11 * sMm;
const Double_t V3Cage::sBPSuppClampInsH = 2.9 * sMm;
const Double_t V3Cage::sBPSuppClampInsXPos = 15 * sMm;
const Double_t V3Cage::sBPSuppClampInsZPos = 7 * sMm;
const Double_t V3Cage::sBPSuppClampShimLen = 26 * sMm;
const Double_t V3Cage::sBPSuppClampShimWid = 15 * sMm;
const Double_t V3Cage::sBPSuppClampShimThick = 2.5 * sMm;
const Double_t V3Cage::sBPSuppClampM5High = 2.7 * sMm;
const Double_t V3Cage::sBPSuppClampM5Diam = 8.5 * sMm;
const Double_t V3Cage::sBPSuppClampM5ZPos = 20 * sMm;
const Double_t V3Cage::sBPSuppZPos = 1801 * sMm;
const Double_t V3Cage::sCageCrossXWidthTot = 973 * sMm;
const Double_t V3Cage::sCageCrossXWidthExt = 944 * sMm;
const Double_t V3Cage::sCageCrossXWidthInt = 904 * sMm;
const Double_t V3Cage::sCageCrossYHeightTot = 244 * sMm;
const Double_t V3Cage::sCageCrossYHeightInt = 220 * sMm;
const Double_t V3Cage::sCageCrossYMid = (126 + 5.5) * sMm;
const Double_t V3Cage::sCageCrossZLength = 8 * sMm;
const Double_t V3Cage::sCageCrossBarThick = 20 * sMm;
const Double_t V3Cage::sCageCrossBarPhi = 25; // Deg
const Double_t V3Cage::sCageMFTRailZLen = 1807 * sMm;
const Double_t V3Cage::sCageMFTRailTotWidth = 27 * sMm;
const Double_t V3Cage::sCageMFTRailExtWidth = 24 * sMm;
const Double_t V3Cage::sCageMFTRailIntWidth = 17.5 * sMm;
const Double_t V3Cage::sCageMFTRailBaseWidth = 22 * sMm;
const Double_t V3Cage::sCageMFTRailTotHeight = 8.9 * sMm;
const Double_t V3Cage::sCageMFTRailExtHeight = 5.9 * sMm;
const Double_t V3Cage::sCageMFTRailIntHeight = 3.5 * sMm;
const Double_t V3Cage::sCageMFTRailsXDist = 44 * sMm;
ClassImp(V3Cage);
V3Cage::V3Cage()
: V11Geometry()
{
}
V3Cage::V3Cage(const char* name)
: V11Geometry(0, name)
{
}
V3Cage::~V3Cage() = default;
void V3Cage::createAndPlaceCage(TGeoVolume* mother, const TGeoManager* mgr)
{
//
// Creates the Cage elements and place them into the mother volume
//
// Input:
// mother : the mother volume hosting the whole Cage
// mgr : the GeoManager (used only to get the proper material)
//
// Output:
//
// Return:
//
// Created: 22 Apr 2022 Mario Sitta
//
// Local variables
Double_t zunit, xpos, ypos, zpos;
// Create the cover elements
TGeoVolume* cageCover = createCageCover(mgr);
TGeoVolume* cageCoverRib = createCageCoverRib(mgr);
TGeoVolume* cageEndCap = createCageEndCap(mgr);
TGeoVolume* cageSidePanel = createCageSidePanel(mgr);
TGeoVolume* cageBPSupport = createBeamPipeSupport(mgr);
TGeoVolume* cageClosingCross = createCageClosingCross(mgr);
// Now place all elements
mother->AddNode(cageCover, 1, new TGeoTranslation(0, sCageYInBarrel, 0));
mother->AddNode(cageCover, 2, new TGeoCombiTrans(0, sCageYInBarrel, 0, new TGeoRotation("", 180, 0, 0)));
zunit = (sCageCoverZLength + sCageCoverRibZLength) / 2.;
zpos = zunit;
mother->AddNode(cageCoverRib, 1, new TGeoTranslation(0, sCageYInBarrel, zpos));
mother->AddNode(cageCoverRib, 2, new TGeoCombiTrans(0, sCageYInBarrel, zpos, new TGeoRotation("", 180, 0, 0)));
mother->AddNode(cageCoverRib, 3, new TGeoTranslation(0, sCageYInBarrel, -zpos));
mother->AddNode(cageCoverRib, 4, new TGeoCombiTrans(0, sCageYInBarrel, -zpos, new TGeoRotation("", 180, 0, 0)));
zpos = 2 * zunit;
mother->AddNode(cageCover, 3, new TGeoTranslation(0, sCageYInBarrel, zpos));
mother->AddNode(cageCover, 4, new TGeoCombiTrans(0, sCageYInBarrel, zpos, new TGeoRotation("", 180, 0, 0)));
mother->AddNode(cageCover, 5, new TGeoTranslation(0, sCageYInBarrel, -zpos));
mother->AddNode(cageCover, 6, new TGeoCombiTrans(0, sCageYInBarrel, -zpos, new TGeoRotation("", 180, 0, 0)));
zpos += sCageCoverZLength / 2;
Double_t zposSP = -zpos + sCageSidePanelLength / 2;
xpos = sCageSidePanelXDist / 2 - sCageSidePanelCoreThick / 2 - sCageSidePanelFoilThick;
mother->AddNode(cageSidePanel, 1, new TGeoTranslation(xpos, sCageYInBarrel, zposSP));
mother->AddNode(cageSidePanel, 2, new TGeoCombiTrans(-xpos, sCageYInBarrel, zposSP, new TGeoRotation("", 180, 0, 0)));
Double_t zposCC = -zpos + sCageSidePanelLength + sCageCrossZLength / 2;
mother->AddNode(cageClosingCross, 1, new TGeoTranslation(0, sCageYInBarrel, zposCC));
mother->AddNode(cageClosingCross, 2, new TGeoCombiTrans(0, sCageYInBarrel, zposCC, new TGeoRotation("", 0, 180, 0)));
// The end cap is only on C side
zpos += sCageECCableCrosTotZ / 2;
mother->AddNode(cageEndCap, 1, new TGeoTranslation(0, sCageYInBarrel, -zpos));
// Third ribs are only on A side
zpos = 3 * zunit;
mother->AddNode(cageCoverRib, 5, new TGeoTranslation(0, sCageYInBarrel, zpos));
mother->AddNode(cageCoverRib, 6, new TGeoCombiTrans(0, sCageYInBarrel, zpos, new TGeoRotation("", 180, 0, 0)));
// The Beam Pipe Support on A side
ypos = sCageYInBarrel - sBPSuppLowCollTailHei / 2;
zpos = sBPSuppZPos + sBPSuppCollarBeamWid / 2;
mother->AddNode(cageBPSupport, 1, new TGeoTranslation(0, ypos, zpos));
// The MFT Rails inside the Cage
createAndPlaceMFTRailsInsideCage(mother, mgr);
return;
}
TGeoVolume* V3Cage::createCageCover(const TGeoManager* mgr)
{
//
// Creates a Cage cover element (from drawings ALIITSUP0226, ALIITSUP0225)
//
// Input:
// mgr : the GeoManager (used only to get the proper material)
//
// Output:
//
// Return:
// The cover as a TGeoVolume
//
// Created: 22 Apr 2022 Mario Sitta
//
// Local variables
static const Int_t coverFoldNVert = 6;
Double_t xvert[coverFoldNVert], yvert[coverFoldNVert];
Double_t halfBase, zlen, alpha;
zlen = 0.5 * sCageCoverZLength;
// The cover core: a TGeoTubeSeg
halfBase = 0.5 * sCageCoverXBaseInt - sCageCoverSheetThick;
alpha = TMath::ACos(halfBase / sCageCoverCoreRext) * TMath::RadToDeg();
TGeoTubeSeg* coreSh = new TGeoTubeSeg("coverCore", sCageCoverCoreRint, sCageCoverCoreRext, zlen, alpha, 180. - alpha);
// The upper and lower sheets: a TGeoTubeSeg
// (as a whole volume - will become a sheet when the core is inserted inside)
halfBase = 0.5 * sCageCoverXBaseInt;
alpha = TMath::ACos(halfBase / sCageCoverRint) * TMath::RadToDeg();
TGeoTubeSeg* sheet = new TGeoTubeSeg("coverSheet", sCageCoverRint, sCageCoverCoreRext, zlen, alpha, 180. - alpha);
// The lateral fold: a Xtru
xvert[0] = sCageCoverXBaseExt / 2.;
yvert[0] = sCageCoverYBaseHeight + sCageCoverSheetThick;
xvert[1] = sCageCoverXWidth / 2.;
yvert[1] = yvert[0];
xvert[2] = xvert[1];
yvert[2] = sCageCoverYBaseHeight;
xvert[3] = sCageCoverXBaseInt / 2.;
yvert[3] = yvert[2];
xvert[4] = xvert[3];
yvert[4] = TMath::Sqrt(sCageCoverRint * sCageCoverRint - sCageCoverXBaseInt * sCageCoverXBaseInt / 4) + sCageCoverSheetThick;
xvert[5] = xvert[0];
yvert[5] = yvert[4];
TGeoXtru* fold = new TGeoXtru(2);
fold->SetName("coverFold");
fold->DefinePolygon(coverFoldNVert, xvert, yvert);
fold->DefineSection(0, -zlen);
fold->DefineSection(1, zlen);
// A BBox to cut away the curved portion above the fold
TGeoBBox* cutfold = new TGeoBBox("cutFold", xvert[1] - xvert[0], yvert[5] - yvert[1], 1.05 * zlen);
// Some matrices to create the composite shape
TGeoRotation* rotfold = new TGeoRotation("rotFold", 180, 180, 0);
rotfold->RegisterYourself();
TGeoTranslation* cutbox1 = new TGeoTranslation("cutBox1", xvert[1], yvert[5], 0);
cutbox1->RegisterYourself();
TGeoTranslation* cutbox2 = new TGeoTranslation("cutBox2", -xvert[1], yvert[5], 0);
cutbox2->RegisterYourself();
// The cover shape: a CompositeShape
TGeoCompositeShape* coverSh = new TGeoCompositeShape("coverSheet-cutFold:cutBox1-cutFold:cutBox2+coverFold+coverFold:rotFold");
// We have all shapes: now create the real volumes
TGeoMedium* medRohacell = mgr->GetMedium(Form("%s_ROHACELL$", GetDetName()));
TGeoMedium* medPrepreg = mgr->GetMedium(Form("%s_M46J6K$", GetDetName()));
TGeoVolume* coverVol = new TGeoVolume("CageCover", coverSh, medPrepreg);
coverVol->SetFillColor(kBlue);
coverVol->SetLineColor(kBlue);
TGeoVolume* coverCoreVol = new TGeoVolume("CageCoverCore", coreSh, medRohacell);
coverCoreVol->SetFillColor(kYellow);
coverCoreVol->SetLineColor(kYellow);
coverVol->AddNode(coverCoreVol, 1, nullptr);
// Finally return the cover volume
return coverVol;
}
TGeoVolume* V3Cage::createCageCoverRib(const TGeoManager* mgr)
{
//
// Creates a Cage cover rib element (from drawing ALIITSUP0228)
//
// Input:
// mgr : the GeoManager (used only to get the proper material)
//
// Output:
//
// Return:
// The cover rib as a TGeoVolume
//
// Created: 22 Apr 2022 Mario Sitta
//
// Local variables
static const Int_t ribFoldNVert = 3;
Double_t xvert[ribFoldNVert], yvert[ribFoldNVert];
Double_t halfBase, zlen, alpha;
zlen = 0.5 * sCageCoverRibZLength;
// The rib main segment: a TGeoTubeSeg
halfBase = 0.5 * sCageCoverRibXBaseInt;
alpha = TMath::ACos(halfBase / sCageCoverRibRint) * TMath::RadToDeg();
TGeoTubeSeg* mainSh = new TGeoTubeSeg("coverRibMain", sCageCoverRibRint, sCageCoverRibRext, zlen, alpha, 180. - alpha);
// The lateral fold: a Xtru
xvert[0] = sCageCoverRibXWidth / 2.;
yvert[0] = sCageCoverRibYBaseHi;
xvert[1] = sCageCoverRibXBaseInt / 2.;
yvert[1] = yvert[0];
xvert[2] = xvert[1];
yvert[2] = yvert[1] + sCageCoverRibFoldHi;
TGeoXtru* fold = new TGeoXtru(2);
fold->SetName("coverRibFold");
fold->DefinePolygon(ribFoldNVert, xvert, yvert);
fold->DefineSection(0, -zlen);
fold->DefineSection(1, zlen);
// Some matrices to create the composite shape
TGeoRotation* rotfold = new TGeoRotation("rotRibFold", 180, 180, 0);
rotfold->RegisterYourself();
// The cover rib shape: a CompositeShape
TGeoCompositeShape* ribSh = new TGeoCompositeShape("coverRibMain+coverRibFold+coverRibFold:rotRibFold");
// We have all shapes: now create the real volume
TGeoMedium* medAl = mgr->GetMedium(Form("%s_ALUMINUM$", GetDetName()));
TGeoVolume* ribVol = new TGeoVolume("CageCoverRib", ribSh, medAl);
ribVol->SetFillColor(kGray);
ribVol->SetLineColor(kGray);
// Finally return the cover rib volume
return ribVol;
}
TGeoVolume* V3Cage::createCageSidePanel(const TGeoManager* mgr)
{
//
// Creates the Cage Side Panel (from drawings ALIITSUP0247, ALIITSUP0248,
// ALIITSUP0243, ALIITSUP0244, ALIITSUP0280, ALIITSUP0245)
//
// Input:
// mgr : the GeoManager (used only to get the proper material)
//
// Output:
//
// Return:
// The side panel as a TGeoVolumeAssembly
//
// Created: 30 Sep 2022 Mario Sitta
// Updated: 20 May 2023 Mario Sitta Mid and side bars added
//
// Local variables
Double_t xlen, ylen, zlen;
Double_t xpos, ypos, zpos;
// The TGeoVolumeAssembly holding all elements
TGeoVolumeAssembly* sidePanelVol = new TGeoVolumeAssembly("CageSidePanel");
// The inner foil: a TGeoCompositeShape
TGeoCompositeShape* inFoilSh = createCageSidePanelCoreFoil(sCageSidePanelFoilThick, "foil");
// The outer foil: a BBox (each)
xlen = sCageSidePanelFoilThick / 2;
ylen = sCageSidePanelWidth / 2;
zlen = sCageSidePanelLength / 2;
TGeoBBox* outFoilSh = new TGeoBBox(xlen, ylen, zlen);
// The intermediate core layer: a TGeoCompositeShape
TGeoCompositeShape* coreSh = createCageSidePanelCoreFoil(sCageSidePanelCoreThick, "core");
// The longest rails
TGeoCompositeShape* rail1Sh = createCageSidePanelRail(sCageSidePanelRail1Len, 1);
// The intermediate rails
TGeoCompositeShape* rail2Sh = createCageSidePanelRail(sCageSidePanelRail2Len, 2);
// The shortest rails
TGeoCompositeShape* rail3Sh = createCageSidePanelRail(sCageSidePanelRail3Len, 3);
// The middle bar: a BBox
xlen = sCageSidePanelCoreThick / 2;
ylen = sCageSidePanelMidBarWid / 2;
zlen = (sCageSidePanelLength - sCageSidePanelRail3Len - sCageSidePanelSidBarWid) / 2;
TGeoBBox* midBarSh = new TGeoBBox(xlen, ylen, zlen);
// The side bar: a BBox
xlen = sCageSidePanelCoreThick / 2;
ylen = sCageSidePanelWidth / 2;
zlen = sCageSidePanelSidBarWid / 2;
TGeoBBox* sidBarSh = new TGeoBBox(xlen, ylen, zlen);
// The elements of the guide:
// - the vertical part: a BBox
xlen = sCageSidePanelGuidThik2 / 2;
ylen = sCageSidePanelGuideInHi / 2;
zlen = sCageSidePanelGuideLen / 2;
TGeoBBox* guideVert = new TGeoBBox(xlen, ylen, zlen);
guideVert->SetName("guidevert");
// - the horizontal part: a BBox
xlen = sCageSidePanelGuideWide / 2;
ylen = sCageSidePanelGuidThik1 / 2;
TGeoBBox* guideHor = new TGeoBBox(xlen, ylen, zlen);
guideHor->SetName("guidehor");
xpos = (sCageSidePanelGuideWide - sCageSidePanelGuidThik2) / 2;
ypos = (sCageSidePanelGuidThik1 + sCageSidePanelGuideInHi) / 2;
TGeoTranslation* guideHorMat1 = new TGeoTranslation(xpos, ypos, 0);
guideHorMat1->SetName("guidehormat1");
guideHorMat1->RegisterYourself();
TGeoTranslation* guideHorMat2 = new TGeoTranslation(xpos, -ypos, 0);
guideHorMat2->SetName("guidehormat2");
guideHorMat2->RegisterYourself();
// The actual guide: a CompositeShape
TGeoCompositeShape* guideSh = new TGeoCompositeShape("guidevert+guidehor:guidehormat1+guidehor:guidehormat2");
// We have all shapes: now create the real volume
TGeoMedium* medFabric = mgr->GetMedium(Form("%s_M46J6K$", GetDetName()));
TGeoMedium* medFoam = mgr->GetMedium(Form("%s_ROHACELL$", GetDetName()));
TGeoMedium* medAlAlloy = mgr->GetMedium(Form("%s_ENAW7075$", GetDetName()));
TGeoVolume* inFoilVol = new TGeoVolume("CageSidePanelInFoil", inFoilSh, medFabric);
inFoilVol->SetFillColor(kBlue);
inFoilVol->SetLineColor(kBlue);
TGeoVolume* outFoilVol = new TGeoVolume("CageSidePanelOutFoil", outFoilSh, medFabric);
outFoilVol->SetFillColor(kBlue);
outFoilVol->SetLineColor(kBlue);
TGeoVolume* coreVol = new TGeoVolume("CageSidePanelCore", coreSh, medFoam);
coreVol->SetFillColor(kYellow);
coreVol->SetLineColor(kYellow);
TGeoVolume* rail1Vol = new TGeoVolume("CageSidePanelRail1st", rail1Sh, medAlAlloy);
rail1Vol->SetFillColor(kGray);
rail1Vol->SetLineColor(kGray);
TGeoVolume* rail2Vol = new TGeoVolume("CageSidePanelRail2nd", rail2Sh, medAlAlloy);
rail2Vol->SetFillColor(kGray);
rail2Vol->SetLineColor(kGray);
TGeoVolume* rail3Vol = new TGeoVolume("CageSidePanelRail3rd", rail3Sh, medAlAlloy);
rail3Vol->SetFillColor(kGray);
rail3Vol->SetLineColor(kGray);
TGeoVolume* midBarVol = new TGeoVolume("CageSidePanelMiddleBar", midBarSh, medAlAlloy);
midBarVol->SetFillColor(kGray);
midBarVol->SetLineColor(kGray);
TGeoVolume* sidBarVol = new TGeoVolume("CageSidePanelSideBar", sidBarSh, medAlAlloy);
sidBarVol->SetFillColor(kGray);
sidBarVol->SetLineColor(kGray);
TGeoVolume* guideVol = new TGeoVolume("CageSidePanelGuide", guideSh, medFabric);
guideVol->SetFillColor(kViolet);
guideVol->SetLineColor(kViolet);
// Then build up the panel
sidePanelVol->AddNode(coreVol, 1, nullptr);
xpos = (sCageSidePanelCoreThick + sCageSidePanelFoilThick) / 2;
sidePanelVol->AddNode(inFoilVol, 1, new TGeoTranslation(-xpos, 0, 0));
sidePanelVol->AddNode(outFoilVol, 1, new TGeoTranslation(xpos, 0, 0));
xpos = (sCageSidePanelCoreThick - sCageSidePanelRailVThik) / 2;
zpos = (sCageSidePanelLength - sCageSidePanelRail1Len) / 2;
for (Int_t j = 0; j < 2; j++) {
ypos = sCageSidePanelRail1Ypos[j];
sidePanelVol->AddNode(rail1Vol, j + 1, new TGeoTranslation(xpos, ypos, zpos));
sidePanelVol->AddNode(rail1Vol, j + 3, new TGeoTranslation(xpos, -ypos, zpos));
}
zpos = (sCageSidePanelLength - sCageSidePanelRail2Len) / 2;
ypos = sCageSidePanelRail2Ypos;
sidePanelVol->AddNode(rail2Vol, 1, new TGeoTranslation(xpos, ypos, zpos));
sidePanelVol->AddNode(rail2Vol, 2, new TGeoTranslation(xpos, -ypos, zpos));
zpos = (sCageSidePanelLength - sCageSidePanelRail3Len) / 2;
for (Int_t j = 0; j < 3; j++) {
ypos = sCageSidePanelRail3Ypos[j];
sidePanelVol->AddNode(rail3Vol, j + 1, new TGeoTranslation(xpos, ypos, zpos));
sidePanelVol->AddNode(rail3Vol, j + 4, new TGeoTranslation(xpos, -ypos, zpos));
}
zpos = sCageSidePanelLength / 2 - midBarSh->GetDZ() - sCageSidePanelSidBarWid;
sidePanelVol->AddNode(midBarVol, 1, new TGeoTranslation(0, 0, -zpos));
zpos = sCageSidePanelLength / 2 - sidBarSh->GetDZ();
sidePanelVol->AddNode(sidBarVol, 1, new TGeoTranslation(0, 0, -zpos));
xpos = sCageSidePanelCoreThick / 2 + sCageSidePanelFoilThick + sCageSidePanelGuidThik2 / 2;
zpos = (sCageSidePanelLength - sCageSidePanelGuideLen) / 2;
sidePanelVol->AddNode(guideVol, 1, new TGeoTranslation(xpos, 0, -zpos));
// Finally return the side panel volume
return sidePanelVol;
}
TGeoCompositeShape* V3Cage::createCageSidePanelCoreFoil(const Double_t xthick, const char* shpref)
{
//
// Creates the shape of the core and the internal foil of the
// Cage Side Panel, which contain proper cuts to host the rails
//
// Input:
// xthick : the shape thickness along X
// shpref : prefix of the shape name
//
// Output:
//
// Return:
// The side panel core or foil as a TGeoCompositeShape
//
// Created: 07 Oct 2022 Mario Sitta
// Updated: 20 May 2023 Mario Sitta Mid and side bars added
//
// Local variables
Double_t xlen, ylen, zlen;
Double_t ypos, zpos;
// The main body: a BBox
xlen = xthick / 2;
ylen = sCageSidePanelWidth / 2;
zlen = sCageSidePanelLength / 2;
TGeoBBox* bodySh = new TGeoBBox(xlen, ylen, zlen);
bodySh->SetName(Form("%sbodyshape", shpref));
// The hole for the longest rails (approx): a BBox
xlen = 1.1 * xthick / 2;
ylen = sCageSidePanelRailWidth / 2;
zlen = sCageSidePanelRail1Len;
TGeoBBox* rail1Sh = new TGeoBBox(xlen, ylen, zlen);
rail1Sh->SetName(Form("%slongrail", shpref));
zpos = sCageSidePanelLength / 2;
TGeoTranslation* rail1Mat[4];
for (Int_t j = 0; j < 2; j++) {
ypos = sCageSidePanelRail1Ypos[j];
rail1Mat[j] = new TGeoTranslation(0, ypos, zpos);
rail1Mat[j]->SetName(Form("longrailmat%d", j));
rail1Mat[j]->RegisterYourself();
rail1Mat[j + 2] = new TGeoTranslation(0, -ypos, zpos);
rail1Mat[j + 2]->SetName(Form("longrailmat%d", j + 2));
rail1Mat[j + 2]->RegisterYourself();
}
// The hole for the intermediate rails (approx): a BBox
zlen = sCageSidePanelRail2Len;
TGeoBBox* rail2Sh = new TGeoBBox(xlen, ylen, zlen);
rail2Sh->SetName(Form("%smedrail", shpref));
ypos = sCageSidePanelRail2Ypos;
TGeoTranslation* rail2Mat[2];
rail2Mat[0] = new TGeoTranslation(0, ypos, zpos);
rail2Mat[0]->SetName("medrailmat0");
rail2Mat[0]->RegisterYourself();
rail2Mat[1] = new TGeoTranslation(0, -ypos, zpos);
rail2Mat[1]->SetName("medrailmat1");
rail2Mat[1]->RegisterYourself();
// The hole for the shortest rails (approx): a BBox
zlen = sCageSidePanelRail3Len;
TGeoBBox* rail3Sh = new TGeoBBox(xlen, ylen, zlen);
rail3Sh->SetName(Form("%sshortrail", shpref));
TGeoTranslation* rail3Mat[6];
for (Int_t j = 0; j < 3; j++) {
ypos = sCageSidePanelRail3Ypos[j];
rail3Mat[j] = new TGeoTranslation(0, ypos, zpos);
rail3Mat[j]->SetName(Form("shortrailmat%d", j));
rail3Mat[j]->RegisterYourself();
rail3Mat[j + 3] = new TGeoTranslation(0, -ypos, zpos);
rail3Mat[j + 3]->SetName(Form("shortrailmat%d", j + 3));
rail3Mat[j + 3]->RegisterYourself();
}
// The hole for the middle bar: a BBox
xlen = 1.1 * sCageSidePanelCoreThick / 2;
ylen = sCageSidePanelMidBarWid / 2;
zlen = (sCageSidePanelLength - sCageSidePanelRail3Len) / 2;
TGeoBBox* midBarHol = new TGeoBBox(xlen, ylen, zlen);
midBarHol->SetName("midbar");
zpos = sCageSidePanelRail3Len / 2;
TGeoTranslation* midBarMat = new TGeoTranslation(0, 0, -zpos);
midBarMat->SetName("midbarmat");
midBarMat->RegisterYourself();
// The hole for the side bar: a BBox
xlen = 1.1 * sCageSidePanelCoreThick / 2;
ylen = 1.1 * sCageSidePanelWidth / 2;
zlen = sCageSidePanelSidBarWid;
TGeoBBox* sidBarHol = new TGeoBBox(xlen, ylen, zlen);
sidBarHol->SetName("sidebar");
zpos = sCageSidePanelLength / 2;
TGeoTranslation* sidBarMat = new TGeoTranslation(0, 0, -zpos);
sidBarMat->SetName("sidebarmat");
sidBarMat->RegisterYourself();
// The actual shape: a CompositeShape
TString compoShape = Form("%sbodyshape", shpref);
for (Int_t j = 0; j < 4; j++) {
compoShape += Form("-%slongrail:longrailmat%d", shpref, j);
}
for (Int_t j = 0; j < 2; j++) {
compoShape += Form("-%smedrail:medrailmat%d", shpref, j);
}
for (Int_t j = 0; j < 6; j++) {
compoShape += Form("-%sshortrail:shortrailmat%d", shpref, j);
}
// The mid and side bar holes are present only in the core shape
if (strcmp(shpref, "core") == 0) {
compoShape += "-midbar:midbarmat-sidebar:sidebarmat";
}
TGeoCompositeShape* corefoilSh = new TGeoCompositeShape(compoShape);
// Now return the shape
return corefoilSh;
}
TGeoCompositeShape* V3Cage::createCageSidePanelRail(const Double_t zlength, const Int_t index)
{
//
// Creates the shape of a Cage Side Panel rail
// (slightly approximated as a linear structure)
//
// Input:
// zlength : the rail length along Z
// index : an integer to distinguish subvolume names
//
// Output:
//
// Return:
// The side panel rail as a TGeoCompositeShape
//
// Created: 08 Oct 2022 Mario Sitta
//
// Local variables
Double_t xlen, ylen;
Double_t xpos, ypos;
// The elements of the rail:
// - the vertical part: a BBox
xlen = sCageSidePanelRailVThik / 2;
ylen = (sCageSidePanelRailWidth - 2 * sCageSidePanelRailHThik) / 2;
TGeoBBox* railVert = new TGeoBBox(xlen, ylen, zlength / 2);
railVert->SetName(Form("railvert%d", index));
// - the horizontal part: a BBox
xlen = sCageSidePanelRailSpan / 2;
ylen = sCageSidePanelRailHThik / 2;
TGeoBBox* railHor = new TGeoBBox(xlen, ylen, zlength / 2);
railHor->SetName(Form("railhor%d", index));
// The relative matrices
xpos = (sCageSidePanelRailVThik - sCageSidePanelRailSpan) / 2;
ypos = (sCageSidePanelRailWidth - sCageSidePanelRailHThik) / 2;
TGeoTranslation* railHorMat1 = new TGeoTranslation(xpos, ypos, 0);
railHorMat1->SetName("railhormat1");
railHorMat1->RegisterYourself();
TGeoTranslation* railHorMat2 = new TGeoTranslation(xpos, -ypos, 0);
railHorMat2->SetName("railhormat2");
railHorMat2->RegisterYourself();
// The actual guide: a CompositeShape
TString compoShape = Form("railvert%d", index);
compoShape += Form("+railhor%d:railhormat1", index);
compoShape += Form("+railhor%d:railhormat2", index);
TGeoCompositeShape* railSh = new TGeoCompositeShape(compoShape);
// Now return the shape
return railSh;
}
TGeoVolume* V3Cage::createCageEndCap(const TGeoManager* mgr)
{
//
// Creates the Cage End Cap (from drawings ALIITSUP0235, ALIITSUP0229)
//
// Input:
// mgr : the GeoManager (used only to get the proper material)
//
// Output:
//
// Return:
// The end cap as a TGeoVolumeAssembly
//
// Created: 30 Jun 2022 Mario Sitta
//
// Local variables
Double_t rmin, rmid, rmax;
Double_t xlen, ylen, zlen;
Double_t xpos, ypos, zpos;
// The TGeoVolumeAssembly holding all elements
TGeoVolumeAssembly* endCapVol = new TGeoVolumeAssembly("CageEndCap");
// The basic fabric disk: a Tube
rmin = sCageEndCapDint / 2;
rmax = sCageEndCapDext / 2;
zlen = sCageEndCapFabThick / 2;
TGeoTube* baseFabric = new TGeoTube(rmin, rmax, zlen);
baseFabric->SetName("endCapBaseFabric");
// The basic foam disk: a Tube
zlen = sCageEndCapFoamThick / 2;
TGeoTube* baseFoam = new TGeoTube(rmin, rmax, zlen);
baseFoam->SetName("endCapBaseFoam");
// Common cut-out shapes
xlen = (sCageEndCapDext - sCageEndCapXWidth) / 2;
ylen = 0.6 * rmax;
TGeoBBox* sideCut = new TGeoBBox(xlen, ylen, 2 * zlen);
sideCut->SetName("endCapBoxCut");
TGeoTube* sideHole = new TGeoTube(0, sCageEndCapSideHoleR, 2 * zlen);
sideHole->SetName("endCapSideHole");
xlen = sCageEndCapCableCutWid / 2;
ylen = rmax - sCageEndCapCableCutR;
TGeoBBox* cableCut = new TGeoBBox(xlen, ylen, 2 * zlen);
cableCut->SetName("endCapCableCut");
// Some matrices to create the composite shapes
xpos = rmax;
TGeoTranslation* boxCutTr1 = new TGeoTranslation("boxCutTr1", xpos, 0, 0);
boxCutTr1->RegisterYourself();
TGeoTranslation* boxCutTr2 = new TGeoTranslation("boxCutTr2", -xpos, 0, 0);
boxCutTr2->RegisterYourself();
xpos = sCageEndCapSideHoleX / 2;
TGeoTranslation* sidHolTr1 = new TGeoTranslation("sideHoleTr1", xpos, 0, 0);
sidHolTr1->RegisterYourself();
TGeoTranslation* sidHolTr2 = new TGeoTranslation("sideHoleTr2", -xpos, 0, 0);
sidHolTr2->RegisterYourself();
xpos = rmax * TMath::Sin(sCageEndCapCableCutPhi * TMath::DegToRad());
ypos = rmax * TMath::Cos(sCageEndCapCableCutPhi * TMath::DegToRad());
TGeoCombiTrans* cableMat1 = new TGeoCombiTrans(xpos, ypos, 0, new TGeoRotation("", -sCageEndCapCableCutPhi, 0, 0));
cableMat1->SetName("cableMat1");
cableMat1->RegisterYourself();
TGeoCombiTrans* cableMat2 = new TGeoCombiTrans(-xpos, ypos, 0, new TGeoRotation("", sCageEndCapCableCutPhi, 0, 0));
cableMat2->SetName("cableMat2");
cableMat2->RegisterYourself();
TGeoCombiTrans* cableMat3 = new TGeoCombiTrans(xpos, -ypos, 0, new TGeoRotation("", -180 + sCageEndCapCableCutPhi, 0, 0));
cableMat3->SetName("cableMat3");
cableMat3->RegisterYourself();
TGeoCombiTrans* cableMat4 = new TGeoCombiTrans(-xpos, -ypos, 0, new TGeoRotation("", 180 - sCageEndCapCableCutPhi, 0, 0));
cableMat4->SetName("cableMat4");
cableMat4->RegisterYourself();
// The external fabric panel (each): a CompositeShape
TGeoCompositeShape* fabricSh = new TGeoCompositeShape("endCapBaseFabric-endCapBoxCut:boxCutTr1-endCapBoxCut:boxCutTr2-endCapSideHole:sideHoleTr1-endCapSideHole:sideHoleTr2-endCapCableCut:cableMat1-endCapCableCut:cableMat2-endCapCableCut:cableMat3-endCapCableCut:cableMat4");
// The internal foam panel: a CompositeShape
TGeoCompositeShape* foamSh = new TGeoCompositeShape("endCapBaseFoam-endCapBoxCut:boxCutTr1-endCapBoxCut:boxCutTr2-endCapSideHole:sideHoleTr1-endCapSideHole:sideHoleTr2-endCapCableCut:cableMat1-endCapCableCut:cableMat2-endCapCableCut:cableMat3-endCapCableCut:cableMat4");
// The round crossing ring: a Pcon (ALIITSUP0281)
// (in real world it is made of two rimmed rings placed face-to-face;
// for simplicity and to spare volumes it is implemented as a single
// Pcon encompassing both rings as mounted in the final setup)
TGeoPcon* rndCrosSh = new TGeoPcon(0, 360, 6);
rmin = sCageECRoundCrossDmin / 2;
rmid = sCageECRoundCrossDmid / 2;
rmax = sCageECRoundCrossDmax / 2;
rndCrosSh->DefineSection(0, -sCageECRoundCrossZext, rmin, rmax);
rndCrosSh->DefineSection(1, -sCageECRoundCrossZint, rmin, rmax);
rndCrosSh->DefineSection(2, -sCageECRoundCrossZint, rmin, rmid);
rndCrosSh->DefineSection(3, sCageECRoundCrossZint, rmin, rmid);
rndCrosSh->DefineSection(4, sCageECRoundCrossZint, rmin, rmax);
rndCrosSh->DefineSection(5, sCageECRoundCrossZext, rmin, rmax);
// The (weirdly shaped) cable crossing: a CompositeShape
TGeoCompositeShape* cblCrosSh = createCageEndCapCableCross(mgr);
// We have all shapes: now create the real volume
TGeoMedium* medFabric = mgr->GetMedium(Form("%s_M46J6K$", GetDetName()));
TGeoMedium* medFoam = mgr->GetMedium(Form("%s_ROHACELL$", GetDetName()));
TGeoMedium* medAl = mgr->GetMedium(Form("%s_ALUMINUM$", GetDetName()));
TGeoVolume* fabVol = new TGeoVolume("CageEndCapFabric", fabricSh, medFabric);
fabVol->SetFillColor(kBlue);
fabVol->SetLineColor(kBlue);
TGeoVolume* foamVol = new TGeoVolume("CageEndCapFoam", foamSh, medFoam);
foamVol->SetFillColor(kYellow);
foamVol->SetLineColor(kYellow);
TGeoVolume* rndCrosVol = new TGeoVolume("CageEndCapRoundCross", rndCrosSh, medAl);
rndCrosVol->SetFillColor(kGray);
rndCrosVol->SetLineColor(kGray);
TGeoVolume* cblCrosVol = new TGeoVolume("CageEndCapCableCross", cblCrosSh, medAl);
cblCrosVol->SetFillColor(kGray);
cblCrosVol->SetLineColor(kGray);
// Then build up the end cap
endCapVol->AddNode(foamVol, 1, nullptr);
zpos = (sCageEndCapFoamThick + sCageEndCapFabThick) / 2;
endCapVol->AddNode(fabVol, 1, new TGeoTranslation(0, 0, zpos));
endCapVol->AddNode(fabVol, 2, new TGeoTranslation(0, 0, -zpos));
endCapVol->AddNode(rndCrosVol, 1, nullptr);
rmax = sCageEndCapDext / 2 - sCageECCableCrosTotHi;
xpos = rmax * TMath::Sin(sCageEndCapCableCutPhi * TMath::DegToRad());
ypos = rmax * TMath::Cos(sCageEndCapCableCutPhi * TMath::DegToRad());
endCapVol->AddNode(cblCrosVol, 1, new TGeoCombiTrans(xpos, ypos, 0, new TGeoRotation("", -sCageEndCapCableCutPhi, 0, 0)));
endCapVol->AddNode(cblCrosVol, 2, new TGeoCombiTrans(-xpos, ypos, 0, new TGeoRotation("", sCageEndCapCableCutPhi, 0, 0)));
endCapVol->AddNode(cblCrosVol, 3, new TGeoCombiTrans(xpos, -ypos, 0, new TGeoRotation("", -180 + sCageEndCapCableCutPhi, 0, 0)));
endCapVol->AddNode(cblCrosVol, 4, new TGeoCombiTrans(-xpos, -ypos, 0, new TGeoRotation("", 180 - sCageEndCapCableCutPhi, 0, 0)));
// Finally return the end cap volume
return endCapVol;
}
TGeoCompositeShape* V3Cage::createCageEndCapCableCross(const TGeoManager* mgr)
{
//
// Creates the Cable Crossing frame for the Cage End Cap (ALIITSUP0282)
// Since it is pretty cumbersome, we create it in a separate method
//
// Input:
// mgr : the GeoManager (used only to get the proper material)
//
// Output:
//
// Return:
// The cable crossing frame as a TGeoCompositeShape
//
// Created: 01 Jul 2022 Mario Sitta
//
// Local variables
Double_t rmin, rmid, rmax;
Double_t xlen, ylen, zlen;
Double_t xpos, ypos, zpos;
// The string holding the complex crossing cable structure
TString crossShape = "";
// The inner lower part: a BBox and its matrix
xlen = sCageECCableCrosInXWid / 2;
ylen = sCageECCableCrosInThik / 2;
zlen = sCageECCableCrosInZLen / 2;
TGeoBBox* cabCrosLow = new TGeoBBox(xlen, ylen, zlen);
cabCrosLow->SetName("CabCrosLow");
TGeoTranslation* matCrosLow = new TGeoTranslation("MatCrosLow", 0, ylen, 0);
matCrosLow->RegisterYourself();
crossShape = "CabCrosLow:MatCrosLow";
// The side wall of lower part: a BBox and its two matrices
xlen = (sCageECCableCrosInXWid + 2 * (sCageECCableCrosSidWid - sCageECCableCrosInThik)) / 2;
ylen = sCageECCableCrosSidWid / 2;
zlen = (sCageECCableCrosTotZ - sCageECCableCrosInZLen) / 4; // We have 2 sides
TGeoBBox* cabCrosSide = new TGeoBBox(xlen, ylen, zlen);
cabCrosSide->SetName("CabCrosSide");
ypos = 2 * cabCrosLow->GetDY() - cabCrosSide->GetDY();
zpos = cabCrosLow->GetDZ() + cabCrosSide->GetDZ();
TGeoTranslation* matCrosSid1 = new TGeoTranslation("MatCrosSid1", 0, ypos, zpos);
matCrosSid1->RegisterYourself();
TGeoTranslation* matCrosSid2 = new TGeoTranslation("MatCrosSid2", 0, ypos, -zpos);
matCrosSid2->RegisterYourself();
crossShape += "+CabCrosSide:MatCrosSid1+CabCrosSide:MatCrosSid2";
// The inner lateral part: a BBox and its two matrices
// (in blueprint the lateral height is not specified, we have to compute it)
rmax = sCageEndCapDext / 2;
xlen = sCageECCableCrosInXWid / 2;
Double_t apothem = TMath::Sqrt(rmax * rmax - xlen * xlen);
Double_t sagitta = rmax - apothem;
xlen = sCageECCableCrosInThik / 2;
ylen = (sCageECCableCrosTotHi - sagitta - sCageECCableCrosInThik) / 2;
zlen = sCageECCableCrosInZLen / 2;
TGeoBBox* cabCrosLat = new TGeoBBox(xlen, ylen, zlen);
cabCrosLat->SetName("CabCrosLateral");
xpos = 0.5 * sCageECCableCrosInXWid - cabCrosLat->GetDX();
ypos = cabCrosLat->GetDY() + sCageECCableCrosInThik;
TGeoTranslation* matCrosLat1 = new TGeoTranslation("MatCrosLat1", xpos, ypos, 0);
matCrosLat1->RegisterYourself();
TGeoTranslation* matCrosLat2 = new TGeoTranslation("MatCrosLat2", -xpos, ypos, 0);
matCrosLat2->RegisterYourself();