]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/CaloTrackCorrelations/macros/AddTaskGenKine.C
move setting of geometry file from Reader to CaloUtils, set it automatically at first...
[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
113 reader->SetZvertexCut(10.); // Open cut
114 reader->SwitchOnPrimaryVertexSelection(); // and besides primary vertex
115
116 reader->SwitchOffEventSelection(); // remove pileup by default
117 reader->SwitchOffV0ANDSelection() ; // and besides v0 AND
118
119 reader->SetImportGeometryFromFile(kFALSE);
120
121 if(kPrint)reader->Print("");
122
123 return reader;
124
125}
126
127
128//_______________________________________
129AliCalorimeterUtils* ConfigureCaloUtils()
130{
131
132 AliCalorimeterUtils *cu = new AliCalorimeterUtils;
133 cu->SetDebug(kDebug);
134
135
136 cu->SwitchOffClusterPlot();
137
138 cu->SwitchOffRecalculateClusterTrackMatching(); // Done in clusterization
139
140 cu->SwitchOffBadChannelsRemoval() ;
141
142 cu->SwitchOffLoadOwnEMCALGeometryMatrices();
143
144 AliEMCALRecoUtils * recou = cu->GetEMCALRecoUtils();
145
146 cu->SwitchOffRecalibration();
147 cu->SwitchOffTimeRecalibration();
148 cu->SwitchOffRunDepCorrection();
149 cu->SwitchOffCorrectClusterLinearity();
150 cu->SwitchOffEMCALOADB() ;
151
152 // PHOS
153 cu->SwitchOffLoadOwnPHOSGeometryMatrices();
154
155 if(kPrint) cu->Print("");
156
157 return cu;
158
159}
160
161
162//_____________________________________
163AliAnaGeneratorKine* ConfigureGenKine()
164{
165
166 AliAnaGeneratorKine *ana = new AliAnaGeneratorKine();
167 ana->SetDebug(kDebug); //10 for lots of messages
168
169 // cluster selection cuts
170
171 ana->SwitchOffFiducialCut();
172
173
174 ana->AddToHistogramsName("AnaGenKine_");
175 SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below
176
177 if(kPrint)ana->Print("");
178
179 return ana;
180
181}
182
183//________________________________________________________
184void SetHistoRangeAndNBins (AliHistogramRanges* histoRanges)
185{
186 // Set common bins for all analysis and MC histograms filling
187
188 histoRanges->SetHistoPtRangeAndNBins(0, 200, 400) ; // Energy and pt histograms
189
190 if(kCalorimeter=="EMCAL")
191 {
192 if(kYears==2010)
193 {
194 histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 122*TMath::DegToRad(), 78) ;
195 histoRanges->SetHistoXRangeAndNBins(-230,90,120); // QA
196 histoRanges->SetHistoYRangeAndNBins(370,450,40); // QA
197 }
198 else if(kYears==2011)
199 {
200 histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 182*TMath::DegToRad(), 108) ;
201 histoRanges->SetHistoXRangeAndNBins(-600,90,200); // QA
202 histoRanges->SetHistoYRangeAndNBins(100,450,100); // QA
203 }
204 else
205 {
206 histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 190*TMath::DegToRad(), 122) ;
207 histoRanges->SetHistoXRangeAndNBins(-100,90,200); // QA
208 histoRanges->SetHistoYRangeAndNBins(50,450,100); // QA
209 }
210
211 histoRanges->SetHistoEtaRangeAndNBins(-0.72, 0.72, 144) ;
212 }
213 else
214 {
215 histoRanges->SetHistoPhiRangeAndNBins(260*TMath::DegToRad(), 320*TMath::DegToRad(), 60) ;
216 histoRanges->SetHistoEtaRangeAndNBins(-0.13, 0.13, 130) ;
217 }
218
219 histoRanges->SetHistoShowerShapeRangeAndNBins(-0.1, 4.9, 500);
220
221 // Invariant mass histoRangeslysis
222 histoRanges->SetHistoMassRangeAndNBins(0., 1., 200) ;
223 histoRanges->SetHistoAsymmetryRangeAndNBins(0., 1. , 100) ;
224
225 // check if time calibration is on
226 histoRanges->SetHistoTimeRangeAndNBins(-1000.,1000,1000);
227 histoRanges->SetHistoDiffTimeRangeAndNBins(-200, 200, 800);
228
229 // track-cluster residuals
230 histoRanges->SetHistoTrackResidualEtaRangeAndNBins(-0.15,0.15,300);
231 histoRanges->SetHistoTrackResidualPhiRangeAndNBins(-0.15,0.15,300);
232 histoRanges->SetHistodRRangeAndNBins(0.,0.15,150);//QA
233
234 // QA, electron, charged
235 histoRanges->SetHistoPOverERangeAndNBins(0,10.,100);
236 histoRanges->SetHistodEdxRangeAndNBins(0.,200.,200);
237
238 // QA
239 histoRanges->SetHistoFinePtRangeAndNBins(0, 10, 200) ; // bining for fhAmpId
240 histoRanges->SetHistoRatioRangeAndNBins(0.,2.,100);
241 histoRanges->SetHistoVertexDistRangeAndNBins(0.,500.,500);
242 histoRanges->SetHistoNClusterCellRangeAndNBins(0,500,500);
243 histoRanges->SetHistoZRangeAndNBins(-400,400,200);
244 histoRanges->SetHistoRRangeAndNBins(400,450,25);
245 histoRanges->SetHistoV0SignalRangeAndNBins(0,5000,500);
246 histoRanges->SetHistoV0MultiplicityRangeAndNBins(0,5000,500);
247 histoRanges->SetHistoTrackMultiplicityRangeAndNBins(0,5000,500);
248
249}