TENDER becomes Tender
[u/mrichter/AliRoot.git] / PWGPP / TPC / macros / MakeTrend.C
1 int MakeTrend(char *infile,int run) {
2
3   //char input_file[300];
4   //sprintf(input_file,"Run_%d/AnalysisResults.root",run);
5   
6   TStopwatch timer;
7   timer.Start();
8   gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT -I$ALICE_ROOT/TRD");
9   gROOT->LoadMacro("$ALICE_ROOT/PWGPP/TPC/macros/ConfigOCDB.C");
10   
11   gSystem->Load("libSTAT");
12   gSystem->Load("libANALYSIS");
13   gSystem->Load("libANALYSISalice");
14   gSystem->Load("libANALYSIScalib");
15   gSystem->Load("libCORRFW");
16   gSystem->Load("libTPCcalib");
17   gSystem->Load("libTRDcalib");
18   gSystem->Load("libT0calib");
19   gSystem->Load("libTOFcalib");
20   gSystem->Load("libANALYSISalice.so");
21   gSystem->Load("libANALYSIScalib.so");
22   gSystem->Load("libTender.so");
23   gSystem->Load("libPWGPP.so");
24                     
25   
26   /*
27   gSystem->Load("libANALYSIS.so");
28   gSystem->Load("libANALYSISalice.so");
29   gSystem->Load("libTender.so");
30   gSystem->Load("libCORRFW.so");
31   gSystem->Load("libPWG0base.so");
32   gSystem->Load("libPWG0dep.so");
33   gSystem->Load("libPWG0selectors.so");
34   gSystem->Load("libPWG1.so");
35     gSystem->Load("libPWG2.so");
36   gSystem->Load("libPWG4base");
37   gSystem->Load("libPWG3muon.so");
38   gSystem->Load("libPWG3muondep.so");
39   gSystem->Load("libPWG2forward.so");
40    gSystem->Load("libPWG4PartCorrBase.so");
41    gSystem->Load("libPWG4PartCorrDep.so");
42  
43   */
44
45   // config OCDB
46   //
47   
48   // ConfigOCDB(run,"local:///lustre/alice/alien/alice/data/2011/OCDB");
49   
50   char *outfile = "trending.root";
51   
52   if (!infile) return -1;
53   if (!outfile) return -1;
54   TFile *f =0;
55   f=TFile::Open(infile,"read");
56   if (!f) {
57     printf("File %s not available\n", infile);
58     return -1;
59   }
60
61   cout<< "test breakpoint -------------------------------------"<<endl; 
62   TList* list = 0;
63   list = dynamic_cast<TList*>(f->Get("TPC")); 
64   cout<< "test0"<< endl;
65   if (!list) { list = dynamic_cast<TList*>(f->Get("TPCQA")); }
66   cout<< "test1"<< endl;
67   if (!list) { list = dynamic_cast<TList*>(f->Get("TPCQA_v0_c0")); }
68   if (!list) { list = dynamic_cast<TList*>(f->Get("TPCQA_v0_c30")); }
69   if (!list) { list = dynamic_cast<TList*>(f->Get("TPCQA_v0_c70")); }
70   if (!list) { list = dynamic_cast<TList*>(f->Get("TPC_PerformanceQA/TPCQA")); }
71   if (!list) { list = dynamic_cast<TList*>(f->Get("TPC_PerformanceQA")); }
72   if (!list) { list = dynamic_cast<TList*>(f->Get("ITSTPCMatch")); }
73   cout<< "test2"<< endl;
74   if (!list) {
75     printf("QA %s not available\n", infile);
76     return -1;
77   } 
78   cout<< "test3"<< endl;
79   
80   AliPerformanceTPC* pTPC = 0;
81   AliPerformanceDEdx* pTPCgain = 0; 
82   AliPerformanceMatch* pTPCmatch = 0; 
83   AliPerformanceMatch* pTPCPull = 0; 
84   AliPerformanceMatch* pConstrain = 0; 
85   if (list) {  pTPC = dynamic_cast<AliPerformanceTPC*>(list->FindObject("AliPerformanceTPC")); }
86   if (list) {  pTPCgain = dynamic_cast<AliPerformanceDEdx*>(list->FindObject("AliPerformanceDEdxTPCInner")); }
87   if (list) {  pTPCmatch = dynamic_cast<AliPerformanceMatch*>(list->FindObject("AliPerformanceMatchTPCITS")); }
88   if (list) {  pTPCPull = dynamic_cast<AliPerformanceMatch*>(list->FindObject("AliPerformanceMatchITSTPC")); }
89   if (list) {  pConstrain = dynamic_cast<AliPerformanceMatch*>(list->FindObject("AliPerformanceMatchTPCConstrain")); }
90
91   
92   cout<< "ss "<<pTPC<<pTPCgain<<pTPCmatch <<pTPCPull<<pConstrain<<endl;
93   /*
94   cout<< ((TH2D*)(pTPC->GetTPCTrackHisto()->Projection(4,5)))->GetEntries()<<endl;
95   
96   
97   TH1* his1D=0;
98   //TH2* his2D=0;
99   TH3* his3D_0=0;
100   
101   
102   his3D_0 = dynamic_cast<TH3*>(pTPC->GetHistos()->FindObject("h_tpc_track_all_recvertex_0_5_7"));
103   his3D_0->GetYaxis()->SetRangeUser(-1,1);
104   his3D_0->GetZaxis()->SetRangeUser(0.25,10);
105   
106   his1D = his3D_0->Project3D("x");
107   Double_t meanTPCncl= his1D->GetMean();
108   
109   cout<< "ss "<< meanTPCncl<<endl;
110   */
111
112   Int_t returncode = 0;
113   AliTPCPerformanceSummary::WriteToFile(pTPC, pTPCgain, pTPCmatch ,pTPCPull,pConstrain, outfile, run);
114   if (f) { delete f; f=0; }
115   
116   ofstream fout("trend_exist");
117   fout<<9<<endl;
118   fout.close();
119   
120   return 9;
121
122 }