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