]>
Commit | Line | Data |
---|---|---|
0601d71e | 1 | // $Id$ |
2 | ||
193828fd | 3 | AliAnalysisTaskEMCALClusterize* AddTaskEMCALClusterize( |
cb68426a | 4 | TString & arrayName, |
5 | const Bool_t bFillAOD = kFALSE, | |
6 | const Int_t bMC = kFALSE, | |
7 | const Bool_t exotic = kTRUE, | |
8 | const TString name = "V1Unfold", | |
9 | const TString trigger = "", | |
10 | const Bool_t tm = kTRUE, | |
11 | const Int_t minEcell = 50, | |
12 | const Int_t minEseed = 100, | |
13 | const Int_t maxDeltaT = 250, | |
14 | const Int_t timeWindow = 1000, | |
15 | const Int_t minEUnf = 15, | |
16 | const Int_t minFrac = 1, | |
17 | const Bool_t bRecalE = kTRUE, | |
18 | const Bool_t bBad = kTRUE, | |
19 | const Bool_t bRecalT = kTRUE, | |
20 | const Bool_t bNonLine = kFALSE, | |
21 | const Int_t minCen = -1, | |
22 | const Int_t maxCen = -1, | |
23 | const Int_t nRowDiff = 1, | |
24 | const Int_t nColDiff = 1 | |
25 | ) | |
193828fd | 26 | { |
5994e71f | 27 | // Get the pointer to the existing analysis manager via the static access method. |
28 | //============================================================================== | |
29 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
531f682d | 30 | if (!mgr) |
31 | { | |
193828fd | 32 | ::Error("AddTaskEMCALClusterize", "No analysis manager to connect to."); |
5994e71f | 33 | return NULL; |
34 | } | |
35 | ||
36 | // Check the analysis type using the event handlers connected to the analysis manager. | |
37 | //============================================================================== | |
531f682d | 38 | if (!mgr->GetInputEventHandler()) |
39 | { | |
40 | ::Error("AddTaskEMCALClusterize", "This clusterize requires an input event handler"); | |
5994e71f | 41 | return NULL; |
42 | } | |
43 | ||
38032052 | 44 | printf("Passed Settings : mc %d, exo %d, name %s, trigger %s, tm %d\n",bMC,exotic,name.Data(),trigger.Data(),tm); |
45 | printf(" Ecell %d, Eseed %d, dT %d, wT %d, minUnf %d, minFrac %d \n",minEcell, minEseed,maxDeltaT,timeWindow,minEUnf,minFrac); | |
cb68426a | 46 | printf(" recalE %d, bad %d, recalT %d, nonlin %d, minCen %d, maxCen %d, rowDiff %d, colDiff %d \n",bRecalE,bBad,bRecalT,bNonLine,minCen,maxCen,nRowDiff,nColDiff); |
38032052 | 47 | |
cb68426a | 48 | // Create name of task and AOD branch depending on different settings |
49 | ||
50 | if(name.Contains("NxN")) arrayName = Form("%dx%d_Ecell%d_Eseed%d_DT%d_WT%d",2*nRowDiff+1,2*nColDiff+1,minEcell,minEseed,maxDeltaT,timeWindow); | |
51 | else arrayName = Form( "%s_Ecell%d_Eseed%d_DT%d_WT%d", name.Data(),minEcell,minEseed,maxDeltaT,timeWindow); | |
52 | ||
53 | if(minCen != -1 && maxCen != -1) | |
54 | arrayName+=Form("_Cen%d_%d",minCen,maxCen); | |
55 | ||
56 | printf("Created Branch Name: \n",arrayName.Data()); | |
57 | ||
58 | ||
531f682d | 59 | //------------------------------------------------------- |
60 | // Init the task and do settings | |
61 | //------------------------------------------------------- | |
62 | ||
cb68426a | 63 | AliAnalysisTaskEMCALClusterize* clusterize = new AliAnalysisTaskEMCALClusterize(Form("EMCALClusterize%s",arrayName.Data())); |
193828fd | 64 | |
cb68426a | 65 | clusterize->SetAODBranchName(arrayName); |
66 | ||
193828fd | 67 | //clusterize->SetOCDBPath("local://$ALICE_ROOT/OCDB"); |
68 | ||
531f682d | 69 | // Some general settings to create AOD file in case we want to keep it |
193828fd | 70 | clusterize->SwitchOffFillAODCaloCells(); |
71 | clusterize->SwitchOffFillAODHeader(); | |
6a797202 | 72 | clusterize->FillAODFile(bFillAOD); // fill aod.root with clusters?, not really needed for analysis. |
193828fd | 73 | |
531f682d | 74 | // Do track matching after clusterization |
193828fd | 75 | if(tm) clusterize->SwitchOnTrackMatching(); |
76 | else clusterize->SwitchOffTrackMatching(); | |
77 | ||
531f682d | 78 | //------------------------------------------------------- |
79 | // Set clusterization parameters via rec param | |
80 | //------------------------------------------------------- | |
193828fd | 81 | |
5994e71f | 82 | AliEMCALRecParam * params = clusterize->GetRecParam(); |
193828fd | 83 | |
531f682d | 84 | // Position and SS weight parameter |
5994e71f | 85 | params->SetW0(4.5); |
193828fd | 86 | |
531f682d | 87 | // Time cuts, depend on data type (no cells time in AODs) |
193828fd | 88 | TString sHandler((mgr->GetInputEventHandler())->ClassName()); |
531f682d | 89 | if(sHandler.Contains("AOD")) |
90 | { | |
193828fd | 91 | printf("AliAnalysisTaskEMCALClusterize - Open time cuts for AODs\n"); |
92 | params->SetTimeCut(1e6);//Open this cut for AODs | |
93 | params->SetTimeMin(-1); //Open this cut for AODs | |
94 | params->SetTimeMax(1e6);//Open this cut for AODs | |
95 | } | |
531f682d | 96 | else |
97 | { | |
193828fd | 98 | printf("AliAnalysisTaskEMCALClusterize - Set time cuts for ESDs\n"); |
5eef1db1 | 99 | if(maxDeltaT > 1) params->SetTimeCut(maxDeltaT*1.e-9); |
100 | else { params->SetTimeCut(250*1.e-9); printf("default maxDeltaT = 250 ns\n"); }// Same as in reco | |
101 | ||
531f682d | 102 | if(timeWindow > 1) |
103 | { | |
5eef1db1 | 104 | params->SetTimeMin(-1*timeWindow*1.e-9); |
105 | params->SetTimeMax(timeWindow*1.e-9); | |
106 | } | |
531f682d | 107 | else |
023e6936 | 108 | { |
109 | if(bRecalT && !bMC) | |
110 | { | |
111 | params->SetTimeMin(-250*1.e-9); | |
112 | params->SetTimeMax( 250*1.e-9); | |
113 | printf("default time window for calibrated time -250 ns < T < 250 ns\n"); | |
114 | } | |
115 | else | |
116 | { | |
117 | // same as in reco, USE IF NO TIME RECALIBRATION | |
118 | params->SetTimeMin(425*1.e-9); | |
119 | params->SetTimeMax(825*1.e-9); | |
120 | printf("default time window 425 ns < T < 825 ns\n"); | |
121 | } | |
5eef1db1 | 122 | } |
193828fd | 123 | } |
124 | ||
531f682d | 125 | // Energy cuts |
193828fd | 126 | params->SetClusteringThreshold(minEseed/1.e3); |
127 | params->SetMinECut (minEcell/1.e3); | |
128 | ||
129 | // Clusterizer type | |
130 | if(name.Contains("V2")) params->SetClusterizerFlag(AliEMCALRecParam::kClusterizerv2); | |
131 | if(name.Contains("V1")) params->SetClusterizerFlag(AliEMCALRecParam::kClusterizerv1); | |
38032052 | 132 | if(name.Contains("NxN")) |
133 | { | |
134 | params->SetClusterizerFlag(AliEMCALRecParam::kClusterizerNxN); | |
135 | printf("Set NxN cluster size to %dx%d (row diff %d, col diff %d)\n",2*nRowDiff+1,2*nColDiff+1,nRowDiff,nColDiff); | |
136 | params->SetNxM(nRowDiff, nColDiff); | |
137 | } | |
193828fd | 138 | |
531f682d | 139 | //------------------------------------------------------- |
140 | // Unfolding, 2 options : | |
141 | //------------------------------------------------------- | |
193828fd | 142 | |
531f682d | 143 | // 1) Just unfold existing clusters |
193828fd | 144 | if(name.Contains("JustUnfold")) |
145 | clusterize->JustUnfold(kTRUE); // if TRUE, do just unfolding, do not recluster cells | |
146 | else | |
147 | clusterize->JustUnfold(kFALSE); | |
148 | ||
531f682d | 149 | // 2) Unfold clusters created in the clusterize (revise settings) |
150 | if (name.Contains("Unfold")) | |
151 | { | |
193828fd | 152 | clusterize->SwitchOnCellEnergySelection(); |
153 | clusterize->SetCellCuts(minEUnf/1000.,minFrac/10000.); | |
154 | printf("AliAnalysisTaskEMCALClusterize - Cuts: min E %f, frac %f\n",minEUnf/1000.,minFrac/10000.); | |
155 | //clusterize->SwitchOffCellEnergySelection(); | |
531f682d | 156 | |
193828fd | 157 | if(!name.Contains("Just")) |
531f682d | 158 | params->SetUnfold(kTRUE); |
159 | else | |
160 | params->SetUnfold(kFALSE); | |
161 | ||
193828fd | 162 | } // unfold |
5994e71f | 163 | |
531f682d | 164 | //------------------------------------------------------- |
165 | // Configure AliEMCALRecoUtils | |
166 | //------------------------------------------------------- | |
167 | ||
193828fd | 168 | AliEMCALRecoUtils * reco = clusterize->GetRecoUtils(); |
531f682d | 169 | gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/ConfigureEMCALRecoUtils.C"); // $ALICE_ROOT/PWGGA/EMCALTasks/macros |
73d0c410 | 170 | ConfigureEMCALRecoUtils(reco,bMC,exotic,bNonLine,bRecalE,bBad,bRecalT); |
5994e71f | 171 | |
531f682d | 172 | //------------------------------------------------------- |
193828fd | 173 | //Alignment matrices |
531f682d | 174 | //------------------------------------------------------- |
175 | ||
eef481c6 | 176 | clusterize->SetImportGeometryFromFile(kTRUE,"$ALICE_ROOT/OADB/EMCAL/geometry_2011.root"); // change only in case 2010 to geometry_2010.root |
177 | ||
023e6936 | 178 | if(!bMC) |
531f682d | 179 | { |
180 | clusterize->SwitchOnLoadOwnGeometryMatrices(); | |
5994e71f | 181 | } |
182 | ||
531f682d | 183 | //------------------------------------------------------- |
184 | // Trigger options | |
185 | //------------------------------------------------------- | |
186 | ||
38032052 | 187 | if(trigger=="EMC7") |
188 | { | |
531f682d | 189 | printf("Clusterizing task trigger EMC7\n"); |
193828fd | 190 | clusterize->SelectCollisionCandidates(AliVEvent::kEMC7); |
191 | } | |
38032052 | 192 | else if (trigger=="INT7") |
193 | { | |
531f682d | 194 | printf("Clusterizing task trigger INT7\n"); |
193828fd | 195 | clusterize->SelectCollisionCandidates(AliVEvent::kINT7); |
196 | } | |
38032052 | 197 | else if(trigger=="EMC1") |
198 | { | |
531f682d | 199 | printf("Clusterizing task trigger EMC1\n"); |
193828fd | 200 | clusterize->SelectCollisionCandidates(AliVEvent::kEMC1); |
201 | } | |
38032052 | 202 | else if(trigger=="MB") |
203 | { | |
531f682d | 204 | printf("Clusterizing task trigger MB\n"); |
193828fd | 205 | clusterize->SelectCollisionCandidates(AliVEvent::kMB); |
531f682d | 206 | } |
38032052 | 207 | else if(trigger=="PHOS") |
208 | { | |
531f682d | 209 | printf("Clusterizing task trigger PHOS\n"); |
210 | clusterize->SelectCollisionCandidates(AliVEvent::kPHI7); | |
211 | } | |
38032052 | 212 | else if(trigger=="PHOSPb") |
213 | { | |
531f682d | 214 | printf("Clusterizing task trigger PHOSPb\n"); |
215 | clusterize->SelectCollisionCandidates(AliVEvent::kPHOSPb); | |
193828fd | 216 | } |
531f682d | 217 | else if(trigger=="AnyINT") |
218 | { | |
219 | printf("Clusterizing task trigger AnyINT\n"); | |
220 | clusterize->SelectCollisionCandidates(AliVEvent::kAnyINT); | |
221 | } | |
222 | else if(trigger=="INT") | |
223 | { | |
224 | printf("Clusterizing task trigger AnyINT\n"); | |
225 | clusterize->SelectCollisionCandidates(AliVEvent::kAny); | |
226 | } | |
227 | else if(trigger=="EMCEGA") | |
228 | { | |
229 | printf("Clusterizing task trigger EMC Gamma\n"); | |
230 | clusterize->SelectCollisionCandidates(AliVEvent::kEMCEGA); | |
231 | } | |
232 | else if(trigger=="EMCEJE") | |
233 | { | |
234 | printf("Clusterizing task trigger EMC Jet\n"); | |
235 | clusterize->SelectCollisionCandidates(AliVEvent::kEMCEJE); | |
236 | } | |
237 | else if(trigger=="Central") | |
238 | { | |
239 | printf("Clusterizing task trigger Central\n"); | |
240 | clusterize->SelectCollisionCandidates(AliVEvent::kCentral); | |
241 | } | |
242 | else if(trigger=="SemiCentral") | |
243 | { | |
244 | printf("Clusterizing task trigger SemiCentral\n"); | |
245 | clusterize->SelectCollisionCandidates(AliVEvent::kSemiCentral); | |
246 | } | |
247 | ||
38032052 | 248 | // Set clusters branch name, make sure the analysis after this one reads this name |
cb68426a | 249 | |
531f682d | 250 | //------------------------------------------------------- |
251 | // Final settings, pass to manager and set the containers | |
252 | //------------------------------------------------------- | |
193828fd | 253 | |
5994e71f | 254 | mgr->AddTask(clusterize); |
255 | ||
256 | // Create containers for input/output | |
257 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ; | |
5994e71f | 258 | mgr->ConnectInput (clusterize, 0, cinput1 ); |
5994e71f | 259 | |
6a797202 | 260 | if(bFillAOD) |
261 | { | |
262 | printf("AddTaskEMCALClusterize - Fill output AOD\n"); | |
263 | AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer() ; | |
264 | mgr->ConnectOutput (clusterize, 0, coutput1 ); | |
265 | } | |
5994e71f | 266 | return clusterize; |
193828fd | 267 | } |