Commit in hps-java/src/main/java/org/lcsim/hps/readout/ecal on MAIN | |||
FADCTriggerVariableDriver.java | +98 | added 1.1 |
Dump fadc vars
diff -N FADCTriggerVariableDriver.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ FADCTriggerVariableDriver.java 2 Sep 2013 21:57:12 -0000 1.1 @@ -0,0 +1,98 @@
+/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package org.lcsim.hps.readout.ecal; + +import java.io.FileNotFoundException; +import java.io.PrintWriter; +import java.util.EnumSet; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.lcsim.event.EventHeader; +import org.lcsim.geometry.Detector; +import org.lcsim.hps.recon.ecal.ECalUtils; +import org.lcsim.hps.recon.ecal.HPSEcalCluster; +import org.lcsim.hps.util.ClockSingleton; + +/** + * + * @author phansson + */ +public class FADCTriggerVariableDriver extends FADCTriggerDriver { + PrintWriter outputStream = null; + private int _pairs = 0; + + public FADCTriggerVariableDriver() { + if(!"".equals(outputFileName)) { + try { + outputStream = new PrintWriter(outputFileName); + } catch (FileNotFoundException ex) { + Logger.getLogger(FADCTriggerVariableDriver.class.getName()).log(Level.SEVERE, null, ex); + } + } + } + + @Override + public void detectorChanged(Detector detector) { + setBeamEnergy(getBeamEnergyFromDetector(detector)); + } + + @Override + public void startOfData() { + } + + @Override + public void process(EventHeader event) { + // super.process(event); + + if (event.hasCollection(HPSEcalCluster.class, clusterCollectionName)) { + + + List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, clusterCollectionName); + + + boolean clusterPairs1 = getClusterPairs(clusters); + + String str = "event/I:beamenergy/F:pairid/I:cl1E/F:cl1posx/I:cl1posy/I:cl2E/F:cl2posx/I:cl2posy/I"; + + int ipair = 0; + for(HPSEcalCluster[] pair : clusterPairs) { + + String evString = String.format("%d %f %d ", event.getEventNumber(),this.beamEnergy,ipair); + for(int icluster = 0; icluster!=2; icluster++ ) { + + HPSEcalCluster cluster = pair[icluster]; + + int quad = ECalUtils.getQuadrant(cluster); + double E = cluster.getEnergy(); + double pos[] = cluster.getSeedHit().getPosition(); + System.out.printf("x %f y %f ix %d iy %d \n", pos[0], pos[1], cluster.getSeedHit().getIdentifierFieldValue("ix"), cluster.getSeedHit().getIdentifierFieldValue("iy")); + + evString += String.format("%f %d %d ", E, pos[0], pos[1]); + } + outputStream.println(evString); + ++ipair; + ++_pairs; + } // pairs + + + } // has clusters + + + + } + + @Override + public void endOfData() { + + System.out.printf("%s: processed %d pairs\n",this.getClass().getSimpleName(),this._pairs); + + } + + + + + +}
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