Update in the task setting (Mariella)
[u/mrichter/AliRoot.git] / prod / acrcaf / reco / run.C
CommitLineData
294ca602 1void run(Int_t runNumber, Int_t nev = 10000, Int_t firstev = 0, const char* rootVersion = 0)
fb6fc115 2{
3 gEnv->SetValue("XSec.GSI.DelegProxy","2");
4 // Select ROOT version
4bf586db 5 if (rootVersion)
294ca602 6 TProof::Mgr("aliprod@alicecaf")->SetROOTVersion(rootVersion);
4bf586db 7
fb6fc115 8 // Login to CAF
9 TProof::Open("aliprod@alicecaf");
10
11 // Enable AliRoot
60a530f0 12 if(!strcmp(rootVersion,"ROOT_new") || !strcmp(rootVersion,"ROOT_pro")) {
4bf586db 13 cout << "Loading " << rootVersion << endl;
14 gProof->UploadPackage(Form("/afs/cern.ch/alice/caf/sw/ALICE/PARs/v4-17-Release.rec/%s.par",rootVersion));
15 gProof->EnablePackage(Form("%s.par",rootVersion));
16 } else {
17 gProof->UploadPackage("/afs/cern.ch/alice/caf/sw/ALICE/PARs/v4-17-Release.rec/AF-v4-17-rec.par");
18 gProof->EnablePackage("AF-v4-17-rec.par");
19 }
fb6fc115 20
21 gSystem->Load("libMonaLisa.so");
22 TMonaLisaWriter monalisa("pcalishuttle02.cern.ch",
23 "SHIFTER_RECO_CAF");
24 SendMonaLisaData(&monalisa,runNumber,"Started",0);
25
26 // Temporary fix in order to avoid timeouts on the master
27 gProof->SetParameter("PROOF_PacketAsAFraction",20);
28
29 // Run reconstruction
30 gROOT->LoadMacro("rec.C");
31 gROOT->ProcessLine(Form("rec(%d,%d,%d);",runNumber,nev,firstev));
32
33 TProof::Mgr("aliprod@alicecaf")->GetSessionLogs()->Save("*",Form("log/run%d.log",runNumber));
34
35 // Check the produced dataset
36 TFileCollection *coll = gProof->GetDataSet(Form("run%d",runNumber));
37 if (coll) {
38 Int_t nEvents = coll->GetTotalEntries("/esdTree");
39 if (nEvents > 0) {
40 cout << "===========================================================================" << endl;
41 cout << nEvents << " events reconstructed and stored in the dataset run" << runNumber << endl;
42 cout << "===========================================================================" << endl;
43 cout << "The dataset is:" << endl;
44 coll->Print();
45 cout << "===========================================================================" << endl;
46 SendMonaLisaData(&monalisa,runNumber,"Done",nEvents);
47 }
48 else {
49 SendMonaLisaData(&monalisa,runNumber,"No_Events",nEvents);
50 }
51 }
52 else {
53 SendMonaLisaData(&monalisa,runNumber,"Failure",0);
54 }
55}
56
57void SendMonaLisaData(TMonaLisaWriter *monalisa, Int_t runNumber, const char* status, Int_t nEvents)
58{
59 TMonaLisaText mlStatus("Status",status);
60 TMonaLisaValue mlEventCount("Event_count",nEvents);
61 TList mlList;
62 mlList.Add(&mlStatus);
63 mlList.Add(&mlEventCount);
64 TString mlID;
65 mlID.Form("%d",runNumber);
66 monalisa->SendParameters(&mlList, mlID.Data());
67}