Print

Print


Commit in lcsim/src/org/lcsim/recon/cluster/density on MAIN
PFlow.java+6-61.1 -> 1.2
MCReconstruction.java-2441.1 removed
+6-250
1 removed + 1 modified, total 2 files
GL: Replaced with cheater clusterer

lcsim/src/org/lcsim/recon/cluster/density
PFlow.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- PFlow.java	12 Aug 2005 19:59:49 -0000	1.1
+++ PFlow.java	27 Sep 2005 20:46:15 -0000	1.2
@@ -46,7 +46,7 @@
 // 	loop.add( new LCIODriver( new File("output.slcio") );
 
         System.out.println("Starting loop over events");
-        loop.loop(10); // -1 for all
+        loop.loop(3); // -1 for all
 
 	loop.dispose();
         _tree.commit();
@@ -64,8 +64,8 @@
 
  	System.out.print("..calhit..");
   	_calhit.process(evt);
-//   	System.out.print("..cheater..");
-//   	_cheater.process(evt);
+   	System.out.print("..cheater...");
+   	_cheater.process(evt);
 
  	System.out.print("..mcreco..");
   	MCReconstruction.getInstance().process(evt);
@@ -82,12 +82,12 @@
 
     public PFlow() throws IOException{
       _calhit = LoadMyCalorimeterHit.getInstance();
-//       _cheater = new CheatClusterDriver();
+      _cheater = new CheatClusterDriver();
 
       prepareNtupleFactory();
       _anal = new DirectedTree(_tf,_tree);
 
-//       add(_cheater);
+      add(_cheater);
       add( MCReconstruction.getInstance() );
       add(_anal);
     }
@@ -102,7 +102,7 @@
 
     //===  FIELDS  ====
 
-    private static AIDA _aida; 
+    private static AIDA _aida;
     private static ITree _tree;
     private static ITupleFactory _tf;
 

lcsim/src/org/lcsim/recon/cluster/density
MCReconstruction.java removed after 1.1
diff -N MCReconstruction.java
--- MCReconstruction.java	12 Aug 2005 19:59:49 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,244 +0,0 @@
-package org.lcsim.recon.cluster.density;
-
-import java.io.IOException;
-import java.util.*;
-import org.lcsim.util.Driver;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.MCParticle;
-import org.lcsim.event.SimCalorimeterHit;
-
-public class MCReconstruction extends Driver {
-
-    static MCReconstruction getInstance(){
-        if(_me==null){
-            _me = new MCReconstruction();
-        }
-        return _me;
-    }
-
-    public void process(EventHeader event){
-	System.out.println("Running _mcreco.process");
-        this.reset();
-//         _cPar = CalParameters.getInstance(event);
-        _runPar = RunControlParameters.getInstance();
-	_event = event;
-    }
-
-    private MCReconstruction(){
-        if(_me==null) _me=this;
-        _myEMmcClusters = new ArrayList<MCCluster>();
-        _myHDmcClusters = new ArrayList<MCCluster>();
-    }
-
-    public void reset(){
-        _myEMmcClusters.clear();
-        _myHDmcClusters.clear();
-	_mcClusters.clear();
-    }
-
-    public List<MCCluster> getmcClusters(final String colName) {
-      if(_mcClusters.size()==0) {
-	Map<Long,MyCalorimeterHit> hitmap
-	    = LoadMyCalorimeterHit.getInstance().getCollHitMap(colName);
-	List<MCParticle> mcp = _event.getMCParticles();
-	fillMCclusterList(hitmap, mcp, _mcClusters);
-      }
-      return _mcClusters;
-    }
-
-    public void fillMCclusterList(Map<Long,MyCalorimeterHit> hitmap,
-				  List<MCParticle> mcpcol,
-				  List<MCCluster> mclus)
-    {
-
-        Vector<MCParticle> mcpVec = new Vector<MCParticle>();
-//         for(int i=0;i<mcpcol.size();++i){
-//             MCParticle mcp = (MCParticle) mcpcol.getElementAt(i);
-	for( MCParticle mcp : mcpcol ) {
-/// This portion needs to be clarified with Guilherme
-//            boolean simPart = mcp.isCreatedInSimulation();
-	    //            if(!simPart){
-	    //                mcpVec.add(mcp);
-	    //            }
-
-            boolean preCalorimeter = MCUtil.createdBeforeCal(mcp);
-            boolean calWorthy = MCUtil.isCalorimeterRelevant(mcp);
-            int genStatus = mcp.getGeneratorStatus();
-            if(preCalorimeter && calWorthy && genStatus<3){
-                mcpVec.add(mcp);
-            }
-        }
-
-        int nmcp = mcpVec.size();
-        Map<MCParticle, Vector<MyCalorimeterHit>> mcpHit
-	    = new HashMap<MCParticle, Vector<MyCalorimeterHit>>();
- 	for( MCParticle mcp : mcpVec ) {
-	    System.out.println("Add hits vector for "+mcp);
- 	    mcpHit.put( mcp, new Vector<MyCalorimeterHit>() );
- 	}
-
-        for( MyCalorimeterHit myhit : hitmap.values() ) {
-	  SimCalorimeterHit ihit = myhit.getHit();
-	  int nmc = ihit.getMCParticleCount();
-	  MCParticle parent = null;
-	  for(int imc=0;imc<nmc;imc++){
-	    MCParticle ipart = ihit.getMCParticle(imc);
-	    int ndx = mcpVec.indexOf(ipart);
-	    if(ndx<0){
-	      int nparent = ipart.getParents().size();
-	      int j = 0; boolean traceBack = true;
-	      while(traceBack && j<nparent){
-		parent = ipart.getParents().get(j);
-		boolean preCalorimeter = MCUtil.createdBeforeCal(parent);
-
-// 		System.out.println("starting traceback"+" "+ipart.getPDG()
-// 				   +" "+ipart.getGeneratorStatus()
-// 				   +" "+ipart.isCreatedInSimulation()
-// 				   +" "+MCUtil.createdBeforeCal(ipart)
-// 				   +" "+MCUtil.isCalorimeterRelevant(ipart)
-// 				   +" "+nparent+" "+j);
-
-		if(preCalorimeter){
-		  ndx = mcpVec.indexOf(parent);
-		  ipart = parent;
-// 		  System.out.println("in traceback"+" "+ndx+" "+parent.getPDG()
-// 				     +" "+parent.getGeneratorStatus());
-		  traceBack = false;
-		}
-		j++;
-	      }
-	    }
-	    if(ndx>=0) {
-	      mcpHit.get(ipart).add(myhit);
-	    }
-	  }
-        }
-
-        makeMCclusters(mcpVec,mcpHit,mclus);
-    }
-
-    public void makeMCclusters(Vector<MCParticle> mcp,
-			       Map<MCParticle, Vector<MyCalorimeterHit>> hitColl,
-			       List<MCCluster> mcclusters)
-    {
-        int nclus = hitColl.size();
-        for( MCParticle mcpart : mcp ) {
-            double cluE = 0.0;
-            double cluX = 0.0; double cluY = 0.0; double cluZ = 0.0;
-            double sumWt = 0.0;
-	    Vector<MyCalorimeterHit> cluHits = hitColl.get(mcpart);
-            double cluSize = cluHits.size();
-
-	    //	    if(cluSize==0){
-	    /*
-		float[] mom = mcpart.getMomentum();
-		double[] ep = mcpart.getEndpoint();
-		System.out.println("mcpart"+" "+mcpart.getPDG()+" "+mcpart.getGeneratorStatus()+" "+
-                                   mcpart.isDecayedInCalorimeter()+" "+mom[0]+" "+mom[1]+
-                                   " "+mom[2]+" "+ep[0]+" "+ep[1]+" "+ep[2]+" "+
-                                   mcpart.isStopped()+" "+cluSize+" "+i);
-	    */
-		//	    }
-
-	    if(cluSize==0) continue;
-            Iterator itr = cluHits.iterator();
-            while(itr.hasNext()){
-                MyCalorimeterHit myhit = (MyCalorimeterHit)itr.next();
-                SimCalorimeterHit hit = myhit.getHit();
-                int npart = hit.getMCParticleCount();
-                double ene = 0;
-                for(int j=0;j<npart;j++){
-                    MCParticle jpart = hit.getMCParticle(j);
-                    if(jpart.equals(mcpart)){
-                        ene = hit.getContributedEnergy(j);
-                    }
-                }
-                double[] pos = hit.getPosition();
-                cluE += (double) ene;
-                if(_runPar.getCentroidWeightType()=="Energy"){
-                    cluX += (double) ene*pos[0];
-                    cluY += (double) ene*pos[1];
-                    cluZ += (double) ene*pos[2];
-                    sumWt += (double) ene;
-                }
-                if(_runPar.getCentroidWeightType()=="Density"){
-                    double dens = myhit.getDensity(0);
-//density sharing needs to be worked out
-                    cluX += (double) dens*pos[0];
-                    cluY += (double) dens*pos[1];
-                    cluZ += (double) dens*pos[2];
-                    sumWt += dens;
-                }
-            }
-            if(sumWt>0.){
-                cluX = cluX/sumWt;
-                cluY = cluY/sumWt;
-                cluZ = cluZ/sumWt;
-            }
-	    //	    System.out.println(cluE);
-
-	    if(_runPar.Prune()){
-		double cluXorig = cluX;
-		double cluYorig = cluY;
-		double cluZorig = cluZ;
-
-		cluE = 0.0; sumWt = 0.0;
-		cluX = 0.0; cluY = 0.0; cluZ = 0.0;
-                Iterator itr1 = cluHits.iterator();
-                while(itr1.hasNext()){
-                    MyCalorimeterHit myhit = (MyCalorimeterHit) itr1.next();
-                    SimCalorimeterHit hit = myhit.getHit();
-                    int npart = hit.getMCParticleCount();
-                    double ene = 0;
-                    for(int j=0;j<npart;j++){
-                        MCParticle jpart = hit.getMCParticle(j);
-                        if(jpart.equals(mcpart)){
-                            ene = hit.getContributedEnergy(j);
-                        }
-                    }
-                    double[] pos = hit.getPosition();
-		    double diffX = pos[0]-cluXorig;
-		    double diffY = pos[1]-cluYorig;
-		    double diffZ = pos[2]-cluZorig;
-		    double distance = diffX*diffX+diffY*diffY+diffZ*diffZ;
-		    if(distance>0.0) distance = Math.sqrt(distance);
-		    if(distance<_runPar.getPruningDist()){
-                        cluE += (double) ene;
-                        if(_runPar.getCentroidWeightType()=="Energy"){
-                            cluX += (double) ene*pos[0];
-                            cluY += (double) ene*pos[1];
-                            cluZ += (double) ene*pos[2];
-                            sumWt += (double) ene;
-                        }
-                        if(_runPar.getCentroidWeightType()=="Density"){
-                            double dens = myhit.getDensity(0);
-//density sharing needs to be worked out
-                            cluX += (double) dens*pos[0];
-                            cluY += (double) dens*pos[1];
-                            cluZ += (double) dens*pos[2];
-                            sumWt += dens;
-                        }
-		    }
-                }
-                if(sumWt>0.){
-                    cluX = cluX/sumWt;
-                    cluY = cluY/sumWt;
-                    cluZ = cluZ/sumWt;
-                }
-	    }
-
-	    //	    System.out.println(cluE+" "+cluSize);
-            MCCluster clus = new MCCluster(mcpart,cluE,cluX,cluY,cluZ,cluSize,cluHits);
-            mcclusters.add(clus);
-        }
-    }
-
-    private static MCReconstruction _me = null;
-//     private static CalParameters _cPar;
-    private EventHeader _event;
-    private static RunControlParameters _runPar;
-    private Map<Long,MyCalorimeterHit> emhitmap,hdhitmap;
-    private static List<MCCluster> _myEMmcClusters = new ArrayList<MCCluster>();
-    private static List<MCCluster> _myHDmcClusters = new ArrayList<MCCluster>();
-    private static List<MCCluster> _mcClusters = new ArrayList<MCCluster>();
-}
CVSspam 0.2.8