]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG1/Macros/RunAliComparisonTask.C
1. Using the THnSparse instead of THx and TProfiles
[u/mrichter/AliRoot.git] / PWG1 / Macros / RunAliComparisonTask.C
1 void RunAliComparisonTask(TChain  *chain = 0, Bool_t aProof = kTRUE, Bool_t aDebug = kFALSE)
2 {
3   //
4   // Set mag field map (needed to propagate track to the DCA)
5   //
6   //Int_t magField = 2;  // 0 - 0.2 T, 1 = 0.4 T, 2  - 0.5 T
7   //magFMap = new AliMagFMaps("Maps","Maps", 2, 1., 10., magField);
8   //AliTracker::SetFieldMap(magFMap,kFALSE);
9
10   //AliMagWrapCheb* field = 0x0;
11   //field = new AliMagWrapCheb("Maps","Maps", 2, 1., 10., AliMagWrapCheb::k5kG,kTRUE,"$(ALICE_ROOT)/data/maps/mfchebKGI_sym.root");
12   //Bool_t uniform=kFALSE;
13   //AliTracker::SetFieldMap(field,uniform);  // tracking with the real map
14
15   TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 2, 1., 1., 10., AliMagF::k5kG));
16
17   //
18   // Create global cuts objects 
19   //
20
21   // Create ESD track reconstruction cuts
22   AliRecInfoCuts *pRecInfoCuts = new AliRecInfoCuts(); 
23   if(pRecInfoCuts) {
24     pRecInfoCuts->SetPtRange(0.20,200.0);
25     //pRecInfoCuts->SetEtaRange(-0.9,0.9);
26     pRecInfoCuts->SetMaxDCAToVertexXY(3.0);
27     pRecInfoCuts->SetMaxDCAToVertexZ(3.0);
28     pRecInfoCuts->SetMinNClustersTPC(50);
29     pRecInfoCuts->SetMinNClustersITS(2);
30     pRecInfoCuts->SetMinTPCsignalN(50);
31
32         pRecInfoCuts->SetHistogramsOn(kFALSE); 
33   } else {
34     AliDebug(AliLog::kError, "ERROR: Cannot create AliRecInfoCuts object");
35   }
36
37   // Create MC track reconstruction cuts
38   AliMCInfoCuts  *pMCInfoCuts = new AliMCInfoCuts();
39   if(pMCInfoCuts) {
40     pMCInfoCuts->SetMinRowsWithDigits(50);
41     pMCInfoCuts->SetMaxR(0.025); // from diamond xy size (pp@10TeV) 
42     pMCInfoCuts->SetMaxVz(10.);  // from diamond z size  (pp@10TeV)
43     pMCInfoCuts->SetRangeTPCSignal(0.5,1.4); 
44   } else {
45     AliDebug(AliLog::kError, "ERROR: Cannot AliMCInfoCuts object");
46   }
47
48   //
49   // Create comparison objects and set cuts 
50   //
51   const Int_t kTPC = 0;
52   const Int_t kTPCITS = 1;
53   const Int_t kConstrained = 2;
54
55   // Resolution
56   AliComparisonRes *pCompRes0 = new AliComparisonRes("AliComparisonResTPC","AliComparisonResTPC",kTPC,kFALSE); 
57   if(!pCompRes0) {
58     AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonRes0 object");
59   }
60   pCompRes0->SetAliRecInfoCuts(pRecInfoCuts);
61   pCompRes0->SetAliMCInfoCuts(pMCInfoCuts);
62
63   AliComparisonRes *pCompRes1 = new AliComparisonRes("AliComparisonResTPCITS","AliComparisonResTPCITS",kTPCITS,kFALSE); 
64   if(!pCompRes1) {
65     AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonRes1 object");
66   }
67   pCompRes1->SetAliRecInfoCuts(pRecInfoCuts);
68   pCompRes1->SetAliMCInfoCuts(pMCInfoCuts);
69
70   AliComparisonRes *pCompRes2 = new AliComparisonRes("AliComparisonResConstrained","AliComparisonResConstrained",kConstrained,kFALSE); 
71   if(!pCompRes2) {
72     AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonRes2 object");
73   }
74   pCompRes2->SetAliRecInfoCuts(pRecInfoCuts);
75   pCompRes2->SetAliMCInfoCuts(pMCInfoCuts);
76
77   // Efficiency
78   AliComparisonEff *pCompEff0 =  new AliComparisonEff("AliComparisonEffTPC","AliComparisonEffTPC",kTPC,kFALSE);
79   if(!pCompEff0) {
80     AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonEff object");
81   }
82   pCompEff0->SetAliRecInfoCuts(pRecInfoCuts);
83   pCompEff0->SetAliMCInfoCuts(pMCInfoCuts);
84
85   AliComparisonEff *pCompEff1 =  new AliComparisonEff("AliComparisonEffTPCITS","AliComparisonEffTPCITS",kTPCITS,kFALSE);
86   if(!pCompEff1) {
87     AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonEff object");
88   }
89   pCompEff1->SetAliRecInfoCuts(pRecInfoCuts);
90   pCompEff1->SetAliMCInfoCuts(pMCInfoCuts);
91
92   AliComparisonEff *pCompEff2 =  new AliComparisonEff("AliComparisonEffConstrained","AliComparisonEffConstrained",kConstrained,kFALSE);
93   if(!pCompEff2) {
94     AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonEff object");
95   }
96   pCompEff2->SetAliRecInfoCuts(pRecInfoCuts);
97   pCompEff2->SetAliMCInfoCuts(pMCInfoCuts);
98
99   // dE/dx
100   AliComparisonDEdx *pCompDEdx0 = new AliComparisonDEdx("AliComparisonDEdxTPC","AliComparisonDEdxTPC",kTPC,kFALSE);
101   if(!pCompDEdx0) {
102     AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonDEdx object");
103   }
104   pCompDEdx0->SetAliRecInfoCuts(pRecInfoCuts);
105   pCompDEdx0->SetAliMCInfoCuts(pMCInfoCuts);
106
107   // DCA
108   AliComparisonDCA *pCompDCA0 = new AliComparisonDCA("AliComparisonDCATPC","AliComparisonDCATPC",kTPC,kFALSE);
109   if(!pCompDCA0) {
110     AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonDCATPC object");
111   }
112   pCompDCA0->SetAliRecInfoCuts(pRecInfoCuts);
113   pCompDCA0->SetAliMCInfoCuts(pMCInfoCuts);
114
115   AliComparisonDCA *pCompDCA1 = new AliComparisonDCA("AliComparisonDCATPCITS","AliComparisonDCAITS",kTPCITS,kFALSE);
116   if(!pCompDCA1) {
117     AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonDCAITS");
118   }
119   pCompDCA1->SetAliRecInfoCuts(pRecInfoCuts);
120   pCompDCA1->SetAliMCInfoCuts(pMCInfoCuts);
121
122   // Create the analysis manager
123   mgr = new AliAnalysisManager("testAnalysis");
124
125   // Create, add task
126   task = new AliComparisonTask;
127
128   task->AddComparisonObject( pCompRes0 );
129   task->AddComparisonObject( pCompRes1 );
130   task->AddComparisonObject( pCompRes2 );
131   task->AddComparisonObject( pCompEff0 );
132   task->AddComparisonObject( pCompEff1 );
133   task->AddComparisonObject( pCompEff2 );
134   task->AddComparisonObject( pCompDEdx0 );
135   task->AddComparisonObject( pCompDCA0 );
136   task->AddComparisonObject( pCompDCA1 );
137   
138   mgr->AddTask(task);
139
140   // Attach input
141   cInput  = mgr->CreateContainer("cInput", TChain::Class(), AliAnalysisManager::kInputContainer);
142   mgr->ConnectInput(task, 0, cInput);
143
144   // Attach output
145   cOutput = mgr->CreateContainer("cOutput", TList::Class(), AliAnalysisManager::kOutputContainer,"Output.root");
146   mgr->ConnectOutput(task, 0, cOutput);
147
148   // Enable debug printouts
149   if (aDebug)
150     mgr->SetDebugLevel(2);
151
152   // Run analysis
153   mgr->InitAnalysis();
154   mgr->PrintStatus();
155
156   if(chain) {
157     mgr->StartAnalysis((aProof) ? "proof" : "local", chain);
158   } else {
159     AliDebug(AliLog::kError, "ERROR: No chain available");
160   }
161 }