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  October 2014

HPS-SVN October 2014

Subject:

r1334 - /java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDetectorSetup.java

From:

[log in to unmask]

Reply-To:

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

Date:

Wed, 29 Oct 2014 19:17:46 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (128 lines)

Author: [log in to unmask]
Date: Wed Oct 29 12:17:43 2014
New Revision: 1334

Log:
Class used to load the database conditions onto HpsTestRunSiSensors.

Added:
    java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDetectorSetup.java   (with props)

Added: java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDetectorSetup.java
 =============================================================================
--- java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDetectorSetup.java	(added)
+++ java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDetectorSetup.java	Wed Oct 29 12:17:43 2014
@@ -0,0 +1,112 @@
+package org.hps.conditions.svt;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.lcsim.geometry.compact.Subdetector;
+import org.lcsim.detector.tracker.silicon.HpsSiSensor;
+import org.lcsim.detector.tracker.silicon.HpsTestRunSiSensor;
+
+import org.hps.conditions.svt.SvtT0Shift.SvtT0ShiftCollection;
+import org.hps.conditions.svt.TestRunSvtChannel.TestRunSvtChannelCollection;
+import org.hps.conditions.svt.TestRunSvtDaqMapping.TestRunSvtDaqMappingCollection;
+import org.hps.util.Pair;
+
+/**
+ * This class puts {@link TestRunSvtConditions} data onto 
+ * <code>HpsTestRunSiSensor</code> objects.
+ *
+ * @author Omar Moreno <[log in to unmask]>
+ */
+public class TestRunSvtDetectorSetup {
+
+    /**
+     * Load conditions data onto a detector object.
+     * 
+     * @param  The detector object.
+     * @param conditions The conditions object.
+     */
+	public void load(Subdetector subdetector, TestRunSvtConditions conditions){
+	
+        // Find sensor objects.
+    	List<HpsSiSensor> sensors = subdetector.getDetectorElement().findDescendants(HpsSiSensor.class);
+        System.out.println("Total sensors found: " + sensors.size());
+    	
+    	TestRunSvtChannelCollection channelMap = conditions.getChannelMap();
+        TestRunSvtDaqMappingCollection daqMap = conditions.getDaqMap();
+        SvtT0ShiftCollection t0Shifts = conditions.getT0Shifts();
+		
+        // Loop over sensors.
+        for(HpsSiSensor sensor : sensors){
+        	
+        	HpsTestRunSiSensor testRunSensor = (HpsTestRunSiSensor) sensor; 
+        	
+            // Reset possible existing conditions data on sensor.
+            sensor.reset();
+        
+            // Get DAQ pair (FPGA ID, Hybrid ID) corresponding to this sensor
+            Pair<Integer, Integer> daqPair = daqMap.getDaqPair(sensor);
+            if (daqPair == null) {
+                throw new RuntimeException("Failed to find DAQ pair for sensor: " + sensor.getName());
+            }
+           
+            // Set the FPGA ID of the sensor
+            testRunSensor.setFpgaID(daqPair.getFirstElement());
+        
+            // Set the hybrid ID of the sensor
+            testRunSensor.setHybridID(daqPair.getSecondElement());
+            
+            // Set the orientation of the sensor
+            String orientation = daqMap.getOrientation(daqPair);
+            if(orientation != null && orientation.contentEquals(TestRunSvtDaqMappingCollection.AXIAL)){
+            	sensor.setAxial(true);
+            } else if(orientation != null && orientation.contains(TestRunSvtDaqMappingCollection.STEREO)){
+            	sensor.setStereo(true);
+            }
+        
+            // Find all the channels for this sensor.
+            Collection<TestRunSvtChannel> channels = channelMap.find(daqPair);
+       
+            
+            // Loop over the channels of the sensor.
+            for (TestRunSvtChannel channel : channels) {
+            
+            	// Get conditions data for this channel.
+                ChannelConstants constants = conditions.getChannelConstants(channel);
+                int channelNumber = channel.getChannel();
+            
+            
+                //
+                // Set conditions data for this channel on the sensor object:
+                //
+                
+                // Check if the channel was flagged as bad
+                if (constants.isBadChannel()) {
+                    sensor.setBadChannel(channelNumber);
+                }
+                
+                // Set the pedestal and noise of each of the samples for the 
+                // channel
+                double[] pedestal = new double[6];
+                double[] noise = new double[6];
+                for(int sampleN = 0; sampleN < HpsTestRunSiSensor.NUMBER_OF_SAMPLES; sampleN++){
+                	pedestal[sampleN] = constants.getCalibration().getPedestal(sampleN);
+                	noise[sampleN] = constants.getCalibration().getNoise(sampleN);
+                }
+                sensor.setPedestal(channelNumber, pedestal);
+                sensor.setNoise(channelNumber, noise);
+               
+                // Set the gain and offset for the channel
+                sensor.setGain(channelNumber, constants.getGain().getGain());
+                sensor.setOffset(channelNumber, constants.getGain().getOffset());
+               
+                // Set the shape fit parameters
+                sensor.setShapeFitParameters(channelNumber, constants.getShapeFitParameters().toArray());
+            }
+            
+            // Set the t0 shift for the sensor.
+            SvtT0Shift sensorT0Shift = t0Shifts.find(daqPair).get(0);
+            sensor.setT0Shift(sensorT0Shift.getT0Shift());
+        }
+	}
+}

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