LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  March 2015

HPS-SVN March 2015

Subject:

r2629 - in /java/trunk: ecal-recon/src/main/java/org/hps/recon/ecal/triggerbank/TDCData.java evio/src/main/java/org/hps/evio/LCSimEngRunEventBuilder.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Tue, 31 Mar 2015 00:30:51 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (138 lines)

Author: [log in to unmask]
Date: Mon Mar 30 17:30:44 2015
New Revision: 2629

Log:
add TDC-DSC mapping

Modified:
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/triggerbank/TDCData.java
    java/trunk/evio/src/main/java/org/hps/evio/LCSimEngRunEventBuilder.java

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/triggerbank/TDCData.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/triggerbank/TDCData.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/triggerbank/TDCData.java	Mon Mar 30 17:30:44 2015
@@ -2,6 +2,9 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import org.hps.conditions.database.DatabaseConditionsManager;
+import org.hps.conditions.ecal.EcalChannel;
+import org.hps.conditions.ecal.EcalConditions;
 import org.lcsim.event.GenericObject;
 
 /**
@@ -43,34 +46,90 @@
 
     public class TDCHit {
 
-        private final int slot, edge, channel, time;
+        private final int tdcSlot, edge, tdcChannel, time;
+        private int dscCrate, dscSlot, dscChannel;
+        private int fadcCrate;
+        private boolean isECal;
+        private int x = 0, y = 0;
 
         public TDCHit(int data) {
-            slot = (data >> 27) & 0x1F; // bits 31:27
+            tdcSlot = (data >> 27) & 0x1F; // bits 31:27
             edge = (data >> 26) & 1; // bits 26:26
-            channel = (data >> 19) & 0x7F; // bits 25:19
+            tdcChannel = (data >> 19) & 0x7F; // bits 25:19
             time = data & 0x7FFFF; // bits 18:00
+            tdc2dsc();
         }
 
-        public int getSlot() {
-            return slot;
+        public int getTdcSlot() {
+            return tdcSlot;
         }
 
         public int getEdge() {
             return edge;
         }
 
-        public int getChannel() {
-            return channel;
+        public int getTdcChannel() {
+            return tdcChannel;
         }
 
         public int getTime() {
             return time;
         }
 
+        public int getDscCrate() {
+            return dscCrate;
+        }
+
+        public int getDscSlot() {
+            return dscSlot;
+        }
+
+        public int getDscChannel() {
+            return dscChannel;
+        }
+
+        public int getFadcCrate() {
+            return fadcCrate;
+        }
+
+        public boolean isECal() {
+            return isECal;
+        }
+
+        public int getX() {
+            return x;
+        }
+
+        public int getY() {
+            return y;
+        }
+
+        private void tdc2dsc() {
+            if (tdcSlot < 10 || tdcSlot > 13 || tdcChannel < 0 || tdcChannel > 127) {
+                throw new RuntimeException("Invalid TDC channel: " + tdcSlot + " " + tdcChannel);
+            }
+            int tdcSlot0 = 10;
+            int dscSlot0 = tdcSlot < 12 ? 3 : 6;
+            dscCrate = tdcChannel < 64 ? 46 : 58;
+            fadcCrate = tdcChannel < 64 ? 2 : 1;
+            dscSlot = (tdcChannel % 64) / 16 + 4 * (tdcSlot - tdcSlot0) + dscSlot0;
+            dscChannel = tdcChannel % 16;
+
+            EcalConditions ecalConditions = DatabaseConditionsManager.getInstance().getEcalConditions();
+            EcalChannel.DaqId daqId = new EcalChannel.DaqId(new int[]{fadcCrate, dscSlot, dscChannel}); // DSC slot/channel mapping mirrors FADC mapping
+            EcalChannel ecalChannel = ecalConditions.getChannelCollection().findChannel(daqId);
+            if (ecalChannel == null) {
+                isECal = false;
+            } else {
+                isECal = true;
+                x = ecalChannel.getX();
+                y = ecalChannel.getY();
+            }
+        }
+
         @Override
         public String toString() {
-            return String.format("slot %d, edge %d, ch %d, time %d", slot, edge, channel, time);
+            return String.format("slot %d, edge %d, ch %d, time %d; DSC crate %d, slot %d, ch %d, isECal %b, ix %d, iy %d", tdcSlot, edge, tdcChannel, time, dscCrate, dscSlot, dscChannel, isECal, x, y);
         }
     }
 }

Modified: java/trunk/evio/src/main/java/org/hps/evio/LCSimEngRunEventBuilder.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/LCSimEngRunEventBuilder.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/LCSimEngRunEventBuilder.java	Mon Mar 30 17:30:44 2015
@@ -51,7 +51,6 @@
         intBanks = new ArrayList<IntBankDefinition>();
         intBanks.add(new IntBankDefinition(SSPData.class, new int[]{sspCrateBankTag, sspBankTag}));
         intBanks.add(new IntBankDefinition(TIData.class, new int[]{sspCrateBankTag, 0xe10a}));
-        intBanks.add(new IntBankDefinition(TDCData.class, new int[]{0x2d, 0xe107}));
         intBanks.add(new IntBankDefinition(TDCData.class, new int[]{0x3a, 0xe107}));
         // ecalReader = new ECalEvioReader(0x25, 0x27);
         triggerConfigReader = new TriggerConfigEvioReader();

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use