Removing compilation warnings and failures
[u/mrichter/AliRoot.git] / TPC / macros / RunAliTPCCalibKrTask.C
CommitLineData
b47f90d3 1/*
78abca19 2 Example usage:
3
4 0. Load neccessary libraries
5
b47f90d3 6 gSystem->Load("libANALYSIS");
7 gSystem->Load("libANALYSISalice");
8 gSystem->Load("libTPCcalib");
78abca19 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
32743ed6 28 //
78abca19 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);
32743ed6 37 gProof->Exec(".x $ALICE_ROOT/TPC/macros/ConfigOCDB.C");
78abca19 38
b47f90d3 39 //
78abca19 40 // 3 Run analysis on PROOF
b47f90d3 41 //
78abca19 42 //
43 // Create chain of input files
44 //
45 gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
46 gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+");
47 .L $ALICE_ROOT/TPC/macros/RunAliTPCCalibKrTask.C
48 RunAliTPCCalibKrTask(kTRUE);
49
b47f90d3 50
32743ed6 51 //
52 // Check the cuts for clusters
53 //
54 AliXRDPROOFtoolkit tool;
55 TChain * chain = tool.MakeChain("list.txt","Kr",0,1000);
56 chain->Lookup();
57 chain->SetProof(kTRUE);
58
59 TCut cutR0("cutR0","fADCcluster/fSize<200"); // adjust it according v seetings -
60 TCut cutR1("cutR1","fADCcluster/fSize>7"); // cosmic tracks and noise removal
61 TCut cutR2("cutR2","fMax.fAdc/fADCcluster<0.4"); // digital noise removal
62 TCut cutR3("cutR3","fMax.fAdc/fADCcluster>0.01"); // noise removal
63 TCut cutR4("cutR4","fMax.fTime>200"); // noise removal
64 TCut cutR5("cutR5","fMax.fTime<600"); // noise removal
65 TCut cutS1("cutS1","fSize<200"); // adjust it according v seetings - cosmic tracks
66 TCut cutAll = cutR0+cutR1+cutR2+cutR3+cutR4+cutR5+cutS1;
67
68
69
70
78abca19 71 //..
72 //
73 //
74
b47f90d3 75 //Example usage
76 TFile f("KrHisto.root");
77 AliTPCCalibKr *kr = f.Get("AliTPCCalibKr");
78
79 kr->ProjectHisto(kr->GetHistoKr(71),"aaa",30,36,30,40)->Draw()
80 //
81 //
82 //
83 MakeTree();
84 //default cuts
85 TCut cutKr("cutKr","entries.fElements<5000&&fitNormChi2.fElements<3&&fitNormChi2.fElements>0.2&&abs(fitRMS.fElements/fitMean.fElements-0.06)<0.025");
86
cb6e6903 87TObjArray * array = AliTPCCalibViewerGUI::ShowGUI("kryptonTree.root");
88AliTPCCalibViewerGUI * viewer = (AliTPCCalibViewerGUI*)array->At(0);
89TTree * tree = viewer->GetViewer()->GetTree();
90
91tree->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")
92
78abca19 93*/
b47f90d3 94
78abca19 95TChain * chain = 0;
b47f90d3 96
78abca19 97void RunAliTPCCalibKrTask(Bool_t bProof = kFALSE)
ffbf9f24 98{
ffbf9f24 99 //
78abca19 100 AliXRDPROOFtoolkit tool;
101 chain = tool.MakeChain("list.txt","Kr","",20000,0);
102 chain->Lookup();
103 chain->SetBranchStatus("Cl.fCluster",kFALSE);
104
ffbf9f24 105 //
106 // Create the analysis manager
107 //
108 AliAnalysisManager *mgr = new AliAnalysisManager("testAnalysis");
109
110 // Calibration component
111 AliTPCCalibKr *calibObj = new AliTPCCalibKr;
112 //calibObj->SetASide(kFALSE);
113
114 // Add task
115 AliTPCCalibKrTask *task = new AliTPCCalibKrTask;
116 task->SetInputChain(chain);
117 task->SetTPCCalibKr(calibObj);
118 mgr->AddTask(task);
119
120 // Attach input
121 cInput = mgr->CreateContainer("cInput", TChain::Class(), AliAnalysisManager::kInputContainer);
122 mgr->ConnectInput(task, 0, cInput);
123
124 // Attach output
125 cOutput = mgr->CreateContainer("cOutput", TList::Class(), AliAnalysisManager::kOutputContainer,"outHistFile.root");
126 mgr->ConnectOutput(task, 0, cOutput);
78abca19 127 //
128 cOutput->SetSpecialOutput(kTRUE);
129 cOutput->SetFileName("CalibObjectFile.root");
130 //
ffbf9f24 131 // Run analysis
78abca19 132 if (!mgr->InitAnalysis()) return;
ffbf9f24 133 mgr->PrintStatus();
78abca19 134 mgr->SetDebugLevel(1);
135
136 if(bProof) {
137 mgr->StartAnalysis("proof", chain);
138 }
ffbf9f24 139 else mgr->StartAnalysis("local", chain);
140}
b47f90d3 141
142
143
144void MakeTree(){
145
146 TFile fpad("calibKr.root");
147 AliTPCPreprocessorOnline * preprocesor = new AliTPCPreprocessorOnline;
148 preprocesor->AddComponent(spectrMean->Clone());
149 preprocesor->AddComponent(spectrRMS->Clone());
150 preprocesor->AddComponent(fitMean->Clone());
151 preprocesor->AddComponent(fitRMS->Clone());
152 preprocesor->AddComponent(fitNormChi2->Clone());
153 preprocesor->AddComponent(entries->Clone());
154 preprocesor->DumpToFile("kryptonTree.root");
155
156}