Skip to content

Commit f2ca293

Browse files
authored
Merge pull request #203 from fucd/ftd-surface
GEO: add surface for sensitive (SiTrackerSkewRing_v01)
2 parents 06db153 + cc2070a commit f2ca293

1 file changed

Lines changed: 30 additions & 7 deletions

File tree

Detector/DetCRD/src/Tracker/SiTrackerSkewRing_v01_geo.cpp

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ static dd4hep::Ref_t create_detector(Detector& description, xml_h e, SensitiveDe
6969
sens.setType("tracker");
7070
std::cout << " ** building SiTrackerEndcapRing_v01 ..." << std::endl ;
7171

72+
dd4hep::xml::Component recPar = x_det.child(_Unicode(reconstruction));
73+
const double strip_width = recPar.attr< double >(_Unicode(strip_width));
74+
const double strip_length = recPar.attr< double >(_Unicode(strip_length));
75+
const double strip_pitch = recPar.attr< double >(_Unicode(strip_pitch));
76+
const double strip_angle = recPar.attr< double >(_Unicode(strip_angle));
77+
7278
dd4hep::rec::ZDiskPetalsData* zDiskPetalsData = new dd4hep::rec::ZDiskPetalsData;
7379

7480
PlacedVolume pv;
@@ -120,6 +126,7 @@ static dd4hep::Ref_t create_detector(Detector& description, xml_h e, SensitiveDe
120126
moduleVol.setVisAttributes(description.visAttributes(x_layer.visStr()));
121127

122128
Placements sensitives;
129+
vector<dd4hep::rec::VolPlane> planes;
123130
int sensor_id = 1;
124131
int c_id = 0;
125132
double c_pos = -half_thickness;
@@ -137,7 +144,27 @@ static dd4hep::Ref_t create_detector(Detector& description, xml_h e, SensitiveDe
137144
pv.addPhysVolID("sensor", sensor_id);
138145
c_vol.setSensitiveDetector(sens);
139146
sensitives.push_back(pv);
140-
++sensor_id;
147+
148+
dd4hep::rec::Vector3D u(-1., 0., 0.);
149+
dd4hep::rec::Vector3D v( 0., 1., 0.);
150+
dd4hep::rec::Vector3D n( 0., 0., -1.);
151+
dd4hep::rec::SurfaceType surfType(dd4hep::rec::SurfaceType::Sensitive);
152+
double front_thickness = c_thickness/2;
153+
double back_thickness = (sensor_id==1) ? c_thickness/2+support_thickness : c_thickness/2;
154+
if(!is_pixel){
155+
surfType.setProperty(dd4hep::rec::SurfaceType::Measurement1D, true) ;
156+
if(sensor_id==1){
157+
u.fill(-cos(strip_angle), sin(strip_angle), 0.);
158+
v.fill( sin(strip_angle), cos(strip_angle), 0.);
159+
}
160+
else{
161+
u.fill(-cos(strip_angle), -sin(strip_angle), 0.);
162+
v.fill(-sin(strip_angle), cos(strip_angle), 0.);
163+
}
164+
}
165+
dd4hep::rec::VolPlane surf(c_vol, surfType , front_thickness, back_thickness, u,v,n);
166+
planes.push_back(surf);
167+
++sensor_id;
141168
}
142169
c_pos += c_thickness;
143170
}
@@ -160,6 +187,7 @@ static dd4hep::Ref_t create_detector(Detector& description, xml_h e, SensitiveDe
160187
PlacedVolume sens_pv = sensitives[ic];
161188
DetElement comp_elt(module, sens_pv.volume().name(), module_id);
162189
comp_elt.setPlacement(sens_pv);
190+
dd4hep::rec::volSurfaceList(comp_elt)->push_back(planes[ic]);
163191
}
164192

165193
if(reflect){
@@ -172,6 +200,7 @@ static dd4hep::Ref_t create_detector(Detector& description, xml_h e, SensitiveDe
172200
PlacedVolume sens_pv = sensitives[ic];
173201
DetElement comp_elt(r_module, sens_pv.volume().name(), module_id);
174202
comp_elt.setPlacement(sens_pv);
203+
dd4hep::rec::volSurfaceList(comp_elt)->push_back(planes[ic]);
175204
}
176205
}
177206
zshift_support = -zshift_support;
@@ -203,12 +232,6 @@ static dd4hep::Ref_t create_detector(Detector& description, xml_h e, SensitiveDe
203232
zDiskPetalsData->layers.push_back(thisLayer);
204233
}
205234

206-
dd4hep::xml::Component recPar = x_det.child(_Unicode(reconstruction));
207-
const double strip_width = recPar.attr< double >(_Unicode(strip_width));
208-
const double strip_length = recPar.attr< double >(_Unicode(strip_length));
209-
const double strip_pitch = recPar.attr< double >(_Unicode(strip_pitch));
210-
const double strip_angle = recPar.attr< double >(_Unicode(strip_angle));
211-
212235
zDiskPetalsData->widthStrip = strip_width;
213236
zDiskPetalsData->lengthStrip = strip_length;
214237
zDiskPetalsData->pitchStrip = strip_pitch;

0 commit comments

Comments
 (0)