Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ target
/docs/javadoc/*
/clara-home
tmp
/common-tools/clas-io/src/main/java/org/jlab/io/banks

# deployment
/myLocalMvnRepo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public FilteredBank(Schema schema, int allocate, String variableName){
filterVar = variableName;
}


/**
* @param schema schema for the bank to filter
* @param variableName name of the variable to filter on
Expand Down Expand Up @@ -99,6 +98,16 @@ public int getByte(String varName, int index ){
return bank.getByte(varName, indexList.get(index));
}

/**
*
* @param column
* @param index
* @return
*/
public int getByte(int column, int index ){
return bank.getByte(column, indexList.get(index));
}

/**
* @param varName name of the bank variable
* @param index filtered index to retrieve
Expand All @@ -108,6 +117,16 @@ public int getShort(String varName, int index ){
return bank.getShort(varName, indexList.get(index));
}

/**
*
* @param column
* @param index
* @return
*/
public int getShort(int column, int index ){
return bank.getShort(column, indexList.get(index));
}

/**
* @param varName name of the bank variable
* @param index filtered index to retrieve
Expand All @@ -116,6 +135,16 @@ public int getShort(String varName, int index ){
public int getInt(String varName, int index ){
return bank.getInt(varName, indexList.get(index));
}

/**
*
* @param column
* @param index
* @return
*/
public int getInt(int column, int index) {
return bank.getInt(column, indexList.get(index));
}

/**
* @param varName name of the bank variable
Expand All @@ -126,6 +155,16 @@ public long getLong(String varName, int index ){
return bank.getLong(varName, indexList.get(index));
}

/**
*
* @param column
* @param index
* @return
*/
public long getLong(int column, int index ){
return bank.getLong(column, indexList.get(index));
}

/**
* @param varName name of the bank variable
* @param index filtered index to retrieve
Expand All @@ -135,6 +174,16 @@ public float getFloat(String varName, int index ){
return bank.getFloat(varName, indexList.get(index));
}

/**
*
* @param column
* @param index
* @return
*/
public float getFloat(int column, int index ){
return bank.getFloat(column, indexList.get(index));
}

/**
* @param index filtered index to retrieve
* @return true bank row index corresponding to the filtered index
Expand Down
16 changes: 16 additions & 0 deletions libexec/bank-schema-enums
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env python3
import os,glob,json
idir = 'etc/bankdefs/hipo4'
odir = 'common-tools/clas-io/src/main/java/org/jlab/io/banks'
os.makedirs(odir, exist_ok=True)
for x in glob.glob(f'{idir}/*.json'):
for bank in json.load(open(x,'r')):
class_name = bank['name'].replace(':','_');
with open(f'{odir}/{class_name}.java','w') as f:
f.write('package org.jlab.io.banks;\n')
f.write(f'public class {class_name} {{\n')
for i,entry in enumerate(bank['entries']):
var_name = entry['name']
f.write(f' public static final short {var_name} = {i};\n')
f.write('}\n')
f.close()
40 changes: 40 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,30 @@

<plugins> <!-- plugins inherited by all child POMs -->

<!-- generate bank shcema enums -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>bank-schema-enums</id>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<inherited>false</inherited> <!-- make this one NOT inherited -->
<configuration>
<target>
<exec executable="python3">
<arg value="libexec/bank-schema-enums"/>
</exec>
</target>
</configuration>
</execution>
</executions>
</plugin>

<!-- static analysis -->
<plugin>
<groupId>com.github.spotbugs</groupId>
Expand Down Expand Up @@ -428,6 +452,22 @@
<pluginManagement>
<plugins> <!-- plugin configurations (unused in child POMs unless declared) -->

<!-- delete auto-generated bank schema enums during clean phase -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.4.0</version>
<configuration>
<filesets>
<fileset>
<directory>common-tools/clas-io/src/main/java/org/jlab/io/banks</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>

<!-- generate minimal POM files for deployment, containing GAV (groupID, artifactId, version) -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jlab.clas.reco.ReconstructionEngine;
import org.jlab.io.banks.HitBasedTrkg__Clusters;
import org.jlab.io.base.DataBank;
import org.jlab.io.base.DataEvent;
import org.jlab.utils.system.ClasUtilsFile;
Expand Down Expand Up @@ -128,11 +129,11 @@ public boolean processDataEvent(DataEvent event) {
int rows = bank.rows();
for (int r = 0; r < rows; r++) {

int id = bank.getInt("id", r);
int sector = bank.getByte("sector", r);
int superlayer = bank.getByte("superlayer", r);
float avgWire = bank.getFloat("avgWire", r);
float fitSlope = bank.getFloat("fitSlope", r);
int id = bank.getInt(HitBasedTrkg__Clusters.id, r);
int sector = bank.getByte(HitBasedTrkg__Clusters.sector, r);
int superlayer = bank.getByte(HitBasedTrkg__Clusters.superlayer, r);
float avgWire = bank.getFloat(HitBasedTrkg__Clusters.avgWire, r);
float fitSlope = bank.getFloat(HitBasedTrkg__Clusters.fitSlope, r);

DCCluster cls = new DCCluster(id, sector, superlayer, avgWire, fitSlope);
allClusterList.add(cls);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import org.jlab.detector.banks.RawDataBank;
import org.jlab.detector.base.DetectorDescriptor;
import org.jlab.detector.base.DetectorType;
import org.jlab.io.banks.BMT__adc;
import org.jlab.io.banks.BST__adc;
import org.jlab.io.base.DataEvent;
import org.jlab.rec.cvt.Constants;
import org.jlab.rec.cvt.Geometry;
Expand Down Expand Up @@ -112,11 +114,11 @@ public void fetch_BMTHits(DataEvent event, Swim swim, IndexedTable status,
//if (bankDGTZ.getInt("ADC", i) < 1) {
//continue; // gemc assigns strip value -1 for inefficiencies, we only consider strips with values between 1 to the maximum strip number for a given detector
//}
int sector = bankDGTZ.getByte("sector", i);
int layer = bankDGTZ.getByte("layer", i);
int strip = bankDGTZ.getShort("component", i);
double ADCtoEdep = bankDGTZ.getInt("ADC", i);
double time = bankDGTZ.getFloat("time", i);
int sector = bankDGTZ.getByte(BMT__adc.sector, i);
int layer = bankDGTZ.getByte(BMT__adc.layer, i);
int strip = bankDGTZ.getShort(BMT__adc.component, i);
double ADCtoEdep = bankDGTZ.getInt(BMT__adc.ADC, i);
double time = bankDGTZ.getFloat(BMT__adc.time, i);
int order = bankDGTZ.trueOrder(i);
//if (order == 1) {
// continue;
Expand Down Expand Up @@ -248,8 +250,8 @@ public void fetch_SVTHits(DataEvent event, int omitLayer, int omitHemisphere,
//The value adcStatus in ccdb is 1 for runs where ADC=-1 is not permitted and 0 for runs where ADC=-1 is permitted

int adcStat = adcStatus.getIntValue("adcstatus", 0, 0, 0);
for (int i = 0; i < rows; i++) {
int ADC = bankDGTZ.getInt("ADC", i);
for (int i = 0; i < rows; i++) {
int ADC = bankDGTZ.getInt(BST__adc.ADC, i);
if(ADCConvertor.isEventUnCorrupted(ADC, adcStat)==false) {
return;
}
Expand All @@ -259,11 +261,11 @@ public void fetch_SVTHits(DataEvent event, int omitLayer, int omitHemisphere,
// first get tdcs
Map<Integer, Double> tdcs = new HashMap<>();
for (int i = 0; i < rows; i++) {
if(bankDGTZ.getInt("ADC", i) < 0) {
int sector = bankDGTZ.getByte("sector", i);
int layer = bankDGTZ.getByte("layer", i);
int strip = bankDGTZ.getShort("component", i);
double time = bankDGTZ.getFloat("time", i);
if(bankDGTZ.getInt(BST__adc.ADC, i) < 0) {
int sector = bankDGTZ.getByte(BST__adc.sector, i);
int layer = bankDGTZ.getByte(BST__adc.layer, i);
int strip = bankDGTZ.getShort(BST__adc.component, i);
double time = bankDGTZ.getFloat(BST__adc.time, i);

//if (order == 1) {
// continue;
Expand All @@ -283,15 +285,15 @@ public void fetch_SVTHits(DataEvent event, int omitLayer, int omitHemisphere,

// then get real hits
for (int i = 0; i < rows; i++) {
if (bankDGTZ.getInt("ADC", i) < 0) {
if (bankDGTZ.getInt(BST__adc.ADC, i) < 0) {
continue; // ignore hits TDC hits with ADC==-1
}
int order = bankDGTZ.getByte("order", i);
int order = bankDGTZ.getByte(BST__adc.order, i);
int sector = bankDGTZ.getByte(BST__adc.sector, i);
int layer = bankDGTZ.getByte(BST__adc.layer, i);
int strip = bankDGTZ.getShort(BST__adc.component, i);
int ADC = bankDGTZ.getInt(BST__adc.ADC, i);
int id = i + 1;
int sector = bankDGTZ.getByte("sector", i);
int layer = bankDGTZ.getByte("layer", i);
int strip = bankDGTZ.getShort("component", i);
int ADC = bankDGTZ.getInt("ADC", i);
double time = 0;//bankDGTZ.getFloat("time", i);
int tdcstrip = 1;
if(strip>128) tdcstrip = 129;
Expand Down
Loading
Loading