prepare PID LQ ref maker for production
[u/mrichter/AliRoot.git] / PWG4 / macros / QA / AddTaskCalorimeterQA.C
CommitLineData
a0bb4dc0 1AliAnalysisTaskParticleCorrelation *AddTaskCalorimeterQA(TString data, Bool_t kUseKinematics = kFALSE, Bool_t kPrintSettings = kFALSE)
2{
3 // Creates a PartCorr task for calorimeters performance studies, configures it and adds it to the analysis manager.
4
5 // Get the pointer to the existing analysis manager via the static access method.
6 //==============================================================================
7 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
8 if (!mgr) {
9 ::Error("AddTaskPartCorr", "No analysis manager to connect to.");
10 return NULL;
11 }
12
13 // Check the analysis type using the event handlers connected to the analysis manager.
14 //==============================================================================
15 if (!mgr->GetInputEventHandler()) {
16 ::Error("AddTaskPartCorr", "This task requires an input event handler");
17 return NULL;
18 }
19 TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
20
21 // Configure analysis
22 //===========================================================================
23
24 //Reader
25 //For this particular analysis few things done by the reader.
26 //Nothing else needs to be set.
27 AliCaloTrackReader * reader = 0x0;
28 if(data=="AOD") reader = new AliCaloTrackAODReader();
29 else if(data=="ESD") reader = new AliCaloTrackESDReader();
30 //reader->SetDebug(10);//10 for lots of messages
31 if(kPrintSettings) reader->Print("");
32
33 if(kUseKinematics){
34 if(inputDataType == "ESD"){
35 reader->SwitchOnStack();
36 reader->SwitchOffAODMCParticles();
37 }
38 else if(inputDataType == "AOD"){
39 reader->SwitchOffStack();
40 reader->SwitchOnAODMCParticles();
41 }
42 }
43
44 reader->SetDeltaAODFileName(""); //Do not create deltaAOD file, this analysis do not create branches.
45
46
47 // ##### Analysis algorithm settings ####
48 //Only needed now for MC data
49 //AliFiducialCut * fidCut = new AliFiducialCut();
50 //fidCut->DoCTSFiducialCut(kFALSE) ;
51 //fidCut->DoEMCALFiducialCut(kTRUE) ;
52 //fidCut->DoPHOSFiducialCut(kTRUE) ;
53
54 AliAnaCalorimeterQA *emcalQA = new AliAnaCalorimeterQA();
55 //emcalQA->SetDebug(2); //10 for lots of messages
56 emcalQA->SetCalorimeter("EMCAL");
57 if(kUseKinematics) emcalQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
58 else emcalQA->SwitchOffDataMC() ;
59 emcalQA->AddToHistogramsName("EMCAL_"); //Begining of histograms name
60 //emcalQA->SetFiducialCut(fidCut);
61 emcalQA->SwitchOffFiducialCut();
62 if(kPrintSettings) emcalQA->Print("");
63 emcalQA->SwitchOnPlotsMaking();
64 emcalQA->SwitchOnCalorimetersCorrelation();
65
66
67 //emcalQA->GetMCAnalysisUtils()->SetDebug(10);
68
69 AliAnaCalorimeterQA *phosQA = new AliAnaCalorimeterQA();
70 //phosQA->SetDebug(2); //10 for lots of messages
71 phosQA->SetCalorimeter("PHOS");
72 if(kUseKinematics) phosQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
73 else phosQA->SwitchOffDataMC() ;
74 phosQA->AddToHistogramsName("PHOS_");//Begining of histograms name
75 //phosQA->SetFiducialCut(fidCut);
76 phosQA->SwitchOffFiducialCut();
77 if(kPrintSettings)phosQA->Print("");
78 //phosQA->GetMCAnalysisUtils()->SetDebug(10);
79 phosQA->SwitchOnPlotsMaking();
80
81 // #### Configure Maker ####
82 AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker();
83 maker->SetReader(reader);//pointer to reader
84 maker->AddAnalysis(emcalQA,0);
85 maker->AddAnalysis(phosQA,1);
86 maker->SetAnaDebug(0) ;
87 maker->SwitchOnHistogramsMaker() ;
88 maker->SwitchOffAODsMaker() ;
89 if(kPrintSettings) maker->Print("");
90
91
92 printf("======================== \n");
93 printf(" End Configuration of Calorimeter QA \n");
94 printf("======================== \n");
95
96 // Create task
97 //===========================================================================
98 AliAnalysisTaskParticleCorrelation * task = new AliAnalysisTaskParticleCorrelation ("CalorimeterPerformance");
99 task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
100 task->SetDebugLevel(0);
101 task->SetAnalysisMaker(maker);
102 mgr->AddTask(task);
103
104 AliAnalysisDataContainer *cout_pc = mgr->CreateContainer("Calo.Performance",TList::Class(),
105 AliAnalysisManager::kOutputContainer, "Calo.Performance.root");
106
107 // Create ONLY the output containers for the data produced by the task.
108 // Get and connect other common input/output containers via the manager as below
109 //==============================================================================
110 mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
111 // AOD output slot will be used in a different way in future
112 //mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
113 mgr->ConnectOutput (task, 1, cout_pc);
114
115 return task;
116}
117
118