Browse Source

Small fixes 3

ParfenovPeter 1 month ago
parent
commit
c85097f863
2 changed files with 31 additions and 3 deletions
  1. 2 0
      SetEnv.sh
  2. 29 3
      bin/main.cpp

+ 2 - 0
SetEnv.sh

@@ -4,3 +4,5 @@ export MCINI=/scratch2/parfenov/Soft/mcini-new
 export PHQMD_PATH=/scratch2/parfenov/Soft/hic-stuff
 export ANALYSISTREE_LIB=/scratch2/parfenov/Soft/AnalysisTree/install/lib
 export ANALYSISTREE_INC=/scratch2/parfenov/Soft/AnalysisTree/install/include
+
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ANALYSISTREE_LIB

+ 29 - 3
bin/main.cpp

@@ -1,5 +1,6 @@
 #include <iostream>
 #include <vector>
+#include <string>
 
 #include <TString.h>
 #include <TH1D.h>
@@ -41,9 +42,12 @@ int main(int argc, char **argv)
   TString iFileName, oFileName;
   TString outputFormat = "analysistree_v2";
 
+  std::string coll_system = "NN";
+  float coll_energy = -1.;
+
   if (argc < 7)
   {
-    std::cerr << "./convert -i input.list -o output.root -input_format [INPUT_FORMAT] [OPTIONAL: -output_format [OUTPUT_FORMAT]]" << std::endl;
+    std::cerr << "./convert -i input.list -o output.root -input_format [INPUT_FORMAT] [OPTIONAL: -output_format [OUTPUT_FORMAT] -system [SYSTEM] -energy [ENERGY]]" << std::endl;
     std::cerr << "Available input formats:" << std::endl;
     std::cerr << "\tmcpico - simple custom ROOT format to store model data" << std::endl;
     std::cerr << "\tparticle - ROOT format that is used by the SMASH model" << std::endl;
@@ -65,7 +69,9 @@ int main(int argc, char **argv)
     if (std::string(argv[i]) != "-i" &&
         std::string(argv[i]) != "-o" &&
         std::string(argv[i]) != "-input_format" &&
-        std::string(argv[i]) != "-output_format")
+        std::string(argv[i]) != "-output_format" &&
+        std::string(argv[i]) != "-system" &&
+        std::string(argv[i]) != "-energy")
     {
       std::cerr << "\n[ERROR]: Unknown parameter " << i << ": " << argv[i] << std::endl;
       return 2;
@@ -112,6 +118,26 @@ int main(int argc, char **argv)
         std::cerr << "\n[ERROR]: Output file format was not specified " << std::endl;
         return 1;
       }
+      if (std::string(argv[i]) == "-system" && i != argc - 1)
+      {
+        coll_system = std::string(argv[++i]);
+        continue;
+      }
+      if (std::string(argv[i]) == "-system" && i == argc - 1)
+      {
+        std::cerr << "\n[ERROR]: System was not specified " << std::endl;
+        return 1;
+      }
+      if (std::string(argv[i]) == "-energy" && i != argc - 1)
+      {
+        coll_energy = std::stof(std::string(argv[++i]));
+        continue;
+      }
+      if (std::string(argv[i]) == "-energy" && i == argc - 1)
+      {
+        std::cerr << "\n[ERROR]: Energy was not specified " << std::endl;
+        return 1;
+      }
     }
   }
 
@@ -171,7 +197,7 @@ int main(int argc, char **argv)
   qaEvent *event = nullptr;
   qaParticle *particle = nullptr;
 
-  writerManager->Init(oFileName.Data(), "modelTree");
+  writerManager->Init(oFileName.Data(), "modelTree", coll_system, coll_energy);
 
   for (Long64_t iev = 0; iev < Nentries; iev++)
   {