automatically write MC info into the trees when MC available
[u/mrichter/AliRoot.git] / PWGPP / macros / AddTaskPerformanceITS.C
1 AliAnalysisTaskITSTrackingCheck *AddTaskPerformanceITS(Bool_t readMC=kFALSE,
2                                                        Bool_t readRP=kFALSE,
3                                                        Bool_t fillNtuples=kFALSE,
4                                                        Int_t minmult=0,
5                                                        Int_t maxmult=1000000,
6                                                        Int_t checkSDDIsIn=1) 
7 {
8   //
9   // Task for check of ITS tracking
10   //
11   // andrea.dainese@pd.infn.it
12   //
13
14
15   // Get the pointer to the existing analysis manager via the static access method.
16   //==============================================================================
17   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
18   if (!mgr) {
19     ::Error("AddTask", "No analysis manager to connect to.");
20     return NULL;
21   }   
22
23   // Create the task
24   AliAnalysisTaskITSTrackingCheck *taskITS = new AliAnalysisTaskITSTrackingCheck("ITStracking");
25   taskITS->SetMultiplicityRange(minmult,maxmult);
26   taskITS->SetReadMC(readMC);
27   taskITS->SetReadRPLabels(readRP);
28   taskITS->SetFillNtuples(fillNtuples);
29   taskITS->SetUseITSSAforNtuples(kFALSE);
30   taskITS->SetCheckSDDIsIn(checkSDDIsIn);
31   //taskITS->SetOCDBPath("alien://folder=/alice/data/2011/OCDB"); // to be commented for the QAtrain
32   AliLog::SetClassDebugLevel("AliAnalysisTaskITSTrackingCheck",10);
33   // Add to the manager
34   mgr->AddTask(taskITS);
35
36   //
37   // Create containers for input/output
38   TString cname="cOutputITS";
39   if(maxmult<1000000) {
40     cname.Append("_"); cname+=minmult; 
41     cname.Append("_"); cname+=maxmult;
42   } 
43
44
45   AliAnalysisDataContainer *cOutputITS = mgr->CreateContainer(cname.Data(),TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:ITS_Performance",mgr->GetCommonFileName()));
46
47
48   // Attach input
49   mgr->ConnectInput(taskITS,0,mgr->GetCommonInputContainer());
50   // Attach output
51   mgr->ConnectOutput(taskITS, 1,cOutputITS);
52   
53   return taskITS;
54 }