Skip to content

Commit

Permalink
Merge branch 'development' into iss060-CVTCosmics
Browse files Browse the repository at this point in the history
  • Loading branch information
zieglerv committed Aug 10, 2023
2 parents a7cef8c + 75a07c5 commit 42c06c1
Show file tree
Hide file tree
Showing 990 changed files with 396 additions and 262 deletions.
67 changes: 51 additions & 16 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,64 @@ on:
# to the last committer of this file!!!!!
- cron: '0 22 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:

build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: 11
distribution: zulu
- name: build
run: ./build-coatjava.sh --spotbugs --unittests --quiet
- name: kpp-test
run: cd validation/advanced-tests && ./run-advanced-tests.sh
- name: eb-ep-test
run: cd validation/advanced-tests && ./run-eb-tests.sh -100 electronproton
- name: eb-eg-test
run: cd validation/advanced-tests && ./run-eb-tests.sh -100 electrongamma
- name: eb-epc-test
run: cd validation/advanced-tests && ./run-eb-tests.sh -100 electronprotonC
- name: eb-enc-test
run: cd validation/advanced-tests && ./run-eb-tests.sh -100 electronneutronC
- name: eb-eftpi-test
run: cd validation/advanced-tests && ./run-eb-tests.sh -100 electronFTpion
- name: tar # tarball to preserve permissions
run: tar czvf coatjava.tar.gz coatjava
- uses: actions/upload-artifact@v3
with:
name: build
retention-days: 1
path: coatjava.tar.gz

test:
needs: [ build ]
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
id:
- kpp
- eb-ep
- eb-eg
- eb-epc
- eb-enc
- eb-eftpi
include:
- { id: kpp, cmd: ./run-advanced-tests.sh }
- { id: eb-ep, cmd: ./run-eb-tests.sh -100 electronproton }
- { id: eb-eg, cmd: ./run-eb-tests.sh -100 electrongamma }
- { id: eb-epc, cmd: ./run-eb-tests.sh -100 electronprotonC }
- { id: eb-enc, cmd: ./run-eb-tests.sh -100 electronneutronC }
- { id: eb-eftpi, cmd: ./run-eb-tests.sh -100 electronFTpion }
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 11
distribution: zulu
- uses: actions/download-artifact@v3
with:
name: build
- name: untar build
run: tar xzvf coatjava.tar.gz
- name: run test
run: |
cd validation/advanced-tests
${{matrix.cmd}}
File renamed without changes.
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 All @@ -33,11 +39,18 @@ public void printDictionary() {
}

public void readDictionary(String fileName, TestMode mode, int wireBinning, int stripBinning, int sectorDependence) {
this.readDictionary(fileName, mode, wireBinning, stripBinning, sectorDependence, -1);
}

public void readDictionary(String fileName, TestMode mode, int wireBinning, int stripBinning, int sectorDependence, int maxRoads) {

System.out.println("\nReading dictionary from file " + fileName);
System.out.println("\nMaximum number of roads set to: " + maxRoads);
int nFull = 0;
int nDupli = 0;

if(maxRoads<0) maxRoads = Integer.MAX_VALUE;

File fileDict = new File(fileName);

try {
Expand All @@ -46,7 +59,7 @@ public void readDictionary(String fileName, TestMode mode, int wireBinning, int
ProgressPrintout progress = new ProgressPrintout();

String line = null;
while ((line = txtreader.readLine()) != null) {
while ((line = txtreader.readLine()) != null && maxRoads>nFull) {

Road road = new Road(line);
road.setBinning(wireBinning, stripBinning, sectorDependence);
Expand All @@ -59,9 +72,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 +110,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 +146,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

0 comments on commit 42c06c1

Please sign in to comment.