]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/macros/CalibrateTPC.C
Updated example macro for TPC calibration (Marian)
[u/mrichter/AliRoot.git] / TPC / macros / CalibrateTPC.C
1 /*
2   Simple calibration analysis
3   //
4   //0. Setup memory chcecker if you want 
5   //
6   gSystem->Load("$ROOTSYS/lib/libGui.so");
7   gSystem->Load("$ROOTSYS/lib/libTree.so");
8   gSystem->Load("$MEMSTAT/libMemStat.so");
9   TMemStat *memstat = new TMemStat(100000000,10000000,kTRUE);
10   AliSysInfo::AddCallBack(TMemStatManager::GetInstance()->fStampCallBack);
11
12   AliSysInfo::AddStamp("Start");  
13   //1. Load needed libraries
14   gSystem->Load("libANALYSIS");
15   gSystem->Load("libTPCcalib");
16   //
17   // Setup analysis manager
18   //
19   .L $ALICE_ROOT/TPC/macros/CalibrateTPC.C
20   AliAnalysisManager * mgr = SetupCalibTask();
21   //
22   // Process data - chain
23   //
24   gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
25   gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+")
26   AliXRDPROOFtoolkit tool; 
27   TChain * chain = tool.MakeChain("esd.txt","esdTree",0,10200);
28   chain->Lookup();
29   // memory
30   mgr->SetNSysInfo(100); 
31   //
32   mgr->SetDebugLevel(1);
33   mgr->StartAnalysis("local",chain);
34   // delete manager
35   //
36   delete mgr;
37   AliSysInfo::AddStamp("End");
38   //
39   // analyze memstat report
40   //
41   delete memstat;
42   TMemStat draw("memstat.root");
43   draw.MakeReport(0,0,"order 0 sortstat 3 sortstamp 0 sortdeep 10 stackdeep 15 maxlength 50")   
44 */
45
46
47 AliAnalysisManager * SetupCalibTask() {
48   //
49   //
50   //
51   TStopwatch stopwatch;
52   stopwatch.Start();
53   //
54   // set magnetic field form the cosmos - it should be provided by framework
55   AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., 2);
56   AliTracker::SetFieldMap(field,0);
57   TGeoManager::Import("/u/miranov/proof/geometry.root");
58   //
59   AliAnalysisManager *mgr=new AliAnalysisManager("TestManager");
60
61   AliESDInputHandler* esdH=new AliESDInputHandler;
62   esdH->SetActiveBranches("ESDfriend");
63   mgr->SetInputEventHandler(esdH);  
64   //
65   //
66   AliCDBManager::Instance()->SetRun(1) ;
67   AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
68   AliTPCClusterParam * clusterParam = AliTPCcalibDB::Instance()->GetClusterParam();
69
70   AliTPCAnalysisTaskcalib *task1=new AliTPCAnalysisTaskcalib("TPC calibration task");
71   
72   AliTPCcalibTracksCuts *cuts = new AliTPCcalibTracksCuts(20, 0.4, 0.5, 0.13, 0.018);
73
74   //
75   AliTPCcalibTracks *calibTracks =  new AliTPCcalibTracks("calibTracks", "Resolution calibration object for tracks", clusterParam, cuts); 
76   AliTPCcalibTracksGain *calibTracksGain =  new AliTPCcalibTracksGain("calibTracksGain","Gain calibration using tracks",cuts); 
77   AliTPCcalibAlign *calibAlign = new AliTPCcalibAlign("alignTPC","Alignment of the TPC sectors");
78   AliTPCcalibLaser *calibLaser = new AliTPCcalibLaser("laserTPC","laserTPC");
79   AliTPCcalibCosmic *calibCosmic = new AliTPCcalibCosmic("cosmicTPC","cosmicTPC");
80   calibTracks->SetDebugLevel(0);
81   calibTracks->SetStreamLevel(0);
82   calibTracksGain->SetDebugLevel(0);
83   calibTracksGain->SetStreamLevel(0);
84   calibAlign->SetDebugLevel(20);
85   calibAlign->SetStreamLevel(2);
86   calibLaser->SetDebugLevel(20);
87   calibLaser->SetStreamLevel(2);
88   calibCosmic->SetDebugLevel(20);
89   calibCosmic->SetStreamLevel(2);
90
91   //
92  // ---*---*-----*-*-----*----------*---
93   // ADD CALIB JOBS HERE!!!!!!!!!!!!!!!!
94   task1->AddJob(calibAlign);
95   task1->AddJob(calibLaser);
96   //task1->AddJob(calibCosmic);
97   //task1->AddJob(calibTracksGain);
98   //task1->AddJob(calibTracks);
99   //  task1->AddJob(new AliTPCcalibBase);
100   // task1->AddJob(new AliTPCcalibV0);
101   // -*----*----*---*-*------*-------**--
102   // -------*--*---------*-----*-------*-
103   task1->SetDebugOuputhPath("/lustre_alpha/alice/miranov/rec/laser_Rec5T/V4T/");
104   mgr->AddTask(task1);
105
106   AliAnalysisDataContainer *cinput1
107     =mgr->CreateContainer("cchain1",TChain::Class(),
108                           AliAnalysisManager::kInputContainer);
109   AliAnalysisDataContainer *coutput1
110     =mgr->CreateContainer("TPCCalib",TObjArray::Class(),
111                           AliAnalysisManager::kOutputContainer,
112                           "CalibObjects.root");
113
114   mgr->ConnectInput(task1,0,cinput1);
115   mgr->ConnectOutput(task1,0,coutput1);
116
117   if (!mgr->InitAnalysis()) return;
118   mgr->PrintStatus(); 
119   
120   stopwatch.Stop();
121   stopwatch.Print();
122   return mgr;
123 }