16 TString rootVersion =
"",
TString aliphysicsVersion =
"vAN-20180105-1",
17 TString dataDir =
"/alice/sim/2016/LHC16e2_plus",
18 TString dataPattern =
"p20/*/AliESDs.root",
20 TString outDir =
"Sim/LHC15o/EmbedV2b/Resolution/20GeV",
21 Int_t maxFilesPerJob = 500,
Int_t maxMergeFiles = 10,
Int_t maxMergeStages = 2,
55 if (smode ==
"saf3" &&
gSystem->GetFromPipe(
"hostname") !=
"nansafmaster3.in2p3.fr") {
61 TFile* outFile = TFile::Open(
"results.root",
"READ");
62 if (!outFile || !outFile->IsOpen())
return;
63 outFile->FindObjectAny(
"convergenceRes")->Draw();
64 outFile->FindObjectAny(
"convergenceShift")->Draw();
69 gROOT->ProcessLine(
".include $ALICE_ROOT/include");
70 gROOT->ProcessLine(
".include $ALICE_PHYSICS/include");
74 if (smode ==
"saf3") gROOT->LoadMacro(
"MuonResolution.C++g");
75 else gROOT->LoadMacro(
"$ALICE_PHYSICS/PWGPP/MUON/dep/MuonResolution.C++g");
76 MuonResolution(smode, inputFileName, nSteps, rootVersion, aliphysicsVersion, dataDir, dataPattern, runFormat, outDir, maxFilesPerJob, maxMergeFiles, maxMergeStages, selectPhysics, selectTrigger, matchTrig, applyAccCut, applyPDCACut, minMomentum, minPt,
isMC, correctForSystematics, extrapMode, shiftHalfCh, shiftDE,
nevents);
89 if (
gSystem->AccessPathName(saf3dir.Data()))
gSystem->Exec(Form(
"mkdir %s", saf3dir.Data()));
90 if (
gSystem->AccessPathName(Form(
"%s/.vaf", saf3dir.Data()))) {
91 Int_t ret =
gSystem->Exec(Form(
"sshfs -o ssh_command=\"gsissh -p1975\" nansafmaster3.in2p3.fr: %s", saf3dir.Data()));
93 cout<<
"mounting of saf3 folder failed"<<endl;
103 cout <<
"cp problem" << endl;
108 gSystem->Exec(Form(
"sed -i '' 's/VafAliPhysicsVersion.*/VafAliPhysicsVersion=\"%s\"/g' $HOME/saf3/.vaf/vaf.conf", aliphysicsVersion.Data()));
112 analysisLocation.ReplaceAll(Form(
"%s/",
gSystem->Getenv(
"HOME")),
"");
113 gSystem->Exec(Form(
"gsissh -p 1975 -t -Y nansafmaster3.in2p3.fr 'cd %s; ~/saf3-enter \"\" \"./runAnalysis.sh 2>&1 | tee runAnalysis.log; exit\"'", analysisLocation.Data()));
116 gSystem->Exec(Form(
"cp -p %s/%s/*.root .", saf3dir.Data(), analysisLocation.Data()));
128 if (
gSystem->AccessPathName(Form(
"%s/.vaf", saf3dir.Data()))) {
129 cout<<
"saf3 folder is not mounted"<<endl;
130 cout<<
"please retry as it can take some time to mount it"<<endl;
135 remoteLocation.ReplaceAll(
gSystem->Getenv(
"HOME"),saf3dir.Data());
136 if (
gSystem->AccessPathName(remoteLocation.Data()))
gSystem->Exec(Form(
"mkdir -p %s", remoteLocation.Data()));
138 gSystem->Exec(Form(
"cp -p $ALICE_PHYSICS/PWGPP/MUON/dep/RunMuonResolution.C %s/RunMuonResolution.C", remoteLocation.Data()));
139 gSystem->Exec(Form(
"cp -p $ALICE_PHYSICS/PWGPP/MUON/dep/MuonResolution.C %s/MuonResolution.C", remoteLocation.Data()));
140 gSystem->Exec(Form(
"cp -p $ALICE_PHYSICS/PWGPP/MUON/dep/AddTaskMuonResolution.C %s/AddTaskMuonResolution.C", remoteLocation.Data()));
142 gSystem->Exec(Form(
"cp runAnalysis.sh %s/runAnalysis.sh", remoteLocation.Data()));
144 if (dataset.EndsWith(
".txt")) {
145 gSystem->Exec(Form(
"cat %s | awk {'print $1\";Mode=cache\"}' > datasetSaf3.txt", dataset.Data()));
146 gSystem->Exec(Form(
"cp datasetSaf3.txt %s/datasetSaf3.txt", remoteLocation.Data()));
147 }
else if (dataset.EndsWith(
".root"))
148 gSystem->Exec(Form(
"cp %s %s/%s", dataset.Data(), remoteLocation.Data(),
gSystem->BaseName(dataset.Data())));
158 ofstream outFile(
"runAnalysis.sh");
159 outFile <<
"#!/bin/bash" << endl;
160 outFile <<
"vafctl start" << endl;
162 outFile <<
"nWorkers=" << nWorkers << endl;
163 outFile <<
"let \"nWorkers -= `pod-info -n`\"" << endl;
164 outFile <<
"echo \"requesting $nWorkers additional workers\"" << endl;
165 outFile <<
"vafreq $nWorkers" << endl;
166 outFile <<
"vafwait " << nWorkers << endl;
167 TString macro =
gSystem->GetFromPipe(
"tail -n 1 $HOME/.root_hist | sed 's/(.*)//g;s/^\.x\ //g;s:^.*/::g'");
168 TString arg =
gSystem->GetFromPipe(
"tail -n 1 $HOME/.root_hist | sed 's/.*(/(/g'");
169 if (dataset.EndsWith(
".txt")) arg.ReplaceAll(dataset.Data(),
"datasetSaf3.txt");
170 else if (dataset.EndsWith(
".root")) arg.ReplaceAll(dataset.Data(),
gSystem->BaseName(dataset.Data()));
171 outFile <<
"root -b -q '" << macro.Data() << arg.Data() <<
"'" << endl;
172 outFile <<
"vafctl stop" << endl;
174 gSystem->Exec(
"chmod u+x runAnalysis.sh");
void RunMuonResolution(TString smode="local", TString inputFileName="AliESDs.root", Int_t nSteps=5, TString rootVersion="", TString aliphysicsVersion="vAN-20180105-1", TString dataDir="/alice/sim/2016/LHC16e2_plus", TString dataPattern="p20/*/AliESDs.root", TString runFormat="%d", TString outDir="Sim/LHC15o/EmbedV2b/Resolution/20GeV", Int_t maxFilesPerJob=500, Int_t maxMergeFiles=10, Int_t maxMergeStages=2, Bool_t selectPhysics=kTRUE, Bool_t selectTrigger=kTRUE, Bool_t matchTrig=kTRUE, Bool_t applyAccCut=kTRUE, Bool_t applyPDCACut=kTRUE, Double_t minMomentum=20., Double_t minPt=0., Bool_t isMC=kFALSE, Bool_t correctForSystematics=kTRUE, Int_t extrapMode=1, Bool_t shiftHalfCh=kFALSE, Bool_t shiftDE=kFALSE, Int_t nevents=1234567890)
void MuonResolution(TString smode, TString inputFileName, Int_t nSteps, TString rootVersion, TString aliphysicsVersion, TString dataDir, TString dataPattern, TString runFormat, TString outDir, Int_t maxFilesPerJob, Int_t maxMergeFiles, Int_t maxMergeStages, Bool_t selectPhysics, Bool_t selectTrigger, Bool_t matchTrig, Bool_t applyAccCut, Bool_t applyPDCACut, Double_t minMomentum, Double_t minPt, Bool_t isMC, Bool_t correctForSystematics, Int_t extrapMode, Bool_t shiftHalfCh, Bool_t shiftDE, Int_t nevents)
void CreateSAF3Executable(TString dataset)
Bool_t RunAnalysisOnSAF3(TString aliphysicsVersion, TString dataset)
Bool_t CopyFileOnSAF3(TString dataset)