[GraXML-commit] Graphics/JiveEvent/src/net/hep/atlas/graphics/JiveEvent/GeometricModel Calo.java,
Brought to you by:
hrivnac
From: Julius H. <hr...@us...> - 2008-06-26 17:09:12
|
Update of /cvsroot/graxml/Graphics/JiveEvent/src/net/hep/atlas/graphics/JiveEvent/GeometricModel In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv5393/net/hep/atlas/graphics/JiveEvent/GeometricModel Modified Files: Jet0.java JiveEventBuilder.java Added Files: Calo.java Log Message: LAr and TILE added Index: JiveEventBuilder.java =================================================================== RCS file: /cvsroot/graxml/Graphics/JiveEvent/src/net/hep/atlas/graphics/JiveEvent/GeometricModel/JiveEventBuilder.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** JiveEventBuilder.java 6 Jun 2008 13:26:48 -0000 1.15 --- JiveEventBuilder.java 26 Jun 2008 17:09:18 -0000 1.16 *************** *** 11,14 **** --- 11,17 ---- import atlantis.utils.xml.AXMLUtils; import atlantis.utils.xml.AXMLErrorHandler; + import atlantis.config.ADefaultValues; + import atlantis.geometry.AAtlasDetector; + import atlantis.Atlantis; // Java3D *************** *** 29,32 **** --- 32,37 ---- import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Node; + import java.util.Map; + import java.util.HashMap; /** <code>JiveEventBuilder</code> performs JiveEvent specific part *************** *** 35,38 **** --- 40,46 ---- * <pre> * $Log$ + * Revision 1.16 2008/06/26 17:09:18 hrivnac + * LAr and TILE added + * * Revision 1.15 2008/06/06 13:26:48 hrivnac * MDT + RPC added *************** *** 108,111 **** --- 116,122 ---- // Atlantis + // - ADefaultValues + ADefaultValues.readRuntimeValues(); + // - Apar if (APar.getGroup("Projection") == null) { log.info("Reading Atlantis configuration from " + ATLANTIS_CONFIG); *************** *** 116,119 **** --- 127,131 ---- parser.setErrorHandler(new AXMLErrorHandler()); Node rootNode = parser.parse(getClass().getClassLoader().getResource(ATLANTIS_CONFIG).openStream()).getDocumentElement(); + System.out.println("WWW WWW " + rootNode); new APar(AXMLUtils.getChild(rootNode, "Parameters")); } *************** *** 122,125 **** --- 134,145 ---- } } + // - AAtlasDetector (needed for LAr) + // TBD: include in JiveEvent + if (Atlantis.getDetector() == null) { + String geomIdCalo = "/home/hrivnac/work/Graphics/AtlantisJava/AtlantisJava/geometry/AGeometry.xml"; + String geomMuon = "/home/hrivnac/work/Graphics/AtlantisJava/AtlantisJava/geometry/AMuonGeometry.xml"; + AAtlasDetector detector = new AAtlasDetector(geomIdCalo, geomMuon); + Atlantis.setDetector(detector); + } } Index: Jet0.java =================================================================== RCS file: /cvsroot/graxml/Graphics/JiveEvent/src/net/hep/atlas/graphics/JiveEvent/GeometricModel/Jet0.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Jet0.java 6 Jun 2008 13:26:45 -0000 1.9 --- Jet0.java 26 Jun 2008 17:09:18 -0000 1.10 *************** *** 56,59 **** --- 56,62 ---- * <pre> * $Log$ + * Revision 1.10 2008/06/26 17:09:18 hrivnac + * LAr and TILE added + * * Revision 1.9 2008/06/06 13:26:45 hrivnac * MDT + RPC added *************** *** 139,143 **** EtaType eta, PhiType phi, ! EnergyType e) { construct(type, count, storeGateKey, eta, phi, e.getValue()); } --- 142,146 ---- EtaType eta, PhiType phi, ! EnergyType e) { construct(type, count, storeGateKey, eta, phi, e.getValue()); } --- NEW FILE: Calo.java --- package net.hep.atlas.graphics.JiveEvent.GeometricModel; // Generic Model import net.hep.atlas.graphics.JiveEvent.JAXB.LArType; // GraXML import net.hep.graphics.GraXML.BuildOptions; import net.hep.graphics.GraXML.GlobalOptions; import net.hep.graphics.GraXML.MasterBuilder; import net.hep.graphics.GraXML.Java3DExtensions.Interactivity.Interacter; import net.hep.graphics.GraXML.Disconnecter.DetachableConnection; import net.hep.graphics.GraXML.Java3DExtensions.BillboardGroup; // Atlantis import atlantis.utils.AHashMap; import atlantis.geometry.ACalorimeterDetector; import atlantis.graphics.ACoord; import atlantis.projection.AProjectionRZ; import atlantis.projection.AProjectionYX; import atlantis.utils.AIdHelper; import atlantis.utils.AAtlantisException; // Java3D import javax.media.j3d.Shape3D; import javax.media.j3d.Group; import javax.media.j3d.BranchGroup; import javax.media.j3d.TransformGroup; import javax.media.j3d.Transform3D; import javax.media.j3d.BoundingSphere; import javax.media.j3d.Appearance; import javax.media.j3d.Material; import javax.media.j3d.LineAttributes; import javax.media.j3d.PointAttributes; import javax.media.j3d.TransparencyAttributes; import javax.media.j3d.LineArray; import javax.media.j3d.PointArray; import javax.media.j3d.GeometryArray; import javax.vecmath.Matrix3d; import javax.vecmath.Point3d; import javax.vecmath.Vector3d; import javax.vecmath.Vector3f; import javax.vecmath.Point3f; import javax.vecmath.Color3f; // FreeHEP import org.freehep.j3d.Cuboid; // AWT import java.awt.Color; // Java import static java.lang.Math.toRadians; import static java.lang.Math.log; import static java.lang.Math.abs; import static java.lang.Math.sqrt; import static java.lang.Math.sin; import static java.lang.Math.cos; import static java.lang.Math.signum; import static java.lang.Math.PI; // Log4J import org.apache.log4j.Logger; /** GraXML representation of Calo Types. * <p><font color="#880088"> * <pre> * $Log: Calo.java,v $ * Revision 1.1 2008/06/26 17:09:18 hrivnac * LAr and TILE added * * </pre> * </font></p> * @opt attributes * @opt operations * @opt types * @opt visibility * @version $Id: Calo.java,v 1.1 2008/06/26 17:09:18 hrivnac Exp $ * @author <a href="mailto:Jul...@ce...">J.Hrivnac</a> */ public abstract class Calo extends JiveRep { public abstract void traverse(MasterBuilder builder, Object element, Group tg, String parent); /** Construct Java3D representation of those <em>Calo</em> cells. * @param type The Calo' type (name). * @param count The number of cells in a set. * @param storeGateKey The corresponding <em>StoreGate</em> key. * @param etas The cells' <em>eta</em>s. * @param phis The cell' <em>phi</em>s. * @param energys The cell' <em>energy</em>s. * @param ids The cell' <em>id</em>s. */ protected void construct(String type, int count, String storeGateKey, float[] etas, float[] phis, float[] energys, int[] ids) { // Draw all cells String name; String info; boolean outlinedBckp = Interacter.outlined(); Interacter.setOutlined(false); Shape3D shape; Appearance appearance; Material material; Color3f color; double[][][] rz = null; double[][][] yx = null; Point3d[] points; double zMin; double zMax; int det; ACalorimeterDetector detector; AProjectionRZ rzProjection = new AProjectionRZ(); AProjectionYX yxProjection = new AProjectionYX(); ACoord coordRZ; ACoord coordYX; // Loop over cells for (int i = 0; i < count; i++) { name = type + "(" + storeGateKey + "/" + i + ")"; info = name; color = color(); // ColorList is set => get Appearance from Color if (color == null) { color = new Color3f(); appearance = builder().appearance(name, name); material = appearance.getMaterial(); material.getSpecularColor(color); } // ColorList is not set => get Color from Appearance else { appearance = new Appearance(); appearance.setMaterial(new Material(color, color, color, color, 1f)); } appearance. setTransparencyAttributes(new TransparencyAttributes(TransparencyAttributes.NICEST, 0.0f)); setAppearance(appearance); // Construct and Use cells det = ACalorimeterDetector.getDetectorIndex(ids[i]); detector = ACalorimeterDetector.get(det); try { coordRZ = detector.getCell(rzProjection, etaIndex(ids[i]), phiIndex(ids[i]), sideIndex(ids[i])); rz = coordRZ.hv; coordYX = detector.getCell(yxProjection, etaIndex(ids[i]), phiIndex(ids[i]), sideIndex(ids[i])); yx = coordYX.hv; zMin = rz[0][0][0]; zMax = rz[0][0][0]; for (int j = 0; j < rz[0][0].length; j++) { if (rz[0][0][j] < zMin) zMin = rz[0][0][j]; if (rz[0][0][j] > zMin) zMax = rz[0][0][j]; } points = new Point3d[]{new Point3d(yx[0][0][0], yx[1][0][0], zMin), new Point3d(yx[0][0][1], yx[1][0][1], zMin), new Point3d(yx[0][0][2], yx[1][0][2], zMin), new Point3d(yx[0][0][3], yx[1][0][3], zMin), new Point3d(yx[0][0][0], yx[1][0][0], zMax), new Point3d(yx[0][0][1], yx[1][0][1], zMax), new Point3d(yx[0][0][2], yx[1][0][2], zMax), new Point3d(yx[0][0][3], yx[1][0][3], zMax)}; for (Point3d point : points) { point.scale(1.0 / builder().norm()); } shape = new Cuboid(points, appearance); shape.setAppearance(appearance); use(shape, name, info); } catch (AAtlantisException e) { log.error("Atlantis Calo cell cannot be processed", e); } } Interacter.setOutlined(outlinedBckp); } /** Give <code>eta</code> index corresponding to <code>cell</code> * index. * @param index The <code>cell</code> index. * @return The <code>eta </code>index. * @throws AAtlantisException if index cannot be mapped. */ abstract protected int etaIndex(int index) throws AAtlantisException; /** Give <code>phi</code> index corresponding to <code>cell</code> * index. * @param index The <code>cell</code> index. * @return The <code>phi </code>index. * @throws AAtlantisException if index cannot be mapped. */ abstract protected int phiIndex(int index) throws AAtlantisException; /** Give <code>side</code> index corresponding to <code>cell</code> * index. * @param index The <code>cell</code> index. * @return The <code>side </code>index. * @throws AAtlantisException if index cannot be mapped. */ abstract protected int sideIndex(int index) throws AAtlantisException; /** Give {@link Color3f} to be used for <em>i</em>s line segments. * @return The {@link Color3f} o be used for <em>i</em>s line segment, * <em>null</em> is colormap is not set. */ abstract protected Color3f color(); /** Logging . */ private static Logger log = Logger.getLogger(Calo.class); } |