]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/macros/RunAliTPCCalibKrTask.C
Option for gamma, jet selection in eta-phi window (G. Conesa)
[u/mrichter/AliRoot.git] / TPC / macros / RunAliTPCCalibKrTask.C
1 /*
2   Example usage:
3
4   0. Load neccessary libraries
5   
6   gSystem->Load("libANALYSIS");
7   gSystem->Load("libANALYSISalice");
8   gSystem->Load("libTPCcalib");
9   gSystem->Load("libXrdClient.so");
10   gSystem->Load("libNetx.so");
11   TGrid::Connect("alien://",0,0,"t");
12   gSystem->Load("$ROOTSYS/lib/libXrdClient.so");
13   //
14   // 1. Make list of the files 
15   //
16   .L $ALICE_ROOT/TPC/macros/testTPC/AlienToolkit.cxx+
17   gSystem->Load("libXrdClient.so");
18   gSystem->Load("libNetx.so");
19   AlienToolkit toolkit;
20   char *path = "/alice/cern.ch/user/a/amatyja/alice/data/"
21   toolkit.MakeCollection(path,"32129*Krypton.root");
22   toolkit.MakeCollection(path,"32231*Krypton.root");
23   toolkit.MakeCollection(path,"32284*Krypton.root");
24   toolkit.PrintPFN(); > list.txt
25
26   //
27   // 2. Initialization of proof
28   //
29   TProofMgr * proofmgr = TProof::Mgr("lxgrid5.gsi.de");
30   TProof * proof = proofmgr->CreateSession();
31   proof->SetParameter("PROOF_MaxSlavesPerNode", (Long_t)1000);
32   .L /u/miranov/macros/ProofEnableAliRoot.C
33   ProofEnableAliRoot("/usr/local/grid/AliRoot/HEAD0108");
34   gProof->Exec("gSystem->Load(\"libANALYSIS.so\")",kTRUE);
35   gProof->Exec("gSystem->Load(\"libSTAT.so\")",kTRUE);
36   gProof->Exec("gSystem->Load(\"libTPCcalib.so\")",kTRUE);
37
38   //
39   // 3 Run analysis on PROOF
40   //
41   //
42   // Create chain of input files
43   //
44   gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
45   gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+");
46   .L $ALICE_ROOT/TPC/macros/RunAliTPCCalibKrTask.C
47   RunAliTPCCalibKrTask(kTRUE);
48   
49   
50   //..
51   //
52   //
53
54   //Example usage 
55   TFile f("KrHisto.root");
56   AliTPCCalibKr *kr = f.Get("AliTPCCalibKr");
57   
58   kr->ProjectHisto(kr->GetHistoKr(71),"aaa",30,36,30,40)->Draw()
59   //
60   //
61   //
62   MakeTree();
63   //default cuts
64   TCut cutKr("cutKr","entries.fElements<5000&&fitNormChi2.fElements<3&&fitNormChi2.fElements>0.2&&abs(fitRMS.fElements/fitMean.fElements-0.06)<0.025");
65
66 TObjArray * array = AliTPCCalibViewerGUI::ShowGUI("kryptonTree.root");
67 AliTPCCalibViewerGUI * viewer = (AliTPCCalibViewerGUI*)array->At(0);
68 TTree * tree = viewer->GetViewer()->GetTree();
69
70 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")
71
72 */
73
74 TChain * chain = 0;
75
76 void RunAliTPCCalibKrTask(Bool_t bProof = kFALSE)
77 {
78   //
79   AliXRDPROOFtoolkit tool;  
80   chain = tool.MakeChain("list.txt","Kr","",20000,0);
81   chain->Lookup();
82   chain->SetBranchStatus("Cl.fCluster",kFALSE);  
83   
84   //
85   // Create the analysis manager
86   //
87   AliAnalysisManager *mgr = new AliAnalysisManager("testAnalysis");
88
89   // Calibration component 
90   AliTPCCalibKr *calibObj = new AliTPCCalibKr;
91   //calibObj->SetASide(kFALSE);
92
93   // Add task 
94   AliTPCCalibKrTask *task = new AliTPCCalibKrTask;
95   task->SetInputChain(chain);
96   task->SetTPCCalibKr(calibObj);
97   mgr->AddTask(task); 
98
99   // Attach input
100   cInput  = mgr->CreateContainer("cInput", TChain::Class(), AliAnalysisManager::kInputContainer);
101   mgr->ConnectInput(task, 0, cInput);
102
103   // Attach output
104   cOutput = mgr->CreateContainer("cOutput", TList::Class(), AliAnalysisManager::kOutputContainer,"outHistFile.root");
105   mgr->ConnectOutput(task, 0, cOutput);
106   //
107   cOutput->SetSpecialOutput(kTRUE);
108   cOutput->SetFileName("CalibObjectFile.root");
109   //
110   // Run analysis
111   if (!mgr->InitAnalysis()) return;
112   mgr->PrintStatus();
113   mgr->SetDebugLevel(1);
114   
115   if(bProof) {
116     mgr->StartAnalysis("proof", chain);
117   }
118   else mgr->StartAnalysis("local", chain);
119 }
120
121
122
123 void MakeTree(){
124
125   TFile fpad("calibKr.root");
126   AliTPCPreprocessorOnline * preprocesor = new AliTPCPreprocessorOnline;  
127   preprocesor->AddComponent(spectrMean->Clone());
128   preprocesor->AddComponent(spectrRMS->Clone());
129   preprocesor->AddComponent(fitMean->Clone());
130   preprocesor->AddComponent(fitRMS->Clone());
131   preprocesor->AddComponent(fitNormChi2->Clone());
132   preprocesor->AddComponent(entries->Clone());
133   preprocesor->DumpToFile("kryptonTree.root");
134   
135 }