Skip to content
This repository has been archived by the owner on May 18, 2023. It is now read-only.

Commit

Permalink
Merge pull request #34 from JeffersonLab/eb-dev
Browse files Browse the repository at this point in the history
merge eb-dev into master
  • Loading branch information
baltzell authored Sep 1, 2017
2 parents 44a6641 + 165de86 commit 20e7588
Show file tree
Hide file tree
Showing 35 changed files with 1,771 additions and 879 deletions.
19 changes: 18 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# installed:
/coatjava
/myLocalMvnRepo
target

*.class
*lundfiles*.dat

Expand All @@ -10,4 +15,16 @@
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
hs_err_pid*

# editor tmp files:
*.swp
*~

# ide stuff:
*.iml
.idea

# no log files:
*.log

2 changes: 1 addition & 1 deletion build-coatjava.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

mkdir -p coatjava
rm -f coatjava/lib/clas/jcsg-0.3.2.jar
mkdir coatjava
cp -r bin coatjava/
cp -r etc coatjava/
mkdir -p coatjava/lib/clas
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.jlab.detector.base;

/**
Expand Down Expand Up @@ -36,6 +31,11 @@ public enum DetectorType {
SC (114, "SC"),
CC (115, "CC"),
SVT (220, "SVT");

// FIXME add layer conventions here, e.g.:
// (or maybe they are defined somewhere else?)
// FTOF2/1A/1B = 0/1/2
// PCAL/Inner/Outer = 1/4/7

private final int detectorId;
private final String detectorName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static double massNeutron(){
}

public static double massElectron(){
return 0.0005;
return 0.000511;
}

public static double massPionCharged(){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.jlab.clas.detector;

import java.util.ArrayList;
Expand All @@ -17,19 +12,17 @@
* @author jnewton
*/
public class CalorimeterResponse extends DetectorResponse {



public CalorimeterResponse(){
super();
}

public CalorimeterResponse(int sector, int layer, int component){
this.getDescriptor().setSectorLayerComponent(sector, layer, component);
}



public static List<DetectorResponse> readHipoEvent(DataEvent event,
String bankName, DetectorType type){
String bankName, DetectorType type){
List<DetectorResponse> responseList = new ArrayList<DetectorResponse>();
if(event.hasBank(bankName)==true){
DataBank bank = event.getBank(bankName);
Expand All @@ -49,10 +42,8 @@ public static List<DetectorResponse> readHipoEvent(DataEvent event,
responseList.add(response);
}
}

return responseList;
}


}

Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.jlab.clas.detector;

import java.util.ArrayList;
Expand All @@ -22,50 +17,49 @@
* @author gavalian
*/
public class CherenkovResponse {
private double hitTime = 0.0;
private double hitTheta = 0.0;
private double hitPhi = 0.0;
private int hitNphe = 0;
private double hitDeltaPhi = 0.0;

private double hitTime = 0.0;
private double hitTheta = 0.0;
private double hitPhi = 0.0;
private double hitNphe = 0;
private double hitDeltaPhi = 0.0;
private double hitDeltaTheta = 0.0;
private int association = -1;
private int hitIndex = -1;
private int hitIndex = -1;
private int association = -1;

private DetectorType cherenkovType = DetectorType.HTCC;
private Point3D hitPosition = new Point3D();
//private Sphere3D
private DetectorDescriptor desc = new DetectorDescriptor();

public CherenkovResponse(double theta, double phi, double dtheta, double dphi){
hitTheta = theta;
hitPhi = phi;
hitDeltaTheta = dtheta;
hitDeltaPhi = dphi;
}

public CherenkovResponse setTime(double time) { hitTime = time; return this;}
public CherenkovResponse setEnergy(int energy) { hitNphe = energy; return this;}
public CherenkovResponse setEnergy(double energy) { hitNphe = energy; return this;}
public void setAssociation(int assoc) {this.association = assoc;}
public void setHitIndex(int index){this.hitIndex = index;}

public double getTime(){ return hitTime;}
public int getHitIndex(){return hitIndex;}
public int getEnergy(){ return hitNphe;}
public double getEnergy(){ return hitNphe;}
public double getTheta() {return this.hitTheta;}
public double getPhi() {return this.hitPhi;}
public double getDeltaTheta(){ return this.hitDeltaTheta;}
public double getDeltaPhi() {return this.hitDeltaPhi;}
public int getAssociation() {return this.association;}

public Point3D getHitPosition(){
return this.hitPosition;
}

public void setHitPosition(double x, double y, double z){
this.hitPosition.set(x, y, z);
}

public Point3D getIntersection(Line3D line){
Vector3D vec = new Vector3D(this.hitPosition.x(),this.hitPosition.y(),this.hitPosition.z());
vec.unit();
Expand All @@ -74,23 +68,15 @@ public Point3D getIntersection(Line3D line){
plane.intersection(line, intersect);
return intersect;
}

public boolean match(Line3D particletrack){
Point3D intersection = this.getIntersection(particletrack);
Vector3D vecRec = intersection.toVector3D();
Vector3D vecHit = this.hitPosition.toVector3D();
//System.out.println(particletrack);
//System.out.println(this.hitPosition);
// System.out.println("Calculated Theta Difference (Degrees)" + Math.abs(vecHit.theta()-vecRec.theta())*57.2958);
// System.out.println("Expected Theta Difference (Degrees)" + this.hitDeltaTheta*57.2958);
// System.out.println(" ");
// System.out.println("Calculated Phi Difference (Degrees)" + Math.abs(vecHit.phi()-vecRec.phi())*57.2958);
// System.out.println("Expected Phi Difference (Degrees)" + this.hitDeltaPhi*57.2958);
// System.out.println(" ");

//System.out.println(Math.abs(vecHit.theta()-vecRec.theta())*57.2958 + " " +
// Math.abs(vecHit.phi()-vecRec.phi())*57.2958);

// FIXME:
// 1. remove hardcoded constant (10 degrees)
// 2. either use both dphi and dtheta from detector bank (only
// exists for HTCC), or get both from CCDB
return (Math.abs(vecHit.theta()-vecRec.theta())<10.0/57.2958
&& Math.abs(vecHit.phi()-vecRec.phi())<this.hitDeltaPhi);
}
Expand All @@ -107,31 +93,58 @@ public DetectorType getCherenkovType(){
public void setCherenkovType(DetectorType htcc){
this.cherenkovType = htcc;
}

public static List<CherenkovResponse> readHipoEvent(DataEvent event,
String bankName, DetectorType type){
String bankName, DetectorType type){
List<CherenkovResponse> responseList = new ArrayList<CherenkovResponse>();
if(event.hasBank(bankName)==true){
DataBank bank = event.getBank(bankName);
int nrows = bank.rows();
for(int row = 0; row < nrows; row++){
int nphe = bank.getInt("nphe", row);
double theta = bank.getFloat("theta", row);
double dtheta = bank.getFloat("dtheta",row);
double phi = bank.getFloat("phi",row);
double dphi = bank.getFloat("dphi",row);

double x = bank.getFloat("x",row);
double y = bank.getFloat("y",row);
double z = bank.getFloat("z",row);
double time = bank.getFloat("time",row);
CherenkovResponse che = new CherenkovResponse(theta,phi,dtheta,dphi);
che.setHitPosition(x, y, z);
//System.out.println(che.getHitPosition());
//System.out.println("hello there is cherenkov");
che.setHitIndex(row);
che.setEnergy(nphe);
che.setTime(time);
che.setCherenkovType(DetectorType.HTCC);

// FIXME: unify LTCC/HTCC detector banks
// Here we have to treat them differently:
// 1. nphe really shouldn't be an integer
// 2. either add dtheta/dphi to LTCC, or ignore HTCC's and use CCDB for both
// 3. HTCC provides both x/y/z and theta/phi, while LTCC provides only x/y/z.
// The current convention in EB is to use only x/y/z, while theta/phi is
// just propogated.

double nphe,theta=0,phi=0,dtheta=0,dphi=0;

if (type==DetectorType.HTCC) {
nphe = (double)bank.getInt("nphe", row);
dtheta = bank.getFloat("dtheta",row);
dphi = bank.getFloat("dphi",row);
theta = bank.getFloat("theta", row);
phi = bank.getFloat("phi",row);
}

else if (type==DetectorType.LTCC) {
nphe = bank.getFloat("nphe", row);
// Hardcode some dtheta/dphi values for now (for matching):
dtheta = 10*3.14159/180;
dphi = 10*3.14159/180;
// Fill theta/phi:
// Not yet.
}

else {
throw new RuntimeException(
"CherenkovResponse::readHipoEvent: invalid DetectorType: "+type);
}

CherenkovResponse che = new CherenkovResponse(theta,phi,dtheta,dphi);
che.setHitPosition(x, y, z);
che.setHitIndex(row);
che.setEnergy(nphe);
che.setTime(time);
che.setCherenkovType(type);

responseList.add(che);
}
Expand Down
Loading

0 comments on commit 20e7588

Please sign in to comment.