Script to extract noise gain corrections
authorcholm <Christian.Holm.Christensen@cern.ch>
Wed, 7 May 2014 10:40:29 +0000 (12:40 +0200)
committercholm <Christian.Holm.Christensen@cern.ch>
Wed, 7 May 2014 10:40:29 +0000 (12:40 +0200)
PWGLF/FORWARD/analysis2/corrs/ExtractNoiseGain.C [new file with mode: 0644]

diff --git a/PWGLF/FORWARD/analysis2/corrs/ExtractNoiseGain.C b/PWGLF/FORWARD/analysis2/corrs/ExtractNoiseGain.C
new file mode 100644 (file)
index 0000000..3efa137
--- /dev/null
@@ -0,0 +1,55 @@
+#include <fstream>
+
+/**
+ * Forward directory 
+ * 
+ */
+const char* fwd = "$ALICE_ROOT/PWGLF/FORWARD/analysis2";
+
+const char* url = "https://alice-logbook.cern.ch/logbook/date_online.php?p_cont=sb&p_rsob=l.run&p_rsob_dir=DESC&ptcf_rtc=%2CExactly%2CFMD%3B%2CAt+least&prsf_rtype=PHYSICS%2C&p_rspn=1&prsf_rn=";
+
+/** 
+ * Extract the noise/gain correction 
+ * 
+ */
+void
+ExtractNoiseGain(Long_t runNo=0) 
+{
+
+  gSystem->AddIncludePath(Form("-I%s -I$ALICE_ROOT/include", fwd));
+  gROOT->Macro(Form("%s/scripts/LoadLibs.C", fwd));
+  gROOT->LoadMacro("ExtractNG.C+");
+
+  std::ofstream f("Upload.C");
+  f << "// Generated by ExtractELoss.C\n"
+    << "TString MakeDest(const TString& dest, const TString& fname)\n"
+    << "{\n"
+    << "  TString tmp(dest);\n"
+    << "  if (!tmp.IsNull()) {\n"
+    << "    if (!tmp.EndsWith(\"/\")) tmp.Append(\"/\");\n"
+    << "    tmp.Append(fname);\n"
+    << "  }\n"
+    << "  return tmp;\n"
+    << "}\n\n"
+    << "void Upload(const TString& dest=\"\")\n"
+    << "{\n"
+    << "  gROOT->Macro(\"" << fwd << "/scripts/LoadLibs.C\");\n"
+    << "  \n"
+    << "  const char* fmdFile = \"fmd_corrections.root\";\n"
+    << "  TString fdest = MakeDest(dest, fmdFile);\n"
+    << "  \n"
+    << "  AliForwardCorrectionManager::Instance().Append(fmdFile, fdest);\n"
+    << "}\n"
+    << "// EOF\n"
+    << std::endl;
+  f.close();
+
+  if (runNo > 0) ExtractForRun(runNo);
+  else           ExtractAll();
+  
+  Info("ExtractNoiseGain", 
+       "Run generated Upload.C(DEST) script to copy files in place");
+}
+// 
+// EOF
+//