Skip to content

Commit 84dcd18

Browse files
zieglervzieglerraffaelladevita
authored
Iss327 svtadc status (#440)
* Reading ADC status for ADC values =-1; handling out-of-range ADCs * Keeping all hits which do not have signs of corrupted data (bad channel number or ADC out of range). * remove MC if statement from method SVTADCtoDAQ. Use of adcstatus clarification. * remove if statement for geantinos that is no longer relevant * Switch the meaning of adcStatus * put back condition to reject the event based on hit corruption status. --------- Co-authored-by: ziegler <[email protected]> Co-authored-by: raffaelladevita <[email protected]>
1 parent 0bd5882 commit 84dcd18

File tree

5 files changed

+53
-17
lines changed

5 files changed

+53
-17
lines changed

reconstruction/cvt/src/main/java/org/jlab/rec/cvt/banks/HitReader.java

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,14 @@ else if(Constants.getInstance().useOnlyBMTC50PercTruthHits && hit.getType()==BMT
222222
* @param omitLayer
223223
* @param omitHemisphere
224224
* @param status
225+
* @param adcStatus
225226
*/
226-
public void fetch_SVTHits(DataEvent event, int omitLayer, int omitHemisphere, IndexedTable status) {
227+
public void fetch_SVTHits(DataEvent event, int omitLayer, int omitHemisphere,
228+
IndexedTable status, IndexedTable adcStatus) {
227229

228230
if (event.hasBank("BST::adc") == false) {
229231
//System.err.println("there is no BST bank ");
230232
_SVTHits = new ArrayList<>();
231-
232233
return;
233234
}
234235

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

241242
if (event.hasBank("BST::adc") == true) {
243+
//pass event
244+
//In RGA Spring 2018 data there should be no BST::adc.ADC=-1 and if found, the event is corrupted.
245+
//In which case all the SVT hits are unreliable and they should all be discarted
246+
//Starting from Fall 2018 all events would have ADC=-1 and this is normal.
247+
//This ADC=-1 status is in a ccdb table
248+
//The value adcStatus in ccdb is 1 for runs where ADC=-1 is not permitted and 0 for runs where ADC=-1 is permitted
249+
250+
int adcStat = adcStatus.getIntValue("adcstatus", 0, 0, 0);
251+
for (int i = 0; i < rows; i++) {
252+
int ADC = bankDGTZ.getInt("ADC", i);
253+
if(ADCConvertor.isEventUnCorrupted(ADC, adcStat)==false) {
254+
return;
255+
}
256+
}
257+
242258
//bankDGTZ.show();
243259
// first get tdcs
244260
Map<Integer, Double> tdcs = new HashMap<>();
@@ -328,24 +344,29 @@ public void fetch_SVTHits(DataEvent event, int omitLayer, int omitHemisphere, In
328344
//if(adcConv.SVTADCtoDAQ(ADC[i], event)<50)
329345
// continue;
330346
// create the strip object with the adc value converted to daq value used for cluster-centroid estimate
331-
Strip SvtStrip = new Strip(strip, ADCConvertor.SVTADCtoDAQ(ADC), time);
347+
348+
//boolean isMC = event.hasBank("MC::Particle");
349+
double E = ADCConvertor.SVTADCtoDAQ(ADC);
350+
if(E==-1)
351+
continue;
352+
353+
Strip SvtStrip = new Strip(strip, E, time);
332354
SvtStrip.setPitch(SVTGeometry.getPitch());
333355
// get the strip line
334356
SvtStrip.setLine(Geometry.getInstance().getSVT().getStrip(layer, sector, strip));
335357
SvtStrip.setModule(Geometry.getInstance().getSVT().getModule(layer, sector));
336358
SvtStrip.setNormal(Geometry.getInstance().getSVT().getNormal(layer, sector));
337359
// if the hit is useable in the analysis its status is =0
338-
if (SvtStrip.getEdep() == 0) {
339-
SvtStrip.setStatus(1);
340-
}
360+
//if (SvtStrip.getEdep() == 0) {
361+
// SvtStrip.setStatus(1);
362+
//}
341363
//get status from ccdb
342364
SvtStrip.setStatus(status.getIntValue("status", sector, layer, strip));
343365
// create the hit object
344366
Hit hit = new Hit(DetectorType.BST, BMTType.UNDEFINED, sector, layer, SvtStrip);
345367
hit.setId(id);
346368
if (Constants.getInstance().flagSeeds)
347369
hit.MCstatus = order;
348-
349370
// add this hit
350371
if(hit.getRegion()!=Constants.getInstance().getRmReg()) {
351372
if(Constants.getInstance().useOnlyMCTruthHits() ) {

reconstruction/cvt/src/main/java/org/jlab/rec/cvt/hit/ADCConvertor.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,30 @@ public ADCConvertor() {
1111

1212
}
1313

14-
/**
14+
public static boolean isEventUnCorrupted(int adc, int adcstat) {
15+
//The value adcStatus is 0 for runs where adc=-1 is permitted and 1 for runs where adc=-1 is NOT permitted
16+
//
17+
boolean pass = true;
18+
if(adc==-1) {
19+
if(adcstat==1) //1: event corrupted; 0 event is OK
20+
pass=false;
21+
if(adcstat==0)
22+
pass=true;
23+
}
24+
return pass;
25+
}
26+
/**
1527
*
1628
* @param adc ADC value Converts ADC values to DAQ units -- used for BST
1729
* test stand analysis
1830
* @return
1931
*/
2032
public static double SVTADCtoDAQ(int adc) {
21-
if (adc == -5) {
22-
return 1; // this is for running with Geantinos. Geantinos have adc -5
23-
}
33+
2434
if (adc < 0 || adc > 7) {
25-
return 0;
35+
return -1;
2636
}
27-
37+
2838
int START[] = new int[8];
2939
int END[] = new int[8];
3040
for (int i = 0; i < 8; i++) {

reconstruction/cvt/src/main/java/org/jlab/rec/cvt/hit/Hit.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class Hit implements Comparable<Hit> {
3333

3434
public boolean newClustering = false;
3535
public int MCstatus = -1;
36+
public boolean isCorrupted;
3637

3738
// constructor
3839
public Hit(DetectorType detector, BMTType type, int sector, int layer, Strip strip) {

reconstruction/cvt/src/main/java/org/jlab/rec/cvt/services/CVTEngine.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,13 +289,15 @@ public boolean processDataEvent(DataEvent event) {
289289
IndexedTable bmtStripVoltage = this.getConstantsManager().getConstants(run, "/calibration/mvt/bmt_strip_voltage");
290290
IndexedTable bmtStripThreshold = this.getConstantsManager().getConstants(run, "/calibration/mvt/bmt_strip_voltage_thresholds");
291291
IndexedTable beamPos = this.getConstantsManager().getConstants(run, "/geometry/beam/position");
292+
IndexedTable adcStatus = this.getConstantsManager().getConstants(run, "/calibration/svt/adcstatus");
292293

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

295296
CVTReconstruction reco = new CVTReconstruction(swimmer);
296297

297298
List<ArrayList<Hit>> hits = reco.readHits(event, svtStatus, bmtStatus, bmtTime,
298-
bmtStripVoltage, bmtStripThreshold);
299+
bmtStripVoltage, bmtStripThreshold,
300+
adcStatus);
299301
List<ArrayList<Cluster>> clusters = reco.findClusters();
300302
List<ArrayList<Cross>> crosses = reco.findCrosses();
301303

@@ -466,7 +468,8 @@ public void initConstantsTables() {
466468
"/calibration/mvt/bmt_voltage",
467469
"/calibration/mvt/bmt_strip_voltage",
468470
"/calibration/mvt/bmt_strip_voltage_thresholds",
469-
"/geometry/beam/position"
471+
"/geometry/beam/position",
472+
"/calibration/svt/adcstatus"
470473
};
471474
requireConstants(Arrays.asList(tables));
472475
this.getConstantsManager().setVariation("default");

reconstruction/cvt/src/main/java/org/jlab/rec/cvt/services/CVTReconstruction.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ public CVTReconstruction(Swim swimmer) {
4040

4141
public List<ArrayList<Hit>> readHits(DataEvent event, IndexedTable svtStatus,
4242
IndexedTable bmtStatus, IndexedTable bmtTime,
43-
IndexedTable bmtStripVoltage, IndexedTable bmtStripVoltageThresh) {
43+
IndexedTable bmtStripVoltage, IndexedTable bmtStripVoltageThresh,
44+
IndexedTable adcStatus) {
4445

4546
HitReader hitRead = new HitReader();
46-
hitRead.fetch_SVTHits(event, -1, -1, svtStatus);
47+
hitRead.fetch_SVTHits(event, -1, -1, svtStatus, adcStatus);
4748
if(Constants.getInstance().svtOnly==false)
4849
hitRead.fetch_BMTHits(event, swimmer, bmtStatus, bmtTime,
4950
bmtStripVoltage, bmtStripVoltageThresh);

0 commit comments

Comments
 (0)