Changes for the Lambdac (Chiara, Rossella)
[u/mrichter/AliRoot.git] / PWG4 / macros / QA / AddTaskCalorimeterQA.C
CommitLineData
b3c71962 1//
2// Wagon contacts: EMCAL Gustavo.Conesa.Balbastre@cern.ch
3// PHOS Yuri.Kharlov@cern.ch
4//
5
2f1cfd22 6AliAnalysisTaskParticleCorrelation *AddTaskCalorimeterQA(TString data, Bool_t kPrintSettings = kFALSE,Bool_t kSimulation = kFALSE)
a0bb4dc0 7{
8 // Creates a PartCorr task for calorimeters performance studies, configures it and adds it to the analysis manager.
9
10 // Get the pointer to the existing analysis manager via the static access method.
11 //==============================================================================
12 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
13 if (!mgr) {
14 ::Error("AddTaskPartCorr", "No analysis manager to connect to.");
15 return NULL;
16 }
17
18 // Check the analysis type using the event handlers connected to the analysis manager.
19 //==============================================================================
20 if (!mgr->GetInputEventHandler()) {
21 ::Error("AddTaskPartCorr", "This task requires an input event handler");
22 return NULL;
23 }
24 TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
25
2f1cfd22 26 Bool_t kUseKinematics = (mgr->GetMCtruthEventHandler())?kTRUE:kFALSE;
27
28 cout<<"********* ACCESS KINE? "<<kUseKinematics<<endl;
29
a0bb4dc0 30 // Configure analysis
31 //===========================================================================
32
33 //Reader
34 //For this particular analysis few things done by the reader.
35 //Nothing else needs to be set.
36 AliCaloTrackReader * reader = 0x0;
37 if(data=="AOD") reader = new AliCaloTrackAODReader();
38 else if(data=="ESD") reader = new AliCaloTrackESDReader();
39 //reader->SetDebug(10);//10 for lots of messages
2f1cfd22 40 reader->SwitchOffEMCAL();
41 reader->SwitchOffPHOS();
42 reader->SwitchOffCTS();
43
a0bb4dc0 44 if(kUseKinematics){
45 if(inputDataType == "ESD"){
46 reader->SwitchOnStack();
47 reader->SwitchOffAODMCParticles();
48 }
49 else if(inputDataType == "AOD"){
50 reader->SwitchOffStack();
51 reader->SwitchOnAODMCParticles();
52 }
53 }
2f1cfd22 54 //if(!kSimulation) reader->SetFiredTriggerClassName("CINT1B-ABCE-NOPF-ALL");
a0bb4dc0 55 reader->SetDeltaAODFileName(""); //Do not create deltaAOD file, this analysis do not create branches.
5a2dbc3c 56 if(kPrintSettings) reader->Print("");
a0bb4dc0 57
fa991e42 58 // *** Calorimeters Utils ***
59 AliCalorimeterUtils *cu = new AliCalorimeterUtils;
60 // Remove clusters close to borders, at least max energy cell is 1 cell away
61 cu->SetNumberOfCellsFromEMCALBorder(1);
1e3689fa 62 cu->SetNumberOfCellsFromPHOSBorder(2);
fa991e42 63 cu->SwitchOnNoFiducialBorderInEMCALEta0();
64
65 // Remove EMCAL hottest channels for first LHC10 periods
66 cu->SwitchOnBadChannelsRemoval();
67 // SM0
68 // cu->SetEMCALChannelStatus(0,3,13); cu->SetEMCALChannelStatus(0,44,1); cu->SetEMCALChannelStatus(0,3,13);
69 cu->SetEMCALChannelStatus(0,20,7); cu->SetEMCALChannelStatus(0,38,2);
70 // SM1
71 // cu->SetEMCALChannelStatus(1,4,7); cu->SetEMCALChannelStatus(1,4,13); cu->SetEMCALChannelStatus(1,9,20);
72 // cu->SetEMCALChannelStatus(1,14,15); cu->SetEMCALChannelStatus(1,23,16); cu->SetEMCALChannelStatus(1,32,23);
73 // cu->SetEMCALChannelStatus(1,37,5); cu->SetEMCALChannelStatus(1,40,1); cu->SetEMCALChannelStatus(1,40,2);
74 // cu->SetEMCALChannelStatus(1,40,5); cu->SetEMCALChannelStatus(1,41,0); cu->SetEMCALChannelStatus(1,41,1);
75 // cu->SetEMCALChannelStatus(1,41,2); cu->SetEMCALChannelStatus(1,41,4);
76 // SM2
77 cu->SetEMCALChannelStatus(2,14,15); cu->SetEMCALChannelStatus(2,18,16); cu->SetEMCALChannelStatus(2,18,17);
78 cu->SetEMCALChannelStatus(2,18,18); cu->SetEMCALChannelStatus(2,18,20); cu->SetEMCALChannelStatus(2,18,21);
79 cu->SetEMCALChannelStatus(2,18,23); cu->SetEMCALChannelStatus(2,19,16); cu->SetEMCALChannelStatus(2,19,17);
80 cu->SetEMCALChannelStatus(2,19,19); cu->SetEMCALChannelStatus(2,19,20); cu->SetEMCALChannelStatus(2,19,21);
81 cu->SetEMCALChannelStatus(2,19,22);
82 //SM3
83 cu->SetEMCALChannelStatus(3,4,7);
84
85 //Recalibration
86 //cu->SwitchOnRecalibration();
87 //TFile * f = new TFile("RecalibrationFactors.root","read");
88 //cu->SetEMCALChannelRecalibrationFactors(0,(TH2F*)f->Get("EMCALRecalFactors_SM0"));
89 //cu->SetEMCALChannelRecalibrationFactors(1,(TH2F*)f->Get("EMCALRecalFactors_SM1"));
90 //cu->SetEMCALChannelRecalibrationFactors(2,(TH2F*)f->Get("EMCALRecalFactors_SM2"));
91 //cu->SetEMCALChannelRecalibrationFactors(3,(TH2F*)f->Get("EMCALRecalFactors_SM3"));
92
93 cu->SetDebug(-1);
94 if(kPrintSettings) cu->Print("");
95
a0bb4dc0 96 // ##### Analysis algorithm settings ####
fa991e42 97 //AliFiducialCut * fidCut = new AliFiducialCut();
98 //fidCut->DoCTSFiducialCut(kFALSE) ;
99 //fidCut->DoEMCALFiducialCut(kTRUE) ;
100 //fidCut->DoPHOSFiducialCut(kTRUE) ;
101
a0bb4dc0 102 AliAnaCalorimeterQA *emcalQA = new AliAnaCalorimeterQA();
103 //emcalQA->SetDebug(2); //10 for lots of messages
104 emcalQA->SetCalorimeter("EMCAL");
105 if(kUseKinematics) emcalQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
106 else emcalQA->SwitchOffDataMC() ;
107 emcalQA->AddToHistogramsName("EMCAL_"); //Begining of histograms name
108 //emcalQA->SetFiducialCut(fidCut);
109 emcalQA->SwitchOffFiducialCut();
5a2dbc3c 110 emcalQA->SwitchOffPlotsMaking();
a0bb4dc0 111 emcalQA->SwitchOnCalorimetersCorrelation();
fa991e42 112 emcalQA->SetTimeCut(420,825);//Open for the moment
a348c43e 113 //Set Histrograms bins and ranges
12db0c2a 114 emcalQA->SetHistoPtRangeAndNBins(0, 10, 100) ;
115 emcalQA->SetHistoPhiRangeAndNBins(75*TMath::DegToRad(), 125*TMath::DegToRad(), 100) ;
116 emcalQA->SetHistoEtaRangeAndNBins(-0.8, 0.8, 80) ;
a5fafd85 117 emcalQA->SetNumberOfModules(4); //EMCAL first year
12db0c2a 118 emcalQA->SetHistoMassRangeAndNBins(0., 0.6, 200) ;
4df35693 119 emcalQA->SetHistoAsymmetryRangeAndNBins(0., 1. , 10) ;
5a2dbc3c 120 emcalQA->SetHistoPOverERangeAndNBins(0,10.,100);
121 emcalQA->SetHistodEdxRangeAndNBins(0.,400.,200);
4df35693 122 emcalQA->SetHistodRRangeAndNBins(0.,TMath::Pi(),150);
123 emcalQA->SetHistoTimeRangeAndNBins(400.,800,200);
5a2dbc3c 124 emcalQA->SetHistoRatioRangeAndNBins(0.,2.,100);
125 emcalQA->SetHistoVertexDistRangeAndNBins(0.,500.,100);
126 emcalQA->SetHistoNClusterCellRangeAndNBins(0,300,300);
12db0c2a 127 emcalQA->SetHistoXRangeAndNBins(-230,90,160);
128 emcalQA->SetHistoYRangeAndNBins(370,450,35);
4df35693 129 emcalQA->SetHistoZRangeAndNBins(-400,400,100);
12db0c2a 130 emcalQA->SetHistoRRangeAndNBins(400,450,25);
255b904d 131
a0bb4dc0 132 //emcalQA->GetMCAnalysisUtils()->SetDebug(10);
133
5a2dbc3c 134 if(kPrintSettings) emcalQA->Print("");
135
a0bb4dc0 136 AliAnaCalorimeterQA *phosQA = new AliAnaCalorimeterQA();
137 //phosQA->SetDebug(2); //10 for lots of messages
138 phosQA->SetCalorimeter("PHOS");
139 if(kUseKinematics) phosQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
140 else phosQA->SwitchOffDataMC() ;
141 phosQA->AddToHistogramsName("PHOS_");//Begining of histograms name
142 //phosQA->SetFiducialCut(fidCut);
143 phosQA->SwitchOffFiducialCut();
a0bb4dc0 144 //phosQA->GetMCAnalysisUtils()->SetDebug(10);
5a2dbc3c 145 phosQA->SwitchOffPlotsMaking();
146 //Set Histrograms bins and ranges
12db0c2a 147 phosQA->SetHistoPtRangeAndNBins(0, 10, 100) ;
148 phosQA->SetHistoPhiRangeAndNBins(255*TMath::DegToRad(), 325*TMath::DegToRad(), 100) ;
149 phosQA->SetHistoEtaRangeAndNBins(-0.13, 0.13, 80) ;
5a2dbc3c 150 phosQA->SetNumberOfModules(3); //PHOS first year
12db0c2a 151 phosQA->SetHistoMassRangeAndNBins(0., 0.6, 200) ;
2f1cfd22 152 phosQA->SetHistoAsymmetryRangeAndNBins(0., 1. , 25) ;
5a2dbc3c 153 phosQA->SetHistoPOverERangeAndNBins(0,10.,100);
154 phosQA->SetHistodEdxRangeAndNBins(0.,400.,200);
4df35693 155 phosQA->SetHistodRRangeAndNBins(0.,TMath::Pi(),150);
156 phosQA->SetHistoTimeRangeAndNBins(0.,400,200);
5a2dbc3c 157 phosQA->SetHistoRatioRangeAndNBins(0.,2.,100);
158 phosQA->SetHistoVertexDistRangeAndNBins(0.,500.,100);
159 phosQA->SetHistoNClusterCellRangeAndNBins(0,300,300);
4df35693 160 phosQA->SetHistoXRangeAndNBins(-100,400,150);
12db0c2a 161 phosQA->SetHistoYRangeAndNBins(-490,-290,100);
162 phosQA->SetHistoZRangeAndNBins(-80,80,80);
163 phosQA->SetHistoRRangeAndNBins(440,480,40);
255b904d 164
165 //if(kPrintSettings)phosQA->Print("");
5a2dbc3c 166
a0bb4dc0 167 // #### Configure Maker ####
168 AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker();
169 maker->SetReader(reader);//pointer to reader
fa991e42 170 maker->SetCaloUtils(cu); //pointer to calorimeter utils
a0bb4dc0 171 maker->AddAnalysis(emcalQA,0);
172 maker->AddAnalysis(phosQA,1);
78219bac 173 maker->SetAnaDebug(-1) ; // 0 to at least print the event number
a0bb4dc0 174 maker->SwitchOnHistogramsMaker() ;
175 maker->SwitchOffAODsMaker() ;
176 if(kPrintSettings) maker->Print("");
177
178
179 printf("======================== \n");
180 printf(" End Configuration of Calorimeter QA \n");
181 printf("======================== \n");
182
183 // Create task
184 //===========================================================================
185 AliAnalysisTaskParticleCorrelation * task = new AliAnalysisTaskParticleCorrelation ("CalorimeterPerformance");
186 task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
3f7a860b 187 //task->SetDebugLevel(-1);
188 task->SelectCollisionCandidates();
2f1cfd22 189 task->SetAnalysisMaker(maker);
a0bb4dc0 190 mgr->AddTask(task);
191
2f1cfd22 192// AliAnalysisDataContainer *cout_pc = mgr->CreateContainer("Calo.Performance",TList::Class(),
193// AliAnalysisManager::kOutputContainer, "Calo.Performance.root");
194
195
196 TString outputfile = AliAnalysisManager::GetCommonFileName();
197 AliAnalysisDataContainer *cout_pc = mgr->CreateContainer("CaloQA", TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:CaloQA",outputfile.Data()));
198
199
a0bb4dc0 200 // Create ONLY the output containers for the data produced by the task.
201 // Get and connect other common input/output containers via the manager as below
202 //==============================================================================
203 mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
a0bb4dc0 204 mgr->ConnectOutput (task, 1, cout_pc);
205
206 return task;
207}
208
209