3 AliAnalysisTaskEMCALClusterize* AddTaskEMCALClusterize(
5 const Bool_t bFillAOD = kFALSE,
6 const Int_t bMC = kFALSE,
7 const Bool_t exotic = kTRUE,
8 const TString name = "V1Unfold", // V1, V2, NxN, 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 Float_t clusterEnergyCutEvent = -1,
24 const Int_t nRowDiff = 1,
25 const Int_t nColDiff = 1,
26 const Bool_t skipOrReject = kFALSE
29 // Get the pointer to the existing analysis manager via the static access method.
30 //==============================================================================
31 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
34 ::Error("AddTaskEMCALClusterize", "No analysis manager to connect to.");
38 // Check the analysis type using the event handlers connected to the analysis manager.
39 //==============================================================================
40 if (!mgr->GetInputEventHandler())
42 ::Error("AddTaskEMCALClusterize", "This clusterize requires an input event handler");
46 printf("Passed Settings : mc %d, exo %d, name %s, trigger %s, tm %d\n",bMC,exotic,name.Data(),trigger.Data(),tm);
47 printf(" Ecell %d, Eseed %d, dT %d, wT %d, minUnf %d, minFrac %d \n",minEcell, minEseed,maxDeltaT,timeWindow,minEUnf,minFrac);
48 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);
50 // Create name of task and AOD branch depending on different settings
52 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);
53 else arrayName = Form( "%s_Ecell%d_Eseed%d_DT%d_WT%d", name.Data(),minEcell,minEseed,maxDeltaT,timeWindow);
55 if(minCen != -1 && maxCen != -1)
56 arrayName+=Form("_Cen%d_%d",minCen,maxCen);
58 printf("Created Branch Name: %s \n",arrayName.Data());
61 //-------------------------------------------------------
62 // Init the task and do settings
63 //-------------------------------------------------------
65 AliAnalysisTaskEMCALClusterize* clusterize = new AliAnalysisTaskEMCALClusterize(Form("EMCALClusterize%s",arrayName.Data()));
67 clusterize->SetAODBranchName(arrayName);
69 //clusterize->SetOCDBPath("local://$ALICE_ROOT/OCDB");
72 clusterize->SetCentralityBin(minCen, maxCen);
74 // Some general settings to create AOD file in case we want to keep it
75 clusterize->SwitchOffFillAODCaloCells();
76 clusterize->SwitchOffFillAODHeader();
77 clusterize->FillAODFile(bFillAOD); // fill aod.root with clusters?, not really needed for analysis.
79 // Do track matching after clusterization
80 if(tm) clusterize->SwitchOnTrackMatching();
81 else clusterize->SwitchOffTrackMatching();
83 //-------------------------------------------------------
84 // Set clusterization parameters via rec param
85 //-------------------------------------------------------
87 AliEMCALRecParam * params = clusterize->GetRecParam();
89 // Position and SS weight parameter
94 if(maxDeltaT > 1) params->SetTimeCut(maxDeltaT*1.e-9);
95 else { params->SetTimeCut(250*1.e-9); printf("default maxDeltaT = 250 ns\n"); }// Same as in reco
99 params->SetTimeMin(-1*timeWindow*1.e-9);
100 params->SetTimeMax(timeWindow*1.e-9);
108 params->SetTimeMin(-250*1.e-9);
109 params->SetTimeMax( 250*1.e-9);
110 printf("default time window for calibrated time -250 ns < T < 250 ns\n");
114 // same as in reco, USE IF NO TIME RECALIBRATION
115 params->SetTimeMin(425*1.e-9);
116 params->SetTimeMax(825*1.e-9);
117 printf("default time window 425 ns < T < 825 ns\n");
122 params->SetTimeMin(-100000000);
123 params->SetTimeMax( 100000000);
124 printf("open time cut\n");
129 params->SetClusteringThreshold(minEseed/1.e3);
130 params->SetMinECut (minEcell/1.e3);
133 if(name.Contains("V2")) params->SetClusterizerFlag(AliEMCALRecParam::kClusterizerv2);
134 if(name.Contains("V1")) params->SetClusterizerFlag(AliEMCALRecParam::kClusterizerv1);
135 if(name.Contains("NxN"))
137 params->SetClusterizerFlag(AliEMCALRecParam::kClusterizerNxN);
138 printf("Set NxN cluster size to %dx%d (row diff %d, col diff %d)\n",2*nRowDiff+1,2*nColDiff+1,nRowDiff,nColDiff);
139 params->SetNxM(nRowDiff, nColDiff);
142 //-------------------------------------------------------
143 // Unfolding, 2 options :
144 //-------------------------------------------------------
146 // 1) Just unfold existing clusters
147 if(name.Contains("JustUnfold"))
148 clusterize->JustUnfold(kTRUE); // if TRUE, do just unfolding, do not recluster cells
150 clusterize->JustUnfold(kFALSE);
152 // 2) Unfold clusters created in the clusterize (revise settings)
153 if (name.Contains("Unfold"))
155 clusterize->SwitchOnCellEnergySelection();
156 clusterize->SetCellCuts(minEUnf/1000.,minFrac/10000.);
157 clusterize->SetRejectBelowThreshold(skipOrReject);
158 printf("AliAnalysisTaskEMCALClusterize - Cuts: min E %f, frac %f\n",minEUnf/1000.,minFrac/10000.);
159 //clusterize->SwitchOffCellEnergySelection();
161 if(!name.Contains("Just"))
162 params->SetUnfold(kTRUE);
164 params->SetUnfold(kFALSE);
168 //-------------------------------------------------------
169 // Configure AliEMCALRecoUtils
170 //-------------------------------------------------------
172 AliEMCALRecoUtils * reco = clusterize->GetRecoUtils();
173 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/ConfigureEMCALRecoUtils.C"); // $ALICE_ROOT/PWGGA/EMCALTasks/macros
174 ConfigureEMCALRecoUtils(reco,bMC,exotic,bNonLine,bRecalE,bBad,bRecalT);
176 //-------------------------------------------------------
177 // Alignment matrices
178 //-------------------------------------------------------
180 //clusterize->SetImportGeometryFromFile(kTRUE,"$ALICE_ROOT/OADB/EMCAL/geometry_2011.root"); // done automatically, set here to force
182 clusterize->SwitchOnLoadOwnGeometryMatrices();
184 //-------------------------------------------------------
185 // Clusterize events with some significant signal
186 //-------------------------------------------------------
188 if(clusterEnergyCutEvent > 0)
190 clusterize->SwitchOnSelectEMCALEvent();
191 clusterize->SetEMCALEnergyCut(clusterEnergyCutEvent);
192 clusterize->SetEMCALNcellsCut(3);
194 else clusterize->SwitchOffSelectEMCALEvent();
196 //-------------------------------------------------------
197 // Cluster MC labels recalculation
198 //-------------------------------------------------------
202 printf("Recalculate MC labels\n");
203 clusterize->SwitchOnUseClusterMCLabelForCell(0) ; // Take the cell MC label as basis (only possible in recent productions)
204 clusterize->SwitchOnRemapMCLabelForAODs() ; // Only in case 0, and for productions where the re-mapping of cell label in AODs was not done (productions before March 2013?)
206 //clusterize->SwitchOnUseClusterMCLabelForCell(1) ; // Assign to each cell the same MC label as the original cluster to which it belonged
207 //clusterize->SwitchOnUseClusterMCLabelForCell(2) ; // Find the original clusters that have the same cells as the new cluster,
208 // assign the labels of the original clusters to the new cluster.
209 // only interesting if output is V1
213 //-------------------------------------------------------
215 //-------------------------------------------------------
219 printf("Clusterizing task trigger EMC7\n");
220 clusterize->SelectCollisionCandidates(AliVEvent::kEMC7);
222 else if (trigger=="INT7")
224 printf("Clusterizing task trigger INT7\n");
225 clusterize->SelectCollisionCandidates(AliVEvent::kINT7);
227 else if(trigger=="EMC1")
229 printf("Clusterizing task trigger EMC1\n");
230 clusterize->SelectCollisionCandidates(AliVEvent::kEMC1);
232 else if(trigger=="MB")
234 printf("Clusterizing task trigger MB\n");
235 clusterize->SelectCollisionCandidates(AliVEvent::kMB);
237 else if(trigger=="PHOS")
239 printf("Clusterizing task trigger PHOS\n");
240 clusterize->SelectCollisionCandidates(AliVEvent::kPHI7);
242 else if(trigger=="PHOSPb")
244 printf("Clusterizing task trigger PHOSPb\n");
245 clusterize->SelectCollisionCandidates(AliVEvent::kPHOSPb);
247 else if(trigger=="AnyINT")
249 printf("Clusterizing task trigger AnyINT\n");
250 clusterize->SelectCollisionCandidates(AliVEvent::kAnyINT);
252 else if(trigger=="INT")
254 printf("Clusterizing task trigger AnyINT\n");
255 clusterize->SelectCollisionCandidates(AliVEvent::kAny);
257 else if(trigger=="EMCEGA")
259 printf("Clusterizing task trigger EMC Gamma\n");
260 clusterize->SelectCollisionCandidates(AliVEvent::kEMCEGA);
262 else if(trigger=="EMCEJE")
264 printf("Clusterizing task trigger EMC Jet\n");
265 clusterize->SelectCollisionCandidates(AliVEvent::kEMCEJE);
267 else if(trigger=="Central")
269 printf("Clusterizing task trigger Central\n");
270 clusterize->SelectCollisionCandidates(AliVEvent::kCentral);
272 else if(trigger=="SemiCentral")
274 printf("Clusterizing task trigger SemiCentral\n");
275 clusterize->SelectCollisionCandidates(AliVEvent::kSemiCentral);
278 // Set clusters branch name, make sure the analysis after this one reads this name
280 //-------------------------------------------------------
281 // Final settings, pass to manager and set the containers
282 //-------------------------------------------------------
284 mgr->AddTask(clusterize);
286 // Create containers for input/output
287 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ;
288 mgr->ConnectInput (clusterize, 0, cinput1 );
292 printf("AddTaskEMCALClusterize - Fill output AOD\n");
293 AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer() ;
294 mgr->ConnectOutput (clusterize, 0, coutput1 );