diff --git a/steering-files/src/main/resources/org/hps/steering/analysis/MakeTuples2016.lcsim b/steering-files/src/main/resources/org/hps/steering/analysis/MakeTuples2016.lcsim new file mode 100644 index 0000000000..482b50c9d5 --- /dev/null +++ b/steering-files/src/main/resources/org/hps/steering/analysis/MakeTuples2016.lcsim @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + 1000 + + + + + svt_bias_good svt_burstmode_noise_good svt_event_header_good svt_latency_good + + + SVTRawTrackerHits + + + + all + true + ${outputFile}_tri.txt + true + + + all + true + ${outputFile}_moller.txt + true + + + all + true + ${outputFile}_fee.txt + true + + + \ No newline at end of file diff --git a/users/src/main/java/org/hps/users/holly/RewriteFlagsDriver.java b/users/src/main/java/org/hps/users/holly/RewriteFlagsDriver.java new file mode 100644 index 0000000000..9ecaf788ec --- /dev/null +++ b/users/src/main/java/org/hps/users/holly/RewriteFlagsDriver.java @@ -0,0 +1,136 @@ +package org.hps.users.holly; + + + +import java.util.Date; + +import java.util.List; + + + +import org.hps.conditions.database.DatabaseConditionsManager; + + +import org.hps.conditions.svt.SvtBiasConstant; + +import org.hps.record.triggerbank.AbstractIntData; + +import org.hps.record.triggerbank.HeadBankData; + +import org.lcsim.event.EventHeader; + +import org.lcsim.event.GenericObject; + +import org.lcsim.geometry.Detector; + +import org.lcsim.util.Driver; + + + +public class RewriteFlagsDriver extends Driver { + + @Override + + public void detectorChanged(Detector detector){ + + initialize(); + + } + + + + SvtBiasConstant.SvtBiasConstantCollection svtBiasConstants = null; + + boolean biasGood = false; + + @Override + + public void process(EventHeader event){ + + Date eventDate = getEventTimeStamp(event); + + if (eventDate != null) { + + biasGood = false; + + if (svtBiasConstants != null) { + + SvtBiasConstant biasConstant = svtBiasConstants.find(eventDate); + + if (biasConstant != null) { + + biasGood = true; + + } + + } + + + + + + + + } + + event.getIntegerParameters().put("svt_bias_good", new int[]{biasGood ? 1 : 0}); + + + + + + } + + private Date getEventTimeStamp(EventHeader event) { + + //long timestamp = event.getTimeStamp(); + + + + + + List intDataCollection = event.get(GenericObject.class, "TriggerBank"); + + for (GenericObject data : intDataCollection) { + + if (AbstractIntData.getTag(data) == HeadBankData.BANK_TAG) { + + Date date = HeadBankData.getDate(data); + + if (date != null) { + + //System.out.printf("%d %d\n", date.getTime(),timestamp); + + return date; + + } + + } + + } + + return null; + + // return new Date(timestamp/1000000 + 1457322909477L); + + } + + public void initialize() { + + try { + + svtBiasConstants = DatabaseConditionsManager.getInstance().getCachedConditions(SvtBiasConstant.SvtBiasConstantCollection.class, "svt_bias_constants").getCachedData(); + + } catch (Exception e) { + + svtBiasConstants = null; + + } + + + + + + } + +} \ No newline at end of file