TENDER becomes Tender
[u/mrichter/AliRoot.git] / PWGPP / PilotTrain / testOutputSize.C
1 #include "TList.h"
2 #include "TTree.h"
3 #include "AliSysInfo.h"
4 #include "TObjString.h"
5 #include "TCanvas.h"
6 #include "TH1.h"
7 #include "TSystem.h"
8 #include "TDirectory.h"
9 #include "TFile.h"
10
11 const Int_t NMODS = 14;
12 TString folder;
13 const char *module_name[NMODS] = {"SPD_Performance",
14                                   "CaloQA",
15                                   "Vertex_Performance",
16                                   "PWGPP_QAsymHists",
17                                   "VZERO_Performance",
18                                   "TPC_PerformanceQA",
19                                   "SDD_Performance",
20                                   "PWGPPdEdxSSDQA",
21                                   "ITS_Performance",
22                                   "TRD_Performance",
23                                   "MTR_ChamberEffMap",
24                                   "PWG2forwardDnDeta",
25                                   "ImpParRes_Performance",
26                                   "MUON_QA"
27 };                                  
28
29 void SetFolder(const char *task_name) 
30 {
31    if (!strcmp(task_name, "SPD_Performance")) folder = "coutput1";
32    if (!strcmp(task_name, "CaloQA")) folder = "CaloQA";
33    if (!strcmp(task_name, "Vertex_Performance")) folder = "cOutputVtxESD";
34    if (!strcmp(task_name, "PWGPP_QAsymHists")) folder = "QAsymHists_Global QAsymHists_ITS QAsymHists_ITS_SA QAsymHists_TPC";
35    if (!strcmp(task_name, "VZERO_Performance")) folder = "QAVZEROHists";
36    if (!strcmp(task_name, "TPC_PerformanceQA")) folder = "TPCQA";
37    if (!strcmp(task_name, "SDD_Performance")) folder = "coutputRP";
38    if (!strcmp(task_name, "PWGPPdEdxSSDQA")) folder = "SSDdEdxQA";
39    if (!strcmp(task_name, "ITS_Performance")) folder = "cOutputITS";
40    if (!strcmp(task_name, "TRD_Performance")) folder = "checkESD infoGen checkDET TRDefficiency TRDresolution checkPID";
41    if (!strcmp(task_name, "MTR_ChamberEffMap")) folder = "testMTRChamberEff triggerChamberEff";
42    if (!strcmp(task_name, "PWG2forwardDnDeta")) folder = "BackgroundCorrected";
43    if (!strcmp(task_name, "ImpParRes_Performance")) folder = "coutputd0ITSpureSARec coutputd0ITSpureSASkip coutputd0allPointRec coutputd0allPointSkip coutputd0partPointRec coutputd0partPointSkip coutputd0onepointSPDRec coutputd0onepointSPDSkip coutputd0postvTracRec coutputd0postvTracSkip coutputd0negtvTracRec coutputd0negtvTracSkip coutputd0pullAllpointRec coutputd0pullAllpointSkip coutputd0onlyRefitRec coutputd0onlyRefitSkip coutputd0sinThetaRec coutputd0sinThetaSkip coutputd0allPointTrue coutputd0postvTracTrue coutputd0negtvTracTrue coutputd0pullAllpointTrue coutputd0phiAllpointSkip coutputd0phiPostvtracSkip coutputd0phiNegtvtracSkip coutputd0clusterTypeSPD01Skip coutputd0clusterTypeSPD02Skip coutputd0clusterTypeSPD03Skip coutputd0clusterTypeSPD11Skip coutputd0clusterTypeSPD12Skip coutputd0clusterTypeSPD13Skip coutputd0PID coutputd0Pt coutputNentries coutputEstimVtx";
44    if (!strcmp(task_name, "MUON_QA")) folder = "general1 expert general2";
45 }
46
47
48 void testOutputSize(const char *filename="QA/QAresults.root")
49 {
50    gSystem->Load("libANALYSIS");
51    gSystem->Load("libANALYSISalice");
52    gSystem->Load("libCORRFW");
53 // Add aditional AliRoot libraries
54    gSystem->Load("libTender.so");
55    gSystem->Load("libPWG0base.so");
56    gSystem->Load("libPWG0dep.so");
57    gSystem->Load("libPWG0selectors.so");
58    gSystem->Load("libPWGPP.so");
59    gSystem->Load("libPWG2.so");
60    gSystem->Load("libPWG2forward.so");
61    gSystem->Load("libEMCALUtils.so");
62    gSystem->Load("libPWG4PartCorrBase.so");
63    gSystem->Load("libPWG4PartCorrDep.so");
64    gSystem->Load("libPWGHFbase.so");
65    gSystem->Load("libPWGmuon.so");
66    gSystem->Load("libPWGmuondep.so");
67    gSystem->Unlink("syswatch.log");
68    AliSysInfo::AddStamp("Start", 0, 0);
69  
70    TList temp;
71    TObjString *os;
72    if (!TFile::Open(filename)) return;
73    TDirectory *cdir = gDirectory;
74
75    for (Int_t imod=0; imod<NMODS; imod++) {
76       SetFolder(module_name[imod]);
77       TObjArray *arr = folder.Tokenize(" ");
78       TIter next(arr);
79       cdir->cd();
80       if (!gDirectory->cd(module_name[imod])) continue;
81       printf("Module: %s folder: %s\n", module_name[imod], gDirectory->GetName());
82       gDirectory->ls();
83       while ((os=(TObjString*)next())) {
84          TSeqCollection *list = (TSeqCollection*)gDirectory->Get(os->GetString());
85          if (list) list->SetOwner();
86          temp.Add(list);
87       }
88       AliSysInfo::AddStamp(module_name[imod], imod+1,1);
89       delete arr;
90 //      temp.Clear();
91    }
92    TTree *tree = AliSysInfo::MakeTree("syswatch.log");
93    tree->SetName("syswatch");
94    tree->SetAlias("event", "id0");
95    tree->SetAlias("task",  "id1");
96    tree->SetAlias("stage", "id2");
97    // Already defined aliases
98    // tree->SetAlias("deltaT","stampSec-stampOldSec");
99    // tree->SetAlias("T","stampSec-first");
100    // tree->SetAlias("deltaVM","(pI.fMemVirtual-pIOld.fMemVirtual)");
101    // tree->SetAlias("VM","pI.fMemVirtual");
102    TCanvas *c = new TCanvas("SysInfo","PWGPP QA train, run #127719 (2.84 M events)" ,10,10,1200,800);
103    tree->SetMarkerStyle(kFullSquare);
104    tree->SetMarkerColor(kRed);
105    tree->SetMarkerSize(1.5);
106    tree->Draw("deltaVM:sname","id1==1","", 1234567890, 0);
107    TH1* hist = (TH1*)gPad->GetListOfPrimitives()->FindObject("htemp");
108    if (hist) {
109       hist->SetTitle("dVM[MB] output list");
110       hist->GetXaxis()->SetTitle("Module");
111       hist->GetYaxis()->SetTitle("deltaVM [MB]");
112    }   
113    c->SetGridx();
114    c->SetGridy();
115 //   tree->SetMarkerStyle(kOpenSquare);
116 //   tree->SetMarkerColor(kRed);
117 //   tree->SetMarkerSize(1);
118 //   tree->Draw("VM:event","id1==2","SAME", 1234567890, 0);
119    temp.Clear();
120    delete tree;
121 /*
122    TFileMerger m;
123    m.AddFile("QAresults1.root");
124    m.AddFile("QAresults2.root");
125    m.OutputFile("QAresults.root");
126    m.Merge();
127 */   
128 }