]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/CaloTrackCorrelations/macros/AddTaskGenKine.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGGA / CaloTrackCorrelations / macros / AddTaskGenKine.C
CommitLineData
7b2086c3 1
2TString kCalorimeter = "EMCAL";
3Int_t kYears = 2011;
4Int_t kDebug = -1;
5Bool_t kPrint = kFALSE;
6
7AliAnalysisTaskCaloTrackCorrelation *AddTaskGenKine(TString outputfile, const Double_t scaleFactor = -1)
8{
9 // Creates a CaloTrackCorr task, configures it and adds it to the analysis manager.
10
11 // Get the pointer to the existing analysis manager via the static access method.
12
13 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
14 if (!mgr)
15 {
16 ::Error("AddTask", "No analysis manager to connect to.");
17 return NULL;
18 }
19
20 // #### Configure analysis ####
21
22 AliAnaCaloTrackCorrMaker * maker = new AliAnaCaloTrackCorrMaker();
23 printf("SCALE FACTOR %e\n",scaleFactor);
24 maker->SetScaleFactor(scaleFactor); // for MC, negative (not scaled) by default
25
26 // General frame setting and configuration
27 maker->SetReader (ConfigureReader() );
28 maker->SetCaloUtils(ConfigureCaloUtils());
29
30 // Analysis tasks setting and configuration
31 Int_t n = 0;//Analysis number, order is important
32 maker->AddAnalysis(ConfigureGenKine(), n++); // Photon cluster selection
33
34 maker->SetAnaDebug(kDebug) ;
35 maker->SwitchOnHistogramsMaker() ;
36 maker->SwitchOffAODsMaker() ;
37
38 if(kPrint) maker->Print("");
39
40 // Create task
41
42 AliAnalysisTaskCaloTrackCorrelation * task = new AliAnalysisTaskCaloTrackCorrelation ("GeneratorKineAnalysis");
43 task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
44 task->SetDebugLevel(kDebug);
45 task->SetBranches("ESD:AliESDRun.,AliESDHeader");
46 task->SetAnalysisMaker(maker);
47 mgr->AddTask(task);
48
49 //Create containers
50
51 if(outputfile.Length()==0) outputfile = AliAnalysisManager::GetCommonFileName();
52
53 AliAnalysisDataContainer *cout_pc = mgr->CreateContainer("GenKine", TList::Class(),
54 AliAnalysisManager::kOutputContainer,
55 Form("%s",outputfile.Data()));
56
57 AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer("Param_GemKine", TList::Class(),
58 AliAnalysisManager::kParamContainer,
59 "AnalysisParameters.root");
60
61 // Create ONLY the output containers for the data produced by the task.
62 // Get and connect other common input/output containers via the manager as below
63 //==============================================================================
64 mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
65 // AOD output slot will be used in a different way in future
66 mgr->ConnectOutput (task, 1, cout_pc);
67 mgr->ConnectOutput (task, 2, cout_cuts);
68
69 return task;
70}
71
72//____________________________________
73AliCaloTrackReader * ConfigureReader()
74{
75
76 AliCaloTrackReader * reader = new AliCaloTrackMCReader();
77
78 reader->SetDebug(kDebug);//10 for lots of messages
79
80// reader->SetPtHardAndJetPtComparison(kTRUE);
81// reader->SetPtHardAndJetPtFactor(4);
82//
83// reader->SetPtHardAndClusterPtComparison(kTRUE);
84// reader->SetPtHardAndClusterPtFactor(1.);
85
86
87 reader->SwitchOffWriteDeltaAOD() ;
88
89 reader->SwitchOnStack();
90 reader->SwitchOffAODMCParticles();
91
92 //------------------------
93 // Detector input filling
94 //------------------------
95
96 //Min cluster/track E
97 reader->SetEMCALEMin(0.3);
98 reader->SetEMCALEMax(1000);
99 reader->SetPHOSEMin(0.3);
100 reader->SetPHOSEMax(1000);
101 reader->SetCTSPtMin(0.2);
102 reader->SetCTSPtMax(1000);
103
104 reader->SwitchOnFiducialCut();
105 //reader->GetFiducialCut()->SetSimpleCTSFiducialCut(0.8, 0, 360) ;
106
107 reader->SwitchOffCTS();
108 reader->SwitchOffEMCALCells();
109 reader->SwitchOffEMCAL();
110 reader->SwitchOffPHOSCells();
111 reader->SwitchOffPHOS();
112
333b77db 113 reader->SetZvertexCut(10.); // Open cut
7b2086c3 114 reader->SwitchOnPrimaryVertexSelection(); // and besides primary vertex
115
333b77db 116 reader->SwitchOffPileUpEventRejection(); // remove pileup by default
117 reader->SwitchOffV0ANDSelection() ; // and besides v0 AND
d2bd7f0c 118
7b2086c3 119 if(kPrint)reader->Print("");
120
121 return reader;
122
123}
124
125
126//_______________________________________
127AliCalorimeterUtils* ConfigureCaloUtils()
128{
129
130 AliCalorimeterUtils *cu = new AliCalorimeterUtils;
131 cu->SetDebug(kDebug);
132
133
134 cu->SwitchOffClusterPlot();
135
136 cu->SwitchOffRecalculateClusterTrackMatching(); // Done in clusterization
137
138 cu->SwitchOffBadChannelsRemoval() ;
139
140 cu->SwitchOffLoadOwnEMCALGeometryMatrices();
141
142 AliEMCALRecoUtils * recou = cu->GetEMCALRecoUtils();
143
144 cu->SwitchOffRecalibration();
145 cu->SwitchOffTimeRecalibration();
146 cu->SwitchOffRunDepCorrection();
147 cu->SwitchOffCorrectClusterLinearity();
148 cu->SwitchOffEMCALOADB() ;
149
150 // PHOS
151 cu->SwitchOffLoadOwnPHOSGeometryMatrices();
152
153 if(kPrint) cu->Print("");
154
155 return cu;
156
157}
158
159
160//_____________________________________
161AliAnaGeneratorKine* ConfigureGenKine()
162{
163
164 AliAnaGeneratorKine *ana = new AliAnaGeneratorKine();
165 ana->SetDebug(kDebug); //10 for lots of messages
166
167 // cluster selection cuts
168
169 ana->SwitchOffFiducialCut();
170
171
172 ana->AddToHistogramsName("AnaGenKine_");
173 SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
174
175 if(kPrint)ana->Print("");
176
177 return ana;
178
179}
180
181//________________________________________________________
182void SetHistoRangeAndNBins (AliHistogramRanges* histoRanges)
183{
184 // Set common bins for all analysis and MC histograms filling
185
186 histoRanges->SetHistoPtRangeAndNBins(0, 200, 400) ; // Energy and pt histograms
187
188 if(kCalorimeter=="EMCAL")
189 {
190 if(kYears==2010)
191 {
192 histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 122*TMath::DegToRad(), 78) ;
193 histoRanges->SetHistoXRangeAndNBins(-230,90,120); // QA
194 histoRanges->SetHistoYRangeAndNBins(370,450,40); // QA
195 }
196 else if(kYears==2011)
197 {
198 histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 182*TMath::DegToRad(), 108) ;
199 histoRanges->SetHistoXRangeAndNBins(-600,90,200); // QA
200 histoRanges->SetHistoYRangeAndNBins(100,450,100); // QA
201 }
202 else
203 {
204 histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 190*TMath::DegToRad(), 122) ;
205 histoRanges->SetHistoXRangeAndNBins(-100,90,200); // QA
206 histoRanges->SetHistoYRangeAndNBins(50,450,100); // QA
207 }
208
209 histoRanges->SetHistoEtaRangeAndNBins(-0.72, 0.72, 144) ;
210 }
211 else
212 {
213 histoRanges->SetHistoPhiRangeAndNBins(260*TMath::DegToRad(), 320*TMath::DegToRad(), 60) ;
214 histoRanges->SetHistoEtaRangeAndNBins(-0.13, 0.13, 130) ;
215 }
216
217 histoRanges->SetHistoShowerShapeRangeAndNBins(-0.1, 4.9, 500);
218
219 // Invariant mass histoRangeslysis
220 histoRanges->SetHistoMassRangeAndNBins(0., 1., 200) ;
221 histoRanges->SetHistoAsymmetryRangeAndNBins(0., 1. , 100) ;
222
223 // check if time calibration is on
224 histoRanges->SetHistoTimeRangeAndNBins(-1000.,1000,1000);
225 histoRanges->SetHistoDiffTimeRangeAndNBins(-200, 200, 800);
226
227 // track-cluster residuals
228 histoRanges->SetHistoTrackResidualEtaRangeAndNBins(-0.15,0.15,300);
229 histoRanges->SetHistoTrackResidualPhiRangeAndNBins(-0.15,0.15,300);
230 histoRanges->SetHistodRRangeAndNBins(0.,0.15,150);//QA
231
232 // QA, electron, charged
233 histoRanges->SetHistoPOverERangeAndNBins(0,10.,100);
234 histoRanges->SetHistodEdxRangeAndNBins(0.,200.,200);
235
236 // QA
237 histoRanges->SetHistoFinePtRangeAndNBins(0, 10, 200) ; // bining for fhAmpId
238 histoRanges->SetHistoRatioRangeAndNBins(0.,2.,100);
239 histoRanges->SetHistoVertexDistRangeAndNBins(0.,500.,500);
240 histoRanges->SetHistoNClusterCellRangeAndNBins(0,500,500);
241 histoRanges->SetHistoZRangeAndNBins(-400,400,200);
242 histoRanges->SetHistoRRangeAndNBins(400,450,25);
243 histoRanges->SetHistoV0SignalRangeAndNBins(0,5000,500);
244 histoRanges->SetHistoV0MultiplicityRangeAndNBins(0,5000,500);
245 histoRanges->SetHistoTrackMultiplicityRangeAndNBins(0,5000,500);
246
247}