Skip to content
Snippets Groups Projects
Commit 36af636c authored by Chao Peng's avatar Chao Peng
Browse files

Merge branch 'chao' into 'master'

Fixed id so they will be unique

See merge request cpeng/NPDet!1
parents 71c2cf81 3851afce
Branches
Tags
No related merge requests found
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
<constant name="world_y" value="world_side"/> <constant name="world_y" value="world_side"/>
<constant name="world_z" value="world_side"/> <constant name="world_z" value="world_side"/>
<constant name="tracker_region_zmax" value="5*m"/>
<constant name="tracker_region_rmax" value="5*m"/>
<constant name="CrossingAngle" value="0.020*rad"/> <constant name="CrossingAngle" value="0.020*rad"/>
<constant name="CaloSides" value="12"/> <constant name="CaloSides" value="12"/>
...@@ -230,8 +233,8 @@ ...@@ -230,8 +233,8 @@
<detectors> <detectors>
<detector id="77" name="StandInVolumes" vis="GreenVis" type="StandInGeometrySOLID" > </detector> <!--<detector id="77" name="StandInVolumes" vis="GreenVis" type="StandInGeometrySOLID" > </detector>-->
<detector id="2" name="GEMTracker_SIDIS" vis="RedVis" type="GaplessGEMTrackerDisc" readout="GEMTrackerHits" > <!--<detector id="2" name="GEMTracker_SIDIS" vis="RedVis" type="GaplessGEMTrackerDisc" readout="GEMTrackerHits" >
<layer id="1" z="-175 *cm" inner_r="36*cm" outer_r="87.0*cm" phi0_offset="0.0*deg" Nmodules="30" /> <layer id="1" z="-175 *cm" inner_r="36*cm" outer_r="87.0*cm" phi0_offset="0.0*deg" Nmodules="30" />
<layer id="2" z="-150 *cm" inner_r="21*cm" outer_r="98.0*cm" phi0_offset="0.0*deg" Nmodules="24" /> <layer id="2" z="-150 *cm" inner_r="21*cm" outer_r="98.0*cm" phi0_offset="0.0*deg" Nmodules="24" />
<layer id="3" z="-119 *cm" inner_r="25*cm" outer_r="112.0*cm" phi0_offset="0.0*deg" Nmodules="21" /> <layer id="3" z="-119 *cm" inner_r="25*cm" outer_r="112.0*cm" phi0_offset="0.0*deg" Nmodules="21" />
...@@ -239,8 +242,9 @@ ...@@ -239,8 +242,9 @@
<layer id="5" z="5 *cm" inner_r="42*cm" outer_r="100.0*cm" phi0_offset="0.0*deg" Nmodules="29" /> <layer id="5" z="5 *cm" inner_r="42*cm" outer_r="100.0*cm" phi0_offset="0.0*deg" Nmodules="29" />
<layer id="6" z="92 *cm" inner_r="55*cm" outer_r="123.0*cm" phi0_offset="0.0*deg" Nmodules="25" /> <layer id="6" z="92 *cm" inner_r="55*cm" outer_r="123.0*cm" phi0_offset="0.0*deg" Nmodules="25" />
</detector> </detector>
-->
<detector id="3" name="LAEC_SIDIS" type="EMCalorimeterSoLID" readout="EMCalHits" vis="InvisibleWithDaughters" > <detector id="3" name="LAEC_SIDIS" type="EMCalorimeterSoLID" readout="LAECalHits" vis="InvisibleWithDaughters" >
<comment>Large Angle Electromagnetic Calorimeter (LAEC) for SIDIS</comment> <comment>Large Angle Electromagnetic Calorimeter (LAEC) for SIDIS</comment>
<dimensions rmin="83*cm" rmax="140*cm" z0="-65*cm" rmod="6.25*cm" rtol="1.0*cm" /> <dimensions rmin="83*cm" rmax="140*cm" z0="-65*cm" rmod="6.25*cm" rtol="1.0*cm" />
<layer repeat="1" vis="InvisibleWithDaughters"> <layer repeat="1" vis="InvisibleWithDaughters">
...@@ -257,6 +261,7 @@ ...@@ -257,6 +261,7 @@
<detector id="4" name="FAEC_SIDIS" type="EMCalorimeterSoLID" readout="EMCalHits" vis="InvisibleWithDaughters" > <detector id="4" name="FAEC_SIDIS" type="EMCalorimeterSoLID" readout="EMCalHits" vis="InvisibleWithDaughters" >
<comment>Forward Angle Electromagnetic Calorimeter (FAEC) for SIDIS</comment> <comment>Forward Angle Electromagnetic Calorimeter (FAEC) for SIDIS</comment>
<dimensions rmin="98*cm" rmax="230*cm" z0="415*cm" rmod="6.25*cm" rtol="1.0*cm" /> <dimensions rmin="98*cm" rmax="230*cm" z0="415*cm" rmod="6.25*cm" rtol="1.0*cm" />
<layer repeat="1" vis="InvisibleWithDaughters"> <layer repeat="1" vis="InvisibleWithDaughters">
<slice material = "Lead" thickness = "1.12*cm" vis="BlueVis"/> <slice material = "Lead" thickness = "1.12*cm" vis="BlueVis"/>
<slice material = "EJ204" thickness = "6.25*cm" vis="PurpleVis" sensitive="yes"/> <slice material = "EJ204" thickness = "6.25*cm" vis="PurpleVis" sensitive="yes"/>
...@@ -272,13 +277,21 @@ ...@@ -272,13 +277,21 @@
<!-- Definition of the readout segmentation/definition --> <!-- Definition of the readout segmentation/definition -->
<readouts> <readouts>
<readout name="EMCalHits">
<segmentation type="NoSegmentation" />
<id>system:6,module:20,layer:10,slice:5,x:48:-8,y:-8</id>
</readout>
<readout name="LAECalHits">
<segmentation type="NoSegmentation" />
<id>system:6,module:20,layer:10,slice:5,x:48:-8,y:-8</id>
</readout>
<!--
<readout name="GEMTrackerHits"> <readout name="GEMTrackerHits">
<id>system:8,layer:5,module:14,sensor:2,side:32:-2,strip:24</id> <id>system:6,layer:5,module:14,sensor:2,side:32:-2,strip:24</id>
</readout> </readout>
<readout name="EMCalHits"> <readout name="LAECalHits">
<id>system:6,module:24,layer:6,slice:5</id> <id>system:6,module:24,layer:6,slice:5</id>
</readout> </readout>
<!--
<readout name="SiTrackerBarrelHits"> <readout name="SiTrackerBarrelHits">
<id>system:8,barrel:3,layer:4,module:14,sensor:2,side:32:-2,strip:24</id> <id>system:8,barrel:3,layer:4,module:14,sensor:2,side:32:-2,strip:24</id>
</readout> </readout>
...@@ -307,10 +320,9 @@ ...@@ -307,10 +320,9 @@
<argument value="SiTrackerBarrel"/> <argument value="SiTrackerBarrel"/>
<argument value="dimension=2"/> <argument value="dimension=2"/>
</plugin> </plugin>
-->
<plugin name="DD4hepVolumeManager" /> <plugin name="DD4hepVolumeManager" />
<plugin name="InstallSurfaceManager" /> <plugin name="InstallSurfaceManager" />
-->
</plugins> </plugins>
<fields> <fields>
......
...@@ -99,6 +99,7 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec ...@@ -99,6 +99,7 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
// a modular vollume // a modular vollume
PolyhedraRegular m_hex(6, 0., rmod, len_z); PolyhedraRegular m_hex(6, 0., rmod, len_z);
Volume mod_vol("module", m_hex, air); Volume mod_vol("module", m_hex, air);
DetElement mod_DE("module0",0 );
// layer start point // layer start point
double l_pos_z = -len_z/2.; double l_pos_z = -len_z/2.;
...@@ -115,7 +116,8 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec ...@@ -115,7 +116,8 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
Position l_pos(0, 0, l_pos_z + l_thickness/2); // Position of the layer. Position l_pos(0, 0, l_pos_z + l_thickness/2); // Position of the layer.
PolyhedraRegular l_hex(6, 0., rmod, l_thickness); PolyhedraRegular l_hex(6, 0., rmod, l_thickness);
Volume l_vol(l_name,l_hex,air); Volume l_vol(l_name,l_hex,air);
DetElement layer(sdet, l_name, det_id); DetElement layer_DE(mod_DE, l_name, det_id);
l_vol.setVisAttributes(desc.invisible());
// Loop over the sublayers or slices for this layer. // Loop over the sublayers or slices for this layer.
int s_num = 1; int s_num = 1;
...@@ -126,12 +128,13 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec ...@@ -126,12 +128,13 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
double s_thick = x_slice.thickness(); double s_thick = x_slice.thickness();
PolyhedraRegular s_hex(6, 0., rmod, s_thick); PolyhedraRegular s_hex(6, 0., rmod, s_thick);
Volume s_vol(s_name, s_hex, desc.material(x_slice.materialStr())); Volume s_vol(s_name, s_hex, desc.material(x_slice.materialStr()));
DetElement slice(layer, s_name, det_id); DetElement slice(layer_DE, s_name, det_id);
if (x_slice.isSensitive()) { if (x_slice.isSensitive()) {
s_vol.setSensitiveDetector(sens); s_vol.setSensitiveDetector(sens);
} }
slice.setAttributes(desc, s_vol, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); slice.setAttributes(desc, s_vol, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr());
s_vol.setVisAttributes(desc.invisible());
// Slice placement. // Slice placement.
PlacedVolume slice_phv = l_vol.placeVolume(s_vol, Position(0, 0, s_pos_z + s_thick/2)); PlacedVolume slice_phv = l_vol.placeVolume(s_vol, Position(0, 0, s_pos_z + s_thick/2));
...@@ -145,11 +148,12 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec ...@@ -145,11 +148,12 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
} }
// Set region, limitset, and vis of layer. // Set region, limitset, and vis of layer.
layer.setAttributes(desc, l_vol, x_layer.regionStr(), x_layer.limitsStr(), x_layer.visStr()); layer_DE.setAttributes(desc, l_vol, x_layer.regionStr(), x_layer.limitsStr(), x_layer.visStr());
l_vol.setVisAttributes(desc.invisible());
PlacedVolume layer_phv = mod_vol.placeVolume(l_vol, l_pos); PlacedVolume layer_phv = mod_vol.placeVolume(l_vol, l_pos);
layer_phv.addPhysVolID("layer", l_num); layer_phv.addPhysVolID("layer", l_num);
layer.setPlacement(layer_phv); layer_DE.setPlacement(layer_phv);
// Increment to next layer Z position. // Increment to next layer Z position.
l_pos_z += l_thickness; l_pos_z += l_thickness;
++l_num; ++l_num;
...@@ -170,11 +174,16 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec ...@@ -170,11 +174,16 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
return p1.y() < p2.y(); return p1.y() < p2.y();
}); });
int nmod = 1; int nmod = 0;
for (auto &p : res) { for (auto &p : res) {
PlacedVolume pv = envelope.placeVolume(mod_vol, Position(p.x(), p.y(), 0.)); PlacedVolume pv = envelope.placeVolume(mod_vol, Position(p.x(), p.y(), 0.));
pv.addPhysVolID("system",det_id ); pv.addPhysVolID("system",det_id );
pv.addPhysVolID("module", nmod++); pv.addPhysVolID("module",nmod+1 );
auto amod = (nmod == 0 ? mod_DE : mod_DE.clone("module"+std::to_string(nmod+1), nmod+1));
amod.setPlacement(pv);
sdet.add(amod);
nmod++;
} }
// Set envelope volume attributes. // Set envelope volume attributes.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment