Author: [log in to unmask] Date: Thu Oct 30 10:44:14 2014 New Revision: 1346 Log: Commit local changes to the Ecal commissioning branch Modified: java/branches/hps-java_ecal-commissioning/conditions/src/test/java/org/hps/conditions/ecal/EcalDaqTest.java java/branches/hps-java_ecal-commissioning/evio/src/main/java/org/hps/evio/ECalEvioReader.java java/branches/hps-java_ecal-commissioning/evio/src/main/java/org/hps/evio/EventConstants.java java/branches/hps-java_ecal-commissioning/evio/src/main/java/org/hps/evio/LCSimTestRunEventBuilder.java java/branches/hps-java_ecal-commissioning/evio/src/main/java/org/hps/evio/TriggerData.java Modified: java/branches/hps-java_ecal-commissioning/conditions/src/test/java/org/hps/conditions/ecal/EcalDaqTest.java ============================================================================= --- java/branches/hps-java_ecal-commissioning/conditions/src/test/java/org/hps/conditions/ecal/EcalDaqTest.java (original) +++ java/branches/hps-java_ecal-commissioning/conditions/src/test/java/org/hps/conditions/ecal/EcalDaqTest.java Thu Oct 30 10:44:14 2014 @@ -10,10 +10,10 @@ public class EcalDaqTest extends TestCase { public void setUp() { - new DevReadOnlyConfiguration().setup().load("HPS-TestRun-v8", 0); + new DevReadOnlyConfiguration().setup().load("HPS-ECalCommissioning", 0); } - public void testEcalLed() { + public void testEcalDAQ() { DatabaseConditionsManager manager = DatabaseConditionsManager.getInstance(); EcalChannelCollection collection = manager.getConditionsData(EcalChannelCollection.class, TableConstants.ECAL_CHANNELS); System.out.println("CH ID \t X \t Y \t crate \t slot \t number \t "); Modified: java/branches/hps-java_ecal-commissioning/evio/src/main/java/org/hps/evio/ECalEvioReader.java ============================================================================= --- java/branches/hps-java_ecal-commissioning/evio/src/main/java/org/hps/evio/ECalEvioReader.java (original) +++ java/branches/hps-java_ecal-commissioning/evio/src/main/java/org/hps/evio/ECalEvioReader.java Thu Oct 30 10:44:14 2014 @@ -54,6 +54,8 @@ for (BaseStructure slotBank : bank.getChildren()) { tag=slotBank.getHeader().getTag(); + /*A. Celentano: this is here just for pure debugging, + * since the trigger is already dealt with in the main event builder*/ if (tag == EventConstants.TRIGGER_BANK_TAG) { if (debug) { int[] data = slotBank.getIntData(); @@ -94,7 +96,7 @@ } } else{ - continue; //A.C. the TI case, for example, goes here. + continue; //A.C. the TI case, for example, goes here. It is critical to have it here. } } } catch (EvioException e) { @@ -250,7 +252,7 @@ if (id == null) { System.out.printf("Crate %d, slot %d, channel %d not found in map\n", crate, slot, channel); } - else if ((slot==20)&&(channel>=13)) continue; + else if ((slot==20)&&(channel>=13)) continue; //A.C. temporary work around. Has to be here since we need to read the full EVIO composite. else { hits.add(new BaseRawCalorimeterHit(id, pulseIntegral, pulseTime)); } Modified: java/branches/hps-java_ecal-commissioning/evio/src/main/java/org/hps/evio/EventConstants.java ============================================================================= --- java/branches/hps-java_ecal-commissioning/evio/src/main/java/org/hps/evio/EventConstants.java (original) +++ java/branches/hps-java_ecal-commissioning/evio/src/main/java/org/hps/evio/EventConstants.java Thu Oct 30 10:44:14 2014 @@ -15,9 +15,9 @@ public static final int EVENTID_BANK_TAG = 0xC000; public static final int EVENT_BANK_NUM = 0xCC; // These correspond to ROC (readout crate) IDs from the DAQ. - public static final int ECAL_TOP_BANK_TAG = 0x25; - public static final int ECAL_BOTTOM_BANK_TAG = 0x27; - public static final int SVT_BANK_TAG = 0x3; + public static final int ECAL_TOP_BANK_TAG = 0x25; //A.C modified + public static final int ECAL_BOTTOM_BANK_TAG = 0x27; //A.C modified + public static final int SVT_BANK_TAG = 0x3; //A.C ???? // These values are put into the number field of the banks. // FIXME Bank numbers should actually be sequentially numbered and not hard-coded. public static final int SVT_BANK_NUMBER = 1; @@ -39,7 +39,7 @@ // The tag for ECal pulse integral data. public static final int ECAL_PULSE_INTEGRAL_BANK_TAG = 0xe103; // The tag for trigger data. - public static final int TRIGGER_BANK_TAG = 0xe106; + public static final int TRIGGER_BANK_TAG = 0xe10C; //A.C modified public static final int SVT_TOTAL_NUMBER_FPGAS = 8; public static final int MC_TIME = 2019686400; //Unix time (in seconds) used for Monte Carlo data - 1/1/2034 Modified: java/branches/hps-java_ecal-commissioning/evio/src/main/java/org/hps/evio/LCSimTestRunEventBuilder.java ============================================================================= --- java/branches/hps-java_ecal-commissioning/evio/src/main/java/org/hps/evio/LCSimTestRunEventBuilder.java (original) +++ java/branches/hps-java_ecal-commissioning/evio/src/main/java/org/hps/evio/LCSimTestRunEventBuilder.java Thu Oct 30 10:44:14 2014 @@ -7,7 +7,7 @@ import java.util.logging.Logger; import org.hps.conditions.deprecated.EcalConditions; -import org.hps.readout.ecal.TriggerData; +import org.hps.evio.TriggerData; import org.jlab.coda.jevio.BaseStructure; import org.jlab.coda.jevio.EvioEvent; import org.lcsim.event.EventHeader; Modified: java/branches/hps-java_ecal-commissioning/evio/src/main/java/org/hps/evio/TriggerData.java ============================================================================= --- java/branches/hps-java_ecal-commissioning/evio/src/main/java/org/hps/evio/TriggerData.java (original) +++ java/branches/hps-java_ecal-commissioning/evio/src/main/java/org/hps/evio/TriggerData.java Thu Oct 30 10:44:14 2014 @@ -1,6 +1,9 @@ package org.hps.evio; import org.lcsim.event.GenericObject; + +import java.util.ArrayList; +import java.util.List; /** * @@ -16,63 +19,147 @@ public static final int AND_TRIG = 6; public static final int TIME = 7; public static final int TRIG_BANK_SIZE = 8; + + //Here goes the 5-bit identifiers for the word type + public static final int TRIG_HEADER = 0x12; + public static final int TRIG_TIME = 0x13; + public static final int TRIG_TYPE = 0x15; + public static final int CLUSTER_TYPE = 0x14; + public static final String TRIG_COLLECTION = "TriggerBank"; private int[] bank; + private long trigTime; + private int eventNum; + + private int trigType; + private int trigTypeData; + private int trigTypeTime; + + private int nCluster,nClusterTop,nClusterBottom; + + private List<Integer> clusterX,clusterY,clusterE,clusterT,clusterNhits; + public TriggerData(int[] bank) { + + + + clusterX=new ArrayList<Integer>(); + clusterY=new ArrayList<Integer>(); + clusterE=new ArrayList<Integer>(); + clusterT=new ArrayList<Integer>(); + clusterNhits=new ArrayList<Integer>(); + + trigTime=0; + trigType=-1; + trigTypeData=0; + + nCluster=nClusterTop=nClusterBottom=0; + this.bank = bank; + this.decodeTriggerBank(); + } + + private void decodeTriggerBank(){ + /*A. Celentano: decode here the trigger bank*/ + /*We do not need to handle block header, block trayler since these are disentagled in the secondary CODA readout list*/ + int this_word; + int this_clusterX,this_clusterY,this_clusterE,this_clusterT,this_clusterNhits; + + + + for (int ii=0;ii<bank.length;ii++){ + this_word=bank[ii]; + + //event header + if (((this_word>>27)&(0x1f))==TRIG_HEADER){ + eventNum=this_word&0x7FFFFFF; + } + //trigger time + else if (((this_word>>27)&(0x1f))==TRIG_TIME){ + trigTime=(bank[ii+1]<<24)|(this_word&0xffffff); + } + //trigger type + else if (((this_word>>27)&(0x1f))==TRIG_TYPE){ + trigType=(this_word>>23)&0xf; //this is the trigbit, from 0 to 7 + trigTypeData=(this_word>>16)&0x7f; + trigTypeTime=(this_word>>16)&0x3ff; + } + //cluster + else if (((this_word>>27)&(0x1f))==CLUSTER_TYPE){ + this_clusterNhits=(this_word>>23)&0xf; + clusterNhits.add(this_clusterNhits); + + this_clusterE=(this_word>>10)&0x1fff; + clusterE.add(this_clusterE); + + this_clusterY=(this_word>>6)&0xf; + clusterY.add(this_clusterY); + if (this_clusterY>0) nClusterTop++; + else if (this_clusterY<0) nClusterBottom++; + + this_clusterX=(this_word)&0x3f; + clusterX.add(this_clusterX); + + this_clusterT=(bank[ii+1])&0x3ff; + clusterT.add(this_clusterT); + + nCluster++; + } - } - - public int getTime() { - return getIntVal(TIME); - } + } + } + + public long getTime() { + return trigTime; + } public int getOrTrig() { - return getIntVal(OR_TRIG); + return 0; } public int getTopTrig() { - return getIntVal(TOP_TRIG); + return 0; } public int getBotTrig() { - return getIntVal(BOT_TRIG); + return 0; } public int getAndTrig() { - return getIntVal(AND_TRIG); + return 0; } public int[] getBank() { return bank; } - public static int getTime(GenericObject object) { - return object.getIntVal(TIME); + public static long getTime(GenericObject object) { + return ((TriggerData)object).getTime(); } public static int getOrTrig(GenericObject object) { - return object.getIntVal(OR_TRIG); + return ((TriggerData)object).getOrTrig(); } public static int getTopTrig(GenericObject object) { - return object.getIntVal(TOP_TRIG); + return ((TriggerData)object).getTopTrig(); } public static int getBotTrig(GenericObject object) { - return object.getIntVal(BOT_TRIG); + return ((TriggerData)object).getBotTrig(); } public static int getAndTrig(GenericObject object) { - return object.getIntVal(AND_TRIG); + return ((TriggerData)object).getAndTrig(); } public static int[] getBank(GenericObject object) { - int[] bank = new int[8]; - for (int i = 0; i < 8; i++) { + int N=((TriggerData)object).bank.length; + int[] bank = new int[N]; + for (int i = 0; i < N; i++) { bank[i] = object.getIntVal(i); } return bank; @@ -80,7 +167,7 @@ @Override public int getNInt() { - return TRIG_BANK_SIZE; + return bank.length; } @Override