Author: [log in to unmask]
Date: Wed Aug 19 19:26:45 2015
New Revision: 3374
Log:
updated trying to write out hit position
Modified:
java/branches/ecal-branch-442/ecal-recon/src/main/java/org/hps/recon/ecal/IterateGainFactorDriver.java
Modified: java/branches/ecal-branch-442/ecal-recon/src/main/java/org/hps/recon/ecal/IterateGainFactorDriver.java
=============================================================================
--- java/branches/ecal-branch-442/ecal-recon/src/main/java/org/hps/recon/ecal/IterateGainFactorDriver.java (original)
+++ java/branches/ecal-branch-442/ecal-recon/src/main/java/org/hps/recon/ecal/IterateGainFactorDriver.java Wed Aug 19 19:26:45 2015
@@ -13,6 +13,8 @@
import org.hps.conditions.ecal.EcalConditions;
import org.lcsim.event.CalorimeterHit;
import org.lcsim.event.EventHeader;
+import org.lcsim.geometry.Detector;
+import org.lcsim.lcio.LCIOConstants;
import org.lcsim.util.Driver;
/**
@@ -46,6 +48,9 @@
public void setOutputCollectionName(final String outputCollectionName) {
this.outputCollectionName = outputCollectionName;
}
+
+ private final String ecalReadoutName = "EcalHitsC";
+
/**
* Basic no argument constructor.
*/
@@ -96,6 +101,14 @@
}
+ @Override
+ public void detectorChanged(Detector detector) {
+ // ECAL combined conditions object.
+ ecalConditions = DatabaseConditionsManager.getInstance().getEcalConditions();
+ }
+
+
+
/**
* Copy hits to a new collection (list) while multiplying the energies by
* the new gain factors.
@@ -110,6 +123,7 @@
long cellID = hit.getCellID();
double energy = hit.getCorrectedEnergy()*gainFileGains.get(findChannelId(cellID));
CalorimeterHit newHit = CalorimeterHitUtilities.create(energy, time, cellID);
+ System.out.println("hit:\t"+energy+"\t"+newHit.getIdentifierFieldValue("ix"));
newHits.add(newHit);
}
@@ -122,7 +136,6 @@
*/
@Override
public void process(final EventHeader event) {
- ecalConditions = DatabaseConditionsManager.getInstance().getEcalConditions();
readGainFile();
// Check if output collection already exists in event which is an error.
@@ -134,11 +147,16 @@
if (event.hasCollection(CalorimeterHit.class,inputCollectionName)){
final List<CalorimeterHit> inputHitCollection = event.get(CalorimeterHit.class, inputCollectionName);
- // Iteerate the gain correction coefficient on each hit.
+ // Iterate the gain correction coefficient on each hit.
final List<CalorimeterHit> outputHitCollection = this.iterateHits(inputHitCollection);
+ 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
+
// Put the collection into the event.
- event.put(outputCollectionName, outputHitCollection, CalorimeterHit.class, 0);
+ event.put(outputCollectionName, outputHitCollection, CalorimeterHit.class, flags, ecalReadoutName);
+ System.out.println("Wrote hit collection");
}
}
|