AliPhysics  eff0747 (eff0747)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
AliEmcalTriggerQATaskPP.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2016, 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 #include <TClonesArray.h>
16 #include <THashList.h>
17 #include <THnSparse.h>
18 
19 #include "AliEMCALTriggerPatchInfo.h"
20 #include "AliEmcalTriggerQAPP.h"
21 #include "AliEMCALTriggerFastOR.h"
22 #include "AliEMCALTriggerConstants.h"
23 
25 
26 using namespace EMCALTrigger;
27 
31 
37  fTriggerPatchesName("EmcalTriggers"),
38  fEMCALTriggerQA(0),
39  fADCperBin(20),
40  fMinAmplitude(10),
41  fDCalPlots(kTRUE),
42  fTriggerPatches(0)
43 {
44 }
45 
51  AliAnalysisTaskEmcal(name,kTRUE),
52  fTriggerPatchesName("EmcalTriggers"),
53  fEMCALTriggerQA(0),
54  fADCperBin(20),
55  fMinAmplitude(10),
56  fDCalPlots(kTRUE),
57  fTriggerPatches(0)
58 {
59  // Constructor.
61 
63  SetNCentBins(1);
64 
65  fEMCALTriggerQA = new TObjArray((fNcentBins+1)*2);
66  fEMCALTriggerQA->SetOwner(kTRUE);
67  fEMCALTriggerQA->AddAt(new AliEmcalTriggerQAPP(name), 0);
68 }
69 
74 {
75  delete fEMCALTriggerQA;
76 }
77 
82 {
84 
85  if (!fInitialized) return;
86 
87  fTriggerPatches = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fTriggerPatchesName));
88 
89  if (fTriggerPatches) {
90  TString objname(fTriggerPatches->GetClass()->GetName());
91  TClass cls(objname);
92  if (!cls.InheritsFrom("AliEMCALTriggerPatchInfo")) {
93  AliError(Form("%s: Objects of type %s in %s are not inherited from AliEMCALTriggerPatchInfo!",
94  GetName(), cls.GetName(), fTriggerPatchesName.Data()));
95  fTriggerPatches = 0;
96  }
97  }
98 
99  if (!fTriggerPatches) {
100  fInitialized = kFALSE;
101  AliError(Form("%s: Unable to get trigger patch container with name %s. Aborting", GetName(), fTriggerPatchesName.Data()));
102  return;
103  }
104 
105  for (Int_t i = 0; i < fNcentBins; i++) {
106  GetTriggerQA(i)->ExecOnce();
107  }
108 }
109 
114 {
116 
117  if (fOutput) {
118  for (Int_t i = 0; i < fNcentBins; i++) {
120  GetTriggerQA(i)->SetDebugLevel(DebugLevel());
121  GetTriggerQA(i)->Init();
122  fOutput->Add(GetTriggerQA(i)->GetListOfHistograms());
123  }
124 
125  PostData(1, fOutput);
126  }
127 }
128 
134 {
135  return kTRUE;
136 }
137 
138 
144 {
145  if (fTriggerPatches) {
146  Int_t nPatches = fTriggerPatches->GetEntriesFast();
147 
148  AliDebug(2, Form("nPatches = %d", nPatches));
149 
150  for (Int_t i = 0; i < nPatches; i++) {
151  AliDebug(2, Form("Processing patch %d", i));
152 
153  AliEMCALTriggerPatchInfo* patch = static_cast<AliEMCALTriggerPatchInfo*>(fTriggerPatches->At(i));
154  if (!patch) continue;
155  if (patch->GetADCAmp() < fMinAmplitude) continue;
156 
158  }
159  }
160 
161  if (fCaloTriggers) {
162  AliEMCALTriggerFastOR fastor;
163  fCaloTriggers->Reset();
164  Int_t globCol = -1, globRow = -1;
165  Float_t L0amp = -1;
166  Int_t L1amp = -1;
167  while (fCaloTriggers->Next()) {
168  // get position in global 2x2 tower coordinates
169  // A0 left bottom (0,0)
170  fCaloTriggers->GetPosition(globCol, globRow);
171  // for some strange reason some ADC amps are initialized in reconstruction
172  // as -1, neglect those
173  fCaloTriggers->GetL1TimeSum(L1amp);
174  if (L1amp < 0) L1amp = 0;
175  fCaloTriggers->GetAmplitude(L0amp);
176  L0amp *= 4;
177  if (L0amp < 0) L0amp = 0;
178 
179  Int_t time = -1;
180  Int_t nl0times(0);
181  fCaloTriggers->GetNL0Times(nl0times);
182  if(nl0times) {
183  TArrayI l0times(nl0times);
184  fCaloTriggers->GetL0Times(l0times.GetArray());
185  for(int itime = 0; itime < nl0times; itime++){
186  time = l0times[itime];
187  break;
188  }
189  }
190 
191  fastor.Initialize(L0amp, L1amp, globRow, globCol, time, fGeom);
192 
194  }
195  }
196 
197  if (fCaloCells) {
198  const Int_t ncells = fCaloCells->GetNumberOfCells();
200  for (Int_t pos = 0; pos < ncells; pos++) {
201  Double_t amp = fCaloCells->GetAmplitude(pos);
202  Int_t absId = fCaloCells->GetCellNumber(pos);
203  cellInfo.Set(absId, amp);
204  GetTriggerQA(fCentBin)->ProcessCell(cellInfo);
205  }
206  }
207 
209 
210  return kTRUE;
211 }
212 
218 {
219  fADCperBin = n;
220 
221  for (Int_t i = 0; i < fNcentBins; i++) {
222  GetTriggerQA(i)->SetADCperBin(n);
223  }
224 }
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
void Set(Int_t absId, Double_t e)
Base task in the EMCAL framework.
TObjArray * fEMCALTriggerQA
produces the QA histograms
void SetDebugLevel(Int_t l)
void ExecOnce()
Actions to be executed only once for the first event.
Int_t fCentBin
!event centrality bin
TClonesArray * fTriggerPatches
! trigger array in
void SetADCperBin(Int_t i)
TList * fOutput
!output list
void SetForceBeamType(BeamType f)
void ProcessFastor(AliEMCALTriggerFastOR *fastor, AliVCaloCells *cells)
void EnableDCal(Bool_t e=kTRUE)
AliEMCALGeometry * fGeom
!emcal geometry
Int_t fMinAmplitude
Minimum trigger patch amplitude.
Int_t fNcentBins
if MC label > fMCLabelShift, MC label -= fMCLabelShift
AliEmcalTriggerQAPP * GetTriggerQA(Int_t i=0)
Class to do some fast QA of the EMCal trigger (pp collisions). Useful also to tune trigger thresholds...
void ProcessPatch(AliEMCALTriggerPatchInfo *patch)
Bool_t fDCalPlots
Whether to add DCal QA plots.
virtual void SetNCentBins(Int_t n)
AliVCaloCells * fCaloCells
!cells
TString fTriggerPatchesName
name of input trigger array
void SetMakeGeneralHistograms(Bool_t g)
void Init()
Initialize the class, i.e. allocate histograms.
AliVCaloTrigger * fCaloTriggers
!calo triggers
Class to generate EMCal trigger QA plots in pp collisions.
Bool_t fInitialized
whether or not it should fill some general histograms
Int_t fADCperBin
ADC counts per bin.
void ProcessCell(const AliEmcalCellInfo &cell)