From fd461ca4219a1bef742e3cc8243950304e84c69b Mon Sep 17 00:00:00 2001
From: "theodore.efremov" <theodore.efremov@cea.fr>
Date: Mon, 28 Oct 2024 11:34:41 +0100
Subject: [PATCH] Made the snakemake implementation more generic and updated
 the readme

---
 Projects/AlPhaPha/2024/ReadMe.md            | 17 +++++++++++++++++
 Projects/AlPhaPha/2024/Snakefile            |  6 +++---
 Projects/AlPhaPha/2024/convert_snakemake.sh |  2 +-
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/Projects/AlPhaPha/2024/ReadMe.md b/Projects/AlPhaPha/2024/ReadMe.md
index 5e43e5374..409ab1485 100644
--- a/Projects/AlPhaPha/2024/ReadMe.md
+++ b/Projects/AlPhaPha/2024/ReadMe.md
@@ -16,3 +16,20 @@ cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1
 
 ## Do not forget
 In project config modifiy analysis output before doing a test analysis
+
+# Config NPTOOL
+when doing cmake for npl do -DNPMULTITHREADING=0 to facilitate multithreading
+with snakemake
+
+# Config for SnakeMake
+ 
+You *NEED* Python3.12
+
+## venv 
+```
+python3.12 -m venv ./.venv
+source ./.venv/bin.activate
+pip install snakemake
+```
+
+Your project.config must point to the root dir of your computer
diff --git a/Projects/AlPhaPha/2024/Snakefile b/Projects/AlPhaPha/2024/Snakefile
index 08299b90b..d43e8eb2c 100644
--- a/Projects/AlPhaPha/2024/Snakefile
+++ b/Projects/AlPhaPha/2024/Snakefile
@@ -3,7 +3,7 @@ import subprocess
 
 # Lire le répertoire d'entrée depuis les arguments de configuration
 #input_directory = config["folder"]
-input_directory = "/home/efremovt/bin/nptool/Projects/AlPhaPha/DataMacro/output/"
+input_directory = os.getcwd() + "/../DataMacro/output"
 origin = [] 
 # Iterate over files in input_directory
 for filename in os.listdir(input_directory):
@@ -12,14 +12,14 @@ for filename in os.listdir(input_directory):
     origin.append(filename)
 
 # Définir le répertoire de sortie pour les fichiers convertis
-phy_directory = "/home/efremovt/bin/nptool/Projects/AlPhaPha/DataMacro/output/analysis"
+phy_directory = os.getcwd() + "/../DataMacro/output/analysis"
 #phy_directory = "./"
 
 # define target files directory
 analysedfile = []
 for inputfile in origin:
   #analysedfile.append("/home/morfouacep/Physics/NPTool/nptool/Projects/ana_e850/root/analysis/"+inputfile.replace("_raw_","_"))
-  analysedfile.append("/home/efremovt/bin/nptool/Projects/AlPhaPha/DataMacro/output/analysis/"+inputfile)
+  analysedfile.append( os.getcwd() + "/../DataMacro/output/analysis/"+inputfile)
 
 ## batch rules
 rule all:
diff --git a/Projects/AlPhaPha/2024/convert_snakemake.sh b/Projects/AlPhaPha/2024/convert_snakemake.sh
index 9ff64f032..10a5f3daf 100755
--- a/Projects/AlPhaPha/2024/convert_snakemake.sh
+++ b/Projects/AlPhaPha/2024/convert_snakemake.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 echo "- executing snakemake file for npanalysis..."
-snakemake --cores 8 --forceall --keep-incomplete --keep-going --rerun-incomplete
+snakemake --cores 30 --forceall --keep-incomplete --keep-going --rerun-incomplete
 echo "- snakemake executed successfully!"
 echo "- Merging file..."
 root -q '../DataMacro/Merger.C(16,"root/analysis","VamosCalib241","../DataMacro/output/analysis/run_raw_241_")'
-- 
GitLab