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

Roads tools cleanup and documentation #61

Merged
merged 4 commits into from
Jul 4, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ public class Dictionary extends HashMap<ArrayList<Byte>, Particle> {
public Dictionary() {
}

public Road getRoad(ArrayList<Byte> key) {
if(this.containsKey(key))
return new Road(key, this.get(key));
else
return null;
}

public void printDictionary() {
for(Map.Entry<ArrayList<Byte>, Particle> entry : this.entrySet()) {
Expand Down Expand Up @@ -59,9 +65,9 @@ public void readDictionary(String fileName, TestMode mode, int wireBinning, int
else {
this.put(road.getKey(mode), road.getParticle());
}
progress.setAsInteger("roads", nFull);
progress.setAsInteger("duplicates", nDupli);
progress.setAsInteger("good", this.size());
progress.setAsInteger("roads", nFull);
progress.setAsInteger("good", this.size());
progress.updateStatus();
}
txtreader.close();
Expand Down Expand Up @@ -97,9 +103,10 @@ public static enum TestMode {

UDF(-1, "Undefined"),
DC(0, "DC"),
DCFTOFPCALU(1, "DCFTOFPCALU"),
DCFTOFPCALUVW(2, "DCFTOFPCALUVW"),
DCFTOFPCALUVWHTCC(3, "DCFTOFPCALUVWHTCC");
DCPCALU(1, "DCPCALU"),
DCFTOFPCALU(2, "DCFTOFPCALU"),
DCFTOFPCALUVW(3, "DCFTOFPCALUVW"),
DCFTOFPCALUVWHTCC(4, "DCFTOFPCALUVWHTCC");

private int mode;
private String name;
Expand Down Expand Up @@ -132,10 +139,12 @@ public static TestMode getTestMode(int mode) {
case 0:
return TestMode.DC;
case 1:
return TestMode.DCFTOFPCALU;
return TestMode.DCPCALU;
case 2:
return TestMode.DCFTOFPCALUVW;
return TestMode.DCFTOFPCALU;
case 3:
return TestMode.DCFTOFPCALUVW;
case 4:
return TestMode.DCFTOFPCALUVWHTCC;
default:
return TestMode.UDF;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ public static void main(String[] args) {

DefaultLogger.debug();

OptionParser parser = new OptionParser("dict-validation");
OptionParser parser = new OptionParser("dict-maker");
parser.setRequiresInputList(false);
parser.addRequired("-o" , "dictionary file name");
parser.addRequired("-i" , "event file");
parser.addOption("-pid" , "0", "select particle PID for new dictonary, 0: no selection,");
parser.addOption("-pid" , "0", "select particle PID for new dictionary, 0: no selection,");
parser.addOption("-charge" , "0", "select particle charge for new dictionary, 0: no selection");
parser.addOption("-threshold", "1", "select roads momentum threshold in GeV");
parser.addOption("-vzmin" , "-10", "minimum vz (cm)");
Expand All @@ -84,9 +85,6 @@ public static void main(String[] args) {
parser.addOption("-dupli" , "1", "remove duplicates in dictionary creation, 0=false, 1=true");
parser.parse(args);

List<String> arguments = new ArrayList<String>();
for(String item : args){ arguments.add(item); }

String dictionaryFileName = null;
if(parser.hasOption("-o")==true) dictionaryFileName = parser.getOption("-o").stringValue();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private Road getRoad(int charge, double p, double theta, double phi, double vx,

Line3d trkLine = new Line3d(ftof,ecal);
List<DetHit> ftofHits = ftofDetector.getIntersections(trkLine);
if (ftofHits != null && ftofHits.size() > 0) {
if (ftofHits != null && !ftofHits.isEmpty()) {
for (DetHit hit : ftofHits) {
FTOFDetHit fhit = new FTOFDetHit(hit);
road.setPaddle(fhit.getLayer(), (byte) fhit.getPaddle());
Expand All @@ -202,7 +202,7 @@ private Road getRoad(int charge, double p, double theta, double phi, double vx,
List<DetectorHit> ecalHits = ecalDetector.getHits(path);

int pcalU=0; int pcalV=0; int pcalW=0;
if (ecalHits != null && ecalHits.size() > 0) {
if (ecalHits != null && !ecalHits.isEmpty()) {
for (DetectorHit ehit : ecalHits) {
if(ehit.getSuperlayerId()+1==1) {
if(ehit.getLayerId()+1==1 && pcalU==0)
Expand Down Expand Up @@ -341,8 +341,8 @@ public static void main(String[] args) {

DefaultLogger.debug();

OptionParser parser = new OptionParser("dict-maker");

OptionParser parser = new OptionParser("dict-generator");
parser.setRequiresInputList(false);
parser.addRequired("-torus", "torus scale");
parser.addRequired("-solenoid","solenoid scale");
parser.addRequired("-charge", "particle charge");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public static void main(String[] args) {
txtreader.close();
}
progress.showStatus();
bufferedWriter.close();
}
catch (FileNotFoundException e) {
e.printStackTrace();
Expand Down
Loading