lcsim/src/org/lcsim/plugin/web/examples
diff -u -r1.3 -r1.4
--- ClusterFinding.java 18 Jul 2005 03:20:13 -0000 1.3
+++ ClusterFinding.java 9 Aug 2005 13:46:45 -0000 1.4
@@ -10,28 +10,73 @@
*/
public class ClusterFinding extends Driver
{
+//
+// Use the "convenient" method of generating AIDA plots
+//
private AIDA aida = AIDA.defaultInstance();
public ClusterFinding()
{
+//
+// Add a cluster Driver with required parameters
+//
int minCells = 5;
add(new NearestNeighborClusterDriver(minCells));
}
+//
+// Process an event
+//
protected void process(EventHeader event)
{
+//
+// Make clusters
+//
super.process(event);
-
- // Loop over all the clusters
-
+//
+// Find all the cluster Lists
+//
List<List<Cluster>> clusterSets = event.get(Cluster.class);
aida.cloud1D("clusterSets").fill(clusterSets.size());
-
+//
+// Loop over all the cluster Lists
+//
for (List<Cluster> clusters : clusterSets)
{
- aida.cloud1D("clusters").fill(clusters.size());
+//
+// Get the ClusterList name
+//
+ String name = event.getMetaData(clusters).getName() + "/";
+//
+// Histogram the number of clusters in the List
+//
+ aida.cloud1D(name+"clusters").fill(clusters.size());
+//
+// Loop over all the clusters in a List
+//
for (Cluster cluster : clusters)
{
- aida.cloud1D("energy").fill(cluster.getEnergy());
+//
+// Histogram the "corrected" energy
+//
+ aida.cloud1D(name+"energy").fill(cluster.getEnergy());
+//
+// Histogram the position as R vs Z
+//
+ double[] pos = cluster.getPosition();
+ double R = Math.sqrt(pos[0]*pos[0] + pos[1]*pos[1]);
+ aida.cloud2D(name+"Position:R vs Z").fill(pos[2],R);
+//
+// Histogram the computed direction
+//
+ aida.cloud1D(name+"Direction: theta").fill(cluster.getITheta());
+ aida.cloud1D(name+"Direction: phi").fill(cluster.getIPhi());
+//
+// Histogram the difference in direction and position theta,phi
+//
+ double posphi = Math.atan2(pos[1],pos[0]);
+ aida.cloud1D(name+"delta phi").fill(posphi - cluster.getIPhi());
+ double postheta = Math.PI/2. - Math.atan2(pos[2],R);
+ aida.cloud1D(name+"delta theta").fill(postheta - cluster.getITheta());
}
}
}