diff --git a/Makefile b/Makefile index 079b7f7b5..c08215ae4 100644 --- a/Makefile +++ b/Makefile @@ -13,17 +13,17 @@ MAKE += -s -SHELL=/bin/bash +SHELL :=/bin/bash # Basic directories -TOP = $(shell pwd) -SR = $(TOP)/src -IN = $(TOP)/include -LB = $(TOP)/lib -BN = $(TOP)/bin -HT = $(TOP)/doc/html -CT = $(TOP)/cint -CF = $(TOP)/config +TOP := $(shell pwd) +SR := $(TOP)/src +IN := $(TOP)/include +LB := $(TOP)/lib +BN := $(TOP)/bin +HT := $(TOP)/doc/html +CT := $(TOP)/cint +CF := $(TOP)/config #------------------------------------------------------------------------------ # Included options (result of ./configure) @@ -54,7 +54,7 @@ LDFLAGS += -L$(LB) #------------------------------------------------------------------------------ # Commands: -CMD= +CMD := #.NOPARALLEL: .EXPORT_ALL_VARIABLES: all copy miw geo geolib @@ -71,8 +71,8 @@ only: info glo geo spe rev siv res mim evi rea fre add cos #------------------------------------------------------------------------------ # Version check: -ROOTVERSIONOK = $(shell bash $(CF)/configure_rootversiontest ) -GEANT4VERSIONOK = $(shell bash $(CF)/configure_geant4versiontest ) +ROOTVERSIONOK := $(shell bash $(CF)/configure_rootversiontest ) +GEANT4VERSIONOK := $(shell bash $(CF)/configure_geant4versiontest ) #------------------------------------------------------------------------------ diff --git a/bin/dcosima b/bin/dcosima index 55e85311f..365bc070d 100755 --- a/bin/dcosima +++ b/bin/dcosima @@ -46,7 +46,7 @@ commandhelp() { echo " --source=[filename]: The source file" echo " --continue=[name]: Continue a simulation run with the given name (ignores --source & --prefix)" echo " --delay=[number] Time between searches for free slots -- the longer the delay time the lower the priority of this instance (default: 10 seconds)" - echo " --zip: Compress the output files." + echo " --unzip: Do not compress the output files (gzip'ing them is the default)." echo " --log: Create a log file of what is started where" echo " --help: Show this help." echo "" @@ -80,7 +80,7 @@ SOURCE="" SOURCEFILENAME="" INSTANCES="1" PREFIX="" -ZIP="FALSE" +ZIP="TRUE" CONTINUE="" LOG="FALSE" LOGFILE="" @@ -109,6 +109,8 @@ for C in "${CMD[@]}"; do CONTINUE=`echo ${C} | awk -F"=" '{ print $2 }'` elif [[ ${C} == *-z* ]]; then ZIP="TRUE" + elif [[ ${C} == *-u* ]]; then + ZIP="FALSE" elif [[ ${C} == *-d* ]]; then DELAY=`echo ${C} | awk -F"=" '{ print $2 }'` elif [[ ${C} == *-l* ]]; then @@ -234,6 +236,12 @@ if [[ ${LOG} == "TRUE" ]]; then echo " * Logging output to file: ${LOGFILE}" fi +if [[ ${ZIP} == "TRUE" ]]; then + echo " * Gzip'ing output" +else + echo " * Not gzip'ing output" +fi + if [[ ${INSTANCES} -gt 0 ]]; then echo " * Simulations instances: ${INSTANCES}" else @@ -674,7 +682,11 @@ if [[ ${LAUNCHED} -gt 0 ]]; then echo " " >> ${ConcatFileName} for (( i=1; i <= ${INSTANCES}; i+=1 )); do - echo "IN ${Base}.p1.inc${i}.id1.sim" >> ${ConcatFileName} + if [[ "${ZIP}" == "TRUE" ]]; then + echo "IN ${Base}.p1.inc${i}.id1.sim.gz" >> ${ConcatFileName} + else + echo "IN ${Base}.p1.inc${i}.id1.sim" >> ${ConcatFileName} + fi done echo "EN" >> ${ConcatFileName} diff --git a/bin/dcosima-runinstance b/bin/dcosima-runinstance index 47a5d47a9..ce1023fba 100755 --- a/bin/dcosima-runinstance +++ b/bin/dcosima-runinstance @@ -265,7 +265,7 @@ OUT="/dev/null" if [[ ${LOGFILE} != "" ]]; then OUT="Sim.inc${INSTANCEID}.log" fi -ssh -i ${HOME}/.ssh/dmegalib_rsa -p ${REMOTEPORT} ${REMOTEUSER}@${REMOTEHOST} ". ~/.dmegalib.bashrc; cd ${MASTERDIR}/${RUNDIR}; nohup nice -n ${NICELEVEL} cosima -p 1 -f ${INSTANCEID} -t ${RUNDIR} -v 0 -s ${SEED} `if [[ ${ZIP} == TRUE ]]; then echo "-z"; fi` ${SOURCEFILE} > ${OUT} 2>&1 &" +ssh -i ${HOME}/.ssh/dmegalib_rsa -p ${REMOTEPORT} ${REMOTEUSER}@${REMOTEHOST} ". ~/.dmegalib.bashrc; cd ${MASTERDIR}/${RUNDIR}; nohup nice -n ${NICELEVEL} cosima -p 1 -f ${INSTANCEID} -t ${RUNDIR} -v 0 -s ${SEED} `if [[ ${ZIP} == FALSE ]]; then echo "-u"; fi` ${SOURCEFILE} > ${OUT} 2>&1 &" if [ "$?" != "0" ]; then echo "ERROR: Failed to start the simulations" | ${LOGGING} exit 1 diff --git a/bin/dmegalib-setup b/bin/dmegalib-setup index ca39cf432..6dbb11568 100755 --- a/bin/dmegalib-setup +++ b/bin/dmegalib-setup @@ -18,7 +18,7 @@ commandhelp() { echo "" echo ""; echo "Example: " - echo " dmegalib-setup --machines=thebe,despina,carpo,sinope,carme,royal,leda,elara,cosi-ccu"; + echo " dmegalib-setup --machines=thebe,despina,carpo,dione,sinope,carme,leda,royal"; echo ""; } diff --git a/config/Makefile.linuxclang b/config/Makefile.linuxclang index 569b007a5..c601a599c 100644 --- a/config/Makefile.linuxclang +++ b/config/Makefile.linuxclang @@ -9,23 +9,23 @@ #---------------------------------------------------------------- -CMODE = "Linux with clang compiler" -DLL = so +CMODE := "Linux with clang compiler" +DLL := so # Basic flags generated by ROOT -ROOTCFLAGS = $(shell root-config --cflags) -ROOTLIBS = $(shell root-config --libs) -ROOTGLIBS = $(shell root-config --glibs) +ROOTCFLAGS := $(shell root-config --cflags) +ROOTLIBS := $(shell root-config --libs) +ROOTGLIBS := $(shell root-config --glibs) # Compiler & linker options: -CXX = clang++ -CXXFLAGS = $(OPT) -std=c++0x -Wall -Wno-deprecated -fPIC -Wno-overloaded-virtual -D_REENTRANT -I$(IN) -I$(CT) -I. $(ROOTCFLAGS) -D___LINUX___ -D___CLING___ -DEFINES = -UHARDWARE -LD = clang++ -LDFLAGS = $(OPT) -D___LINUX___ -SOFLAGS = -shared -LIBS = $(ROOTLIBS) -lpthread -lThread -lMinuit -lGeom -lSpectrum -lTMVA -GLIBS = $(ROOTGLIBS) -DEPFLAGS = -MD -MF +CXX := clang++ +CXXFLAGS := $(OPT) -std=c++0x -Wall -Wno-deprecated -fPIC -Wno-overloaded-virtual -D_REENTRANT -I$(IN) -I$(CT) -I. $(ROOTCFLAGS) -D___LINUX___ -D___CLING___ +DEFINES := -UHARDWARE +LD := clang++ +LDFLAGS := $(OPT) -D___LINUX___ +SOFLAGS := -shared +LIBS := $(ROOTLIBS) -lpthread -lThread -lMinuit -lGeom -lSpectrum -lTMVA +GLIBS := $(ROOTGLIBS) +DEPFLAGS := -MD -MF -LINK = ln -s -f +LINK := ln -s -f diff --git a/config/Makefile.linuxgcc b/config/Makefile.linuxgcc index db54c9d91..d9f7ca68b 100644 --- a/config/Makefile.linuxgcc +++ b/config/Makefile.linuxgcc @@ -9,30 +9,30 @@ #---------------------------------------------------------------- -CMODE = "Linux with gcc utilizing C++14" -DLL = so +CMODE := "Linux with gcc utilizing C++14" +DLL := so # Basic flags generated by ROOT -ROOTCFLAGS = $(shell root-config --cflags) -ROOTLIBS = $(shell root-config --libs) -ROOTGLIBS = $(shell root-config --glibs) +ROOTCFLAGS := $(shell root-config --cflags) +ROOTLIBS := $(shell root-config --libs) +ROOTGLIBS := $(shell root-config --glibs) # Compiler & linker options: -CXX = g++ -CXXFLAGS = $(OPT) -std=c++14 -Wall -Wno-deprecated -fPIC -D_REENTRANT -I$(IN) -I$(CT) -I. $(ROOTCFLAGS) -D___LINUX___ -D___CLING___ -DEFINES = -UHARDWARE -LD = g++ -LDFLAGS = $(OPT) -D___LINUX___ -SOFLAGS = -shared -LIBS = $(ROOTLIBS) -lpthread -lThread -lMinuit -lGeom -lSpectrum -lTMVA -GLIBS = $(ROOTGLIBS) -DEPFLAGS = -MM +CXX := g++ +CXXFLAGS := $(OPT) -std=c++14 -Wall -Wno-deprecated -fPIC -D_REENTRANT -I$(IN) -I$(CT) -I. $(ROOTCFLAGS) -D___LINUX___ -D___CLING___ +DEFINES := -UHARDWARE +LD := g++ +LDFLAGS := $(OPT) -D___LINUX___ +SOFLAGS := -shared +LIBS := $(ROOTLIBS) -lpthread -lThread -lMinuit -lGeom -lSpectrum -lTMVA +GLIBS := $(ROOTGLIBS) +DEPFLAGS := -MM -LINK = ln -s -f +LINK := ln -s -f # HEASoft -HEACFLAGS = -HEALIBS = +HEACFLAGS := +HEALIBS := ifneq ("$(wildcard $(LHEASOFT)/include/fitsio.h)", "") HEACFLAGS += -I$(LHEASOFT)/include HEALIBS += -L$(LHEASOFT)/lib diff --git a/config/Makefile.linuxicc b/config/Makefile.linuxicc index 16e03d1c8..5cd22386d 100644 --- a/config/Makefile.linuxicc +++ b/config/Makefile.linuxicc @@ -9,23 +9,23 @@ #---------------------------------------------------------------- -CMODE = "Linux with icc compiler" -DLL = so +CMODE := "Linux with icc compiler" +DLL := so # Basic flags generated by ROOT -ROOTCFLAGS = $(shell root-config --cflags) -ROOTLIBS = $(shell root-config --libs) -ROOTGLIBS = $(shell root-config --glibs) +ROOTCFLAGS := $(shell root-config --cflags) +ROOTLIBS := $(shell root-config --libs) +ROOTGLIBS := $(shell root-config --glibs) # Compiler & linker options: -CXX = icc -CXXFLAGS = $(OPT) -fPIC -wd1572 -wd1125 -wd654 -wd191 -wd1224 -wd1476 -wd913 -I$(IN) -I$(CT) -I. $(ROOTCFLAGS) -D___LINUX___ -D___CLING___ -DEFINES = -UHARDWARE -LD = icc -LDFLAGS = $(OPT) -D___LINUX___ -SOFLAGS = -shared -LIBS = $(ROOTLIBS) -lpthread -lThread -lMinuit -lGeom -lSpectrum -lTMVA -GLIBS = $(ROOTGLIBS) -DEPFLAGS = -M +CXX := icc +CXXFLAGS := $(OPT) -fPIC -wd1572 -wd1125 -wd654 -wd191 -wd1224 -wd1476 -wd913 -I$(IN) -I$(CT) -I. $(ROOTCFLAGS) -D___LINUX___ -D___CLING___ +DEFINES := -UHARDWARE +LD := icc +LDFLAGS := $(OPT) -D___LINUX___ +SOFLAGS := -shared +LIBS := $(ROOTLIBS) -lpthread -lThread -lMinuit -lGeom -lSpectrum -lTMVA +GLIBS := $(ROOTGLIBS) +DEPFLAGS := -M -LINK = ln -s -f +LINK := ln -s -f diff --git a/config/Makefile.macosx b/config/Makefile.macosx index f76bd6281..7ed957113 100644 --- a/config/Makefile.macosx +++ b/config/Makefile.macosx @@ -9,31 +9,31 @@ #---------------------------------------------------------------- -CMODE = "MacOSX with clang compiler" -ARCH = macosx -DLL = so +CMODE := "MacOSX with clang compiler" +ARCH := macosx +DLL := so # Basic flags generated by ROOT -ROOTCFLAGS = $(shell root-config --cflags) -ROOTLIBS = $(shell root-config --libs) -ROOTGLIBS = $(shell root-config --glibs) +ROOTCFLAGS := $(shell root-config --cflags) +ROOTLIBS := $(shell root-config --libs) +ROOTGLIBS := $(shell root-config --glibs) # Compiler & linker options: -CXX = c++ -CXXFLAGS = $(OPT) -std=c++14 -pipe -Wall -fPIC -D_REENTRANT -I$(IN) -I$(CT) -I. $(ROOTCFLAGS) -D___MACOSX___ -D___CLING___ -Wno-unused-but-set-variable -Wno-overloaded-virtual -Wno-tautological-undefined-compare -Wno-deprecated-declarations -DEFINES = -UHARDWARE -LD = c++ -LDFLAGS = $(OPT) -Xlinker -bind_at_load -flat_namespace -D___MACOSX___ -SOFLAGS = -dynamiclib -flat_namespace -undefined suppress -LIBS = $(ROOTLIBS) -lpthread -lThread -lMinuit -lGeom -lSpectrum -lTMVA -GLIBS = $(ROOTGLIBS) -DEPFLAGS = -M - -LINK = ln -s -f +CXX := c++ +CXXFLAGS := $(OPT) -std=c++14 -pipe -Wall -fPIC -D_REENTRANT -I$(IN) -I$(CT) -I. $(ROOTCFLAGS) -D___MACOSX___ -D___CLING___ -Wno-unused-but-set-variable -Wno-overloaded-virtual -Wno-tautological-undefined-compare -Wno-deprecated-declarations +DEFINES := -UHARDWARE +LD := c++ +LDFLAGS := $(OPT) -Xlinker -bind_at_load -flat_namespace -D___MACOSX___ +SOFLAGS := -dynamiclib -flat_namespace -undefined suppress +LIBS := $(ROOTLIBS) -lpthread -lThread -lMinuit -lGeom -lSpectrum -lTMVA +GLIBS := $(ROOTGLIBS) +DEPFLAGS := -M + +LINK := ln -s -f # HEASoft -HEACFLAGS = -HEALIBS = +HEACFLAGS := +HEALIBS := ifneq ("$(wildcard $(LHEASOFT)/include/fitsio.h)", "") HEACFLAGS += -I$(LHEASOFT)/include HEALIBS += -L$(LHEASOFT)/lib diff --git a/configure b/configure index 54d481b5b..3bbe40b2f 100755 --- a/configure +++ b/configure @@ -515,9 +515,9 @@ echo "# Section A: Additional libraries" >> config/Makefile.options echo "# " >> config/Makefile.options echo "# Important: Don't modify this sections by yourself " >> config/Makefile.options echo " " >> config/Makefile.options -echo "GEANT4INSTALLED = ${Geant4Found}" >> config/Makefile.options -echo "HEASOFTINSTALLED = ${FitsIOFound}" >> config/Makefile.options -echo "MPIINSTALLED = ${MPIFound}" >> config/Makefile.options +echo "GEANT4INSTALLED := ${Geant4Found}" >> config/Makefile.options +echo "HEASOFTINSTALLED := ${FitsIOFound}" >> config/Makefile.options +echo "MPIINSTALLED := ${MPIFound}" >> config/Makefile.options echo " " >> config/Makefile.options echo "# " >> config/Makefile.options @@ -538,7 +538,7 @@ if [[ ${ARCH} == linux ]]; then fi echo "Please see the file config/Makefile.options for more optimization options for the Intel and GNU compiler" echo "" >> config/Makefile.options -echo "OPT = ${OPTIONS}" >> config/Makefile.options +echo "OPT := ${OPTIONS}" >> config/Makefile.options if ( [ $Geant4Found -eq 0 ] ); then echo "$G4DEBUG" >> config/Makefile.options fi @@ -551,10 +551,10 @@ echo "# If you have anything else, set it in Makefile.user " >> confi echo "# " >> config/Makefile.options echo "" >> config/Makefile.options if ( [ $Geant4OpenGLFound -eq 0 ] ); then - echo "G4VIS_USE_OPENGLX=1" >> config/Makefile.options + echo "G4VIS_USE_OPENGLX := 1" >> config/Makefile.options fi if ( [ $Geant4DawnFileFound -eq 0 ] ); then - echo "G4VIS_USE_DAWNFILE=1" >> config/Makefile.options + echo "G4VIS_USE_DAWNFILE := 1" >> config/Makefile.options fi echo "" >> config/Makefile.options diff --git a/resource/examples/advanced/Atmosphere/make_all.sh b/resource/examples/advanced/Atmosphere/make_all.sh index 5a86fc4f9..0b3c16d48 100644 --- a/resource/examples/advanced/Atmosphere/make_all.sh +++ b/resource/examples/advanced/Atmosphere/make_all.sh @@ -1,6 +1,6 @@ for P in `ls *.cxx`; do - make -f ${MEGALIB}/resource/standalone/Makefile.standalone PRG=${P} + make -f ${MEGALIB}/resource/standalone/Makefile.StandAlone PRG=${P} done diff --git a/resource/examples/advanced/Pipeline/SimulateSources.sh b/resource/examples/advanced/Pipeline/SimulateSources.sh index 52ec3c6c8..0f95df8bf 100644 --- a/resource/examples/advanced/Pipeline/SimulateSources.sh +++ b/resource/examples/advanced/Pipeline/SimulateSources.sh @@ -32,7 +32,7 @@ PointSourceContinuumPolarizedTemplate=${MEGALIB}/resource/examples/advanced/Pipe THREADS=1 -NCPUS=`cat /proc/cpuinfo | grep "processor" | wc -l` +NCPUS=`grep ^cpu\\scores /proc/cpuinfo | uniq | awk '{print $4}'` # Create the directory where to store the simulation file if [ ! -d "${PointSourceDir}" ]; then diff --git a/src/addon/Makefile b/src/addon/Makefile index 38ced029c..61e645080 100644 --- a/src/addon/Makefile +++ b/src/addon/Makefile @@ -15,7 +15,7 @@ # Definitions: # -PRGSX = \ +PRGSX := \ $(BN)/SensitivityOptimizer \ $(BN)/Mask \ $(BN)/ConvertMGeant \ @@ -37,18 +37,18 @@ PRGSX = \ $(BN)/IsotopeFileSplitter \ $(BN)/VariableSourceDetector \ -FITS = \ +FITS := \ $(BN)/TraFitsConverter \ $(BN)/ConvertMGGPOD \ $(BN)/ResponseToXSPEC \ -MPI = $(BN)/bundler +MPI := $(BN)/bundler -MLIBS = -L$(LB) -lMimrecGui -lMimrec -lRevanGui -lRevan -lSivanGui -lSivan -lSpectralyzeGui -lSpectralyze -lGeomegaGui -lGeomega -lCommonMisc -lCommonGui +MLIBS := -L$(LB) -lMimrecGui -lMimrec -lRevanGui -lRevan -lSivanGui -lSivan -lSpectralyzeGui -lSpectralyze -lGeomegaGui -lGeomega -lCommonMisc -lCommonGui -EVERYTHING = $(PRGSX) $(FITS) +EVERYTHING := $(PRGSX) $(FITS) #---------------------------------------------------------------- # Commands: diff --git a/src/cosima/inc/MCEventAction.hh b/src/cosima/inc/MCEventAction.hh index 948c40d97..0af38137b 100644 --- a/src/cosima/inc/MCEventAction.hh +++ b/src/cosima/inc/MCEventAction.hh @@ -54,7 +54,7 @@ class MCEventAction : public G4UserEventAction public: /// Constructor taking the run parameters as argument MCEventAction(MCParameterFile& RunParameters, const bool Zip, - const long Seed); + const long Seed, const bool m_NoTimeOut); /// Default destructor virtual ~MCEventAction(); @@ -214,6 +214,12 @@ private: double m_TotalTime; /// Flag indicating if the timer has started bool m_TimerStarted; + /// Flag indicating that we should not consider time outs + bool m_NoTimeOut; + /// A time out - if no events are stored after this time stop the simulation + double m_TimeOut; + /// Flag indicating that we can ignore the time out since events have been stored + bool m_IgnoreTimeOut; /// Map of passive material name and deposited energy map m_PassiveMaterialMap; diff --git a/src/cosima/inc/MCMain.hh b/src/cosima/inc/MCMain.hh index 05c14e271..417a8b8f3 100644 --- a/src/cosima/inc/MCMain.hh +++ b/src/cosima/inc/MCMain.hh @@ -106,7 +106,9 @@ private: int m_ParallelID; /// Assigned fixed incarbation ID of the output file(s) int m_IncarnationID; - + /// No timeout: Normally the simulation times out if no events are stored, this flag prevents this + bool m_NoTimeOut; + /// Name of the parameter file MString m_ParameterFileName; /// Name of the macro file diff --git a/src/cosima/src/MCEventAction.cc b/src/cosima/src/MCEventAction.cc index e4448a857..3e8c47dbc 100644 --- a/src/cosima/src/MCEventAction.cc +++ b/src/cosima/src/MCEventAction.cc @@ -59,8 +59,8 @@ const int MCEventAction::c_InvalidCollID = -987; /****************************************************************************** * Default constructor */ -MCEventAction::MCEventAction(MCParameterFile& RunParameters, const bool Zip, const long Seed) : - m_RunParameters(RunParameters), m_Zip(Zip) +MCEventAction::MCEventAction(MCParameterFile& RunParameters, const bool Zip, const long Seed, const bool NoTimeOut) : + m_RunParameters(RunParameters), m_NoTimeOut(NoTimeOut), m_Zip(Zip) { m_OutFileName = ""; @@ -84,6 +84,8 @@ MCEventAction::MCEventAction(MCParameterFile& RunParameters, const bool Zip, con m_TotalTime = 0; m_TimerStarted = false; + m_TimeOut = 30*60; // seconds + m_IgnoreTimeOut = false; m_Interrupt = false; @@ -187,6 +189,7 @@ bool MCEventAction::NextRun() // Some final initializations m_TotalTime = 0; m_TimerStarted = false; + m_IgnoreTimeOut = false; m_Interrupt = false; @@ -733,6 +736,7 @@ void MCEventAction::EndOfEventAction(const G4Event* Event) if (m_RelegateEvents == true) { m_Relegator(E[e]); } + m_IgnoreTimeOut = true; } delete E[e]; @@ -746,6 +750,7 @@ void MCEventAction::EndOfEventAction(const G4Event* Event) if (m_RelegateEvents == true) { m_Relegator(m_Event); } + m_IgnoreTimeOut = true; } } @@ -830,6 +835,28 @@ void MCEventAction::EndOfEventAction(const G4Event* Event) } Run.Stop(); } + + if (m_NoTimeOut == false && m_IgnoreTimeOut == false) { + if (m_TotalTime > m_TimeOut) { + mout<SetUserInitialization(new MCPhysicsList(m_RunParameters)); - m_RunManager->SetUserAction(new MCEventAction(m_RunParameters, m_Zip, m_Seed)); + m_RunManager->SetUserAction(new MCEventAction(m_RunParameters, m_Zip, m_Seed, m_NoTimeOut)); // Set geometry @@ -256,6 +257,7 @@ unsigned int MCMain::ParseCommandLine(int argc, char** argv) Usage<<" -m: macro file name (type: *.mac)"<