Print

Print


Commit in hps-java/src/main/java/org/lcsim/hps on MAIN
monitoring/ecal/EcalDaqPlots.java+2-11.3 -> 1.4
evio/BasicEvioFileReader.java+22-31.4 -> 1.5
    /EventConstants.java-21.9 -> 1.10
    /ECalEvioReader.java+60-541.9 -> 1.10
recon/ecal/HPSEcalConditions.java+44-401.1 -> 1.2
+128-100
5 modified files
playing with the new ECal detector; update EcalDaqPlots with (hard-coded) list of slots

hps-java/src/main/java/org/lcsim/hps/monitoring/ecal
EcalDaqPlots.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- EcalDaqPlots.java	2 May 2012 00:39:40 -0000	1.3
+++ EcalDaqPlots.java	2 May 2012 14:55:52 -0000	1.4
@@ -27,6 +27,7 @@
 	private AIDA aida;
 	private Detector detector;
 	private List<IHistogram1D> plots;
+        private static final short[] slots = {10, 13, 9, 14, 8, 15, 7, 16, 6, 17, 5, 18, 4, 19};
 
 	public EcalDaqPlots() {
 	}
@@ -71,7 +72,7 @@
 		for (int i = 0; i < 14; i++) { // slot
 			for (int j = 1; j < 3; j++) { // crate                
 				//System.out.println("creating plot: " + "ECAL: Crate " + j + "; Slot " + i + " in region " + region);
-				IHistogram1D hist = aida.histogram1D("ECAL: Crate " + j + "; Slot " + i, 16, 0, 16);
+				IHistogram1D hist = aida.histogram1D("ECAL: Crate " + j + "; Slot " + slots[i], 16, 0, 16);
 				plots.add(hist);
 				plotter.region(region).plot(hist);
 				JASHist jhist = ((PlotterRegion) plotter.region(region)).getPlot();

hps-java/src/main/java/org/lcsim/hps/evio
BasicEvioFileReader.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- BasicEvioFileReader.java	2 May 2012 00:26:01 -0000	1.4
+++ BasicEvioFileReader.java	2 May 2012 14:55:52 -0000	1.5
@@ -71,12 +71,31 @@
     }
 
     private static void printComposite(CompositeData cdata, String indent) {
-        System.out.println(cdata.toString(indent));
+        System.out.println(indent + "Raw byte count: " + cdata.getRawBytes().length);
+//        System.out.println(cdata.toString(indent));
     }
 
     private static void printWindow(CompositeData cdata, String indent) {
-        System.out.println(indent + "Byte count: " + cdata.getRawBytes().length);
-        System.out.println(indent + "Slot: " + cdata.getByte());
+        while (true) {
+            try {
+                System.out.println(indent + "Byte count: " + cdata.getRawBytes().length);
+                System.out.println(indent + "Slot: " + cdata.getByte());
+                System.out.println(indent + "Trigger: " + cdata.getInt());
+                System.out.println(indent + "Timestamp: " + cdata.getLong());
+                int nchannels = cdata.getNValue();
+                System.out.println(indent + "NChannels: " + nchannels);
+                for (int j = 0; j < nchannels; j++) {
+                    System.out.println(indent + "Channel: " + cdata.getByte());
+                    int nSamples = cdata.getNValue();
+                    System.out.println(indent + "NSamples: " + nSamples);
+                    for (int i = 0; i < nSamples; i++) {
+                        cdata.getShort();
+                    }
+                }
+            } catch (IndexOutOfBoundsException e) {
+                break;
+            }
+        }
     }
 
     /*

hps-java/src/main/java/org/lcsim/hps/evio
EventConstants.java 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- EventConstants.java	27 Apr 2012 22:13:53 -0000	1.9
+++ EventConstants.java	2 May 2012 14:55:52 -0000	1.10
@@ -36,8 +36,6 @@
     public static final int ECAL_PULSE_BANK_TAG = 0xe102;
     // The tag for ECal pulse integral data.
     public static final int ECAL_PULSE_INTEGRAL_BANK_TAG = 0xe103;
-    // layer ID used for encoding of physical ID
-    public static final int ECAL_LAYER = 0;
     
     public static final int SVT_TOTAL_NUMBER_FPGAS = 8;
 }

hps-java/src/main/java/org/lcsim/hps/evio
ECalEvioReader.java 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- ECalEvioReader.java	2 May 2012 13:20:41 -0000	1.9
+++ ECalEvioReader.java	2 May 2012 14:55:52 -0000	1.10
@@ -17,7 +17,7 @@
 /**
  *
  * @author Sho Uemura <[log in to unmask]>
- * @version $Id: ECalEvioReader.java,v 1.9 2012/05/02 13:20:41 meeg Exp $
+ * @version $Id: ECalEvioReader.java,v 1.10 2012/05/02 14:55:52 meeg Exp $
  */
 public class ECalEvioReader extends EvioReader {
     // Names of subdetectors.
@@ -123,9 +123,6 @@
                     for (int i = 0; i < nSamples; i++) {
                         adcValues[i] = cdata.getShort();
                     }
-//				if (debug) {
-//					System.out.println("    pulseTime=" + pulseTime + "; pulseIntegral=" + pulseIntegral);
-//				}
                     hits.add(new BaseRawTrackerHit(id, 0, adcValues));
                 }
             } catch (IndexOutOfBoundsException e) {
@@ -148,34 +145,37 @@
             }
         }
 
-        int crate = bankTag;
-        short slot = cdata.getByte();
-        int trigger = cdata.getInt();
-        long timestamp = cdata.getLong();
-        int nchannels = cdata.getNValue();
-        if (debug) {
-            System.out.println("slot#=" + slot + "; trigger=" + trigger + "; timestamp=" + timestamp + "; nchannels=" + nchannels);
-        }
-        for (int j = 0; j < nchannels; j++) {
-            short channel = cdata.getByte();
-            int npulses = cdata.getNValue();
-            if (debug) {
-                System.out.println("  channel=" + channel + "; npulses=" + npulses);
-            }
-            long daqID = HPSEcalConditions.getDaqID(crate, slot, channel);
-            Long id = HPSEcalConditions.daqToPhysicalID(daqID);
-
-            for (int k = 0; k < npulses; k++) {
-                short pulseNum = cdata.getByte();
-                int sampleCount = cdata.getNValue();
-                short[] adcValues = new short[sampleCount];
-                for (int i = 0; i < sampleCount; i++) {
-                    adcValues[i] = cdata.getShort();
-                }
-//				if (debug) {
-//					System.out.println("    pulseTime=" + pulseTime + "; pulseIntegral=" + pulseIntegral);
-//				}
-                hits.add(new BaseRawTrackerHit(id, pulseNum, adcValues));
+        while (true) {
+            try {
+                int crate = bankTag;
+                short slot = cdata.getByte();
+                int trigger = cdata.getInt();
+                long timestamp = cdata.getLong();
+                int nchannels = cdata.getNValue();
+                if (debug) {
+                    System.out.println("slot#=" + slot + "; trigger=" + trigger + "; timestamp=" + timestamp + "; nchannels=" + nchannels);
+                }
+                for (int j = 0; j < nchannels; j++) {
+                    short channel = cdata.getByte();
+                    int npulses = cdata.getNValue();
+                    if (debug) {
+                        System.out.println("  channel=" + channel + "; npulses=" + npulses);
+                    }
+                    long daqID = HPSEcalConditions.getDaqID(crate, slot, channel);
+                    Long id = HPSEcalConditions.daqToPhysicalID(daqID);
+
+                    for (int k = 0; k < npulses; k++) {
+                        short pulseNum = cdata.getByte();
+                        int sampleCount = cdata.getNValue();
+                        short[] adcValues = new short[sampleCount];
+                        for (int i = 0; i < sampleCount; i++) {
+                            adcValues[i] = cdata.getShort();
+                        }
+                        hits.add(new BaseRawTrackerHit(id, pulseNum, adcValues));
+                    }
+                }
+            } catch (IndexOutOfBoundsException e) {
+                break;
             }
         }
         return hits;
@@ -194,30 +194,36 @@
             }
         }
 
-        int crate = bankTag;
-        short slot = cdata.getByte();
-        int trigger = cdata.getInt();
-        long timestamp = cdata.getLong();
-        int nchannels = cdata.getNValue();
-        if (debug) {
-            System.out.println("slot#=" + slot + "; trigger=" + trigger + "; timestamp=" + timestamp + "; nchannels=" + nchannels);
-        }
-        for (int j = 0; j < nchannels; j++) {
-            short channel = cdata.getByte();
-            int npulses = cdata.getNValue();
-            if (debug) {
-                System.out.println("  channel=" + channel + "; npulses=" + npulses);
-            }
-            long daqID = HPSEcalConditions.getDaqID(crate, slot, channel);
-            Long id = HPSEcalConditions.daqToPhysicalID(daqID);
-
-            for (int k = 0; k < npulses; k++) {
-                short pulseTime = cdata.getShort();
-                int pulseIntegral = cdata.getInt();
+        while (true) {
+            try {
+                int crate = bankTag;
+                short slot = cdata.getByte();
+                int trigger = cdata.getInt();
+                long timestamp = cdata.getLong();
+                int nchannels = cdata.getNValue();
                 if (debug) {
-                    System.out.println("    pulseTime=" + pulseTime + "; pulseIntegral=" + pulseIntegral);
+                    System.out.println("slot#=" + slot + "; trigger=" + trigger + "; timestamp=" + timestamp + "; nchannels=" + nchannels);
                 }
-                hits.add(new BaseRawCalorimeterHit(id, pulseIntegral, pulseTime));
+                for (int j = 0; j < nchannels; j++) {
+                    short channel = cdata.getByte();
+                    int npulses = cdata.getNValue();
+                    if (debug) {
+                        System.out.println("  channel=" + channel + "; npulses=" + npulses);
+                    }
+                    long daqID = HPSEcalConditions.getDaqID(crate, slot, channel);
+                    Long id = HPSEcalConditions.daqToPhysicalID(daqID);
+
+                    for (int k = 0; k < npulses; k++) {
+                        short pulseTime = cdata.getShort();
+                        int pulseIntegral = cdata.getInt();
+                        if (debug) {
+                            System.out.println("    pulseTime=" + pulseTime + "; pulseIntegral=" + pulseIntegral);
+                        }
+                        hits.add(new BaseRawCalorimeterHit(id, pulseIntegral, pulseTime));
+                    }
+                }
+            } catch (IndexOutOfBoundsException e) {
+                break;
             }
         }
         return hits;

hps-java/src/main/java/org/lcsim/hps/recon/ecal
HPSEcalConditions.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- HPSEcalConditions.java	2 May 2012 00:39:40 -0000	1.1
+++ HPSEcalConditions.java	2 May 2012 14:55:52 -0000	1.2
@@ -4,17 +4,17 @@
 import org.lcsim.geometry.Subdetector;
 import java.io.IOException;
 import java.io.Reader;
-import java.io.StreamTokenizer;
 import java.util.HashMap;
 import java.util.StringTokenizer;
 import org.lcsim.conditions.ConditionsManager;
-import org.lcsim.geometry.util.IDEncoder;
-import static org.lcsim.hps.evio.EventConstants.ECAL_LAYER;
+import org.lcsim.detector.identifier.ExpandedIdentifier;
+import org.lcsim.detector.identifier.IExpandedIdentifier;
+import org.lcsim.detector.identifier.IIdentifierHelper;
 
 /**
  *
  * @author meeg
- * @version $Id: HPSEcalConditions.java,v 1.1 2012/05/02 00:39:40 meeg Exp $
+ * @version $Id: HPSEcalConditions.java,v 1.2 2012/05/02 14:55:52 meeg Exp $
  */
 public class HPSEcalConditions {
 
@@ -26,7 +26,7 @@
     private static HashMap<Long, Integer> daqToPedestalMap = new HashMap<Long, Integer>();
     private static HashMap<Long, Double> daqToNoiseMap = new HashMap<Long, Double>();
     private static boolean pedestalsLoaded = false;
-
+    
     private HPSEcalConditions() {
     }
 
@@ -42,9 +42,9 @@
         ConditionsManager conditions = ConditionsManager.defaultInstance();
         try {
             Reader pedestalsReader = conditions.getRawConditions("calibECal/fadc01.ped").getReader();
-            loadPedestals(pedestalsReader,1);
+            loadPedestals(pedestalsReader, 1);
             pedestalsReader = conditions.getRawConditions("calibECal/fadc02.ped").getReader();
-            loadPedestals(pedestalsReader,2);
+            loadPedestals(pedestalsReader, 2);
         } catch (IOException e) {
             throw new RuntimeException("couldn't get pedestals file", e);
         }
@@ -71,7 +71,7 @@
             StringTokenizer lineTok = new StringTokenizer(line);
 
             if (lineTok.countTokens() != 0) {
-                if (lineTok.countTokens() != 5) {
+                if (lineTok.countTokens() != 4) {
                     throw new RuntimeException("Invalid line in pedestals file: " + line);
                 } else {
                     short slot = Short.valueOf(lineTok.nextToken());
@@ -88,47 +88,51 @@
     public static void fillDaqCellMap(Subdetector ecal) {
 
         System.out.println("reading DAQ map");
-
-        IDEncoder enc = new IDEncoder(ecal.getIDDecoder().getIDDescription());
-        enc.setValue("system", ecal.getSystemID());
-        enc.setValue("layer", ECAL_LAYER);
+        
+        IIdentifierHelper helper = ecal.getDetectorElement().getIdentifierHelper();
+        IExpandedIdentifier expId = new ExpandedIdentifier(helper.getIdentifierDictionary().getNumberOfFields());
+        expId.setValue(helper.getFieldIndex("system"), ecal.getSystemID());
 
         ConditionsManager conditions = ConditionsManager.defaultInstance();
-        StreamTokenizer tok = null;
+        BufferedReader bufferedPedestals;
         try {
-            tok = new StreamTokenizer(conditions.getRawConditions("daqmap/ecal.txt").getReader());
+            bufferedPedestals = new BufferedReader(conditions.getRawConditions("daqmap/ecal.txt").getReader());
         } catch (IOException e) {
             throw new RuntimeException("couldn't get DAQ map from conditions manager", e);
         }
-        tok.commentChar('#');
-        tok.eolIsSignificant(false);
-        tok.parseNumbers();
-        try {
-            while (tok.nextToken() != StreamTokenizer.TT_EOF) {
-                tok.pushBack();
-                int x = (int) getNumber(tok);
-                int y = (int) getNumber(tok);
-                enc.setValue("ix", x);
-                enc.setValue("iy", y);
-                int crate = (int) getNumber(tok);
-                short slot = (short) getNumber(tok);
-                short channel = (short) getNumber(tok);
-                addMapEntry(enc.getID(), getDaqID(crate, slot, channel));
-//				System.out.printf("x = %d, y = %d, crate = %d, slot = %d, channel = %d\n", x, y, crate, slot, channel);
-//				System.out.printf("physicalID = %d, daqID = %d\n",enc.getID(), getDaqID(crate, slot, channel));
+        String line;
+        while (true) {
+            try {
+                line = bufferedPedestals.readLine();
+            } catch (IOException e) {
+                throw new RuntimeException("couldn't parse ECal DAQ map", e);
             }
-        } catch (IOException e) {
-            throw new RuntimeException("couldn't parse DAQ map", e);
-        }
-        mapLoaded = true;
-    }
+            if (line == null) {
+                break;
+            }
+
+            if (line.indexOf("#") != -1) {
+                line = line.substring(0, line.indexOf("#"));
+            }
+
+            StringTokenizer lineTok = new StringTokenizer(line);
 
-    private static double getNumber(StreamTokenizer tok) throws IOException {
-        if (tok.nextToken() == StreamTokenizer.TT_NUMBER) {
-            return tok.nval;
-        } else {
-            throw new IOException("expected an int from DAQ map, instead got " + tok);
+            if (lineTok.countTokens() != 0) {
+                if (lineTok.countTokens() != 5) {
+                    throw new RuntimeException("Invalid line in ECal DAQ map: " + line);
+                } else {
+                    int x = Integer.valueOf(lineTok.nextToken());
+                    int y = Integer.valueOf(lineTok.nextToken());
+                    expId.setValue(helper.getFieldIndex("ix"), x);
+                    expId.setValue(helper.getFieldIndex("iy"), y);
+                    int crate = Integer.valueOf(lineTok.nextToken());
+                    short slot = Short.valueOf(lineTok.nextToken());
+                    short channel = Short.valueOf(lineTok.nextToken());
+                    addMapEntry(helper.pack(expId).getValue(), getDaqID(crate, slot, channel));
+                }
+            }
         }
+        mapLoaded = true;
     }
 
     private static void addMapEntry(long physicalID, long daqID) {
CVSspam 0.2.12


Use REPLY-ALL to reply to list

To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1