-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add a steering file for monitoring using KF tracks and add a tool to remove hits from pattern reco in LCIO #935
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
samplingFraction: 1.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
samplingFraction: 1.0 |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
name: HPS_TimDesign_iter0 |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
package org.hps.recon.tracking; | ||
|
||
import java.util.List; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
|
||
import org.lcsim.detector.tracker.silicon.SiSensor; | ||
import org.lcsim.event.EventHeader; | ||
|
@@ -16,6 +18,8 @@ public class SensorSetup extends RawTrackerHitSensorSetup { | |
|
||
/// Name of the collection of fitted hits | ||
private String fittedHitColName_ = ""; | ||
|
||
private List<String> sensorNames_ = new ArrayList<String>(); | ||
|
||
/// Constructor | ||
public SensorSetup() { } | ||
|
@@ -29,6 +33,10 @@ public SensorSetup() { } | |
*/ | ||
public void setFittedHitCollection(String fittedHitColName) { fittedHitColName_ = fittedHitColName; } | ||
|
||
public void setSkipSensors(String[] sensorNames) { | ||
this.sensorNames_ = new ArrayList<String>(Arrays.asList(sensorNames)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change this to Hash Map. On a separate note, I wonder if this method should check if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the framework already checks you only set a specific variable in the steering file once and throws an error if it is there more than once. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given the behavior we would like from this code, not clear to me HashMap really buys us anything. |
||
} | ||
|
||
@Override | ||
protected void process(EventHeader event) { | ||
|
||
|
@@ -50,7 +58,26 @@ protected void process(EventHeader event) { | |
public void loadFittedHits(List< LCRelation > fittedHits) { | ||
|
||
for (LCRelation fittedHit : fittedHits) { | ||
|
||
Boolean skipHit = false; | ||
RawTrackerHit rawHit = FittedRawTrackerHit.getRawTrackerHit(fittedHit); | ||
|
||
SiSensor sensor = (SiSensor) rawHit.getDetectorElement(); | ||
String name = sensor.getName(); | ||
|
||
if (sensorNames_.size() > 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This check is unnecessary. If sensorNames_ is empty, the whole for loop will be skipped. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The loop is over all the hits, this check is on the list of sensors we want to skip. I do think sensorNames_ is potentially a confusing variable name since it is really the sensors to be skipped. |
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the following works as well ...
Note the use of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The behavior of this will be different. contains behavior is different when called on an array vs a string. I think we do indeed want contains called on the string and not the array, which gives us easier control over which sensors we drop. This is only called once, so the complexity of the code doesn't really matter, and either way will effectively run in the same time. We would like to be able to remove multiple sensors with a single string if they all contain the same sub-string. |
||
for (String sensorName : sensorNames_) { | ||
if (name.contains(sensorName)) { | ||
skipHit = true; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
if (skipHit) | ||
continue; | ||
|
||
((SiSensor) rawHit.getDetectorElement()).getReadout().addHit(fittedHit); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this to a HashSet. You don't need to initialize the array since you do so in the
setSkipSensors
method below.