1 ///////////////////////////////////////////////////////////////////////////////
2 // Macro to setup AliPerformanceTask for
3 // TPC performance QA to run on PWGPP QA train.
5 // By default 1 performance component is added to
7 // 1. AliPerformancePtCalib
8 // or AliPerformancePtCalibMC if bUseMCinfo = kTRUE (use MC info)
10 // Usage on the analysis train (default configuration):
11 // gSystem->Load("libANALYSIS");
12 // gSystem->Load("libANALYSISalice");
13 // gSystem->Load("libTPCcalib.so");
14 // gSystem->Load("libPWGPP.so");
16 // gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskPerformanceTPCPtCalib.C");
17 // AliPerformanceTask *tpcQA = AddTaskPerformanceTPCPtCalib("kTRUE","kTRUE","CINT1B-ABCE-NOPF-ALL");
20 // TPCPtCalib.Performance.root file with TPC performance components is created.
22 // Each of the components contains THnSparse generic histograms which
23 // have to be analysed (post-analysis) by using Analyse() function.
24 // Each component contains such function.
26 // June 2010 - Simone Schuchmann sschuchm@ikf.uni-frankfurt.de
27 ///////////////////////////////////////////////////////////////////////////////
29 //____________________________________________
30 AliPerformanceTask* AddTaskPerformanceTPCPtCalib(Bool_t bUseMCInfo=kFALSE, Bool_t bUseESDfriend=kFALSE, const char *triggerClass=0)
34 // Create physics trigger selection class
36 AliPhysicsSelection *physTrigSel = new AliPhysicsSelection();
39 // Add AliPerformanceTask with TPC performance components
41 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
43 Error("AddTaskPerformanceTPCPtCalib","AliAnalysisManager not set!");
47 TString type = mgr->GetInputEventHandler()->GetDataType();
48 if (!type.Contains("ESD")) {
49 Error("AddTaskPerformanceTPCPtCalib", "ESD input handler needed!");
53 AliMCEventHandler *mcH = (AliMCEventHandler*)mgr->GetMCtruthEventHandler();
54 if (!mcH && bUseMCInfo) {
55 Error("AddTaskPerformanceTPCPtCalib", "MC input handler needed!");
62 AliPerformanceTask *task = new AliPerformanceTask("TPCPerformanceInvPt","TPC Performance PtCalib");
64 Error("AddTaskPerformanceTPCPtCalib", "TPC performance task cannot be created!");
67 task->SetUseMCInfo(bUseMCInfo);
68 task->SetUseESDfriend(kFALSE);
69 task->SelectCollisionCandidates();
72 // Add physics selection task to analysis manager
74 // gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
75 // AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection();
76 // mgr->AddTask(physSelTask);
81 // Create TPC-ESD track reconstruction cuts
83 AliRecInfoCuts *pRecInfoCuts = new AliRecInfoCuts();
85 pRecInfoCuts->SetMaxDCAToVertexXY(3.0);
86 pRecInfoCuts->SetMaxDCAToVertexZ(3.0);
87 pRecInfoCuts->SetMinNClustersTPC(50);
88 pRecInfoCuts->SetMinNClustersITS(2);
89 pRecInfoCuts->SetHistogramsOn(kFALSE);
92 Error("AddTaskPerformanceTPCPtCalib", "AliRecInfoCuts cannot be created!");
96 // Create TPC-MC track reconstruction cuts
98 AliMCInfoCuts *pMCInfoCuts = new AliMCInfoCuts();
100 pMCInfoCuts->SetMinTrackLength(70);
103 Error("AddTaskPerformanceTPCPtCalib", "AliMCInfoCuts cannot be created!");
108 // Create performance objects for TPC and set cuts
110 enum { kTPC = 0, kTPCITS, kConstrained, kTPCInner, kTPCOuter, kTPCSec };
114 AliPerformancePtCalib *ptCalib = NULL;
115 AliPerformancePtCalibMC *ptCalibMC = NULL;
118 ptCalibMC = new AliPerformancePtCalibMC("AliPerformancePtCalibMC","AliPerformancePtCalibMC");
120 Error("AddTaskPerformanceTPCPtCalib", "Cannot create AliPerformancePtCalibMC");
122 // physTrigSel->SetAnalyzeMC();
123 // ptCalibMC->SetPhysicsTriggerSelection(physTrigSel);
124 ptCalibMC->SetAliRecInfoCuts(pRecInfoCuts);
125 ptCalibMC->SetReadTPCTracks(kTRUE);
126 AliESDtrackCuts* esdtrackCuts = new AliESDtrackCuts("AliESDtrackCutsPtMC");
127 esdtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2009(kTRUE);
128 ptCalibMC->SetAliESDtrackCuts(esdtrackCuts);
129 //ptCalibMC->SetEtaRange(0.9);
133 ptCalib = new AliPerformancePtCalib("AliPerformancePtCalib","AliPerformancePtCalib");
135 Error("AddTaskPerformanceTPCPtCalib", "Cannot create AliPerformancePtCalib");
137 ptCalib->SetAliRecInfoCuts(pRecInfoCuts);
138 ptCalib->SetReadTPCTracks(kTRUE);
139 ptCalib->SetEtaRange(0.8);
140 // ptCalib->SetAliMCInfoCuts(pMCInfoCut);
142 //if(triggerClass) ptCalib->SetTriggerClass(triggerClass);
143 //ptCalib->SetPhysicsTriggerSelection(physTrigSel);
144 //ptCalib->SetTrigger(AliTriggerAnalysis::kMB1);
145 AliESDtrackCuts* esdtrackCuts = new AliESDtrackCuts("AliESDtrackCutsPt");
146 esdtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2009(kTRUE);
147 ptCalib->SetAliESDtrackCuts(esdtrackCuts);
151 // add components to the performance task
153 if(bUseMCInfo) task->AddPerformanceObject(ptCalibMC);
154 else task->AddPerformanceObject(ptCalib);
156 // Create containers for input
158 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
161 // Create containers for output
163 AliAnalysisDataContainer *coutput_tpcptcalib = mgr->CreateContainer("TPCPtCalib", TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s.Performance.root", task->GetName()));
164 mgr->ConnectOutput(task, 1, coutput_tpcptcalib);