]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/macros/RunAliTPCCalibKrTask.C
Adding more examples - default selections (marian)
[u/mrichter/AliRoot.git] / TPC / macros / RunAliTPCCalibKrTask.C
1
2 /*
3   gSystem->Load("libANALYSIS");
4   gSystem->Load("libANALYSISalice");
5   gSystem->Load("libTPCcalib");
6   //..
7   //
8   //
9   
10   //Example usage 
11   TFile f("KrHisto.root");
12   AliTPCCalibKr *kr = f.Get("AliTPCCalibKr");
13   
14   kr->ProjectHisto(kr->GetHistoKr(71),"aaa",30,36,30,40)->Draw()
15   //
16   //
17   //
18   MakeTree();
19   //default cuts
20   TCut cutKr("cutKr","entries.fElements<5000&&fitNormChi2.fElements<3&&fitNormChi2.fElements>0.2&&abs(fitRMS.fElements/fitMean.fElements-0.06)<0.025");
21
22 TObjArray * array = AliTPCCalibViewerGUI::ShowGUI("kryptonTree.root");
23 AliTPCCalibViewerGUI * viewer = (AliTPCCalibViewerGUI*)array->At(0);
24 TTree * tree = viewer->GetViewer()->GetTree();
25
26 tree->SetAlias("cutAll","abs(fitNormChi2.fElements-2.)<1.8&&entries.fElements/entries_Median.fElements<4&&entries.fElements/entries_Median.fElements>0.4&&fitRMS.fElements/fitMean.fElements<0.09&&fitRMS.fElements/fitMean.fElements>0.02")
27
28
29
30  */
31
32
33 void RunAliTPCCalibKrTask(const char* list="KrClusters_250508.txt",Bool_t bProof = kFALSE)
34 {
35
36   if(bProof) {
37     TProof *proof = TProof::Open("jacek@gsiaf.gsi.de");
38     gProof->GetManager()->SetROOTVersion("5.18/00a");
39
40     // Proof Enable Libraries
41     gROOT->LoadMacro("ProofEnableAliRoot.C");
42     ProofEnableAliRoot("/d/alice11/jacek/alice/x86_64/AliRoot/HEAD");
43   }
44
45   //
46   // Create chain of input files
47   //
48   gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
49   gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx++");
50   AliXRDPROOFtoolkit tool;
51
52   // -- Make chain of files
53   TChain * chain = tool.MakeChain(list,"Kr","",2,0);
54   chain->SetBranchStatus("Cl.fCluster",kFALSE);
55   //
56   // Create the analysis manager
57   //
58   AliAnalysisManager *mgr = new AliAnalysisManager("testAnalysis");
59
60   // Calibration component 
61   AliTPCCalibKr *calibObj = new AliTPCCalibKr;
62   //calibObj->SetASide(kFALSE);
63
64   // Add task 
65   AliTPCCalibKrTask *task = new AliTPCCalibKrTask;
66   task->SetInputChain(chain);
67   task->SetTPCCalibKr(calibObj);
68   mgr->AddTask(task); 
69
70   // Attach input
71   cInput  = mgr->CreateContainer("cInput", TChain::Class(), AliAnalysisManager::kInputContainer);
72   mgr->ConnectInput(task, 0, cInput);
73
74   // Attach output
75   cOutput = mgr->CreateContainer("cOutput", TList::Class(), AliAnalysisManager::kOutputContainer,"outHistFile.root");
76   mgr->ConnectOutput(task, 0, cOutput);
77
78   // Run analysis
79   mgr->InitAnalysis();
80   mgr->PrintStatus();
81   if(bProof) mgr->StartAnalysis("proof", chain);
82   else mgr->StartAnalysis("local", chain);
83 }
84
85
86
87 void MakeTree(){
88
89   TFile fpad("calibKr.root");
90   AliTPCPreprocessorOnline * preprocesor = new AliTPCPreprocessorOnline;  
91   preprocesor->AddComponent(spectrMean->Clone());
92   preprocesor->AddComponent(spectrRMS->Clone());
93   preprocesor->AddComponent(fitMean->Clone());
94   preprocesor->AddComponent(fitRMS->Clone());
95   preprocesor->AddComponent(fitNormChi2->Clone());
96   preprocesor->AddComponent(entries->Clone());
97   preprocesor->DumpToFile("kryptonTree.root");
98   
99 }