Modified SDD zero suppression algorithm in simulation and reconstruction. Allows...
[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();
a348c43e 65 //Set Histrograms bins and ranges
66 emcalQA->SetHistoPtRangeAndNBins(0, 10, 100) ;
67 emcalQA->SetHistoPhiRangeAndNBins(75*TMath::DegToRad(), 125*TMath::DegToRad(), 100) ;
68 emcalQA->SetHistoEtaRangeAndNBins(-0.8, 0.8, 160) ;
a0bb4dc0 69
70 //emcalQA->GetMCAnalysisUtils()->SetDebug(10);
71
72 AliAnaCalorimeterQA *phosQA = new AliAnaCalorimeterQA();
73 //phosQA->SetDebug(2); //10 for lots of messages
74 phosQA->SetCalorimeter("PHOS");
75 if(kUseKinematics) phosQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
76 else phosQA->SwitchOffDataMC() ;
77 phosQA->AddToHistogramsName("PHOS_");//Begining of histograms name
78 //phosQA->SetFiducialCut(fidCut);
79 phosQA->SwitchOffFiducialCut();
80 if(kPrintSettings)phosQA->Print("");
81 //phosQA->GetMCAnalysisUtils()->SetDebug(10);
82 phosQA->SwitchOnPlotsMaking();
a348c43e 83 //Set Histrograms bins and ranges
84 phosQA->SetHistoPtRangeAndNBins(0, 10, 100) ;
85 phosQA->SetHistoPhiRangeAndNBins(215*TMath::DegToRad(), 325*TMath::DegToRad(), 100) ;
86 phosQA->SetHistoEtaRangeAndNBins(-0.13, 0.13, 100) ;
87
88
a0bb4dc0 89 // #### Configure Maker ####
90 AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker();
91 maker->SetReader(reader);//pointer to reader
92 maker->AddAnalysis(emcalQA,0);
93 maker->AddAnalysis(phosQA,1);
94 maker->SetAnaDebug(0) ;
95 maker->SwitchOnHistogramsMaker() ;
96 maker->SwitchOffAODsMaker() ;
97 if(kPrintSettings) maker->Print("");
98
99
100 printf("======================== \n");
101 printf(" End Configuration of Calorimeter QA \n");
102 printf("======================== \n");
103
104 // Create task
105 //===========================================================================
106 AliAnalysisTaskParticleCorrelation * task = new AliAnalysisTaskParticleCorrelation ("CalorimeterPerformance");
107 task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
108 task->SetDebugLevel(0);
109 task->SetAnalysisMaker(maker);
110 mgr->AddTask(task);
111
112 AliAnalysisDataContainer *cout_pc = mgr->CreateContainer("Calo.Performance",TList::Class(),
113 AliAnalysisManager::kOutputContainer, "Calo.Performance.root");
114
115 // Create ONLY the output containers for the data produced by the task.
116 // Get and connect other common input/output containers via the manager as below
117 //==============================================================================
118 mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
119 // AOD output slot will be used in a different way in future
120 //mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
121 mgr->ConnectOutput (task, 1, cout_pc);
122
123 return task;
124}
125
126