-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathLFHCAL_geo.cpp
More file actions
1172 lines (1094 loc) · 56.7 KB
/
LFHCAL_geo.cpp
File metadata and controls
1172 lines (1094 loc) · 56.7 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
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright (C) 2023 Friederike Bock
//==========================================================================
// Implementation of longitudinally separated forward calorimeter
//--------------------------------------------------------------------------
// Author: Friederike Bock (ORNL)
//==========================================================================
#include "DD4hep/DetFactoryHelper.h"
#include "DD4hep/Printout.h"
#include "DD4hep/Shapes.h"
#include "DDRec/DetectorData.h"
#include "DDRec/Surface.h"
#include <XML/Helper.h>
#include "XML/Layering.h"
#include "XML/Utilities.h"
using namespace dd4hep;
struct moduleParamsStrct {
moduleParamsStrct()
: mod_BIwidth(0.)
, mod_BIheight(0.)
, mod_SWThick(0.)
, mod_TWThick(0.)
, mod_MPThick(0.)
, mod_FWThick(0.)
, mod_BWThick(0.)
, mod_width(0.)
, mod_height(0.)
, mod_notchDepth(0.)
, mod_notchHeight(0.)
, mod_foilThick(0.)
, mod_pcbLength(0.)
, mod_pcbThick(0.)
, mod_pcbWidth(0.)
, mod_visStr("")
, mod_regStr("")
, mod_limStr("") {}
moduleParamsStrct(double BIwidth, double BIheight, double SWThick, double TWThick, double MPThick,
double FWThick, double BWThick, double width, double height, double notchDepth,
double notchHeight, double foilThick, double pcbLegth, double pcbThick,
double pcbWidth, std::string visStr, std::string regStr, std::string limStr) {
mod_BIwidth = BIwidth;
mod_BIheight = BIheight;
mod_SWThick = SWThick;
mod_TWThick = TWThick;
mod_MPThick = MPThick;
mod_FWThick = FWThick;
mod_BWThick = BWThick;
mod_width = width;
mod_height = height;
mod_notchDepth = notchDepth;
mod_notchHeight = notchHeight;
mod_foilThick = foilThick;
mod_pcbLength = pcbLegth;
mod_pcbThick = pcbThick;
mod_pcbWidth = pcbWidth;
mod_visStr = visStr;
mod_regStr = regStr;
mod_limStr = limStr;
}
double mod_BIwidth = 0.;
double mod_BIheight = 0.;
double mod_SWThick = 0.;
double mod_TWThick = 0.;
double mod_MPThick = 0.;
double mod_FWThick = 0.;
double mod_BWThick = 0.;
double mod_width = 0.;
double mod_height = 0.;
double mod_notchDepth = 0.;
double mod_notchHeight = 0.;
double mod_foilThick = 0.;
double mod_pcbLength = 0.;
double mod_pcbThick = 0.;
double mod_pcbWidth = 0.;
std::string mod_visStr = "";
std::string mod_regStr = "";
std::string mod_limStr = "";
};
struct sliceParamsStrct {
sliceParamsStrct()
: layer_ID(0)
, slice_ID(0)
, slice_partID(0)
, slice_thick(0.)
, slice_offset(0.)
, slice_readoutLayer(0)
, slice_matStr("")
, slice_visStr("")
, slice_regStr("")
, slice_limStr("") {}
sliceParamsStrct(int l_ID, int sl_ID, int sl_partID, double sl_thick, double sl_off, int l_rl,
std::string sl_matStr, std::string sl_visStr, std::string sl_regStr,
std::string sl_limStr) {
layer_ID = l_ID;
slice_ID = sl_ID;
slice_partID = sl_partID;
slice_thick = sl_thick;
slice_offset = sl_off;
slice_readoutLayer = l_rl;
slice_matStr = sl_matStr;
slice_visStr = sl_visStr;
slice_regStr = sl_regStr;
slice_limStr = sl_limStr;
}
int layer_ID = 0;
int slice_ID = 0;
int slice_partID = 0;
double slice_thick = 0.;
double slice_offset = 0.;
int slice_readoutLayer = 0;
std::string slice_matStr = "";
std::string slice_visStr = "";
std::string slice_regStr = "";
std::string slice_limStr = "";
};
//************************************************************************************************************
//************************** Assembly for absorber plates ***************************************************
//************************************************************************************************************
Volume createAbsorberPlate(Detector& desc, std::string basename, double h_mod, double w_mod,
double t_mod_tp, double t_mod_sp, double t_slice, double w_notch,
double h_notch, Material slice_mat, std::string region,
std::string limit, std::string vis, bool renderComp) {
double w_plate = (w_mod / 2 - t_mod_sp) * 2;
double l_A = -w_plate / 2;
double l_B = -(w_plate / 2 - w_notch);
double r_A = w_plate / 2;
// 0 1 2 3 4
const std::vector<double> xCoord = {l_A, r_A, r_A, l_A, l_A,
// 5 6 7
l_B, l_B, l_A};
// 0 1 2 3 4
double topA = h_mod / 2 - t_mod_tp;
double topB = h_notch / 2;
double botA = -(h_mod / 2 - t_mod_tp);
double botB = -(h_notch / 2);
// 0 1 2 3 4
const std::vector<double> yCoord = {topA, topA, botA, botA, botB,
// 5 6 7 8 9
botB, topB, topB};
const std::vector<double> zStep = {-t_slice / 2, t_slice / 2};
const std::vector<double> zStepX = {0., 0.};
const std::vector<double> zStepY = {0., 0.};
const std::vector<double> zStepScale = {1., 1.};
ExtrudedPolygon absplate = ExtrudedPolygon(xCoord, yCoord, zStep, zStepX, zStepY, zStepScale);
Volume absplate_vol(basename, absplate, slice_mat);
// Setting slice attributes
if (renderComp) {
absplate_vol.setAttributes(desc, region, limit, vis);
} else {
absplate_vol.setAttributes(desc, region, limit, "InvisibleNoDaughters");
}
return absplate_vol;
}
//************************************************************************************************************
//************************** Filler plate i.e. air & kapton & PCB & ESR
//************************************************************************************************************
Volume createFillerPlate(Detector& desc, std::string basename, double h_mod, double w_mod,
double t_mod_tp, double t_mod_sp, double t_slice, double w_notch,
Material slice_mat, std::string region, std::string limit, std::string vis,
bool renderComp) {
double w_plate = w_mod - 2 * t_mod_sp - w_notch;
double h_plate = h_mod - 2 * t_mod_tp;
Box filler(w_plate / 2., h_plate / 2., t_slice / 2.);
Volume filler_vol(basename, filler, slice_mat);
// Setting slice attributes
if (renderComp) {
filler_vol.setAttributes(desc, region, limit, vis);
} else {
filler_vol.setAttributes(desc, region, limit, "InvisibleNoDaughters");
}
return filler_vol;
}
//************************************************************************************************************
//************************** single scintillator plate for tower *********************************************
//************************************************************************************************************
Volume createScintillatorTower(Detector& desc, std::string basename, double w_tow, double h_tow,
double t_slice, Material slice_mat, std::string region,
std::string limit, std::string vis, SensitiveDetector sens,
bool renderComp) {
Box scintplate(w_tow / 2., h_tow / 2., t_slice / 2.);
Volume slice_vol(basename, scintplate, slice_mat);
// Setting appropriate slices as sensitive
sens.setType("calorimeter");
slice_vol.setSensitiveDetector(sens);
// Setting slice attributes
if (renderComp) {
slice_vol.setAttributes(desc, region, limit, vis);
} else {
slice_vol.setAttributes(desc, region, limit, "InvisibleNoDaughters");
}
return slice_vol;
}
//************************************************************************************************************
//************************** create scintillator plate with separations for 8M *******************************
//************************************************************************************************************
Assembly createScintillatorPlateEightM(Detector& desc, std::string basename,
// int modID,
int layerID, double h_mod, double w_mod, double t_mod_tp,
double t_mod_sp, double t_slice, double w_notch,
double t_foil, Material slice_mat, int roLayer,
std::string region, std::string limit, std::string vis,
SensitiveDetector sens, bool renderComp) {
// Tower placement in 8M module
//======================================================================
//|| || || || ||
//|| 0 || 1 || 2 || 3 ||
//|| || || || ||
//======================================================================
//|| || || || ||
//|| 4 || 5 || 6 || 7 ||
//|| || || || ||
//======================================================================
Assembly modScintAssembly(basename);
double w_plate = w_mod - w_notch - 2 * t_mod_sp - 2 * t_foil;
double h_plate = h_mod - 2 * t_mod_tp - 2 * t_foil;
double w_tow = (w_plate - 6 * t_foil) / 4;
double h_tow = (h_plate - 2 * t_foil) / 2;
// placement volumes
PlacedVolume pvm;
// foil separations // 0 1 2 3 4
const std::vector<double> xCoordTi = {
-(w_plate / 2.), -(w_tow + 3 * t_foil), -(w_tow + 3 * t_foil), -(w_tow + 1 * t_foil),
-(w_tow + 1 * t_foil),
// 5 6 7 8 9
-t_foil, -t_foil, t_foil, t_foil, w_tow + 1 * t_foil,
// 10 11 12 13 14
w_tow + 1 * t_foil, w_tow + 3 * t_foil, w_tow + 3 * t_foil, w_plate / 2., w_plate / 2.,
// 15 16 17 18 19
w_tow + 3 * t_foil, w_tow + 3 * t_foil, w_tow + 1 * t_foil, w_tow + 1 * t_foil, t_foil,
// 20 21 22 23 24
t_foil, -t_foil, -t_foil, -(w_tow + 1 * t_foil), -(w_tow + 1 * t_foil),
// 25 26 27
-(w_tow + 3 * t_foil), -(w_tow + 3 * t_foil), -(w_plate / 2.)};
// 0 1 2 3 4
const std::vector<double> yCoordTi = {
t_foil, t_foil, (h_plate / 2.), (h_plate / 2.), t_foil,
// 5 6 7 8 9
t_foil, (h_plate / 2.), (h_plate / 2.), t_foil, t_foil,
// 10 11 12 13 14
(h_plate / 2.), (h_plate / 2.), t_foil, t_foil, -t_foil,
// 15 16 17 18 19
-t_foil, -(h_plate / 2.), -(h_plate / 2.), -t_foil, -t_foil,
// 20 21 22 23 24
-(h_plate / 2.), -(h_plate / 2.), -t_foil, -t_foil, -(h_plate / 2.),
// 25 26 27
-(h_plate / 2.), -t_foil, -t_foil};
const std::vector<double> zStepTi = {-t_slice / 2, t_slice / 2};
const std::vector<double> zStepXTi = {0., 0.};
const std::vector<double> zStepYTi = {0., 0.};
const std::vector<double> zStepScaleTi = {1., 1.};
ExtrudedPolygon foilgrid =
ExtrudedPolygon(xCoordTi, yCoordTi, zStepTi, zStepXTi, zStepYTi, zStepScaleTi);
Box foil_t((w_plate + 2 * t_foil) / 2., t_foil / 2., t_slice / 2.);
Box foil_s(t_foil / 2., h_plate / 2., t_slice / 2.);
Volume foilgrid_vol(basename + "_ESRFoil_" + _toString(layerID, "_layer_%d"), foilgrid,
slice_mat);
Volume foil_t_vol(basename + "_ESRFoilT_" + _toString(layerID, "_layer_%d"), foil_t, slice_mat);
Volume foil_b_vol(basename + "_ESRFoilB_" + _toString(layerID, "_layer_%d"), foil_t, slice_mat);
Volume foil_l_vol(basename + "_ESRFoilL_" + _toString(layerID, "_layer_%d"), foil_s, slice_mat);
Volume foil_r_vol(basename + "_ESRFoilR_" + _toString(layerID, "_layer_%d"), foil_s, slice_mat);
// Setting slice attributes
if (renderComp) {
foilgrid_vol.setAttributes(desc, region, limit, "LFHCALLayerSepVis");
foil_t_vol.setAttributes(desc, region, limit, "LFHCALLayerSepVis");
foil_b_vol.setAttributes(desc, region, limit, "LFHCALLayerSepVis");
foil_l_vol.setAttributes(desc, region, limit, "LFHCALLayerSepVis");
foil_r_vol.setAttributes(desc, region, limit, "LFHCALLayerSepVis");
} else {
foilgrid_vol.setAttributes(desc, region, limit, "InvisibleNoDaughters");
foil_t_vol.setAttributes(desc, region, limit, "InvisibleNoDaughters");
foil_b_vol.setAttributes(desc, region, limit, "InvisibleNoDaughters");
foil_l_vol.setAttributes(desc, region, limit, "InvisibleNoDaughters");
foil_r_vol.setAttributes(desc, region, limit, "InvisibleNoDaughters");
}
pvm = modScintAssembly.placeVolume(foilgrid_vol, Position(0, 0, 0));
pvm = modScintAssembly.placeVolume(foil_t_vol, Position(0, 1.5 * t_foil + h_tow, 0));
pvm = modScintAssembly.placeVolume(foil_b_vol, Position(0, -(1.5 * t_foil + h_tow), 0));
pvm = modScintAssembly.placeVolume(foil_l_vol, Position(-(3.5 * t_foil + 2 * w_tow), 0, 0));
pvm = modScintAssembly.placeVolume(foil_r_vol, Position((3.5 * t_foil + 2 * w_tow), 0, 0));
// 8M module placement of scintillator for tower
double rotZ[8] = {0, 0, 0, 0, 0, 0, 0, 0};
double rotY[8] = {0, 0, 0, 0, 0, 0, 0, 0};
double rotX[8] = {0, 0, 0, 0, 0, 0, 0, 0};
double posX[8] = {(w_tow * 1.5 + 3 * t_foil), (w_tow * 0.5 + t_foil),
-(w_tow * 0.5 + t_foil), -(w_tow * 1.5 + 3 * t_foil),
(w_tow * 1.5 + 3 * t_foil), (w_tow * 0.5 + t_foil),
-(w_tow * 0.5 + t_foil), -(w_tow * 1.5 + 3 * t_foil)};
double posY[8] = {0.5 * (h_tow) + t_foil, 0.5 * (h_tow) + t_foil, 0.5 * (h_tow) + t_foil,
0.5 * (h_tow) + t_foil, -(0.5 * (h_tow) + t_foil), -(0.5 * (h_tow) + t_foil),
-(0.5 * (h_tow) + t_foil), -(0.5 * (h_tow) + t_foil)};
double posZ[8] = {0, 0, 0, 0, 0, 0, 0, 0};
int towerx = 0;
int towery = 0;
// loop over all towers within same module
for (int i = 0; i < 8; i++) {
// printout(DEBUG, "LFHCAL_geo", basename + _toString(i, "_tower_%d") + "\t" + _toString(modID) + "\t" + _toString(i) + "\t" + _toString(layerID));
Volume modScintTowerAss =
createScintillatorTower(desc, basename + _toString(i, "_tower_%d"), w_tow, h_tow, t_slice,
slice_mat, region, limit, vis, sens, renderComp);
pvm = modScintAssembly.placeVolume(
modScintTowerAss,
Transform3D(RotationZYX(rotZ[i], rotY[i], rotX[i]), Position(posX[i], posY[i], posZ[i])));
towerx = i % 4;
towery = 0;
if (i > 3)
towery = 1;
pvm.addPhysVolID("towerx", towerx)
.addPhysVolID("towery", towery)
.addPhysVolID("layerz", layerID)
.addPhysVolID("passive", 0)
.addPhysVolID("rlayerz", roLayer);
}
return modScintAssembly;
}
//************************************************************************************************************
//************************** create scintillator plate with separations for 4M *******************************
//************************************************************************************************************
Assembly createScintillatorPlateFourM(Detector& desc, std::string basename,
// int modID,
int layerID, double h_mod, double w_mod, double t_mod_tp,
double t_mod_sp, double t_slice, double w_notch,
double t_foil, Material slice_mat, int roLayer,
std::string region, std::string limit, std::string vis,
SensitiveDetector sens, bool renderComp) {
// Tower placement in 4M module
//--------------------------------
//| || |
//| 0 || 1 |
//| || |
//|==============================|
//| || |
//| 2 || 3 |
//| || |
//--------------------------------
Assembly modScintAssembly(basename);
double w_plate = w_mod - w_notch - 2 * t_mod_sp - 2 * t_foil;
double h_plate = h_mod - 2 * t_mod_tp - 2 * t_foil;
double w_tow = (w_plate - 2 * t_foil) / 2;
double h_tow = (h_plate - 2 * t_foil) / 2;
// placement volumes
PlacedVolume pvm;
// foil separations
// 0 1 2 3 4
const std::vector<double> xCoordTi = {
-(w_plate / 2.), -t_foil, -t_foil, t_foil, t_foil,
// 5 6 7 8 9
w_plate / 2., w_plate / 2., t_foil, t_foil, -t_foil,
// 10 11
-t_foil, -(w_plate / 2.)};
// 0 1 2 3 4
const std::vector<double> yCoordTi = {
t_foil,
t_foil,
(h_plate / 2.),
(h_plate / 2.),
t_foil,
// 5 6 7 8 9
t_foil,
-t_foil,
-t_foil,
-(h_plate / 2.),
-(h_plate / 2.),
// 10 11
-t_foil,
-t_foil,
};
const std::vector<double> zStepTi = {-t_slice / 2, t_slice / 2};
const std::vector<double> zStepXTi = {0., 0.};
const std::vector<double> zStepYTi = {0., 0.};
const std::vector<double> zStepScaleTi = {1., 1.};
ExtrudedPolygon foilgrid =
ExtrudedPolygon(xCoordTi, yCoordTi, zStepTi, zStepXTi, zStepYTi, zStepScaleTi);
Box foil_t((w_plate + 2 * t_foil) / 2., t_foil / 2., t_slice / 2.);
Box foil_s(t_foil / 2., h_plate / 2., t_slice / 2.);
Volume foilgrid_vol(basename + "_ESRFoil_" + _toString(layerID, "_layer_%d"), foilgrid,
slice_mat);
Volume foil_t_vol(basename + "_ESRFoilT_" + _toString(layerID, "_layer_%d"), foil_t, slice_mat);
Volume foil_b_vol(basename + "_ESRFoilB_" + _toString(layerID, "_layer_%d"), foil_t, slice_mat);
Volume foil_l_vol(basename + "_ESRFoilL_" + _toString(layerID, "_layer_%d"), foil_s, slice_mat);
Volume foil_r_vol(basename + "_ESRFoilR_" + _toString(layerID, "_layer_%d"), foil_s, slice_mat);
// Setting slice attributes
if (renderComp) {
foilgrid_vol.setAttributes(desc, region, limit, "LFHCALLayerSepVis");
foil_t_vol.setAttributes(desc, region, limit, "LFHCALLayerSepVis");
foil_b_vol.setAttributes(desc, region, limit, "LFHCALLayerSepVis");
foil_l_vol.setAttributes(desc, region, limit, "LFHCALLayerSepVis");
foil_r_vol.setAttributes(desc, region, limit, "LFHCALLayerSepVis");
} else {
foilgrid_vol.setAttributes(desc, region, limit, "InvisibleNoDaughters");
foil_t_vol.setAttributes(desc, region, limit, "InvisibleNoDaughters");
foil_b_vol.setAttributes(desc, region, limit, "InvisibleNoDaughters");
foil_l_vol.setAttributes(desc, region, limit, "InvisibleNoDaughters");
foil_r_vol.setAttributes(desc, region, limit, "InvisibleNoDaughters");
}
pvm = modScintAssembly.placeVolume(foilgrid_vol, Position(0, 0, 0));
pvm = modScintAssembly.placeVolume(foil_t_vol, Position(0, 1.5 * t_foil + h_tow, 0));
pvm = modScintAssembly.placeVolume(foil_b_vol, Position(0, -(1.5 * t_foil + h_tow), 0));
pvm = modScintAssembly.placeVolume(foil_l_vol, Position(-(1.5 * t_foil + w_tow), 0, 0));
pvm = modScintAssembly.placeVolume(foil_r_vol, Position((1.5 * t_foil + w_tow), 0, 0));
// 4M module placement of scintillator for tower
double rotZ[4] = {0, 0, 0, 0};
double rotY[4] = {0, 0, 0, 0};
double rotX[4] = {0, 0, 0, 0};
double posX[4] = {(w_tow * 0.5 + t_foil), -(w_tow * 0.5 + t_foil), (w_tow * 0.5 + t_foil),
-(w_tow * 0.5 + t_foil)};
double posY[4] = {0.5 * (h_tow) + t_foil, 0.5 * (h_tow) + t_foil, -(0.5 * (h_tow) + t_foil),
-(0.5 * (h_tow) + t_foil)};
double posZ[4] = {0, 0, 0, 0};
int towerx = 0;
int towery = 0;
// loop over all towers within same module
for (int i = 0; i < 4; i++) {
// printout(DEBUG, "LFHCAL_geo", basename + _toString(i, "_tower_%d") + "\t" + _toString(modID) + "\t" + _toString(i) + "\t" + _toString(layerID));
Volume modScintTowerAss =
createScintillatorTower(desc, basename + _toString(i, "_tower_%d"), w_tow, h_tow, t_slice,
slice_mat, region, limit, vis, sens, renderComp);
pvm = modScintAssembly.placeVolume(
modScintTowerAss,
Transform3D(RotationZYX(rotZ[i], rotY[i], rotX[i]), Position(posX[i], posY[i], posZ[i])));
towerx = i % 2;
towery = 0;
if (i > 1)
towery = 1;
pvm.addPhysVolID("towerx", towerx)
.addPhysVolID("towery", towery)
.addPhysVolID("layerz", layerID)
.addPhysVolID("passive", 0)
.addPhysVolID("rlayerz", roLayer);
}
return modScintAssembly;
}
//************************************************************************************************************
//************************** create 8M module assembly ******************************************************
//************************************************************************************************************
Volume createEightMModule(Detector& desc, moduleParamsStrct mod_params,
std::vector<sliceParamsStrct> sl_params,
// int modID,
double length, SensitiveDetector sens, bool renderComp, bool allSen) {
std::string baseName = "LFHCAL_8M";
// assembly definition
Box modBox(mod_params.mod_width / 2., mod_params.mod_height / 2., length / 2.);
Volume vol_mod(baseName, modBox, desc.material("Air"));
vol_mod.setVisAttributes(desc.visAttributes(mod_params.mod_visStr.data()));
// placement operator
PlacedVolume pvm;
// ********************************************************************************
// Casing definition
// ********************************************************************************
// geom definition 8M module casing
Box MountingPlate(mod_params.mod_width / 2., mod_params.mod_height / 2.,
mod_params.mod_MPThick / 2.);
Box modFrontPlate(mod_params.mod_width / 2., mod_params.mod_height / 2.,
mod_params.mod_FWThick / 2.);
Box modSidePlateL(
mod_params.mod_SWThick / 2., mod_params.mod_height / 2.,
(length - mod_params.mod_MPThick - mod_params.mod_FWThick - mod_params.mod_BWThick) / 2.);
Box modSidePlateR(
mod_params.mod_SWThick / 2., mod_params.mod_height / 2.,
(length - mod_params.mod_MPThick - mod_params.mod_FWThick - mod_params.mod_BWThick) / 2.);
Box modTopPlate(
(mod_params.mod_width - 2 * mod_params.mod_SWThick) / 2., mod_params.mod_TWThick / 2.,
(length - mod_params.mod_MPThick - mod_params.mod_FWThick - mod_params.mod_BWThick) / 2.);
Box modBottomPlate(
(mod_params.mod_width - 2 * mod_params.mod_SWThick) / 2., mod_params.mod_TWThick / 2.,
(length - mod_params.mod_MPThick - mod_params.mod_FWThick - mod_params.mod_BWThick) / 2.);
Box modBackCutOut(mod_params.mod_BIwidth / 2., mod_params.mod_BIheight / 2.,
mod_params.mod_BWThick / 2.);
Box modBackPlateFull(mod_params.mod_width / 2., mod_params.mod_height / 2.,
mod_params.mod_BWThick / 2.);
SubtractionSolid modBackPlate(modBackPlateFull, modBackCutOut);
// volume definition 8M module casing
Volume vol_mountingPlate(baseName + "_MountingPlate", MountingPlate, desc.material("Steel235"));
Volume vol_modFrontPlate(baseName + "_FrontPlate", modFrontPlate, desc.material("Steel235"));
Volume vol_modBackPlate(baseName + "_BackPlate", modBackPlate, desc.material("Steel235"));
Volume vol_modSidePlateL(baseName + "_LeftSidePlate", modSidePlateL, desc.material("Steel235"));
Volume vol_modSidePlateR(baseName + "_RightSidePlate", modSidePlateR, desc.material("Steel235"));
Volume vol_modTopPlate(baseName + "_TopPlate", modTopPlate, desc.material("Steel235"));
Volume vol_modBottomPlate(baseName + "_BottomPlate", modBottomPlate, desc.material("Steel235"));
if (allSen) {
sens.setType("calorimeter");
vol_mountingPlate.setSensitiveDetector(sens);
vol_modFrontPlate.setSensitiveDetector(sens);
vol_modBackPlate.setSensitiveDetector(sens);
vol_modSidePlateL.setSensitiveDetector(sens);
vol_modSidePlateR.setSensitiveDetector(sens);
vol_modTopPlate.setSensitiveDetector(sens);
vol_modBottomPlate.setSensitiveDetector(sens);
}
if (renderComp) {
vol_mountingPlate.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
// mod_params.mod_visStr);
"LFHCALLayerTungstenVis");
vol_modFrontPlate.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
// mod_params.mod_visStr);
"LFHCALLayerSteelVis");
vol_modBackPlate.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
// mod_params.mod_visStr);
"LFHCALLayerSteelVis");
vol_modSidePlateL.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
mod_params.mod_visStr);
vol_modSidePlateR.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
mod_params.mod_visStr);
vol_modTopPlate.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
// mod_params.mod_visStr);
"LFHCALLayerSteelVis");
vol_modBottomPlate.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
// mod_params.mod_visStr);
"LFHCALLayerSteelVis");
} else {
vol_mountingPlate.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
"InvisibleNoDaughters");
vol_modFrontPlate.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
"InvisibleNoDaughters");
vol_modBackPlate.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
"InvisibleNoDaughters");
vol_modSidePlateL.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
"InvisibleNoDaughters");
vol_modSidePlateR.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
"InvisibleNoDaughters");
vol_modTopPlate.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
"InvisibleNoDaughters");
vol_modBottomPlate.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
"InvisibleNoDaughters");
}
// ********************************************************************************
// long PCB
// ********************************************************************************
Box modPCB(mod_params.mod_pcbThick / 2., mod_params.mod_pcbWidth / 2.,
(mod_params.mod_pcbLength) / 2.);
Volume vol_modPCB(baseName + "_PCB", modPCB, desc.material("Fr4"));
if (renderComp) {
vol_modPCB.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr, "LFHCALModPCB");
} else {
vol_modPCB.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
"InvisibleNoDaughters");
}
int layer_num = 0;
double slice_z = -length / 2 + mod_params.mod_MPThick +
mod_params.mod_FWThick; // Keeps track of layers' local z locations
// Looping through the number of repeated layers & slices in each section
for (int i = 0; i < (int)sl_params.size(); i++) {
slice_z += sl_params[i].slice_offset +
sl_params[i].slice_thick / 2.; // Going to halfway point in layer
layer_num = sl_params[i].layer_ID;
//*************************************************
// absorber plates
//*************************************************
Material slice_mat = desc.material(sl_params[i].slice_matStr);
if (sl_params[i].slice_partID == 1) {
Volume modAbsAssembly = createAbsorberPlate(
desc, baseName + "_Abs" + _toString(sl_params[i].layer_ID, "_layer_%d"),
mod_params.mod_height, mod_params.mod_width, mod_params.mod_TWThick,
mod_params.mod_SWThick, sl_params[i].slice_thick, mod_params.mod_notchDepth,
mod_params.mod_notchHeight, slice_mat, sl_params[i].slice_regStr,
sl_params[i].slice_limStr, sl_params[i].slice_visStr, renderComp);
// Placing slice within layer
if (allSen)
modAbsAssembly.setSensitiveDetector(sens);
pvm = vol_mod.placeVolume(modAbsAssembly,
Transform3D(RotationZYX(0, 0, 0), Position(0., 0., slice_z)));
if (allSen)
pvm.addPhysVolID("towerx", 0)
.addPhysVolID("towery", 0)
.addPhysVolID("rlayerz", sl_params[i].slice_readoutLayer)
.addPhysVolID("layerz", layer_num)
.addPhysVolID("passive", 1);
//*************************************************
// air & kapton & PCB & ESR
//*************************************************
} else if (sl_params[i].slice_partID == 2) {
Volume modFillAssembly =
createFillerPlate(desc,
baseName + "_Fill" + _toString(sl_params[i].layer_ID, "_layer_%d") +
_toString(sl_params[i].slice_ID, "slice_%d"),
mod_params.mod_height, mod_params.mod_width, mod_params.mod_TWThick,
mod_params.mod_SWThick, sl_params[i].slice_thick,
mod_params.mod_notchDepth, slice_mat, sl_params[i].slice_regStr,
sl_params[i].slice_limStr, sl_params[i].slice_visStr, renderComp);
// Placing slice within layer
if (allSen)
modFillAssembly.setSensitiveDetector(sens);
pvm = vol_mod.placeVolume(
modFillAssembly, Transform3D(RotationZYX(0, 0, 0),
Position((mod_params.mod_notchDepth) / 2., 0., slice_z)));
if (allSen)
pvm.addPhysVolID("towerx", 1)
.addPhysVolID("towery", 0)
.addPhysVolID("rlayerz", sl_params[i].slice_readoutLayer)
.addPhysVolID("layerz", layer_num)
.addPhysVolID("passive", 1);
//*************************************************
// scintillator
//*************************************************
} else {
Assembly modScintAssembly = createScintillatorPlateEightM(
desc, baseName + "_ScintAssembly" + _toString(sl_params[i].layer_ID, "_layer_%d"),
layer_num, mod_params.mod_height, mod_params.mod_width, mod_params.mod_TWThick,
mod_params.mod_SWThick, sl_params[i].slice_thick, mod_params.mod_notchDepth,
mod_params.mod_foilThick, slice_mat, sl_params[i].slice_readoutLayer,
sl_params[i].slice_regStr, sl_params[i].slice_limStr, sl_params[i].slice_visStr, sens,
renderComp);
// Placing slice within layer
pvm = vol_mod.placeVolume(
modScintAssembly, Transform3D(RotationZYX(0, 0, 0),
Position((mod_params.mod_notchDepth) / 2., 0, slice_z)));
}
slice_z += sl_params[i].slice_thick / 2.;
}
// placement 8M module casing
pvm = vol_mod.placeVolume(vol_mountingPlate,
Position(0, 0, -(length - mod_params.mod_MPThick) / 2.));
pvm = vol_mod.placeVolume(
vol_modFrontPlate,
Position(0, 0, -(length - mod_params.mod_FWThick) / 2. + mod_params.mod_MPThick));
if (allSen)
pvm.addPhysVolID("towerx", 2)
.addPhysVolID("towery", 0)
.addPhysVolID("layerz", 0)
.addPhysVolID("passive", 1);
pvm =
vol_mod.placeVolume(vol_modBackPlate, Position(0, 0, (length - mod_params.mod_BWThick) / 2.));
if (allSen)
pvm.addPhysVolID("towerx", 2)
.addPhysVolID("towery", 0)
.addPhysVolID("layerz", layer_num)
.addPhysVolID("passive", 1);
pvm = vol_mod.placeVolume(
vol_modSidePlateL,
Position(-(mod_params.mod_width - mod_params.mod_SWThick) / 2., 0,
(mod_params.mod_FWThick + mod_params.mod_MPThick - mod_params.mod_BWThick) / 2));
if (allSen)
pvm.addPhysVolID("towerx", 3)
.addPhysVolID("towery", 0)
.addPhysVolID("layerz", 0)
.addPhysVolID("passive", 1);
pvm = vol_mod.placeVolume(
vol_modSidePlateR,
Position((mod_params.mod_width - mod_params.mod_SWThick) / 2., 0,
(mod_params.mod_FWThick + mod_params.mod_MPThick - mod_params.mod_BWThick) / 2));
if (allSen)
pvm.addPhysVolID("towerx", 0)
.addPhysVolID("towery", 1)
.addPhysVolID("layerz", 0)
.addPhysVolID("passive", 1);
pvm = vol_mod.placeVolume(
vol_modTopPlate,
Position(0, (mod_params.mod_height - mod_params.mod_TWThick) / 2.,
(mod_params.mod_FWThick + mod_params.mod_MPThick - mod_params.mod_BWThick) / 2));
if (allSen)
pvm.addPhysVolID("towerx", 1)
.addPhysVolID("towery", 1)
.addPhysVolID("layerz", 0)
.addPhysVolID("passive", 1);
pvm = vol_mod.placeVolume(
vol_modBottomPlate,
Position(0, -(mod_params.mod_height - mod_params.mod_TWThick) / 2.,
(mod_params.mod_FWThick + mod_params.mod_MPThick - mod_params.mod_BWThick) / 2));
if (allSen)
pvm.addPhysVolID("towerx", 2)
.addPhysVolID("towery", 1)
.addPhysVolID("layerz", 0)
.addPhysVolID("passive", 1);
double lengthA =
length - mod_params.mod_FWThick - mod_params.mod_MPThick + mod_params.mod_BWThick / 2;
double z_offSetPCB =
(mod_params.mod_FWThick + mod_params.mod_MPThick + mod_params.mod_BWThick) / 2 -
(lengthA - mod_params.mod_pcbLength) / 2.;
pvm = vol_mod.placeVolume(
vol_modPCB,
Position(-(mod_params.mod_width - 2 * mod_params.mod_SWThick - mod_params.mod_notchDepth) /
2.,
0, z_offSetPCB));
return vol_mod;
}
//************************************************************************************************************
//************************** create 8M module assembly ******************************************************
//************************************************************************************************************
Volume createFourMModule(Detector& desc, moduleParamsStrct mod_params,
std::vector<sliceParamsStrct> sl_params,
// int modID,
double length, SensitiveDetector sens, bool renderComp, bool allSen) {
std::string baseName = "LFHCAL_4M";
// assembly definition
Box modBox(mod_params.mod_width / 2., mod_params.mod_height / 2., length / 2.);
Volume vol_mod(baseName, modBox, desc.material("Air"));
printout(DEBUG, "LFHCAL_geo", "visualization string module: " + mod_params.mod_visStr);
vol_mod.setVisAttributes(desc.visAttributes(mod_params.mod_visStr.data()));
// placement operator
PlacedVolume pvm;
// ********************************************************************************
// Casing definition
// ********************************************************************************
// geom definition 8M module casing
Box MountingPlate(mod_params.mod_width / 2., mod_params.mod_height / 2.,
mod_params.mod_MPThick / 2.);
Box modFrontPlate(mod_params.mod_width / 2., mod_params.mod_height / 2.,
mod_params.mod_FWThick / 2.);
Box modSidePlateL(
mod_params.mod_SWThick / 2., mod_params.mod_height / 2.,
(length - mod_params.mod_MPThick - mod_params.mod_FWThick - mod_params.mod_BWThick) / 2.);
Box modSidePlateR(
mod_params.mod_SWThick / 2., mod_params.mod_height / 2.,
(length - mod_params.mod_MPThick - mod_params.mod_FWThick - mod_params.mod_BWThick) / 2.);
Box modTopPlate(
(mod_params.mod_width - 2 * mod_params.mod_SWThick) / 2., mod_params.mod_TWThick / 2.,
(length - mod_params.mod_MPThick - mod_params.mod_FWThick - mod_params.mod_BWThick) / 2.);
Box modBottomPlate(
(mod_params.mod_width - 2 * mod_params.mod_SWThick) / 2., mod_params.mod_TWThick / 2.,
(length - mod_params.mod_MPThick - mod_params.mod_FWThick - mod_params.mod_BWThick) / 2.);
Box modBackCutOut(mod_params.mod_BIwidth / 2., mod_params.mod_BIheight / 2.,
mod_params.mod_BWThick / 2.);
Box modBackPlateFull(mod_params.mod_width / 2., mod_params.mod_height / 2.,
mod_params.mod_BWThick / 2.);
SubtractionSolid modBackPlate(modBackPlateFull, modBackCutOut);
// volume definition 8M module casing
Volume vol_mountingPlate(baseName + "_MountingPlate", MountingPlate, desc.material("Steel235"));
Volume vol_modFrontPlate(baseName + "_FrontPlate", modFrontPlate, desc.material("Steel235"));
Volume vol_modBackPlate(baseName + "_BackPlate", modBackPlate, desc.material("Steel235"));
Volume vol_modSidePlateL(baseName + "_LeftSidePlate", modSidePlateL, desc.material("Steel235"));
Volume vol_modSidePlateR(baseName + "_RightSidePlate", modSidePlateR, desc.material("Steel235"));
Volume vol_modTopPlate(baseName + "_TopPlate", modTopPlate, desc.material("Steel235"));
Volume vol_modBottomPlate(baseName + "_BottomPlate", modBottomPlate, desc.material("Steel235"));
if (allSen) {
sens.setType("calorimeter");
vol_mountingPlate.setSensitiveDetector(sens);
vol_modFrontPlate.setSensitiveDetector(sens);
vol_modBackPlate.setSensitiveDetector(sens);
vol_modSidePlateL.setSensitiveDetector(sens);
vol_modSidePlateR.setSensitiveDetector(sens);
vol_modTopPlate.setSensitiveDetector(sens);
vol_modBottomPlate.setSensitiveDetector(sens);
}
if (renderComp) {
vol_mountingPlate.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
// mod_params.mod_visStr);
"LFHCALLayerTungstenVis");
vol_modFrontPlate.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
// mod_params.mod_visStr);
"LFHCALLayerSteelVis");
vol_modBackPlate.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
// mod_params.mod_visStr);
"LFHCALLayerSteelVis");
vol_modSidePlateL.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
mod_params.mod_visStr);
vol_modSidePlateR.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
mod_params.mod_visStr);
vol_modTopPlate.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
// mod_params.mod_visStr);
"LFHCALLayerSteelVis");
vol_modBottomPlate.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
// mod_params.mod_visStr);
"LFHCALLayerSteelVis");
} else {
vol_mountingPlate.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
"InvisibleNoDaughters");
vol_modFrontPlate.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
"InvisibleNoDaughters");
vol_modBackPlate.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
"InvisibleNoDaughters");
vol_modSidePlateL.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
"InvisibleNoDaughters");
vol_modSidePlateR.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
"InvisibleNoDaughters");
vol_modTopPlate.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
"InvisibleNoDaughters");
vol_modBottomPlate.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
"InvisibleNoDaughters");
}
// ********************************************************************************
// long PCB
// ********************************************************************************
Box modPCB(mod_params.mod_pcbThick / 2., mod_params.mod_pcbWidth / 2.,
(mod_params.mod_pcbLength) / 2.);
Volume vol_modPCB(baseName + "_PCB", modPCB, desc.material("Fr4"));
if (renderComp) {
vol_modPCB.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr, "LFHCALModPCB");
} else {
vol_modPCB.setAttributes(desc, mod_params.mod_regStr, mod_params.mod_limStr,
"InvisibleNoDaughters");
}
int layer_num = 0;
double slice_z = -length / 2 + mod_params.mod_MPThick +
mod_params.mod_FWThick; // Keeps track of layers' local z locations
// Looping through the number of repeated layers & slices in each section
for (int i = 0; i < (int)sl_params.size(); i++) {
slice_z += sl_params[i].slice_offset +
sl_params[i].slice_thick / 2.; // Going to halfway point in layer
layer_num = sl_params[i].layer_ID;
//*************************************************
// absorber plates
//*************************************************
Material slice_mat = desc.material(sl_params[i].slice_matStr);
if (sl_params[i].slice_partID == 1) {
Volume modAbsAssembly = createAbsorberPlate(
desc, baseName + "_Abs" + _toString(sl_params[i].layer_ID, "_layer_%d"),
mod_params.mod_height, mod_params.mod_width, mod_params.mod_TWThick,
mod_params.mod_SWThick, sl_params[i].slice_thick, mod_params.mod_notchDepth,
mod_params.mod_notchHeight, slice_mat, sl_params[i].slice_regStr,
sl_params[i].slice_limStr, sl_params[i].slice_visStr, renderComp);
// Placing slice within layer
if (allSen)
modAbsAssembly.setSensitiveDetector(sens);
pvm = vol_mod.placeVolume(modAbsAssembly,
Transform3D(RotationZYX(0, 0, 0), Position(0., 0., slice_z)));
if (allSen)
pvm.addPhysVolID("towerx", 0)
.addPhysVolID("towery", 0)
.addPhysVolID("rlayerz", sl_params[i].slice_readoutLayer)
.addPhysVolID("layerz", layer_num)
.addPhysVolID("passive", 1);
//*************************************************
// air & kapton & PCB & ESR
//*************************************************
} else if (sl_params[i].slice_partID == 2) {
Volume modFillAssembly =
createFillerPlate(desc,
baseName + "_Fill" + _toString(sl_params[i].layer_ID, "_layer_%d") +
_toString(sl_params[i].slice_ID, "slice_%d"),
mod_params.mod_height, mod_params.mod_width, mod_params.mod_TWThick,
mod_params.mod_SWThick, sl_params[i].slice_thick,
mod_params.mod_notchDepth, slice_mat, sl_params[i].slice_regStr,
sl_params[i].slice_limStr, sl_params[i].slice_visStr, renderComp);
// Placing slice within layer
if (allSen)
modFillAssembly.setSensitiveDetector(sens);
pvm = vol_mod.placeVolume(
modFillAssembly, Transform3D(RotationZYX(0, 0, 0),
Position((mod_params.mod_notchDepth) / 2., 0., slice_z)));
if (allSen)
pvm.addPhysVolID("towerx", 1)
.addPhysVolID("towery", 0)
.addPhysVolID("rlayerz", sl_params[i].slice_readoutLayer)
.addPhysVolID("layerz", layer_num)
.addPhysVolID("passive", 1);
//*************************************************
// scintillator
//*************************************************
} else {
Assembly modScintAssembly = createScintillatorPlateFourM(
desc, baseName + "_ScintAssembly" + _toString(sl_params[i].layer_ID, "_layer_%d"),
layer_num, mod_params.mod_height, mod_params.mod_width, mod_params.mod_TWThick,
mod_params.mod_SWThick, sl_params[i].slice_thick, mod_params.mod_notchDepth,
mod_params.mod_foilThick, slice_mat, sl_params[i].slice_readoutLayer,
sl_params[i].slice_regStr, sl_params[i].slice_limStr, sl_params[i].slice_visStr, sens,
renderComp);
// Placing slice within layer
pvm = vol_mod.placeVolume(
modScintAssembly, Transform3D(RotationZYX(0, 0, 0),
Position((mod_params.mod_notchDepth) / 2., 0, slice_z)));
}
slice_z += sl_params[i].slice_thick / 2.;
}
// placement 4M module casing
pvm = vol_mod.placeVolume(vol_mountingPlate,
Position(0, 0, -(length - mod_params.mod_MPThick) / 2.));
pvm = vol_mod.placeVolume(
vol_modFrontPlate,
Position(0, 0, -(length - mod_params.mod_FWThick) / 2. + mod_params.mod_MPThick));
if (allSen)
pvm.addPhysVolID("towerx", 2)
.addPhysVolID("towery", 0)
.addPhysVolID("layerz", 0)
.addPhysVolID("passive", 1);
pvm =
vol_mod.placeVolume(vol_modBackPlate, Position(0, 0, (length - mod_params.mod_BWThick) / 2.));
if (allSen)
pvm.addPhysVolID("towerx", 2)
.addPhysVolID("towery", 0)
.addPhysVolID("layerz", layer_num)
.addPhysVolID("passive", 1);
pvm = vol_mod.placeVolume(
vol_modSidePlateL,
Position(-(mod_params.mod_width - mod_params.mod_SWThick) / 2., 0,
(mod_params.mod_FWThick + mod_params.mod_MPThick - mod_params.mod_BWThick) / 2));
if (allSen)
pvm.addPhysVolID("towerx", 3)
.addPhysVolID("towery", 0)
.addPhysVolID("layerz", 0)
.addPhysVolID("passive", 1);
pvm = vol_mod.placeVolume(
vol_modSidePlateR,
Position((mod_params.mod_width - mod_params.mod_SWThick) / 2., 0,
(mod_params.mod_FWThick + mod_params.mod_MPThick - mod_params.mod_BWThick) / 2));
if (allSen)
pvm.addPhysVolID("towerx", 0)
.addPhysVolID("towery", 1)
.addPhysVolID("layerz", 0)
.addPhysVolID("passive", 1);
pvm = vol_mod.placeVolume(
vol_modTopPlate,
Position(0, (mod_params.mod_height - mod_params.mod_TWThick) / 2.,
(mod_params.mod_FWThick + mod_params.mod_MPThick - mod_params.mod_BWThick) / 2));
if (allSen)
pvm.addPhysVolID("towerx", 1)
.addPhysVolID("towery", 1)
.addPhysVolID("layerz", 0)
.addPhysVolID("passive", 1);
pvm = vol_mod.placeVolume(
vol_modBottomPlate,
Position(0, -(mod_params.mod_height - mod_params.mod_TWThick) / 2.,
(mod_params.mod_FWThick + mod_params.mod_MPThick - mod_params.mod_BWThick) / 2));
if (allSen)
pvm.addPhysVolID("towerx", 2)
.addPhysVolID("towery", 1)
.addPhysVolID("layerz", 0)
.addPhysVolID("passive", 1);
double lengthA =
length - mod_params.mod_FWThick - mod_params.mod_MPThick + mod_params.mod_BWThick / 2;
double z_offSetPCB =
(mod_params.mod_FWThick + mod_params.mod_MPThick + mod_params.mod_BWThick) / 2 -
(lengthA - mod_params.mod_pcbLength) / 2.;
pvm = vol_mod.placeVolume(
vol_modPCB,
Position(-(mod_params.mod_width - 2 * mod_params.mod_SWThick - mod_params.mod_notchDepth) /
2.,
0, z_offSetPCB));
return vol_mod;
}
//********************************************************************************************
//* *
//* Create detector *
//============================== MAIN FUNCTION =============================================
//* *
//********************************************************************************************
static Ref_t createDetector(Detector& desc, xml_h handle, SensitiveDetector sens) {
// global detector variables
xml_det_t detElem = handle;
std::string detName = detElem.nameStr();
int detID = detElem.id();
// general detector dimensions
xml_dim_t dim = detElem.dimensions();
double length = dim.z(); // Size along z-axis
// general detector position
xml_dim_t pos = detElem.position();
printout(DEBUG, "LFHCAL_geo",
"global LFHCal position " + _toString(pos.x()) + "\t" + _toString(pos.y()) + "\t" +
_toString(pos.z()));
// envelope volume
xml_comp_t x_env = detElem.child(_Unicode(envelope));
Tube rmaxtube(0, dim.rmax(), dim.z() / 2);