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

Low Q2 acts surfaces #699

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft
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
6 changes: 4 additions & 2 deletions compact/definitions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,10 @@ The unused IDs below are saved for future use.
<constant name="LumiSpecCAL_ID" value="194"/>
<constant name="LumiDirectPCAL_ID" value="195"/>

<constant name="TaggerTracker_ID" value="198"/>
<constant name="TaggerCalorimeter_ID" value="199"/>
<constant name="TaggerSubAssembly_ID" value="196"/>
<constant name="TaggerTrackerCompanion_ID" value="197"/>
<constant name="TaggerTracker_ID" value="198"/>
<constant name="TaggerCalorimeter_ID" value="199"/>

<documentation>
## Detector Definition Parameters
Expand Down
29 changes: 19 additions & 10 deletions compact/far_backward/taggers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,20 @@
</define>

<detectors>
<detector
id="TaggerTrackerCompanion_ID"
name="TaggerTrackerCompanion"
type="epic_CompositeTracker"
actsType="endcap"
vis="TrackerSubAssemblyVis">
<type_flags type="DetType_TRACKER + DetType_ENDCAP"/>
<position x="0*cm" y="0*cm" z="+4*um" />
</detector>

<comment> Main beamline vacuum volume spanning between B2BeR and Q3eR magnets</comment>
<detector id="TaggerTracker_ID" name="BackwardsTaggerStation" type="BackwardsTagger" wall="Backwards_Box_Wall" lumi="true" vis="BeamPipeVis" readout="TaggerTrackerHits">

<type_flags type="DetType_TRACKER + DetType_ENDCAP"/>
<focus x="Dipole_Focus_X" y="Dipole_Focus_Y" z="Dipole_Focus_Z" />
<bounding xmin="Vacuum_BB_MinX" xmax="Vacuum_BB_MaxX"
ymin="Vacuum_BB_MinY" ymax="Vacuum_BB_MaxY"
Expand All @@ -39,6 +50,8 @@
<trackLayer id="2" type="timepix" z="203*mm" sensor_thickness="400*um"/>
<trackLayer id="3" type="timepix" z="303*mm" sensor_thickness="400*um"/>
<windowLayer id="1" type="window" z="0*mm" thickness="2*mm" material="CarbonFiber"/>
<layer_material surface="inner" binning="binPhi,binR" bins0="12" bins1="12"/>
<layer_material surface="outer" binning="binPhi,binR" bins0="12" bins1="12"/>
</module>
<module id="2"
name="Tagger2"
Expand All @@ -51,24 +64,20 @@
>
<dimensions x="Tagger2_Width/2" y="Tagger2_Height/2" z="Tagger2_Length"/>
<foilLayer id="0" type="foil" z="0*mm" thickness="100*um" angle="70*deg"/>
<trackLayer id="0" type="timepix" z="3*mm" sensor_thickness="400*um"/>
<trackLayer id="1" type="timepix" z="103*mm" sensor_thickness="400*um"/>
<trackLayer id="2" type="timepix" z="203*mm" sensor_thickness="400*um"/>
<trackLayer id="3" type="timepix" z="303*mm" sensor_thickness="400*um"/>
<trackLayer id="4" type="timepix" z="3*mm" sensor_thickness="400*um"/>
<trackLayer id="5" type="timepix" z="103*mm" sensor_thickness="400*um"/>
<trackLayer id="6" type="timepix" z="203*mm" sensor_thickness="400*um"/>
<trackLayer id="7" type="timepix" z="303*mm" sensor_thickness="400*um"/>
<windowLayer id="1" type="window" z="0*mm" thickness="2*mm" material="CarbonFiber"/>
<layer_material surface="inner" binning="binPhi,binR" bins0="12" bins1="12"/>
<layer_material surface="outer" binning="binPhi,binR" bins0="12" bins1="12"/>
</module>

</detector>

</detectors>


<plugins>
<plugin name="DD4hep_ParametersPlugin">
<argument value="BackwardsTaggerStation"/>
<argument value="layer_pattern: str=Tagger\d"/>
</plugin>
</plugins>


<readouts>
Expand Down
7 changes: 7 additions & 0 deletions compact/tracking/definitions_craterlake.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@
<composite name="B0Tracker"/>
<composite name="B0TrackerCompanion"/>
</detector>
<detector id="TaggerSubAssembly_ID"
name="TaggerSubAssembly"
type="DD4hep_SubdetectorAssembly"
vis="TrackerSubAssemblyVis">
<composite name="TaggerTrackerCompanion"/>
<composite name="BackwardsTaggerStation"/>
</detector>
</detectors>

<documentation>
Expand Down
57 changes: 50 additions & 7 deletions src/BackwardsTaggers_geo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
// Copyright (C) 2022 Simon Gardner

#include "DD4hep/DetFactoryHelper.h"
#include "DD4hep/OpticalSurfaces.h"
#include "DD4hep/Printout.h"
#include "DDRec/DetectorData.h"
#include "DDRec/Surface.h"
#include "XML/Utilities.h"
#include "DD4hepDetectorHelper.h"


//////////////////////////////////////////////////
Expand All @@ -29,6 +30,7 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
int detID = x_det.id();

DetElement det(detName, detID);
dd4hep::xml::setDetectorTypeFlag(x_det, det);

string vis_name = dd4hep::getAttrOrDefault<std::string>(x_det, _Unicode(vis), "BackwardsBox");

Expand Down Expand Up @@ -181,7 +183,8 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
nAir++;
}

Assembly TaggerAssembly("Tagger_module_assembly");
//Assembly TaggerAssembly("Tagger_module_assembly");
Assembly TaggerAssembly(moduleName);

PlacedVolume pv_mod2 = mother.placeVolume(
TaggerAssembly,
Expand All @@ -191,6 +194,9 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
pv_mod2.addPhysVolID("module", moduleID);
moddet.setPlacement(pv_mod2);

auto &moduleParams = DD4hepDetectorHelper::ensureExtension<dd4hep::rec::VariantParameters>(moddet);
moduleParams.set<string>("layer_pattern", "Tagger_tracker_layer\\d");

Make_Tagger(desc, mod, TaggerAssembly, moddet, sens);

}
Expand Down Expand Up @@ -367,6 +373,11 @@ static void Make_Tagger(Detector& desc, xml_coll_t& mod, Assembly& env, DetEleme
double layerZ = dd4hep::getAttrOrDefault<double>(lay, _Unicode(z), 0 * mm);
double layerThickness = dd4hep::getAttrOrDefault<double>(lay, _Unicode(sensor_thickness), 200 * um);

double envelope_r_min = dd4hep::getAttrOrDefault<double>(lay, _Unicode(envelope_r_min), -10.0*mm);
double envelope_r_max = dd4hep::getAttrOrDefault<double>(lay, _Unicode(envelope_r_max), 10.0*mm);
double envelope_z_min = dd4hep::getAttrOrDefault<double>(lay, _Unicode(envelope_z_min), -10.0*mm);
double envelope_z_max = dd4hep::getAttrOrDefault<double>(lay, _Unicode(envelope_z_max), 10.0*mm);

Volume mother = env;
double MotherThickness = tagboxL;

Expand All @@ -379,17 +390,49 @@ static void Make_Tagger(Detector& desc, xml_coll_t& mod, Assembly& env, DetEleme
}

Box Layer_Box(tag_w, tag_h, layerThickness / 2);
Volume layVol("Tagger_tracker_layer", Layer_Box, Silicon);

std::string layerName = "Tagger_tracker_layer" + std::to_string(layerID);
Volume layVol(layerName, Layer_Box, Silicon);
layVol.setSensitiveDetector(sens);
layVol.setVisAttributes(desc.visAttributes(layerVis));


PlacedVolume pv_layer = mother.placeVolume(layVol, Transform3D(rotate, Position(0, 0, MotherThickness - layerZ + layerThickness / 2)));
pv_layer.addPhysVolID("layer", layerID);
Assembly layer_vol(layerName);
PlacedVolume pv_layer = mother.placeVolume(layer_vol, Transform3D(rotate, Position(0, 0, MotherThickness - layerZ + layerThickness / 2)));
PlacedVolume pv_layerdet = layer_vol.placeVolume(layVol);
pv_layerdet.addPhysVolID("layer", layerID);

DetElement laydet(modElement,"layerName"+std::to_string(layerID), layerID);
laydet.setPlacement(pv_layer);
DetElement laydet(modElement,pv_layer.volume().name(), layerID);
DetElement laydetdet(laydet,layerName+"DET", layerID);

laydetdet.setPlacement(pv_layerdet);

// -------- create a measurement plane for the tracking surface attched to the sensitive volume -----
Vector3D u(-1., 0., 0.);
Vector3D v( 0.,-1., 0.);
Vector3D n( 0., 0., 1.);

// Add surface to layer for acts reconstruction
SurfaceType type(SurfaceType::Sensitive);

layer_vol->GetShape()->ComputeBBox();
auto &layerParams = DD4hepDetectorHelper::ensureExtension<dd4hep::rec::VariantParameters>(laydet);
layerParams.set<string>("axis_definitions", "XZY");
layerParams.set<double>("envelope_r_min", envelope_r_min);
layerParams.set<double>("envelope_r_max", envelope_r_max);
layerParams.set<double>("envelope_z_min", envelope_z_min);
layerParams.set<double>("envelope_z_max", envelope_z_max);

for (xml_coll_t lmat(mod, _Unicode(layer_material)); lmat; ++lmat) {
xml_comp_t x_layer_material = lmat;
DD4hepDetectorHelper::xmlToProtoSurfaceMaterial(x_layer_material, layerParams, "layer_material");
}


VolPlane surf(layVol, type, 2.0, 1.0, u, v, n); //,o ) ;
volSurfaceList(laydet)->push_back(surf);

laydet.setPlacement(pv_layer);

}
}
Expand Down