LCDetectors
diff -u -r1.17 -r1.18
--- Makefile 6 Oct 2006 00:25:17 -0000 1.17
+++ Makefile 6 Oct 2006 01:23:17 -0000 1.18
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.17 2006/10/06 00:25:17 jeremy Exp $
+# $Id: Makefile,v 1.18 2006/10/06 01:23:17 jeremy Exp $
#
# Makefile using GeomConverter and shell tools to
@@ -39,6 +39,11 @@
DAWNCUT=dawncut
endif
+# What editor to use?
+ifndef EDITOR
+ EDITOR=emacs
+endif
+
# Location of the LCSim website.
# Default is SLAC NFS.
ifndef PRJ_WWW
@@ -70,14 +75,17 @@
echo "cvs_commit - commit changes to single detector"; \
echo "dawn - generate prim file for DAWN for single detector"; \
echo "gdml - make GDML file for single detector"; \
+ echo "godl - make GODL file for single detector"; \
echo "heprep - make HepRep file for single detector"; \
echo "lcdd - make LCDD file for single detector"; \
echo "new - create a new detector"; \
+ echo "ogl - load the LCDD into SLIC and start OpenGL viewer"; \
echo "olap - check a single detector for overlaps"; \
echo "mkdir - make directory for new detector"; \
echo "oiv - load LCDD file into Geant4 OpenInventor viewer"; \
echo "properties - create detector.properties file for single detector"; \
echo "root - load the GDML file into the ROOT OpenGL viewer"; \
+ echo "slic - load the LCDD file into SLIC"; \
echo "template - copy template files to new detector dir"; \
echo "tree - output drawTree command to file"; \
echo "update - update single detector to WWW"; \
@@ -89,6 +97,7 @@
echo "build_all - rebuild all detectors"; \
echo "cleanup_all - make fresh copies of all detectors"; \
echo "gdml_all - make gdml files for all detectors"; \
+ echo "godl_all - make GODL file for single detector"; \
echo "lcdd_all - make LCDD files for all detectors"; \
echo "heprep_all - make HepRep files for all detectors"; \
echo "olap_all - check all detectors for overlaps"; \
@@ -166,6 +175,11 @@
@for detector in $(DETECTORS); do \
$(MAKE) heprep DETECTOR=$$detector; done
+# Create the GODL file for each detector.
+godl_all:
+ @for detector in $(DETECTORS); do \
+ $(MAKE) godl DETECTOR=$$detector; done
+
# Detector tree for all.
tree_all:
@for detector in $(DETECTORS); do \
@@ -217,78 +231,83 @@
# Create the LCDD file for a single detector.
lcdd:
- @echo "Creating LCDD file for $(DETECTOR) ..." ; \
- $(GEOMCONVERTER) -o lcdd ./detectors/$(DETECTOR)/compact.xml ./detectors/$(DETECTOR)/$(DETECTOR).lcdd;
+ @$(GEOMCONVERTER) -o lcdd ./detectors/$(DETECTOR)/compact.xml ./detectors/$(DETECTOR)/$(DETECTOR).lcdd &>/dev/null; \
+ echo "Created ./detectors/$(DETECTOR)/$(DETECTOR).lcdd"
# Use SLIC to dump a pure GDML file for a single detector.
gdml:
- @echo "Creating GDML file for $(DETECTOR) ..." ; \
- $(SLICBIN) -g ./detectors/$(DETECTOR)/$(DETECTOR).lcdd -G ./detectors/$(DETECTOR)/$(DETECTOR).gdml;
+ @$(SLICBIN) -g ./detectors/$(DETECTOR)/$(DETECTOR).lcdd -G ./detectors/$(DETECTOR)/$(DETECTOR).gdml &>/dev/null; \
+ echo "Created ./detectors/$(DETECTOR)/$(DETECTOR).gdml"
-# Load the LCDD file into SLIC.
+# Load the LCDD file into SLIC and visualize with OpenGL.
slic:
- @echo "Loading $(DETECTOR) into slic ..."; \
- $(SLICBIN) -g ./detectors/$(DETECTOR)/$(DETECTOR).lcdd -m ./g4macros/opengl.mac -n;
+ @$(SLICBIN) -g ./detectors/$(DETECTOR)/$(DETECTOR).lcdd -n;
-# Load the LCDD file into SLIC.
+# Load the LCDD file into SLIC and visualize with OpenGL.
+ogl:
+ @$(SLICBIN) -g ./detectors/$(DETECTOR)/$(DETECTOR).lcdd -m ./g4macros/opengl.mac -n;
+
+# Load the LCDD file into SLIC and visualize with OpenInvetor.
oiv:
- @echo "Loading $(DETECTOR) into Geant4/Inventor ..."; \
- $(SLICBIN) -g ./detectors/$(DETECTOR)/$(DETECTOR).lcdd -m ./g4macros/oiv.mac -n;
+ @$(SLICBIN) -g ./detectors/$(DETECTOR)/$(DETECTOR).lcdd -m ./g4macros/oiv.mac -n;
# Generate the prim file for DAWN.
dawn:
- @echo "Creating prim file for $(DETECTOR) ..."; \
- $(SLICBIN) -g ./detectors/$(DETECTOR)/$(DETECTOR).lcdd -m ./g4macros/dawn.mac; \
- mv g4_00.prim ./detectors/$(DETECTOR)/$(DETECTOR).prim;
+ @$(SLICBIN) -g ./detectors/$(DETECTOR)/$(DETECTOR).lcdd -m ./g4macros/dawn.mac &>/dev/null; \
+ mv g4_00.prim ./detectors/$(DETECTOR)/$(DETECTOR).prim; \
+ echo "Created ./detectors/$(DETECTOR)/$(DETECTOR).prim"
# Do a ZY cutaway using dawncut.
dawncut_zy:
- @echo "Applying dawncut 1 0 0 0 to $(DETECTOR) ..."; \
- $(DAWNCUT) 1 0 0 0 ./detectors/$(DETECTOR)/$(DETECTOR).prim ./detectors/$(DETECTOR)/$(DETECTOR)_cut_zy.prim; \
- $(DAWN) ./detectors/$(DETECTOR)/$(DETECTOR)_cut_zy.prim;
+ @$(DAWNCUT) 1 0 0 0 ./detectors/$(DETECTOR)/$(DETECTOR).prim ./detectors/$(DETECTOR)/$(DETECTOR)_cut_zy.prim &>/dev/null; \
+ echo "Created ./detectors/$(DETECTOR)/$(DETECTOR)_cut_zy.prim"
+
+# FIXME: Launching dawn/ghostview after the dawncut seems to hang my machine! --JM
# Do a ZX cutaway using dawncut.
dawncut_zx:
- @echo "Applying dawncut 0 1 0 0 to $(DETECTOR) ..."; \
- $(DAWNCUT) 0 1 0 0 ./detectors/$(DETECTOR)/$(DETECTOR).prim ./detectors/$(DETECTOR)/$(DETECTOR)_cut_zx.prim; \
- $(DAWN) ./detectors/$(DETECTOR)/$(DETECTOR)_cut_zx.prim;
+ @$(DAWNCUT) 0 1 0 0 ./detectors/$(DETECTOR)/$(DETECTOR).prim ./detectors/$(DETECTOR)/$(DETECTOR)_cut_zx.prim &>/dev/null; \
+ echo "Created ./detectors/$(DETECTOR)/$(DETECTOR)_cut_zx.prim"
# Do an XY cutaway using dawncut.
dawncut_xy:
- @echo "Applying dawncut 0 0 0 1 to $(DETECTOR) ..."; \
- $(DAWNCUT) 0 0 1 0 ./detectors/$(DETECTOR)/$(DETECTOR).prim ./detectors/$(DETECTOR)/$(DETECTOR)_cut_xy.prim; \
- $(DAWN) ./detectors/$(DETECTOR)/$(DETECTOR)_cut_xy.prim;
+ @$(DAWNCUT) 0 0 1 0 ./detectors/$(DETECTOR)/$(DETECTOR).prim ./detectors/$(DETECTOR)/$(DETECTOR)_cut_xy.prim &>/dev/null; \
+ echo "Created ./detectors/$(DETECTOR)/$(DETECTOR)_cut_xy.prim"
# Generate a VRML file.
vrml:
- @echo "Creating VRML file for $(DETECTOR) .."; \
- $(SLICBIN) -g ./detectors/$(DETECTOR)/$(DETECTOR).lcdd -m ./g4macros/vrml.mac; \
- mv g4_00.wrl ./detectors/$(DETECTOR)/$(DETECTOR).wrl;
+ @$(SLICBIN) -g ./detectors/$(DETECTOR)/$(DETECTOR).lcdd -m ./g4macros/vrml.mac &>/dev/null; \
+ mv g4_00.wrl ./detectors/$(DETECTOR)/$(DETECTOR).wrl; \
+ echo "Created ./detectors/$(DETECTOR)/$(DETECTOR).wrl"
# Check a detector for overlaps.
olap:
- @echo "Checking $(DETECTOR) for overlaps ..."; \
- $(SLICBIN) -g ./detectors/$(DETECTOR)/$(DETECTOR).lcdd -m ./g4macros/olap.mac &> ./detectors/$(DETECTOR)/$(DETECTOR)_olap_check.txt;
+ @$(SLICBIN) -g ./detectors/$(DETECTOR)/$(DETECTOR).lcdd -m ./g4macros/olap.mac &> ./detectors/$(DETECTOR)/$(DETECTOR)_olap_check.txt; \
+ echo "Created ./detectors/$(DETECTOR)/$(DETECTOR)_olap_check.txt"
# Output the text geometry tree.
tree:
- @echo "Outputting geometry tree for $(DETECTOR) ..."; \
- $(SLICBIN) -g ./detectors/$(DETECTOR)/$(DETECTOR).lcdd -m ./g4macros/tree.mac &> ./detectors/$(DETECTOR)/$(DETECTOR)_geom_tree.txt;
+ @$(SLICBIN) -g ./detectors/$(DETECTOR)/$(DETECTOR).lcdd -m ./g4macros/tree.mac &> ./detectors/$(DETECTOR)/$(DETECTOR)_geom_tree.txt; \
+ echo "Created ./detectors/$(DETECTOR)/$(DETECTOR)_geom_tree.txt"
# Only define this target if ROOT is defined in the user environment.
ifdef ROOTSYS
# Load the GDML file into the Python/GDML/ROOT viewer.
root:
- @echo "Loading $(DETECTOR) into ROOT ..."; \
- $(PYTHON) -i $(ROOTSYS)/gdml/GDMLROOT.py file://$(PWD)/detectors/$(DETECTOR)/$(DETECTOR).gdml;
+ @$(PYTHON) -i $(ROOTSYS)/gdml/GDMLROOT.py file://$(PWD)/detectors/$(DETECTOR)/$(DETECTOR).gdml;
endif
# Use GeomConverter to create the HepRep file for a single detector.
heprep:
- @echo "Creating HepRep file for $(DETECTOR)..." ; \
- $(GEOMCONVERTER) -o heprep ./detectors/$(DETECTOR)/compact.xml ./detectors/$(DETECTOR)/detector.heprep;
+ @$(GEOMCONVERTER) -o heprep ./detectors/$(DETECTOR)/compact.xml ./detectors/$(DETECTOR)/$(DETECTOR).heprep &>/dev/null; \
+ echo "Created ./detectors/$(DETECTOR)/$(DETECTOR).heprep"
+
+# Use GeomConverter to create the GODL file for a single detector.
+godl:
+ @$(GEOMCONVERTER) -o godl ./detectors/$(DETECTOR)/compact.xml ./detectors/$(DETECTOR)/$(DETECTOR).godl &>/dev/null; \
+ echo "Created ./detectors/$(DETECTOR)/$(DETECTOR).godl"
# Commit changes to LCDetectors cvs for a single detector.
cvs_commit:
@@ -304,28 +323,34 @@
# Recreate the detector.properties file for a single detector.
properties:
- @echo "name: $(DETECTOR)" > detectors/$(DETECTOR)/detector.properties
+ @echo "name: $(DETECTOR)" > detectors/$(DETECTOR)/detector.properties; \
+ echo "Created detectors/$(DETECTOR)/detector.properties"
# Create the zip file for a single detector.
zip:
- @echo "Creating zip file for $(DETECTOR) ..."; \
- if [ -e detectors/$(DETECTOR).zip ]; then rm detectors/$(DETECTOR).zip; fi; \
+ @if [ -e detectors/$(DETECTOR).zip ]; then rm detectors/$(DETECTOR).zip; fi; \
cd detectors/$(DETECTOR); \
- for f in $$(find . -print | grep -v CVS); do zip -o $(DETECTOR) $$f &> /dev/null; done; \
+ for f in $$(find . -print | grep -v CVS); do zip -o $(DETECTOR) $$f &>/dev/null; done; \
chmod 775 $(DETECTOR).zip; \
zipinfo $(DETECTOR).zip; \
cd ../..; \
- mv detectors/$(DETECTOR)/$(DETECTOR).zip detectors;
+ mv detectors/$(DETECTOR)/$(DETECTOR).zip detectors; \
+ echo "Created detectors/$(DETECTOR).zip"
# Create a new detector.
new: mkdir template properties
# Cleanup a detector directory by deleting and then recheckout from CVS.
-cleanup:
- @echo "Cleaning up $(DETECTOR) ... "; \
- rm -rf ./detectors/$(DETECTOR); \
- cvs update -d detectors/$(DETECTOR);
+realclean:
+ @rm -rf ./detectors/$(DETECTOR); \
+ cvs update -d detectors/$(DETECTOR); \
+ echo "Fetched clean version of $(DETECTOR)"
+
+# Edit the compact description for this detector.
+edit:
+ @$(EDITOR) ./detectors/$(DETECTOR)/compact.xml;
+# FIXME: Date check doesn't seem to work always. --JM
# Update detector to the website if necessary.
# update:
# @if [[ "$(PWD)/detectors/$(DETECTOR).zip" -nt "$(PRJ_WWW)/detectors/$(DETECTOR).zip" ]]; then \