2020import org .lcsim .geometry .compact .converter .lcdd .util .Position ;
2121import org .lcsim .geometry .compact .converter .lcdd .util .Rotation ;
2222import org .lcsim .geometry .compact .converter .lcdd .util .SensitiveDetector ;
23+ import org .lcsim .geometry .compact .converter .lcdd .util .Tracker ;
2324import org .lcsim .geometry .compact .converter .lcdd .util .Volume ;
2425import org .lcsim .geometry .util .TransformationUtils ;
2526
3031 */
3132public abstract class HPSTracker2014Base extends LCDDSubdetector {
3233
33- protected boolean _debug = false ;
34+ protected boolean _debug = true ;
3435 protected static HPSTrackerLCDDBuilder builder ;
3536 private final boolean buildBeamPlane = false ;
3637 private final double beamPlaneWidth = 385.00 ;
3738 private final double beamPlaneLength = 1216.00 ;
3839 private final double beamPlaneThickness = 0.00000001 ;
40+
41+ private String inactiveSiReadoutName = null ;
42+ private Tracker inactiveSiTracker = null ;
3943
4044 public HPSTracker2014Base (Element c ) throws JDOMException {
4145 super (c );
46+ if (c .getAttribute ("inactiveSiReadout" ) != null ) {
47+ this .inactiveSiReadoutName = c .getAttributeValue ("inactiveSiReadout" );
48+ }
49+ }
50+
51+ public void setInactiveSiReadoutName (String inactiveSiReadoutName ) {
52+ this .inactiveSiReadoutName = inactiveSiReadoutName ;
4253 }
4354
4455 /**
@@ -49,7 +60,7 @@ public HPSTracker2014Base(Element c) throws JDOMException {
4960 * @return the builder.
5061 */
5162 abstract protected HPSTrackerLCDDBuilder initializeBuilder (LCDD lcdd , SensitiveDetector sens );
52-
63+
5364 public boolean isTracker () {
5465 return true ;
5566 }
@@ -73,6 +84,17 @@ public void addToLCDD(LCDD lcdd, SensitiveDetector sens) throws JDOMException {
7384 // vee (constraints pitch & yaw)
7485 // flat (constraints roll)
7586 // /
87+
88+ /**
89+ * The sensitive detector for reading out hits from the inactive region of the
90+ * sensor is setup here, if necessary. --JM
91+ */
92+ if (this .inactiveSiReadoutName != null ) {
93+ Tracker tracker = new Tracker (this .inactiveSiReadoutName + "_det" );
94+ tracker .setHitsCollection (this .inactiveSiReadoutName );
95+ lcdd .addSensitiveDetector (tracker );
96+ this .inactiveSiTracker = tracker ;
97+ }
7698
7799 // ID of the detector.
78100 int id = node .getAttribute ("id" ).getIntValue ();
@@ -227,14 +249,14 @@ private void setupPhysicalVolumes(LCDDSurveyVolume lcddObj, LCDD lcdd, Sensitive
227249 */
228250 private void setPhysicalVolumeProperties (LCDDSurveyVolume surveyVolume , SensitiveDetector sd )
229251 throws DataConversionException {
230-
252+
231253 if (_debug )
232254 System .out .printf ("%s: setPhysVolumeProperties for name %s\n " , getClass ().getSimpleName (),
233- surveyVolume .getName ());
255+ surveyVolume .getName ());
234256
235257 String name = surveyVolume .getName ();
236258 if (HPSTrackerBuilder .isHalfModule (surveyVolume .getName ())) {
237- setHalfModulePhysicalVolumeProperties (surveyVolume );
259+ setHalfModulePhysicalVolumeProperties (surveyVolume );
238260 } else if (HPSTrackerBuilder .isActiveSensor (surveyVolume .getName ())) {
239261 setActiveSensorPhysicalVolumeProperties (surveyVolume , sd );
240262 } else if (HPSTrackerBuilder .isSensor (surveyVolume .getName ())) {
@@ -272,6 +294,16 @@ private void setSensorPhysicalVolumeProperties(LCDDSurveyVolume surveyVolume) {
272294 private void setActiveSensorPhysicalVolumeProperties (LCDDSurveyVolume surveyVolume , SensitiveDetector sd ) {
273295 surveyVolume .getPhysVolume ().addPhysVolID ("sensor" , 0 );
274296 surveyVolume .getVolume ().setSensitiveDetector (sd );
297+
298+ /**
299+ * Assign inactive Si detector to half-module, which must happen after the active sensor has been processed so
300+ * that XML elements appear in the correct order defined by the schema. --JM
301+ */
302+ if (this .inactiveSiTracker != null ) {
303+ //System.out.println("Setting sens det '" + this.inactiveSiReadoutName
304+ // + "' on inactive Si volume '" + surveyVolume.getVolume().getName() + "'");
305+ surveyVolume .getPhysMother ().getVolume ().setSensitiveDetector (this .inactiveSiTracker );
306+ }
275307 }
276308
277309 abstract protected int getModuleNumber (String surveyVolume );
@@ -293,7 +325,6 @@ private void setHalfModulePhysicalVolumeProperties(LCDDSurveyVolume surveyVolume
293325 physVol .addPhysVolID ("barrel" , 0 );
294326 surveyVolume .getPhysVolume ().addPhysVolID ("layer" , layer );
295327 surveyVolume .getPhysVolume ().addPhysVolID ("module" , moduleNumber );
296-
297328 }
298329
299330 protected void makeBeamPlane (Volume motherVolume , LCDD lcdd , SensitiveDetector sens ) throws JDOMException {
0 commit comments