From 04fce5f0dbd39072503929e6b67614cc8087bd97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20Asorey?= <asoreyh@gmail.com> Date: Wed, 19 Jul 2017 00:08:42 -0300 Subject: [PATCH] No need to enter into sim and src directory --- Makefile | 18 +++++++++++++++--- README.md | 33 +++++++++++++++------------------ configs.h | 1 + data/Makefile | 10 ---------- default.inp | 1 + sim/Makefile | 8 ++++++++ {data => sim}/default.inp | 8 ++++---- src/Makefile | 21 ++++++++++++++------- 8 files changed, 58 insertions(+), 42 deletions(-) create mode 120000 configs.h delete mode 100644 data/Makefile create mode 120000 default.inp create mode 100644 sim/Makefile rename {data => sim}/default.inp (97%) diff --git a/Makefile b/Makefile index 6e5cef7..94192b3 100644 --- a/Makefile +++ b/Makefile @@ -24,16 +24,28 @@ # try to preserve encoding CC = g++ +CODE_DIR = src +SIM_DIR = sim TESTS = check-lago -TARGETS = CFLAGS = -Wall -all: $(TESTS) $(TARGETS) +all: $(TESTS) + $(MAKE) -C $(CODE_DIR) + $(MAKE) -C $(CODE_DIR) install .PHONY: clean clean: - rm -f $(TARGETS) + rm -f bin/* + $(MAKE) -C $(CODE_DIR) clean + +run: + $(MAKE) -C $(SIM_DIR) + +fullclean: + rm -f bin/* + $(MAKE) -C $(CODE_DIR) clean + $(MAKE) -C $(SIM_DIR) clean check-lago: ifndef LAGO_EASY diff --git a/README.md b/README.md index 1a40080..cf5cc80 100644 --- a/README.md +++ b/README.md @@ -28,11 +28,7 @@ Please follow this simple instructions. ## Requirements -You just need a working [ROOT](http://root.cern.ch/) installation (ROOT v 5.34.36 or higher is the recommended version). Then you just - make -from this directory. It will create the - LAGO_EASY -environment variable and modify the *.bashrc* file. Please source it again before to continue. +You just need a working [ROOT](http://root.cern.ch/) installation (ROOT v 5.34.36 or higher is the recommended version). Then you just execute <kbd>make</kbd> at the main directory. It will create the <kbd>${LAGO_EASY}</kbd> environment variable and modify the <kbd>$HOME/.bashrc</kbd> file. Please source it again before to continue. Please report any installation problems please [email us](mailto:lago@lagoproject.org). @@ -40,32 +36,33 @@ Please report any installation problems please [email us](mailto:lago@lagoprojec ### Modifying geometry -The detector geometry is defined in the *Constants.h* file, located at the *src* directory. To modify it: - cd $LAGO_EASY - vim src/Constants.h +The detector geometry is defined in the <kbd>src/Constants.h</kbd> file. A symbolink link named <kbd>configs.h</kbd> is provided. To modify just edit this file: + + <kbd>vim configs.h</kbd> and modify it by changing the values of STATION_RADIUS, STATION_HEIGHT and the number and position of PMTs (NPM X_PM and Y_PM). For example, for one of our detectors deployed at the LAGO Bariloche site, the configuring block is: ``` cpp +//DETECTOR CONSTANTS const double STATION_RADIUS = 0.70; //(m) const double STATION_HEIGHT = 1.46; //(m) const int NPM = 1; const double X_PM[NPM] = {0.}; // (0,0) is the center of the tank roof const double Y_PM[NPM] = {0.}; // (0,0) is the center of the tank roof +const double RAD_PM = .1477;//(m) +const double HC_PM = .0776;//(m) +const double TOP_FACT = 1.; //white top ``` -Then recompile it - cd $LAGO_EASY/src +If you change detector geometry, you will need to recompile the whole package. Just execute <kbd>make</kbd> at the parent directory: +```bash + cd ${LAGO_EASY}/src make +``` ## Running -Go to the data directory, - - cd $LAGO_EASY/data +The simulation execution is governed by the <kbd>default.inp</kbd> file. Just edit if following the examples given in that file. It is straightforward. Please be sure to be in CALIB mode (SHOWER mode is deactivated in LAGO code). Then, for run the simulation just use -and edit the *default.inp* file. It is straightforward. Be sure to be in CALIB mode (SHOWER mode is deactivated in LAGO code). Then, just run it from the data directory using *make*: - - make + <kbd>make run</kbd> -It will provide a **root** file with a specific name depending on the parameters defined in the *default.inp* file. It is then converted in ASCII, extracting the FADC traces, producing a *.dat* ASCII file. -~ +in the parent directory. It will provide a <kbd>.root</kbd> file with a specific name depending on the parameters defined in the <kbd>default.inp</kbd> file. It is then converted into ASCII, extracting the FADC traces, producing a <kbd>.dat</kbd> ASCII file. diff --git a/configs.h b/configs.h new file mode 120000 index 0000000..59f040c --- /dev/null +++ b/configs.h @@ -0,0 +1 @@ +src/Constants.h \ No newline at end of file diff --git a/data/Makefile b/data/Makefile deleted file mode 100644 index 7694f33..0000000 --- a/data/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -all: - cd ../src && make - @echo "../src/EasySim" - @../src/EasySim || true - @for i in *.root ; do nm=`basename $$i .root`; [ -f $$nm.dat ] || (echo "../src/Ascii $$i > $$nm.dat" && ../src/Ascii $$i > $$nm.dat && echo "Done"); done - @for i in *.root ; do nm=`basename $$i .root`; [ $$nm.dat -nt $$i ] || (echo "../src/Ascii $$i > $$nm.dat" && ../src/Ascii $$i > $$nm.dat && echo "Done"); done - @rm *.root - -clean: - rm -f calib_*.dat calib_*.root diff --git a/default.inp b/default.inp new file mode 120000 index 0000000..7507a1d --- /dev/null +++ b/default.inp @@ -0,0 +1 @@ +sim/default.inp \ No newline at end of file diff --git a/sim/Makefile b/sim/Makefile new file mode 100644 index 0000000..78750bd --- /dev/null +++ b/sim/Makefile @@ -0,0 +1,8 @@ +all: + @echo "../bin/EasySim" + @../bin/EasySim || true + @for i in *.root; do nm=`basename $$i .root`; [ -f $$nm.dat ] || (echo "../bin/Ascii $$i > $$nm.dat" && ../bin/Ascii $$i > $$nm.dat && echo "Done"); done + @for i in *.root ; do nm=`basename $$i .root`; [ $$nm.dat -nt $$i ] || (echo "../bin/Ascii $$i > $$nm.dat" && ../bin/Ascii $$i > $$nm.dat && echo "Done"); done + +clean: + rm -f calib_*.dat calib_*.root diff --git a/data/default.inp b/sim/default.inp similarity index 97% rename from data/default.inp rename to sim/default.inp index 32c3764..e9e494a 100644 --- a/data/default.inp +++ b/sim/default.inp @@ -7,7 +7,7 @@ ################################################ # # number of events (Number of particles injected in station) -NEvents 100 +NEvents 10000 # runnumber (Used for File naming, can be any string) RunNumber 01 # partmode (VEM| FIXEDTHETA| RANDOM| SCINTILLATOR| HORIZONTAL) @@ -15,11 +15,11 @@ RunNumber 01 # FIXEDTHETA for a fixed theta defined below # RANDOM for sin2theta distribution as expected # other should not be used -PartMode VEM +PartMode RANDOM # partcode (3 for muons, 2 for electrons, 1 for gammas,0 for all) -PartCode 3 +PartCode 0 # partenergy (in GeV = 1 Gev for VEM, 0=spectrum) -PartEnergy 1 +PartEnergy 0 # parttheta (in degrees relevant only in FIXEDTHETA mode) PartTheta 0 # diff --git a/src/Makefile b/src/Makefile index c494e3c..12edb54 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,29 +1,36 @@ -CPPFLAGS= -DCALIBONLY -Wno-deprecated -I`root-config --cflags` +CC=g++ +CPPFLAGS= -DCALIBONLY -Wno-deprecated -I`root-config --cflags` -Wall LINKFLAGS= `root-config --libs` SRC=Event.o Station.o Array.o Particle.o EventDict.o ShowerParam.o Utils.o BuildProcessesTables.o FastSimulation.o ManageEvent.o EasySimConfig.o Analyze.o AnaDict.o -all: EasySim Ascii Trace +TARGETS=EasySim Ascii Trace + +all: $(TESTS) $(TARGETS) EventDict.cc: Event.h Station.h Array.h Particle.h EasySimLinkDef.h rootcint -f EventDict.cc -c Event.h Station.h Array.h Particle.h EasySimLinkDef.h + AnaDict.cc: Analyze.h rootcint -f AnaDict.cc -c Analyze.h .o: - g++ -c $< + $(CC) -c $< EasySim: ${SRC} EasySim.o - g++ -o $@ ${SRC} EasySim.o ${LINKFLAGS} + $(CC) -o $@ ${SRC} EasySim.o ${LINKFLAGS} Ascii: ${SRC} Ascii.o - g++ -o $@ ${SRC} Ascii.o ${LINKFLAGS} + $(CC) -o $@ ${SRC} Ascii.o ${LINKFLAGS} Trace: - g++ -o $@ trace.cc + $(CC) -o $@ trace.cc clean: - rm -f *.o *Dict* EasySim Ascii Trace + rm -f $(TARGETS) *.o *Dict* + +install: + cp $(TARGETS) ../bin/ # dependencies added by makedep (and slightly alterated for ROOT dictionnaries) # DO NOT DELETE -- GitLab