8 * @ingroup pwglf_forward_scripts_corr
11 Backup(const TString& fname, Int_t n=10)
13 TString fn(fname); fn.Append(Form(".%d", n));
14 if (!gSystem->AccessPathName(fn.Data())) {
15 Error("Backup", "Last possible backup slot (%d) filled for %s",
20 for (Int_t i=n-1; i >= 0; i--) {
22 if (i > 0) fi.Append(Form(".%d", i));
23 if (gSystem->AccessPathName(fi.Data())) continue;
25 TString fb(fname); fb.Append(Form(".%d", i+1));
27 if (gSystem->Rename(fi.Data(), fb.Data())) {
28 Error("Backup", "Failed to backup %s to %s", fi.Data(), fb.Data());
42 * @ingroup pwglf_forward_scripts_corr
49 case AliForwardCorrectionManager::kSecondaryMap:
50 nWhat = "secondary map"; break;
51 case AliForwardCorrectionManager::kDoubleHit:
52 nWhat = "double hit"; break;
53 case AliForwardCorrectionManager::kVertexBias:
54 nWhat = "vertex bias"; break;
55 case AliForwardCorrectionManager::kMergingEfficiency:
56 nWhat = "merging efficiency";break;
57 case AliForwardCorrectionManager::kELossFits:
58 nWhat = "energy loss fits"; break;
60 Info("MakeWhat", " Copying %s corrections", nWhat.Data());
62 AliForwardCorrectionManager& mgr = AliForwardCorrectionManager::Instance();
63 TString dir = gSystem->ExpandPathName(mgr.GetFileDir(what));
65 // Make the directory if it doesn't exist
66 if (gSystem->AccessPathName(dir.Data())) {
67 Info("MakeWhat", " Making directory %s ... ", dir.Data());
68 if (gSystem->mkdir(dir.Data(), true)) {
69 Error("MakeWhat", "couldn't make directory %s", dir.Data());
74 TString pattern = mgr.GetFileName(what, 1, 900, 5, false);
75 pattern.ReplaceAll("0900GeV", "[0-9]+GeV");
76 pattern.ReplaceAll("pp", "[a-zA-Z]+");
77 pattern.ReplaceAll("p5kG", "[pm][0-9]+kG");
78 pattern.ReplaceAll("real", "[a-zA-Z]+");
80 TPRegexp regex(pattern);
82 TSystemDirectory sysdir(".", ".");
83 TIter next(sysdir.GetListOfFiles());
84 TSystemFile* file = 0;
85 while ((file = static_cast<TSystemFile*>(next()))) {
86 if (file->IsDirectory()) continue;
87 TString fname(file->GetName());
89 if (!regex.Match(fname)) continue;
91 // Info("MakeWhat", " match: %s", fname.Data());
92 TString to(gSystem->ConcatFileName(dir.Data(), fname.Data()));
94 if (!Backup(to)) return false;
96 Info("MakeWhat", " copying %s\n to %s",
97 fname.Data(), to.Data());
98 if (gSystem->CopyFile(fname.Data(), to.Data(), false)) {
99 Error("MakeWhat", "Failed to copy %s to %s", fname.Data(), to.Data());
113 * @ingroup pwglf_forward_scripts_corr
116 MoveCorrections(bool sec=true,
122 Info("MoveCorrections", "Loadingl libraries ...");
123 gROOT->Macro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/LoadLibs.C");
125 Info("MoveCorrections", "Moving selected corrections ...");
126 if (sec) MoveWhat(AliForwardCorrectionManager::kSecondaryMap);
127 if (dbl) MoveWhat(AliForwardCorrectionManager::kDoubleHit);
128 if (vtx) MoveWhat(AliForwardCorrectionManager::kVertexBias);
129 if (merge) MoveWhat(AliForwardCorrectionManager::kMergingEfficiency);
130 if (eloss) MoveWhat(AliForwardCorrectionManager::kELossFits);