a3aebfff |
1 | AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calorimeter) |
90eb3a19 |
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("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 dataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD" |
20 | |
21 | // Configure analysis |
22 | //=========================================================================== |
23 | |
24 | //Reader |
25 | AliCaloTrackReader * reader = 0x0; |
26 | if(data=="AOD") reader = new AliCaloTrackAODReader(); |
27 | else if(data=="ESD") reader = new AliCaloTrackESDReader(); |
28 | else if(data=="MC") reader = new AliCaloTrackMCReader(); |
29 | reader->SetDebug(-1);//10 for lots of messages |
30 | |
90eb3a19 |
31 | //Min particle pT |
32 | reader->SetEMCALPtMin(0.5); |
33 | reader->SetPHOSPtMin(0.5); |
a3aebfff |
34 | reader->SetCTSPtMin(0.2); |
90eb3a19 |
35 | reader->Print(""); |
36 | |
a3aebfff |
37 | // ##### Analysis algorithm settings #### |
38 | |
39 | // -------------------- |
40 | // --- Pi0 Analysis --- |
41 | // -------------------- |
90eb3a19 |
42 | |
43 | AliCaloPID * pid = new AliCaloPID(); |
44 | pid->SetDispersionCut(1.5); |
45 | pid->SetTOFCut(5.e-9); |
46 | pid->SetDebug(-1); |
47 | pid->Print(""); |
48 | |
a3aebfff |
49 | AliAnaPhoton *anaphoton1 = new AliAnaPhoton(); |
50 | anaphoton1->SetDebug(-1); //10 for lots of messages |
90eb3a19 |
51 | //anaphoton->SetMinPt(0.5); |
a3aebfff |
52 | anaphoton1->SetMinDistanceToBadChannel(2, 4, 5); |
53 | anaphoton1->SetCaloPID(pid); |
54 | anaphoton1->SetCalorimeter(calorimeter); |
55 | anaphoton1->SwitchOffDataMC() ;//Access MC stack and fill more histograms |
56 | anaphoton1->SwitchOffCaloPID(); |
57 | anaphoton1->SwitchOffCaloPIDRecalculation(); //recommended for EMCAL |
58 | anaphoton1->SwitchOffFidutialCut(); |
59 | anaphoton1->SetOutputAODName("PhotonsForPi0IM"+calorimeter); |
60 | anaphoton1->Print(""); |
61 | |
90eb3a19 |
62 | AliAnaPi0 *anapi0 = new AliAnaPi0(); |
63 | anapi0->SetDebug(-1);//10 for lots of messages |
a3aebfff |
64 | anapi0->SetInputAODName("PhotonsForPi0IM"+calorimeter); |
90eb3a19 |
65 | anapi0->SetCaloPID(pid); |
66 | anapi0->SetCalorimeter(calorimeter); |
67 | anapi0->SwitchOnFidutialCut(); |
68 | anapi0->SwitchOffDataMC() ;//Access MC stack and fill more histograms |
69 | anapi0->Print(""); |
70 | |
90eb3a19 |
71 | |
a3aebfff |
72 | // ------------------------------------------------- |
73 | // --- Photon Isolation and Correlation Analysis --- |
74 | // ------------------------------------------------- |
75 | |
76 | AliAnaPhoton *anaphoton2 = new AliAnaPhoton(); |
77 | anaphoton2->SetDebug(-1); //10 for lots of messages |
78 | anaphoton2->SetMinPt(5); |
79 | anaphoton2->SetCaloPID(pid); |
80 | anaphoton2->SetCalorimeter(calorimeter); |
81 | anaphoton2->SwitchOffDataMC() ;//Access MC stack and fill more histograms |
82 | anaphoton2->SwitchOnCaloPID(); |
83 | if(calorimeter == "EMCAL") anaphoton2->SwitchOnCaloPIDRecalculation(); |
84 | anaphoton2->SwitchOffFidutialCut(); |
85 | anaphoton2->SetOutputAODName("DirectPhotons"+calorimeter); |
86 | anaphoton2->SetOutputAODClassName("AliAODPWG4ParticleCorrelation"); |
87 | anaphoton2->AddToHistogramsName("AnaPhotonCorr_"); |
88 | anaphoton2->Print(""); |
90eb3a19 |
89 | // ### Isolation analysis ### |
90 | |
91 | AliIsolationCut * ic = new AliIsolationCut(); |
92 | ic->SetConeSize(0.5); |
93 | ic->SetPtThreshold(1.); |
94 | ic->SetICMethod(AliIsolationCut::kPtThresIC); |
95 | ic->Print(""); |
96 | |
97 | AliAnaParticleIsolation *anaisol = new AliAnaParticleIsolation(); |
98 | anaisol->SetDebug(-1); |
99 | //anaisol->SetMinPt(5); |
a3aebfff |
100 | anaisol->SetInputAODName("DirectPhotons"+calorimeter); |
90eb3a19 |
101 | anaisol->SetCalorimeter(calorimeter); |
102 | anaisol->SwitchOffDataMC() ;//Access MC stack and fill more histograms |
103 | //Select clusters with no pair, if both clusters with pi0 mass |
104 | anaisol->SwitchOffInvariantMass(); |
105 | //anaisol->SetNeutralMesonSelection(nms); |
106 | //Do isolation cut |
107 | anaisol->SetIsolationCut(ic); |
108 | //Do or not do isolation with previously produced AODs. |
109 | //No effect if use of SwitchOnSeveralIsolation() |
110 | anaisol->SwitchOffReIsolation(); |
111 | //Multiple IC |
112 | anaisol->SwitchOffSeveralIsolation() ; |
113 | anaisol->Print(""); |
114 | |
a3aebfff |
115 | // ### Correlation with Jet Finder AOD output |
116 | AliAnaParticleJetFinderCorrelation *anacorrjet = new AliAnaParticleJetFinderCorrelation(); |
117 | anacorrjet->SetInputAODName("DirectPhotons"+calorimeter); |
118 | anacorrjet->SwitchOffFidutialCut(); |
119 | anacorrjet->SetDebug(-1); |
120 | anacorrjet->SetConeSize(1); |
121 | anacorrjet->SelectIsolated(kTRUE); // do correlation with isolated photons |
122 | anacorrjet->SetPtThresholdInCone(0.2); |
123 | anacorrjet->SetDeltaPhiCutRange(0.5,5.5);//Mostly Open Cuts |
124 | anacorrjet->SetRatioCutRange(0.01,3); //Mostly Open Cuts |
125 | anacorrjet->UseJetRefTracks(kFALSE); //Not working now |
126 | anacorrjet->Print(""); |
90eb3a19 |
127 | |
128 | // ### Correlation with hadrons |
a3aebfff |
129 | AliAnaParticleHadronCorrelation *anacorrhadron = new AliAnaParticleHadronCorrelation(); |
130 | anacorrhadron->SetInputAODName("DirectPhotons"+calorimeter); |
131 | anacorrhadron->SetDebug(-1); |
132 | anacorrhadron->SwitchOffFidutialCut(); |
133 | anacorrhadron->SetPtCutRange(1,100); |
134 | anacorrhadron->SetDeltaPhiCutRange(1.5,4.5); |
135 | anacorrhadron->SelectIsolated(kTRUE); // do correlation with isolated photons |
136 | if(calorimeter=="PHOS"){ |
90eb3a19 |
137 | //Correlate with particles in EMCAL |
a3aebfff |
138 | anacorrhadron->SwitchOnCaloPID(); |
139 | anacorrhadron->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL |
90eb3a19 |
140 | } |
a3aebfff |
141 | anacorrhadron->Print(""); |
90eb3a19 |
142 | |
143 | // #### Configure Maker #### |
a3aebfff |
144 | AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker(); |
90eb3a19 |
145 | maker->SetReader(reader);//pointer to reader |
a3aebfff |
146 | maker->AddAnalysis(anaphoton1,0); |
147 | maker->AddAnalysis(anapi0,1); |
148 | maker->AddAnalysis(anaphoton2,2); |
149 | maker->AddAnalysis(anaisol,3); |
150 | maker->AddAnalysis(anacorrjet,4); |
151 | maker->AddAnalysis(anacorrhadron,5); |
90eb3a19 |
152 | maker->SetAnaDebug(-1) ; |
153 | maker->SwitchOnHistogramsMaker() ; |
154 | maker->SwitchOnAODsMaker() ; |
155 | maker->Print(""); |
a3aebfff |
156 | |
90eb3a19 |
157 | printf("======================== \n"); |
a3aebfff |
158 | printf(" End Configuration of PartCorr analysis with detector %s \n",calorimeter.Data()); |
90eb3a19 |
159 | printf("======================== \n"); |
160 | |
a3aebfff |
161 | // Create task |
162 | //=========================================================================== |
163 | AliAnalysisTaskParticleCorrelation * task = new AliAnalysisTaskParticleCorrelation ("PartCorr"); |
164 | task->SetConfigFileName(""); //Don't configure the analysis via configuration file. |
165 | //task->SetDebugLevel(-1); |
166 | task->SetAnalysisMaker(maker); |
167 | mgr->AddTask(task); |
168 | |
169 | AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(Form("PartCorr"),TList::Class(), |
170 | AliAnalysisManager::kOutputContainer, Form("PartCorr_%s.root",calorimeter.Data())); |
171 | |
172 | // Create ONLY the output containers for the data produced by the task. |
173 | // Get and connect other common input/output containers via the manager as below |
174 | //============================================================================== |
175 | mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer()); |
176 | // AOD output slot will be used in a different way in future |
177 | mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer()); |
178 | mgr->ConnectOutput (task, 1, cout_pc); |
179 | |
180 | return task; |
90eb3a19 |
181 | } |
a3aebfff |
182 | |
183 | |