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

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
zieglerv committed Jul 19, 2017
2 parents ee05582 + b2fdd34 commit b8dc520
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,25 +291,25 @@ public void fillHipoEventCND(HipoDataEvent hipoEvent, EvioDataEvent evioEvent){
hipoADC.setByte("layer", index, (byte) evioBank.getInt("layer",i));
hipoADC.setShort("component", index, (short) evioBank.getInt("paddle",i));
hipoADC.setByte("order", index,(byte) 0);
hipoADC.setInt("ADC", index, evioBank.getInt("ADCD", i));
hipoADC.setInt("ADC", index, evioBank.getInt("ADCL", i));

hipoADC.setByte("sector", index+1, (byte) evioBank.getInt("sector",i));
hipoADC.setByte("layer", index+1, (byte) evioBank.getInt("layer",i));
hipoADC.setShort("component", index+1, (short) evioBank.getInt("paddle",i));
hipoADC.setByte("order", index+1,(byte) 1);
hipoADC.setInt("ADC", index+1, evioBank.getInt("ADCN", i));
hipoADC.setInt("ADC", index+1, evioBank.getInt("ADCR", i));

hipoTDC.setByte("sector", index, (byte) evioBank.getInt("sector",i));
hipoTDC.setByte("layer", index, (byte) evioBank.getInt("layer",i));
hipoTDC.setShort("component", index, (short) evioBank.getInt("paddle",i));
hipoTDC.setByte("order", index,(byte) 2);
hipoTDC.setInt("TDC", index, evioBank.getInt("TDCD", i));
hipoTDC.setInt("TDC", index, evioBank.getInt("TDCL", i));

hipoTDC.setByte("sector", index+1, (byte) evioBank.getInt("sector",i));
hipoTDC.setByte("layer", index+1, (byte) evioBank.getInt("layer",i));
hipoTDC.setShort("component", index+1, (short) evioBank.getInt("paddle",i));
hipoTDC.setByte("order", index+1,(byte) 3);
hipoTDC.setInt("TDC", index+1, evioBank.getInt("TDCN", i));
hipoTDC.setInt("TDC", index+1, evioBank.getInt("TDCR", i));

}
hipoEvent.appendBanks(hipoADC,hipoTDC);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ public int getCalorimeterHit(List<CalorimeterResponse> hitList, DetectorType ty
double distanceThreshold){

Line3D trajectory = this.detectorTrack.getLastCross();
System.out.println("find hit in array size = "+ hitList.size());
//System.out.println("find hit in array size = "+ hitList.size());
Point3D hitPoint = new Point3D();
double minimumDistance = 500.0;
int bestIndex = -1;
Expand Down
14 changes: 7 additions & 7 deletions etc/bankdefs/clas12/CND.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
<column name="hitn" num="99" type="int32" info="Hit1 Number"/>
</section>
<section name="dgtz" tag="302" num="0" info="Digitized information">
<column name="sector" type="int32" num="1" info="sector" />
<column name="layer" type="int32" num="2" info="layer" />
<column name="paddle" type="int32" num="3" info="paddle number" />
<column name="ADCD" type="int32" num="4" info="ADC Direct" />
<column name="ADCN" type="int32" num="5" info="ADC Neighbor" />
<column name="TDCD" type="int32" num="6" info="TDC Direct" />
<column name="TDCN" type="int32" num="7" info="TDC Neighbor" />
<column name="sector" type="int32" num="1" info="sector" />
<column name="layer" type="int32" num="2" info="layer" />
<column name="component" type="int32" num="3" info="component number" />
<column name="ADCL" type="int32" num="4" info="ADC Left" />
<column name="ADCR" type="int32" num="5" info="ADC Right" />
<column name="TDCL" type="int32" num="6" info="TDC Left" />
<column name="TDCR" type="int32" num="7" info="TDC Right" />
<column name="hitn" type="int32" num="99" info="hit number" />
</section>
</bank>
Expand Down
7 changes: 7 additions & 0 deletions validation/unit-tests/run-unit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ if [ $? != 0 ] ; then echo "RandomEventGenerator compilation failure" ; exit 1 ;
javac -cp $classPath src/dc/DCReconstructionTest.java
if [ $? != 0 ] ; then echo "DCReconstructionTest compilation failure" ; exit 1 ; fi

javac -cp $classPath src/cvt/CVTReconstructionTest.java
if [ $? != 0 ] ; then echo "CVTReconstructionTest compilation failure" ; exit 1 ; fi

javac -cp $classPath src/ec/ECReconstructionTest.java
if [ $? != 0 ] ; then echo "ECReconstructionTest compilation failure" ; exit 1 ; fi

Expand All @@ -25,6 +28,10 @@ if [ $? != 0 ] ; then echo "ECReconstructionTest compilation failure" ; exit 1 ;
java -DCLAS12DIR="$COAT" -Xmx1536m -Xms1024m -cp $classPath org.junit.runner.JUnitCore dc.DCReconstructionTest
if [ $? != 0 ] ; then echo "dc unit test failure" ; exit 1 ; else echo "dc passed unit tests" ; fi

# run cvt junit tests
java -DCLAS12DIR="$COAT" -Xmx1536m -Xms1024m -cp $classPath org.junit.runner.JUnitCore cvt.CVTReconstructionTest
if [ $? != 0 ] ; then echo "cvt unit test failure" ; exit 1 ; else echo "cvt passed unit tests" ; fi

# run ec junit tests
java -DCLAS12DIR="$COAT" -Xmx1536m -Xms1024m -cp $classPath org.junit.runner.JUnitCore ec.ECReconstructionTest
if [ $? != 0 ] ; then echo "ec unit test failure" ; exit 1 ; else echo "ec passed unit tests" ; fi
Expand Down
53 changes: 53 additions & 0 deletions validation/unit-tests/src/cvt/CVTReconstructionTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package cvt;

import org.junit.Test;
import static org.junit.Assert.*;

import events.TestEvent;

import org.jlab.io.base.DataEvent;
import org.jlab.rec.cvt.services.CVTReconstruction;
import org.jlab.service.eb.EBHBEngine;
import org.jlab.service.eb.EBTBEngine;

/**
*
* @author naharrison
*/
public class CVTReconstructionTest {

@Test
public void testCVTReconstruction() {

DataEvent testEvent = TestEvent.getCVTTestEvent();

CVTReconstruction CVTengine = new CVTReconstruction();
CVTengine.init();
CVTengine.processDataEvent(testEvent);

EBHBEngine EBHBengine = new EBHBEngine();
EBHBengine.init();
EBHBengine.processDataEvent(testEvent);

EBTBEngine EBTBengine = new EBTBEngine();
EBTBengine.init();
EBTBengine.processDataEvent(testEvent);

assertEquals(testEvent.hasBank("REC::Particle"), true);
assertEquals(testEvent.getBank("REC::Particle").rows(), 1);
assertEquals(testEvent.getBank("REC::Particle").getByte("charge", 0), 1);
assertEquals(isWithinXPercent(10.0, testEvent.getBank("REC::Particle").getFloat("px", 0), -0.375), true);
assertEquals(isWithinXPercent(10.0, testEvent.getBank("REC::Particle").getFloat("py", 0), 0.483), true);
assertEquals(isWithinXPercent(10.0, testEvent.getBank("REC::Particle").getFloat("pz", 0), 0.674), true);
assertEquals(isWithinXPercent(30.0, testEvent.getBank("REC::Particle").getFloat("vz", 0), -13.9), true);
}


public static boolean isWithinXPercent(double X, double val, double standard) {
if(standard >= 0 && val > (1.0 - (X/100.0))*standard && val < (1.0 + (X/100.0))*standard) return true;
else if(standard < 0 && val < (1.0 - (X/100.0))*standard && val > (1.0 + (X/100.0))*standard) return true;
return false;
}


}
77 changes: 77 additions & 0 deletions validation/unit-tests/src/events/TestEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,83 @@ public static HipoDataEvent getDCSector1ElectronEvent() {
}


public static HipoDataEvent getCVTTestEvent() {
HipoDataSync writer = new HipoDataSync();
HipoDataEvent testEvent = (HipoDataEvent) writer.createEvent();
DataBank config = testEvent.createBank("RUN::config", 1);
DataBank SVTadc = testEvent.createBank("SVT::adc", 7);

// this event is based on a gemc (4a.1.1 aka 4a.2.0) event with
// torus = -1.0 , solenoid = 1.0
// <option name="BEAM_P" value="proton, 0.91*GeV, 42.2*deg, 127.8*deg"/>
// <option name="SPREAD_P" value="0*GeV, 0*deg, 0*deg"/>
// <option name="BEAM_V" value="(0, 0, -1.39)cm"/>
// <option name="SPREAD_V" value="(0.0, 0.0)cm"/>

config.setInt("run", 0, (int) 11);
config.setInt("event", 0, (int) 1);
config.setInt("trigger", 0, (int) 0);
config.setLong("timestamp", 0, (long) 0);
config.setByte("type", 0, (byte) 0);
config.setByte("mode", 0, (byte) 0);
config.setFloat("torus", 0, (float) -1.0);
config.setFloat("solenoid", 0, (float) 1.0);
config.setFloat("rf", 0, (float) 0.0);
config.setFloat("startTime", 0, (float) 0.0);

for(int i = 0; i < 7; i++) {
SVTadc.setByte("order", i, (byte) 0);
SVTadc.setShort("ped", i, (short) 0);
SVTadc.setLong("timestamp", i, (long) 0);
}

SVTadc.setByte("sector", 0, (byte) 5);
SVTadc.setByte("sector", 1, (byte) 5);
SVTadc.setByte("sector", 2, (byte) 7);
SVTadc.setByte("sector", 3, (byte) 7);
SVTadc.setByte("sector", 4, (byte) 7);
SVTadc.setByte("sector", 5, (byte) 9);
SVTadc.setByte("sector", 6, (byte) 9);

SVTadc.setByte("layer", 0, (byte) 1);
SVTadc.setByte("layer", 1, (byte) 2);
SVTadc.setByte("layer", 2, (byte) 3);
SVTadc.setByte("layer", 3, (byte) 4);
SVTadc.setByte("layer", 4, (byte) 4);
SVTadc.setByte("layer", 5, (byte) 5);
SVTadc.setByte("layer", 6, (byte) 6);

SVTadc.setShort("component", 0, (short) 109);
SVTadc.setShort("component", 1, (short) 77);
SVTadc.setShort("component", 2, (short) 52);
SVTadc.setShort("component", 3, (short) 137);
SVTadc.setShort("component", 4, (short) 138);
SVTadc.setShort("component", 5, (short) 1);
SVTadc.setShort("component", 6, (short) 190);

SVTadc.setInt("ADC", 0, (int) 7);
SVTadc.setInt("ADC", 1, (int) 7);
SVTadc.setInt("ADC", 2, (int) 7);
SVTadc.setInt("ADC", 3, (int) 5);
SVTadc.setInt("ADC", 4, (int) 5);
SVTadc.setInt("ADC", 5, (int) 7);
SVTadc.setInt("ADC", 6, (int) 7);

SVTadc.setFloat("time", 0, (float) 97.0);
SVTadc.setFloat("time", 1, (float) 201.0);
SVTadc.setFloat("time", 2, (float) 78.0);
SVTadc.setFloat("time", 3, (float) 102.0);
SVTadc.setFloat("time", 4, (float) 81.0);
SVTadc.setFloat("time", 5, (float) 91.0);
SVTadc.setFloat("time", 6, (float) 205.0);

testEvent.appendBank(config);
testEvent.appendBank(SVTadc);

return testEvent;
}


public static HipoDataEvent getECSector1PhotonEvent() {
HipoDataSync writer = new HipoDataSync();
HipoDataEvent testEvent = (HipoDataEvent) writer.createEvent();
Expand Down

0 comments on commit b8dc520

Please sign in to comment.