]>
Commit | Line | Data |
---|---|---|
eef0e082 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, 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 | /* $Id$ */ | |
17 | ||
5f4740c2 | 18 | // --- Root --- |
eef0e082 | 19 | #include <Riostream.h> |
20 | #include <TChain.h> | |
21 | #include <TTree.h> | |
22 | #include <TFile.h> | |
23 | #include <TList.h> | |
24 | ||
5f4740c2 | 25 | // --- AliRoot --- |
eef0e082 | 26 | #include "AliAnalysisTaskSE.h" |
27 | #include "AliAnalysisManager.h" | |
28 | #include "AliStack.h" | |
29 | #include "AliESDEvent.h" | |
30 | #include "AliESDInputHandler.h" | |
31 | #include "AliAODEvent.h" | |
32 | #include "AliMCEvent.h" | |
33 | #include "AliEMCALGeometry.h" | |
34 | #include "AliCaloCalibPedestal.h" | |
eef0e082 | 35 | #include "AliEMCALFastORPatch.h" |
36 | ||
5f4740c2 | 37 | #include "AliAnalysisTaskEMCALFastOR2Trigger.h" |
38 | ||
eef0e082 | 39 | ClassImp(AliAnalysisTaskEMCALFastOR2Trigger) |
40 | ||
41 | //________________________________________________________________________ | |
5f4740c2 | 42 | AliAnalysisTaskEMCALFastOR2Trigger::AliAnalysisTaskEMCALFastOR2Trigger() |
43 | : AliAnalysisTaskSE(), | |
44 | fNcol(2), | |
45 | fNrow(2), | |
46 | fShiftCol(1), | |
47 | fShiftRow(1), | |
48 | fTriggerClustersName("triggerClusters"), | |
49 | fTimeCutOn(1), | |
50 | fMinL0Time(7), | |
51 | fMaxL0Time(9), | |
52 | fCheckDeadClusters(0), | |
53 | fPedestal(0) | |
eef0e082 | 54 | { |
5f4740c2 | 55 | // Constructor |
eef0e082 | 56 | } |
57 | ||
58 | //________________________________________________________________________ | |
5f4740c2 | 59 | AliAnalysisTaskEMCALFastOR2Trigger::AliAnalysisTaskEMCALFastOR2Trigger(const char *name) |
60 | : AliAnalysisTaskSE(name), | |
61 | fNcol(2), | |
62 | fNrow(2), | |
63 | fShiftCol(1), | |
64 | fShiftRow(1), | |
65 | fTriggerClustersName("triggerClusters"), | |
66 | fTimeCutOn(1), | |
67 | fMinL0Time(7), | |
68 | fMaxL0Time(9), | |
69 | fCheckDeadClusters(0), | |
70 | fPedestal(0) | |
eef0e082 | 71 | { |
72 | // Constructor | |
73 | ||
74 | } | |
75 | ||
76 | //________________________________________________________________________ | |
77 | AliAnalysisTaskEMCALFastOR2Trigger::~AliAnalysisTaskEMCALFastOR2Trigger() | |
78 | { | |
5f4740c2 | 79 | // Destructor |
eef0e082 | 80 | } |
81 | ||
82 | //________________________________________________________________________ | |
83 | void AliAnalysisTaskEMCALFastOR2Trigger::UserCreateOutputObjects() | |
84 | { | |
5f4740c2 | 85 | // Create output objects |
eef0e082 | 86 | } |
87 | ||
88 | //________________________________________________________________________ | |
89 | void AliAnalysisTaskEMCALFastOR2Trigger::UserExec(Option_t *) | |
90 | { | |
5f4740c2 | 91 | // Main loop, called for each event |
eef0e082 | 92 | |
93 | // Create pointer to reconstructed event | |
94 | AliVEvent *event = InputEvent(); | |
5f4740c2 | 95 | if (!event) { |
96 | AliWarning("Could not retrieve event"); | |
97 | return; | |
98 | } | |
eef0e082 | 99 | |
100 | // create pointer to event | |
101 | AliESDEvent* esd = dynamic_cast<AliESDEvent*>(event); | |
5f4740c2 | 102 | if (!esd) { |
eef0e082 | 103 | AliError("Cannot get the ESD event"); |
104 | return; | |
105 | } | |
106 | ||
107 | AliESDCaloTrigger *triggers = esd->GetCaloTrigger("EMCAL"); | |
108 | ||
109 | if (!triggers || !(triggers->GetEntries() > 0)) | |
110 | return; | |
111 | ||
112 | AliEMCALGeometry *fGeom = AliEMCALGeometry::GetInstance(AliEMCALGeometry::GetDefaultGeometryName()); | |
113 | Int_t nSupMod = 0, nModule = 0, nIphi = 0, nIeta = 0, iphi = 0, ieta = 0; | |
114 | ||
115 | // ------------------------------- | |
116 | // Trigger clusterizer parameters | |
117 | ||
118 | Int_t totalCols = 48; | |
119 | Int_t totalRows = 60; | |
120 | Int_t nTRURow = 15; | |
121 | Int_t nTRUCol = 2; | |
122 | Int_t nColFastOR = totalCols / nTRUCol; | |
123 | Int_t nRowFastOR = totalRows / nTRURow; | |
5f4740c2 | 124 | Int_t maxiShiftRow = fNrow / fShiftRow; |
125 | Int_t maxiShiftCol = fNcol / fShiftCol; | |
126 | Int_t nFastORCluster = fNcol * fNrow; | |
127 | Int_t nTriggerClusters = totalRows * totalCols / fNcol / fNrow; | |
eef0e082 | 128 | Int_t nTotalClus = nTriggerClusters * maxiShiftCol * maxiShiftRow; |
5f4740c2 | 129 | Int_t nClusRowNoShift = nRowFastOR / fNrow; |
130 | //Int_t nClusColNoShift = nColFastOR / fNcol; | |
131 | ||
132 | // ------------------------------- | |
eef0e082 | 133 | |
134 | TClonesArray *triggers_array = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fTriggerClustersName)); | |
5f4740c2 | 135 | if(!triggers_array){ |
eef0e082 | 136 | triggers_array = new TClonesArray("AliESDCaloTrigger", nTotalClus); |
137 | triggers_array->SetName(fTriggerClustersName); | |
138 | InputEvent()->AddObject(triggers_array); | |
139 | } | |
5f4740c2 | 140 | else { |
eef0e082 | 141 | triggers_array->Delete(); |
142 | } | |
143 | ||
144 | Bool_t *dead_clusters = new Bool_t[nTotalClus]; | |
5f4740c2 | 145 | for (Int_t i = 0; i < nTotalClus; i++){ |
eef0e082 | 146 | dead_clusters[i] = kFALSE; |
147 | } | |
eef0e082 | 148 | |
149 | triggers->Reset(); | |
150 | ||
5f4740c2 | 151 | while (triggers->Next()) { |
eef0e082 | 152 | Float_t L0FastORamp = 0; |
153 | ||
154 | triggers->GetAmplitude(L0FastORamp); | |
155 | ||
156 | if (L0FastORamp < 0) | |
157 | continue; | |
158 | ||
5f4740c2 | 159 | if (fTimeCutOn){ |
eef0e082 | 160 | Int_t ntimes = 0; |
161 | triggers->GetNL0Times(ntimes); | |
162 | ||
163 | if (ntimes < 1) | |
164 | continue; | |
165 | ||
166 | Int_t trgtimes[25]; | |
167 | triggers->GetL0Times(trgtimes); | |
168 | ||
169 | Bool_t trgInTimeWindow = 0; | |
5f4740c2 | 170 | for (Int_t i = 0; i < ntimes; i++) { |
eef0e082 | 171 | if ((fMaxL0Time >= trgtimes[i]) && (fMinL0Time <= trgtimes[i])) |
172 | trgInTimeWindow = 1; | |
173 | } | |
174 | ||
175 | if (!trgInTimeWindow) | |
176 | continue; | |
177 | } | |
178 | ||
179 | Int_t gCol = 0, gRow = 0; | |
180 | ||
181 | triggers->GetPosition(gCol, gRow); | |
182 | ||
183 | Int_t find = -1; | |
184 | fGeom->GetAbsFastORIndexFromPositionInEMCAL(gCol, gRow, find); | |
185 | ||
186 | if (find<0) | |
187 | continue; | |
188 | ||
189 | Int_t cidx[4] = {-1}; | |
190 | Bool_t ret = fGeom->GetCellIndexFromFastORIndex(find, cidx); | |
191 | ||
192 | if (!ret) | |
193 | continue; | |
194 | ||
195 | Bool_t deadCluster = kFALSE; | |
196 | ||
5f4740c2 | 197 | if (fCheckDeadClusters && fPedestal){ |
198 | for (Int_t i = 0; i < 4; i++){ | |
eef0e082 | 199 | fGeom->GetCellIndex (cidx[i], nSupMod, nModule, nIphi, nIeta); |
200 | fGeom->GetCellPhiEtaIndexInSModule (nSupMod, nModule, nIphi, nIeta, iphi, ieta); | |
201 | ||
202 | Double_t d = fPedestal->GetDeadMap(nSupMod)->GetBinContent(ieta,iphi); | |
5f4740c2 | 203 | if (d == AliCaloCalibPedestal::kDead || d == AliCaloCalibPedestal::kHot){ |
eef0e082 | 204 | deadCluster = kTRUE; |
205 | } | |
206 | } | |
207 | } | |
208 | ||
209 | // -------------------------- | |
210 | // Trigger clusterizer | |
211 | ||
5f4740c2 | 212 | for (Int_t ishiftRow = 0; ishiftRow < maxiShiftRow; ishiftRow++){ |
213 | Int_t nClusRow = (nRowFastOR - fShiftRow * ishiftRow) / fNrow; | |
eef0e082 | 214 | |
5f4740c2 | 215 | for (Int_t ishiftCol = 0; ishiftCol < maxiShiftCol; ishiftCol++){ |
eef0e082 | 216 | Int_t iTotalClus = nTriggerClusters * (ishiftRow * maxiShiftCol + ishiftCol); |
217 | ||
5f4740c2 | 218 | Int_t nClusCol = (nColFastOR - fShiftCol * ishiftCol) / fNcol; |
eef0e082 | 219 | |
5f4740c2 | 220 | Int_t irow_eff = gRow - fShiftRow * ishiftRow; |
eef0e082 | 221 | Int_t iTRUrow = irow_eff / nRowFastOR; |
222 | irow_eff -= iTRUrow * nRowFastOR; | |
5f4740c2 | 223 | Int_t iClusRow = irow_eff / fNrow; |
eef0e082 | 224 | |
225 | if (irow_eff < 0 || iClusRow >= nClusRow) | |
226 | continue; | |
227 | ||
5f4740c2 | 228 | Int_t icol_eff = gCol - fShiftCol * ishiftCol; |
eef0e082 | 229 | Int_t iTRUcol = icol_eff / nColFastOR; |
230 | icol_eff -= iTRUcol * nColFastOR; | |
5f4740c2 | 231 | Int_t iClusCol = icol_eff / fNcol; |
eef0e082 | 232 | |
233 | if (icol_eff < 0 || iClusCol >= nClusCol) | |
234 | continue; | |
235 | ||
236 | irow_eff += iTRUrow * nRowFastOR; | |
5f4740c2 | 237 | iClusRow = irow_eff / fNrow; |
eef0e082 | 238 | |
239 | icol_eff += iTRUcol * nColFastOR; | |
5f4740c2 | 240 | iClusCol = icol_eff / fNcol; |
eef0e082 | 241 | |
242 | Int_t iTriggerCluster = iClusRow + iClusCol * nClusRowNoShift * nTRURow + iTotalClus; | |
5f4740c2 | 243 | Int_t iTriggerDigit = irow_eff % fNrow + (icol_eff % fNcol) * fNrow; |
eef0e082 | 244 | |
245 | if (dead_clusters[iTriggerCluster] && fCheckDeadClusters) deadCluster = kTRUE; | |
246 | ||
5f4740c2 | 247 | if (deadCluster){ |
eef0e082 | 248 | dead_clusters[iTriggerCluster] = kTRUE; |
5f4740c2 | 249 | if (triggers_array->At(iTriggerCluster)){ |
eef0e082 | 250 | triggers_array->RemoveAt(iTriggerCluster); |
251 | } | |
252 | continue; | |
253 | } | |
254 | ||
5f4740c2 | 255 | if (!triggers_array->At(iTriggerCluster)){ |
eef0e082 | 256 | (*triggers_array)[iTriggerCluster] = new AliEMCALFastORPatch(iTriggerCluster, nFastORCluster); |
257 | } | |
258 | ||
259 | AliEMCALFastORPatch *triggerCluster = dynamic_cast<AliEMCALFastORPatch*>(triggers_array->At(iTriggerCluster)); | |
260 | ||
5f4740c2 | 261 | if (triggerCluster->GetFastORamplitude(iTriggerDigit) > -1){ |
262 | AliWarning("FastOR already added!"); | |
eef0e082 | 263 | return; |
264 | } | |
265 | ||
266 | triggerCluster->AddFastORat(L0FastORamp, gCol, gRow, iTriggerDigit); | |
267 | ||
268 | } // loop on col shift | |
269 | ||
270 | } // loop on row shift | |
271 | ||
272 | // ------------------------------ | |
5f4740c2 | 273 | |
eef0e082 | 274 | } // loop on L0 FastOR triggers |
275 | ||
276 | delete[] dead_clusters; | |
277 | ||
278 | triggers_array->Compress(); | |
279 | } |