Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,40 @@ public static DetectorEvent readDetectorEvent(DataEvent event, String particle_b
return detectorEvent;
}

public static void readRichParticles(List<DetectorParticle> particles, DataEvent event, String richbank) {
if (event.hasBank(richbank)) {
DataBank rich = event.getBank(richbank);
int nrows = rich.rows();
for (int row = 0; row<nrows; row++) {
DetectorParticle p = particles.get(rich.getByte("pindex", row));
p.setPid(rich.getShort("best_PID", row));
p.setChi2(rich.getShort("best_c2", row));
p.particleScores[0] = rich.getFloat("el_logl", row);
p.particleScores[1] = rich.getFloat("pi_logl", row);
p.particleScores[2] = rich.getFloat("k_logl", row);
p.particleScores[3] = rich.getFloat("pr_logl", row);
}
}
}

public static DataBank getHypothesesBank(List<DetectorParticle> particles, DataEvent event) {
final int np = particles.size();
int nrows = 0;
for (int i=0; i<np; i++) if (particles.get(i).particleScores[0] > 0) nrows++;
DataBank bank = event.createBank("REC::Hypotheses", nrows);
for (int i=0; i<np; i++) {
for (int j=0; j<4; j++) {
if (particles.get(i).particleScores[j] > 0) {
int row = j + i*4;
bank.setByte("pindex", row, (byte)i);
bank.setInt("pid", row, 11);
bank.setFloat("logl", row, (float)particles.get(i).particleScores[j]);
}
}
}
return bank;
}

/**
* creates a bank with particles information.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public class DetectorParticle implements Comparable {
private int particleScore = 0; // scores are assigned detector hits
private double particleScoreChi2 = 0.0; // chi2 for particle score
private double startTime = -1.0; // per-particle start-time

public double[] particleScores = new double[4];

public double getStartTime() { return this.startTime; }
public void setStartTime(double time) {this.startTime=time; }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.jlab.clas.detector;

import java.util.ArrayList;
import java.util.List;
import org.jlab.detector.base.DetectorType;
import org.jlab.io.base.DataBank;
import org.jlab.io.base.DataEvent;
Expand All @@ -16,10 +15,6 @@ public class RingCherenkovResponse extends DetectorResponse {
private int cluster = 0;
private int xtalk = 0;

//public RingCherenkovResponse(){
// super();
//}

public RingCherenkovResponse(int sector, int layer, int component){
this.getDescriptor().setSectorLayerComponent(sector, layer, component);
}
Expand All @@ -34,13 +29,11 @@ public RingCherenkovResponse(RingCherenkovResponse r){
public void set_cluster(int cluster){ this.cluster = cluster;}
public void set_xtalk(int xtalk){ this.xtalk = xtalk;}

// ----------------
public static ArrayList<DetectorResponse> readHipoEvent(DataEvent event,
String bankName, DetectorType type, int signal_type){
// ----------------

int debugMode = 0;
ArrayList<DetectorResponse> responseList = new ArrayList<DetectorResponse>();
ArrayList<DetectorResponse> responseList = new ArrayList<>();

if(debugMode==1){
if(signal_type==0)System.out.format(" reading bank %s for single hits \n", bankName);
Expand Down Expand Up @@ -72,8 +65,7 @@ public static ArrayList<DetectorResponse> readHipoEvent(DataEvent event,
z = bank.getFloat("z", row);
if(debugMode>=1)System.out.format(" ---> read cluster %4d %4d %8.2f %8.2f ",row,id,energy,time);
}

if(bankName.equals("RICH::Hit")){
else if(bankName.equals("RICH::Hit")){
id = bank.getShort("id", row);
int cluster = bank.getShort("cluster", row);
int xtalk = bank.getShort("xtalk", row);
Expand All @@ -88,7 +80,7 @@ public static ArrayList<DetectorResponse> readHipoEvent(DataEvent event,
if(debugMode>=1)System.out.format(" ---> read hit %4d %4d (%3d %3d %5d --> %3d) %8.2f %8.2f ",
row,id,status,cluster,xtalk,good,energy,time);
}
if(bankName.equals("RICH::Signal")){
else if(bankName.equals("RICH::Signal")){
id = bank.getShort("id", row);
int hindex = bank.getShort("hindex", row);
int size = bank.getShort("size", row);
Expand Down
11 changes: 11 additions & 0 deletions etc/bankdefs/hipo4/event.json
Original file line number Diff line number Diff line change
Expand Up @@ -644,5 +644,16 @@
{"name":"py", "type":"F", "info":"y component of the momentum (GeV)"},
{"name":"pz", "type":"F", "info":"z component of the momentum (GeV)"}
]
},
{
"name": "REC::Hypotheses",
"group": 300,
"item": 50,
"info": "Particle identification bank",
"entries": [
{"name":"pindex","type":"S", "info":"row index in REC::Particle"},
{"name":"pid", "type":"I", "info":"particle id hypothesis in LUND conventions"},
{"name":"logl", "type":"F", "info":"log(Likelihood) for this hypothesis"}
]
}
]
5 changes: 5 additions & 0 deletions reconstruction/eb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@
<artifactId>clas12detector-ltcc</artifactId>
<version>14.1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jlab.clas12.detector</groupId>
<artifactId>clas12detector-rich</artifactId>
<version>14.1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
79 changes: 43 additions & 36 deletions reconstruction/eb/src/main/java/org/jlab/service/eb/EBEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.jlab.rec.eb.EBCCDBEnum;
import org.jlab.rec.eb.EBScalers;
import org.jlab.rec.eb.EBRadioFrequency;
import org.jlab.rec.rich.RICHEBEngine;

/**
*
Expand All @@ -26,6 +27,8 @@ public class EBEngine extends ReconstructionEngine {

boolean usePOCA = false;

RICHEBEngine rich;

// output banks:
String eventBank = null;
String eventBankFT = null;
Expand Down Expand Up @@ -58,10 +61,46 @@ public EBEngine(String name){
initBankNames();
}

public void initBankNames() {
//Initialize bank names
@Override
public boolean init() {

this.registerOutputBank(eventBank);
this.registerOutputBank(particleBank);
this.registerOutputBank(eventBankFT);
this.registerOutputBank(particleBankFT);
this.registerOutputBank(calorimeterBank);
this.registerOutputBank(caloextrasBank);
this.registerOutputBank(scintillatorBank);
this.registerOutputBank(scintextrasBank);
this.registerOutputBank(cherenkovBank);
this.registerOutputBank(trackBank);
this.registerOutputBank(utrackBank);
this.registerOutputBank(ftrackBank);
this.registerOutputBank(crossBank);
this.registerOutputBank(ftBank);
this.registerOutputBank(trajectoryBank);
this.registerOutputBank(covMatrixBank);

if (this.getEngineConfigString("outputBankPrefix")!=null) {
this.setOutputBankPrefix(this.getEngineConfigString("outputBankPrefix"));
}

requireConstants(EBCCDBConstants.getAllTableNames());

this.getConstantsManager().setVariation("default");

if (this.getEngineConfigString("eb-rich") != null) {
rich = new RICHEBEngine();
rich.init();
}
return true;
}

@Override
public void detectorChanged(int run) {}

public void initBankNames() {}

public void setUsePOCA(boolean val) {
this.usePOCA=val;
}
Expand Down Expand Up @@ -249,6 +288,8 @@ public boolean processDataEventUser(DataEvent de,EBScalers ebs) {
}

}

if (rich != null) rich.processDataEvent(de);

return true;
}
Expand Down Expand Up @@ -345,38 +386,4 @@ public void setCvtTrajType(String name) {
this.cvtTrajType = name;
}

@Override
public boolean init() {

this.registerOutputBank(eventBank);
this.registerOutputBank(particleBank);
this.registerOutputBank(eventBankFT);
this.registerOutputBank(particleBankFT);
this.registerOutputBank(calorimeterBank);
this.registerOutputBank(caloextrasBank);
this.registerOutputBank(scintillatorBank);
this.registerOutputBank(scintextrasBank);
this.registerOutputBank(cherenkovBank);
this.registerOutputBank(trackBank);
this.registerOutputBank(utrackBank);
this.registerOutputBank(ftrackBank);
this.registerOutputBank(crossBank);
this.registerOutputBank(ftBank);
this.registerOutputBank(trajectoryBank);
this.registerOutputBank(covMatrixBank);

if (this.getEngineConfigString("outputBankPrefix")!=null) {
this.setOutputBankPrefix(this.getEngineConfigString("outputBankPrefix"));
}

requireConstants(EBCCDBConstants.getAllTableNames());

this.getConstantsManager().setVariation("default");

return true;
}

@Override
public void detectorChanged(int runNumber) {}

}
Loading
Loading