diff --git a/compact/dirc.xml b/compact/dirc.xml index d759866d2d903e8f702073d422b53e12f72b286e..b5f21f7a5fdb6c3cf649b568c7c01bb63f3c5e3b 100644 --- a/compact/dirc.xml +++ b/compact/dirc.xml @@ -1,29 +1,103 @@ <lccdd> - <comment>Initial implementation of the Athena Detector - DIRC (ported from g4e). Currently constructed around - a fixed radius of 83.65cm (between the uRWEL layers). - TODO: this needs to be properly parameterized. + <comment> + DIRC consists of 16 (default) identical modules making a barrel. + Each DIRC module consists of: + _______ + [ | \ + [ | \ + [FD|Prizm|Lens|--------bars+glue-----|mirror] + + Main constants to control DIRC global geometry: + - DIRC_length + - DIRC_offset + - DIRC_rmin + - DIRCBox_count (16 full dirc, 1 - a single module) + - DIRC_rotation (allows to flip the DIRC) + + When DIRC_length is set, it affects bars length (all other lengths are fixed) + The width of each DIRC module is derived from DIRCPrism_width + </comment> <define> - <comment> - ### DIRC parameters - </comment> <constant name="DIRC_length" value="CentralTracking_length + BackwardPIDLength"/> <constant name="DIRC_offset" value="(CentralTracking_length - DIRC_length)/2.0"/> + <constant name="DIRC_rmin" value="83.65*cm"/> + <constant name="DIRC_rotation" value="pi" comment="Allows DIRC flip"/> + <!-- <constant name="cb_DIRC_length" value="DIRCLength"/> --> + <!-- CLEANUP THIS if not sure. This is from the initial implementation + <constant name="DIRC_length" value="285.500*cm"/> + <constant name="DIRC_rmin" value="82.00*cm"/>--> + + <!-- Prism --> + <constant name="DIRCPrism_width" value="360*mm"/> + <constant name="DIRCPrism_length" value="300*mm"/> + <constant name="DIRCPrism_short_edge" value="50*mm"/> + <constant name="DIRCPrism_angle" value="32*deg"/> + <constant name="DIRCPrism_long_edge" value="DIRCPrism_short_edge + DIRCPrism_length * tan(DIRCPrism_angle)"/> + <constant name="DIRCPrism_height" value="DIRCPrism_long_edge"/> - <constant name="DIRC_rmin" value="83.65*cm"/> - <constant name="DIRC_rmin" value="TrackerBarrel_rmax"/> - <constant name="DIRCBars_DX" value="1.7*cm"/> - <constant name="DIRCBars_DY" value="42.*cm"/> - <constant name="DIRCNum" value="2*Pi*DIRC_rmin/DIRCBars_DY"/> - <constant name="DIRCDPhi" value="DIRCBars_DY/DIRC_rmin"/> + <!-- Box - main DIRC modules --> + <constant name="DIRCBox_count" value="16" comment="Number of DIRC boxes per... DIRC. 16 - default"/> + <constant name="DIRCBox_width" value="DIRCPrism_width"/> - <constant name="DIRC_rmin" value="82.00*cm"/> - <constant name="DIRC_rmax" value="88.00*cm"/> + <!-- Mirror --> + <constant name="DIRCMirror_height" value="20 * mm"/> + <constant name="DIRCMirror_width" value="DIRCPrism_width"/> + <constant name="DIRCMirror_thickness" value="1 * mm"/> + + <!-- Lens --> + <constant name="DIRCLens_height" value="DIRCPrism_long_edge"/> + <constant name="DIRCLens_width" value="DIRCPrism_width"/> + <constant name="DIRCLens_thickness" value="12 * mm"/> + <constant name="DIRCLens_r1" value="33 * mm"/> + <constant name="DIRCLens_r2" value="24 * mm"/> + <constant name="DIRCLens_shight" value="25 * mm" comment="Is 'shight' from UK urban dictionary???"/> + + <!-- FD (Foto detectors?) --> + <constant name="DIRCFd_height" value="DIRCPrism_height"/> + <constant name="DIRCFd_width" value="DIRCPrism_width"/> + <constant name="DIRCFd_thickness" value="1*mm"/> + + <!-- Bar - Each DIRC box consists of N "bars" --> + <!-- BarAssembly - Bars + Glue --> + <constant name="DIRCBarAssm_length" value="DIRC_length - DIRCPrism_length - DIRCMirror_thickness - DIRCLens_thickness - DIRCFd_thickness" comment="Length of bars+glue assembly"/> + <constant name="DIRCBar_count" value="11" comment="Number of bars per box"/> + <constant name="DIRCBar_gap" value="0.15 * mm"/> + <constant name="DIRCBar_height" value="17 * mm"/> + <constant name="DIRCBar_width" value="(DIRCPrism_width - (DIRCBar_count - 1) * DIRCBar_gap) / DIRCBar_count"/> + <constant name="DIRCGlue_thickness" value="0.05 * mm"/> + <constant name="DIRCBar_length" value="(DIRCBarAssm_length-4*DIRCGlue_thickness)/4"/> + + <!-- dirc outer volume --> + <comment> + RMax is calculated according to "rectangle inside ring" problem solution + https://math.stackexchange.com/questions/4222684/calculate-rectangle-inside-ring-parameters/4222691#4222691 + </comment> + <constant name="DIRC_rmax" value="sqrt( (DIRC_rmin+DIRCPrism_height)^2 + 0.25*(DIRCPrism_height)^2 )"/> </define> + <materials> + <comment> + Only non optical material variants are here. + See optical_materials.xml for optical ones + - + </comment> + + <material name="Epotek"> + <D type="density" value="1.2" unit="g/cm3"/> + <composite n="5" ref="H"/> + <composite n="3" ref="C"/> + <composite n="2" ref="O"/> + </material> + <material name="Nlak33a"> + <D type="density" value="4.220" unit="g/cm3"/> + <composite n="1" ref="Si"/> + <composite n="2" ref="O"/> + </material> + </materials> + <limits> </limits> @@ -31,31 +105,73 @@ </regions> <display> + <vis name="DIRCTube" alpha="0.1" r="0" g="0.6" b="0.6" visible="true" showDaughters="true" lineStyle="solid" drawingStyle="solid" /> + <vis name="DIRCBox" alpha="0.1" r="256/256" g="256/256" b="256/256" visible="true" showDaughters="true" lineStyle="solid" drawingStyle="solid" /> + <vis name="DIRCLens1" alpha="1" r="3/256" g="37/256" b="76/256" visible="true" showDaughters="false" lineStyle="solid" drawingStyle="solid" /> + <vis name="DIRCLens2" alpha="1" r="17/256" g="103/256" b="177/256" visible="true" showDaughters="false" lineStyle="solid" drawingStyle="solid" /> + <vis name="DIRCLens3" alpha="1" r="0/256" g="128/256" b="128/256" visible="true" showDaughters="false" lineStyle="solid" drawingStyle="solid" /> + <vis name="DIRCBar" alpha="1" r="0/256" g="128/256" b="128/256" visible="true" showDaughters="false" lineStyle="solid" drawingStyle="solid" /> + <vis name="DIRCGlue" alpha="1" r="125/256" g="0/256" b="128/256" visible="true" showDaughters="false" lineStyle="solid" drawingStyle="solid" /> + <vis name="DIRCMirror" alpha="1" r="0" g="0" b="1" visible="true" showDaughters="false" lineStyle="solid" drawingStyle="solid" /> + <vis name="DIRCPrism" alpha="1" r="212/256" g="175/256" b="55/256" visible="true" showDaughters="false" lineStyle="solid" drawingStyle="solid" /> + <vis name="DIRCFd" alpha="1" r="0.7" g="0" b="0" visible="true" showDaughters="false" /> </display> <detectors> - <detector id="BarrelDIRC_ID" name="DIRC" type="DIRC" readout="DIRCHits" vis="AnlTeal"> - <dimensions rmin="DIRC_rmin" rmax="DIRC_rmax" length="DIRC_length" radius="DIRC_rmin" dx="DIRCBars_DX" dy="DIRCBars_DY" number="DIRCNum" deltaphi="DIRCDPhi"/> + <detector id="BarrelDIRC_ID" name="cb_DIRC" type="cb_DIRC" readout="DIRCBarHits" vis="DIRCTube"> + <dimensions rmin="DIRC_rmin" rmax="DIRC_rmax" length="DIRC_length" radius="DIRCRadius" dx="DIRCBars_DX" dy="DIRCBars_DY" number="DIRCNum" deltaphi="DIRCDPhi"/> <position x="0" y="0" z="DIRC_offset"/> - <module name="Module0" R="DIRC_rmin" phi="0*DIRCDPhi" /> - <module name="Module1" R="DIRC_rmin" phi="1*DIRCDPhi" /> - <module name="Module2" R="DIRC_rmin" phi="2*DIRCDPhi" /> - <module name="Module3" R="DIRC_rmin" phi="3*DIRCDPhi" /> - <module name="Module4" R="DIRC_rmin" phi="4*DIRCDPhi" /> - <module name="Module5" R="DIRC_rmin" phi="5*DIRCDPhi" /> - <module name="Module6" R="DIRC_rmin" phi="6*DIRCDPhi" /> - <module name="Module7" R="DIRC_rmin" phi="7*DIRCDPhi" /> - <module name="Module8" R="DIRC_rmin" phi="8*DIRCDPhi" /> - <module name="Module9" R="DIRC_rmin" phi="9*DIRCDPhi" /> - <module name="Module10" R="DIRC_rmin" phi="10*DIRCDPhi" /> - <module name="Module11" R="DIRC_rmin" phi="11*DIRCDPhi" /> + <rotation theta="DIRC_rotation"/> + <module name="DircBox" R="DIRCRadius" repeat="DIRCBox_count" width="DIRCPrism_width + 1*mm" height="DIRCPrism_height*2" length="DIRCBarAssm_length + 550*mm" vis="DIRCBox"> + <!-- Mirror (at the end of the module) --> + <mirror + height="DIRCMirror_height" + width="DIRCMirror_width" + thickness="DIRCMirror_thickness" + material="Aluminum" + vis="DIRCMirror" + /> + + <!-- DIRC Bar --> + <!-- TODO parametrize as bar+glue assembly with layers --> + <bar + height="DIRCBar_height" + width="DIRCBar_width" + length="DIRCBar_length" + repeat="DIRCBar_count" + gap="DIRCBar_gap" + material="Quartz" + vis="DIRCBar" + /> + + <glue thickness="DIRCGlue_thickness" material="Epotek" vis="DIRCGlue"/> + + <!-- lens --> + <lens + height="DIRCLens_height" + width="DIRCLens_width" + thickness="DIRCLens_thickness" + r1="DIRCLens_r1" + r2="DIRCLens_r2" + /> + + <prism/> <!-- TODO parametrize here --> + + <fd + height="DIRCFd_height" + width="DIRCFd_width" + thickness="DIRCFd_thickness" + vis="DIRCFd" + material="Quartz" + /> + </module> </detector> </detectors> <readouts> - <readout name="DIRCHits"> + <readout name="DIRCBarHits"> <segmentation type="CartesianGridXY" grid_size_x="3.0*mm" grid_size_y="3.0*mm" /> - <id>system:8,barrel:3,module:12,x:32:-16,y:-16</id> + <id>system:8,module:8,section:8,bar:8,x:32:-16,y:-16</id> </readout> </readouts> diff --git a/compact/optical_materials.xml b/compact/optical_materials.xml index 242add12e34e2c780f26c0a8c95f20615b4df127..66bd455a29f9abc461aefa46178c9e0fd8aad605 100644 --- a/compact/optical_materials.xml +++ b/compact/optical_materials.xml @@ -27,6 +27,317 @@ 4.0*eV 10.0*cm 5.1*eV 10.0*cm "/> + <matrix name="RINDEX__DIRCQuartz" coldim="2" values=" + 1.90745*eV 1.45653 + 1.93725*eV 1.45681 + 1.968*eV 1.4571 + 1.99974*eV 1.4574 + 2.03253*eV 1.45771 + 2.0664*eV 1.45804 + 2.10143*eV 1.45838 + 2.13766*eV 1.45873 + 2.17516*eV 1.45911 + 2.214*eV 1.4595 + 2.25426*eV 1.45991 + 2.296*eV 1.46034 + 2.33932*eV 1.4608 + 2.38431*eV 1.46128 + 2.43106*eV 1.46179 + 2.47968*eV 1.46233 + 2.53029*eV 1.4629 + 2.583*eV 1.4635 + 2.63796*eV 1.46415 + 2.69531*eV 1.46483 + 2.7552*eV 1.46557 + 2.81782*eV 1.46635 + 2.88335*eV 1.46719 + 2.952*eV 1.46809 + 3.024*eV 1.46907 + 3.0996*eV 1.47012 + 3.17908*eV 1.47125 + 3.26274*eV 1.47249 + 3.35092*eV 1.47383 + 3.44401*eV 1.47529 + 3.54241*eV 1.47689 + 3.64659*eV 1.47865 + 3.7571*eV 1.48059 + 3.87451*eV 1.48274 + 3.99949*eV 1.48513 + 4.13281*eV 1.48779 + "/> + <matrix name="ABSLENGTH__DIRCQuartz" coldim="2" values=" + 1.90745*eV 2.33615e+06*mm + 1.93725*eV 2.19567e+06*mm + 1.968*eV 2.06162e+06*mm + 1.99974*eV 1.93381e+06*mm + 2.03253*eV 1.81203e+06*mm + 2.0664*eV 1.6961e+06*mm + 2.10143*eV 1.58582e+06*mm + 2.13766*eV 1.48101e+06*mm + 2.17516*eV 1.38148e+06*mm + 2.214*eV 1.28706e+06*mm + 2.25426*eV 1.19756e+06*mm + 2.296*eV 1.11281e+06*mm + 2.33932*eV 1.03264e+06*mm + 2.38431*eV 956885*mm + 2.43106*eV 885374*mm + 2.47968*eV 817949*mm + 2.53029*eV 754450*mm + 2.583*eV 694722*mm + 2.63796*eV 638613*mm + 2.69531*eV 585973*mm + 2.7552*eV 536656*mm + 2.81782*eV 490520*mm + 2.88335*eV 447425*mm + 2.952*eV 407233*mm + 3.024*eV 369813*mm + 3.0996*eV 335032*mm + 3.17908*eV 302764*mm + 3.26274*eV 272886*mm + 3.35092*eV 245275*mm + 3.44401*eV 219814*mm + 3.54241*eV 196390*mm + 3.64659*eV 174889*mm + 3.7571*eV 155204*mm + 3.87451*eV 137229*mm + 3.99949*eV 120863*mm + 4.13281*eV 106006*mm + "/> + <matrix name="RINDEX__DIRCEpotek" coldim="2" values=" + 1.90745*eV 1.55403 + 1.93725*eV 1.55557 + 1.968*eV 1.55698 + 1.99974*eV 1.55827 + 2.03253*eV 1.55945 + 2.0664*eV 1.56056 + 2.10143*eV 1.5616 + 2.13766*eV 1.5626 + 2.17516*eV 1.56358 + 2.214*eV 1.56455 + 2.25426*eV 1.56553 + 2.296*eV 1.56654 + 2.33932*eV 1.5676 + 2.38431*eV 1.56872 + 2.43106*eV 1.56993 + 2.47968*eV 1.57125 + 2.53029*eV 1.57269 + 2.583*eV 1.57427 + 2.63796*eV 1.57601 + 2.69531*eV 1.57793 + 2.7552*eV 1.58005 + 2.81782*eV 1.58238 + 2.88335*eV 1.58495 + 2.952*eV 1.58777 + 3.024*eV 1.59086 + 3.0996*eV 1.59424 + 3.17908*eV 1.59793 + 3.26274*eV 1.60195 + 3.35092*eV 1.60631 + 3.44401*eV 1.61103 + 3.54241*eV 1.61614 + 3.64659*eV 1.62165 + 3.7571*eV 1.62758 + 3.87451*eV 1.63395 + 3.99949*eV 1.64077 + 4.13281*eV 1.64807 + "/> + <matrix name="ABSLENGTH__DIRCEpotek" coldim="2" values=" + 1.90745*eV 2.33615e+06*mm + 1.93725*eV 2.19567e+06*mm + 1.968*eV 2.06162e+06*mm + 1.99974*eV 1.93381e+06*mm + 2.03253*eV 1.81203e+06*mm + 2.0664*eV 1.6961e+06*mm + 2.10143*eV 1.58582e+06*mm + 2.13766*eV 1.48101e+06*mm + 2.17516*eV 1.38148e+06*mm + 2.214*eV 1.28706e+06*mm + 2.25426*eV 1.19756e+06*mm + 2.296*eV 1.11281e+06*mm + 2.33932*eV 1.03264e+06*mm + 2.38431*eV 956885*mm + 2.43106*eV 885374*mm + 2.47968*eV 817949*mm + 2.53029*eV 754450*mm + 2.583*eV 694722*mm + 2.63796*eV 638613*mm + 2.69531*eV 585973*mm + 2.7552*eV 536656*mm + 2.81782*eV 490520*mm + 2.88335*eV 447425*mm + 2.952*eV 407233*mm + 3.024*eV 369813*mm + 3.0996*eV 335032*mm + 3.17908*eV 302764*mm + 3.26274*eV 272886*mm + 3.35092*eV 245275*mm + 3.44401*eV 219814*mm + 3.54241*eV 196390*mm + 3.64659*eV 174889*mm + 3.7571*eV 155204*mm + 3.87451*eV 137229*mm + 3.99949*eV 120863*mm + 4.13281*eV 106006*mm + "/> + + <matrix name="RINDEX__DIRCNlak33a" coldim="2" values=" + 1.0*eV 1.73816 + 1.2511*eV 1.73836 + 1.26386*eV 1.73858 + 1.27687*eV 1.73881 + 1.29016*eV 1.73904 + 1.30372*eV 1.73928 + 1.31758*eV 1.73952 + 1.33173*eV 1.73976 + 1.34619*eV 1.74001 + 1.36097*eV 1.74026 + 1.37607*eV 1.74052 + 1.39152*eV 1.74078 + 1.40731*eV 1.74105 + 1.42347*eV 1.74132 + 1.44*eV 1.7416 + 1.45692*eV 1.74189 + 1.47425*eV 1.74218 + 1.49199*eV 1.74249 + 1.51016*eV 1.74279 + 1.52878*eV 1.74311 + 1.54787*eV 1.74344 + 1.56744*eV 1.74378 + 1.58751*eV 1.74412 + 1.6081*eV 1.74448 + 1.62923*eV 1.74485 + 1.65092*eV 1.74522 + 1.6732*eV 1.74562 + 1.69609*eV 1.74602 + 1.71961*eV 1.74644 + 1.7438*eV 1.74687 + 1.76868*eV 1.74732 + 1.79427*eV 1.74779 + 1.82062*eV 1.74827 + 1.84775*eV 1.74878 + 1.87571*eV 1.7493 + 1.90452*eV 1.74985 + 1.93423*eV 1.75042 + 1.96488*eV 1.75101 + 1.99652*eV 1.75163 + 2.0292*eV 1.75228 + 2.06296*eV 1.75296 + 2.09787*eV 1.75368 + 2.13398*eV 1.75443 + 2.17135*eV 1.75521 + 2.21006*eV 1.75604 + 2.25017*eV 1.75692 + 2.29176*eV 1.75784 + 2.33492*eV 1.75882 + 2.37973*eV 1.75985 + 2.42631*eV 1.76095 + 2.47473*eV 1.76211 + 2.52514*eV 1.76335 + 2.57763*eV 1.76467 + 2.63236*eV 1.76608 + 2.68946*eV 1.76758 + 2.7491*eV 1.7692 + 2.81143*eV 1.77093 + 2.87666*eV 1.77279 + 2.94499*eV 1.7748 + 3.01665*eV 1.77698 + 3.09187*eV 1.77934 + 3.17095*eV 1.7819 + 3.25418*eV 1.7847 + 3.34189*eV 1.78775 + 3.43446*eV 1.79111 + 3.53231*eV 1.79481 + 3.6359*eV 1.79889 + 3.74575*eV 1.80343 + 3.86244*eV 1.8085 + 3.98663*eV 1.81419 + 4.11908*eV 1.82061 + 4.26062*eV 1.8279 + 4.41225*eV 1.83625 + 4.57506*eV 1.84589 + 4.75035*eV 1.85713 + 4.93961*eV 1.87039 + "/> + <matrix name="ABSLENGTH__DIRCNlak33a" coldim="2" values=" + 1.0*eV 371813*mm + 1.2511*eV 352095*mm + 1.26386*eV 331021*mm + 1.27687*eV 310814*mm + 1.29016*eV 291458*mm + 1.30372*eV 272937*mm + 1.31758*eV 255238*mm + 1.33173*eV 238342*mm + 1.34619*eV 222234*mm + 1.36097*eV 206897*mm + 1.37607*eV 192313*mm + 1.39152*eV 178463*mm + 1.40731*eV 165331*mm + 1.42347*eV 152896*mm + 1.44*eV 141140*mm + 1.45692*eV 130043*mm + 1.47425*eV 119585*mm + 1.49199*eV 109747*mm + 1.51016*eV 100507*mm + 1.52878*eV 91846.3*mm + 1.54787*eV 83743.1*mm + 1.56744*eV 76176.7*mm + 1.58751*eV 69126.1*mm + 1.6081*eV 62570.2*mm + 1.62923*eV 56488.0*mm + 1.65092*eV 50858.3*mm + 1.6732*eV 45660.1*mm + 1.69609*eV 40872.4*mm + 1.71961*eV 36474.6*mm + 1.7438*eV 32445.8*mm + 1.76868*eV 28765.9*mm + 1.79427*eV 25414.6*mm + 1.82062*eV 22372.2*mm + 1.84775*eV 19619.3*mm + 1.87571*eV 17136.9*mm + 1.90452*eV 14906.5*mm + 1.93423*eV 12910.2*mm + 1.96488*eV 11130.3*mm + 1.99652*eV 9550.13*mm + 2.0292*eV 8153.3*mm + 2.06296*eV 6924.25*mm + 2.09787*eV 5848.04*mm + 2.13398*eV 4910.46*mm + 2.17135*eV 4098.04*mm + 2.21006*eV 3398.06*mm + 2.25017*eV 2798.54*mm + 2.29176*eV 2288.32*mm + 2.33492*eV 1856.99*mm + 2.37973*eV 1494.92*mm + 2.42631*eV 1193.28*mm + 2.47473*eV 943.973*mm + 2.52514*eV 739.657*mm + 2.57763*eV 573.715*mm + 2.63236*eV 440.228*mm + 2.68946*eV 333.94*mm + 2.7491*eV 250.229*mm + 2.81143*eV 185.064*mm + 2.87666*eV 134.967*mm + 2.94499*eV 96.9664*mm + 3.01665*eV 68.5529*mm + 3.09187*eV 47.6343*mm + 3.17095*eV 32.4882*mm + 3.25418*eV 21.7174*mm + 3.34189*eV 14.2056*mm + 3.43446*eV 9.07612*mm + 3.53231*eV 5.65267*mm + 3.6359*eV 3.4241*mm + 3.74575*eV 2.01226*mm + 3.86244*eV 1.14403*mm + 3.98663*eV 0.62722*mm + 4.11908*eV 0.330414*mm + 4.26062*eV 0.166558*mm + 4.41225*eV 0.0799649*mm + 4.57506*eV 0.0363677*mm + 4.75035*eV 0.0155708*mm + 4.93961*eV 0.00623089*mm + "/> + + <matrix name= "REFLECTIVITY_mirror" coldim="2" values=" 1.0*eV 0.9 4.0*eV 0.9 @@ -420,6 +731,37 @@ <property name="ABSLENGTH" ref="ABSLENGTH__Acrylic_DRICH"/> </material> <!-- END dRICh material definitions --> + <material name="QuartzOptical"> + <D type="density" value="2.2" unit="g/cm3"/> + <composite n="1" ref="Si"/> + <composite n="2" ref="O"/> + <property name="RINDEX" ref="RINDEX__DIRCQuartz"/> + <property name="ABSLENGTH" ref="ABSLENGTH__DIRCQuartz"/> + </material> + <material name="EpotekOptical"> + <D type="density" value="1.2" unit="g/cm3"/> + <composite n="5" ref="H"/> + <composite n="3" ref="C"/> + <composite n="2" ref="O"/> + <property name="RINDEX" ref="RINDEX__DIRCEpotek"/> + <property name="ABSLENGTH" ref="ABSLENGTH__DIRCEpotek"/> + <!-- G4Material *Epotek = new G4Material("Epotek", density = 1.2 * g / cm3, ncomponents = 3); + Epotek->AddElement(C, natoms = 3); + Epotek->AddElement(H, natoms = 5); + Epotek->AddElement(O, natoms = 2);--> + </material> + <material name="Nlak33aOptical"> + <D type="density" value="4.220" unit="g/cm3"/> + <composite n="1" ref="Si"/> + <composite n="2" ref="O"/> + <property name="RINDEX" ref="RINDEX__DIRCNlak33a"/> + <property name="ABSLENGTH" ref="ABSLENGTH__DIRCNlak33a"/> + <!-- + Nlak33aMaterial = new G4Material("Nlak33a", density = 4.220 * g / cm3, ncomponents = 2); + Nlak33aMaterial->AddElement(Si, natoms = 1); + Nlak33aMaterial->AddElement(O, natoms = 2); + --> + </material> </materials> <surfaces> <opticalsurface finish="polished" model="glisur" name="MirrorOpticalSurface" type="dielectric_metal" value="0"> diff --git a/compact/subsystem_views/dirc_only.xml b/compact/subsystem_views/dirc_only.xml new file mode 100644 index 0000000000000000000000000000000000000000..68d88c247505a418938aab6fa296241140b65d76 --- /dev/null +++ b/compact/subsystem_views/dirc_only.xml @@ -0,0 +1,178 @@ +<lccdd xmlns:compact="http://www.lcsim.org/schemas/compact/1.0" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/compact/1.0/compact.xsd"> + + <debug> + <type name="surface" value="1"/> + <type name="material" value="1"/> + <type name="readout" value="1"/> + <type name="segmentation" value="1"/> + <type name="limits" value="1"/> + <type name="region" value="1"/> + <type name="includes" value="1"/> + </debug> + + <documentation level="-1"> + # Athena Detector + - https://eicweb.phy.anl.gov/EIC/detectors/athena.git + - https://eicweb.phy.anl.gov/EIC/detectors/ip6.git + </documentation> + + <!-- Some information about detector --> + <info name="Athena Detector" title="Athena Detector" + author="Athena Collaboration" + url="https://eicweb.phy.anl.gov/EIC/detectors/athena.git" + status="development" + version="v1 2021-03-16"> + <comment> Athena </comment> + </info> + <define> + <documentation level="2"> + ## Main Constant Definitions + + The ip6 (or other ip) defines should be included first. + These files have only a define tags. + </documentation> + <include ref="ip6/ip6_defs.xml" /> + <include ref="compact/definitions.xml" /> + </define> + + <includes> + <gdmlFile ref="compact/elements.xml"/> + <gdmlFile ref="compact/materials.xml"/> + <file ref="compact/optical_materials.xml"/> + </includes> + + <limits> + <limitset name="EICBeamlineLimits"> + <limit name="step_length_max" particles="*" value="1.0" unit="mm" /> + <limit name="track_length_max" particles="*" value="1.0" unit="mm" /> + <limit name="time_max" particles="*" value="0.1" unit="ns" /> + <limit name="ekin_min" particles="*" value="0.001" unit="MeV" /> + <limit name="range_min" particles="*" value="0.1" unit="mm" /> + </limitset> + <limitset name="cal_limits"> + <limit name="step_length_max" particles="*" value="5.0" unit="mm"/> + </limitset> + </limits> + + <display> + <include ref="compact/display.xml" /> + </display> + + <documentation level="0"> + ## Detector Subsystems + + ### IP Subsystems + + The interaction point subsystems are included before the central detector subsystems. + This is becuase the IP subsystems, for exmaple the beampipe, will define paramters + which are subsquently used in the central detector construction -- e.g. the vertex tracker + uses the beampipe OD to help define its placement. + + The IP subsystems include the Far forward and backward regions. The list of subsystem includes: + - Interaction region beampipe + - B0 tracker + - Off-momentum tracker + - Far forward roman pots + - Zero Degree Calorimeter + - Beam line magnets. + - and more... + </documentation> + +<!-- <include ref="ip6/forward_ion_beamline.xml"/>--> +<!-- <include ref="ip6/beampipe.xml"/>--> + + <detectors> +<!-- <detector id="VertexBarrelSubAssembly_ID"--> +<!-- name="VertexBarrelSubAssembly"--> +<!-- type="DD4hep_SubdetectorAssembly"--> +<!-- vis="TrackerSubAssemblyVis">--> +<!-- <composite name="VertexBarrel" />--> +<!-- </detector>--> +<!-- <detector id="VertexEndcapSubAssembly_ID"--> +<!-- name="VertexEndcapSubAssembly"--> +<!-- type="DD4hep_SubdetectorAssembly"--> +<!-- vis="TrackerSubAssemblyVis">--> +<!-- <composite name="VertexEndcapN" />--> +<!-- <composite name="VertexEndcapP" />--> +<!-- </detector>--> + +<!-- <detector id="TrackerBarrelSubAssembly_Inner_ID"--> +<!-- name="TrackerBarrelSubAssembly_Inner"--> +<!-- type="DD4hep_SubdetectorAssembly"--> +<!-- vis="TrackerSubAssemblyVis">--> +<!-- <composite name="TrackerBarrel_Inner"/>--> +<!-- </detector>--> +<!-- <detector id="TrackerEndcapSubAssembly_Inner_ID"--> +<!-- name="TrackerEndcapSubAssembly_Inner"--> +<!-- type="DD4hep_SubdetectorAssembly"--> +<!-- vis="TrackerSubAssemblyVis">--> +<!-- <composite name="TrackerEndcapN_Inner"/>--> +<!-- <composite name="TrackerEndcapP_Inner"/>--> +<!-- </detector>--> + +<!-- <detector id="TrackerBarrelSubAssembly_Outer_ID"--> +<!-- name="TrackerSubAssembly_Outer"--> +<!-- type="DD4hep_SubdetectorAssembly"--> +<!-- vis="TrackerSubAssemblyVis">--> +<!-- <composite name="TrackerBarrel_Outer"/>--> +<!-- <composite name="TrackerEndcapP_Outer"/>--> +<!-- <composite name="TrackerEndcapN_Outer"/>--> +<!-- </detector>--> + +<!-- <detector id="TOFSubAssembly_ID"--> +<!-- name="TOFSubAssembly"--> +<!-- type="DD4hep_SubdetectorAssembly"--> +<!-- vis="TOFSubAssemblyVis">--> +<!-- <composite name="BarrelTOF"/>--> +<!-- <composite name="ForwardTOF"/>--> +<!-- <composite name="BackwardTOF"/>--> +<!-- </detector>--> + + </detectors> + +<!-- <include ref="compact/vertex_tracker.xml"/>--> + +<!-- <include ref="compact/central_tracker.xml"/>--> + +<!-- <include ref="compact/tof_barrel.xml"/>--> +<!-- <include ref="compact/tof_endcap.xml"/>--> + + <!--include ref="compact/rwell_tracker_barrel.xml"--> + + <include ref="compact/dirc.xml"/> + + <!-- When changing magnet, also select dimensions in definitions.xml. --> +<!-- <include ref="compact/solenoid.xml"/>--> + +<!-- <include ref="compact/ci_ecal.xml"/>--> + <!--<include ref="compact/ci_ecal_shashlik.xml"/>--> + <!--<include ref="compact/ce_ecal.xml"/>--> +<!-- <include ref="compact/ce_ecal_crystal_glass.xml"/>--> + <!-- <include ref="compact/ecal_barrel.xml"/> --> + <!-- <include ref="compact/ecal_barrel_hybrid.xml"/> --> +<!-- <include ref="compact/ecal_barrel_interlayers.xml"/>--> + +<!-- <include ref="compact/hcal.xml"/>--> + + <!--include ref="compact/ce_GEM.xml"/--> + <!--include ref="compact/gem_tracker_endcap.xml"/--> + <!--include ref="compact/mrich.xml"/--> +<!-- <include ref="compact/forward_trd.xml"/>--> +<!-- <include ref="compact/gaseous_rich.xml"/>--> + +<!-- <include ref="ip6/B0_tracker.xml"/>--> +<!-- <include ref="ip6/far_forward_offM_tracker.xml"/>--> +<!-- <include ref="ip6/far_forward_romanpots.xml"/>--> +<!-- <include ref="ip6/far_forward_detectors.xml"/>--> + + <!-- + <include ref="compact/mm_tracker_barrel.xml"/> + <include ref="compact/cb_VTX_Barrel.xml"/> + --> + + <readouts> + </readouts> + +</lccdd> diff --git a/macro/dirc_vis.mac b/macro/dirc_vis.mac new file mode 100644 index 0000000000000000000000000000000000000000..1d68dcf39b5a56c55a08be6e4946f7135ce0d193 --- /dev/null +++ b/macro/dirc_vis.mac @@ -0,0 +1,203 @@ +# npsim --runType vis --compactFile athena.xml --random.seed 1 --enableGun --gun.energy 2*GeV --gun.thetaMin 90*deg --gun.thetaMax 90*deg --gun.distribution uniform --macro macro/dirc_vis.mac --outputFile dirc_vis.root + +/vis/list + +# Use this open statement to create an OpenGL view: +/vis/open OGL 600x600-0+0 + + +# +# Use this open statement to create a .prim file suitable for +# viewing in DAWN: +#/vis/open DAWNFILE +# +# Use this open statement to create a .heprep file suitable for +# viewing in HepRApp: +#/vis/open HepRepFile +# +# Use this open statement to create a .wrl file suitable for +# viewing in a VRML viewer: +#/vis/open VRML2FILE +# +# Disable auto refresh and quieten vis messages whilst scene and +# trajectories are established: +/vis/viewer/set/autoRefresh false +/vis/viewer/set/rotationStyle freeRotation +/vis/verbose errors +# +# Draw geometry: +/vis/drawVolume + +# Specify zoom value: +/vis/viewer/zoom 1.4 + +# Specify style (surface or wireframe): +#/vis/viewer/set/style wireframe + +#top +# /vis/viewer/set/viewpointThetaPhi -90. 0. +# /vis/viewer/set/viewpointVector 0 1 0.00000001 +# /vis/viewer/set/upVector 1 0 0 + +#mcp +#/vis/viewer/set/viewpointVector -1 0 0.00000001 +#/vis/viewer/set/upVector 0 1 0 + +#side +# /vis/viewer/set/viewpointVector 0 1 0.00000001 +# /vis/viewer/set/upVector 0 -1 0 + +#lenses +#/vis/viewer/set/viewpointThetaPhi 30 30 +# +#/vis/viewer/set/projection orthogonal +#/vis/viewer/zoomTo 4.5 +#/vis/viewer/set/targetPoint -110 20 -10 cm +#/vis/viewer/set/background white + + +# Draw coordinate axes: +/vis/scene/add/axes 0 0 0 1 m +# +# Draw smooth trajectories at end of event, showing trajectory points +# as markers 2 pixels wide: +/vis/scene/add/trajectories smooth +#/vis/modeling/trajectories/create/drawByCharge +#/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true +#/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 + +/vis/modeling/trajectories/create/drawByParticleID +/vis/modeling/trajectories/drawByParticleID-0/set opticalphoton yellow +/vis/modeling/trajectories/drawByParticleID-0/setRGBA opticalphoton 1 0.8 0 0.3 +/vis/modeling/trajectories/drawByParticleID-0/setRGBA e+ 1 0 1 1 +/vis/modeling/trajectories/drawByParticleID-0/default/setDrawStepPts true +/vis/modeling/trajectories/drawByParticleID-0/default/setStepPtsSize 2 + + + +# (if too many tracks cause core dump => /tracking/storeTrajectory 0) +# +# Draw hits at end of event: +#/vis/scene/add/hits +# +# To draw only gammas: +#/vis/filtering/trajectories/create/particleFilter +#/vis/filtering/trajectories/particleFilter-0/add gamma +# +# To invert the above, drawing all particles except gammas, +# keep the above two lines but also add: +#/vis/filtering/trajectories/particleFilter-0/invert true +# +# Many other options are available with /vis/modeling and /vis/filtering. +# For example, to select colour by particle ID: +#/vis/modeling/trajectories/create/drawByParticleID +#/vis/modeling/trajectories/drawByParticleID-0/set e- blue +# +# To superimpose all of the events from a given run: +/vis/scene/endOfEventAction accumulate + +# Re-establish auto refreshing and verbosity: +/vis/viewer/set/autoRefresh true +/vis/verbose warnings +# +# For file-based drivers, use this to create an empty detector view: +#/vis/viewer/flush + +/vis/viewer/set/projection p 40 deg +/vis/viewer/set/style s +/vis/viewer/set/hiddenEdge true +#/vis/viewer/set/background 1 1 1 0 +#/vis/viewer/set/background 0 0 0 0 +/vis/viewer/set/hiddenMarker +/vis/geometry/set/forceLineSegmentsPerCircle all 0 50 +# /vis/viewer/set/globalLineWidthScale 1.5 +# /vis/geometry/set/lineWidth all 0 1 + +/vis/ogl/set/displayListLimit 500000 + + +#fp + +#/vis/viewer/save + +# #mcp +# /vis/viewer/set/viewpointVector -1 0 0.00000001 +# /vis/viewer/set/upVector 0 1 +# /vis/viewer/set/viewpointThetaPhi 9 41 deg +# /vis/viewer/zoomTo 6 +# /vis/viewer/set/targetPoint 88.5358 -17.0546 18.8692 cm + + +# lens +# /vis/viewer/zoomTo 20 +# /vis/viewer/set/viewpointThetaPhi 129.792 1.39204 deg +# /vis/viewer/set/targetPoint 100 20 210 cm + +# # #lens side +# /vis/viewer/set/viewpointVector 1.31839e-16 -1 -6.93889e-18 +# /vis/viewer/set/upVector 0 1 0 +# /vis/viewer/set/projection orthogonal +# /vis/viewer/zoomTo 11 +# /vis/viewer/scaleTo 1 1 1 +# /vis/viewer/set/targetPoint 1.01299 -0.569503 2.15227 m + + +# side wedge +# /vis/viewer/set/viewpointVector -5.20417e-17 1 -3.46945e-18 +# /vis/viewer/set/upVector 0 1 0 +# /vis/viewer/set/projection orthogonal +# /vis/viewer/zoomTo 13.4 +# /vis/viewer/scaleTo 1 1 1 +# /vis/viewer/set/targetPoint 1.0404 -0.128502 2.17344 m + +# whole length +# /vis/viewer/zoomTo 7.0883 +# /vis/viewer/set/targetPoint 1.11348 -0.128502 0.164898 m +#/vis/ogl/export ev_1.png + +# draw field +#/vis/scene/add/magneticField 10 + +#/vis/scene/create +#/vis/scene/add/volume +# +#/vis/sceneHandler/create VRML2FILE +# +#/vis/viewer/create +# +#/tracking/storeTrajectory 1 +#/vis/scene/add/trajectories +#/vis/scene/endOfEventAction accumulate + +/vis/viewer/refresh + + +/gps/verbose 2 +/gps/particle pi- +/gps/number 1 + +#/gps/ene/type Gauss +/gps/ene/mono 6.0 GeV +#/gps/ene/sigma 3.0 GeV + +#/gps/pos/type Volume +#/gps/pos/shape Cylinder +#/gps/pos/centre 0.0 0.0 0.0 cm +#/gps/pos/radius 0.01 cm +#/gps/pos/halfz 10 cm +/gps/position 0 0 0 cm +#/gps/direction 1 0 0 + +/gps/direction -1 0 0 +#/gps/ang/type iso +#/gps/ang/mintheta 10 degree +#/gps/ang/maxtheta 170 degree + +/vis/viewer/set/viewpointVector 0 -1 0 +/vis/viewer/set/upVector -1 0 0 +/vis/viewer/set/projection orthogonal +/vis/viewer/zoomTo 6.8984 +/vis/viewer/scaleTo 1 1 1 +/vis/viewer/set/targetPoint -0.987804 0.579407 2.01758 m + +/run/beamOn 1 \ No newline at end of file diff --git a/src/DIRC_geo.cpp b/src/DIRC_geo.cpp index 160b022a9b37c3ed8b68d667cda1dcc68cdbcf17..03f4d9be0de116d71cb67c8f2fa57167b84e6cbc 100644 --- a/src/DIRC_geo.cpp +++ b/src/DIRC_geo.cpp @@ -4,7 +4,7 @@ #include "DDRec/DetectorData.h" #include "DDRec/Surface.h" #include <XML/Helper.h> -#include "XML/Layering.h" + ////////////////////////////////// // Central Barrel DIRC ////////////////////////////////// @@ -12,60 +12,351 @@ using namespace std; using namespace dd4hep; +// Fixed Trap constructor. This function is a workaround of this bug: +// https://github.com/AIDASoft/DD4hep/issues/850 +// Should be used instead of dd4hep::Trap(pName, pZ, pY, pX, pLTX) constructor +dd4hep::Trap MakeTrap( const std::string& pName, double pZ, double pY, double pX, double pLTX ); + static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens) { - xml_det_t x_det = e; - string detName = x_det.nameStr(); - int detID = x_det.id(); + xml_det_t xml_det = e; + string det_name = xml_det.nameStr(); + int det_id = xml_det.id(); + + // Main detector xml element + xml_dim_t dirc_dim = xml_det.dimensions(); + xml_dim_t dirc_pos = xml_det.position(); + xml_dim_t dirc_rot = xml_det.rotation(); + double det_rin = dirc_dim.rmin(); + double det_rout = dirc_dim.rmax(); + double SizeZ = dirc_dim.length(); - xml_dim_t dim = x_det.dimensions(); - xml_dim_t pos = x_det.position(); - double RIn = dim.rmin(); - double ROut = dim.rmax(); - double SizeZ = dim.length(); + // DEBUG + // double mirror_r1 = x_det.attr<double>(_Unicode(r1)); + + // DIRC box: + xml_comp_t xml_box_module = xml_det.child(_U(module)); Material Vacuum = desc.material("Vacuum"); - Material mat = desc.material("Quartz"); - Tube cb_DIRC_Barrel_GVol_Solid(RIn, ROut, SizeZ / 2.0, 0., 360.0 * deg); - Volume detVol("cb_DIRC_GVol_Solid_Logic", cb_DIRC_Barrel_GVol_Solid, Vacuum); - detVol.setVisAttributes(desc.invisible()); - - DetElement det(detName, detID); - Volume motherVol = desc.pickMotherVolume(det); - Transform3D tr(RotationZYX(0.0, 0.0, 0.0), Position(0.0, 0.0, pos.z())); - PlacedVolume detPV = motherVol.placeVolume(detVol, tr); - detPV.addPhysVolID("system", detID); - detPV.addPhysVolID("barrel", 1); - det.setPlacement(detPV); + Material air = desc.material("AirOptical"); + Material quartz = desc.material("Quartz"); + Material epotek = desc.material("Epotek"); + Material nlak33a = desc.material("Nlak33a"); + auto& bar_material = quartz; + auto mirror_material = desc.material("Aluminum"); // mirror material - ////////////////// - // DIRC Bars - ////////////////// + Tube det_geo(det_rin, det_rout, SizeZ / 2., 0., 360.0 * deg); + //Volume det_volume("DIRC", det_geo, Vacuum); + Assembly det_volume("DIRC"); + det_volume.setVisAttributes(desc.visAttributes(xml_det.visStr())); + + DetElement det(det_name, det_id); + Volume mother_vol = desc.pickMotherVolume(det); + + Transform3D tr(RotationZYX(0, dirc_rot.theta(), 0.0), Position(0.0, 0.0, dirc_pos.z())); + PlacedVolume det_plvol = mother_vol.placeVolume(det_volume, tr); + + det_plvol.addPhysVolID("system", det_id); + det.setPlacement(det_plvol); + + // Parts Dimentions + + int fLensId = 6; // focusing system + // 0 no lens + // 1 spherical lens + // 3 3-layer spherical lens + // 6 3-layer cylindrical lens + // 10 ideal lens (thickness = 0, ideal focusing) + + int fGeomType = 0; // Full DIRC - 0, 1 only one plate + int fRunType = 0; // 0, 10 - simulation, 1, 5 - lookup table, 2,3,4 - reconstruction + + + double fPrizm[4]; + fPrizm[0] = 360 * mm; + fPrizm[1] = 300 * mm; + fPrizm[3] = 50 * mm; + fPrizm[2] = fPrizm[3] + 300 * tan(32 * deg) * mm; + double fBarsGap = 0.15 * mm; + + std::cout << "DIRC: fPrizm[2] " << fPrizm[2] << std::endl; + + double fdTilt = 80 * deg; + double fPrizmT[6]; + fPrizmT[0] = 390 * mm; + fPrizmT[1] = (400 - 290 * cos(fdTilt)) * mm; // + fPrizmT[2] = 290 * sin(fdTilt) * mm; // hight + fPrizmT[3] = 50 * mm; // face + fPrizmT[4] = 290 * mm; + fPrizmT[5] = 290 * cos(fdTilt)* mm; + + double fMirror[3]; + fMirror[0] = 20 * mm; + fMirror[1] = fPrizm[0]; + fMirror[2] = 1 * mm; + // fPrizm[0] = 170; fPrizm[1] = 300; fPrizm[2] = 50+300*tan(45*deg); fPrizm[3] = 50; + +// double fBar[3]; +// fBar[0] = 17 * mm; +// fBar[1] = (fPrizm[0] - (fNBar - 1) * fBarsGap) / fNBar; +// fBar[2] = 1050 * mm; // 4200; //4200 + + double fMcpTotal[3]; + double fMcpActive[3]; + fMcpTotal[0] = fMcpTotal[1] = 53 + 4; + fMcpTotal[2] = 1*mm; + fMcpActive[0] = fMcpActive[1] = 53; + fMcpActive[2] = 1*mm; - double dR = dim.radius(); - double cb_DIRC_bars_DZ = SizeZ; - double cb_DIRC_bars_DY = dim.dy(); - double cb_DIRC_bars_DX = dim.dx(); - int NUM = dim.number(); - double cb_DIRC_bars_DPhi = dim.deltaphi(); + double fLens[4]; + fLens[0] = fLens[1] = 40 * mm; + fLens[2] = 10 * mm; + double fRadius = (det_rin + det_rout)/2; - Material cb_DIRC_bars_Material = desc.material("Quartz"); + double fBoxWidth = fPrizm[0]; + + double fFd[3]; + fFd[0] = fBoxWidth; + fFd[1] = fPrizm[2]; + fFd[2] = 1 * mm; + + fLens[0] = fPrizm[3]; + fLens[1] = fPrizm[0]; + fLens[2] = 12 * mm; + + // Getting box XML + const int fNBoxes = xml_box_module.repeat(); + const double box_width = xml_box_module.width(); + const double box_height = xml_box_module.height(); + const double box_length = xml_box_module.length() + 550*mm; + + + // The DIRC + Assembly dirc_module("DIRCModule"); + + //Volume lDirc("lDirc", gDirc, air); + dirc_module.setVisAttributes(desc.visAttributes(xml_box_module.visStr())); + + + // FD... whatever F and D is + xml_comp_t xml_fd = xml_box_module.child(_Unicode(fd)); + Box gFd("gFd", xml_fd.height()/2, xml_fd.width()/2, xml_fd.thickness()/2); + Volume lFd ("lFd", gFd, desc.material(xml_fd.materialStr())); + lFd.setVisAttributes(desc.visAttributes(xml_fd.visStr())); + //lFd.setSensitiveDetector(sens); + + + // The Bar + xml_comp_t xml_bar = xml_box_module.child(_Unicode(bar)); + double bar_height = xml_bar.height(); + double bar_width = xml_bar.width(); + double bar_length = xml_bar.length(); + Box gBar("gBar", bar_height/2, bar_width/2, bar_length/2); + Volume lBar("lBar", gBar, desc.material(xml_bar.materialStr())); + lBar.setVisAttributes(desc.visAttributes(xml_bar.visStr())); + + // Glue + xml_comp_t xml_glue = xml_box_module.child(_Unicode(glue)); + double glue_thickness = xml_glue.thickness(); // 0.05 * mm; + Box gGlue("gGlue", bar_height/2, bar_width/2, glue_thickness/2); + Volume lGlue("lGlue", gGlue, desc.material(xml_glue.materialStr())); + lGlue.setVisAttributes(desc.visAttributes(xml_glue.visStr())); - Box cb_DIRC_bars_Solid(cb_DIRC_bars_DX / 2., cb_DIRC_bars_DY / 2., cb_DIRC_bars_DZ / 2.); - Volume cb_DIRC_bars_Logic("cb_DIRC_bars_Logix", cb_DIRC_bars_Solid, cb_DIRC_bars_Material); - cb_DIRC_bars_Logic.setVisAttributes(desc.visAttributes(x_det.visStr())); sens.setType("photoncounter"); - cb_DIRC_bars_Logic.setSensitiveDetector(sens); - - int count = 0; - for (xml_coll_t mod(x_det, _U(module)); mod; ++mod) { - xml_comp_t x_mod = mod; - Transform3D tr(RotationZ(x_mod.phi()), Position(-x_mod.R() * cos(x_mod.phi()), -x_mod.R() * sin(x_mod.phi()), 0)); - PlacedVolume barPV = detVol.placeVolume(cb_DIRC_bars_Logic, tr); - barPV.addPhysVolID("module", count++); + lBar.setSensitiveDetector(sens); + + int bars_repeat_z = 4; // TODO parametrize! + double bar_assm_length = (bar_length + glue_thickness) * bars_repeat_z; + int fNBar = xml_bar.repeat(); + double bar_gap = xml_bar.gap(); + for (int y_index = 0; y_index < fNBar; y_index++) { + double shift_y = y_index * (bar_width + bar_gap) - 0.5 * box_width + 0.5 * bar_width; + for (int z_index = 0; z_index < bars_repeat_z; z_index++) { + double z = -0.5 * bar_assm_length + 0.5 * bar_length + (bar_length + glue_thickness) * z_index; + auto placed_bar = dirc_module.placeVolume(lBar, Position(0, shift_y, z)); + dirc_module.placeVolume(lGlue, Position(0, shift_y, z + 0.5 * (bar_length + glue_thickness))); + placed_bar.addPhysVolID("section", z_index); + placed_bar.addPhysVolID("bar", y_index); + } } + + + // The Mirror + xml_comp_t xml_mirror = xml_box_module.child(_Unicode(mirror)); + Box gMirror("gMirror", xml_mirror.height()/2, xml_mirror.width()/2, xml_mirror.thickness()/2); + Volume lMirror("lMirror", gMirror, desc.material(xml_mirror.materialStr())); + dirc_module.placeVolume(lMirror, Position(0, 0, -0.5 * (bar_assm_length - xml_mirror.thickness()))); + lMirror.setVisAttributes(desc.visAttributes(xml_mirror.visStr())); + + // The mirror optical surface + OpticalSurfaceManager surfMgr = desc.surfaceManager(); + auto surf = surfMgr.opticalSurface("MirrorOpticalSurface"); + SkinSurface skin(desc, det, Form("dirc_mirror_optical_surface"), surf, lMirror); + skin.isValid(); + + // LENS + // Lens volumes + Volume lLens1; + Volume lLens2; + Volume lLens3; + + double lensMinThikness = 2.0 * mm; + double layer12 = lensMinThikness * 2; + + // r1 = (r1==0)? 27.45: r1; + // r2 = (r2==0)? 20.02: r2; + + double r1 = 33 * mm; + double r2 = 24 * mm; + double shight = 25 * mm; + + Position zTrans1(0, 0, -r1 - fLens[2] / 2. + r1 - sqrt(r1 * r1 - shight / 2. * shight / 2.) + lensMinThikness); + Position zTrans2(0, 0, -r2 - fLens[2] / 2. + r2 - sqrt(r2 * r2 - shight / 2. * shight / 2.) + layer12); + + Box gfbox("fbox", 0.5 * fLens[0], 0.5 * fLens[1], 0.5 * fLens[2]); + Box gcbox("cbox", 0.5 * fLens[0], 0.5 * fLens[1] + 1*mm, 0.5 * fLens[2]); + +// Volume gfbox_volume("gfbox_volume", gfbox, bar_material); +// lDirc.placeVolume(gfbox_volume, Position(0, 0, 0)); +// +// Volume gcbox_volume("gcbox_volume", gcbox, bar_material); +// lDirc.placeVolume(gcbox_volume, Position(0, 0, 50)); + + + Position tTrans1(0.5 * (fLens[0] + shight), 0, -fLens[2] + layer12); + Position tTrans0(-0.5 * (fLens[0] + shight), 0, -fLens[2] + layer12); + SubtractionSolid tubox("tubox", gfbox, gcbox, tTrans1); + SubtractionSolid gubox("gubox", tubox, gcbox, tTrans0); + +// Volume tubox_volume("tubox_volume", tubox, bar_material); +// lDirc.placeVolume(tubox_volume, Position(0, 0, 100)); +// +// Volume gubox_volume("gubox_volume", gubox, bar_material); +// lDirc.placeVolume(gubox_volume, Position(0, 0, 150)); + + Tube gcylinder1("Cylinder1", 0, r1, 0.5 * fLens[1], 0 * deg, 360 * deg); + Tube gcylinder2("Cylinder2", 0, r2, 0.5 * fLens[1] - 0.5*mm, 0 * deg, 360 * deg); + Tube gcylinder1c("Cylinder1c", 0, r1, 0.5 * fLens[1] + 0.5*mm, 0 * deg, 360 * deg); + Tube gcylinder2c("Cylinder2c", 0, r2, 0.5 * fLens[1] + 0.5*mm, 0 * deg, 360 * deg); + RotationX xRot(-M_PI / 2.); + + IntersectionSolid gLens1("Lens1", gubox, gcylinder1, Transform3D(xRot, zTrans1)); + SubtractionSolid gLenst("temp", gubox, gcylinder1c, Transform3D(xRot, zTrans1)); + +// Volume gLens1_volume("gLens1_volume", gLens1, bar_material); +// lDirc.placeVolume(gLens1_volume, Position(0, 0, 200)); +// +// Volume gLenst_volume("gLenst_volume", gLenst, bar_material); +// lDirc.placeVolume(gLenst_volume, Position(0, 0, 250)); + + IntersectionSolid gLens2("Lens2", gLenst, gcylinder2, Transform3D(xRot, zTrans2)); + SubtractionSolid gLens3("Lens3", gLenst, gcylinder2c, Transform3D(xRot, zTrans2)); + + lLens1 = Volume("lLens1", gLens1, bar_material); + lLens2 = Volume("lLens2", gLens2, nlak33a); + lLens3 = Volume("lLens3", gLens3, bar_material); + + lLens1.setVisAttributes(desc.visAttributes("DIRCLens1")); + lLens2.setVisAttributes(desc.visAttributes("DIRCLens2")); + lLens3.setVisAttributes(desc.visAttributes("DIRCLens3")); + + + double shifth = 0.5 * (bar_assm_length + fLens[2]); + // fmt::print("LENS HERE shifth={}\n", shifth); + + lLens1.setVisAttributes(desc.visAttributes("AnlTeal")); + dirc_module.placeVolume(lLens1, Position(0, 0, shifth)); + dirc_module.placeVolume(lLens2, Position(0, 0, shifth)); + dirc_module.placeVolume(lLens3, Position(0, 0, shifth)); + // The Prizm + Trap gPrizm = MakeTrap("gPrizm", fPrizm[0], fPrizm[1], fPrizm[2], fPrizm[3]); + Volume lPrizm("lPrizm", gPrizm, bar_material); + lPrizm.setVisAttributes(desc.visAttributes("DIRCPrism")); + + //G4RotationMatrix *fdRot = new G4RotationMatrix(); + //G4RotationMatrix *fdrot = new G4RotationMatrix(); + double evshiftz = 0.5 * bar_assm_length + fPrizm[1] + fMcpActive[2] / 2. + fLens[2]; + double evshiftx = -3*mm; + + double prism_shift_x = (fPrizm[2] + fPrizm[3]) / 4. - 0.5 * fPrizm[3] + 1.5*mm; + double prism_shift_z = 0.5 * (bar_assm_length + fPrizm[1]) + fLens[2]; + + Position fPrismShift(prism_shift_x, 0, prism_shift_z); + dirc_module.placeVolume(lPrizm, Transform3D(xRot, fPrismShift)); + dirc_module.placeVolume(lFd, Position(0.5 * fFd[1] - 0.5 * fPrizm[3] - evshiftx, 0, evshiftz)); + + double dphi = 2 * M_PI / (double)fNBoxes; + for (int i = 0; i < fNBoxes; i++) { + double phi = dphi * i; + double dx = -fRadius * cos(phi); + double dy = -fRadius * sin(phi); + + //G4RotationMatrix *tRot = new G4RotationMatrix(); + + Transform3D tr(RotationZ(phi+M_PI), Position(dx, dy, 0)); + PlacedVolume box_placement = det_volume.placeVolume(dirc_module, tr); + box_placement.addPhysVolID("module", i); + + + // fmt::print("placing dircbox # {} -tphi={:.0f} dx={:.0f}, dy={:.0f}\n", i, phi/deg, dx/cm, dy/cm); + + //new G4PVPlacement(tRot, G4ThreeVector(dx, dy, 0), lDirc, "wDirc", lExpHall, false, i); + } + + + ////////////////// + // DIRC Bars + ////////////////// + + // double bar_radius = 83.65 * cm; + // double bar_length = SizeZ; + // double bar_width = 42. * cm; + // double bar_thicknes = 1.7 * cm; + // int bar_count = 2 * M_PI * bar_radius / bar_width; + // double bar_dphi = 2 * 3.1415926 / bar_count; + // Material bar_material = desc.material("Quartz"); + + // Box bar_geo(bar_thicknes / 2., bar_width / 2., bar_length / 2.); + // Volume bar_volume("cb_DIRC_bars_Logix", bar_geo, bar_material); + // bar_volume.setVisAttributes(desc.visAttributes(xml_det.visStr())); + // sens.setType("photoncounter"); + // bar_volume.setSensitiveDetector(sens); + + // for (int ia = 0; ia < bar_count; ia++) { + // double phi = (ia * (bar_dphi)); + // double x = -bar_radius * cos(phi); + // double y = -bar_radius * sin(phi); + + // Transform3D tr(RotationZ(bar_dphi * ia), Position(x, y, 0)); + // PlacedVolume barPV = det_volume.placeVolume(bar_volume, tr); + // barPV.addPhysVolID("module", ia); + // } return det; } -DECLARE_DETELEMENT(DIRC, createDetector) +DECLARE_DETELEMENT(cb_DIRC, createDetector) + +dd4hep::Trap MakeTrap( const std::string& pName, double pZ, double pY, double pX, double pLTX ) +{ + // Fixed Trap constructor. This function is a workaround of this bug: + // https://github.com/AIDASoft/DD4hep/issues/850 + // Should be used instead of dd4hep::Trap(pName, pZ, pY, pX, pLTX) constructor + + double fDz = 0.5*pZ; + double fTthetaCphi = 0; + double fTthetaSphi = 0; + double fDy1 = 0.5*pY; + double fDx1 = 0.5*pX; + double fDx2 = 0.5*pLTX; + double fTalpha1 = 0.5*(pLTX - pX)/pY; + double fDy2 = fDy1; + double fDx3 = fDx1; + double fDx4 = fDx2; + double fTalpha2 = fTalpha1; + + return Trap(pName, fDz, fTthetaCphi, fTthetaSphi, + fDy1, fDx1, fDx2, fTalpha1, + fDy2, fDx3, fDx4, fTalpha2); +} +