]>
Commit | Line | Data |
---|---|---|
bdd28eb5 | 1 | AliAnalysisTaskParticleCorrelation *AddTaskPi0(TString data, TString calorimeter, Bool_t kPrintSettings = kFALSE,Bool_t kSimulation = kFALSE, Bool_t outputAOD=kFALSE, TString outputfile = "", Int_t year = 2010,TString col = "pp",Bool_t oldAOD=kFALSE) |
d7c10d78 | 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 | |
bdd28eb5 | 55 | reader->SwitchOffSuspiciousClustersRemoval(); //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(); | |
20218aea | 79 | //Event selection |
80 | if (col=="pp" ) { | |
81 | reader->SwitchOnEventSelection(); //remove pileup by default | |
82 | reader->SwitchOffV0ANDSelection() ; // and besides v0 AND | |
83 | reader->SwitchOffPrimaryVertexSelection(); // and besides primary vertex | |
84 | } | |
85 | else if(col=="PbPb") { | |
86 | reader->SwitchOffEventSelection(); //remove pileup by default | |
87 | reader->SwitchOffV0ANDSelection() ; // and besides v0 AND | |
88 | reader->SwitchOffPrimaryVertexSelection(); // and besides primary vertex | |
89 | } | |
d7c10d78 | 90 | |
0b13c1f9 | 91 | reader->SetZvertexCut(10.); |
92 | ||
d7c10d78 | 93 | //Min particle pT |
bdd28eb5 | 94 | reader->SetEMCALPtMin(0.5); |
d7c10d78 | 95 | reader->SetPHOSPtMin(0.); |
96 | reader->SetCTSPtMin(0.); | |
97 | if(outputAOD) reader->SwitchOnWriteDeltaAOD() ; | |
98 | if(oldAOD) reader->SwitchOnOldAODs(); | |
99 | if(kPrintSettings) reader->Print(""); | |
100 | ||
101 | // *** Calorimeters Utils *** | |
102 | AliCalorimeterUtils *cu = new AliCalorimeterUtils; | |
bdd28eb5 | 103 | if(year==2010) cu->SetEMCALGeometryName("EMCAL_FIRSTYEARV1"); |
104 | else cu->SetEMCALGeometryName("EMCAL_COMPLETEV1"); | |
d7c10d78 | 105 | // Remove clusters close to borders, at least max energy cell is 1 cell away |
106 | cu->SetNumberOfCellsFromEMCALBorder(1); | |
107 | cu->SetNumberOfCellsFromPHOSBorder(2); | |
108 | ||
109 | // Remove EMCAL hottest channels for first LHC10 periods | |
af7b3903 | 110 | // cu->SwitchOnBadChannelsRemoval(); |
111 | // cu->SwitchOnDistToBadChannelRecalculation(); | |
112 | ||
113 | // TFile * fbad = new TFile("BadChannels.root","read"); | |
114 | // TH2I * hbad0 = (TH2I*)fbad->Get("EMCALBadChannelMap_Mod0"); | |
115 | // TH2I * hbad1 = (TH2I*)fbad->Get("EMCALBadChannelMap_Mod1"); | |
116 | // TH2I * hbad2 = (TH2I*)fbad->Get("EMCALBadChannelMap_Mod2"); | |
117 | // TH2I * hbad3 = (TH2I*)fbad->Get("EMCALBadChannelMap_Mod3"); | |
118 | // cu->SetEMCALChannelStatusMap(0,hbad0); | |
119 | // cu->SetEMCALChannelStatusMap(1,hbad1); | |
120 | // cu->SetEMCALChannelStatusMap(2,hbad2); | |
121 | // cu->SetEMCALChannelStatusMap(3,hbad3); | |
d7c10d78 | 122 | |
123 | ||
124 | //Recalibration | |
125 | //cu->SwitchOnRecalibration(); | |
126 | //TFile * f = new TFile("RecalibrationFactors.root","read"); | |
127 | //cu->SetEMCALChannelRecalibrationFactors(0,(TH2F*)f->Get("EMCALRecalFactors_SM0")); | |
128 | //cu->SetEMCALChannelRecalibrationFactors(1,(TH2F*)f->Get("EMCALRecalFactors_SM1")); | |
129 | //cu->SetEMCALChannelRecalibrationFactors(2,(TH2F*)f->Get("EMCALRecalFactors_SM2")); | |
130 | //cu->SetEMCALChannelRecalibrationFactors(3,(TH2F*)f->Get("EMCALRecalFactors_SM3")); | |
131 | //f->Close(); | |
132 | ||
133 | cu->SetDebug(-1); | |
134 | if(kPrintSettings) cu->Print(""); | |
135 | ||
136 | ||
137 | // ##### Analysis algorithm settings #### | |
138 | ||
139 | // ------------------------------------------------- | |
140 | // --- Photon/Pi0/Omega/Electron Analysis --- | |
141 | // ------------------------------------------------- | |
142 | ||
143 | AliAnaPhoton *anaphoton = new AliAnaPhoton(); | |
144 | anaphoton->SetDebug(-1); //10 for lots of messages | |
145 | if(calorimeter == "PHOS"){ | |
5c8fd15c | 146 | anaphoton->SetNCellCut(2);// At least 2 cells |
147 | anaphoton->SetMinPt(3.); | |
d7c10d78 | 148 | anaphoton->SetMinDistanceToBadChannel(2, 4, 5); |
149 | } | |
150 | else {//EMCAL | |
5c8fd15c | 151 | anaphoton->SetNCellCut(1);// At least 2 cells |
bdd28eb5 | 152 | anaphoton->SetMinPt(0.5); // no effect minium EMCAL cut. |
5c8fd15c | 153 | //if(!kUseKinematics) anaphoton->SetTimeCut(400,900);// Time window of [400-900] ns |
154 | //anaphoton->SetMinDistanceToBadChannel(6, 12, 18);//For officially produced ESDs/AODs | |
155 | anaphoton->SetMinDistanceToBadChannel(1, 2, 3);//For filtered AODs, new releases. | |
d7c10d78 | 156 | } |
157 | anaphoton->SetCalorimeter(calorimeter); | |
158 | if(kUseKinematics) anaphoton->SwitchOnDataMC() ;//Access MC stack and fill more histograms | |
159 | else anaphoton->SwitchOffDataMC() ; | |
160 | anaphoton->SwitchOffCaloPID(); | |
161 | anaphoton->SwitchOffFiducialCut(); | |
162 | if(kSimulation){ | |
163 | anaphoton->SwitchOnFiducialCut(); | |
164 | AliFiducialCut * fidCut1stYear = anaphoton->GetFiducialCut(); | |
165 | fidCut1stYear->DoCTSFiducialCut(kFALSE) ; | |
166 | fidCut1stYear->DoEMCALFiducialCut(kTRUE) ; | |
167 | fidCut1stYear->DoPHOSFiducialCut(kTRUE) ; | |
168 | fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.); | |
169 | fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.); | |
170 | } | |
171 | ||
172 | if(!data.Contains("delta")) { | |
173 | anaphoton->SetOutputAODName(Form("Photons%s",calorimeter.Data())); | |
174 | anaphoton->SetOutputAODClassName("AliAODPWG4ParticleCorrelation"); | |
175 | } | |
176 | else anaphoton->SetInputAODName(Form("Photons%s",calorimeter.Data())); | |
177 | anaphoton->AddToHistogramsName("AnaPhotonCorr_"); | |
178 | //Set Histograms bins and ranges | |
bdd28eb5 | 179 | anaphoton->SetHistoPtRangeAndNBins(0, 30, 150) ; |
20218aea | 180 | if(year==2010)anaphoton->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 122*TMath::DegToRad(), 78) ; |
181 | else anaphoton->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 182*TMath::DegToRad(), 108) ; | |
bdd28eb5 | 182 | anaphoton->SetHistoEtaRangeAndNBins(-0.72, 0.72, 144) ; |
d7c10d78 | 183 | if(kPrintSettings) anaphoton->Print(""); |
184 | ||
185 | // ----------------------------------- | |
186 | // --- Pi0 Invariant Mass Analysis --- | |
187 | // ----------------------------------- | |
188 | ||
189 | AliAnaPi0 *anapi0 = new AliAnaPi0(); | |
190 | anapi0->SetDebug(-1);//10 for lots of messages | |
191 | anapi0->SetInputAODName(Form("Photons%s",calorimeter.Data())); | |
192 | anapi0->SetCalorimeter(calorimeter); | |
bdd28eb5 | 193 | anapi0->SwitchOffMultipleCutAnalysis(); |
af7b3903 | 194 | //anapi0->SetNPtCuts(2); |
20218aea | 195 | //anapi0->SetNAsymCuts(2); |
af7b3903 | 196 | //anapi0->SetNNCellCuts(2); |
20218aea | 197 | //anapi0->SetNPIDBits(1); |
d7c10d78 | 198 | |
af7b3903 | 199 | //anapi0->SetPtCutsAt(0,0.3); anapi0->SetPtCutsAt(1,0.5); |
200 | //anapi0->SetAsymCutsAt(0,0.1);anapi0->SetAsymCutsAt(1,0.5); | |
201 | //anapi0->SetNCellCutsAt(0,1); anapi0->SetNCellCutsAt(1,2); | |
20218aea | 202 | //anapi0->SetPIDBitsAt(0,0); //No Cut |
bdd28eb5 | 203 | //anapi0->SetPIDBitsAt(1,2); //Dispersion Cut |
d7c10d78 | 204 | |
205 | ||
206 | if(kSimulation){ | |
207 | anapi0->SwitchOnFiducialCut(); | |
208 | AliFiducialCut * fidCut1stYear = anapi0->GetFiducialCut(); | |
209 | fidCut1stYear->DoCTSFiducialCut(kFALSE) ; | |
210 | fidCut1stYear->DoEMCALFiducialCut(kTRUE) ; | |
211 | fidCut1stYear->DoPHOSFiducialCut(kTRUE) ; | |
212 | fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.); | |
213 | fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.); | |
214 | } | |
215 | ||
d7c10d78 | 216 | //settings for pp collision mixing |
217 | anapi0->SwitchOnOwnMix(); //Off when mixing done with general mixing frame | |
20218aea | 218 | if (col=="pp" ) { |
219 | anapi0->SetNCentrBin(1); | |
220 | anapi0->SwitchOnSMCombinations(); | |
221 | } | |
222 | else if(col=="PbPb") { | |
223 | anapi0->SetNCentrBin(10); | |
224 | anapi0->SwitchOffSMCombinations(); | |
225 | } | |
226 | anapi0->SetNZvertBin(10); | |
d7c10d78 | 227 | anapi0->SetNRPBin(1); |
bdd28eb5 | 228 | anapi0->SetNMaxEvMix(50); |
d7c10d78 | 229 | |
230 | if(kUseKinematics)anapi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms | |
231 | else anapi0->SwitchOffDataMC() ; | |
232 | if(calorimeter=="PHOS") anapi0->SetNumberOfModules(3); //PHOS first year | |
bdd28eb5 | 233 | else { |
234 | if(year==2010) anapi0->SetNumberOfModules(4); //EMCAL first year | |
235 | else anapi0->SetNumberOfModules(10); | |
236 | } | |
237 | anapi0->SetHistoPtRangeAndNBins(0, 30, 150) ; | |
238 | anapi0->SetHistoEtaRangeAndNBins(-0.72, 0.72, 144) ; | |
20218aea | 239 | if(year==2010)anaphoton->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 122*TMath::DegToRad(), 78) ; |
240 | else anaphoton->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 182*TMath::DegToRad(), 108) ; | |
bdd28eb5 | 241 | |
242 | anapi0->SetHistoMassRangeAndNBins(0., 1., 200) ; | |
af7b3903 | 243 | anapi0->SetHistoAsymmetryRangeAndNBins(0., 1. , 100) ; |
244 | anapi0->SetHistoTrackMultiplicityRangeAndNBins(0, 200, 20); | |
245 | ||
d7c10d78 | 246 | if(kPrintSettings) anapi0->Print(""); |
247 | ||
248 | ||
d7c10d78 | 249 | // #### Configure Maker #### |
250 | AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker(); | |
251 | maker->SetReader(reader);//pointer to reader | |
252 | maker->SetCaloUtils(cu); //pointer to calorimeter utils | |
253 | Int_t n = 0;//Analysis number, order is important | |
254 | // Particle selection analysis | |
255 | maker->AddAnalysis(anaphoton,n++); | |
256 | maker->AddAnalysis(anapi0,n++); | |
257 | maker->SetAnaDebug(-1) ; | |
258 | maker->SwitchOnHistogramsMaker() ; | |
259 | if(data.Contains("delta")) maker->SwitchOffAODsMaker() ; | |
260 | else maker->SwitchOnAODsMaker() ; | |
261 | ||
262 | if(kPrintSettings) maker->Print(""); | |
263 | ||
264 | printf("======================== \n"); | |
265 | printf(" End Configuration of Pi0 analysis with detector %s \n",calorimeter.Data()); | |
266 | printf("======================== \n"); | |
267 | ||
268 | // Create task | |
269 | //=========================================================================== | |
270 | AliAnalysisTaskParticleCorrelation * task = new AliAnalysisTaskParticleCorrelation (Form("PartCorr%s",calorimeter.Data())); | |
271 | task->SetConfigFileName(""); //Don't configure the analysis via configuration file. | |
272 | //task->SetDebugLevel(-1); | |
af7b3903 | 273 | if(data=="ESD")task->SelectCollisionCandidates(); |
d7c10d78 | 274 | task->SetAnalysisMaker(maker); |
275 | //if(!kSimulation)task->SelectCollisionCandidates(); //AliPhysicsSelection has to be attached before. | |
276 | mgr->AddTask(task); | |
277 | ||
278 | //Create containers | |
279 | char name[128]; | |
280 | sprintf(name,"PartCorr_%s",calorimeter.Data()); | |
281 | cout<<"Name of task "<<name<<endl; | |
d7c10d78 | 282 | |
bdd28eb5 | 283 | if(outputfile.Length()==0)outputfile = AliAnalysisManager::GetCommonFileName(); |
284 | ||
d7c10d78 | 285 | AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(calorimeter.Data(), TList::Class(), |
bdd28eb5 | 286 | AliAnalysisManager::kOutputContainer, |
287 | Form("%s:Pi0",outputfile.Data())); | |
d7c10d78 | 288 | |
289 | AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(Form("%sCuts",calorimeter.Data()), TList::Class(), | |
bdd28eb5 | 290 | AliAnalysisManager::kParamContainer, |
291 | Form("%s:Pi0Cuts",outputfile.Data())); | |
d7c10d78 | 292 | // Create ONLY the output containers for the data produced by the task. |
293 | // Get and connect other common input/output containers via the manager as below | |
294 | //============================================================================== | |
295 | mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer()); | |
296 | // AOD output slot will be used in a different way in future | |
297 | if(!data.Contains("delta") && outputAOD) mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer()); | |
298 | mgr->ConnectOutput (task, 1, cout_pc); | |
299 | mgr->ConnectOutput (task, 2, cout_cuts); | |
300 | ||
301 | return task; | |
302 | } | |
303 | ||
304 |