Commit in hps-java/src on MAIN | |||
test/java/org/lcsim/hps/evio/HPSEvioReader.java | +3 | -3 | 1.1 -> 1.2 |
/DoEvioTest.java | +3 | -3 | 1.1 -> 1.2 |
main/java/org/lcsim/hps/recon/ecal/HPSEcalPrintDriver.java | -108 | 1.2 removed | |
/HPSEcalFlashTrigger.java | -410 | 1.4 removed | |
main/java/org/lcsim/hps/users/meeg/HPSEcalPrintDriver.java | +108 | added 1.1 | |
/EvioFileReader.java | +2 | -3 | 1.11 -> 1.12 |
main/java/org/lcsim/hps/recon/tracking/HPSTrackerSample.java | -66 | 1.1 removed | |
/HPSTrackerEvent.java | -185 | 1.1 removed | |
/HPSTrackerHit.java | -43 | 1.1 removed | |
main/java/org/lcsim/hps/users/omoreno/HPSEcalFlashTrigger.java | +411 | added 1.1 | |
/HPSTestRunDriver.java | +1 | -2 | 1.2 -> 1.3 |
main/java/org/lcsim/hps/users/mgraham/HPSTrackerHit.java | +43 | added 1.1 | |
main/java/org/lcsim/hps/users/homer/HPSTrackerEvent.java | +183 | added 1.1 | |
/HPSTrackerSample.java | +66 | added 1.1 | |
main/resources/org/lcsim/hps/steering/OnlineTracking.lcsim | -1 | 1.4 -> 1.5 | |
+820 | -824 |
move some unused classes to org.lcsim.hps.users
diff -u -r1.1 -r1.2 --- HPSEvioReader.java 31 Mar 2012 04:47:54 -0000 1.1 +++ HPSEvioReader.java 29 Apr 2012 02:10:05 -0000 1.2 @@ -24,15 +24,15 @@
import org.lcsim.event.base.BaseLCSimEvent; import org.lcsim.hps.recon.tracking.HPSMakeSVTCellID;
-import org.lcsim.hps.recon.tracking.HPSTrackerEvent; -import org.lcsim.hps.recon.tracking.HPSTrackerSample;
+import org.lcsim.hps.users.homer.HPSTrackerEvent; +import org.lcsim.hps.users.homer.HPSTrackerSample;
/** * This is a test of using jevio routines to read EVIO files. * * @author homer
- * @version $Id: HPSEvioReader.java,v 1.1 2012/03/31 04:47:54 homer Exp $
+ * @version $Id: HPSEvioReader.java,v 1.2 2012/04/29 02:10:05 meeg Exp $
*/ public class HPSEvioReader extends TestCase {
diff -u -r1.1 -r1.2 --- DoEvioTest.java 28 Mar 2012 18:43:37 -0000 1.1 +++ DoEvioTest.java 29 Apr 2012 02:10:05 -0000 1.2 @@ -27,8 +27,8 @@
import org.lcsim.event.SimTrackerHit; import org.lcsim.event.base.BaseLCSimEvent; import org.lcsim.event.base.BaseRawTrackerHit;
-import org.lcsim.hps.recon.tracking.HPSTrackerEvent; -import org.lcsim.hps.recon.tracking.HPSTrackerSample;
+import org.lcsim.hps.users.homer.HPSTrackerEvent; +import org.lcsim.hps.users.homer.HPSTrackerSample;
import org.lcsim.hps.recon.tracking.MapDAQCellID; import org.lcsim.util.lcio.LCIOWriter;
@@ -36,7 +36,7 @@
* This is a test of using jevio routines to read EVIO files. * * @author homer
- * @version $Id: DoEvioTest.java,v 1.1 2012/03/28 18:43:37 jeremy Exp $
+ * @version $Id: DoEvioTest.java,v 1.2 2012/04/29 02:10:05 meeg Exp $
*/ public class DoEvioTest extends TestCase {
diff -N HPSEcalPrintDriver.java --- HPSEcalPrintDriver.java 7 Oct 2011 23:14:54 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,108 +0,0 @@
-package org.lcsim.hps.recon.ecal; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.List; - -import org.lcsim.event.CalorimeterHit; -import org.lcsim.event.EventHeader; -import org.lcsim.geometry.Detector; -import org.lcsim.geometry.IDDecoder; -import org.lcsim.geometry.subdetector.HPSEcal3; -import org.lcsim.hps.util.ClockSingleton; -import org.lcsim.util.Driver; - -/** - * Performs readout of ECal hits. - * - * @author Sho Uemura <[log in to unmask]> - * @version $Id: HPSEcalPrintDriver.java,v 1.2 2011/10/07 23:14:54 meeg Exp $ - */ -public class HPSEcalPrintDriver extends Driver { - - HPSEcal3 ecal; - IDDecoder dec; - String ecalCollectionName; - String ecalName; - String ecalReadoutName = "EcalHits"; - String outputFilePath; - PrintWriter outputStream = null; - int nx, ny; - - public void setEcalReadoutName(String ecalReadoutName) { - this.ecalReadoutName = ecalReadoutName; - } - - public void setEcalCollectionName(String ecalCollectionName) { - this.ecalCollectionName = ecalCollectionName; - } - - public void setEcalName(String ecalName) { - this.ecalName = ecalName; - } - - public void setOutputFilePath(String outputFilePath) { - this.outputFilePath = outputFilePath; - } - - public void startOfData() { - if (ecalCollectionName == null) - throw new RuntimeException("The parameter ecalCollectionName was not set!"); - - if (ecalName == null) - throw new RuntimeException("The parameter ecalName was not set!"); - - try { - outputStream = new PrintWriter(outputFilePath); - } catch (IOException ex) { - throw new RuntimeException("Invalid outputFilePath!"); - } - } - - public void endOfData() { - if (outputStream != null) - outputStream.close(); - } - - public void detectorChanged(Detector detector) { - // Get the Subdetector. - ecal = (HPSEcal3) detector.getSubdetector(ecalName); - dec = ecal.getIDDecoder(); - nx = (int) ecal.nx(); - ny = (int) ecal.ny(); - } - - public void process(EventHeader event) { - //System.out.println(this.getClass().getCanonicalName() + " - process"); - // Get the list of ECal hits. - List<CalorimeterHit> hits = event.get(CalorimeterHit.class, ecalCollectionName); - - if (hits == null) - throw new RuntimeException("Event is missing ECal hits collection!"); - - if (!hits.isEmpty()) { - double hitArray[][] = new double[nx][2 * ny]; - for (CalorimeterHit hit : hits) { - dec.setID(hit.getCellID()); - int ix = dec.getValue("ix"); - int iy = dec.getValue("iy"); - if (nx % 2 == 0) { - hitArray[ix > 0 ? nx / 2 + ix - 1 : nx / 2 + ix][iy > 0 ? ny + iy - 1 : ny + iy] += hit.getRawEnergy(); - } else { - hitArray[ix > 0 ? nx / 2 + ix : nx / 2 + ix][iy > 0 ? ny + iy - 1 : ny + iy] += hit.getRawEnergy(); - } - } - - outputStream.printf("Event %d\n", ClockSingleton.getClock()); - for (int x = 0; x < nx; x++) { - for (int y = 0; y < 2 * ny; y++) { - if (hitArray[x][y] == 0) - outputStream.printf("0\t"); - else - outputStream.printf("%4.3f\t", hitArray[x][y]); - } - outputStream.println(); - } - } - } -}
\ No newline at end of file
diff -N HPSEcalFlashTrigger.java --- HPSEcalFlashTrigger.java 17 Nov 2011 01:43:26 -0000 1.4 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,410 +0,0 @@
-package org.lcsim.hps.recon.ecal; - -//--- Java ---// -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -//--- org.lcsim ---// -import org.lcsim.event.Cluster; -import org.lcsim.event.EventHeader; -import org.lcsim.hps.util.ClockSingleton; -import org.lcsim.util.Driver; - - -/** - * Heavy Photon Search ECal Flash Trigger - * - * @author Omar Moreno <[log in to unmask]> - * @version $Id: HPSEcalFlashTrigger.java,v 1.4 2011/11/17 01:43:26 meeg Exp $ - */ -public class HPSEcalFlashTrigger extends Driver -{ - // The HPS ECal Clusterer - HPSEcalClusterer ecalClusterer; - - String ecalRawHitsCollectionName = "EcalHits"; - String ecalClusterCollectionName = "EcalClusters"; - - // A list to contain all cluster pairs in an event - List<Cluster[]> clusterPairs; - - int nTriggers; - int totalEvents; - - private double clusterEnergyHigh = 1.85; // GeV - private double clusterEnergyLow = .1; // GeV - private double energySumThreshold = 2; // GeV - private double energyDifferenceThreshold = 1.5; // GeV - private double maxCoplanarityAngle = 35; // degrees - - - /** - * Constructor - */ - public HPSEcalFlashTrigger( ) - { - // Instantiate the HPS Clusterer - ecalClusterer = new HPSEcalClusterer(); - ecalClusterer.setClusterCollectionName( ecalClusterCollectionName ); - ecalClusterer.setEcalCollectionName( ecalRawHitsCollectionName ); - ecalClusterer.setEcalName( "Ecal" ); - add( ecalClusterer ); - - clusterPairs = new ArrayList<Cluster[]>(); - } - - @Override - public void process(EventHeader event) - { - - super.process(event); - totalEvents +=1; - - // Get a list of all clusters found by the clusterer in the event - List< Cluster > ecalClusters - = event.get(Cluster.class, ecalClusterCollectionName); - - //--- Apply Trigger Cuts ---// - - // Require that the event have at least two clusters in opposite - // quadrants - if ( !getClusterPairs( ecalClusters ) ) return; - - // Iterate through all cluster pairs present in the event. If at least - // one of the cluster pairs satisfies all of the trigger conditions, - // a trigger signal is sent to all other detectors. - for( Iterator it = clusterPairs.iterator(); it.hasNext(); ){ - - Cluster[] clusterPair = (Cluster[]) it.next(); - - // Require the componets of a cluster pair to have an energy in - // the range of 100 MeV to 1.85 GeV - if( !clusterECut( clusterPair ) ) continue; - - // Require the sum of the energies of the components of the - // cluster pair to be less than the - // (Beam Energy)*(Sampling Fraction) ( 2 GeV for the Test Run ) - if( !energySum( clusterPair ) ) continue; - - // Require the difference in energy of the components of the - // cluster pair to be less than 1.5 GeV - if( !energyDifference( clusterPair ) ) continue; - - // Apply a low energy cluster vs. distance cut of the form - // E_low + .0032 GeV/mm < .8 GeV - if( !energyDistanceCut( clusterPair ) ) continue; - - // Require that the two clusters are coplanar with the beam within - // 35 degrees - if( !coplanarityCut( clusterPair ) ) continue; - - // If all cuts are pased, send a trigger signal -// sendTrigger( ); - - // Increment number of triggers - nTriggers +=1; - - // Only require that at least one cluster pair passes all the - // trigger cuts - break; - } - } - - /** - * Run before any processes are called - */ - @Override - public void startOfData() - { - nTriggers = 0; - totalEvents = 0; - } - - /** - * Run after all data has been processed - */ - @Override - public void endOfData( ) { - - System.out.println( "Total Number of Triggers: " + nTriggers ); - System.out.println( "The Trigger Rate: " - + ( (( double )nTriggers/( double )totalEvents))*100. + "%" ); - } - - /** - * Get a list of all unique cluster pairs in the event - * - * @param ecalClusters : List of ECal clusters - * @return true if there are any cluster pairs - */ - public boolean getClusterPairs(List<Cluster> ecalClusters) - { - - // Check to see if there are at least two clusters - if (ecalClusters.size() < 2) return false; - - // Create a list which will hold all neighboring cluster to the cluster - // of interest - List< Cluster> ecalClusterNeighbors = new ArrayList< Cluster >(); - for (Cluster ecalCluster : ecalClusters) { - ecalClusterNeighbors.add(ecalCluster); - } - - // Clear the list of cluster pairs - clusterPairs.clear(); - - for ( Cluster ecalCluster : ecalClusters ) { - - // Get the quadrant which contains the ECal cluster of interest - int ecalClusterQuad = getECalQuadrant(ecalCluster); - - // Create a list of neighbors to the cluster of interest - ecalClusterNeighbors.remove(ecalCluster); - - // Loop over all neigboring clusters and check to see if there is - // any which lie in opposing quadrants to the cluster of interest. - // If so, add them to the list of cluster pairs - for (Cluster ecalClusterNeighbor : ecalClusterNeighbors ){ - - switch (ecalClusterQuad) { - case 1: - if ( getECalQuadrant( ecalClusterNeighbor ) == 3 ){ - Cluster[] clusterPair - = { ecalCluster, ecalClusterNeighbor }; - clusterPairs.add( clusterPair ); - } - break; - case 2: - if ( getECalQuadrant( ecalClusterNeighbor ) == 4 ){ - Cluster[] clusterPair - = { ecalCluster, ecalClusterNeighbor }; - clusterPairs.add( clusterPair ); - } - break; - case 3: - if ( getECalQuadrant( ecalClusterNeighbor ) == 1 ) { - Cluster[] clusterPair - = { ecalCluster, ecalClusterNeighbor }; - clusterPairs.add(clusterPair); - } - break; - case 4: - if ( getECalQuadrant( ecalClusterNeighbor ) == 2 ) { - Cluster[] clusterPair - = { ecalCluster, ecalClusterNeighbor }; - clusterPairs.add(clusterPair); - } - break; - } - } - } - - return !clusterPairs.isEmpty(); - } - - /** - * Checks if the ECal clusters making up a cluster pair lie above the low - * energy threshold and below the high energy threshold - * - * @param clusterPair : pair of clusters - * @return true if a pair is found, false otherwise - */ - public boolean clusterECut( Cluster[] clusterPair ) - { - - if( clusterPair[ 0 ].getEnergy( ) < clusterEnergyHigh - && clusterPair[ 1 ].getEnergy( ) < clusterEnergyHigh - && clusterPair[ 0 ].getEnergy( ) > clusterEnergyLow - && clusterPair[ 1 ].getEnergy( ) > clusterEnergyLow ) - return true; - - return false; - } - - /** - * Returns the quadrant which contains the ECal cluster - * - * @param ecalCluster : ECal cluster - * @return Quadrant number - */ - public int getECalQuadrant(Cluster ecalCluster) - { - double[] clusterPosition = ecalCluster.getPosition(); - - // Quadrant 1 - if(( clusterPosition[0] > 0.0 ) && ( clusterPosition[1] > 0.0 )) - return 1; - //Quadrant 2 - if(( clusterPosition[0] < 0.0 ) && ( clusterPosition[1] > 0.0 )) - return 2; - // Quadrant 3 - if(( clusterPosition[0] < 0.0 ) && ( clusterPosition[1] < 0.0 )) - return 3; - // Quadrant 4 - return 4; - } - - /** - * Checks if the sum of the energies of ECal clusters making up a cluster - * pair is below an energy sum threshold - * - * @param clusterPair : pair of clusters - * @return true if a pair is found, false otherwise - */ - public boolean energySum( Cluster[] clusterPair ) - { - double clusterESum = clusterPair[ 0 ].getEnergy() - + clusterPair[ 1 ].getEnergy(); - if( clusterESum < energySumThreshold ) return true; - - return false; - } - - /** - * Checks if the energy difference between the ECal clusters making up - * a cluster pair is below an energy difference threshold - * - * @param clusterPair : pair of clusters - * @return true if pair is found, false otherwise - */ - public boolean energyDifference( Cluster[] clusterPair ) - { - double clusterEDifference - = Math.abs( clusterPair[ 0 ].getEnergy( ) - - clusterPair[ 1 ].getEnergy() ); - - if( clusterEDifference < energyDifferenceThreshold ) - return true; - - return false; - - } - - /** - * Require that the distance from the beam of the lowest energy cluster - * in a cluster pair satisfies the following - * E_low + d_b*.0032 GeV/mm < .8 GeV - * - * @param clusterPiar : pair of clusters - * @return true if pair is found, false otherwise - */ - public boolean energyDistanceCut( Cluster[] clusterPair ) - { - Cluster lowEnergyCluster; - - // Obtain the lowest energy cluster - if( clusterPair[0].getEnergy() < clusterPair[1].getEnergy() ) - lowEnergyCluster = clusterPair[0]; - else lowEnergyCluster = clusterPair[1]; - - // Calculate its position - double lowEClusterPosition - = Math.sqrt( Math.pow( lowEnergyCluster.getPosition()[0], 2) - + Math.pow( lowEnergyCluster.getPosition()[1], 2) ); - - double clusterDistvsE - = lowEnergyCluster.getEnergy() + lowEClusterPosition*(0.0032); - - if( clusterDistvsE > .8 /* GeV */ ) return true; - - return false; - } - - /** - * Checks if a cluster pair is coplanar to the beam within a given - * angle - * - * @param clusterPair : pair of clusters - * @return true if pair is found, false otherwise - */ - public boolean coplanarityCut( Cluster[] clusterPair ) - { - // Find the distance of both clusters from the origin - double cluster1Dist - = Math.sqrt( Math.pow( clusterPair[0].getPosition()[0],2 ) - + Math.pow( clusterPair[0].getPosition()[1],2) ); - double cluster2Dist - = Math.sqrt( Math.pow( clusterPair[1].getPosition()[0],2 ) - + Math.pow( clusterPair[1].getPosition()[1],2) ); - - // Calculate the dot product between the distance vectors of - // each cluster in the cluster pair - double clusterDot - = clusterPair[0].getPosition()[0]*clusterPair[1].getPosition()[0] - +clusterPair[0].getPosition()[1]*clusterPair[1].getPosition()[1]; - - // Find the angle between clusters in the pair - double cosphi = clusterDot/( cluster1Dist*cluster2Dist ); - double phi = Math.toDegrees( Math.acos( cosphi ) ); - - if( (180 - phi ) < maxCoplanarityAngle ) return true; - - return false; - - } - - /** - * Sends an ECal trigger signal - */ - public void sendTrigger() - { - ClockSingleton.setTrigger(); - } - - /** - * Set the upper energy cluster threshold - * - * @param highThreshold : Threshold in GeV - */ - public void setUpperETheshold( double highThreshold ) - { - - clusterEnergyHigh = highThreshold; - } - - /** - * Set the lower energy cluster threshold - * - * @param lowThrehold : Threshold in GeV - */ - public void setLowerEThreshold( double lowThreshold ) - { - - clusterEnergyLow = lowThreshold; - } - - /** - * Set the threshold on the sum of the two cluster energies - * - * @param sumThreshold : Threshold in GeV - */ - public void setESumThreshold( double sumThreshold ) - { - - energySumThreshold = sumThreshold; - } - - /** - * Set the threshold on the energy difference between two cluster energies - * - * @param diffThreshold : Threshold in GeV - */ - public void setEDiffThrehold( double diffThreshold ) - { - - energyDifferenceThreshold = diffThreshold; - } - - /** - * Set the maximum angle required to achieve coplanarity between the - * clusters and the beam - * - * @param maxCoplanarity : Maximum angle in degrees - */ - public void setMaxCoplanarityAngle( double maxCoplanarity ) - { - maxCoplanarityAngle = maxCoplanarity; - } - -}
diff -N HPSEcalPrintDriver.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ HPSEcalPrintDriver.java 29 Apr 2012 02:10:05 -0000 1.1 @@ -0,0 +1,108 @@
+package org.lcsim.hps.users.meeg; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.List; + +import org.lcsim.event.CalorimeterHit; +import org.lcsim.event.EventHeader; +import org.lcsim.geometry.Detector; +import org.lcsim.geometry.IDDecoder; +import org.lcsim.geometry.subdetector.HPSEcal3; +import org.lcsim.hps.util.ClockSingleton; +import org.lcsim.util.Driver; + +/** + * Performs readout of ECal hits. + * + * @author Sho Uemura <[log in to unmask]> + * @version $Id: HPSEcalPrintDriver.java,v 1.1 2012/04/29 02:10:05 meeg Exp $ + */ +public class HPSEcalPrintDriver extends Driver { + + HPSEcal3 ecal; + IDDecoder dec; + String ecalCollectionName; + String ecalName; + String ecalReadoutName = "EcalHits"; + String outputFilePath; + PrintWriter outputStream = null; + int nx, ny; + + public void setEcalReadoutName(String ecalReadoutName) { + this.ecalReadoutName = ecalReadoutName; + } + + public void setEcalCollectionName(String ecalCollectionName) { + this.ecalCollectionName = ecalCollectionName; + } + + public void setEcalName(String ecalName) { + this.ecalName = ecalName; + } + + public void setOutputFilePath(String outputFilePath) { + this.outputFilePath = outputFilePath; + } + + public void startOfData() { + if (ecalCollectionName == null) + throw new RuntimeException("The parameter ecalCollectionName was not set!"); + + if (ecalName == null) + throw new RuntimeException("The parameter ecalName was not set!"); + + try { + outputStream = new PrintWriter(outputFilePath); + } catch (IOException ex) { + throw new RuntimeException("Invalid outputFilePath!"); + } + } + + public void endOfData() { + if (outputStream != null) + outputStream.close(); + } + + public void detectorChanged(Detector detector) { + // Get the Subdetector. + ecal = (HPSEcal3) detector.getSubdetector(ecalName); + dec = ecal.getIDDecoder(); + nx = (int) ecal.nx(); + ny = (int) ecal.ny(); + } + + public void process(EventHeader event) { + //System.out.println(this.getClass().getCanonicalName() + " - process"); + // Get the list of ECal hits. + List<CalorimeterHit> hits = event.get(CalorimeterHit.class, ecalCollectionName); + + if (hits == null) + throw new RuntimeException("Event is missing ECal hits collection!"); + + if (!hits.isEmpty()) { + double hitArray[][] = new double[nx][2 * ny]; + for (CalorimeterHit hit : hits) { + dec.setID(hit.getCellID()); + int ix = dec.getValue("ix"); + int iy = dec.getValue("iy"); + if (nx % 2 == 0) { + hitArray[ix > 0 ? nx / 2 + ix - 1 : nx / 2 + ix][iy > 0 ? ny + iy - 1 : ny + iy] += hit.getRawEnergy(); + } else { + hitArray[ix > 0 ? nx / 2 + ix : nx / 2 + ix][iy > 0 ? ny + iy - 1 : ny + iy] += hit.getRawEnergy(); + } + } + + outputStream.printf("Event %d\n", ClockSingleton.getClock()); + for (int x = 0; x < nx; x++) { + for (int y = 0; y < 2 * ny; y++) { + if (hitArray[x][y] == 0) + outputStream.printf("0\t"); + else + outputStream.printf("%4.3f\t", hitArray[x][y]); + } + outputStream.println(); + } + } + } +}
\ No newline at end of file
diff -u -r1.11 -r1.12 --- EvioFileReader.java 28 Apr 2012 21:05:15 -0000 1.11 +++ EvioFileReader.java 29 Apr 2012 02:10:05 -0000 1.12 @@ -103,7 +103,6 @@
//int eventCount = 0; do { EvioEvent evioEvent = null;
- EventHeader lcsimEvent = null;
do { try { evioEvent = reader.parseNextEvent();
@@ -113,11 +112,11 @@
} while (evioEvent == null || !eventBuilder.isPhysicsEvent(evioEvent)); // Create LCSim event from EVIO data.
- lcsimEvent = eventBuilder.makeLCSimEvent(evioEvent);
+ EventHeader lcsimEvent = eventBuilder.makeLCSimEvent(evioEvent);
// Supply record to Driver Adapter. driverAdapter.recordSupplied(new RecordSuppliedEvent(new Object(), lcsimEvent));
- Thread.currentThread().sleep(delay);
+ Thread.sleep(delay);
} while (reader.getNumEventsRemaining() != 0); // Cleanup. driverAdapter.finish(null);
diff -N HPSTrackerSample.java --- HPSTrackerSample.java 28 Mar 2012 18:40:01 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,66 +0,0 @@
-/* - * Description : based on the C++ version from Ryan Herbst - * Sample Container - * Sample Data consists of the following: Z[xx:xx] = Zeros, O[xx:xx] = Ones - * Sample[0] = O[0], Z[0], Hybrid[1:0], Z[0], ApvChip[2:0], Z[0], Channel[6:0], FpgaAddress[15:0] - * Sample[1] = Z[1:0], Sample1[13:0]], Z[1:0], Sample0[13:0] - * Sample[2] = Z[1:0], Sample3[13:0]], Z[1:0], Sample2[13:0] - * Sample[3] = Z[1:0], Sample5[13:0]], Z[1:0], Sample4[13:0] - * - */ -package org.lcsim.hps.recon.tracking; - -/** - * - * @author neal - */ -public class HPSTrackerSample { - // Local data - - protected int ldata_[] = new int[4]; - // Data pointer - protected int data_[]; - - public void setData(int data[]) { - data_ = data; - } - //! Get hybrid index. - public int hybrid() { - return ((data_[0] >> 28) & 0x3); - } - //! Get apv index. - - public int apv() { - return ((data_[0] >> 24) & 0x7); - } - - //! Get channel index. - public int channel() { - return ((data_[0] >> 16) & 0x7F); - } - - //! Get FpgaAddress value from header. - public int fpgaAddress() { - return (data_[0] & 0xFFFF); - } - //! Get adc value at index. - - public int value(int index) { - switch (index) { - case 0: - return (data_[1] & 0x3FFF); - case 1: - return ((data_[1] >> 16) & 0x3FFF); - case 2: - return (data_[2] & 0x3FFF); - case 3: - return ((data_[2] >> 16) & 0x3FFF); - case 4: - return (data_[3] & 0x3FFF); - case 5: - return ((data_[3] >> 16) & 0x3FFF); - default: - return (0); - } - } -}
diff -N HPSTrackerEvent.java --- HPSTrackerEvent.java 28 Mar 2012 18:40:01 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,185 +0,0 @@
-/* - * Description : based on the C++ version from Ryan Herbst - * - * To change this template, choose Tools | Templates - * and open the template in the editor. - * Description : - * Event Container - * Event Data consists of the following: Z[xx:xx] = Zeros - * Frame Size = 1 x 32-bits (32-bit dwords) - * Header = 8 x 32-bits - * Header[0] = T[0], Z[14:0], FpgaAddress[15:0] - T = 1 For TI FPGA - * Header[1] = Sequence[31:0] -// - * The rest of the event header depends on the T flag, For T = 0: -// - * Header[2] = TempB[15:0], TempA[15:0] - * Header[3] = TempD[15:0], TempC[15:0] - * Header[4] = TempF[15:0], TempE[15:0] - * Header[5] = TempH[15:0], TempG[15:0] - * Header[6] = TempJ[15:0], TempI[15:0] - * Header[7] = TempL[15:0], TempK[15:0] - * Samples... (See HPSTrackerSample.java) - * Tail = 1 x 32-bits - * Should be zero - */ -package org.lcsim.hps.recon.tracking; - -import org.lcsim.hps.recon.tracking.HPSTrackerSample; - -/** - * - * @author neal - */ -public class HPSTrackerEvent extends HPSTrackerSample { - - double temp; - double tk; - double res; - double volt; - int idx; - - // Temperature Constants - double coeffA_ = -1.4141963e1; - double coeffB_ = 4.4307830e3; - double coeffC_ = -3.4078983e4; - double coeffD_ = -8.8941929e6; - double t25_ = 10000.0; - double k0_ = 273.15; - double vmax_ = 2.5; - double vref_ = 2.5; - double rdiv_ = 10000; - double minTemp_ = -50; - double maxTemp_ = 150; - double incTemp_ = 0.01; - int adcCnt_ = 4096; - - // Temperature lookup table - double tempTable_[] = new double[adcCnt_]; - - // Local trigger data - int tiData_[] = new int[7]; // What size can this grow to???? - - // Frame Constants - int headSize_ = 8; - int tailSize_ = 1; - int sampleSize_ = 4; - - // frame size must be set externally - int size_ = 0; - - public void TrackerEvent() { - - // Fill temperature lookup table - temp = minTemp_; - while (temp < maxTemp_) { - tk = k0_ + temp; - res = t25_ * Math.exp(coeffA_ + (coeffB_ / tk) + (coeffC_ / (tk * tk)) + (coeffD_ / (tk * tk * tk))); - volt = (res * vmax_) / (rdiv_ + res); - idx = (int) ((volt / vref_) * (double) (adcCnt_ - 1)); - if (idx < adcCnt_) { - tempTable_[idx] = temp; - } - temp += incTemp_; - } - } - - // Get TI flag from header - public boolean isTiFrame() { - return ((data_[0] & 0x80000000) != 0); - } - -// Get FpgaAddress value from header. - public int fpgaAddress() { - return (data_[0] & 0xFFFF); - } - -// Get sequence count from header. - public int sequence() { - return (data_[1]); - } - -// Get trigger block from header. - int[] tiData() { - for (int iti = 0; iti < tiData_.length; iti++) { - tiData_[iti] = data_[2 + iti]; - } - return (tiData_); - } - - // Set address of data buffer - public void setData(int indat[]) { - data_ = indat; - } - -// Set frame size - public void setSize(int sz) { - size_ = sz; - } - - // Get sample size value from header. - public int sampleSize() { - return ((data_[0] >> 8) & 0xF); - } - -// Get temperature values from header. - public double temperature(int index) { - if (isTiFrame()) { - return (0.0); - } else { - switch (index) { - case 0: - return (tempTable_[(data_[2] & 0x3FFF)]); - case 1: - return (tempTable_[((data_[2] >> 16) & 0x3FFF)]); - case 2: - return (tempTable_[(data_[3] & 0x3FFF)]); - case 3: - return (tempTable_[((data_[3] >> 16) & 0x3FFF)]); - case 4: - return (tempTable_[(data_[4] & 0x3FFF)]); - case 5: - return (tempTable_[((data_[4] >> 16) & 0x3FFF)]); - case 6: - return (tempTable_[(data_[5] & 0x3FFF)]); - case 7: - return (tempTable_[((data_[5] >> 16) & 0x3FFF)]); - case 8: - return (tempTable_[(data_[6] & 0x3FFF)]); - case 9: - return (tempTable_[((data_[6] >> 16) & 0x3FFF)]); - case 10: - return (tempTable_[(data_[7] & 0x3FFF)]); - case 11: - return (tempTable_[((data_[7] >> 16) & 0x3FFF)]); - default: - return (0.0); - } - } - - } - -// Get sample count - public int count() { -// return (128); -// int size_ = sampleSize(); -// System.out.println("count: size_ = " + size_); - return ((size_ - (headSize_ + tailSize_)) / sampleSize_); - } -// Get sample at index - - public HPSTrackerSample sample(int index) { - if (index >= count()) { // should be count() - return (null); - } else { - HPSTrackerSample sample_ = new HPSTrackerSample(); - for (int ii = 0; ii < sampleSize_; ii++) { - ldata_[ii] = data_[headSize_ + (index * sampleSize_) + ii]; -// System.out.println("ldata[" + ii + "] = " + ldata_[ii]); - } -// sample_.setData(data_[headSize_ + (index * sampleSize_)]); - sample_.setData(ldata_); - return (sample_); - } - } -}
diff -N HPSTrackerHit.java --- HPSTrackerHit.java 24 Apr 2012 14:07:45 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,43 +0,0 @@
-/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package org.lcsim.hps.recon.tracking; - -import org.lcsim.detector.identifier.Identifier; -import org.lcsim.event.RawTrackerHit; -import org.lcsim.event.base.BaseRawTrackerHit; - -/** - * - * @author mgraham - */ -public class HPSTrackerHit extends BaseRawTrackerHit{ - double t0; - double amp; - public HPSTrackerHit( - long id, - int time, - short[] adcValues, double t0, double Amp) { - this.cellId = id; - this.compactId = new Identifier(id); - this.time = time; - this.adcValues = adcValues; - this.t0=t0; - this.amp=Amp; - } - - public HPSTrackerHit( - RawTrackerHit rth, double t0, double Amp) { - this.cellId = rth.getCellID(); - this.compactId = new Identifier(rth.getCellID()); - this.time = rth.getTime(); - this.adcValues = rth.getADCValues(); - this.t0=t0; - this.amp=Amp; - } - - public double getT0(){return t0;} - public double getAmp(){return amp;} - -}
diff -N HPSEcalFlashTrigger.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ HPSEcalFlashTrigger.java 29 Apr 2012 02:10:05 -0000 1.1 @@ -0,0 +1,411 @@
+package org.lcsim.hps.users.omoreno; + +//--- Java ---// +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +//--- org.lcsim ---// +import org.lcsim.event.Cluster; +import org.lcsim.event.EventHeader; +import org.lcsim.hps.recon.ecal.HPSEcalClusterer; +import org.lcsim.hps.util.ClockSingleton; +import org.lcsim.util.Driver; + + +/** + * Heavy Photon Search ECal Flash Trigger + * + * @author Omar Moreno <[log in to unmask]> + * @version $Id: HPSEcalFlashTrigger.java,v 1.1 2012/04/29 02:10:05 meeg Exp $ + */ +public class HPSEcalFlashTrigger extends Driver +{ + // The HPS ECal Clusterer + HPSEcalClusterer ecalClusterer; + + String ecalRawHitsCollectionName = "EcalHits"; + String ecalClusterCollectionName = "EcalClusters"; + + // A list to contain all cluster pairs in an event + List<Cluster[]> clusterPairs; + + int nTriggers; + int totalEvents; + + private double clusterEnergyHigh = 1.85; // GeV + private double clusterEnergyLow = .1; // GeV + private double energySumThreshold = 2; // GeV + private double energyDifferenceThreshold = 1.5; // GeV + private double maxCoplanarityAngle = 35; // degrees + + + /** + * Constructor + */ + public HPSEcalFlashTrigger( ) + { + // Instantiate the HPS Clusterer + ecalClusterer = new HPSEcalClusterer(); + ecalClusterer.setClusterCollectionName( ecalClusterCollectionName ); + ecalClusterer.setEcalCollectionName( ecalRawHitsCollectionName ); + ecalClusterer.setEcalName( "Ecal" ); + add( ecalClusterer ); + + clusterPairs = new ArrayList<Cluster[]>(); + } + + @Override + public void process(EventHeader event) + { + + super.process(event); + totalEvents +=1; + + // Get a list of all clusters found by the clusterer in the event + List< Cluster > ecalClusters + = event.get(Cluster.class, ecalClusterCollectionName); + + //--- Apply Trigger Cuts ---// + + // Require that the event have at least two clusters in opposite + // quadrants + if ( !getClusterPairs( ecalClusters ) ) return; + + // Iterate through all cluster pairs present in the event. If at least + // one of the cluster pairs satisfies all of the trigger conditions, + // a trigger signal is sent to all other detectors. + for( Iterator it = clusterPairs.iterator(); it.hasNext(); ){ + + Cluster[] clusterPair = (Cluster[]) it.next(); + + // Require the componets of a cluster pair to have an energy in + // the range of 100 MeV to 1.85 GeV + if( !clusterECut( clusterPair ) ) continue; + + // Require the sum of the energies of the components of the + // cluster pair to be less than the + // (Beam Energy)*(Sampling Fraction) ( 2 GeV for the Test Run ) + if( !energySum( clusterPair ) ) continue; + + // Require the difference in energy of the components of the + // cluster pair to be less than 1.5 GeV + if( !energyDifference( clusterPair ) ) continue; + + // Apply a low energy cluster vs. distance cut of the form + // E_low + .0032 GeV/mm < .8 GeV + if( !energyDistanceCut( clusterPair ) ) continue; + + // Require that the two clusters are coplanar with the beam within + // 35 degrees + if( !coplanarityCut( clusterPair ) ) continue; + + // If all cuts are pased, send a trigger signal +// sendTrigger( ); + + // Increment number of triggers + nTriggers +=1; + + // Only require that at least one cluster pair passes all the + // trigger cuts + break; + } + } + + /** + * Run before any processes are called + */ + @Override + public void startOfData() + { + nTriggers = 0; + totalEvents = 0; + } + + /** + * Run after all data has been processed + */ + @Override + public void endOfData( ) { + + System.out.println( "Total Number of Triggers: " + nTriggers ); + System.out.println( "The Trigger Rate: " + + ( (( double )nTriggers/( double )totalEvents))*100. + "%" ); + } + + /** + * Get a list of all unique cluster pairs in the event + * + * @param ecalClusters : List of ECal clusters + * @return true if there are any cluster pairs + */ + public boolean getClusterPairs(List<Cluster> ecalClusters) + { + + // Check to see if there are at least two clusters + if (ecalClusters.size() < 2) return false; + + // Create a list which will hold all neighboring cluster to the cluster + // of interest + List< Cluster> ecalClusterNeighbors = new ArrayList< Cluster >(); + for (Cluster ecalCluster : ecalClusters) { + ecalClusterNeighbors.add(ecalCluster); + } + + // Clear the list of cluster pairs + clusterPairs.clear(); + + for ( Cluster ecalCluster : ecalClusters ) { + + // Get the quadrant which contains the ECal cluster of interest + int ecalClusterQuad = getECalQuadrant(ecalCluster); + + // Create a list of neighbors to the cluster of interest + ecalClusterNeighbors.remove(ecalCluster); + + // Loop over all neigboring clusters and check to see if there is + // any which lie in opposing quadrants to the cluster of interest. + // If so, add them to the list of cluster pairs + for (Cluster ecalClusterNeighbor : ecalClusterNeighbors ){ + + switch (ecalClusterQuad) { + case 1: + if ( getECalQuadrant( ecalClusterNeighbor ) == 3 ){ + Cluster[] clusterPair + = { ecalCluster, ecalClusterNeighbor }; + clusterPairs.add( clusterPair ); + } + break; + case 2: + if ( getECalQuadrant( ecalClusterNeighbor ) == 4 ){ + Cluster[] clusterPair + = { ecalCluster, ecalClusterNeighbor }; + clusterPairs.add( clusterPair ); + } + break; + case 3: + if ( getECalQuadrant( ecalClusterNeighbor ) == 1 ) { + Cluster[] clusterPair + = { ecalCluster, ecalClusterNeighbor }; + clusterPairs.add(clusterPair); + } + break; + case 4: + if ( getECalQuadrant( ecalClusterNeighbor ) == 2 ) { + Cluster[] clusterPair + = { ecalCluster, ecalClusterNeighbor }; + clusterPairs.add(clusterPair); + } + break; + } + } + } + + return !clusterPairs.isEmpty(); + } + + /** + * Checks if the ECal clusters making up a cluster pair lie above the low + * energy threshold and below the high energy threshold + * + * @param clusterPair : pair of clusters + * @return true if a pair is found, false otherwise + */ + public boolean clusterECut( Cluster[] clusterPair ) + { + + if( clusterPair[ 0 ].getEnergy( ) < clusterEnergyHigh + && clusterPair[ 1 ].getEnergy( ) < clusterEnergyHigh + && clusterPair[ 0 ].getEnergy( ) > clusterEnergyLow + && clusterPair[ 1 ].getEnergy( ) > clusterEnergyLow ) + return true; + + return false; + } + + /** + * Returns the quadrant which contains the ECal cluster + * + * @param ecalCluster : ECal cluster + * @return Quadrant number + */ + public int getECalQuadrant(Cluster ecalCluster) + { + double[] clusterPosition = ecalCluster.getPosition(); + + // Quadrant 1 + if(( clusterPosition[0] > 0.0 ) && ( clusterPosition[1] > 0.0 )) + return 1; + //Quadrant 2 + if(( clusterPosition[0] < 0.0 ) && ( clusterPosition[1] > 0.0 )) + return 2; + // Quadrant 3 + if(( clusterPosition[0] < 0.0 ) && ( clusterPosition[1] < 0.0 )) + return 3; + // Quadrant 4 + return 4; + } + + /** + * Checks if the sum of the energies of ECal clusters making up a cluster + * pair is below an energy sum threshold + * + * @param clusterPair : pair of clusters + * @return true if a pair is found, false otherwise + */ + public boolean energySum( Cluster[] clusterPair ) + { + double clusterESum = clusterPair[ 0 ].getEnergy() + + clusterPair[ 1 ].getEnergy(); + if( clusterESum < energySumThreshold ) return true; + + return false; + } + + /** + * Checks if the energy difference between the ECal clusters making up + * a cluster pair is below an energy difference threshold + * + * @param clusterPair : pair of clusters + * @return true if pair is found, false otherwise + */ + public boolean energyDifference( Cluster[] clusterPair ) + { + double clusterEDifference + = Math.abs( clusterPair[ 0 ].getEnergy( ) + - clusterPair[ 1 ].getEnergy() ); + + if( clusterEDifference < energyDifferenceThreshold ) + return true; + + return false; + + } + + /** + * Require that the distance from the beam of the lowest energy cluster + * in a cluster pair satisfies the following + * E_low + d_b*.0032 GeV/mm < .8 GeV + * + * @param clusterPiar : pair of clusters + * @return true if pair is found, false otherwise + */ + public boolean energyDistanceCut( Cluster[] clusterPair ) + { + Cluster lowEnergyCluster; + + // Obtain the lowest energy cluster + if( clusterPair[0].getEnergy() < clusterPair[1].getEnergy() ) + lowEnergyCluster = clusterPair[0]; + else lowEnergyCluster = clusterPair[1]; + + // Calculate its position + double lowEClusterPosition + = Math.sqrt( Math.pow( lowEnergyCluster.getPosition()[0], 2) + + Math.pow( lowEnergyCluster.getPosition()[1], 2) ); + + double clusterDistvsE + = lowEnergyCluster.getEnergy() + lowEClusterPosition*(0.0032); + + if( clusterDistvsE > .8 /* GeV */ ) return true; + + return false; + } + + /** + * Checks if a cluster pair is coplanar to the beam within a given + * angle + * + * @param clusterPair : pair of clusters + * @return true if pair is found, false otherwise + */ + public boolean coplanarityCut( Cluster[] clusterPair ) + { + // Find the distance of both clusters from the origin + double cluster1Dist + = Math.sqrt( Math.pow( clusterPair[0].getPosition()[0],2 ) + + Math.pow( clusterPair[0].getPosition()[1],2) ); + double cluster2Dist + = Math.sqrt( Math.pow( clusterPair[1].getPosition()[0],2 ) + + Math.pow( clusterPair[1].getPosition()[1],2) ); + + // Calculate the dot product between the distance vectors of + // each cluster in the cluster pair + double clusterDot + = clusterPair[0].getPosition()[0]*clusterPair[1].getPosition()[0] + +clusterPair[0].getPosition()[1]*clusterPair[1].getPosition()[1]; + + // Find the angle between clusters in the pair + double cosphi = clusterDot/( cluster1Dist*cluster2Dist ); + double phi = Math.toDegrees( Math.acos( cosphi ) ); + + if( (180 - phi ) < maxCoplanarityAngle ) return true; + + return false; + + } + + /** + * Sends an ECal trigger signal + */ + public void sendTrigger() + { + ClockSingleton.setTrigger(); + } + + /** + * Set the upper energy cluster threshold + * + * @param highThreshold : Threshold in GeV + */ + public void setUpperETheshold( double highThreshold ) + { + + clusterEnergyHigh = highThreshold; + } + + /** + * Set the lower energy cluster threshold + * + * @param lowThrehold : Threshold in GeV + */ + public void setLowerEThreshold( double lowThreshold ) + { + + clusterEnergyLow = lowThreshold; + } + + /** + * Set the threshold on the sum of the two cluster energies + * + * @param sumThreshold : Threshold in GeV + */ + public void setESumThreshold( double sumThreshold ) + { + + energySumThreshold = sumThreshold; + } + + /** + * Set the threshold on the energy difference between two cluster energies + * + * @param diffThreshold : Threshold in GeV + */ + public void setEDiffThrehold( double diffThreshold ) + { + + energyDifferenceThreshold = diffThreshold; + } + + /** + * Set the maximum angle required to achieve coplanarity between the + * clusters and the beam + * + * @param maxCoplanarity : Maximum angle in degrees + */ + public void setMaxCoplanarityAngle( double maxCoplanarity ) + { + maxCoplanarityAngle = maxCoplanarity; + } + +}
diff -u -r1.2 -r1.3 --- HPSTestRunDriver.java 3 Jan 2012 19:55:09 -0000 1.2 +++ HPSTestRunDriver.java 29 Apr 2012 02:10:05 -0000 1.3 @@ -13,7 +13,6 @@
//--- HPS Java ---// import org.lcsim.hps.recon.tracking.SiTrackerSpectrometerSensorSetup;
-import org.lcsim.hps.recon.ecal.HPSEcalFlashTrigger;
//import org.lcsim.hps.users.omoreno.tracking.HPSTrackerHitDriverL3; //import org.lcsim.hps.recon.tracking.HPSAPV25.HPSSVTHitDriver; import org.lcsim.hps.util.ClockSingleton;
@@ -21,7 +20,7 @@
/** * * @author Omar Moreno <[log in to unmask]>
- * @version $Id: HPSTestRunDriver.java,v 1.2 2012/01/03 19:55:09 omoreno Exp $
+ * @version $Id: HPSTestRunDriver.java,v 1.3 2012/04/29 02:10:05 meeg Exp $
*/ public class HPSTestRunDriver extends Driver {
diff -N HPSTrackerHit.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ HPSTrackerHit.java 29 Apr 2012 02:10:05 -0000 1.1 @@ -0,0 +1,43 @@
+/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package org.lcsim.hps.users.mgraham; + +import org.lcsim.detector.identifier.Identifier; +import org.lcsim.event.RawTrackerHit; +import org.lcsim.event.base.BaseRawTrackerHit; + +/** + * + * @author mgraham + */ +public class HPSTrackerHit extends BaseRawTrackerHit{ + double t0; + double amp; + public HPSTrackerHit( + long id, + int time, + short[] adcValues, double t0, double Amp) { + this.cellId = id; + this.compactId = new Identifier(id); + this.time = time; + this.adcValues = adcValues; + this.t0=t0; + this.amp=Amp; + } + + public HPSTrackerHit( + RawTrackerHit rth, double t0, double Amp) { + this.cellId = rth.getCellID(); + this.compactId = new Identifier(rth.getCellID()); + this.time = rth.getTime(); + this.adcValues = rth.getADCValues(); + this.t0=t0; + this.amp=Amp; + } + + public double getT0(){return t0;} + public double getAmp(){return amp;} + +}
diff -N HPSTrackerEvent.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ HPSTrackerEvent.java 29 Apr 2012 02:10:05 -0000 1.1 @@ -0,0 +1,183 @@
+/* + * Description : based on the C++ version from Ryan Herbst + * + * To change this template, choose Tools | Templates + * and open the template in the editor. + * Description : + * Event Container + * Event Data consists of the following: Z[xx:xx] = Zeros + * Frame Size = 1 x 32-bits (32-bit dwords) + * Header = 8 x 32-bits + * Header[0] = T[0], Z[14:0], FpgaAddress[15:0] - T = 1 For TI FPGA + * Header[1] = Sequence[31:0] +// + * The rest of the event header depends on the T flag, For T = 0: +// + * Header[2] = TempB[15:0], TempA[15:0] + * Header[3] = TempD[15:0], TempC[15:0] + * Header[4] = TempF[15:0], TempE[15:0] + * Header[5] = TempH[15:0], TempG[15:0] + * Header[6] = TempJ[15:0], TempI[15:0] + * Header[7] = TempL[15:0], TempK[15:0] + * Samples... (See HPSTrackerSample.java) + * Tail = 1 x 32-bits + * Should be zero + */ +package org.lcsim.hps.users.homer; + +/** + * + * @author neal + */ +public class HPSTrackerEvent extends HPSTrackerSample { + + double temp; + double tk; + double res; + double volt; + int idx; + + // Temperature Constants + double coeffA_ = -1.4141963e1; + double coeffB_ = 4.4307830e3; + double coeffC_ = -3.4078983e4; + double coeffD_ = -8.8941929e6; + double t25_ = 10000.0; + double k0_ = 273.15; + double vmax_ = 2.5; + double vref_ = 2.5; + double rdiv_ = 10000; + double minTemp_ = -50; + double maxTemp_ = 150; + double incTemp_ = 0.01; + int adcCnt_ = 4096; + + // Temperature lookup table + double tempTable_[] = new double[adcCnt_]; + + // Local trigger data + int tiData_[] = new int[7]; // What size can this grow to???? + + // Frame Constants + int headSize_ = 8; + int tailSize_ = 1; + int sampleSize_ = 4; + + // frame size must be set externally + int size_ = 0; + + public void TrackerEvent() { + + // Fill temperature lookup table + temp = minTemp_; + while (temp < maxTemp_) { + tk = k0_ + temp; + res = t25_ * Math.exp(coeffA_ + (coeffB_ / tk) + (coeffC_ / (tk * tk)) + (coeffD_ / (tk * tk * tk))); + volt = (res * vmax_) / (rdiv_ + res); + idx = (int) ((volt / vref_) * (double) (adcCnt_ - 1)); + if (idx < adcCnt_) { + tempTable_[idx] = temp; + } + temp += incTemp_; + } + } + + // Get TI flag from header + public boolean isTiFrame() { + return ((data_[0] & 0x80000000) != 0); + } + +// Get FpgaAddress value from header. + public int fpgaAddress() { + return (data_[0] & 0xFFFF); + } + +// Get sequence count from header. + public int sequence() { + return (data_[1]); + } + +// Get trigger block from header. + int[] tiData() { + for (int iti = 0; iti < tiData_.length; iti++) { + tiData_[iti] = data_[2 + iti]; + } + return (tiData_); + } + + // Set address of data buffer + public void setData(int indat[]) { + data_ = indat; + } + +// Set frame size + public void setSize(int sz) { + size_ = sz; + } + + // Get sample size value from header. + public int sampleSize() { + return ((data_[0] >> 8) & 0xF); + } + +// Get temperature values from header. + public double temperature(int index) { + if (isTiFrame()) { + return (0.0); + } else { + switch (index) { + case 0: + return (tempTable_[(data_[2] & 0x3FFF)]); + case 1: + return (tempTable_[((data_[2] >> 16) & 0x3FFF)]); + case 2: + return (tempTable_[(data_[3] & 0x3FFF)]); + case 3: + return (tempTable_[((data_[3] >> 16) & 0x3FFF)]); + case 4: + return (tempTable_[(data_[4] & 0x3FFF)]); + case 5: + return (tempTable_[((data_[4] >> 16) & 0x3FFF)]); + case 6: + return (tempTable_[(data_[5] & 0x3FFF)]); + case 7: + return (tempTable_[((data_[5] >> 16) & 0x3FFF)]); + case 8: + return (tempTable_[(data_[6] & 0x3FFF)]); + case 9: + return (tempTable_[((data_[6] >> 16) & 0x3FFF)]); + case 10: + return (tempTable_[(data_[7] & 0x3FFF)]); + case 11: + return (tempTable_[((data_[7] >> 16) & 0x3FFF)]); + default: + return (0.0); + } + } + + } + +// Get sample count + public int count() { +// return (128); +// int size_ = sampleSize(); +// System.out.println("count: size_ = " + size_); + return ((size_ - (headSize_ + tailSize_)) / sampleSize_); + } +// Get sample at index + + public HPSTrackerSample sample(int index) { + if (index >= count()) { // should be count() + return (null); + } else { + HPSTrackerSample sample_ = new HPSTrackerSample(); + for (int ii = 0; ii < sampleSize_; ii++) { + ldata_[ii] = data_[headSize_ + (index * sampleSize_) + ii]; +// System.out.println("ldata[" + ii + "] = " + ldata_[ii]); + } +// sample_.setData(data_[headSize_ + (index * sampleSize_)]); + sample_.setData(ldata_); + return (sample_); + } + } +}
diff -N HPSTrackerSample.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ HPSTrackerSample.java 29 Apr 2012 02:10:06 -0000 1.1 @@ -0,0 +1,66 @@
+/* + * Description : based on the C++ version from Ryan Herbst + * Sample Container + * Sample Data consists of the following: Z[xx:xx] = Zeros, O[xx:xx] = Ones + * Sample[0] = O[0], Z[0], Hybrid[1:0], Z[0], ApvChip[2:0], Z[0], Channel[6:0], FpgaAddress[15:0] + * Sample[1] = Z[1:0], Sample1[13:0]], Z[1:0], Sample0[13:0] + * Sample[2] = Z[1:0], Sample3[13:0]], Z[1:0], Sample2[13:0] + * Sample[3] = Z[1:0], Sample5[13:0]], Z[1:0], Sample4[13:0] + * + */ +package org.lcsim.hps.users.homer; + +/** + * + * @author neal + */ +public class HPSTrackerSample { + // Local data + + protected int ldata_[] = new int[4]; + // Data pointer + protected int data_[]; + + public void setData(int data[]) { + data_ = data; + } + //! Get hybrid index. + public int hybrid() { + return ((data_[0] >> 28) & 0x3); + } + //! Get apv index. + + public int apv() { + return ((data_[0] >> 24) & 0x7); + } + + //! Get channel index. + public int channel() { + return ((data_[0] >> 16) & 0x7F); + } + + //! Get FpgaAddress value from header. + public int fpgaAddress() { + return (data_[0] & 0xFFFF); + } + //! Get adc value at index. + + public int value(int index) { + switch (index) { + case 0: + return (data_[1] & 0x3FFF); + case 1: + return ((data_[1] >> 16) & 0x3FFF); + case 2: + return (data_[2] & 0x3FFF); + case 3: + return ((data_[2] >> 16) & 0x3FFF); + case 4: + return (data_[3] & 0x3FFF); + case 5: + return ((data_[3] >> 16) & 0x3FFF); + default: + return (0); + } + } +}
diff -u -r1.4 -r1.5 --- OnlineTracking.lcsim 28 Apr 2012 21:03:47 -0000 1.4 +++ OnlineTracking.lcsim 29 Apr 2012 02:10:06 -0000 1.5 @@ -19,7 +19,6 @@
<driver name="HPSSVTDAQMaps" type="org.lcsim.hps.recon.tracking.HPSSVTDAQMaps"/> <driver name="SVTDataToRawTrackerHitDriver" type="org.lcsim.hps.recon.tracking.SVTDataToRawTrackerHitDriver"/> <driver name="HPSRawTrackerHitFitterDriver" type="org.lcsim.hps.recon.tracking.HPSRawTrackerHitFitterDriver">
- <debug>true</debug>
<fitAlgorithm>Analytic</fitAlgorithm> </driver> <driver name="TrackerHitDriver" type="org.lcsim.hps.users.mgraham.DataTrackerHitDriver">
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