]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/macros/AddTaskPartCorr.C
include CalorimeterQA in analysis train, some debug prints in QA added
[u/mrichter/AliRoot.git] / PWG4 / macros / AddTaskPartCorr.C
CommitLineData
a3aebfff 1AliAnalysisTaskParticleCorrelation *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
4865e325 30 if(calorimeter == "EMCAL") reader->SwitchOnEMCALCells();
31 if(calorimeter == "PHOS") reader->SwitchOnPHOSCells();
90eb3a19 32 //Min particle pT
4865e325 33 reader->SetEMCALPtMin(0.2);
34 reader->SetPHOSPtMin(0.2);
a3aebfff 35 reader->SetCTSPtMin(0.2);
90eb3a19 36 reader->Print("");
37
a3aebfff 38 // ##### Analysis algorithm settings ####
39
40 // --------------------
41 // --- Pi0 Analysis ---
42 // --------------------
90eb3a19 43
44 AliCaloPID * pid = new AliCaloPID();
45 pid->SetDispersionCut(1.5);
46 pid->SetTOFCut(5.e-9);
47 pid->SetDebug(-1);
48 pid->Print("");
4865e325 49
50 AliFidutialCut * fidCut = new AliFidutialCut();
51 fidCut->DoCTSFidutialCut(kFALSE) ;
52 fidCut->DoEMCALFidutialCut(kTRUE) ;
53 fidCut->DoPHOSFidutialCut(kTRUE) ;
54
55 AliAnaCalorimeterQA *qa = new AliAnaCalorimeterQA();
56 qa->SetDebug(-1); //10 for lots of messages
57 qa->SetCalorimeter(calorimeter);
58 qa->SwitchOnDataMC() ;//Access MC stack and fill more histograms
59 qa->AddToHistogramsName("AnaCaloQA_"+calorimeter);
60 qa->SetFidutialCut(fidCut);
61 qa->SwitchOnFidutialCut();
62 qa->Print("");
63
a3aebfff 64 AliAnaPhoton *anaphoton1 = new AliAnaPhoton();
65 anaphoton1->SetDebug(-1); //10 for lots of messages
90eb3a19 66 //anaphoton->SetMinPt(0.5);
a3aebfff 67 anaphoton1->SetMinDistanceToBadChannel(2, 4, 5);
68 anaphoton1->SetCaloPID(pid);
69 anaphoton1->SetCalorimeter(calorimeter);
70 anaphoton1->SwitchOffDataMC() ;//Access MC stack and fill more histograms
71 anaphoton1->SwitchOffCaloPID();
72 anaphoton1->SwitchOffCaloPIDRecalculation(); //recommended for EMCAL
73 anaphoton1->SwitchOffFidutialCut();
4865e325 74 anaphoton1->SetOutputAODName("PhotonsForIM"+calorimeter);
a3aebfff 75 anaphoton1->Print("");
76
90eb3a19 77 AliAnaPi0 *anapi0 = new AliAnaPi0();
78 anapi0->SetDebug(-1);//10 for lots of messages
4865e325 79 anapi0->SetInputAODName("PhotonsForIM"+calorimeter);
90eb3a19 80 anapi0->SetCaloPID(pid);
81 anapi0->SetCalorimeter(calorimeter);
82 anapi0->SwitchOnFidutialCut();
83 anapi0->SwitchOffDataMC() ;//Access MC stack and fill more histograms
84 anapi0->Print("");
85
4865e325 86// AliAnaNeutralMeson *ananeutral = new AliAnaNeutralMeson();
87// ananeutral->SetDebug(-1);//10 for lots of messages
88// ananeutral->SetInputAODName("PhotonsForIM"+calorimeter);
89// ananeutral->SetCaloPID(pid);
90// // ananeutral->SetNCentrBin(5); //number of bins in centrality
91// // ananeutral->SetNZvertBin(5); //number of bins for vertex position
92// // ananeutral->SetNRPBin(6); //number of bins in reaction plain
93// ananeutral->SetAnaPi0Eta(kTRUE); //whether analysis pi0 and eta
94// ananeutral->SetAnaOmega(kTRUE); //whether analysis omega
95// ananeutral->SetNPID(3);
96// ananeutral->SetInvMassCut(1.);
97// ananeutral->SetNEventsMixed(6);
98// ananeutral->SetNAsyBinsMinMax(200,0,1.);
99// ananeutral->SetNPtBinsMinMax(200,0,20.);
100// ananeutral->SetNMassBinsMinMas(200,0,1.);
101// ananeutral->SetPi0MassPeakWidthCut(0.015);
102// ananeutral->SetCalorimeter(calorimeter);
103// ananeutral->SwitchOnFidutialCut();
104// ananeutral->SwitchOffDataMC() ;//Access MC stack and fill more histograms
105// ananeutral->AddToHistogramsName("AnaNeutralMeson_");
106// ananeutral->Print("");
107
a3aebfff 108 // -------------------------------------------------
109 // --- Photon Isolation and Correlation Analysis ---
110 // -------------------------------------------------
111
112 AliAnaPhoton *anaphoton2 = new AliAnaPhoton();
113 anaphoton2->SetDebug(-1); //10 for lots of messages
114 anaphoton2->SetMinPt(5);
115 anaphoton2->SetCaloPID(pid);
116 anaphoton2->SetCalorimeter(calorimeter);
117 anaphoton2->SwitchOffDataMC() ;//Access MC stack and fill more histograms
118 anaphoton2->SwitchOnCaloPID();
119 if(calorimeter == "EMCAL") anaphoton2->SwitchOnCaloPIDRecalculation();
120 anaphoton2->SwitchOffFidutialCut();
121 anaphoton2->SetOutputAODName("DirectPhotons"+calorimeter);
122 anaphoton2->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
123 anaphoton2->AddToHistogramsName("AnaPhotonCorr_");
124 anaphoton2->Print("");
90eb3a19 125 // ### Isolation analysis ###
126
127 AliIsolationCut * ic = new AliIsolationCut();
128 ic->SetConeSize(0.5);
129 ic->SetPtThreshold(1.);
130 ic->SetICMethod(AliIsolationCut::kPtThresIC);
131 ic->Print("");
132
133 AliAnaParticleIsolation *anaisol = new AliAnaParticleIsolation();
134 anaisol->SetDebug(-1);
135 //anaisol->SetMinPt(5);
a3aebfff 136 anaisol->SetInputAODName("DirectPhotons"+calorimeter);
90eb3a19 137 anaisol->SetCalorimeter(calorimeter);
138 anaisol->SwitchOffDataMC() ;//Access MC stack and fill more histograms
139 //Select clusters with no pair, if both clusters with pi0 mass
140 anaisol->SwitchOffInvariantMass();
141 //anaisol->SetNeutralMesonSelection(nms);
142 //Do isolation cut
143 anaisol->SetIsolationCut(ic);
144 //Do or not do isolation with previously produced AODs.
145 //No effect if use of SwitchOnSeveralIsolation()
146 anaisol->SwitchOffReIsolation();
147 //Multiple IC
148 anaisol->SwitchOffSeveralIsolation() ;
149 anaisol->Print("");
150
a3aebfff 151 // ### Correlation with Jet Finder AOD output
152 AliAnaParticleJetFinderCorrelation *anacorrjet = new AliAnaParticleJetFinderCorrelation();
153 anacorrjet->SetInputAODName("DirectPhotons"+calorimeter);
154 anacorrjet->SwitchOffFidutialCut();
155 anacorrjet->SetDebug(-1);
156 anacorrjet->SetConeSize(1);
157 anacorrjet->SelectIsolated(kTRUE); // do correlation with isolated photons
158 anacorrjet->SetPtThresholdInCone(0.2);
159 anacorrjet->SetDeltaPhiCutRange(0.5,5.5);//Mostly Open Cuts
160 anacorrjet->SetRatioCutRange(0.01,3); //Mostly Open Cuts
161 anacorrjet->UseJetRefTracks(kFALSE); //Not working now
162 anacorrjet->Print("");
90eb3a19 163
164 // ### Correlation with hadrons
a3aebfff 165 AliAnaParticleHadronCorrelation *anacorrhadron = new AliAnaParticleHadronCorrelation();
166 anacorrhadron->SetInputAODName("DirectPhotons"+calorimeter);
9415d854 167 anacorrhadron->SetOutputAODName("CorrelatedPi0s"+calorimeter);
168 anacorrhadron->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
a3aebfff 169 anacorrhadron->SetDebug(-1);
12524a23 170 anacorrhadron->SwitchOffCaloPID();
a3aebfff 171 anacorrhadron->SwitchOffFidutialCut();
172 anacorrhadron->SetPtCutRange(1,100);
173 anacorrhadron->SetDeltaPhiCutRange(1.5,4.5);
174 anacorrhadron->SelectIsolated(kTRUE); // do correlation with isolated photons
4865e325 175 if(calorimeter=="PHOS"){
90eb3a19 176 //Correlate with particles in EMCAL
a3aebfff 177 anacorrhadron->SwitchOnCaloPID();
178 anacorrhadron->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
90eb3a19 179 }
a3aebfff 180 anacorrhadron->Print("");
90eb3a19 181
182 // #### Configure Maker ####
a3aebfff 183 AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker();
90eb3a19 184 maker->SetReader(reader);//pointer to reader
4865e325 185 maker->AddAnalysis(qa,0);
186 maker->AddAnalysis(anaphoton1,1);
187 maker->AddAnalysis(anapi0,2);
188 maker->AddAnalysis(anaphoton2,3);
189 maker->AddAnalysis(anaisol,4);
190 maker->AddAnalysis(anacorrjet,5);
191 maker->AddAnalysis(anacorrhadron,6);
192 //maker->AddAnalysis(ananeutral,7);
90eb3a19 193 maker->SetAnaDebug(-1) ;
194 maker->SwitchOnHistogramsMaker() ;
195 maker->SwitchOnAODsMaker() ;
196 maker->Print("");
a3aebfff 197
90eb3a19 198 printf("======================== \n");
a3aebfff 199 printf(" End Configuration of PartCorr analysis with detector %s \n",calorimeter.Data());
90eb3a19 200 printf("======================== \n");
201
a3aebfff 202 // Create task
203 //===========================================================================
fbc534a2 204 AliAnalysisTaskParticleCorrelation * task = new AliAnalysisTaskParticleCorrelation ("PartCorr"+calorimeter);
a3aebfff 205 task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
206 //task->SetDebugLevel(-1);
207 task->SetAnalysisMaker(maker);
208 mgr->AddTask(task);
209
fbc534a2 210 char name[128];
211 sprintf(name,"PartCorr_%s",calorimeter.Data());
212cout<<"Name of task "<<name<<endl;
213 AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(Form(name),TList::Class(),
a3aebfff 214 AliAnalysisManager::kOutputContainer, Form("PartCorr_%s.root",calorimeter.Data()));
215
216 // Create ONLY the output containers for the data produced by the task.
217 // Get and connect other common input/output containers via the manager as below
218 //==============================================================================
219 mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
220 // AOD output slot will be used in a different way in future
221 mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
222 mgr->ConnectOutput (task, 1, cout_pc);
223
224 return task;
90eb3a19 225}
a3aebfff 226
227