Skip to content

Commit

Permalink
Keeping all hits which do not have signs of corrupted data (bad chan…
Browse files Browse the repository at this point in the history
…nel number or ADC out of range).
  • Loading branch information
ziegler committed Sep 17, 2024
1 parent 5476ff3 commit 79d40c2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ 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, IndexedTable adcStatus) {
Expand All @@ -246,14 +247,14 @@ public void fetch_SVTHits(DataEvent event, int omitLayer, int omitHemisphere,
//This ADC=-1 status is in a ccdb table
boolean pass=true;
int adcStat = adcStatus.getIntValue("adcstatus", 0, 0, 0);
for (int i = 0; i < rows; i++) {
int ADC = bankDGTZ.getInt("ADC", i);
if(ADCConvertor.isEventCorrupted(ADC, adcStat)==false) {
pass=false;
}
}
if(pass==false)
return;
// for (int i = 0; i < rows; i++) {
// int ADC = bankDGTZ.getInt("ADC", i);
// if(ADCConvertor.isEventCorrupted(ADC, adcStat)==false) {
// pass=false;
// }
// }
// if(pass==false)
// return;
//bankDGTZ.show();
// first get tdcs
Map<Integer, Double> tdcs = new HashMap<>();
Expand Down Expand Up @@ -348,6 +349,7 @@ public void fetch_SVTHits(DataEvent event, int omitLayer, int omitHemisphere,
double E = ADCConvertor.SVTADCtoDAQ(ADC, isMC);
if(E==-1)
continue;

Strip SvtStrip = new Strip(strip, E, time);
SvtStrip.setPitch(SVTGeometry.getPitch());
// get the strip line
Expand All @@ -365,9 +367,13 @@ public void fetch_SVTHits(DataEvent event, int omitLayer, int omitHemisphere,
hit.setId(id);
if (Constants.getInstance().flagSeeds)
hit.MCstatus = order;

if(!ADCConvertor.isEventUnCorrupted(ADC, adcStat)) {
hit.isCorrupted=true;
}
// add this hit
if(hit.getRegion()!=Constants.getInstance().getRmReg()) {

if(hit.getRegion()!=Constants.getInstance().getRmReg()
&& !hit.isCorrupted) {
if(Constants.getInstance().useOnlyMCTruthHits() ) {
if(hit.MCstatus==0)
hits.add(hit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public ADCConvertor() {

}

public static boolean isEventCorrupted(int adc, int adcstat) {
public static boolean isEventUnCorrupted(int adc, int adcstat) {
boolean pass = true;
if(adc==-1 && adc*adcstat==0) //0: event corrupted; -1 event is OK
pass=false;
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

0 comments on commit 79d40c2

Please sign in to comment.