java/trunk/users/src/main/java/org/hps/users/luca
--- java/trunk/users/src/main/java/org/hps/users/luca/ElectronAnalysis.java 2014-05-08 03:59:36 UTC (rev 564)
+++ java/trunk/users/src/main/java/org/hps/users/luca/ElectronAnalysis.java 2014-05-08 16:46:47 UTC (rev 565)
@@ -7,20 +7,10 @@
package org.hps.users.luca;
import hep.aida.IHistogram1D;
-import hep.aida.IHistogram2D;
-import hep.aida.IProfile2D;
-import java.io.BufferedWriter;
-import java.io.FileWriter;
-import java.io.IOException;
import java.util.List;
-import org.hps.readout.ecal.FADCEcalReadoutDriver;
-import org.hps.readout.ecal.RingBuffer;
-import org.hps.recon.ecal.ECalUtils;
-import org.hps.recon.ecal.EcalRawConverterDriver;
import org.hps.recon.ecal.HPSEcalCluster;
-import org.hps.recon.ecal.EcalClusterer;
import org.lcsim.event.CalorimeterHit;
import org.lcsim.event.EventHeader;
import org.lcsim.util.Driver;
@@ -31,56 +21,60 @@
* @author Luca
*/
public class ElectronAnalysis extends Driver {
-
//dichiaro la classe per i grafici e quelle per la ricostruzione qui invece che nello steering
private AIDA aida = AIDA.defaultInstance();
IHistogram1D enePlot = aida.histogram1D("energia", 1000, 0, 3);
- // IHistogram1D enePlotcorre = aida.histogram1D("energiacorretta", 1000, 0, 3);
+ IHistogram1D enePlotcorre = aida.histogram1D("energiacorretta", 1000, 0, 3);
- // FADCEcalReadoutDriver readoutDriver= new FADCEcalReadoutDriver();
- // EcalRawConverterDriver converterDriver = new EcalRawConverterDriver();
- // EcalClusterer ecalClusterer = new EcalClusterer();
- ///da qui vanno definiti gli istogrammi
+ // FADCEcalReadoutDriver readoutDriver= new FADCEcalReadoutDriver();
+ // EcalRawConverterDriver converterDriver = new EcalRawConverterDriver();
+ // EcalClusterer ecalClusterer = new EcalClusterer();
+ // da qui vanno definiti gli istogrammi
//start of data
-
@Override
public void startOfData() {
-
- // ecalClusterer.setEcalName("Ecal");
-
- //ecalClusterer.setEcalCollectionName("EcalCorrectedHits");
-
+ // ecalClusterer.setEcalName("Ecal");
+ // ecalClusterer.setEcalCollectionName("EcalCorrectedHits");
super.startOfData();
-
-
}
//inizio processo eventi
-
@Override
- public void process(EventHeader event){
- /* List<CalorimeterHit> hits = event.get(CalorimeterHit.class, "EcalHits");
- for(CalorimeterHit hit : hits){
- if(hit.getRawEnergy()>2){
- enePlot.fill(hit.getRawEnergy());}
- //enePlotcorre.fill(hit.getCorrectedEnergy());
- }
- */
- if( !event.hasCollection(HPSEcalCluster.class,"EcalClusters"))
- {System.out.println(" no clusters \n");} else {
- System.out.println("yes we cluster! \n");
- }
-// for(HPSEcalCluster cluster : clusters){
- // System.out.println(cluster.getSeedHit().getCellID());
-
- //}
-
-
-
+ public void process(EventHeader event) {
+ // Make sure that the event contains a hit collection.
+ if(event.hasCollection(CalorimeterHit.class, "EcalHits")) {
+ // Get the hit collection.
+ List<CalorimeterHit> hits = event.get(CalorimeterHit.class, "EcalHits");
+
+ // Generate histograms from the hits which exceed 2 GeV.
+ for(CalorimeterHit hit : hits){
+ if(hit.getRawEnergy() > 2){
+ enePlot.fill(hit.getRawEnergy());
+ enePlotcorre.fill(hit.getCorrectedEnergy());
+ }
+ }
+ }
+
+ // Make sure that the event contains a cluster collection.
+ if(event.hasCollection(HPSEcalCluster.class, "EcalClusters")) {
+ // Indicate that there are clusters.
+ System.out.println("Event contains clusters.");
+
+ // Get the cluster collection.
+ List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, "EcalClusters");
+
+ // Print the seed hits for the clusters.
+ for(HPSEcalCluster cluster : clusters){
+ System.out.printf("\t%d%n", cluster.getSeedHit().getCellID());
+ }
+ System.out.println("\n");
+ }
+
+ // Otherwise, indicate that there are no clusters.
+ else { System.out.println("Event does not contain clusters.\n"); }
}
-
}