Skip to content
Snippets Groups Projects
Commit 983511e2 authored by Sylvester Joosten's avatar Sylvester Joosten
Browse files

Resolve "ERICH service material"

parent b8751ad8
Branches
Tags
1 merge request!278Resolve "ERICH service material"
......@@ -113,6 +113,8 @@
<vis name="MRICH_lens_vis" ref="AnlGray" showDaughters="true" visible="true" />
<vis name="MRICH_mirror_vis" ref="AnlGray" showDaughters="true" visible="true" />
<vis name="RICHServiceVis" ref="AnlGray" showDaughters="true" visible="true" />
</display>
<comment>
......
......@@ -102,6 +102,7 @@
<vis name="MRICH_lens_vis" ref="AnlGray" showDaughters="true" visible="true" />
<vis name="MRICH_mirror_vis" ref="AnlGray" showDaughters="true" visible="true" />
<vis name="RICHServiceVis" ref="AnlGray" showDaughters="true" visible="true" />
<comment>
Deprecated values used for IP6 vis
......
......@@ -155,6 +155,10 @@
rmax="ERICH_rmax - 4*cm"
/>
<services>
<comment> SJJ: random standin for readout + electronics + cooling @FIXME </comment>
<component name="aluminum" thickness="10*mm" vis="RICHServiceVis" material="Aluminum"/>
</services>
</sensors>
</detector>
......
......@@ -3,22 +3,23 @@
// Author: C. Dilks
//----------------------------------
#include <XML/Helper.h>
#include "TMath.h"
#include "TString.h"
#include "GeometryHelpers.h"
#include "Math/Point2D.h"
#include "DDRec/Surface.h"
#include "DDRec/DetectorData.h"
#include "DD4hep/OpticalSurfaces.h"
#include "DD4hep/DetFactoryHelper.h"
#include "DD4hep/OpticalSurfaces.h"
#include "DD4hep/Printout.h"
#include "DDRec/DetectorData.h"
#include "DDRec/Surface.h"
#include "GeometryHelpers.h"
#include "Math/Point2D.h"
#include "TMath.h"
#include "TString.h"
#include <XML/Helper.h>
using namespace dd4hep;
using namespace dd4hep::rec;
// create the detector
static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetector sens) {
static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetector sens)
{
xml::DetElement detElem = handle;
std::string detName = detElem.nameStr();
int detID = detElem.id();
......@@ -81,15 +82,20 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
if (debug_optics) {
printout(WARNING, "ERich_geo", "DEBUGGING ERICH OPTICS");
switch (debug_optics_mode) {
case 1: vesselMat = aerogelMat = filterMat = sensorMat = gasvolMat = desc.material("VacuumOptical"); break;
case 2: vesselMat = aerogelMat = filterMat = sensorMat = desc.material("VacuumOptical"); break;
default: printout(FATAL,"ERich_geo","UNKNOWN debug_optics_mode"); return det;
case 1:
vesselMat = aerogelMat = filterMat = sensorMat = gasvolMat = desc.material("VacuumOptical");
break;
case 2:
vesselMat = aerogelMat = filterMat = sensorMat = desc.material("VacuumOptical");
break;
default:
printout(FATAL, "ERich_geo", "UNKNOWN debug_optics_mode");
return det;
};
aerogelVis = sensorVis;
gasvolVis = vesselVis = desc.invisible();
};
// BUILD VESSEL //////////////////////////////////////
/* - `vessel`: aluminum enclosure, the mother volume of the eRICh
* - `gasvol`: gas volume, which fills `vessel`; all other volumes defined below
......@@ -97,20 +103,9 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
*/
// tank solids
Cone vesselTank(
vesselLength/2.0,
vesselRmin1,
vesselRmax1,
vesselRmin0,
vesselRmax0
);
Cone gasvolTank(
vesselLength/2.0 - windowThickness,
vesselRmin1 + wallThickness,
vesselRmax1 - wallThickness,
vesselRmin0 + wallThickness,
vesselRmax0 - wallThickness
);
Cone vesselTank(vesselLength / 2.0, vesselRmin1, vesselRmax1, vesselRmin0, vesselRmax0);
Cone gasvolTank(vesselLength / 2.0 - windowThickness, vesselRmin1 + wallThickness, vesselRmax1 - wallThickness,
vesselRmin0 + wallThickness, vesselRmax0 - wallThickness);
// extra solids for `debug_optics` only
Box vesselBox(1001, 1001, 1001);
......@@ -119,9 +114,18 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
// choose vessel and gasvol solids (depending on `debug_optics_mode` (0=disabled))
Solid vesselSolid, gasvolSolid;
switch (debug_optics_mode) {
case 0: vesselSolid=vesselTank; gasvolSolid=gasvolTank; break; // `!debug_optics`
case 1: vesselSolid=vesselBox; gasvolSolid=gasvolBox; break;
case 2: vesselSolid=vesselBox; gasvolSolid=gasvolTank; break;
case 0:
vesselSolid = vesselTank;
gasvolSolid = gasvolTank;
break; // `!debug_optics`
case 1:
vesselSolid = vesselBox;
gasvolSolid = gasvolBox;
break;
case 2:
vesselSolid = vesselBox;
gasvolSolid = gasvolTank;
break;
};
// volumes
......@@ -140,11 +144,9 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
auto originFront = Position(0., 0., vesselLength / 2.0);
auto originBack = Position(0., 0., -vesselLength / 2.0);
// sensitive detector type
sens.setType("photoncounter");
// SECTOR LOOP //////////////////////////////////
for (int isec = 0; isec < nSectors; isec++) {
......@@ -155,7 +157,6 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
double sectorRotation = isec * 360 / nSectors * degree;
std::string secName = "sec" + std::to_string(isec);
// BUILD RADIATOR //////////////////////////////////////
// solid and volume: create aerogel and filter sectors
......@@ -169,7 +170,8 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
// aerogel placement and surface properties
// TODO [low-priority]: define skin properties for aerogel and filter
auto radiatorPos = Position(0., 0., radiatorFrontplane - 0.5 * aerogelThickness) + originFront;
auto aerogelPV = gasvolVol.placeVolume(aerogelVol,
auto aerogelPV = gasvolVol.placeVolume(
aerogelVol,
RotationZ(sectorRotation) // rotate about beam axis to sector
* Translation3D(radiatorPos.x(), radiatorPos.y(), radiatorPos.z()) // re-center to originFront
* RotationY(radiatorPitch) // change polar angle to specified pitch
......@@ -181,7 +183,8 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
// filter placement and surface properties
if (!debug_optics) {
auto filterPV = gasvolVol.placeVolume(filterVol,
auto filterPV = gasvolVol.placeVolume(
filterVol,
RotationZ(sectorRotation) // rotate about beam axis to sector
* Translation3D(radiatorPos.x(), radiatorPos.y(), radiatorPos.z()) // re-center to originFront
* RotationY(radiatorPitch) // change polar angle
......@@ -195,8 +198,6 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
}; // END SECTOR LOOP //////////////////////////
// BUILD SENSORS ///////////////////////
// solid and volume: single sensor module
......@@ -205,7 +206,8 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
sensorVol.setVisAttributes(sensorVis);
// sensitivity
if(!debug_optics) sensorVol.setSensitiveDetector(sens);
if (!debug_optics)
sensorVol.setSensitiveDetector(sens);
// sensor plane positioning: we want |`sensorPlaneFrontplane`| to be the distance between the
// aerogel backplane (i.e., aerogel/filter boundary) and the sensor active surface (e.g, photocathode)
......@@ -232,11 +234,13 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
sy = sgny * usy;
// annular cut
if(std::hypot(sx,sy)<sensorPlaneRmin || std::hypot(sx,sy)>sensorPlaneRmax) continue;
if (std::hypot(sx, sy) < sensorPlaneRmin || std::hypot(sx, sy) > sensorPlaneRmax)
continue;
// placement (note: transformations are in reverse order)
auto sensorPV = gasvolVol.placeVolume(sensorVol,Transform3D(
Translation3D(sensorPlanePos.x(), sensorPlanePos.y(), sensorPlanePos.z()) // move to reference position
auto sensorPV = gasvolVol.placeVolume(
sensorVol, Transform3D(Translation3D(sensorPlanePos.x(), sensorPlanePos.y(),
sensorPlanePos.z()) // move to reference position
* Translation3D(sx, sy, 0.) // move to grid position
));
......@@ -248,7 +252,8 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
DetElement sensorDE(det, Form("sensor_de_%d", imod), 10000 * imod); // TODO: what is this 10000?
sensorDE.setPlacement(sensorPV);
if (!debug_optics) {
SkinSurface sensorSkin(desc, sensorDE, "sensor_optical_surface", sensorSurf, sensorVol); // TODO: 3rd arg needs `imod`?
SkinSurface sensorSkin(desc, sensorDE, "sensor_optical_surface", sensorSurf,
sensorVol); // TODO: 3rd arg needs `imod`?
sensorSkin.isValid();
};
......@@ -259,7 +264,35 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
};
};
// END SENSOR MODULE LOOP ------------------------
//
// Add service material if desired
if (detElem.child("sensors").hasChild("services")) {
xml_comp_t x_service = detElem.child("sensors").child(_Unicode(services));
Assembly service_vol("services");
service_vol.setVisAttributes(desc, x_service.visStr());
// Compute service total thickness from components
double total_thickness = 0;
xml_coll_t ci(x_service, _Unicode(component));
for (ci.reset(), total_thickness = 0.0; ci; ++ci) {
total_thickness += xml_comp_t(ci).thickness();
}
int ncomponents = 0;
double thickness_sum = -total_thickness / 2.0;
for (xml_coll_t ci(x_service, _Unicode(component)); ci; ++ci, ncomponents++) {
xml_comp_t x_comp = ci;
double thickness = x_comp.thickness();
Tube c_tube{sensorPlaneRmin, sensorPlaneRmax, thickness};
Volume c_vol{_toString(ncomponents, "component%d"), c_tube, desc.material(x_comp.materialStr())};
c_vol.setVisAttributes(desc, x_comp.visStr());
service_vol.placeVolume(c_vol, Position(0, 0, thickness_sum + thickness / 2.0));
thickness_sum += thickness;
}
gasvolVol.placeVolume(service_vol,
Transform3D(Translation3D(sensorPlanePos.x(), sensorPlanePos.y(),
sensorPlanePos.z() - sensorThickness - total_thickness)));
}
// place gas volume
PlacedVolume gasvolPV = vesselVol.placeVolume(gasvolVol, Position(0, 0, 0));
......@@ -268,9 +301,7 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
// place mother volume (vessel)
Volume motherVol = desc.pickMotherVolume(det);
PlacedVolume vesselPV = motherVol.placeVolume(vesselVol,
Position(0, 0, vesselZmin) - originFront
);
PlacedVolume vesselPV = motherVol.placeVolume(vesselVol, Position(0, 0, vesselZmin) - originFront);
vesselPV.addPhysVolID("system", detID);
det.setPlacement(vesselPV);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment