Skip to content

Commit

Permalink
Updated LumiSpecCAL segmentation (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
aranyagiri authored Dec 3, 2024
1 parent 63dda25 commit 4a010ff
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 49 deletions.
7 changes: 4 additions & 3 deletions compact/display.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@
<comment>
Luminosity Visualisation
</comment>
<vis name="LumiSpecCAL_ModuleVis" ref="AnlGold" alpha="0.5" visible="true" showDaughters="true"/>
<vis name="LumiSpecCAL_FiberVis" ref="AnlRed" alpha="0.8" visible="true"/>
<vis name="LumiSpecCAL_FiberHolderVis" ref="AnlBlue" alpha="1.0" visible="true"/>
<vis name="LumiSpecCAL_LayerVis" ref="AnlOrange" alpha="0.2" visible="true" showDaughters = "false"/>
<vis name="LumiSpecCAL_ModuleVis" ref="AnlGold" alpha="0.5" visible="true" showDaughters="false"/>
<vis name="LumiSpecCAL_FiberVis" ref="AnlRed" alpha="0.8" visible="true"/>
<vis name="LumiSpecCAL_FiberHolderVis" ref="AnlBlue" alpha="1.0" visible="true"/>


<comment>
Expand Down
23 changes: 15 additions & 8 deletions compact/far_backward/definitions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -271,21 +271,28 @@
<constant name="LumiConverter_DZ" value="1*mm"/>

<!-- Lumi spectrometer CAL -->
<constant name="LumiSpecCAL_SiPMSizeXY" value="3*mm"/>
<constant name="LumiSpecCAL_SiPMNumX" value="20"/>
<constant name="LumiSpecCAL_SiPMNumY" value="3"/>
<constant name="LumiSpecCAL_SiPMSizeXY" value="4*mm"/>
<constant name="LumiSpecCAL_SiPMNumX" value="14"/>
<constant name="LumiSpecCAL_SiPMNumY" value="2"/>
<constant name="LumiSpecCAL_ZLayers" value="20"/>
<constant name="LumiSpecCAL_XYLayers" value="3"/>
<comment>
Note : Values/Notations for making modules pointing along z-axis.
Rotation of modules wrt XY axis after construction.
</comment>
<constant name="LumiSpecCAL_ModSizeX" value="LumiSpecCAL_SiPMNumX*LumiSpecCAL_SiPMSizeXY"/>
<constant name="LumiSpecCAL_ModSizeY" value="LumiSpecCAL_SiPMNumY*LumiSpecCAL_SiPMSizeXY"/>
<constant name="LumiSpecCAL_DZ" value="LumiSpecCAL_ZLayers*LumiSpecCAL_ModSizeY"/>
<constant name="LumiSpecCAL_DXY" value="LumiSpecCAL_XYLayers*LumiSpecCAL_ModSizeX"/>
<constant name="LumiSpecCAL_ModSizeZ" value="LumiSpecCAL_DXY"/> <!-- fibre length -->

<constant name="LumiSpecCAL_SiPMSpaceXY" value="0.15*mm"/> <!-- mechanical space for adjacent SiPMs-->
<constant name="LumiSpecCAL_LayerCoatX" value="0.25*cm"/> <!-- mechanical covering of layers, def without rotation-->
<constant name="LumiSpecCAL_LayerCoatY" value="0.25*cm"/> <!-- mechanical covering of layers, def without rotation -->

<constant name="LumiSpecCAL_ModSizeX" value="LumiSpecCAL_SiPMNumX*(LumiSpecCAL_SiPMSizeXY + 2*LumiSpecCAL_SiPMSpaceXY)"/>
<constant name="LumiSpecCAL_ModSizeY" value="LumiSpecCAL_SiPMNumY*(LumiSpecCAL_SiPMSizeXY + 2*LumiSpecCAL_SiPMSpaceXY)"/>

<!-- Add the size of layer coating to the overall size of CAL -->
<constant name="LumiSpecCAL_DZ" value="LumiSpecCAL_ZLayers*(LumiSpecCAL_ModSizeY + 2.0*LumiSpecCAL_LayerCoatY)"/>
<constant name="LumiSpecCAL_DXY" value="LumiSpecCAL_XYLayers*LumiSpecCAL_ModSizeX + 2.0*LumiSpecCAL_LayerCoatX"/>

<constant name="LumiSpecCAL_ModSizeZ" value="LumiSpecCAL_XYLayers*LumiSpecCAL_ModSizeX"/> <!-- fibre length -->
<constant name="LumiSpecCAL_Z" value="-8*m + LumiSweepMag_Z - LumiSpecCAL_DZ/2.0"/>
<constant name="LumiSpecCAL_FiveSigma" value="LumiBeamDiv_pref * fabs(LumiSpecCAL_Z)"/>
<constant name="LumiSpecCAL_Y" value="LumiSpecCAL_FiveSigma + LumiSpecCAL_DXY/2.0"/>
Expand Down
10 changes: 8 additions & 2 deletions compact/far_backward/lumi/spec_ScFi_cal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@
<lccdd>

<detectors>
<detector id="LumiSpecCAL_ID" name="LumiSpecCAL" type="EcalLumiSpecWScFi" vis="FFPreVis" readout="EcalLumiSpecHits" sizeXY="LumiSpecCAL_DXY" sizeZ="LumiSpecCAL_DZ" nmod_perlayer="LumiSpecCAL_XYLayers" nlayer="LumiSpecCAL_ZLayers" >
<detector id="LumiSpecCAL_ID" name="LumiSpecCAL" type="EcalLumiSpecWScFi" vis="LumiSpecCAL_LayerVis" readout="EcalLumiSpecHits" sizeXY="LumiSpecCAL_DXY" sizeZ="LumiSpecCAL_DZ" nmod_perlayer="LumiSpecCAL_XYLayers" nlayer="LumiSpecCAL_ZLayers" >
<position x="0.0*cm" y="0.0*cm" z="0.0*cm"/>
<rotation x="0.0*rad" y="0.0*rad" z="0.0*rad"/>

<layer sizeX="LumiSpecCAL_XYLayers*LumiSpecCAL_ModSizeX + 2.0*LumiSpecCAL_LayerCoatX" sizeY="LumiSpecCAL_ModSizeY + 2.0*LumiSpecCAL_LayerCoatY" sizeZ="LumiSpecCAL_ModSizeZ" coatSizeX="LumiSpecCAL_LayerCoatX" coatSizeY="LumiSpecCAL_LayerCoatY" material="Polystyrene" vis="LumiSpecCAL_LayerVis"/>

<module sizex="LumiSpecCAL_ModSizeX" sizey="LumiSpecCAL_ModSizeY" sizez="LumiSpecCAL_ModSizeZ" material="WPowderplusEpoxy" vis="LumiSpecCAL_ModuleVis">

<block sizeX="LumiSpecCAL_SiPMSizeXY" sizeY="LumiSpecCAL_SiPMSizeXY" sizeZ="LumiSpecCAL_ModSizeZ" SpaceXY="LumiSpecCAL_SiPMSpaceXY"/>

<fiber
material="Polystyrene"
radius="LumiSpecCAL_FiberRadius"
Expand All @@ -30,7 +36,7 @@
<readouts>
<readout name="EcalLumiSpecHits">
<segmentation type="NoSegmentation"/>
<id>system:8,sector:4,orientation:4,layer:8,module:4,fiber_x:16,fiber_y:16</id>
<id>system:8,sector:8,layer:8,module:8,block:8,fiber_x:4,fiber_y:4</id>
</readout>
</readouts>

Expand Down
121 changes: 85 additions & 36 deletions src/EcalLumiSpecWScFi_geo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,29 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
xml_comp_t pos = x_det.position();
xml_comp_t rot = x_det.rotation();

//function for module definition
auto [modVol, modSize] = build_specScFiCAL_module(description, x_mod, sens);

// Position of first module, layer from center of CAL
double mod_pos0 = -(detSizeXY / 2.0) + (modSize.x() / 2.0);
double layer_pos0 = -(detSizeZ / 2.0) + (modSize.y() / 2.0);
//layer definition before rotation
xml_comp_t x_layer = x_det.child(_Unicode(layer));

double laySizeX = getAttrOrDefault(x_layer, _Unicode(sizeX), 1.0 * cm);
double laySizeY = getAttrOrDefault(x_layer, _Unicode(sizeY), 1.0 * cm);
double laySizeZ = getAttrOrDefault(x_layer, _Unicode(sizeZ), 1.0 * cm);
double layerCoatSizeX = getAttrOrDefault(x_layer, _Unicode(coatSizeX), 1.0 * cm);
double layerCoatSizeY = getAttrOrDefault(x_layer, _Unicode(coatSizeY), 1.0 * cm);

Material layMat = description.material(x_layer.attr<std::string>(_Unicode(material)));

Box layerBox(detSizeXY / 2, modSize.y() / 2, detSizeXY / 2);
Volume layerVol("layer", layerBox, Air);
layerVol.setVisAttributes(description.visAttributes(x_mod.attr<std::string>(_Unicode(vis))));
Box layerBox(laySizeX / 2.0, laySizeY / 2.0, laySizeZ / 2.0);
Volume layerVol("layer", layerBox, layMat);
layerVol.setVisAttributes(description.visAttributes(x_det.attr<std::string>(_Unicode(vis))));

//Fill layer with modules
// Position of first module, layer from center of CAL
double mod_pos0 = -(detSizeXY / 2.0) + (modSize.x() / 2.0) + layerCoatSizeX;
double layer_pos0 = -(detSizeZ / 2.0) + (modSize.y() / 2.0) + layerCoatSizeY;

//Fill uncoated layer with modules
for (int mod_id = 0; mod_id < nmod_perlayer; mod_id++) {

//Build // to z-axis, then rotate
Expand All @@ -71,26 +83,27 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
modPV.addPhysVolID("module", mod_id);
} //imod-loop close

//sector definition
Box sectorBox(detSizeXY / 2, detSizeXY / 2, detSizeZ / 2);
Volume sectorVol(det_name + "_sector", sectorBox, Air);
sectorVol.setVisAttributes(description.visAttributes(x_mod.attr<std::string>(_Unicode(vis))));

//Fill sector with layers
//Fill sector with layers (coated)
for (int layer_id = 0; layer_id < nlayer; layer_id++) {

double lay_pos_z = -layer_id * modSize.y() - layer_pos0;
double lay_pos_z = -layer_id * (modSize.y() + 2.0 * layerCoatSizeY) - layer_pos0;
double lay_pos_y = 0.0 * cm;
double lay_pos_x = 0.0 * cm;
int orientation = layer_id % 2 == 0;

//rotation
RotationZYX lay_rot = RotationZYX(0, 0, -90.0 * degree);
if (orientation)
lay_rot *= RotationY(-90.0 * degree);

PlacedVolume layPV = sectorVol.placeVolume(
layerVol, Transform3D(lay_rot, Position(lay_pos_x, lay_pos_y, lay_pos_z)));
layPV.addPhysVolID("layer", layer_id).addPhysVolID("orientation", orientation);

layPV.addPhysVolID("layer", layer_id);
} //layer_id-loop close

// loop over sectors(top, bottom)
Expand Down Expand Up @@ -134,30 +147,67 @@ static tuple<Volume, Position> build_specScFiCAL_module(const Detector& descript
Volume modVol("module_vol", modShape, modMat);

modVol.setVisAttributes(description.visAttributes(mod_x.attr<std::string>(_Unicode(vis))));
//----------------------------Scintillating fibers -----------------------------------------------------------

//--------------------------Block of fibers in a module------------------------------------------------------

//block fibers
auto fiber_block = mod_x.child(_Unicode(block));

auto fb_sx = fiber_block.attr<double>(_Unicode(sizeX));
auto fb_sy = fiber_block.attr<double>(_Unicode(sizeY));
auto fb_sz = fiber_block.attr<double>(_Unicode(sizeZ));
auto fb_SpaceXY = fiber_block.attr<double>(_Unicode(SpaceXY));

Position fbSize(fb_sx, fb_sy, fb_sz);

//fibers
auto fiber_tube = mod_x.child(_Unicode(fiber));
auto fr = fiber_tube.attr<double>(_Unicode(radius));
auto fsx = fiber_tube.attr<double>(_Unicode(spacex));
auto fsy = fiber_tube.attr<double>(_Unicode(spacey));
auto fiberMat = description.material(fiber_tube.attr<std::string>(_Unicode(material)));
Tube fiberShape(0., fr, modSize.z() / 2.0);

auto fr = fiber_tube.attr<double>(_Unicode(radius));
auto fsx = fiber_tube.attr<double>(_Unicode(spacex));
auto fsy = fiber_tube.attr<double>(_Unicode(spacey));

//fiber block description and placement in module
Box fbShape(fbSize.x() / 2.0, fbSize.y() / 2.0, fbSize.z() / 2.0);
Volume fbVol("fiberblock_volume", fbShape, modMat);
fbVol.setVisAttributes(
description.visAttributes(mod_x.attr<std::string>(_Unicode(vis)))); //same as module

int num_fbX = int(modSize.x() / (fbSize.x() + 2.0 * fb_SpaceXY));
int num_fbY = int(modSize.y() / (fbSize.y() + 2.0 * fb_SpaceXY));

double fb_xpos0 = -(modSize.x() / 2.0) + (fbSize.x() / 2.0) + fb_SpaceXY;
double fb_ypos0 = -(modSize.y() / 2.0) + (fbSize.y() / 2.0) + fb_SpaceXY;
int nblock = 0;

for (int iy = 0; iy < num_fbY; iy++) {
for (int ix = 0; ix < num_fbX; ix++) {
double fb_pos_x = fb_xpos0 + ix * (fbSize.x() + 2.0 * fb_SpaceXY); //mm
double fb_pos_y = fb_ypos0 + iy * (fbSize.y() + 2.0 * fb_SpaceXY); //mm
double fb_pos_z = 0 * mm;

auto fbPV = modVol.placeVolume(fbVol, nblock, Position{fb_pos_x, fb_pos_y, fb_pos_z});
fbPV.addPhysVolID("block", nblock++);
}
}

//fiber placement and description in blocks
auto fiberMat = description.material(fiber_tube.attr<std::string>(_Unicode(material)));
Tube fiberShape(0., fr, fbSize.z() / 2.0);
Volume fiberVol("fiber_vol", fiberShape, fiberMat);
fiberVol.setVisAttributes(description.visAttributes(fiber_tube.attr<std::string>(_Unicode(vis))));
fiberVol.setSensitiveDetector(sens);

//double submod_sizexy = 2.0*fr; // size of square = diameter of tubes.
int num_submodX = int(modSize.x() / (2 * fr + 2.0 * fsx));
int num_submodY = int(modSize.y() / (2 * fr + 2.0 * fsy));
int num_fX = int(fbSize.x() / (2 * fr + 2.0 * fsx));
int num_fY = int(fbSize.y() / (2 * fr + 2.0 * fsy));

double submod_xpos0 = -modSize.x() / 2.0 + fr + fsx;
double submod_ypos0 = -modSize.y() / 2.0 + fr + fsy;
int nfibers = 0;
double fiber_xpos0 = -(fbSize.x() / 2.0) + fr + fsx;
double fiber_ypos0 = -(fbSize.y() / 2.0) + fr + fsy;
int nfibers = 0;

//Fiber Holder
auto fiberholder_x = mod_x.child(_Unicode(fiberholder));
double fh_dz = 0.6 * mm; //thickness of fiber holder
double fh_dz = 0.25 * mm; //thickness of fiber holder

double fh_outerbox_y = 2.0 * fr + 2.0 * fsy;
double fh_outerbox_x = 2.0 * fr + 2.0 * fsx;
Expand All @@ -176,26 +226,25 @@ static tuple<Volume, Position> build_specScFiCAL_module(const Detector& descript
int nfh = 0;

//placement of fibers and fiberholder
for (int iy = 0; iy < num_submodY; iy++) {

for (int ix = 0; ix < num_submodX; ix++) {
for (int iy = 0; iy < num_fY; iy++) {
for (int ix = 0; ix < num_fX; ix++) {

double submod_pos_x = submod_xpos0 + ix * (2.0 * fr + 2.0 * fsx); //mm
double submod_pos_y = submod_ypos0 + iy * (2.0 * fr + 2.0 * fsy); //mm
double submod_pos_z = 0 * mm; //mm
double fiber_pos_x = fiber_xpos0 + ix * (2.0 * fr + 2.0 * fsx); //mm
double fiber_pos_y = fiber_ypos0 + iy * (2.0 * fr + 2.0 * fsy); //mm
double fiber_pos_z = 0 * mm; //mm

//placement of fiber
auto fiberPV = modVol.placeVolume(fiberVol, nfibers++,
Position{submod_pos_x, submod_pos_y, submod_pos_z});
auto fiberPV =
fbVol.placeVolume(fiberVol, nfibers++, Position{fiber_pos_x, fiber_pos_y, fiber_pos_z});
fiberPV.addPhysVolID("fiber_x", ix + 1).addPhysVolID("fiber_y", iy + 1);

//placement of fiber holder 6.6*cm apart c-to-c
int num_holders = 4; // which means 4 regions
double fh_pos_z0 = -1 * (modSize.z() / 2.0) + (fh_dz / 2.0);
int num_holders = 6; // which means 4 regions
double fh_pos_z0 = -1 * (fbSize.z() / 2.0) + (fh_dz / 2.0);

for (int iz = 0; iz < num_holders; iz++) {
double fh_pos_z = fh_pos_z0 + iz * ((modSize.z() - fh_dz) / (num_holders - 1));
modVol.placeVolume(fiberholderVol, nfh++, Position{submod_pos_x, submod_pos_y, fh_pos_z});
double fh_pos_z = fh_pos_z0 + iz * ((fbSize.z() - fh_dz) / (num_holders - 1));
fbVol.placeVolume(fiberholderVol, nfh++, Position{fiber_pos_x, fiber_pos_y, fh_pos_z});
} //iz close

} //ix close
Expand Down

0 comments on commit 4a010ff

Please sign in to comment.