AliAnaPi0: Add possibility to cut on opening angle of pairs, to reject background...
[u/mrichter/AliRoot.git] / PWG4 / macros / QA / AddTaskCalorimeterQA.C
CommitLineData
5a2dbc3c 1AliAnalysisTaskParticleCorrelation *AddTaskCalorimeterQA(TString data, Bool_t kUseKinematics = kFALSE, Bool_t kPrintSettings = kFALSE,Bool_t kSimulation = kFALSE)
a0bb4dc0 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
a0bb4dc0 31
32 if(kUseKinematics){
33 if(inputDataType == "ESD"){
34 reader->SwitchOnStack();
35 reader->SwitchOffAODMCParticles();
36 }
37 else if(inputDataType == "AOD"){
38 reader->SwitchOffStack();
39 reader->SwitchOnAODMCParticles();
40 }
41 }
5a2dbc3c 42 if(!kSimulation) reader->SetFiredTriggerClassName("CINT1B-ABCE-NOPF-ALL");
a0bb4dc0 43 reader->SetDeltaAODFileName(""); //Do not create deltaAOD file, this analysis do not create branches.
5a2dbc3c 44 if(kPrintSettings) reader->Print("");
a0bb4dc0 45
46 // ##### Analysis algorithm settings ####
47 //Only needed now for MC data
48 //AliFiducialCut * fidCut = new AliFiducialCut();
49 //fidCut->DoCTSFiducialCut(kFALSE) ;
50 //fidCut->DoEMCALFiducialCut(kTRUE) ;
51 //fidCut->DoPHOSFiducialCut(kTRUE) ;
52
53 AliAnaCalorimeterQA *emcalQA = new AliAnaCalorimeterQA();
54 //emcalQA->SetDebug(2); //10 for lots of messages
55 emcalQA->SetCalorimeter("EMCAL");
56 if(kUseKinematics) emcalQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
57 else emcalQA->SwitchOffDataMC() ;
58 emcalQA->AddToHistogramsName("EMCAL_"); //Begining of histograms name
59 //emcalQA->SetFiducialCut(fidCut);
60 emcalQA->SwitchOffFiducialCut();
5a2dbc3c 61 emcalQA->SwitchOffPlotsMaking();
a0bb4dc0 62 emcalQA->SwitchOnCalorimetersCorrelation();
a348c43e 63 //Set Histrograms bins and ranges
64 emcalQA->SetHistoPtRangeAndNBins(0, 10, 100) ;
65 emcalQA->SetHistoPhiRangeAndNBins(75*TMath::DegToRad(), 125*TMath::DegToRad(), 100) ;
66 emcalQA->SetHistoEtaRangeAndNBins(-0.8, 0.8, 160) ;
a5fafd85 67 emcalQA->SetNumberOfModules(4); //EMCAL first year
5a2dbc3c 68 emcalQA->SetHistoMassRangeAndNBins(0., 0.5, 500) ;
69 emcalQA->SetHistoAsymmetryRangeAndNBins(0., 1. , 5) ;
70 emcalQA->SetHistoPOverERangeAndNBins(0,10.,100);
71 emcalQA->SetHistodEdxRangeAndNBins(0.,400.,200);
72 emcalQA->SetHistodRRangeAndNBins(0.,TMath::Pi(),300);
73 emcalQA->SetHistoTimeRangeAndNBins(0.,1000,1000);
74 emcalQA->SetHistoRatioRangeAndNBins(0.,2.,100);
75 emcalQA->SetHistoVertexDistRangeAndNBins(0.,500.,100);
76 emcalQA->SetHistoNClusterCellRangeAndNBins(0,300,300);
77
a0bb4dc0 78 //emcalQA->GetMCAnalysisUtils()->SetDebug(10);
79
5a2dbc3c 80 if(kPrintSettings) emcalQA->Print("");
81
a0bb4dc0 82 AliAnaCalorimeterQA *phosQA = new AliAnaCalorimeterQA();
83 //phosQA->SetDebug(2); //10 for lots of messages
84 phosQA->SetCalorimeter("PHOS");
85 if(kUseKinematics) phosQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
86 else phosQA->SwitchOffDataMC() ;
87 phosQA->AddToHistogramsName("PHOS_");//Begining of histograms name
88 //phosQA->SetFiducialCut(fidCut);
89 phosQA->SwitchOffFiducialCut();
90 if(kPrintSettings)phosQA->Print("");
91 //phosQA->GetMCAnalysisUtils()->SetDebug(10);
5a2dbc3c 92 phosQA->SwitchOffPlotsMaking();
93 //Set Histrograms bins and ranges
94 phosQA->SetHistoPtRangeAndNBins(0, 10, 100) ;
95 phosQA->SetHistoPhiRangeAndNBins(215*TMath::DegToRad(), 325*TMath::DegToRad(), 100) ;
96 phosQA->SetHistoEtaRangeAndNBins(-0.13, 0.13, 100) ;
97 phosQA->SetNumberOfModules(3); //PHOS first year
98 phosQA->SetHistoMassRangeAndNBins(0., 0.5, 500) ;
99 phosQA->SetHistoAsymmetryRangeAndNBins(0., 1. , 5) ;
100 phosQA->SetHistoPOverERangeAndNBins(0,10.,100);
101 phosQA->SetHistodEdxRangeAndNBins(0.,400.,200);
102 phosQA->SetHistodRRangeAndNBins(0.,TMath::Pi(),300);
103 phosQA->SetHistoTimeRangeAndNBins(0.,1000,1000);
104 phosQA->SetHistoRatioRangeAndNBins(0.,2.,100);
105 phosQA->SetHistoVertexDistRangeAndNBins(0.,500.,100);
106 phosQA->SetHistoNClusterCellRangeAndNBins(0,300,300);
107
a0bb4dc0 108 // #### Configure Maker ####
109 AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker();
110 maker->SetReader(reader);//pointer to reader
111 maker->AddAnalysis(emcalQA,0);
112 maker->AddAnalysis(phosQA,1);
491e4f8b 113 maker->SetAnaDebug(-1) ;
a0bb4dc0 114 maker->SwitchOnHistogramsMaker() ;
115 maker->SwitchOffAODsMaker() ;
116 if(kPrintSettings) maker->Print("");
117
118
119 printf("======================== \n");
120 printf(" End Configuration of Calorimeter QA \n");
121 printf("======================== \n");
122
123 // Create task
124 //===========================================================================
125 AliAnalysisTaskParticleCorrelation * task = new AliAnalysisTaskParticleCorrelation ("CalorimeterPerformance");
126 task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
127 task->SetDebugLevel(0);
128 task->SetAnalysisMaker(maker);
129 mgr->AddTask(task);
130
131 AliAnalysisDataContainer *cout_pc = mgr->CreateContainer("Calo.Performance",TList::Class(),
132 AliAnalysisManager::kOutputContainer, "Calo.Performance.root");
133
134 // Create ONLY the output containers for the data produced by the task.
135 // Get and connect other common input/output containers via the manager as below
136 //==============================================================================
137 mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
138 // AOD output slot will be used in a different way in future
139 //mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
140 mgr->ConnectOutput (task, 1, cout_pc);
141
142 return task;
143}
144
145