RunAnalyzer.C 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * \brief Helper macros for analyzing name.femtoDst.root files using FemtoDstAnalyzer.C
  3. *
  4. * This macros takes inFileName argument with a femtoDst.root file
  5. * or with a list of files (name.lis or name.list). It sets _VANILLA_ROOT_
  6. * (necessary for standalone mode), loads pre-compiled libStFemtoDst.so
  7. * (from StFemtoEvent), compiles and executes a text
  8. * FemtoDstAnalyzer.C macro with passing inFileName to it, and
  9. * cleans up the directory from the compilation products at the end.
  10. *
  11. * Some details:
  12. * inFileName - is a name of name.femtoDst.root file or a name
  13. * of a name.lis(t) files that contains a list of
  14. * name1.femtoDst.root files.
  15. * NOTE: inFileName should contain either /absolutePath/inFileName
  16. * or /relative2currentDir/inFileName
  17. * It is assumed that FemtoDstAnalyzer.C is placed in the same
  18. * directory where the RunAnalyzer.C is stored.
  19. *
  20. * \author Grigory Nigmatkulov
  21. * \date July 5, 2018
  22. */
  23. // ROOT headers
  24. #include "TROOT.h"
  25. #include "TSystem.h"
  26. #include "TString.h"
  27. //_________________
  28. void RunAnalyzer(const Char_t *inFileName = "st_physics_12150008_raw_4030001.femtoDst.root", const Char_t *outFile = "./star_basic_hists.root") {
  29. // Next line is not needed if you are not running in a standalone mode
  30. gROOT->ProcessLine("#define _VANILLA_ROOT_");
  31. gSystem->Load("../build/libStFemtoDst.so");
  32. TString str;
  33. str = ".x FemtoDstAnalyzer.C+(\"";
  34. str += inFileName;
  35. str += "\",\"";
  36. str += outFile;
  37. str += "\")";
  38. gROOT->ProcessLine( str.Data() );
  39. // Next line should be commented if you run in a batch mode
  40. gROOT->ProcessLine(".!rm -f FemtoDstAnalyzer_C* ");
  41. }