AliPhysics  master (3d17d9d)
AliEmcalTriggerSimQATask.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2018, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 #include <TClonesArray.h>
17 #include <THashList.h>
18 
19 #include <AliVEventHandler.h>
20 #include <AliAnalysisManager.h>
21 #include <AliClusterContainer.h>
22 #include <AliEMCALTriggerPatchInfo.h>
23 
25 
27 ClassImp(AliEmcalTriggerSimQATask);
29 
34 fTriggerPatchesName("EmcalTriggers"),
35 fTriggerPatches(0),
36 fMinAmplitude(0),
37 fMinClusterEnergy(3.),
38 fPtBinWidth(0.5),
39 fMaxPt(120),
40 fEventTriggerBits(0x0),
41 fHistManager("AliEmcalTriggerSimQATask")
42 {}
43 
49 fTriggerPatchesName("EmcalTriggers"),
51 fMinAmplitude(0),
53 fPtBinWidth(0.5),
54 fMaxPt(120),
56 fHistManager(name)
57 {
59 
60  // Initializing array in CINT-compatible way
61  //EventEMCALTriggerType_t fTriggerTypesValues[kNTriggerTypes] = {kMB, kEL0, kEG1, kEG2, kEJ1, kEJ2};
62  EventEMCALTriggerType_t fTriggerTypesValues[kNTriggerTypes] = {kMB, kEL0, kDL0, kEG1, kDG1, kEG2, kDG2, kEJ1, kDJ1, kEJ2, kDJ2};
63  memcpy (fTriggerTypes,fTriggerTypesValues,sizeof(fTriggerTypes));
64 }
65 
66 
71 
72 }
73 
74 
80 }
81 
87 
88  TString histname;
89  TString title;
90 
91  Int_t nPtBins = TMath::CeilNint(fMaxPt/fPtBinWidth);
92 
93  Double_t fMinEta = -0.7;
94  Double_t fMaxEta = 0.7;
95  Double_t fMinDeltaEta = -1.4;
96  Double_t fMaxDeltaEta = 1.4;
97  Double_t fMinPhi = 0;
98  Double_t fMaxPhi = 2*TMath::Pi();
99  Double_t fMinDeltaPhi = -TMath::Pi();
100  Double_t fMaxDeltaPhi = TMath::Pi();
101  Int_t nEtaBins = 96;
102  Int_t nPhiBins = 208;
103  Int_t nDeltaEtaBins = 192;
104  Int_t nDeltaPhiBins = 416;
105 
106  Double_t fMinCol = 0;
107  Double_t fMaxCol = 48;
108  Double_t fMinRow = 0;
109  Double_t fMaxRow = 104;
110  Int_t nCol = 48;
111  Int_t nRow = 104;
112 
113  Double_t fMaxADCValue = 1024;
114  Int_t nADCBins = 512;
115 
116  Int_t nSmallADCBins = 128;
117  Int_t nSmallEBins = 100;
118 
119  // Hist for counting clusters
120  fHistManager.CreateTH1("NClusters","NClusters;N_{cluster}; counts",300,0,300);
121 
122  // loop over trigger types
123  for (Int_t i = 0; i < kNTriggerTypes; i++) {
124  // Clusters in the EMCal (not including DCal)
125  histname = TString::Format("fHistEMCalClusEnergy_Trig_%s",fTriggerNames[i].Data());
126  title = histname + ";#it{E}_{cluster} (GeV); counts";
127  fHistManager.CreateTH1(histname.Data(),title.Data(),nPtBins,0,fMaxPt);
128  // Clusters in the DCal
129  histname = TString::Format("fHistDCalClusEnergy_Trig_%s",fTriggerNames[i].Data());
130  title = histname + ";#it{E}_{cluster} (GeV); counts";
131  fHistManager.CreateTH1(histname.Data(),title.Data(),nPtBins,0,fMaxPt);
132  }
133 
134  for (Int_t i = 0; i < kNTriggerTypes; i++) {
135  histname = TString::Format("fHistClusEtaPhi_Trig_%s",fTriggerNames[i].Data());
136  title = histname + ";#eta_{cluster};#phi_{cluster};counts";
137  fHistManager.CreateTH2(histname.Data(),title.Data(),nEtaBins,fMinEta,fMaxEta,nPhiBins,fMinPhi,fMaxPhi);
138  }
139 
140  // Patch Energy Spectra
141  for (Int_t i = 1; i < kNTriggerTypes; i++) {
142  histname = TString::Format("fHistPatchEnergy_Trig_%s",fTriggerNames[i].Data());
143  title = histname + ";#it{E}_{patch} (GeV); counts";
144  fHistManager.CreateTH1(histname.Data(),title.Data(),nPtBins,0,fMaxPt);
145  }
146  for (Int_t i = 1; i < kNTriggerTypes; i++) {
147  histname = TString::Format("fHistPatchOnlineADCAmp_Trig_%s",fTriggerNames[i].Data());
148  title = histname + ";#it{E}_{patch} (ADC); counts";
149  fHistManager.CreateTH1(histname.Data(),title.Data(),nADCBins,0,fMaxADCValue);
150  }
151 
152  // Patch Energy Spectra vs Col
153  for (Int_t i = 1; i < kNTriggerTypes; i++) {
154  histname = TString::Format("fHistPatchColEnergy_Trig_%s",fTriggerNames[i].Data());
155  title = histname + ";Col;#it{E}_{patch} (ADC); counts";
156  fHistManager.CreateTH2(histname.Data(),title.Data(),nCol,fMinCol,fMaxCol,nPtBins,0,fMaxPt);
157  }
158  for (Int_t i = 1; i < kNTriggerTypes; i++) {
159  histname = TString::Format("fHistPatchColOnlineADCAmp_Trig_%s",fTriggerNames[i].Data());
160  title = histname + ";Col;#it{E}_{patch} (ADC); counts";
161  fHistManager.CreateTH2(histname.Data(),title.Data(),nCol,fMinCol,fMaxCol,nADCBins,0,fMaxADCValue);
162  }
163 
164  // Patch Energy Spectra vs Row
165  for (Int_t i = 1; i < kNTriggerTypes; i++) {
166  histname = TString::Format("fHistPatchRowEnergy_Trig_%s",fTriggerNames[i].Data());
167  title = histname + ";Row;#it{E}_{patch} (ADC); counts";
168  fHistManager.CreateTH2(histname.Data(),title.Data(),nRow,fMinRow,fMaxRow,nPtBins,0,fMaxPt);
169  }
170  for (Int_t i = 1; i < kNTriggerTypes; i++) {
171  histname = TString::Format("fHistPatchRowOnlineADCAmp_Trig_%s",fTriggerNames[i].Data());
172  title = histname + ";Row;#it{E}_{patch} (ADC); counts";
173  fHistManager.CreateTH2(histname.Data(),title.Data(),nRow,fMinRow,fMaxRow,nADCBins,0,fMaxADCValue);
174  }
175 
176  // Patch Corner Col,Row
177  for (Int_t i = 1; i < kNTriggerTypes; i++) {
178  histname = TString::Format("fHistPatchColRow_Trig_%s",fTriggerNames[i].Data());
179  title = histname + ";Col;Row;counts";
180  fHistManager.CreateTH2(histname.Data(),title.Data(),nCol,fMinCol,fMaxCol,nRow,fMinRow,fMaxRow);
181  }
182 
183  // Patch Geometric Centers
184  for (Int_t i = 1; i < kNTriggerTypes; i++) {
185  histname = TString::Format("fHistPatchEtaPhiGeo_Trig_%s",fTriggerNames[i].Data());
186  title = histname + ";#eta_{patch};#phi_{patch};counts";
187  fHistManager.CreateTH2(histname.Data(),title.Data(),nEtaBins,fMinEta,fMaxEta,nPhiBins,fMinPhi,fMaxPhi);
188  }
189 
190  // Patch Cluster Matching Histograms
191  Int_t nTRU = 0;
192  if (!fGeom) {
193  AliError("Geometry not found. Initializing...");
194  fGeom = AliEMCALGeometry::GetInstance(AliEMCALGeometry::GetDefaultGeometryName());
195  if (!fGeom) {
196  AliError("Geometry instance could not be found. Assuming 52 TRU.");
197  nTRU = 52;
198  } else {
199  nTRU = fGeom->GetNTotalTRU();
200  }
201  } else {
202  nTRU = fGeom->GetNTotalTRU();
203  }
204 
205  // Patch-Cluster Delta Phi vs Cluster Phi
206  for (Int_t i = 1; i < kNTriggerTypes; i++) {
207  histname = TString::Format("fHistClusPhiClusPatchDPhi_Trig_%s",fTriggerNames[i].Data());
208  title = histname + ";#phi_{cluster};#Delta#phi_{cluster-patch};counts";
209  fHistManager.CreateTH2(histname.Data(),title.Data(),nPhiBins,fMinPhi,fMaxPhi,nDeltaPhiBins,fMinDeltaPhi,fMaxDeltaPhi);
210  }
211  // Patch-Cluster Delta Phi vs Cluster Eta
212  for (Int_t i = 1; i < kNTriggerTypes; i++) {
213  histname = TString::Format("fHistClusEtaClusPatchDPhi_Trig_%s",fTriggerNames[i].Data());
214  title = histname + ";#eta_{cluster};#Delta#phi_{cluster-patch};counts";
215  fHistManager.CreateTH2(histname.Data(),title.Data(),nEtaBins,fMinEta,fMaxEta,nDeltaPhiBins,fMinDeltaPhi,fMaxDeltaPhi);
216  }
217  // Patch-Cluster Delta Eta vs Cluster Phi
218  for (Int_t i = 1; i < kNTriggerTypes; i++) {
219  histname = TString::Format("fHistClusPhiClusPatchDEta_Trig_%s",fTriggerNames[i].Data());
220  title = histname + ";#phi_{cluster};#Delta#eta_{cluster-patch};counts";
221  fHistManager.CreateTH2(histname.Data(),title.Data(),nPhiBins,fMinPhi,fMaxPhi,nDeltaEtaBins,fMinDeltaEta,fMaxDeltaEta);
222  }
223  // Patch-Cluster Delta Eta vs Cluster Eta
224  for (Int_t i = 1; i < kNTriggerTypes; i++) {
225  histname = TString::Format("fHistClusEtaClusPatchDEta_Trig_%s",fTriggerNames[i].Data());
226  title = histname + ";#eta_{cluster};#Delta#eta_{cluster-patch};counts";
227  fHistManager.CreateTH2(histname.Data(),title.Data(),nEtaBins,fMinEta,fMaxEta,nDeltaEtaBins,fMinDeltaEta,fMaxDeltaEta);
228  }
229 
230  // Patch-Cluster Delta Eta, per TRU
231  for (Int_t i = 1; i < kNTriggerTypes; i++) {
232  histname = TString::Format("fHistClusPatchDEtaTRU_Trig_%s",fTriggerNames[i].Data());
233  title = histname + ";#Delta#eta_{cluster-patch};TRU;counts";
234  fHistManager.CreateTH2(histname.Data(),title.Data(),nDeltaEtaBins,fMinDeltaEta,fMaxDeltaEta,nTRU,0,nTRU);
235  }
236  // Patch-Cluster Delta Phi, per TRU
237  for (Int_t i = 1; i < kNTriggerTypes; i++) {
238  histname = TString::Format("fHistClusPatchDPhiTRU_Trig_%s",fTriggerNames[i].Data());
239  title = histname + ";#Delta#phi_{cluster-patch};TRU;counts";
240  fHistManager.CreateTH2(histname.Data(),title.Data(),nDeltaPhiBins,fMinDeltaPhi,fMaxDeltaPhi,nTRU,0,nTRU);
241  }
242 
243  // Patch-Cluster Energy, per TRU
244  for (Int_t i = 1; i < kNTriggerTypes; i++) {
245  histname = TString::Format("fHistClusEnergyPatchAmpTRU_Trig_%s",fTriggerNames[i].Data());
246  title = histname + ";E_{clus} (GeV);E_{patch} (ADC);TRU;counts";
247  fHistManager.CreateTH3(histname.Data(),title.Data(),nSmallEBins,0,fMaxPt,nSmallADCBins,0,fMaxADCValue,nTRU,0,nTRU);
248  }
249 
250 
252 }
253 
259  if (!fCaloClusters)
260  {
261  fCaloClusters = (TClonesArray*)GetClusterContainer(0);
262  }
263 
264  return kTRUE;
265 }
266 
272  // Loop over patches, identify which trigger conditions are met
273  DoPatchLoop();
274 
275  // Loop over clusters
276  DoClusterLoop();
277  return kTRUE;
278 }
279 
285  TString ClusterContName = "caloClusters";
286 
287  // Get the pointer to the existing analysis manager via the static access method
288  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
289  if (!mgr) {
290  ::Error("AliEmcalTriggerSimQATask", "No analysis manager to connect to.");
291  return 0;
292  }
293 
294  // Check the analysis type using the event handlers connected to the analysis manager
295  AliVEventHandler *evhand = mgr->GetInputEventHandler();
296  if (!evhand) {
297  ::Error("AliEmcalTriggerSimQATask", "This task requires an input event handler");
298  return 0;
299  }
300 
301  // Init the task and set settings
302  TString taskName("AliEmcalTriggerSimQATask");
303  AliEmcalTriggerSimQATask * eTask = new AliEmcalTriggerSimQATask(taskName);
304  eTask->AddClusterContainer(ClusterContName);
305 
306  mgr->AddTask(eTask);
307  // Create containers for input/output
308  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
309  mgr->ConnectInput(eTask, 0, cinput1);
310 
311  TString commonoutput(Form("%s", AliAnalysisManager::GetCommonFileName()));
312 
313  TString contOutName(Form("%s_histos", taskName.Data()));
314  mgr->ConnectOutput(eTask, 1, mgr->CreateContainer(contOutName, TList::Class(), AliAnalysisManager::kOutputContainer, commonoutput.Data()));
315 
316  return eTask;
317 }
318 
320 
321  Int_t fPatchTriggerBits = 0x0;
322 
323  Bool_t fIsDCal = patch->IsDCalPHOS();
324  // In Trigger Types array, DCal Triggers are 1 more than the EMCal Trigger type
325  Int_t fTriggerInt = 0;
326 
327  if (patch->IsLevel0()) {
328  fTriggerInt = kEL0 + fIsDCal;
329  fPatchTriggerBits |= 0x1 << fTriggerInt;
330  }
331  if (patch->IsGammaHigh()) {
332  fTriggerInt = kEG1 + fIsDCal;
333  fPatchTriggerBits |= 0x1 << fTriggerInt;
334  }
335  if (patch->IsGammaLow()) {
336  fTriggerInt = kEG2 + fIsDCal;
337  fPatchTriggerBits |= 0x1 << fTriggerInt;
338  }
339  if (patch->IsJetHigh()) {
340  fTriggerInt = kEJ1 + fIsDCal;
341  fPatchTriggerBits |= 0x1 << fTriggerInt;
342  }
343  if (patch->IsJetLow()) {
344  fTriggerInt = kEJ2 + fIsDCal;
345  fPatchTriggerBits |= 0x1 << fTriggerInt;
346  }
347  return fPatchTriggerBits;
348 }
349 
351  fEventTriggerBits = 0x0; // Reset
352  fTriggerPatches = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fTriggerPatchesName));
353 
354  if (!fTriggerPatches) return;
355 
356  Int_t nPatches = fTriggerPatches->GetEntries();
357 
358  for (Int_t i = 0; i < nPatches; i++) {
359  AliEMCALTriggerPatchInfo* patch = static_cast<AliEMCALTriggerPatchInfo*>(fTriggerPatches->At(i));
360  if (!patch) continue;
361  if (patch->GetADCAmp() < fMinAmplitude) continue;
362  Bool_t fIsDCal = patch->IsDCalPHOS();
363  // In Trigger Types array, DCal Triggers are 1 more than the EMCal Trigger type
364  Int_t fTriggerInt = 0;
365  if (patch->IsLevel0()) {
366  fTriggerInt = kEL0 + fIsDCal;
367  fEventTriggerBits |= 0x1 << fTriggerInt;
368  FillPatchHistograms(patch,fTriggerInt);
369  }
370  if (patch->IsGammaHigh()) {
371  fTriggerInt = kEG1 + fIsDCal;
372  fEventTriggerBits |= 0x1 << fTriggerInt;
373  FillPatchHistograms(patch,fTriggerInt);
374  }
375  if (patch->IsGammaLow()) {
376  fTriggerInt = kEG2 + fIsDCal;
377  fEventTriggerBits |= 0x1 << fTriggerInt;
378  FillPatchHistograms(patch,fTriggerInt);
379  }
380  if (patch->IsJetHigh()) {
381  fTriggerInt = kEJ1 + fIsDCal;
382  fEventTriggerBits |= 0x1 << fTriggerInt;
383  FillPatchHistograms(patch,fTriggerInt);
384  }
385  if (patch->IsJetLow()) {
386  fTriggerInt = kEJ2 + fIsDCal;
387  fEventTriggerBits |= 0x1 << fTriggerInt;
388  FillPatchHistograms(patch,fTriggerInt);
389  }
390  }
391 }
392 
393 void AliEmcalTriggerSimQATask::FillPatchHistograms(AliEMCALTriggerPatchInfo * patch, Int_t i) {
394  fHistManager.FillTH2(Form("fHistPatchColEnergy_Trig_%s",fTriggerNames[i+1].Data()),patch->GetColStart(),patch->GetPatchE());
395  fHistManager.FillTH2(Form("fHistPatchColOnlineADCAmp_Trig_%s",fTriggerNames[i+1].Data()),patch->GetColStart(),patch->GetADCAmp());
396  fHistManager.FillTH2(Form("fHistPatchRowEnergy_Trig_%s",fTriggerNames[i+1].Data()),patch->GetRowStart(),patch->GetPatchE());
397  fHistManager.FillTH2(Form("fHistPatchRowOnlineADCAmp_Trig_%s",fTriggerNames[i+1].Data()),patch->GetRowStart(),patch->GetADCAmp());
398  fHistManager.FillTH1(Form("fHistPatchEnergy_Trig_%s",fTriggerNames[i+1].Data()),patch->GetPatchE());
399  fHistManager.FillTH1(Form("fHistPatchOnlineADCAmp_Trig_%s",fTriggerNames[i+1].Data()),patch->GetADCAmp());
400  fHistManager.FillTH2(Form("fHistPatchColRow_Trig_%s",fTriggerNames[i+1].Data()),patch->GetColStart(),patch->GetRowStart());
401  fHistManager.FillTH2(Form("fHistPatchEtaPhiGeo_Trig_%s",fTriggerNames[i+1].Data()),patch->GetEtaGeo(),patch->GetPhiGeo());
402 }
403 
404 
406  TString histname;
407 
409  if (!clusters) {
410  AliError("Cluster Container Not Found");
411  return ;
412  }
413  Int_t nClusters = clusters->GetNClusters();
414  fHistManager.FillTH1("NClusters",nClusters);
415 
416  // Cycle over clusters
417  for (Int_t i = 0; i < nClusters; i++) {
418  AliVCluster * cluster = (AliVCluster *) clusters->GetAcceptCluster(i);
419  if (!cluster) continue;
420  MatchClusterToPatches(cluster);
421  for (Int_t j = 0; j < kNTriggerTypes; j++) {
422  // Check if this event had this trigger
423  if (fTriggerTypes[j] < 0) {
424  // This is Minimum Bias, so accept all events
425  }
426  else if (!(fEventTriggerBits & (0x1 << fTriggerTypes[j]))) {
427  continue;
428  }
429 
430  // Get Cluster vector
431  TLorentzVector vCluster;
432  clusters->GetMomentum(vCluster,cluster);
433  Double_t fPhi = vCluster.Phi();
434  if (fPhi < 0) fPhi+=2*TMath::Pi();
435 
436  // Split Cluster spectra into EMCal, DCal
437  Bool_t isDCal = (fPhi > 4.); // Lazy check
438  if (isDCal) {
439  histname = TString::Format("fHistDCalClusEnergy_Trig_%s",fTriggerNames[j].Data());
440  } else {
441  histname = TString::Format("fHistEMCalClusEnergy_Trig_%s",fTriggerNames[j].Data());
442  }
443  fHistManager.FillTH1(histname,cluster->E());
444 // histname = TString::Format("fHistClusEnergy_Trig_%s",fTriggerNames[j].Data());
445 // fHistManager.FillTH1(histname,cluster->E());
446  histname = TString::Format("fHistClusEtaPhi_Trig_%s",fTriggerNames[j].Data());
447  fHistManager.FillTH1(histname,vCluster.Eta(),fPhi);
448  }
449  }
450 }
451 
453  if (!fTriggerPatches) return;
454  if (!fGeom) return; // Can't run this without geometry
456  if (!clusters) {
457  AliError("Cluster Container Not Found");
458  return ;
459  }
460 
461  Int_t nPatches = fTriggerPatches->GetEntries();
462  for (Int_t i = 0; i < nPatches; i++) {
463  AliEMCALTriggerPatchInfo* patch = static_cast<AliEMCALTriggerPatchInfo*>(fTriggerPatches->At(i));
464  if (!patch) continue;
465  if (patch->GetADCAmp() < fMinAmplitude) continue;
466  if (cluster->E() < fMinClusterEnergy) continue;
467 
468  TLorentzVector vCluster; // Cluster Vector
469  clusters->GetMomentum(vCluster,cluster);
470 
471  // Cluster, Patch centers
472  Float_t ClusterPhi = vCluster.Phi();
473  Float_t ClusterEta = vCluster.Eta();
474  Float_t PatchPhi = patch->GetPhiGeo();
475  Float_t PatchEta = patch->GetEtaGeo();
476 
477  Float_t DeltaPhi = fmod(ClusterPhi - PatchPhi,2*TMath::Pi());
478  if (DeltaPhi >= TMath::Pi()) DeltaPhi -= 2*TMath::Pi();
479  Float_t DeltaEta = ClusterEta - PatchEta;
480 
481  // Getting TRU info based on patch corner
482  Int_t PatchRow = patch->GetRowStart();
483  Int_t PatchCol = patch->GetColStart();
484 
485  Int_t fAbsId = -1;
486  if (!fGeom->GetAbsFastORIndexFromPositionInEMCAL(PatchCol,PatchRow, fAbsId)) {
487  AliError("Could not find FastOR index from position");
488  }
489  Int_t iTRU = -1;
490  Int_t iADC = -1;
491  if (!fGeom->GetTRUFromAbsFastORIndex(fAbsId, iTRU, iADC)) {
492  AliError(Form("Mapping mismatch: could not find TRU from FastOR Id %d",fAbsId));
493  }
494 
495  Int_t iTriggerClass = GeneratePatchTriggerBits(patch);
496 
497  if (iTriggerClass != 0) {
498  for (Int_t i = 1; i < kNTriggerTypes; i++) {
499  if (!(iTriggerClass & (0x1 << fTriggerTypes[i]))) continue;
500 
501  // Fill These histograms for all pairs:
502  TString histName = TString::Format("fHistClusPatchDEtaTRU_Trig_%s",fTriggerNames[i].Data());
503  fHistManager.FillTH2(histName,DeltaEta,iTRU);
504 
505  histName = TString::Format("fHistClusPatchDPhiTRU_Trig_%s",fTriggerNames[i].Data());
506  fHistManager.FillTH2(histName,DeltaPhi,iTRU);
507 
508  histName = TString::Format("fHistClusPhiClusPatchDPhi_Trig_%s",fTriggerNames[i].Data());
509  fHistManager.FillTH2(histName,ClusterPhi,DeltaPhi);
510  histName = TString::Format("fHistClusEtaClusPatchDPhi_Trig_%s",fTriggerNames[i].Data());
511  fHistManager.FillTH2(histName,ClusterEta,DeltaPhi);
512  histName = TString::Format("fHistClusPhiClusPatchDEta_Trig_%s",fTriggerNames[i].Data());
513  fHistManager.FillTH2(histName,ClusterPhi,DeltaEta);
514  histName = TString::Format("fHistClusEtaClusPatchDEta_Trig_%s",fTriggerNames[i].Data());
515  fHistManager.FillTH2(histName,ClusterEta,DeltaEta);
516  }
517  }
518 
519  // Match Method 1
520  // Check Delta R between patch cluster
521 
522  // Match Method 2
523  // Check if Cluster Center is in Patch
524  Float_t PatchPhiMin = patch->GetPhiMin();
525  Float_t PatchPhiMax = patch->GetPhiMax();
526  Float_t PatchEtaMin = patch->GetEtaMin();
527  Float_t PatchEtaMax = patch->GetEtaMax();
528 
529  if ((PatchPhiMin <= ClusterPhi) && (ClusterPhi <= PatchPhiMax)) {
530  if ((PatchEtaMin <= ClusterEta) && (ClusterEta <= PatchEtaMax)) {
531  // Patch Cluster Matched
532  if (iTriggerClass != 0) {
533  for (Int_t i = 1; i < kNTriggerTypes; i++) {
534  if (!(iTriggerClass & (0x1 << fTriggerTypes[i]))) continue;
535  TString sHistName = TString::Format("fHistClusEnergyPatchAmpTRU_Trig_%s",fTriggerNames[i].Data());
536  fHistManager.FillTH3(sHistName,cluster->E(),patch->GetADCAmp(),iTRU);
537  }
538  }
539  }
540  }
541  }
542 }
543 
544 
double Double_t
Definition: External.C:58
static Double_t DeltaPhi(Double_t phia, Double_t phib, Double_t rMin=-TMath::Pi()/2, Double_t rMax=3 *TMath::Pi()/2)
const char * title
Definition: MakeQAPdf.C:27
Base task in the EMCAL framework.
EventEMCALTriggerType_t fTriggerTypes[kNTriggerTypes]
Trigger type array.
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
Fill a 2D histogram within the container.
void MatchClusterToPatches(AliVCluster *cluster)
void FillTH3(const char *hname, double x, double y, double z, double weight=1., Option_t *opt="")
Fill a 3D histogram within the container.
Float_t fMaxPt
Histogram pt limit.
AliClusterContainer * AddClusterContainer(const char *n)
Create new cluster container and attach it to the task.
Float_t fPtBinWidth
Histogram pt bin width.
TClonesArray * fCaloClusters
!clusters
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
Create a new TH2 within the container.
int Int_t
Definition: External.C:63
void FillPatchHistograms(AliEMCALTriggerPatchInfo *patch, Int_t i)
THashList * GetListOfHistograms() const
Get the list of histograms.
Definition: THistManager.h:671
float Float_t
Definition: External.C:68
AliEMCALGeometry * fGeom
!emcal geometry
Int_t fMinAmplitude
Minimum trigger patch amplitude.
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Get cluster container attached to this task.
Int_t fEventTriggerBits
! Variable storing trigger bits for entire event, set by DoPatchLoop()
AliVCluster * GetAcceptCluster(Int_t i) const
Int_t GetNClusters() const
Int_t GeneratePatchTriggerBits(AliEMCALTriggerPatchInfo *patch)
const TString fTriggerNames[kNTriggerTypes]
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
TString fTriggerPatchesName
name of input trigger array
static AliEmcalTriggerSimQATask * AddTaskEmcalTriggerSimQA()
THistManager fHistManager
Histogram Manager.
AliEmcalList * fOutput
!output list
void SetMakeGeneralHistograms(Bool_t g)
Enable general histograms.
Bool_t GetMomentum(TLorentzVector &mom, const AliVCluster *vc, Double_t mass) const
virtual void ExecOnce()
Perform steps needed to initialize the analysis.
void UserCreateOutputObjects()
Main initialization function on the worker.
EMCAL trigger simulation QA Task Produces QA histograms for the simulated EMCAL trigger in MC...
bool Bool_t
Definition: External.C:53
Container structure for EMCAL clusters.
Float_t fMinClusterEnergy
Minimum cluster energy.
TH3 * CreateTH3(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, int nbinsz, double zmin, double zmax, Option_t *opt="")
Create a new TH2 within the container.
TClonesArray * fTriggerPatches
! trigger array in