Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[aranya_lumidesign] LumiCal Material/Dim updates. #797

Merged
merged 4 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions compact/display.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@
<comment>
Luminosity Visualisation
</comment>
<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"/>
<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
8 changes: 4 additions & 4 deletions compact/far_backward/definitions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -283,17 +283,17 @@
Rotation of modules wrt XY axis after construction.
</comment>

<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.5*cm"/> <!-- mechanical covering of layers, def without rotation -->
<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)"/>
Expand Down
12 changes: 6 additions & 6 deletions compact/far_backward/lumi/spec_ScFi_cal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
<detectors>
<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"/>
<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="Aluminum5083" vis="LumiSpecCAL_LayerVis"/>
<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
<block sizeX="LumiSpecCAL_SiPMSizeXY" sizeY="LumiSpecCAL_SiPMSizeXY" sizeZ="LumiSpecCAL_ModSizeZ" SpaceXY="LumiSpecCAL_SiPMSpaceXY"/>

<fiber
material="Polystyrene"
radius="LumiSpecCAL_FiberRadius"
spacex="LumiSpecCAL_FiberSpaceX"
spacey="LumiSpecCAL_FiberSpaceY"
vis="LumiSpecCAL_FiberVis"/>
<fiberholder material="Brass360" vis="LumiSpecCAL_FiberHolderVis"/>
<fiberholder material="Steel1020" vis="LumiSpecCAL_FiberHolderVis"/>
</module>
<sector id="0">
<position x="0.0*cm" y="LumiSpecCAL_Y" z="LumiSpecCAL_Z"/>
Expand Down
123 changes: 63 additions & 60 deletions src/EcalLumiSpecWScFi_geo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
double detSizeZ = getAttrOrDefault(x_det, _Unicode(sizeZ), 180 * mm);
int nmod_perlayer = getAttrOrDefault(x_det, _Unicode(nmod_perlayer), 3);
int nlayer = getAttrOrDefault(x_det, _Unicode(nlayer), 20);

// Global detector position and resolution
xml_comp_t pos = x_det.position();
xml_comp_t rot = x_det.rotation();
Expand All @@ -54,16 +54,16 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s

//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(laySizeX/2.0, laySizeY/2.0, laySizeZ/2.0);

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(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))));

Expand Down Expand Up @@ -91,19 +91,19 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
//Fill sector with layers (coated)
for (int layer_id = 0; layer_id < nlayer; layer_id++) {

double lay_pos_z = -layer_id*(modSize.y() + 2.0*layerCoatSizeY) - 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);
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);
layPV.addPhysVolID("layer", layer_id);
} //layer_id-loop close

// loop over sectors(top, bottom)
Expand Down Expand Up @@ -147,92 +147,95 @@ 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))));

//--------------------------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_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
//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 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);
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) );
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;
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;
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++);
}}
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)));
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);

int num_fX = int(fbSize.x() /(2 *fr + 2.0 *fsx));
int num_fY = int(fbSize.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 fiber_xpos0 = -(fbSize.x()/2.0) + fr + fsx;
double fiber_ypos0 = -(fbSize.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.4 * mm; //thickness of fiber holder
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this value to XML


double fh_outerbox_y = 2.0*fr + 2.0*fsy;
double fh_outerbox_x = 2.0*fr + 2.0*fsx;
Box fh_outerbox(fh_outerbox_x/2.0, fh_outerbox_y/2.0, fh_dz/2.0);
double fh_outerbox_y = 2.0 * fr + 2.0 * fsy;
double fh_outerbox_x = 2.0 * fr + 2.0 * fsx;
Box fh_outerbox(fh_outerbox_x / 2.0, fh_outerbox_y / 2.0, fh_dz / 2.0);

double fh_innerbox_y = 2.0*fr;
double fh_innerbox_x = 2.0*fr;
Box fh_innerbox(fh_innerbox_x/2.0, fh_innerbox_y/2.0, fh_dz/2.0);
double fh_innerbox_y = 2.0 * fr;
double fh_innerbox_x = 2.0 * fr;
Box fh_innerbox(fh_innerbox_x / 2.0, fh_innerbox_y / 2.0, fh_dz / 2.0);

SubtractionSolid fiberholder_solid(fh_outerbox, fh_innerbox, Position(0.0, 0.0, 0.0));
auto fiberholderMat = description.material(fiberholder_x.attr<std::string>(_Unicode(material)));
Volume fiberholderVol("fiberholder_vol", fiberholder_solid, fiberholderMat);
fiberholderVol.setVisAttributes( description.visAttributes(fiberholder_x.attr<std::string>(_Unicode(vis))) );
fiberholderVol.setVisAttributes(
description.visAttributes(fiberholder_x.attr<std::string>(_Unicode(vis))));

int nfh = 0;

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

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
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 = fbVol.placeVolume(fiberVol, nfibers++,
Position{fiber_pos_x, fiber_pos_y, fiber_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
Expand Down
Loading