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

Commit

Permalink
Added Fit Residual to TB hits banks.
Browse files Browse the repository at this point in the history
Added Field Scale factor to hits timing cuts
  • Loading branch information
zieglerv committed Jun 8, 2018
1 parent e406be8 commit d0feba2
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import cnuphys.snr.clas12.Clas12NoiseResult;
import org.jlab.detector.geant4.v2.DCGeant4Factory;
import org.jlab.rec.dc.Constants;
import org.jlab.rec.dc.trajectory.DCSwimmer;
import org.jlab.utils.groups.IndexedTable;

/**
Expand Down Expand Up @@ -206,11 +207,12 @@ public void fetch_DCHits(DataEvent event, Clas12NoiseAnalysis noiseAnalysis, Noi
if(region ==1 && T0Sub>timeCutMin && T0Sub<timeCutMax)
passTimingCut=true;
if(region ==2) {
double Bscale = DCSwimmer.getTorScale()*DCSwimmer.getTorScale();
if(wire[i]>=56) {
if(T0Sub>timeCutMin && T0Sub<timeCutMax+timeCutLC*(float)(112-wire[i]/56))
if(T0Sub>timeCutMin && T0Sub<timeCutMax+timeCutLC*(double)(112-wire[i]/56)*Bscale)
passTimingCut=true;
} else {
if(T0Sub>timeCutMin && T0Sub<timeCutMax+200+timeCutLC*(float)(56-wire[i]/56))
if(T0Sub>timeCutMin && T0Sub<timeCutMax+200*Bscale+timeCutLC*(double)(56-wire[i]/56)*Bscale)
passTimingCut=true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,9 @@ public DataBank fillTBHitsBank(DataEvent event, List<FittedHit> hitlist) {
if(bank.getDescriptor().hasEntry("time")==true){
bank.setFloat("time", i, (float) hitlist.get(i).get_Time());
}
if(bank.getDescriptor().hasEntry("fitResidual")==true){
bank.setFloat("fitResidual", i, (float) hitlist.get(i).get_TrkResid());
}
bank.setFloat("doca", i, (float) hitlist.get(i).get_Doca());
bank.setFloat("docaError", i, (float) hitlist.get(i).get_DocaErr());
bank.setFloat("trkDoca", i, (float) hitlist.get(i).get_ClusFitDoca());
Expand Down
14 changes: 14 additions & 0 deletions reconstruction/dc/src/main/java/org/jlab/rec/dc/hit/FittedHit.java
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,11 @@ public void updateHitPositionWithTime(double cosTrkAngle, double B, IndexedTable

}

public double XatY(DCGeant4Factory DcDetector, double y) {
double x = this.calc_GeomCorr(DcDetector, y);
return x + this.get_LeftRightAmb() * (this.get_TimeToDistance()) ;
}

private double _WireLength;

public double get_WireLength() {
Expand All @@ -542,6 +547,15 @@ public void set_WireMaxSag(double _WireMaxSag) {
this._WireMaxSag = _WireMaxSag;
}

private double _TrkResid;

public double get_TrkResid() {
return _TrkResid;
}

public void set_TrkResid(double _TrkResid) {
this._TrkResid = _TrkResid;
}

private double calc_GeomCorr(DCGeant4Factory DcDetector, double y) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -701,13 +701,17 @@ public void matchHits(List<StateVec> stateVecAtPlanesList, Track trk, DCGeant4Fa
for(StateVec st : stateVecAtPlanesList) {
if(st==null)
return;
double Xtrk = st.x();
double Ytrk = st.y();
planeIdNum++;
float[] bf = new float[3];
for(Cross c : trk) {
for(FittedHit h1 : c.get_Segment1()) {
if(planeIdNum== (h1.get_Superlayer()-1)*6+h1.get_Layer() ) {
bf[0]=(float) 0.;bf[1]=(float) 0.;bf[2]=(float) 0.;
h1.setAssociatedStateVec(st);
h1.setAssociatedStateVec(st);
double Xhit = h1.XatY(DcDetector, Ytrk);
h1.set_TrkResid(Xhit-Xtrk) ;
dcSwim.Bfield(st.x(), st.y(), h1.get_Z(), bf);
h1.setB(Math.sqrt(bf[0]*bf[0]+bf[1]*bf[1]+bf[2]*bf[2]));
h1.setSignalPropagTimeAlongWire(DcDetector);
Expand All @@ -718,6 +722,8 @@ public void matchHits(List<StateVec> stateVecAtPlanesList, Track trk, DCGeant4Fa
if(planeIdNum== (h2.get_Superlayer()-1)*6+h2.get_Layer() ) {
bf[0]=(float) 0.;bf[1]=(float) 0.;bf[2]=(float) 0.;
h2.setAssociatedStateVec(st);
double Xhit = h2.XatY(DcDetector, Ytrk);
h2.set_TrkResid(Xhit-Xtrk) ;
dcSwim.Bfield(st.x(), st.y(), h2.get_Z(), bf);
h2.setB(Math.sqrt(bf[0]*bf[0]+bf[1]*bf[1]+bf[2]*bf[2]));
h2.setSignalPropagTimeAlongWire(DcDetector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ public void testB() {
// x = 10+100*aRandom.nextDouble();
//y= 10*aRandom.nextDouble();
//z=200+200*aRandom.nextDouble();
x=31; y=0; z=300;
//x=31; y=0; z=300;
// swim.Bfield(x, y, z, result);
System.out.println(result[0]+", "+result[1]+" , "+result[2]+" = ? ");
MagneticFields.getInstance().initializeMagneticFields();
MagneticFields.getInstance().setActiveField(MagneticFields.FieldType.COMPOSITEROTATED);
MagneticFields.getInstance().getActiveField().field((float)x, (float)y, (float)z, result);
System.out.println(result[0]+", "+result[1]+" , "+result[2]+" "+
MagneticFields.getInstance().getActiveField().getName());
//System.out.println(result[0]+", "+result[1]+" , "+result[2]+" = ? ");
//MagneticFields.getInstance().initializeMagneticFields();
//MagneticFields.getInstance().setActiveField(MagneticFields.FieldType.COMPOSITEROTATED);
//MagneticFields.getInstance().getActiveField().field((float)x, (float)y, (float)z, result);
//System.out.println(result[0]+", "+result[1]+" , "+result[2]+" "+
// MagneticFields.getInstance().getActiveField().getName());
//}
}
public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,10 +525,10 @@ public static synchronized void setSolScale(double s) {
public static synchronized void setTorScale(double s) {
TORSCALE = s;
}
public static synchronized double getSolScale() {
public static double getSolScale() {
return SOLSCALE;
}
public static synchronized double getTorScale() {
public static double getTorScale() {
return TORSCALE;
}

Expand Down

0 comments on commit d0feba2

Please sign in to comment.