]>
Commit | Line | Data |
---|---|---|
d7c10d78 | 1 | AliAnalysisTaskParticleCorrelation *AddTaskPi0(TString data, TString calorimeter, Bool_t kPrintSettings = kFALSE,Bool_t kSimulation = kFALSE, Bool_t outputAOD=kFALSE, Bool_t oldAOD=kFALSE) |
2 | { | |
3 | // Creates a PartCorr task, 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("AddTaskPi0", "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("AddTaskPi0", "This task requires an input event handler"); | |
17 | return NULL; | |
18 | } | |
19 | TString inputDataType = "AOD"; | |
20 | if(!data.Contains("delta")) | |
21 | inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD" | |
22 | //cout<<"DATA TYPE :: "<<inputDataType<<endl; | |
23 | // inputDataType: data managed by the input handler | |
24 | // data: can be same as one managed by input handler, or the output AOD created by the filter. By default use AOD | |
25 | ||
26 | Bool_t kUseKinematics = kFALSE; | |
27 | if(kSimulation) { | |
28 | kUseKinematics = (mgr->GetMCtruthEventHandler())?kTRUE:kFALSE; | |
29 | if (!kUseKinematics && data=="AOD" && inputDataType != "ESD") kUseKinematics = kTRUE; //AOD primary should be available ... | |
30 | } | |
31 | ||
32 | cout<<"********* ACCESS KINE? "<<kUseKinematics<<endl; | |
33 | ||
34 | // Configure analysis | |
35 | //=========================================================================== | |
36 | ||
37 | // *** Reader *** | |
38 | AliCaloTrackReader * reader = ; | |
39 | if(data.Contains("AOD")) reader = new AliCaloTrackAODReader(); | |
40 | else if(data=="ESD") reader = new AliCaloTrackESDReader(); | |
41 | else if(data=="MC" && inputDataType == "ESD") reader = new AliCaloTrackMCReader(); | |
42 | reader->SetDebug(-1);//10 for lots of messages | |
43 | reader->SwitchOnCTS(); | |
44 | //reader->SetDeltaAODFileName(""); | |
45 | //if(!kSimulation) reader->SetFiredTriggerClassName("CINT1B-ABCE-NOPF-ALL"); | |
46 | if(calorimeter == "EMCAL") { | |
47 | reader->SwitchOnEMCALCells(); | |
48 | reader->SwitchOnEMCAL(); | |
49 | } | |
50 | if(calorimeter == "PHOS") { | |
51 | reader->SwitchOnPHOSCells(); | |
52 | reader->SwitchOnPHOS(); | |
53 | } | |
5c8fd15c | 54 | |
55 | reader->SwitchOnSuspiciousClustersRemoval(); //EMCAL | |
d7c10d78 | 56 | |
57 | // for case data="deltaAOD", no need to fill the EMCAL/PHOS cluster lists | |
58 | if(data.Contains("delta")){ | |
59 | reader->SwitchOffEMCAL(); | |
60 | reader->SwitchOffPHOS(); | |
61 | reader->SwitchOffEMCALCells(); | |
62 | reader->SwitchOffPHOSCells(); | |
63 | } | |
64 | ||
65 | if(kUseKinematics){ | |
66 | if(inputDataType == "ESD"){ | |
67 | reader->SwitchOnStack(); | |
68 | reader->SwitchOffAODMCParticles(); | |
69 | } | |
70 | else if(inputDataType == "AOD"){ | |
71 | reader->SwitchOffStack(); | |
72 | reader->SwitchOnAODMCParticles(); | |
73 | } | |
74 | } | |
af7b3903 | 75 | |
76 | //In case of AODs created only for calorimeters, and track information filtered | |
77 | //CTS is off when calling this method | |
78 | //reader->SwitchOnCaloFilterPatch(); | |
d7c10d78 | 79 | |
0b13c1f9 | 80 | reader->SetZvertexCut(10.); |
81 | ||
d7c10d78 | 82 | //Min particle pT |
83 | reader->SetEMCALPtMin(0.1); | |
84 | reader->SetPHOSPtMin(0.); | |
85 | reader->SetCTSPtMin(0.); | |
86 | if(outputAOD) reader->SwitchOnWriteDeltaAOD() ; | |
87 | if(oldAOD) reader->SwitchOnOldAODs(); | |
88 | if(kPrintSettings) reader->Print(""); | |
89 | ||
90 | // *** Calorimeters Utils *** | |
91 | AliCalorimeterUtils *cu = new AliCalorimeterUtils; | |
92 | // Remove clusters close to borders, at least max energy cell is 1 cell away | |
93 | cu->SetNumberOfCellsFromEMCALBorder(1); | |
94 | cu->SetNumberOfCellsFromPHOSBorder(2); | |
95 | ||
96 | // Remove EMCAL hottest channels for first LHC10 periods | |
af7b3903 | 97 | // cu->SwitchOnBadChannelsRemoval(); |
98 | // cu->SwitchOnDistToBadChannelRecalculation(); | |
99 | ||
100 | // TFile * fbad = new TFile("BadChannels.root","read"); | |
101 | // TH2I * hbad0 = (TH2I*)fbad->Get("EMCALBadChannelMap_Mod0"); | |
102 | // TH2I * hbad1 = (TH2I*)fbad->Get("EMCALBadChannelMap_Mod1"); | |
103 | // TH2I * hbad2 = (TH2I*)fbad->Get("EMCALBadChannelMap_Mod2"); | |
104 | // TH2I * hbad3 = (TH2I*)fbad->Get("EMCALBadChannelMap_Mod3"); | |
105 | // cu->SetEMCALChannelStatusMap(0,hbad0); | |
106 | // cu->SetEMCALChannelStatusMap(1,hbad1); | |
107 | // cu->SetEMCALChannelStatusMap(2,hbad2); | |
108 | // cu->SetEMCALChannelStatusMap(3,hbad3); | |
d7c10d78 | 109 | |
110 | ||
111 | //Recalibration | |
112 | //cu->SwitchOnRecalibration(); | |
113 | //TFile * f = new TFile("RecalibrationFactors.root","read"); | |
114 | //cu->SetEMCALChannelRecalibrationFactors(0,(TH2F*)f->Get("EMCALRecalFactors_SM0")); | |
115 | //cu->SetEMCALChannelRecalibrationFactors(1,(TH2F*)f->Get("EMCALRecalFactors_SM1")); | |
116 | //cu->SetEMCALChannelRecalibrationFactors(2,(TH2F*)f->Get("EMCALRecalFactors_SM2")); | |
117 | //cu->SetEMCALChannelRecalibrationFactors(3,(TH2F*)f->Get("EMCALRecalFactors_SM3")); | |
118 | //f->Close(); | |
119 | ||
120 | cu->SetDebug(-1); | |
121 | if(kPrintSettings) cu->Print(""); | |
122 | ||
123 | ||
124 | // ##### Analysis algorithm settings #### | |
125 | ||
126 | // ------------------------------------------------- | |
127 | // --- Photon/Pi0/Omega/Electron Analysis --- | |
128 | // ------------------------------------------------- | |
129 | ||
130 | AliAnaPhoton *anaphoton = new AliAnaPhoton(); | |
131 | anaphoton->SetDebug(-1); //10 for lots of messages | |
132 | if(calorimeter == "PHOS"){ | |
5c8fd15c | 133 | anaphoton->SetNCellCut(2);// At least 2 cells |
134 | anaphoton->SetMinPt(3.); | |
d7c10d78 | 135 | anaphoton->SetMinDistanceToBadChannel(2, 4, 5); |
136 | } | |
137 | else {//EMCAL | |
5c8fd15c | 138 | anaphoton->SetNCellCut(1);// At least 2 cells |
139 | anaphoton->SetMinPt(0.3); // no effect minium EMCAL cut. | |
140 | //if(!kUseKinematics) anaphoton->SetTimeCut(400,900);// Time window of [400-900] ns | |
141 | //anaphoton->SetMinDistanceToBadChannel(6, 12, 18);//For officially produced ESDs/AODs | |
142 | anaphoton->SetMinDistanceToBadChannel(1, 2, 3);//For filtered AODs, new releases. | |
d7c10d78 | 143 | } |
144 | anaphoton->SetCalorimeter(calorimeter); | |
145 | if(kUseKinematics) anaphoton->SwitchOnDataMC() ;//Access MC stack and fill more histograms | |
146 | else anaphoton->SwitchOffDataMC() ; | |
147 | anaphoton->SwitchOffCaloPID(); | |
148 | anaphoton->SwitchOffFiducialCut(); | |
149 | if(kSimulation){ | |
150 | anaphoton->SwitchOnFiducialCut(); | |
151 | AliFiducialCut * fidCut1stYear = anaphoton->GetFiducialCut(); | |
152 | fidCut1stYear->DoCTSFiducialCut(kFALSE) ; | |
153 | fidCut1stYear->DoEMCALFiducialCut(kTRUE) ; | |
154 | fidCut1stYear->DoPHOSFiducialCut(kTRUE) ; | |
155 | fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.); | |
156 | fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.); | |
157 | } | |
158 | ||
159 | if(!data.Contains("delta")) { | |
160 | anaphoton->SetOutputAODName(Form("Photons%s",calorimeter.Data())); | |
161 | anaphoton->SetOutputAODClassName("AliAODPWG4ParticleCorrelation"); | |
162 | } | |
163 | else anaphoton->SetInputAODName(Form("Photons%s",calorimeter.Data())); | |
164 | anaphoton->AddToHistogramsName("AnaPhotonCorr_"); | |
165 | //Set Histograms bins and ranges | |
af7b3903 | 166 | anaphoton->SetHistoPtRangeAndNBins(0, 100, 200) ; |
d7c10d78 | 167 | // ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ; |
168 | // ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ; | |
169 | if(kPrintSettings) anaphoton->Print(""); | |
170 | ||
171 | // ----------------------------------- | |
172 | // --- Pi0 Invariant Mass Analysis --- | |
173 | // ----------------------------------- | |
174 | ||
175 | AliAnaPi0 *anapi0 = new AliAnaPi0(); | |
176 | anapi0->SetDebug(-1);//10 for lots of messages | |
177 | anapi0->SetInputAODName(Form("Photons%s",calorimeter.Data())); | |
178 | anapi0->SetCalorimeter(calorimeter); | |
179 | ||
180 | anapi0->SwitchOnMultipleCutAnalysis(); | |
af7b3903 | 181 | //anapi0->SetNPtCuts(2); |
182 | //anapi0->SetNAsymCuts(2); | |
183 | //anapi0->SetNNCellCuts(2); | |
d7c10d78 | 184 | anapi0->SetNPIDBits(2); |
185 | ||
af7b3903 | 186 | //anapi0->SetPtCutsAt(0,0.3); anapi0->SetPtCutsAt(1,0.5); |
187 | //anapi0->SetAsymCutsAt(0,0.1);anapi0->SetAsymCutsAt(1,0.5); | |
188 | //anapi0->SetNCellCutsAt(0,1); anapi0->SetNCellCutsAt(1,2); | |
189 | anapi0->SetPIDBitsAt(0,0); //No Cut | |
190 | anapi0->SetPIDBitsAt(1,2); //Dispersion Cut | |
d7c10d78 | 191 | |
192 | ||
193 | if(kSimulation){ | |
194 | anapi0->SwitchOnFiducialCut(); | |
195 | AliFiducialCut * fidCut1stYear = anapi0->GetFiducialCut(); | |
196 | fidCut1stYear->DoCTSFiducialCut(kFALSE) ; | |
197 | fidCut1stYear->DoEMCALFiducialCut(kTRUE) ; | |
198 | fidCut1stYear->DoPHOSFiducialCut(kTRUE) ; | |
199 | fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.); | |
200 | fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.); | |
201 | } | |
202 | ||
d7c10d78 | 203 | //settings for pp collision mixing |
204 | anapi0->SwitchOnOwnMix(); //Off when mixing done with general mixing frame | |
205 | anapi0->SetNCentrBin(1); | |
206 | anapi0->SetNZvertBin(1); | |
207 | anapi0->SetNRPBin(1); | |
208 | anapi0->SetNMaxEvMix(10); | |
209 | ||
210 | if(kUseKinematics)anapi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms | |
211 | else anapi0->SwitchOffDataMC() ; | |
212 | if(calorimeter=="PHOS") anapi0->SetNumberOfModules(3); //PHOS first year | |
213 | else anapi0->SetNumberOfModules(4); //EMCAL first year | |
af7b3903 | 214 | anapi0->SetHistoPtRangeAndNBins(0, 20, 200) ; |
d7c10d78 | 215 | //anapi0->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ; |
216 | //anapi0->SetHistoEtaRangeAndNBins(-0.8, 0.8, 200) ; | |
af7b3903 | 217 | anapi0->SetHistoMassRangeAndNBins(0., 0.9, 300) ; |
218 | anapi0->SetHistoAsymmetryRangeAndNBins(0., 1. , 100) ; | |
219 | anapi0->SetHistoTrackMultiplicityRangeAndNBins(0, 200, 20); | |
220 | ||
d7c10d78 | 221 | if(kPrintSettings) anapi0->Print(""); |
222 | ||
223 | ||
224 | ||
225 | // #### Configure Maker #### | |
226 | AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker(); | |
227 | maker->SetReader(reader);//pointer to reader | |
228 | maker->SetCaloUtils(cu); //pointer to calorimeter utils | |
229 | Int_t n = 0;//Analysis number, order is important | |
230 | // Particle selection analysis | |
231 | maker->AddAnalysis(anaphoton,n++); | |
232 | maker->AddAnalysis(anapi0,n++); | |
233 | maker->SetAnaDebug(-1) ; | |
234 | maker->SwitchOnHistogramsMaker() ; | |
235 | if(data.Contains("delta")) maker->SwitchOffAODsMaker() ; | |
236 | else maker->SwitchOnAODsMaker() ; | |
237 | ||
238 | if(kPrintSettings) maker->Print(""); | |
239 | ||
240 | printf("======================== \n"); | |
241 | printf(" End Configuration of Pi0 analysis with detector %s \n",calorimeter.Data()); | |
242 | printf("======================== \n"); | |
243 | ||
244 | // Create task | |
245 | //=========================================================================== | |
246 | AliAnalysisTaskParticleCorrelation * task = new AliAnalysisTaskParticleCorrelation (Form("PartCorr%s",calorimeter.Data())); | |
247 | task->SetConfigFileName(""); //Don't configure the analysis via configuration file. | |
248 | //task->SetDebugLevel(-1); | |
af7b3903 | 249 | if(data=="ESD")task->SelectCollisionCandidates(); |
d7c10d78 | 250 | task->SetAnalysisMaker(maker); |
251 | //if(!kSimulation)task->SelectCollisionCandidates(); //AliPhysicsSelection has to be attached before. | |
252 | mgr->AddTask(task); | |
253 | ||
254 | //Create containers | |
255 | char name[128]; | |
256 | sprintf(name,"PartCorr_%s",calorimeter.Data()); | |
257 | cout<<"Name of task "<<name<<endl; | |
258 | //AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(Form(name),TList::Class(), | |
259 | // AliAnalysisManager::kOutputContainer, Form("PartCorr_%s.root",calorimeter.Data())); | |
260 | ||
261 | TString outputfile = AliAnalysisManager::GetCommonFileName(); | |
262 | // AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(Form("PartCorr_%s",calorimeter.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:PartCorr_%s",outputfile.Data(),calorimeter.Data())); | |
263 | AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(calorimeter.Data(), TList::Class(), | |
264 | AliAnalysisManager::kOutputContainer, | |
265 | Form("%s:PartCorr",outputfile.Data())); | |
266 | ||
267 | AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(Form("%sCuts",calorimeter.Data()), TList::Class(), | |
268 | AliAnalysisManager::kParamContainer, | |
269 | Form("%s:PartCorrCuts",outputfile.Data())); | |
270 | ||
271 | // Create ONLY the output containers for the data produced by the task. | |
272 | // Get and connect other common input/output containers via the manager as below | |
273 | //============================================================================== | |
274 | mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer()); | |
275 | // AOD output slot will be used in a different way in future | |
276 | if(!data.Contains("delta") && outputAOD) mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer()); | |
277 | mgr->ConnectOutput (task, 1, cout_pc); | |
278 | mgr->ConnectOutput (task, 2, cout_cuts); | |
279 | ||
280 | return task; | |
281 | } | |
282 | ||
283 |