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  August 2015

HPS-SVN August 2015

Subject:

r3385 - /java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalOnlineRawConverterDriver.java

From:

[log in to unmask]

Reply-To:

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

Date:

Thu, 20 Aug 2015 21:14:40 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (157 lines)

Author: [log in to unmask]
Date: Thu Aug 20 14:14:38 2015
New Revision: 3385

Log:
Copied EcalRawConverterDriver and kept only the parts used for FADC/SSP/trigger emulation and diagnostics and based on reading DAQConfig on the fly from EVIO.  This is now EcalOnlineRawConverterDriver and only to be used for trigger diagnostics studies with real data.  Eventually all the bits that were put in EcalRawConverterDriver for trigger diagnostics should be removed.

Added:
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalOnlineRawConverterDriver.java

Added: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalOnlineRawConverterDriver.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalOnlineRawConverterDriver.java	(added)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/EcalOnlineRawConverterDriver.java	Thu Aug 20 14:14:38 2015
@@ -0,0 +1,141 @@
+package org.hps.recon.ecal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hps.recon.ecal.daqconfig.ConfigurationManager;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.GenericObject;
+import org.lcsim.event.LCRelation;
+import org.lcsim.event.RawCalorimeterHit;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.lcio.LCIOConstants;
+import org.lcsim.util.Driver;
+
+/**
+ * This class is used to convert between collections of {@link org.lcsim.event.RawCalorimeterHit}
+ * and {@link org.lcsim.event.RawTrackerHit}, objects with ADC/sample information, and
+ * collections of {@link org.lcsim.event.CalorimeterHit}, objects with energy/time information.
+ * 
+ * org.hps.recon.ecal.EcalRawConverter is called to do most of the lower level work.
+ *
+ *
+*/
+public class EcalOnlineRawConverterDriver extends Driver {
+
+    private EcalOnlineRawConverter converter = null;
+    /**
+     * Input collection name
+     * Can be a {@link org.lcsim.event.RawTrackerHit} or {@link org.lcsim.event.RawCalorimeterHit}
+     * These have ADC and sample time information.
+     */
+    private String rawCollectionName = "EcalReadoutHits";
+    
+    /**
+     * Output collection name
+     * Always a {@link org.lcsim.event.CalorimeterHit}
+     * This has energy (GeV) and ns time information.
+     */
+    private String ecalCollectionName = "EcalCalHits";
+
+    /**
+     * ecalCollectionName "type" (must match detector-data) 
+     */
+    private final String ecalReadoutName = "EcalHits";
+
+    /*
+     * Output relation between ecalCollectionName and Mode-7 pedestals
+     */
+    private static final String extraDataRelationsName = "EcalReadoutExtraDataRelations";
+
+    public EcalOnlineRawConverterDriver() {
+        converter = new EcalOnlineRawConverter();
+    }
+
+    /**
+     * Set the output {@link org.lcsim.event.CalorimeterHit} collection name,
+     * 
+     * @param ecalCollectionName The <code>CalorimeterHit</code> collection name.
+     */
+    public void setEcalCollectionName(String ecalCollectionName) {
+        this.ecalCollectionName = ecalCollectionName;
+    }
+
+    /**
+     * Set the input raw collection name
+     * <p>
+     * Depending on the Driver configuration, this could be a collection
+     * of {@link org.lcsim.event.RawTrackerHit} objects for Mode-1
+     * or {@link org.lcsim.event.RawCalorimeterHit} objects for Mode-3
+     * or Mode-7.
+     * 
+     * @param rawCollectionName The raw collection name.
+     */
+    public void setRawCollectionName(String rawCollectionName) {
+        this.rawCollectionName = rawCollectionName;
+    }
+
+    @Override
+    public void startOfData() {
+        if (ecalCollectionName == null) {
+            throw new RuntimeException("The parameter ecalCollectionName was not set!");
+        }
+    }
+
+    @Override
+    public void process(EventHeader event) {
+    	// Do not process the event if the DAQ configuration should be
+    	// used for value, but is not initialized.
+    	if(!ConfigurationManager.isInitialized()) {
+    		return;
+    	}
+    	
+        double timeOffset = 0.0;
+        int flags = 0;
+        flags += 1 << LCIOConstants.RCHBIT_TIME; //store hit time
+        flags += 1 << LCIOConstants.RCHBIT_LONG; //store hit position; this flag has no effect for RawCalorimeterHits
+
+        ArrayList<CalorimeterHit> newHits = new ArrayList<CalorimeterHit>();
+
+        /*
+         * This is for FADC Mode-1 data:    
+         */
+        if (event.hasCollection(RawTrackerHit.class, rawCollectionName)) {
+        	List<RawTrackerHit> hits = event.get(RawTrackerHit.class, rawCollectionName);
+
+        	for (RawTrackerHit hit : hits) {
+        		newHits.addAll(converter.HitDtoA(event,hit));
+        	}
+        	event.put(ecalCollectionName, newHits, CalorimeterHit.class, flags, ecalReadoutName);
+        }
+
+        /*
+         * This is for FADC pulse mode data (Mode-3 or Mode-7):
+         */
+        if (event.hasCollection(RawCalorimeterHit.class, rawCollectionName)) { 
+
+        	/*
+        	 * This is for FADC Mode-7 data:
+        	 */
+        	if (event.hasCollection(LCRelation.class, extraDataRelationsName)) { // extra information available from mode 7 readout
+        		List<LCRelation> extraDataRelations = event.get(LCRelation.class, extraDataRelationsName);
+        		for (LCRelation rel : extraDataRelations) {
+        			RawCalorimeterHit hit = (RawCalorimeterHit) rel.getFrom();
+        			GenericObject extraData = (GenericObject) rel.getTo();
+        			newHits.add(converter.HitDtoA(event,hit, extraData, timeOffset));
+        		}
+        	} else {
+        		/*
+        		 * This is for FADC Mode-3 data:
+        		 */
+        		List<RawCalorimeterHit> hits = event.get(RawCalorimeterHit.class, rawCollectionName);
+        		for (RawCalorimeterHit hit : hits) {
+        			newHits.add(converter.HitDtoA(event, hit, timeOffset));
+        		}
+        	}
+        	event.put(ecalCollectionName, newHits, CalorimeterHit.class, flags, ecalReadoutName);
+        }
+    }
+
+}

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