AliPhysics  068200c (068200c)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AddTaskEMCALClusterize.C
Go to the documentation of this file.
1 
40  TString & arrayName,
41  const Bool_t bFillAOD = kFALSE,
42  const Int_t bMC = kFALSE,
43  const Bool_t exotic = kTRUE,
44  const TString name = "V1Unfold", // V1, V2, NxN, V1Unfold
45  const TString trigger = "",
46  const Int_t tm = 1,
47  const Int_t minEcell = 50,
48  const Int_t minEseed = 100,
49  const Int_t maxDeltaT = 250,
50  const Int_t timeWindow = 1000,
51  const Int_t minEUnf = 15,
52  const Int_t minFrac = 1,
53  const Bool_t bRecalE = kTRUE,
54  const Bool_t bBad = kTRUE,
55  const Bool_t bRecalT = kTRUE,
56  const Bool_t bNonLine = kFALSE,
57  const Int_t minCen = -1,
58  const Int_t maxCen = -1,
59  const Float_t clusterEnergyCutEvent = -1,
60  const Int_t nRowDiff = 1,
61  const Int_t nColDiff = 1,
62  const Bool_t skipOrReject = kFALSE,
63  const Int_t tCardMimic = kFALSE,
64  const Bool_t cellUpd = kTRUE
65  )
66 {
67  // Get the pointer to the existing analysis manager via the static access method.
68  //==============================================================================
69  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
70  if (!mgr)
71  {
72  ::Error("AddTaskEMCALClusterize", "No analysis manager to connect to.");
73  return NULL;
74  }
75 
76  // Check the analysis type using the event handlers connected to the analysis manager.
77  //==============================================================================
78  if (!mgr->GetInputEventHandler())
79  {
80  ::Error("AddTaskEMCALClusterize", "This clusterize requires an input event handler");
81  return NULL;
82  }
83 
84  printf("Passed Settings : mc %d, exo %d, name %s, trigger %s, tm %d\n",bMC,exotic,name.Data(),trigger.Data(),tm);
85  printf(" Ecell %d, Eseed %d, dT %d, wT %d, minUnf %d, minFrac %d \n",minEcell, minEseed,maxDeltaT,timeWindow,minEUnf,minFrac);
86  printf(" recalE %d, bad %d, recalT %d, nonlin %d, minCen %d, maxCen %d, rowDiff %d, colDiff %d, t-card %d, cell update %d \n",
87  bRecalE,bBad,bRecalT,bNonLine,minCen,maxCen,nRowDiff,nColDiff,tCardMimic);
88 
89  // Create name of task and AOD branch depending on different settings
90 
91  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);
92  else arrayName = Form( "%s_Ecell%d_Eseed%d_DT%d_WT%d", name.Data(),minEcell,minEseed,maxDeltaT,timeWindow);
93 
94  if(minCen != -1 && maxCen != -1)
95  arrayName+=Form("_Cen%d_%d",minCen,maxCen);
96 
97  printf("Created Branch Name: %s \n",arrayName.Data());
98 
99 
100  //-------------------------------------------------------
101  // Init the task and do settings
102  //-------------------------------------------------------
103 
104  AliAnalysisTaskEMCALClusterize* clusterize = new AliAnalysisTaskEMCALClusterize(Form("EMCALClusterize%s",arrayName.Data()));
105 
106  clusterize->SetAODBranchName(arrayName);
107 
108  //clusterize->SetOCDBPath("local://$ALICE_ROOT/OCDB");
109 
110  // Centrality range
111  clusterize->SetCentralityBin(minCen, maxCen);
112 
113  // Some general settings to create AOD file in case we want to keep it
114  clusterize->SwitchOffFillAODCaloCells();
115  clusterize->SwitchOffFillAODHeader();
116  clusterize->FillAODFile(bFillAOD); // fill aod.root with clusters?, not really needed for analysis.
117 
118  // Update cells list after cuts
119  if ( cellUpd ) clusterize->SwitchOnUpdateCell();
120 
121  //-------------------------------------------------------
122  // Set clusterization parameters via rec param
123  //-------------------------------------------------------
124 
125  AliEMCALRecParam * params = clusterize->GetRecParam();
126 
127  //
128  // Position and SS weight parameter
129  //
130  params->SetW0(4.5);
131 
132  //
133  // Time cuts
134  // Be careful using time cuts, best thing is to leave them open.
135  //
136  if(maxDeltaT > 1) params->SetTimeCut(maxDeltaT*1.e-9);
137  else { params->SetTimeCut(250*1.e-9); printf("default maxDeltaT = 250 ns\n"); }// Same as in reco
138 
139  if(timeWindow > 1)
140  {
141  params->SetTimeMin(-1*timeWindow*1.e-9);
142  params->SetTimeMax(timeWindow*1.e-9);
143  }
144  else
145  {
146  if(!bMC)
147  {
148  if(bRecalT)
149  {
150  params->SetTimeMin(-250*1.e-9);
151  params->SetTimeMax( 250*1.e-9);
152  printf("default time window for calibrated time -250 ns < T < 250 ns\n");
153  }
154  else
155  {
156  // same as in reco, USE IF NO TIME RECALIBRATION
157  params->SetTimeMin(425*1.e-9);
158  params->SetTimeMax(825*1.e-9);
159  printf("default time window 425 ns < T < 825 ns\n");
160  }
161  }
162  else
163  {
164  params->SetTimeMin(-100000000);
165  params->SetTimeMax( 100000000);
166  printf("open time cut\n");
167  }
168  }
169 
170  //
171  // Energy cuts
172  //
173  params->SetClusteringThreshold(minEseed/1.e3);
174  params->SetMinECut (minEcell/1.e3);
175 
176  //
177  // Clusterizer type
178  //
179  if(name.Contains("V2")) params->SetClusterizerFlag(AliEMCALRecParam::kClusterizerv2);
180  if(name.Contains("V1")) params->SetClusterizerFlag(AliEMCALRecParam::kClusterizerv1);
181  if(name.Contains("NxN"))
182  {
183  params->SetClusterizerFlag(AliEMCALRecParam::kClusterizerNxN);
184  printf("Set NxN cluster size to %dx%d (row diff %d, col diff %d)\n",2*nRowDiff+1,2*nColDiff+1,nRowDiff,nColDiff);
185  params->SetNxM(nRowDiff, nColDiff);
186  }
187 
188  //-------------------------------------------------------
189  // Unfolding, 2 options :
190  //-------------------------------------------------------
191 
192  // 1) Just unfold existing clusters
193  if(name.Contains("JustUnfold"))
194  clusterize->JustUnfold(kTRUE); // if TRUE, do just unfolding, do not recluster cells
195  else
196  clusterize->JustUnfold(kFALSE);
197 
198  // 2) Unfold clusters created in the clusterize (revise settings)
199  if (name.Contains("Unfold"))
200  {
201  clusterize->SwitchOnCellEnergySelection();
202  clusterize->SetCellCuts(minEUnf/1000.,minFrac/10000.);
203  clusterize->SetRejectBelowThreshold(skipOrReject);
204  printf("AliAnalysisTaskEMCALClusterize - Cuts: min E %f, frac %f\n",minEUnf/1000.,minFrac/10000.);
205  //clusterize->SwitchOffCellEnergySelection();
206 
207  if(!name.Contains("Just"))
208  params->SetUnfold(kTRUE);
209  else
210  params->SetUnfold(kFALSE);
211 
212  } // unfold
213 
214  //-------------------------------------------------------
215  // Configure AliEMCALRecoUtils
216  //-------------------------------------------------------
217 
218  AliEMCALRecoUtils * reco = clusterize->GetRecoUtils();
219 
220  gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/EMCAL/macros/ConfigureEMCALRecoUtils.C");
221 
222  ConfigureEMCALRecoUtils(reco,bMC,exotic,bNonLine,bRecalE,bBad,bRecalT);
223 
224  // Do track matching after clusterization
225  if ( tm > 0 )
226  {
227  clusterize->SwitchOnTrackMatching();
228  if ( tm == 2 ) clusterize->GetRecoUtils()->SwitchOnAODHybridTracksMatch();
229  else if ( tm == 1 ) clusterize->GetRecoUtils()->SwitchOnAODTPCOnlyTracksMatch();
230  else clusterize->GetRecoUtils()->SetAODTrackFilterMask(tm);
231  }
232  else clusterize->SwitchOffTrackMatching();
233 
234 
235  //-------------------------------------------------------
236  // Alignment matrices
237  //-------------------------------------------------------
238 
239  //clusterize->SetImportGeometryFromFile(kTRUE,"$ALICE_PHYSICS/OADB/EMCAL/geometry_2011.root"); // done automatically, set here to force
240 
241  clusterize->SwitchOnLoadOwnGeometryMatrices();
242 
243  //-------------------------------------------------------
244  // Clusterize events with some significant signal
245  //-------------------------------------------------------
246 
247  if(clusterEnergyCutEvent > 0)
248  {
249  clusterize->SwitchOnSelectEMCALEvent();
250  clusterize->SetEMCALEnergyCut(clusterEnergyCutEvent);
251  clusterize->SetEMCALNcellsCut(3);
252  }
253  else clusterize->SwitchOffSelectEMCALEvent();
254 
255  //-------------------------------------------------------
256  // Cluster MC labels recalculation
257  //-------------------------------------------------------
258 
259  if(bMC)
260  {
261  //printf("Recalculate MC labels\n");
262  clusterize->SwitchOnUseClusterMCLabelForCell(0) ; // Take the cell MC label as basis (only possible in recent productions, from 2012?)
263  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?)
264 
265  //clusterize->SwitchOnUseClusterMCLabelForCell(1) ; // Assign to each cell the same MC label as the original cluster to which it belonged
266  //clusterize->SwitchOnUseClusterMCLabelForCell(2) ; // Find the original clusters that have the same cells as the new cluster,
267  // assign the labels of the original clusters to the new cluster.
268  // only interesting if output is V1
269 
270  // clusterize->SwitchOnUseMCEdepFracLabelForCell(); // For Run2 MC, switch all the above off
271 
272  }
273 
274  //-------------------------------------------------------
275  // T-Card cell correlation
276  //-------------------------------------------------------
277 
278  clusterize->SwitchOffTCardCorrelation();
279 
280  if(bMC && tCardMimic > 0)
281  {
282  if ( tCardMimic == 1 ) clusterize->SwitchOnTCardCorrelation(kFALSE);
283  else clusterize->SwitchOnTCardCorrelation(kTRUE);
284 
285  clusterize->SetInducedEnergyLossFraction (0.00700, 0.00700, 0.00700, 0.00000);
286  clusterize->SetInducedEnergyLossFractionP1 (0.00060, 0.00060, 0.00060, 0.00000);
287  clusterize->SetInducedEnergyLossFractionWidth(0.00900, 0.00900, 0.00900, 0.00000);
288 
289  clusterize->SetInducedEnergyLossProbabilityPerSM(0.30, 0);
290  clusterize->SetInducedEnergyLossProbabilityPerSM(0.60, 1);
291  clusterize->SetInducedEnergyLossProbabilityPerSM(0.50, 2);
292  clusterize->SetInducedEnergyLossProbabilityPerSM(1.00, 3);
293  clusterize->SetInducedEnergyLossProbabilityPerSM(0.35, 4);
294  clusterize->SetInducedEnergyLossProbabilityPerSM(0.25, 5);
295  clusterize->SetInducedEnergyLossProbabilityPerSM(0.35, 6);
296  clusterize->SetInducedEnergyLossProbabilityPerSM(1.00, 7);
297  clusterize->SetInducedEnergyLossProbabilityPerSM(0.25, 8);
298  clusterize->SetInducedEnergyLossProbabilityPerSM(0.25, 9);
299  }
300 
301  //-------------------------------------------------------
302  // Trigger options
303  //-------------------------------------------------------
304 
305  if(trigger=="EMC7")
306  {
307  printf("Clusterizing task trigger EMC7\n");
308  clusterize->SelectCollisionCandidates(AliVEvent::kEMC7);
309  }
310  else if (trigger=="INT7")
311  {
312  printf("Clusterizing task trigger INT7\n");
313  clusterize->SelectCollisionCandidates(AliVEvent::kINT7);
314  }
315  else if(trigger=="EMC1")
316  {
317  printf("Clusterizing task trigger EMC1\n");
318  clusterize->SelectCollisionCandidates(AliVEvent::kEMC1);
319  }
320  else if(trigger=="MB")
321  {
322  printf("Clusterizing task trigger MB\n");
323  clusterize->SelectCollisionCandidates(AliVEvent::kMB);
324  }
325  else if(trigger=="PHOS")
326  {
327  printf("Clusterizing task trigger PHOS\n");
328  clusterize->SelectCollisionCandidates(AliVEvent::kPHI7);
329  }
330  else if(trigger=="PHOSPb")
331  {
332  printf("Clusterizing task trigger PHOSPb\n");
333  clusterize->SelectCollisionCandidates(AliVEvent::kPHOSPb);
334  }
335  else if(trigger=="AnyINT")
336  {
337  printf("Clusterizing task trigger AnyINT\n");
338  clusterize->SelectCollisionCandidates(AliVEvent::kAnyINT);
339  }
340  else if(trigger=="INT")
341  {
342  printf("Clusterizing task trigger AnyINT\n");
343  clusterize->SelectCollisionCandidates(AliVEvent::kAny);
344  }
345  else if(trigger=="EMCEGA")
346  {
347  printf("Clusterizing task trigger EMC Gamma\n");
348  clusterize->SelectCollisionCandidates(AliVEvent::kEMCEGA);
349  }
350  else if(trigger=="EMCEJE")
351  {
352  printf("Clusterizing task trigger EMC Jet\n");
353  clusterize->SelectCollisionCandidates(AliVEvent::kEMCEJE);
354  }
355  else if(trigger=="Central")
356  {
357  printf("Clusterizing task trigger Central\n");
358  clusterize->SelectCollisionCandidates(AliVEvent::kCentral);
359  }
360  else if(trigger=="SemiCentral")
361  {
362  printf("Clusterizing task trigger SemiCentral\n");
363  clusterize->SelectCollisionCandidates(AliVEvent::kSemiCentral);
364  }
365 
366  // Set clusters branch name, make sure the analysis after this one reads this name
367 
368  //-------------------------------------------------------
369  // Final settings, pass to manager and set the containers
370  //-------------------------------------------------------
371 
372  mgr->AddTask(clusterize);
373 
374  // Create containers for input/output
375  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ;
376  mgr->ConnectInput (clusterize, 0, cinput1 );
377 
378  if(bFillAOD)
379  {
380  printf("AddTaskEMCALClusterize - Fill output AOD\n");
381  AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer() ;
382  mgr->ConnectOutput (clusterize, 0, coutput1 );
383  }
384  return clusterize;
385 }
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
void ConfigureEMCALRecoUtils(AliEMCALRecoUtils *reco, Bool_t bMC=kFALSE, Bool_t bExotic=kTRUE, Bool_t bNonLin=kFALSE, Bool_t bRecalE=kTRUE, Bool_t bBad=kTRUE, Bool_t bRecalT=kTRUE, Int_t debug=-1)
bool Bool_t
Definition: External.C:53
AliAnalysisTaskEMCALClusterize * AddTaskEMCALClusterize(TString &arrayName, const Bool_t bFillAOD=kFALSE, const Int_t bMC=kFALSE, const Bool_t exotic=kTRUE, const TString name="V1Unfold", const TString trigger="", const Int_t tm=1, const Int_t minEcell=50, const Int_t minEseed=100, const Int_t maxDeltaT=250, const Int_t timeWindow=1000, const Int_t minEUnf=15, const Int_t minFrac=1, const Bool_t bRecalE=kTRUE, const Bool_t bBad=kTRUE, const Bool_t bRecalT=kTRUE, const Bool_t bNonLine=kFALSE, const Int_t minCen=-1, const Int_t maxCen=-1, const Float_t clusterEnergyCutEvent=-1, const Int_t nRowDiff=1, const Int_t nColDiff=1, const Bool_t skipOrReject=kFALSE, const Int_t tCardMimic=kFALSE, const Bool_t cellUpd=kTRUE)
Reclusterize EMCal clusters, put them in a new branch for other following analysis.