4 removed files
lcsim/src/org/lcsim/recon/ganging
diff -N GangCalorimeterHits.java
--- GangCalorimeterHits.java 6 Dec 2007 23:59:05 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,61 +0,0 @@
-/*
- * GangCalorimeterHits.java
- *
- * Created on October 16, 2006, 1:34 PM
- *
- */
-package org.lcsim.recon.ganging;
-import java.util.*;
-import org.lcsim.util.Driver;
-import org.lcsim.event.*;
-import org.lcsim.geometry.*;
-/**
- * Creates a collection of ganged calorimeter hits from a collection
- * of calorimeter hits
- *
- * @author cassell
- */
-public class GangCalorimeterHits
-{
- public List<CalorimeterHit> GangCollection(EventHeader event,String coll,int ngang)
- {
-// Create empty output list
- Map<Long,CalorimeterHit>newMap = new HashMap<Long,CalorimeterHit>();
-// Get a list of CalorimeterHit lists from event
- List<List<CalorimeterHit>> clists = event.get(CalorimeterHit.class);
-// Loop over list of lists
- for(List<CalorimeterHit> list:clists)
- {
-// Find the collection name requested
- if(event.getMetaData(list).getName().compareTo(coll) == 0)
- {
-// Get the IDDecoder
- IDDecoder oldDecoder = event.getMetaData(list).getIDDecoder();
-// Create a new IDDecoder
- GangedCalorimeterIDDecoder newDecoder =
- new GangedCalorimeterIDDecoder(oldDecoder,ngang);
-// Loop over the CalorimeterHits
- for(CalorimeterHit h:list)
- {
-// Create a new ganged hit from this hit
- GangedSimCalorimeterHit gh =
- new GangedSimCalorimeterHit((SimCalorimeterHit) h,ngang);
- Long lid = new Long(gh.getCellID());
-// Find out if we've already created a hit with this ID
- if(newMap.containsKey(lid))
- {
- ( (GangedSimCalorimeterHit)newMap.get(lid)).addHit(gh);
- }
- else
- {
- newMap.put(lid, gh);
- }
- }
- }
- }
-// Return the new list of ganged hits
- return new ArrayList(newMap.values());
-
- }
-
-}
lcsim/src/org/lcsim/recon/ganging
diff -N GangedCalorimeterIDDecoder.java
--- GangedCalorimeterIDDecoder.java 3 Feb 2010 21:19:32 -0000 1.6
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,274 +0,0 @@
-/*
- * GangedCalorimeterIDDecoder.java
- *
- * Created on October 16, 2006, 12:12 PM
- *
- */
-
-package org.lcsim.recon.ganging;
-import org.lcsim.geometry.*;
-import org.lcsim.geometry.subdetector.BarrelEndcapFlag;
-import org.lcsim.geometry.util.IDDescriptor;
-import org.lcsim.geometry.util.IDEncoder;
-import hep.physics.vec.Hep3Vector;
-import hep.physics.vec.BasicHep3Vector;
-
-/**
- * IDDecoder for ganged hits. Uses the original decoder for everything but
- * position related methods.
- * @author cassell
- */
-public class GangedCalorimeterIDDecoder implements IDDecoder
-{
-
- IDDecoder oldDecoder;
- int nganged;
- long id;
-// For now, assume we know the relevant field names from the Barrel/Endcap flag
- String[] fields;
- static String[] BarFields = {"phi","z"};
- static String[] ECFields = {"x","y"};
-//
- /** Creates a new instance of GangedCalorimeterIDDecoder */
- public GangedCalorimeterIDDecoder(IDDecoder old, int gang)
- {
- oldDecoder = old;
- nganged = gang;
- fields = new String[2];
- if(oldDecoder.getBarrelEndcapFlag().isBarrel())
- {
- fields[0] = BarFields[0];
- fields[1] = BarFields[1];
- }
- else
- {
- fields[0] = ECFields[0];
- fields[1] = ECFields[1];
- }
- }
- public void setID(long iid)
- {
- id = iid;
- oldDecoder.setID(iid);
- }
-
- /** Get an expanded identifier that maps strings to integer values. */
- //public ExpandedIdentifier getExpandedIdentifier()
- //{
- // return oldDecoder.getExpandedIdentifier();
- //}
-
- /** Same as getIDExpanded() except sets id. */
- //public ExpandedIdentifier getExpandedIdentifier(long id)
- //{
- // return oldDecoder.getExpandedIdentifier(id);
- //}
-
- /*/\/\/\ Access to field data /\/\/\ */
- public int getValue(String field)
- {
- return oldDecoder.getValue(field);
- }
- public int getValue(int index)
- {
- return oldDecoder.getValue(index);
- }
-
- /* /\/\/\ ID description /\/\/\ */
- public int getFieldCount()
- {
- return oldDecoder.getFieldCount();
- }
- public String getFieldName(int index)
- {
- return oldDecoder.getFieldName(index);
- }
- public int getFieldIndex(String name)
- {
- return oldDecoder.getFieldIndex(name);
- }
- public void setIDDescription(IDDescriptor id)
- {
- oldDecoder.setIDDescription(id);
- }
- public IDDescriptor getIDDescription()
- {
- return oldDecoder.getIDDescription();
- }
-
- /** @return layer number */
- public int getLayer()
- {
- return oldDecoder.getLayer();
- }
-
- public int getVLayer()
- {
- return getLayer();
- }
-
- /* /\/\/\ Position interface /\/\/\ */
-
- // FIXME: change to Hep3Vector and eliminate the X/Y/Z/theta/phi methods
-
- /** @return Hep3Vector representing the position of the current ID. */
- public Hep3Vector getPositionVector()
- {
- return new BasicHep3Vector(getPosition());
- }
-
- /** @return position as double array of length 3 */
- public double[] getPosition()
- {
- long[] oldids = getOldIDs();
- double[] pos = new double[3];
- for(int i=0;i<oldids.length;i++)
- {
- oldDecoder.setID(oldids[i]);
- pos[0] += oldDecoder.getX();
- pos[1] += oldDecoder.getY();
- pos[2] += oldDecoder.getZ();
- }
- pos[0] /= oldids.length;
- pos[1] /= oldids.length;
- pos[2] /= oldids.length;
- return pos;
- }
-
- /** @return X coordinate */
- public double getX(){return getPosition()[0];}
-
- /** @return Y coordinate */
- public double getY(){return getPosition()[1];}
-
- /** @return Z coordinate */
- public double getZ(){return getPosition()[2];}
-
- /** @return phi angle */
- public double getPhi()
- {
- double[] pos = getPosition();
- return Math.atan2(pos[1], pos[0]);
- }
-
- /** @return theta angle */
- public double getTheta()
- {
- double[] pos = getPosition();
- return Math.atan2(Math.sqrt(pos[0]*pos[0] + pos[1]*pos[1]), pos[2]);
- }
-
- /* /\/\/\ Reverse Decoding: Position to Cell /\/\/\ */
-
- public long findCellContainingXYZ(Hep3Vector pos)
- {
- return gangedCellID(oldDecoder.findCellContainingXYZ(pos));
- }
- public long findCellContainingXYZ(double[] pos)
- {
- return gangedCellID(oldDecoder.findCellContainingXYZ(pos));
- }
- public long findCellContainingXYZ(double x, double y, double z)
- {
- return gangedCellID(oldDecoder.findCellContainingXYZ(x,y,z));
- }
-
- /* /\/\/\ Miscellaneous /\/\/\ */
-
- /** Get the flag that indicates barrel or endcap, i.e. the "barrel" field. */
- public BarrelEndcapFlag getBarrelEndcapFlag()
- {
- return oldDecoder.getBarrelEndcapFlag();
- }
-
- /** Get the system ID, i.e. the "system" field. */
- public int getSystemID()
- {
- return oldDecoder.getSystemID();
- }
-
- /** @Deprecated use getSystemID() instead */
- public int getSystemNumber()
- {
- return oldDecoder.getSystemNumber();
- }
-
- /** Get the Subdetector associated with this IDDecoder, or null if not applicable. */
- public Subdetector getSubdetector()
- {
- return oldDecoder.getSubdetector();
- }
-
- /* /\/\/\ Neighbours /\/\/\ */
-
- public boolean supportsNeighbours()
- {
- return oldDecoder.supportsNeighbours();
- }
- public long[] getNeighbourIDs()
- {
- return oldDecoder.getNeighbourIDs();
- }
- public long[] getNeighbourIDs(int deltaLayer, int deltaTheta, int deltaPhi)
- {
- return oldDecoder.getNeighbourIDs(deltaLayer, deltaTheta, deltaPhi);
- }
- public long[] getOldIDs()
- {
- IDEncoder enc = new IDEncoder(oldDecoder.getIDDescription());
- long[] old = new long[nganged*nganged];
- int n = oldDecoder.getFieldCount();
- int[] vals = new int[n];
- int[] ovals = new int[n];
- for(int i=0;i<n;i++)
- {
- vals[i] = oldDecoder.getValue(i);
- ovals[i] = oldDecoder.getValue(i);
- }
- int i0 = oldDecoder.getFieldIndex(fields[0]);
- int i1 = oldDecoder.getFieldIndex(fields[1]);
- int index = 0;
- for(int j0=0;j0<nganged;j0++)
- {
- vals[i0] = ovals[i0]*nganged + j0;
- for(int j1=0;j1<nganged;j1++)
- {
- vals[i1] = ovals[i1]*nganged + j1;
- old[index] = enc.setValues(vals);
- index++;
- }
- }
- return old;
- }
- public long gangedCellID(long oldid)
- {
- oldDecoder.setID(oldid);
- int n = oldDecoder.getFieldCount();
- int[] vals = new int[n];
- for(int i=0;i<n;i++)
- {
- vals[i] = oldDecoder.getValue(i);
- }
- int i0 = oldDecoder.getFieldIndex(fields[0]);
- int i1 = oldDecoder.getFieldIndex(fields[1]);
- if(vals[i0] < 0)
- {
- vals[i0] = (vals[i0] + 1)/nganged - 1;
- }
- else
- {
- vals[i0] /= nganged;
- }
- if(vals[i1] < 0)
- {
- vals[i1] = (vals[i1] + 1)/nganged - 1;
- }
- else
- {
- vals[i1] /= nganged;
- }
- IDEncoder enc = new IDEncoder(oldDecoder.getIDDescription());
- return enc.setValues(vals);
- }
-
-}
lcsim/src/org/lcsim/recon/ganging
diff -N GangedSimCalorimeterHit.java
--- GangedSimCalorimeterHit.java 23 May 2008 03:12:10 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,154 +0,0 @@
-/*
- * GangedSimCalorimeterHit.java
- *
- * Created on October 16, 2006, 12:06 PM
- *
- */
-
-package org.lcsim.recon.ganging;
-import org.lcsim.event.SimCalorimeterHit;
-import org.lcsim.event.MCParticle;
-import org.lcsim.geometry.*;
-import org.lcsim.event.EventHeader.LCMetaData;
-import org.lcsim.event.base.BaseCalorimeterHit;
-
-/**
- * Implement SimCalorimeterHit for a ganged hit
- *
- * @author cassell
- */
-public class GangedSimCalorimeterHit
-extends BaseCalorimeterHit
-implements SimCalorimeterHit
-{
- protected double rawEnergy;
- protected double correctedEnergy;
- protected long cellID;
- IDDecoder decoder;
- LCMetaData data;
- Subdetector subd;
- protected double[] pos;
- protected double time;
- int ncont;
- double[] Econt;
- MCParticle[] MCcont;
- double[] tcont;
-// int[] pdgcont;
-
- /** Creates a new instance of GangedSimCalorimeterHit */
- public GangedSimCalorimeterHit(SimCalorimeterHit h,int gang)
- {
-//
-// Simply store most of the info
-//
- rawEnergy = h.getRawEnergy();
- correctedEnergy = h.getCorrectedEnergy();
- data = h.getMetaData();
- subd = h.getSubdetector();
- time = h.getTime();
- ncont = h.getMCParticleCount();
- Econt = new double[ncont];
- tcont = new double[ncont];
-// pdgcont = new int[ncont];
- MCcont = new MCParticle[ncont];
- for(int i=0;i<ncont;i++)
- {
- Econt[i] = h.getContributedEnergy(i);
- tcont[i] = h.getContributedTime(i);
-// pdgcont[i] = h.getPDG(i);
- MCcont[i] = h.getMCParticle(i);
- }
- decoder = new GangedCalorimeterIDDecoder(h.getIDDecoder(),gang);
- cellID = ((GangedCalorimeterIDDecoder)decoder).gangedCellID(h.getCellID());
- pos = null;
- }
- public void addHit(SimCalorimeterHit h)
- {
- rawEnergy += h.getRawEnergy();
- correctedEnergy += h.getCorrectedEnergy();
- if(h.getTime() < time)time = h.getTime();
- int newcount = 0;
- int newcont = h.getMCParticleCount();
- int[] indx = new int[newcont];
- for(int i=0;i<newcont;i++)
- {
- boolean found = false;
- for(int j=0;j<ncont;j++)
- {
- if(h.getMCParticle(i) == MCcont[j])
- {
- Econt[j] += h.getContributedEnergy(i);
- found = true;
- }
- }
- if(!found)
- {
- indx[newcount] = i;
- newcount++;
- }
- }
- if(newcount > 0)
- {
- double[] newEcont = new double[ncont+newcount];
- double[] newtcont = new double[ncont+newcount];
-// int[] newpdgcont = new int[ncont+newcount];
- MCParticle[] newMCcont = new MCParticle[ncont+newcount];
- for(int i=0;i<ncont;i++)
- {
- newEcont[i] = Econt[i];
- newtcont[i] = tcont[i];
-// newpdgcont[i] = pdgcont[i];
- newMCcont[i] = MCcont[i];
- }
- for(int j=0;j<newcount;j++)
- {
- newEcont[ncont+j] = h.getContributedEnergy(indx[j]);
- newtcont[ncont+j] = h.getContributedTime(indx[j]);
-// newpdgcont[ncont+j] = h.getPDG(indx[j]);
- newMCcont[ncont+j] = h.getMCParticle(indx[j]);
- }
- ncont += newcount;
- Econt = newEcont;
- tcont = newtcont;
- // pdgcont = newpdgcont;
- MCcont = newMCcont;
- }
- }
- public int getMCParticleCount()
- {return ncont;}
- public MCParticle getMCParticle(int index)
- {return MCcont[index];}
- public double getContributedEnergy(int index)
- {return Econt[index];}
- public double getContributedTime(int index)
- {return tcont[index];}
- public int getPDG(int index)
- {
-// return pdgcont[index];
- return 0;
- }
- public double getRawEnergy()
- {return rawEnergy;}
- public double getCorrectedEnergy()
- {return correctedEnergy;}
- public long getCellID()
- {return cellID;}
- public IDDecoder getIDDecoder()
- {return decoder;}
- public Subdetector getSubdetector()
- {return subd;}
- public LCMetaData getMetaData()
- {return data;}
- public double getTime()
- {return time;}
- public double[] getPosition()
- {
- if(pos == null)
- {
- decoder.setID(cellID);
- pos = decoder.getPosition();
- }
- return pos;
- }
-
-}
lcsim/src/org/lcsim/recon/ganging
diff -N GangingDriver.java
--- GangingDriver.java 6 Dec 2007 23:59:05 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,40 +0,0 @@
-/*
- * GangingDriver.java
- *
- * Created on October 19, 2006, 7:22 AM
- *
- */
-
-package org.lcsim.recon.ganging;
-import org.lcsim.util.Driver;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.CalorimeterHit;
-import java.util.List;
-
-/**
- * Simple example driver to put a collection of ganged CalorimeterHits into event
- *
- * @author cassell
- */
-public class GangingDriver extends Driver
-{
- String inputCollName;
- String outputCollName;
- int ngang;
- GangCalorimeterHits ganger;
-
- /** Creates a new instance of GangingDriver */
- public GangingDriver(String name,int n)
- {
- ngang = n;
- inputCollName = name;
- outputCollName = "Ganged"+name+n+"x"+n;
- ganger = new GangCalorimeterHits();
- }
- public void process(EventHeader event)
- {
- List<CalorimeterHit> coll = ganger.GangCollection(event,inputCollName, ngang);
- event.put(outputCollName,coll);
- }
-
-}
CVSspam 0.2.8