1 added + 4 modified, total 5 files
java/trunk/users/src/main/java/org/hps/users/luca
--- java/trunk/users/src/main/java/org/hps/users/luca/CalibTest2.java 2014-06-09 20:02:48 UTC (rev 694)
+++ java/trunk/users/src/main/java/org/hps/users/luca/CalibTest2.java 2014-06-10 12:34:34 UTC (rev 695)
@@ -5,34 +5,17 @@
import hep.aida.IHistogram2D;
import java.io.IOException;
import java.io.*;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
+
+
import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.lang.String;
-import java.lang.Math;
-import org.hps.recon.ecal.ECalUtils;
-import org.hps.recon.ecal.HPSEcalCluster;
-import org.lcsim.event.CalorimeterHit;
+
import org.lcsim.event.EventHeader;
-import org.lcsim.event.ParticleID;
-import org.lcsim.geometry.Detector;
-import org.lcsim.geometry.subdetector.HPSEcal3;
-import org.lcsim.geometry.subdetector.HPSEcal3.NeighborMap;
-import org.lcsim.lcio.LCIOConstants;
-import org.lcsim.util.Driver;
-import java.util.List;
-import org.lcsim.event.Cluster;
-import org.lcsim.event.EventHeader;
import org.lcsim.event.MCParticle;
-import org.lcsim.event.SimCalorimeterHit;
-import org.lcsim.event.SimTrackerHit;
-import org.lcsim.event.Track;
+
import org.lcsim.util.Driver;
-import org.lcsim.event.base.CalorimeterHitImpl;
+
import org.lcsim.util.aida.AIDA;
+
/**
* <code>CalbTest2</code> reads the requested information from a SLIC output (non-reconstructed) slcio file and print
* the results into a text format that can be read offline
@@ -45,46 +28,47 @@
// the class has to be derived from the driver class
public class CalibTest2 extends Driver {
-private FileWriter writer;
-String outputFileName = "elettrons.txt";
+/*private FileWriter writer;
+private FileWriter writer2;
+String outputFileName = "coulombelectrons.txt";
+String outputFileName2 = "coulombelectronsStopped.txt";*/
private AIDA aida = AIDA.defaultInstance();
- IHistogram1D thetaPlot = aida.histogram1D("theta", 100, 0.0, 0.3);
- IHistogram2D pulses = aida.histogram2D("pulses",100,-3.0,3.0,100,-3.0,3.0);
- IHistogram1D eneMCPlot = aida.histogram1D("energia elettroni coulomb", 100, 0.0, 3);
- IHistogram1D enetuttiPlot = aida.histogram1D("energia tutti", 100, 0.0, 0.3);
- IHistogram1D eneTuttiEmenoPlot = aida.histogram1D("energia tutti elettroni", 100, 0.0, 0.3);
-public void setOutputFileName(String outputFileName){
+
+
+ IHistogram1D eneMCallPlot = aida.histogram1D("All MCParticles Energy", 300, 0.0, 3);
+ IHistogram1D eneEminusPlot = aida.histogram1D("All electrons Energy", 300, 0.0, 3);
+ IHistogram1D eneCoulombEPlot = aida.histogram1D("Coulomb Electrons", 300, 0.0, 3);
+ IHistogram1D ParticleIdPlot = aida.histogram1D("ParticleId", 100,-50, 50);
+/*public void setOutputFileName(String outputFileName){
this.outputFileName = outputFileName;
-}
- @Override
+}*/
+/* @Override
public void startOfData(){
try{
//initialize the writer
writer=new FileWriter(outputFileName);
+ writer2=new FileWriter(outputFileName2);
//Clear the file
writer.write("");
+ writer2.write("");
}
catch(IOException e ){
System.err.println("Error initializing output file for event display.");
}
-}
- @Override
+}*/
+/* @Override
public void endOfData(){
try{
//close the file writer.
writer.close();
+ writer2.close();
}
catch(IOException e){
System.err.println("Error closing utput file for event display.");
}
-}
- int counter=0;
- double theta=0; //theta angle
- double PTOT;//total quadrimomentum
- // constructor
-// public CalibTest2() {
- // }
+}*/
+
// overwrite the process method
@Override
protected void process(EventHeader event) {
@@ -93,36 +77,20 @@
if(event.hasCollection(MCParticle.class,"MCParticle"))
{
List<MCParticle> mcParticles = event.get(MCParticle.class,"MCParticle");
-
- // try{
- for (MCParticle particle : mcParticles)
- { enetuttiPlot.fill(particle.getEnergy());
- if(particle.getPDGID()>0)
- { eneTuttiEmenoPlot.fill(particle.getEnergy());
- if(particle.getEnergy()> 2.1)
- {
- PTOT=Math.sqrt(particle.getPX()*particle.getPX() + particle.getPY()*particle.getPY()+particle.getPZ()*particle.getPZ() );
- theta=Math.acos(particle.getPZ()/PTOT);
- counter++;
- //writer.append(theta+" "+particle.getPX()+" "+particle.getPY()+"\n");
- thetaPlot.fill(theta);
- pulses.fill(particle.getPX(),particle.getPY());
- eneMCPlot.fill(particle.getEnergy());
- }
- // }
- //System.out.println(particle.getPDGID());
- }
- }
- }
-
- /* catch(IOException e ){
- System.err.println("Error writing tooutput for event display");
- }*/
- //System.out.println("ho contato" + counter + "elettroni. \n");
+ for(MCParticle particle : mcParticles){
+ ParticleIdPlot.fill(particle.getPDGID());
+ eneMCallPlot.fill(particle.getEnergy());
+ if(particle.getPDGID()==11)
+ {eneEminusPlot.fill(particle.getEnergy());}
+ if(particle.getPDGID()==1 && particle.getEnergy()>2.150)
+ {eneCoulombEPlot.fill(particle.getEnergy());}
-
-
+
+ }
+
+ }
+
}//end of Process
}//end of driver
\ No newline at end of file
java/trunk/users/src/main/java/org/hps/users/luca
--- java/trunk/users/src/main/java/org/hps/users/luca/myTriggerDriver.java 2014-06-09 20:02:48 UTC (rev 694)
+++ java/trunk/users/src/main/java/org/hps/users/luca/myTriggerDriver.java 2014-06-10 12:34:34 UTC (rev 695)
@@ -31,7 +31,7 @@
/**
* Reads clusters and makes trigger decision using opposite quadrant criterion.
* Prints triggers to file if file path specified.
- *
+ * @author Luca Colaneri <[log in to unmask]> making modification to study effects on coulomb electrons
* @author Omar Moreno <[log in to unmask]>
* @author Sho Uemura <[log in to unmask]>
* @version $Id: FADCTriggerDriver.java,v 1.4 2013/09/02 21:56:56 phansson Exp $
@@ -554,7 +554,7 @@
// To apply pair coincidence time, use only bottom clusters from the
// readout cycle pairCoincidence readout cycles ago, and top clusters
// from all 2*pairCoincidence+1 previous readout cycles
- for (HPSEcalCluster botCluster : botClusterQueue.element()) {
+ for (HPSEcalCluster botCluster : botClusterQueue.element()) { /////da come capisco sembra un for su tutti i cluster solo della testa della queue..e gli altri?
for (List<HPSEcalCluster> topClusters : topClusterQueue) {
for (HPSEcalCluster topCluster : topClusters) {
// System.out.format("%f\t%f\n", topCluster.getSeedHit().getTime(), botCluster.getSeedHit().getTime());
java/trunk/users/src/main/java/org/hps/users/luca
--- java/trunk/users/src/main/java/org/hps/users/luca/mycluster.java 2014-06-09 20:02:48 UTC (rev 694)
+++ java/trunk/users/src/main/java/org/hps/users/luca/mycluster.java 2014-06-10 12:34:34 UTC (rev 695)
@@ -9,10 +9,7 @@
import hep.aida.IHistogram2D;
import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.LinkedList;
+
import java.util.List;
import java.util.Queue;
import org.hps.readout.ecal.ClockSingleton;
@@ -36,31 +33,36 @@
*/
public class mycluster extends Driver {
- private FileWriter writer;
- String outputFileName = "HitEnePos.txt";
+ /* private FileWriter writer;
+ private FileWriter writer2;
+ String outputFileName = "ClusterEnePos1.txt";
+ String outputFileName2 = "ClusterEnePos2.txt";
+ int cx, cy;*/
-
int counter=0;
AIDA aida = AIDA.defaultInstance();
- IHistogram1D enePlot = aida.histogram1D("energia cluster", 100, 0.0,3.0);
- IHistogram2D positionPlot = aida.histogram2D("Posizione cluster", 60,-350,350,10,-100,100);
- IHistogram1D dimPlot = aida.histogram1D("dimensione cluster", 12, 0.0,12);
- IHistogram1D dimPlot2 = aida.histogram1D("dimensione cluster con taglio", 12, 0.0,12);
- IHistogram1D eneSeedHitPlot = aida.histogram1D("energia seedHit", 100, 0.0,3.0);
- IHistogram1D eneHitPlot = aida.histogram1D("energia dHit", 100, 0.2,3.0);
- IHistogram3D enePosPlot = aida.histogram3D("energia cluster vs posizione",350,-350,350,100,-100,100, 100, 0.0,3.0);
- double[] position;
+ IHistogram1D eneTuttiPlot = aida.histogram1D("All Hits Energy", 300, 0.0,3.0);
+ IHistogram1D eneTuttiPlotCut = aida.histogram1D("All Hits Energy E> 1GeV", 300, 0.0,3.0);
+ IHistogram1D eneClusterPlot = aida.histogram1D("All Clusters Energy", 300, 0.0,3.0);
+ IHistogram1D eneClusterPlotcut = aida.histogram1D("Clusters Energy E>1.4", 300, 0.0,3.0);
+ IHistogram1D eneSeedPlot = aida.histogram1D("All Seed Energy ", 300, 0.0,3.0);
+ IHistogram1D eneSeedPlotcut = aida.histogram1D(" Seed Energy (Cluster E>1.4)", 300, 0.0,3.0);
+
+
+
- public void setOutputFileName(String outputFileName){
+ /* public void setOutputFileName(String outputFileName){
this.outputFileName = outputFileName;
}
@Override
public void startOfData(){
try{
- //initialize the writer
+ //initialize the writers
writer=new FileWriter(outputFileName);
- //Clear the file
+ writer2=new FileWriter(outputFileName2);
+ //Clear the files
writer.write("");
+ writer2.write("");
}
catch(IOException e ){
System.err.println("Error initializing output file for event display.");
@@ -72,11 +74,12 @@
try{
//close the file writer.
writer.close();
+ writer2.close();
}
catch(IOException e){
System.err.println("Error closing utput file for event display.");
}
-}
+} */
@Override
public void process (EventHeader event){
@@ -87,40 +90,29 @@
{
List<CalorimeterHit> hits = event.get(CalorimeterHit.class,"EcalCorrectedHits");
for(CalorimeterHit hit : hits){
- if(hit.getRawEnergy()>0.6 &&hit.getRawEnergy()<2.3){
- eneHitPlot.fill(hit.getRawEnergy());
-
- }
+ eneTuttiPlot.fill(hit.getRawEnergy());
+ if(hit.getRawEnergy()>=1){
+ eneTuttiPlotCut.fill(hit.getRawEnergy());
}
-
+ }
+
+
+
}
if(event.hasCollection(HPSEcalCluster.class, "EcalClusters")) {
List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, "EcalClusters");
if(clusters.size() > 0) {
- counter++;
- for(HPSEcalCluster cluster : clusters){
-
-
- positionPlot.fill(cluster.getPosition()[0], cluster.getPosition()[1]);
- enePlot.fill(cluster.getEnergy());
- dimPlot.fill(cluster.getSize());
- eneSeedHitPlot.fill(cluster.getSeedHit().getRawEnergy());
- position=cluster.getPosition();
+ for(HPSEcalCluster cluster : clusters){
+ eneClusterPlot.fill(cluster.getEnergy());
+ eneSeedPlot.fill(cluster.getSeedHit().getRawEnergy());
+ if(cluster.getEnergy()>=1.4){
+ eneClusterPlotcut.fill(cluster.getEnergy());
+ eneSeedPlotcut.fill(cluster.getSeedHit().getRawEnergy());
+ }
- if(cluster.getSeedHit().getRawEnergy()>1)
- {dimPlot2.fill(cluster.getSize());}
- /* try{
- //writer.append(position[0] + " " + position[1] + " " +cluster.getSeedHit().getRawEnergy()+ "\n");
- }
-
- catch(IOException e ){System.err.println("Error writing to output for event display.");}*/
-
-
- }
-
-
+ }
}
}
java/trunk/users/src/main/java/org/hps/users/luca
--- java/trunk/users/src/main/java/org/hps/users/luca/mycluster2.java 2014-06-09 20:02:48 UTC (rev 694)
+++ java/trunk/users/src/main/java/org/hps/users/luca/mycluster2.java 2014-06-10 12:34:34 UTC (rev 695)
@@ -234,7 +234,7 @@
public int getCrystal (HPSEcalCluster cluster){
int x,y,id=0;
- x= -1*cluster.getSeedHit().getIdentifierFieldValue("ix");
+ x= (-1)*cluster.getSeedHit().getIdentifierFieldValue("ix");
y= cluster.getSeedHit().getIdentifierFieldValue("iy");
if(y==5){
@@ -259,14 +259,18 @@
else id=x+161;}
else if(y==1)
- {if(x<0){
- id=x+208;}
- else id=x+198;}
+ {x=-x;
+ if(x>0){
+ id=-x+208;}
+ else if(x==-1){id=208;}
+ else if(x<-1) id=-x+198;}
else if(y==-1)
- {if(x<0){
- id=x+245;}
- else id=x+235;}
+ {x=-x;
+ if(x>0){
+ id=-x+245;}
+ else if(x==-1 )id=245;
+ else if(x<-1){id=-x+257;}}
else if(y==-2)
{if(x<0){
java/trunk/users/src/main/java/org/hps/users/luca
--- java/trunk/users/src/main/java/org/hps/users/luca/mycluster3.java (rev 0)
+++ java/trunk/users/src/main/java/org/hps/users/luca/mycluster3.java 2014-06-10 12:34:34 UTC (rev 695)
@@ -0,0 +1,311 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.hps.users.luca;
+import hep.aida.IHistogram1D;
+import hep.aida.IHistogram2D;
+import java.io.IOException;
+import java.util.*;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Queue;
+import org.hps.readout.ecal.ClockSingleton;
+import org.hps.readout.ecal.TriggerDriver;
+
+import org.hps.recon.ecal.ECalUtils;
+import org.hps.recon.ecal.HPSEcalCluster;
+import org.lcsim.event.Cluster;
+import org.lcsim.event.EventHeader;
+import org.lcsim.geometry.Detector;
+import org.lcsim.util.aida.AIDA;
+import org.lcsim.util.Driver;
+import hep.aida.*;
+import hep.aida.IHistogram3D;
+import java.io.FileWriter;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.MCParticle;
+
+/**
+ *
+ * @author Luca Colaneri
+ */
+public class mycluster3 extends Driver {
+ int posx, posy;
+ int radius=2;
+ int Clustercount=0;
+ int clusterWindow=50;
+ int TotalCluster=0;
+ double timeDifference;
+ double energyThreshold=1.5;
+ private LinkedList<ArrayList<HPSEcalCluster>> clusterBuffer;
+ protected String clusterCollectionName = "EcalClusters";
+
+
+
+ private FileWriter writer;
+ //private FileWriter writer2;
+ String outputFileName = "ClusterInfonew.txt";
+ // String outputFileName2 = "ClusterEnePos2.txt";
+
+
+
+
+ public void setRadius (int radius){
+ this.radius=radius;
+ }
+
+ public void setEnergyThreshold (double threshold){
+ this.energyThreshold=threshold;
+ }
+
+ public void setClusterCollectionName(String clusterCollectionName) {
+ this.clusterCollectionName = clusterCollectionName;
+ }
+
+ public void setOutputFileName(String outputFileName){
+this.outputFileName = outputFileName;
+}
+ public void settimeDifference(double time){
+ this.timeDifference=time;
+
+ }
+ /*
+ *
+ *
+ *
+ */
+
+ @Override
+public void startOfData(){
+
+ //initialize the clusterbuffer
+ clusterBuffer= new LinkedList<ArrayList<HPSEcalCluster>>();
+ //populate the clusterbuffer with (2*clusterWindow + 1)
+ // empty events, representing the fact that the first few events will not have any events in the past portion of the buffer
+ int bufferSize=(2*clusterWindow)+1;
+ for(int i = 0;i<bufferSize; i++){
+ clusterBuffer.add(new ArrayList<HPSEcalCluster>(0));
+ }
+
+
+
+
+ try{
+ //initialize the writers
+ writer=new FileWriter(outputFileName);
+ // writer2=new FileWriter(outputFileName2);
+ //Clear the files
+ writer.write("");
+ // writer2.write("");
+}
+catch(IOException e ){
+System.err.println("Error initializing output file for event display.");
+}
+}
+
+@Override
+public void endOfData(){
+System.out.println("Ho contato" + TotalCluster + " clusters di cui " + Clustercount + "isolati\n");
+
+ try{
+//close the file writer.
+ writer.close();
+ // writer2.close();
+ }
+catch(IOException e){
+ System.err.println("Error closing utput file for event display.");
+}
+}
+
+ @Override
+ public void process (EventHeader event){
+
+
+
+
+
+ //get the clusters from the event
+ if(event.hasCollection(HPSEcalCluster.class, "EcalClusters")) {
+ List<HPSEcalCluster> clusterList =event.get(HPSEcalCluster.class,clusterCollectionName );
+
+ //put the clusters in the arraylist
+
+ ArrayList<HPSEcalCluster> clusterSet = new ArrayList<HPSEcalCluster>();
+ for(HPSEcalCluster cluster : clusterList){
+ TotalCluster++;
+ clusterSet.add(cluster);
+ }
+ //remove the last event from cluster buffer and add the new one
+ clusterBuffer.removeLast();
+ clusterBuffer.addFirst(clusterSet);
+ //Run the sorting algorithm;
+ ClusterAnalyzer();
+ }
+}
+
+
+ /**
+ * For each crystal, looks for clusters that hit that clystar, if it is an isolated cluster, it's put in goodclusterqueue
+ */
+ public void ClusterAnalyzer(){
+ //get the cluster list at the current time in the buffer
+ArrayList<HPSEcalCluster> currentClusters = clusterBuffer.get(clusterWindow+1);
+
+
+ ///cerca i cluster nella posizione che ci interessa poi chiama la funzione che decide se sono "isolati"
+ //System.out.println("Sta partendo il for sulla Queue \n");
+ for(int y=-5;y<6;y++){
+ for(int x=-23;x<24;x++){
+ posx=x;
+ posy=y;
+
+ //ciclo for nel set di currentCluster, ovvero il set nel mezzo del buffer
+ for(HPSEcalCluster cluster : currentClusters){
+ if((cluster.getSeedHit().getIdentifierFieldValue("ix")== posx) && (cluster.getSeedHit().getIdentifierFieldValue("iy")==posy )&& (cluster.getEnergy() > energyThreshold)){
+
+ if(ClusterChecker(cluster)){
+ int id;
+ Clustercount++;
+ id=getCrystal(cluster);
+ try{
+ writer.append(id + " " + cluster.getSeedHit().getTime() + " " + cluster.getEnergy()+ " " + cluster.getSize() + " " + cluster.getSeedHit().getRawEnergy() + " ");
+ /*for(CalorimeterHit hit : cluster.getCalorimeterHits())
+ {writer.append(hit.getRawEnergy()+ " ");
+ }*/
+ writer.append("\n");
+
+ }
+
+ catch(IOException e ){System.err.println("Error writing tooutput for event display");}
+
+ }
+ }
+
+
+ }
+
+
+
+ }
+ }
+
+
+
+
+
+ }
+ /**
+ * Check if the cluster is isolaterd checking if there are clusters near it in time and in space in the buffer
+ * @param cluster
+ * @return
+ */
+
+public boolean ClusterChecker (HPSEcalCluster cluster){
+//System.out.println("Sono nel clustercheck! \n");
+
+boolean check=true;
+
+ //ciclo sulle liste del buffer
+loops:
+ for(ArrayList<HPSEcalCluster> currentList : clusterBuffer){
+ //ciclo sui cluster della lista corrente
+ for(HPSEcalCluster currentcluster : currentList){
+ if(currentcluster!= cluster){
+ //if there is a cluster in the buffer that is in the considered radius in a time window lower than expected, the loop is brocken and the analyzed cluster is not good
+ if(!((currentcluster.getSeedHit().getIdentifierFieldValue("ix")< posx-radius || currentcluster.getSeedHit().getIdentifierFieldValue("ix")> posx+radius)&& (currentcluster.getSeedHit().getIdentifierFieldValue("iy")< posy-radius || currentcluster.getSeedHit().getIdentifierFieldValue("iy")> posy+radius))&& Math.abs(cluster.getSeedHit().getTime()-currentcluster.getSeedHit().getTime())<timeDifference){
+ check=false;
+ break loops;
+ }
+ }
+
+
+
+ }
+
+
+ }
+
+
+
+return check;
+
+}
+
+
+
+ public int getCrystal (HPSEcalCluster cluster){
+ int x,y,id=0;
+ x= (-1)*cluster.getSeedHit().getIdentifierFieldValue("ix");
+ y= cluster.getSeedHit().getIdentifierFieldValue("iy");
+
+ if(y==5){
+ if(x<0)
+ {id=x+24;}
+ else id= x+23;
+ }
+
+ else if(y==4)
+ {if(x<0){
+ id=x+70;}
+ else id=x+69;}
+
+ else if(y==3)
+ {if(x<0){
+ id=x+116;}
+ else id=x+115;}
+
+ else if(y==2)
+ {if(x<0){
+ id=x+162;}
+ else id=x+161;}
+
+ else if(y==1)
+ {x=-x;
+ if(x>0){
+ id=-x+208;}
+ else if(x==-1){id=208;}
+ else if(x<-1) id=-x+198;}
+
+ else if(y==-1)
+ {x=-x;
+ if(x>0){
+ id=-x+245;}
+ else if(x==-1 )id=245;
+ else if(x<-1){id=-x+257;}}
+
+
+ else if(y==-2)
+ {if(x<0){
+ id=x+282;}
+ else id=x+281;}
+
+ else if(y==-3)
+ {if(x<0){
+ id=x+328;}
+ else id=x+327;}
+
+ else if(y==-4)
+ {if(x<0){
+ id=x+374;}
+ else id=x+373;}
+
+ else if(y==-5)
+ {if(x<0){
+ id=x+420;}
+ else id=x+419;}
+
+ return id;
+
+ }
+
+
+ } //chiusura driver
+
+
+
SVNspam 0.1