39 if (smode ==
"saf3" &&
gSystem->GetFromPipe(
"hostname") !=
"nansafmaster3.in2p3.fr") {
45 TFile* outFile = TFile::Open(
"results.root",
"READ");
46 if (!outFile || !outFile->IsOpen())
return;
47 outFile->FindObjectAny(
"convergenceRes")->Draw();
48 outFile->FindObjectAny(
"convergenceShift")->Draw();
53 gROOT->ProcessLine(
".include $ALICE_ROOT/include");
54 gROOT->ProcessLine(
".include $ALICE_PHYSICS/include");
58 if (smode ==
"saf3") gROOT->LoadMacro(
"MuonResolution.C++g");
59 else gROOT->LoadMacro(
"$ALICE_PHYSICS/PWGPP/MUON/dep/MuonResolution.C++g");
60 MuonResolution(smode, inputFileName, rootVersion, aliphysicsVersion, nSteps, selectPhysics, selectTrigger, matchTrig, applyAccCut, applyPDCACut, minMomentum, minPt,
isMC, correctForSystematics, extrapMode, shiftHalfCh, shiftDE,
nevents);
73 if (
gSystem->AccessPathName(saf3dir.Data()))
gSystem->Exec(Form(
"mkdir %s", saf3dir.Data()));
74 if (
gSystem->AccessPathName(Form(
"%s/.vaf", saf3dir.Data()))) {
75 Int_t ret =
gSystem->Exec(Form(
"sshfs -o ssh_command=\"gsissh -p1975\" nansafmaster3.in2p3.fr: %s", saf3dir.Data()));
77 cout<<
"mounting of saf3 folder failed"<<endl;
87 cout <<
"cp problem" << endl;
92 gSystem->Exec(Form(
"sed -i '' 's/VafAliPhysicsVersion.*/VafAliPhysicsVersion=\"%s\"/g' $HOME/saf3/.vaf/vaf.conf", aliphysicsVersion.Data()));
96 analysisLocation.ReplaceAll(Form(
"%s/",
gSystem->Getenv(
"HOME")),
"");
97 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()));
100 gSystem->Exec(Form(
"cp -p %s/%s/*.root .", saf3dir.Data(), analysisLocation.Data()));
112 if (
gSystem->AccessPathName(Form(
"%s/.vaf", saf3dir.Data()))) {
113 cout<<
"saf3 folder is not mounted"<<endl;
114 cout<<
"please retry as it can take some time to mount it"<<endl;
119 remoteLocation.ReplaceAll(
gSystem->Getenv(
"HOME"),saf3dir.Data());
120 if (
gSystem->AccessPathName(remoteLocation.Data()))
gSystem->Exec(Form(
"mkdir -p %s", remoteLocation.Data()));
122 gSystem->Exec(Form(
"cp -p $ALICE_PHYSICS/PWGPP/MUON/dep/RunMuonResolution.C %s/RunMuonResolution.C", remoteLocation.Data()));
123 gSystem->Exec(Form(
"cp -p $ALICE_PHYSICS/PWGPP/MUON/dep/MuonResolution.C %s/MuonResolution.C", remoteLocation.Data()));
124 gSystem->Exec(Form(
"cp -p $ALICE_PHYSICS/PWGPP/MUON/dep/AddTaskMuonResolution.C %s/AddTaskMuonResolution.C", remoteLocation.Data()));
126 gSystem->Exec(Form(
"cp runAnalysis.sh %s/runAnalysis.sh", remoteLocation.Data()));
128 if (dataset.EndsWith(
".txt")) {
129 gSystem->Exec(Form(
"cat %s | awk {'print $1\";Mode=cache\"}' > datasetSaf3.txt", dataset.Data()));
130 gSystem->Exec(Form(
"cp datasetSaf3.txt %s/datasetSaf3.txt", remoteLocation.Data()));
131 }
else if (dataset.EndsWith(
".root"))
132 gSystem->Exec(Form(
"cp %s %s/%s", dataset.Data(), remoteLocation.Data(),
gSystem->BaseName(dataset.Data())));
142 ofstream outFile(
"runAnalysis.sh");
143 outFile <<
"#!/bin/bash" << endl;
144 outFile <<
"vafctl start" << endl;
146 outFile <<
"nWorkers=" << nWorkers << endl;
147 outFile <<
"let \"nWorkers -= `pod-info -n`\"" << endl;
148 outFile <<
"echo \"requesting $nWorkers additional workers\"" << endl;
149 outFile <<
"vafreq $nWorkers" << endl;
150 outFile <<
"vafwait " << nWorkers << endl;
151 TString macro =
gSystem->GetFromPipe(
"tail -n 1 $HOME/.root_hist | sed 's/(.*)//g;s/^\.x\ //g;s:^.*/::g'");
152 TString arg =
gSystem->GetFromPipe(
"tail -n 1 $HOME/.root_hist | sed 's/.*(/(/g'");
153 if (dataset.EndsWith(
".txt")) arg.ReplaceAll(dataset.Data(),
"datasetSaf3.txt");
154 else if (dataset.EndsWith(
".root")) arg.ReplaceAll(dataset.Data(),
gSystem->BaseName(dataset.Data()));
155 outFile <<
"root -b -q '" << macro.Data() << arg.Data() <<
"'" << endl;
156 outFile <<
"vafctl stop" << endl;
158 gSystem->Exec(
"chmod u+x runAnalysis.sh");
void RunMuonResolution(TString smode="local", TString inputFileName="AliESDs.root", TString rootVersion="", TString aliphysicsVersion="vAN-20161011-1", Int_t nSteps=3, Bool_t selectPhysics=kTRUE, Bool_t selectTrigger=kTRUE, Bool_t matchTrig=kTRUE, Bool_t applyAccCut=kTRUE, Bool_t applyPDCACut=kTRUE, Double_t minMomentum=0., 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 CreateSAF3Executable(TString dataset)
Bool_t RunAnalysisOnSAF3(TString aliphysicsVersion, TString dataset)
void MuonResolution(TString smode, TString inputFileName, TString rootVersion, TString aliphysicsVersion, Int_t nSteps, 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)
Bool_t CopyFileOnSAF3(TString dataset)