diff --git a/compact/display.xml b/compact/display.xml index daf1d4898..69e76b048 100644 --- a/compact/display.xml +++ b/compact/display.xml @@ -62,9 +62,10 @@ Luminosity Visualisation - - - + + + + diff --git a/compact/far_backward/definitions.xml b/compact/far_backward/definitions.xml index ee3a4b26c..bfd863ee8 100644 --- a/compact/far_backward/definitions.xml +++ b/compact/far_backward/definitions.xml @@ -271,21 +271,28 @@ - - - + + + Note : Values/Notations for making modules pointing along z-axis. Rotation of modules wrt XY axis after construction. - - - - - + + + + + + + + + + + + diff --git a/compact/far_backward/lumi/spec_ScFi_cal.xml b/compact/far_backward/lumi/spec_ScFi_cal.xml index 3edf00d97..763649985 100644 --- a/compact/far_backward/lumi/spec_ScFi_cal.xml +++ b/compact/far_backward/lumi/spec_ScFi_cal.xml @@ -4,10 +4,16 @@ - + + + + + + + - system:8,sector:4,orientation:4,layer:8,module:4,fiber_x:16,fiber_y:16 + system:8,sector:8,layer:8,module:8,block:8,fiber_x:4,fiber_y:4 diff --git a/src/EcalLumiSpecWScFi_geo.cpp b/src/EcalLumiSpecWScFi_geo.cpp index db986e36a..eb4b65cca 100644 --- a/src/EcalLumiSpecWScFi_geo.cpp +++ b/src/EcalLumiSpecWScFi_geo.cpp @@ -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(_Unicode(material))); - Box layerBox(detSizeXY / 2, modSize.y() / 2, detSizeXY / 2); - Volume layerVol("layer", layerBox, Air); - layerVol.setVisAttributes(description.visAttributes(x_mod.attr(_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(_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 @@ -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(_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) @@ -134,30 +147,67 @@ static tuple build_specScFiCAL_module(const Detector& descript Volume modVol("module_vol", modShape, modMat); modVol.setVisAttributes(description.visAttributes(mod_x.attr(_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(_Unicode(sizeX)); + auto fb_sy = fiber_block.attr(_Unicode(sizeY)); + auto fb_sz = fiber_block.attr(_Unicode(sizeZ)); + auto fb_SpaceXY = fiber_block.attr(_Unicode(SpaceXY)); + + Position fbSize(fb_sx, fb_sy, fb_sz); //fibers auto fiber_tube = mod_x.child(_Unicode(fiber)); - auto fr = fiber_tube.attr(_Unicode(radius)); - auto fsx = fiber_tube.attr(_Unicode(spacex)); - auto fsy = fiber_tube.attr(_Unicode(spacey)); - auto fiberMat = description.material(fiber_tube.attr(_Unicode(material))); - Tube fiberShape(0., fr, modSize.z() / 2.0); + + auto fr = fiber_tube.attr(_Unicode(radius)); + auto fsx = fiber_tube.attr(_Unicode(spacex)); + auto fsy = fiber_tube.attr(_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(_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(_Unicode(material))); + Tube fiberShape(0., fr, fbSize.z() / 2.0); Volume fiberVol("fiber_vol", fiberShape, fiberMat); fiberVol.setVisAttributes(description.visAttributes(fiber_tube.attr(_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; @@ -176,26 +226,25 @@ static tuple 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