Skip to content
Merged
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 @@ -222,13 +222,14 @@ else if(Constants.getInstance().useOnlyBMTC50PercTruthHits && hit.getType()==BMT
* @param omitLayer
* @param omitHemisphere
* @param status
* @param adcStatus
*/
public void fetch_SVTHits(DataEvent event, int omitLayer, int omitHemisphere, IndexedTable status) {
public void fetch_SVTHits(DataEvent event, int omitLayer, int omitHemisphere,
IndexedTable status, IndexedTable adcStatus) {

if (event.hasBank("BST::adc") == false) {
//System.err.println("there is no BST bank ");
_SVTHits = new ArrayList<>();

return;
}

Expand All @@ -239,6 +240,21 @@ public void fetch_SVTHits(DataEvent event, int omitLayer, int omitHemisphere, In
int rows = bankDGTZ.rows();

if (event.hasBank("BST::adc") == true) {
//pass event
//In RGA Spring 2018 data there should be no BST::adc.ADC=-1 and if found, the event is corrupted.
//In which case all the SVT hits are unreliable and they should all be discarted
//Starting from Fall 2018 all events would have ADC=-1 and this is normal.
//This ADC=-1 status is in a ccdb table
//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);
if(ADCConvertor.isEventUnCorrupted(ADC, adcStat)==false) {
return;
}
}

//bankDGTZ.show();
// first get tdcs
Map<Integer, Double> tdcs = new HashMap<>();
Expand Down Expand Up @@ -328,24 +344,29 @@ public void fetch_SVTHits(DataEvent event, int omitLayer, int omitHemisphere, In
//if(adcConv.SVTADCtoDAQ(ADC[i], event)<50)
// continue;
// create the strip object with the adc value converted to daq value used for cluster-centroid estimate
Strip SvtStrip = new Strip(strip, ADCConvertor.SVTADCtoDAQ(ADC), time);

//boolean isMC = event.hasBank("MC::Particle");
double E = ADCConvertor.SVTADCtoDAQ(ADC);
if(E==-1)
continue;

Strip SvtStrip = new Strip(strip, E, time);
SvtStrip.setPitch(SVTGeometry.getPitch());
// get the strip line
SvtStrip.setLine(Geometry.getInstance().getSVT().getStrip(layer, sector, strip));
SvtStrip.setModule(Geometry.getInstance().getSVT().getModule(layer, sector));
SvtStrip.setNormal(Geometry.getInstance().getSVT().getNormal(layer, sector));
// if the hit is useable in the analysis its status is =0
if (SvtStrip.getEdep() == 0) {
SvtStrip.setStatus(1);
}
//if (SvtStrip.getEdep() == 0) {
// SvtStrip.setStatus(1);
//}
//get status from ccdb
SvtStrip.setStatus(status.getIntValue("status", sector, layer, strip));
// create the hit object
Hit hit = new Hit(DetectorType.BST, BMTType.UNDEFINED, sector, layer, SvtStrip);
hit.setId(id);
if (Constants.getInstance().flagSeeds)
hit.MCstatus = order;

// add this hit
if(hit.getRegion()!=Constants.getInstance().getRmReg()) {
if(Constants.getInstance().useOnlyMCTruthHits() ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,30 @@ public ADCConvertor() {

}

/**
public static boolean isEventUnCorrupted(int adc, int adcstat) {
//The value adcStatus is 0 for runs where adc=-1 is permitted and 1 for runs where adc=-1 is NOT permitted
//
boolean pass = true;
if(adc==-1) {
if(adcstat==1) //1: event corrupted; 0 event is OK
pass=false;
if(adcstat==0)
pass=true;
}
return pass;
}
/**
*
* @param adc ADC value Converts ADC values to DAQ units -- used for BST
* test stand analysis
* @return
*/
public static double SVTADCtoDAQ(int adc) {
if (adc == -5) {
return 1; // this is for running with Geantinos. Geantinos have adc -5
}

if (adc < 0 || adc > 7) {
return 0;
return -1;
}

int START[] = new int[8];
int END[] = new int[8];
for (int i = 0; i < 8; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class Hit implements Comparable<Hit> {

public boolean newClustering = false;
public int MCstatus = -1;
public boolean isCorrupted;

// constructor
public Hit(DetectorType detector, BMTType type, int sector, int layer, Strip strip) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,15 @@ public boolean processDataEvent(DataEvent event) {
IndexedTable bmtStripVoltage = this.getConstantsManager().getConstants(run, "/calibration/mvt/bmt_strip_voltage");
IndexedTable bmtStripThreshold = this.getConstantsManager().getConstants(run, "/calibration/mvt/bmt_strip_voltage_thresholds");
IndexedTable beamPos = this.getConstantsManager().getConstants(run, "/geometry/beam/position");
IndexedTable adcStatus = this.getConstantsManager().getConstants(run, "/calibration/svt/adcstatus");

Geometry.getInstance().initialize(this.getConstantsManager().getVariation(), run, svtLorentz, bmtVoltage);

CVTReconstruction reco = new CVTReconstruction(swimmer);

List<ArrayList<Hit>> hits = reco.readHits(event, svtStatus, bmtStatus, bmtTime,
bmtStripVoltage, bmtStripThreshold);
bmtStripVoltage, bmtStripThreshold,
adcStatus);
List<ArrayList<Cluster>> clusters = reco.findClusters();
List<ArrayList<Cross>> crosses = reco.findCrosses();

Expand Down Expand Up @@ -466,7 +468,8 @@ public void initConstantsTables() {
"/calibration/mvt/bmt_voltage",
"/calibration/mvt/bmt_strip_voltage",
"/calibration/mvt/bmt_strip_voltage_thresholds",
"/geometry/beam/position"
"/geometry/beam/position",
"/calibration/svt/adcstatus"
};
requireConstants(Arrays.asList(tables));
this.getConstantsManager().setVariation("default");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ public CVTReconstruction(Swim swimmer) {

public List<ArrayList<Hit>> readHits(DataEvent event, IndexedTable svtStatus,
IndexedTable bmtStatus, IndexedTable bmtTime,
IndexedTable bmtStripVoltage, IndexedTable bmtStripVoltageThresh) {
IndexedTable bmtStripVoltage, IndexedTable bmtStripVoltageThresh,
IndexedTable adcStatus) {

HitReader hitRead = new HitReader();
hitRead.fetch_SVTHits(event, -1, -1, svtStatus);
hitRead.fetch_SVTHits(event, -1, -1, svtStatus, adcStatus);
if(Constants.getInstance().svtOnly==false)
hitRead.fetch_BMTHits(event, swimmer, bmtStatus, bmtTime,
bmtStripVoltage, bmtStripVoltageThresh);
Expand Down