3 removed + 5 modified, total 8 files
lcsim/src/org/lcsim/recon/cluster/density
diff -u -r1.2 -r1.3
--- Cluster.java 27 Sep 2005 20:46:19 -0000 1.2
+++ Cluster.java 29 Sep 2005 19:08:36 -0000 1.3
@@ -2,21 +2,21 @@
import java.util.Vector;
import org.lcsim.event.CalorimeterHit;
+import org.lcsim.recon.cluster.util.BasicCluster;
-public class Cluster {
+public class Cluster extends BasicCluster {
public Cluster(double ene,double xpos,double ypos,double zpos,
- int size,Vector<CalorimeterHit> hitColl)
+ Vector<CalorimeterHit> hitColl)
{
_ene = ene;
_xpos = xpos;
_ypos = ypos;
_zpos = zpos;
- _size = size;
- _hitColl = hitColl;
+ for( CalorimeterHit hit : hitColl ) {
+ addHit( hit );
+ }
}
double _ene,_xpos,_ypos,_zpos;
- int _size;
- Vector<CalorimeterHit> _hitColl;
}
lcsim/src/org/lcsim/recon/cluster/density
diff -u -r1.2 -r1.3
--- ClusterBuilder.java 27 Sep 2005 20:46:19 -0000 1.2
+++ ClusterBuilder.java 29 Sep 2005 19:08:36 -0000 1.3
@@ -7,13 +7,14 @@
LoadMyCalorimeterHit _loader = LoadMyCalorimeterHit.getInstance();
- public List makeClusters(Vector<Vector<CalorimeterHit>> hitColl,
- RunControlParameters rpar)
+ public List<Cluster> makeClusters(Vector<Vector<CalorimeterHit>> hitColl,
+ RunControlParameters rpar)
{
List<Cluster> clusters = new ArrayList<Cluster>();
int nclus = hitColl.size();
assert nclus > 0 : "ClusterBuilder: no clusters received.";
+ // loop over clusters
for(int i=0;i<nclus;i++){
double cluE = 0.0;
double cluX = 0.0; double cluY = 0.0; double cluZ = 0.0;
@@ -23,6 +24,7 @@
if(cluSize==0) System.out.println("Damn 2");
assert cluSize > 0 : "ClusterBuilder: zero-hits cluster found.";
+ // loop over hits in this cluster
for( CalorimeterHit ihit : hitColl.get(i) ){
double ene = ihit.getRawEnergy();
double[] pos = ihit.getPosition();
@@ -34,19 +36,11 @@
sumWt += ene;
}
if(rpar.getCentroidWeightType()=="Density"){
- if(cluSize>1){
- double dens = _loader.getDensity(ihit);
- cluX += dens*pos[0];
- cluY += dens*pos[1];
- cluZ += dens*pos[2];
- sumWt += dens;
- }
- else{
- cluX = pos[0];
- cluY = pos[1];
- cluZ = pos[2];
- sumWt = 1.0;
- }
+ double dens = _loader.getDensity(ihit);
+ cluX += dens*pos[0];
+ cluY += dens*pos[1];
+ cluZ += dens*pos[2];
+ sumWt += dens;
}
}
if(sumWt>0.){
@@ -55,7 +49,7 @@
cluZ = cluZ/sumWt;
}
// System.out.println(cluE+" "+cluX+" "+cluY+" "+cluZ);
- Cluster clus = new Cluster(cluE,cluX,cluY,cluZ,cluSize,hitColl.get(i));
+ Cluster clus = new Cluster(cluE,cluX,cluY,cluZ,hitColl.get(i));
clusters.add(clus);
}
return clusters;
lcsim/src/org/lcsim/recon/cluster/density
diff -u -r1.2 -r1.3
--- DirectedTree.java 27 Sep 2005 20:46:19 -0000 1.2
+++ DirectedTree.java 29 Sep 2005 19:08:36 -0000 1.3
@@ -393,7 +393,7 @@
Map<CalorimeterHit,Integer> recTagMap
= new HashMap<CalorimeterHit,Integer>();
for(Cluster clust : recon ) {
- Vector<CalorimeterHit> cellVec = clust._hitColl;
+ List<CalorimeterHit> cellVec = clust.getCalorimeterHits();
// System.out.println(tag+" "+cellVec.size());
if(cellVec.size()==0.) System.out.println("Damn 3");
// for(int i=0;i<cellVec.size();i++){
@@ -428,7 +428,7 @@
emClusFolder.fill(1,(float) clust._xpos);
emClusFolder.fill(2,(float) clust._ypos);
emClusFolder.fill(3,(float) clust._zpos);
- emClusFolder.fill(4, clust._size);
+ emClusFolder.fill(4, clust.getSize());
emClusFolder.addRow();
// System.out.println("EM Clus "+tag+" "+clust._xpos+" "+clust._ypos+" "+clust._zpos+" "+ clust._size );
}
@@ -437,7 +437,7 @@
hdClusFolder.fill(1,(float) clust._xpos);
hdClusFolder.fill(2,(float) clust._ypos);
hdClusFolder.fill(3,(float) clust._zpos);
- hdClusFolder.fill(4, clust._size );
+ hdClusFolder.fill(4, clust.getSize() );
hdClusFolder.addRow();
}
tag++;
@@ -448,8 +448,9 @@
for( CalorimeterHit ihit : clust.getCalorimeterHits() ) {
Integer tagObject = recTagMap.get(ihit);
// System.out.println("getting: "+ihit+" -> "+tagObject);
- int rtag = -1;
- if(tagObject!=null) rtag = tagObject.intValue();
+
+ int rtag = -1;
+ if(tagObject!=null) rtag = tagObject.intValue();
double[] pos = ihit.getPosition();
double cdens = _loader.getDensity(ihit);
if(cdens==0) continue; // skip hits below energy cut
@@ -496,7 +497,6 @@
MCParticle mcpart = getMCParticleInCluster(clust);
float charge = (float)mcpart.getCharge();
- System.out.println("charge="+charge);
int particleID = mcpart.getType().getPDGID();
float mcE = (float)mcpart.getEnergy();
Hep3Vector mcMom = mcpart.getMomentum();
lcsim/src/org/lcsim/recon/cluster/density
diff -u -r1.2 -r1.3
--- LoadMyCalorimeterHit.java 27 Sep 2005 20:46:19 -0000 1.2
+++ LoadMyCalorimeterHit.java 29 Sep 2005 19:08:36 -0000 1.3
@@ -100,7 +100,7 @@
assert false : "loadMyCalHit.fillHitMap(): colName="+colName;
}
- // Get hits, if they exist
+ // Get hit collection, if it exist
List<SimCalorimeterHit> tmpHits = null;
try {
tmpHits = _event.getSimCalorimeterHits(colName);
@@ -122,19 +122,20 @@
: "LoadCalorimeterHit: multiple subdets in a collection";
double ene = _weight*(ihit.getRawEnergy());
+ // apply energy cut
if(ene>_thresh*_mip){
long cellid = ihit.getCellID();
- Long key = new Long(cellid);
- CalorimeterHit khit = new MyCalorimeterHit(ihit);
- hitmap.put(key,khit);
+ hitmap.put( cellid, ihit);
}
// else {
// System.out.println("LoadMyCalhit: rejected hit="+ihit+", id="+MyTools.printID(ihit.getCellID()));
// }
}
+ // fill map keying hitmap by Subdetector
if(det!=null) _subdet2collMap.put( det, hitmap );
- // assign densities to every hit
+ // assign densities to every hit in *new* hitmap,
+ // thus density=0 for hits failing energy cut
for( CalorimeterHit khit : hitmap.values() ) {
long cellid = khit.getCellID();
@@ -150,12 +151,11 @@
}
_densityMap.put(cellid,nNeigh);
- ((MyCalorimeterHit)khit).setDensity(0, nNeigh);
AIDA.defaultInstance().cloud1D("density").fill(nNeigh);
}
}
-
+ // Get hit density from a hit reference
double getDensity(final CalorimeterHit hit) {
if(hit==null) return 0.0;
try {
@@ -167,6 +167,7 @@
}
}
+ // Get hit density from cellID
double getDensity(long cellid) {
if(cellid==0) return 0.0;
return _densityMap.get( cellid );
lcsim/src/org/lcsim/recon/cluster/density
diff -u -r1.3 -r1.4
--- PFlow.java 27 Sep 2005 21:26:48 -0000 1.3
+++ PFlow.java 29 Sep 2005 19:08:37 -0000 1.4
@@ -33,14 +33,8 @@
PFlow pflow = new PFlow();
loop.add( pflow );
-// // ModeDetection anal2 = new ModeDetection(_tf,_tree);
-// // Canny anal3 = new Canny(_tf,_tree);
-
-// reader.registerLCEventListener(mycalhit);
-// reader.registerLCEventListener(mcreco);
-// reader.registerLCEventListener(anal1);
-// // reader.registerLCEventListener(anal2);
-// // reader.registerLCEventListener(anal3);
+// ModeDetection anal2 = new ModeDetection(_tf,_tree);
+// Canny anal3 = new Canny(_tf,_tree);
// last driver, if output is needed
// loop.add( new LCIODriver( new File("output.slcio") );
lcsim/src/org/lcsim/recon/cluster/density
diff -N MCCluster.java
--- MCCluster.java 27 Sep 2005 20:46:23 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,21 +0,0 @@
-
-package org.lcsim.recon.cluster.density;
-
-import java.util.Vector;
-import org.lcsim.recon.cluster.util.BasicCluster;
-import org.lcsim.event.MCParticle;
-import org.lcsim.event.CalorimeterHit;
-
-public class MCCluster extends BasicCluster {
-
- public MCCluster(MCParticle mcpart,
- Vector<CalorimeterHit> hitColl)
- {
- _mcpart = mcpart;
- for( CalorimeterHit hit : hitColl) {
- addHit( hit );
- }
- }
-
- private MCParticle _mcpart;
-}
lcsim/src/org/lcsim/recon/cluster/density
diff -N MCUtil.java
--- MCUtil.java 27 Sep 2005 20:46:25 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,34 +0,0 @@
-package org.lcsim.recon.cluster.density;
-
-import org.lcsim.event.MCParticle;
-import hep.physics.vec.Hep3Vector;
-
-public class MCUtil{
-
- public static boolean createdBeforeCal(MCParticle mcpart){
- boolean beforeCalorimeter = false;
- Hep3Vector vertex = mcpart.getOrigin();
- double[] vert = new double[3];
- vert[0] = vertex.x();
- vert[1] = vertex.y();
- vert[2] = vertex.z();
-// for(int ii=0;ii<3;ii++){
-// vert = vertex/10.;
-// }
- double rad = vert[0]*vert[0]+vert[1]*vert[1];
- if(rad>0.) rad = Math.sqrt(rad);
-// if(rad<125. && Math.abs(vert[2])<185.){
- if(rad<127. && Math.abs(vert[2])<168.){
- beforeCalorimeter = true;
- }
- return beforeCalorimeter;
- }
-
- public static boolean isCalorimeterRelevant(MCParticle mcpart){
- boolean interesting = true;
- int pid = Math.abs(mcpart.getType().getPDGID());
- if(pid==12 || pid==14 || pid==16) interesting = false;
- // if(mcpart.getEnergy()<0.5) interesting = false;
- return interesting;
- }
-}
lcsim/src/org/lcsim/recon/cluster/density
diff -N MyCalorimeterHit.java
--- MyCalorimeterHit.java 27 Sep 2005 20:46:27 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,42 +0,0 @@
-package org.lcsim.recon.cluster.density;
-
-import org.lcsim.event.SimCalorimeterHit;
-import org.lcsim.event.CalorimeterHit;
-import org.lcsim.geometry.IDDecoder;
-import org.lcsim.geometry.Subdetector;
-
-public class MyCalorimeterHit implements CalorimeterHit {
-
- public MyCalorimeterHit(SimCalorimeterHit myHit) {
- _myHit = myHit;
- initDensity();
- }
-
- private void initDensity(){
- _dens = new double[2];
- _dens[0] = 0.0;
- _dens[1] = 0.0;
- }
-
- public void setDensity(int index, double density){
- if(index>=_dens.length) throw new IllegalArgumentException();
- _dens[index] = density;
- }
-
- public double getDensity(int index){
- if(index>=_dens.length) throw new IllegalArgumentException();
- return this._dens[index];
- }
-
- public double getRawEnergy() { return _myHit.getRawEnergy(); }
- public double getCorrectedEnergy() { return _myHit.getCorrectedEnergy(); }
- public long getCellID() { return _myHit.getCellID(); }
- public IDDecoder getIDDecoder() { return _myHit.getIDDecoder(); }
- public Subdetector getSubdetector() { return _myHit.getSubdetector(); }
- public double getTime() { return _myHit.getTime(); }
- public double[] getPosition() { return _myHit.getPosition(); }
-
- //*** FIELDS
- SimCalorimeterHit _myHit;
- private double [] _dens;
-}
CVSspam 0.2.8