Line data Source code
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 : // --- ROOT system ---
17 : #include <TClonesArray.h>
18 : #include <TFile.h>
19 : #include <TH1F.h>
20 : #include <TH1I.h>
21 : #include <TH2F.h>
22 : #include <TH3I.h>
23 : #include <TLine.h>
24 : #include <TText.h>
25 : #include <TProfile.h>
26 : #include <TProfile2D.h>
27 : #include <TStyle.h>
28 :
29 : // --- AliRoot header files ---
30 : #include "AliDAQ.h"
31 : #include "AliESDCaloCluster.h"
32 : #include "AliESDCaloCells.h"
33 : #include "AliESDEvent.h"
34 : #include "AliLog.h"
35 : #include "AliEMCALQADataMakerRec.h"
36 : #include "AliQAChecker.h"
37 : #include "AliEMCALDigit.h"
38 : #include "AliEMCALRecPoint.h"
39 : #include "AliEMCALRawUtils.h"
40 : #include "AliEMCALReconstructor.h"
41 : #include "AliEMCALRecParam.h"
42 : #include "AliRawReader.h"
43 : #include "AliCaloRawStreamV3.h"
44 : #include "AliEMCALGeoParams.h"
45 : #include "AliRawEventHeaderBase.h"
46 : #include "AliQAManager.h"
47 : #include "AliCDBEntry.h"
48 :
49 : #include "AliCaloBunchInfo.h"
50 : #include "AliCaloFitResults.h"
51 : #include "AliCaloRawAnalyzer.h"
52 : #include "AliCaloRawAnalyzerFactory.h"
53 :
54 : #include "AliEMCALGeometry.h"
55 : #include "AliEMCALTriggerSTURawStream.h"
56 :
57 : using namespace std;
58 :
59 : /// \cond CLASSIMP
60 42 : ClassImp(AliEMCALQADataMakerRec) ;
61 : /// \endcond
62 :
63 : //____________________________________________________________________________
64 : /// Constructor.
65 : ///
66 : /// \param fitAlgo: an Integer value to specify the fitting Algorithm to be used
67 : /// see EMCALUtils/AliCaloConstants.h enum fitAlgorithm
68 : ///
69 : AliEMCALQADataMakerRec::AliEMCALQADataMakerRec(Int_t fitAlgo) :
70 6 : AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kEMCAL), "EMCAL Quality Assurance Data Maker"),
71 2 : fFittingAlgorithm(0),
72 2 : fRawAnalyzer(0),
73 2 : fRawAnalyzerTRU(0),
74 2 : fGeom(0),
75 2 : fSuperModules(20), // number of SuperModules; updated to 20 for EMCal + DCal
76 2 : fFirstPedestalSample(0),
77 2 : fLastPedestalSample(3),
78 2 : fFirstPedestalSampleTRU(0),
79 2 : fLastPedestalSampleTRU(3),
80 2 : fMinSignalLG(0),
81 2 : fMaxSignalLG(AliEMCALGeoParams::fgkSampleMax),
82 2 : fMinSignalHG(0),
83 2 : fMaxSignalHG(AliEMCALGeoParams::fgkSampleMax),
84 2 : fMinSignalTRU(0),
85 2 : fMaxSignalTRU(AliEMCALGeoParams::fgkSampleMax),
86 2 : fMinSignalLGLEDMon(0),
87 2 : fMaxSignalLGLEDMon(AliEMCALGeoParams::fgkSampleMax),
88 2 : fMinSignalHGLEDMon(0),
89 2 : fMaxSignalHGLEDMon(AliEMCALGeoParams::fgkSampleMax),
90 2 : fCalibRefHistoPro(NULL),
91 2 : fCalibRefHistoH2F(NULL),
92 2 : fLEDMonRefHistoPro(NULL),
93 2 : fHighEmcHistoH2F(NULL)
94 : // fTextSM(new TText*[fSuperModules]) ,
95 : // fLineCol(NULL),
96 : // fLineRow(NULL)
97 10 : {
98 2 : SetFittingAlgorithm(fitAlgo);
99 :
100 4 : fGeom = AliEMCALGeometry::GetInstance();
101 :
102 2 : if(!fGeom)
103 : {
104 0 : AliCDBManager* man = AliCDBManager::Instance();
105 0 : Int_t runNumber = man->GetRun();
106 0 : fGeom = AliEMCALGeometry::GetInstanceFromRunNumber(runNumber);
107 0 : }
108 :
109 2 : if(!fGeom)
110 : {
111 0 : AliWarning(Form("Using default geometry in reconstruction!!!"));
112 0 : fGeom = AliEMCALGeometry::GetInstance(AliEMCALGeometry::GetDefaultGeometryName());
113 0 : }
114 :
115 2 : if ( !fGeom ) AliFatal(Form("Could not get geometry!"));
116 8 : else AliInfo (Form("Geometry name: <<%s>>",fGeom->GetName()));
117 :
118 : // for (Int_t sm = 0 ; sm < fSuperModules ; sm++){
119 : // fTextSM[sm] = NULL ;
120 : // }
121 4 : }
122 :
123 : //____________________________________________________________________________
124 : ///
125 : /// Copy constructor.
126 : ///
127 : /// \param qadm: AliEMCALQADataMakerRec
128 : ///
129 : AliEMCALQADataMakerRec::AliEMCALQADataMakerRec(const AliEMCALQADataMakerRec& qadm) :
130 0 : AliQADataMakerRec(),
131 0 : fFittingAlgorithm(0),
132 0 : fRawAnalyzer(0),
133 0 : fRawAnalyzerTRU(0),
134 0 : fGeom(0),
135 0 : fSuperModules(qadm.GetSuperModules()),
136 0 : fFirstPedestalSample(qadm.GetFirstPedestalSample()),
137 0 : fLastPedestalSample(qadm.GetLastPedestalSample()),
138 0 : fFirstPedestalSampleTRU(qadm.GetFirstPedestalSampleTRU()),
139 0 : fLastPedestalSampleTRU(qadm.GetLastPedestalSampleTRU()),
140 0 : fMinSignalLG(qadm.GetMinSignalLG()),
141 0 : fMaxSignalLG(qadm.GetMaxSignalLG()),
142 0 : fMinSignalHG(qadm.GetMinSignalHG()),
143 0 : fMaxSignalHG(qadm.GetMaxSignalHG()),
144 0 : fMinSignalTRU(qadm.GetMinSignalTRU()),
145 0 : fMaxSignalTRU(qadm.GetMaxSignalTRU()),
146 0 : fMinSignalLGLEDMon(qadm.GetMinSignalLGLEDMon()),
147 0 : fMaxSignalLGLEDMon(qadm.GetMaxSignalLGLEDMon()),
148 0 : fMinSignalHGLEDMon(qadm.GetMinSignalHGLEDMon()),
149 0 : fMaxSignalHGLEDMon(qadm.GetMaxSignalHGLEDMon()),
150 0 : fCalibRefHistoPro(NULL),
151 0 : fCalibRefHistoH2F(NULL),
152 0 : fLEDMonRefHistoPro(NULL),
153 0 : fHighEmcHistoH2F(NULL)
154 : // fTextSM(new TText*[fSuperModules]) ,
155 : // fLineCol(NULL),
156 : // fLineRow(NULL)
157 0 : {
158 0 : SetName((const char*)qadm.GetName()) ;
159 0 : SetTitle((const char*)qadm.GetTitle());
160 0 : SetFittingAlgorithm(qadm.GetFittingAlgorithm());
161 :
162 : // for (Int_t sm = 0 ; sm < fSuperModules ; sm++){
163 : // fTextSM[sm] = qadm.fTextSM[sm] ;
164 : // }
165 0 : }
166 :
167 : //__________________________________________________________________
168 : ///
169 : /// Assignment operator.
170 : ///
171 : /// \param qadm: AliEMCALQADataMakerRec
172 : ///
173 : AliEMCALQADataMakerRec& AliEMCALQADataMakerRec::operator = (const AliEMCALQADataMakerRec& qadm )
174 : {
175 0 : this->~AliEMCALQADataMakerRec();
176 0 : new(this) AliEMCALQADataMakerRec(qadm);
177 : // fLineCol = NULL;
178 : // fLineRow = NULL;
179 : // for (Int_t sm = 0 ; sm < fSuperModules ; sm++){
180 : // fTextSM[sm] = qadm.fTextSM[sm] ;
181 : // }
182 0 : return *this;
183 0 : }
184 :
185 : //____________________________________________________________________________
186 : ///
187 : /// Detector specific actions at end of cycle
188 : ///
189 : /// \param task
190 : /// \param list of histograms
191 : ///
192 : void AliEMCALQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
193 : {
194 : //TH1I *rmsL0=(TH1I*)list[fEventSpecie]->At(kNL0TRUSamples);
195 : // if(fCycleCounter)
196 : // GetRawsData(kNEventsPerTower)->Scale(1./fCycleCounter);
197 : /*for(int i=0; i<AliEMCALTriggerMappingV2::fSTURegionNEta; i++)
198 : for(int j=0; j<AliEMCALTriggerMappingV2::fSTURegionNPhi; j++)
199 : FillRawsData(kNL0TRURMS,i,j,rmsL0->GetBinError(i,j));
200 : */
201 : // reset triggers list to select all histos
202 0 : ResetEventTrigClasses();
203 : // do the QA checking
204 0 : AliQAChecker::Instance()->Run(AliQAv1::kEMCAL, task, list) ;
205 0 : }
206 :
207 : //____________________________________________________________________________
208 : ///
209 : /// Get the reference histogram from OCDB
210 : ///
211 : void AliEMCALQADataMakerRec::GetCalibRefFromOCDB()
212 : {
213 0 : TString sName1("hHighEmcalRawMaxMinusMin") ;
214 0 : TString sName2("hLowLEDMonEmcalRawMaxMinusMin") ;
215 0 : sName1.Prepend(Form("%s_", AliRecoParam::GetEventSpecieName(AliRecoParam::kCalib))) ;
216 0 : sName2.Prepend(Form("%s_", AliRecoParam::GetEventSpecieName(AliRecoParam::kCalib))) ;
217 :
218 0 : TString refStorage(AliQAv1::GetQARefStorage()) ;
219 0 : if (!refStorage.Contains(AliQAv1::GetLabLocalOCDB()) && !refStorage.Contains(AliQAv1::GetLabAliEnOCDB())) {
220 0 : AliFatal(Form("%s is not a valid location for reference data", refStorage.Data())) ;
221 : } else {
222 0 : AliQAManager* manQA = AliQAManager::QAManager(AliQAv1::kRAWS) ;
223 0 : AliQAv1::SetQARefDataDirName(AliRecoParam::kCalib) ;
224 0 : if ( ! manQA->GetLock() ) {
225 0 : manQA->SetDefaultStorage(AliQAv1::GetQARefStorage()) ;
226 0 : manQA->SetSpecificStorage("*", AliQAv1::GetQARefStorage()) ;
227 0 : manQA->SetRun(AliCDBManager::Instance()->GetRun()) ;
228 0 : manQA->SetLock() ;
229 : }
230 :
231 0 : char * detOCDBDir = Form("%s/%s/%s", GetName(), AliQAv1::GetRefOCDBDirName(), AliQAv1::GetRefDataDirName()) ;
232 0 : AliCDBEntry * entry = manQA->Get(detOCDBDir, manQA->GetRun()) ;
233 0 : if (entry) {
234 0 : TList * listDetQAD =static_cast<TList *>(entry->GetObject()) ;
235 0 : if ( strcmp(listDetQAD->ClassName(), "TList") != 0 ) {
236 0 : AliError(Form("Expected a Tlist and found a %s for detector %s", listDetQAD->ClassName(), GetName())) ;
237 : listDetQAD = NULL ;
238 0 : }
239 :
240 : TObjArray * dirOCDB= NULL ;
241 0 : if ( listDetQAD )
242 0 : dirOCDB = static_cast<TObjArray *>(listDetQAD->FindObject(Form("%s/%s", AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), AliRecoParam::GetEventSpecieName(AliRecoParam::kCalib)))) ;
243 0 : if (dirOCDB){
244 0 : fCalibRefHistoPro = dynamic_cast<TProfile *>(dirOCDB->FindObject(sName1.Data())) ;
245 0 : fLEDMonRefHistoPro = dynamic_cast<TProfile *>(dirOCDB->FindObject(sName2.Data())) ;
246 0 : }
247 0 : }
248 : }
249 :
250 0 : if(fCalibRefHistoPro && fLEDMonRefHistoPro)
251 : {
252 : // Defining histograms binning, each 2D histogram covers all SMs
253 0 : Int_t nSMSectors = fSuperModules / 2; // 2 SMs per sector
254 :
255 0 : AliCDBManager* man = AliCDBManager::Instance();
256 0 : Int_t runNumber = man->GetRun();
257 : Int_t nbinsZ, nbinsPhi;
258 0 : if (!(fGeom-> GetEMCGeometry()->GetGeoName().Contains("DCAL"))){
259 : nbinsZ = AliEMCALGeoParams::fgkEMCALCols;
260 : nbinsPhi = AliEMCALGeoParams::fgkEMCALRows;
261 0 : }
262 : else{
263 : nbinsZ = AliEMCALTriggerMappingV2::fSTURegionNEta;
264 : nbinsPhi = AliEMCALTriggerMappingV2::fSTURegionNPhi;
265 : }
266 0 : if(!fCalibRefHistoH2F)
267 0 : fCalibRefHistoH2F = new TH2F("hCalibRefHisto", "hCalibRefHisto", nbinsZ, -0.5, nbinsZ - 0.5, nbinsPhi, -0.5, nbinsPhi -0.5);
268 0 : ConvertProfile2H(fCalibRefHistoPro,fCalibRefHistoH2F) ;
269 0 : } else {
270 0 : AliFatal(Form("No reference object with name %s or %s found", sName1.Data(), sName2.Data())) ;
271 : }
272 :
273 0 : }
274 :
275 : //____________________________________________________________________________
276 : ///
277 : /// Create histograms to controll ESD.
278 : /// Multiple paragraphs are split on multiple lines.
279 : ///
280 : void AliEMCALQADataMakerRec::InitESDs()
281 : {
282 : const Bool_t expert = kTRUE ;
283 : const Bool_t image = kTRUE ;
284 :
285 0 : TH1F * h1 = new TH1F("hESDCaloClusterE", "ESDs CaloCluster energy in EMCAL;Energy [GeV];Counts", 200, 0., 100.) ;
286 0 : h1->Sumw2() ;
287 0 : Add2ESDsList(h1, kESDCaloClusE, !expert, image) ;
288 :
289 0 : TH1I * h2 = new TH1I("hESDCaloClusterM", "ESDs CaloCluster multiplicity in EMCAL;# of Clusters;Entries", 100, 0, 100) ;
290 0 : h2->Sumw2() ;
291 0 : Add2ESDsList(h2, kESDCaloClusM, !expert, image) ;
292 :
293 0 : TH1F * h3 = new TH1F("hESDCaloCellA", "ESDs CaloCell amplitude in EMCAL;Energy [GeV];Counts", 500, 0., 50.) ;
294 0 : h3->Sumw2() ;
295 0 : Add2ESDsList(h3, kESDCaloCellA, !expert, image) ;
296 :
297 0 : TH1I * h4 = new TH1I("hESDCaloCellM", "ESDs CaloCell multiplicity in EMCAL;# of Clusters;Entries", 200, 0, 1000) ;
298 0 : h4->Sumw2() ;
299 0 : Add2ESDsList(h4, kESDCaloCellM, !expert, image) ;
300 : //
301 0 : ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
302 0 : }
303 :
304 : //____________________________________________________________________________
305 : /// Create Digits histograms in Digits subdir.
306 : ///
307 : void AliEMCALQADataMakerRec::InitDigits()
308 : {
309 : const Bool_t expert = kTRUE ;
310 : const Bool_t image = kTRUE ;
311 :
312 0 : TH1I * h0 = new TH1I("hEmcalDigits", "Digits amplitude distribution in EMCAL;Amplitude [ADC counts];Counts", 500, 0, 500) ;
313 0 : h0->Sumw2() ;
314 0 : Add2DigitsList(h0, 0, !expert, image) ;
315 0 : TH1I * h1 = new TH1I("hEmcalDigitsMul", "Digits multiplicity distribution in EMCAL;# of Digits;Entries", 200, 0, 2000) ;
316 0 : h1->Sumw2() ;
317 0 : Add2DigitsList(h1, 1, !expert, image) ;
318 : //
319 0 : ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
320 0 : }
321 :
322 : //____________________________________________________________________________
323 : ///
324 : /// Create Reconstructed PoInt_ts histograms in RecPoints subdir.
325 : ///
326 : void AliEMCALQADataMakerRec::InitRecPoints()
327 : {
328 : const Bool_t expert = kTRUE ;
329 : const Bool_t image = kTRUE ;
330 :
331 0 : TH1F* h0 = new TH1F("hEMCALRpE","EMCAL RecPoint energies;Energy [GeV];Counts",200, 0.,20.); //GeV
332 0 : h0->Sumw2();
333 0 : Add2RecPointsList(h0,kRecPE, !expert, image);
334 :
335 0 : TH1I* h1 = new TH1I("hEMCALRpM","EMCAL RecPoint multiplicities;# of Clusters;Entries",100,0,100);
336 0 : h1->Sumw2();
337 0 : Add2RecPointsList(h1,kRecPM, !expert, image);
338 :
339 0 : TH1I* h2 = new TH1I("hEMCALRpDigM","EMCAL RecPoint Digit Multiplicities;# of Digits;Entries",20,0,20);
340 0 : h2->Sumw2();
341 0 : Add2RecPointsList(h2,kRecPDigM, !expert, image);
342 : //
343 0 : ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
344 0 : }
345 :
346 : //____________________________________________________________________________
347 : ///
348 : /// Create Raws histograms in Raws subdir.
349 : ///
350 : void AliEMCALQADataMakerRec::InitRaws()
351 : {
352 : const Bool_t expert = kTRUE ;
353 : const Bool_t saveCorr = kTRUE ;
354 : const Bool_t image = kTRUE ;
355 : const Option_t *profileOption = "s";
356 :
357 : Int_t nTowersPerSM = 2*AliEMCALTriggerMappingV2::fNEta*2*AliEMCALTriggerMappingV2::fNPhi; // number of towers in a SuperModule; 24x48
358 0 : Int_t nTot = fSuperModules * nTowersPerSM; // max number of towers in all SuperModules
359 :
360 : //Defining histograms binning, each 2D histogram covers all SMs
361 : Int_t nTotTRUs = AliEMCALTriggerMappingV2::fNTotalTRU;
362 : Int_t nSMSectors = fSuperModules / 2; // 2 SMs per sector
363 : Int_t nbinsZ = 2*AliEMCALTriggerMappingV2::fSTURegionNEta;
364 : Int_t nbinsPhi = 2*AliEMCALTriggerMappingV2::fSTURegionNPhi;
365 :
366 : Int_t nTRUCols = nbinsZ/2; // total TRU columns for 2D TRU histos
367 : Int_t nTRURows = nbinsPhi/2; // total TRU rows for 2D TRU histos
368 : // counter info: number of channels per event (bins are SM index)
369 0 : TProfile * h0 = new TProfile("hLowEmcalSupermodules", "Low Gain EMC: # of towers vs SuperMod;SM Id;# of towers",
370 0 : fSuperModules, -0.5, fSuperModules-0.5, profileOption) ;
371 0 : Add2RawsList(h0, kNsmodLG, !expert, !image, !saveCorr) ;
372 0 : TProfile * h1 = new TProfile("hHighEmcalSupermodules", "High Gain EMC: # of towers vs SuperMod;SM Id;# of towers",
373 0 : fSuperModules, -0.5, fSuperModules-0.5, profileOption) ;
374 0 : Add2RawsList(h1, kNsmodHG, !expert, !image, !saveCorr) ;
375 :
376 : // where did max sample occur? (bins are towers)
377 0 : TProfile * h2 = new TProfile("hLowEmcalRawtime", "Low Gain EMC: Time at Max vs towerId;Tower Id;Time [ticks]",
378 0 : nTot, -0.5, nTot-0.5, profileOption) ;
379 0 : Add2RawsList(h2, kTimeLG, expert, !image, !saveCorr) ;
380 0 : TProfile * h3 = new TProfile("hHighEmcalRawtime", "High Gain EMC: Time at Max vs towerId;Tower Id;Time [ticks]",
381 : nTot, -0.5, nTot-0.5, profileOption) ;
382 0 : Add2RawsList(h3, kTimeHG, expert, !image, !saveCorr) ;
383 :
384 : // how much above pedestal was the max sample? (bins are towers)
385 0 : TProfile * h4 = new TProfile("hLowEmcalRawMaxMinusMin", "Low Gain EMC: Max - Min vs towerId;Tower Id;Max-Min [ADC counts]",
386 : nTot, -0.5, nTot-0.5, profileOption) ;
387 0 : Add2RawsList(h4, kSigLG, !expert, !image, !saveCorr) ;
388 0 : TProfile * h5 = new TProfile("hHighEmcalRawMaxMinusMin", "High Gain EMC: Max - Min vs towerId;Tower Id;Max-Min [ADC counts]",
389 : nTot, -0.5, nTot-0.5, profileOption) ;
390 0 : Add2RawsList(h5, kSigHG, !expert, !image, !saveCorr) ;
391 :
392 : // total counter: channels per event
393 0 : TH1I * h6 = new TH1I("hLowNtot", "Low Gain EMC: Total Number of found towers;# of Towers;Counts", 200, 0, nTot) ;
394 0 : h6->Sumw2() ;
395 0 : Add2RawsList(h6, kNtotLG, !expert, !image, !saveCorr) ;
396 0 : TH1I * h7 = new TH1I("hHighNtot", "High Gain EMC: Total Number of found towers;# of Towers;Counts", 200,0, nTot) ;
397 0 : h7->Sumw2() ;
398 0 : Add2RawsList(h7, kNtotHG, !expert, !image, !saveCorr) ;
399 :
400 : // pedestal (bins are towers)
401 0 : TProfile * h8 = new TProfile("hLowEmcalRawPed", "Low Gain EMC: Pedestal vs towerId;Tower Id;Pedestal [ADC counts]",
402 : nTot, -0.5, nTot-0.5, profileOption) ;
403 0 : Add2RawsList(h8, kPedLG, expert, !image, !saveCorr) ;
404 0 : TProfile * h9 = new TProfile("hHighEmcalRawPed", "High Gain EMC: Pedestal vs towerId;Tower Id;Pedestal [ADC counts]",
405 : nTot, -0.5, nTot-0.5, profileOption) ;
406 0 : Add2RawsList(h9, kPedHG, expert, !image, !saveCorr) ;
407 :
408 :
409 : // now repeat the same for TRU and LEDMon data
410 : Int_t nTot2x2 = nTotTRUs*AliEMCALTriggerMappingV2::fNModulesInTRU; // max number of TRU channels for all SuperModules
411 :
412 : // counter info: number of channels per event (bins are SM index)
413 0 : TProfile * hT0 = new TProfile("hTRUEmcalSupermodules", "TRU EMC: # of TRU channels vs SuperMod;SM Id;# of TRU channels",
414 0 : fSuperModules, -0.5, fSuperModules-0.5, profileOption) ;
415 0 : Add2RawsList(hT0, kNsmodTRU, expert, !image, !saveCorr) ;
416 :
417 : // how much above pedestal was the max sample? (bins are TRU channels)
418 0 : TProfile * hT1 = new TProfile("hTRUEmcalRawMaxMinusMin", "TRU EMC: Max - Min vs 2x2Id;2x2 Id;Max-Min [ADC counts]",
419 : nTot2x2, -0.5, nTot2x2-0.5, profileOption) ;
420 0 : Add2RawsList(hT1, kSigTRU, expert, !image, !saveCorr) ;
421 :
422 : // total counter: channels per event
423 0 : TH1I * hT2 = new TH1I("hTRUNtot", "TRU EMC: Total Number of found TRU channels;# of TRU Channels;Counts", 200, 0, nTot2x2) ;
424 0 : hT2->Sumw2() ;
425 0 : Add2RawsList(hT2, kNtotTRU, expert, !image, !saveCorr) ;
426 :
427 : // L0 trigger hits: # of hits (bins are TRU channels)
428 0 : TH2I * hT3 = new TH2I("hTRUEmcalL0hits", "L0 trigger hits: Total number of 2x2 L0 generated", nTRUCols, -0.5, nTRUCols - 0.5, nTRURows, -0.5, nTRURows-0.5);
429 0 : hT3->SetOption("COLZ");
430 : //hT3->Sumw2();
431 0 : Add2RawsList(hT3, kNL0TRU, !expert, image, !saveCorr);
432 :
433 : // L0 trigger hits: average time (bins are TRU channels)
434 0 : TProfile2D * hT4 = new TProfile2D("hTRUEmcalL0hitsAvgTime", "L0 trigger hits: average time bin", nTRUCols, -0.5, nTRUCols - 0.5, nTRURows, -0.5, nTRURows-0.5, profileOption);
435 0 : hT4->SetOption("COLZ");
436 0 : Add2RawsList(hT4, kTimeL0TRU, !expert, image, !saveCorr);
437 :
438 : // L0 trigger hits: first in the event (bins are TRU channels)
439 0 : TH1I * hT5 = new TH1I("hTRUEmcalL0hitsFirst", "L0 trigger hits: First hit in the event", nTot2x2, -0.5, nTot2x2);
440 0 : hT5->Sumw2();
441 0 : Add2RawsList(hT5, kNL0FirstTRU, expert, !image, !saveCorr);
442 :
443 : // L0 trigger hits: average time of first hit in the event (bins are TRU channels)
444 0 : TProfile * hT6 = new TProfile("hTRUEmcalL0hitsFirstAvgTime", "L0 trigger hits: average time of first hit", nTot2x2, -0.5, nTot2x2, profileOption);
445 0 : Add2RawsList(hT6, kTimeL0FirstTRU, expert, !image, !saveCorr);
446 :
447 : // L0 number of time sample: # of samples over the threshold out of the 13 time sample (bins are TRU channels)
448 0 : TH2I * hT7 = new TH2I("hTRUEmcalL0Samples", "L0 fired trigger within a bunch per Patch", nTRUCols, -0.5, nTRUCols-0.5, nTRURows, -0.5, nTRURows-0.5);
449 0 : hT7->SetOption("COLZ");
450 : //hT3->Sumw2();
451 0 : Add2RawsList(hT7, kNL0TRUSamples, !expert, image, !saveCorr);
452 :
453 0 : TH1F * hT8 = new TH1F("hRMSOfnTimes", "Dispersion of Time for Fired Triggers per Patch", nTRUCols*nTRURows, -0.5, nTRUCols*nTRURows-0.5);
454 0 : hT8->Sumw2();
455 0 : Add2RawsList(hT8, kNL0TRURMS, !expert, image, !saveCorr);
456 :
457 : // and also LED Mon..
458 : // LEDMon has both high and low gain channels, just as regular FEE/towers
459 0 : Int_t nTotLEDMon = fSuperModules * AliEMCALGeoParams::fgkEMCALLEDRefs; // max number of LEDMon channels for all SuperModules
460 :
461 : // counter info: number of channels per event (bins are SM index)
462 0 : TProfile * hL0 = new TProfile("hLowLEDMonEmcalSupermodules", "LowLEDMon Gain EMC: # of strips vs SuperMod;SM Id;# of strips",
463 0 : fSuperModules, -0.5, fSuperModules-0.5, profileOption) ;
464 0 : Add2RawsList(hL0, kNsmodLGLEDMon, expert, !image, !saveCorr) ;
465 0 : TProfile * hL1 = new TProfile("hHighLEDMonEmcalSupermodules", "HighLEDMon Gain EMC: # of strips vs SuperMod;SM Id;# of strips",
466 0 : fSuperModules, -0.5, fSuperModules-0.5, profileOption) ;
467 0 : Add2RawsList(hL1, kNsmodHGLEDMon, expert, !image, !saveCorr) ;
468 :
469 : // where did max sample occur? (bins are strips)
470 0 : TProfile * hL2 = new TProfile("hLowLEDMonEmcalRawtime", "LowLEDMon Gain EMC: Time at Max vs stripId;Strip Id;Time [ticks]",
471 0 : nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ;
472 0 : Add2RawsList(hL2, kTimeLGLEDMon, expert, !image, !saveCorr) ;
473 0 : TProfile * hL3 = new TProfile("hHighLEDMonEmcalRawtime", "HighLEDMon Gain EMC: Time at Max vs stripId;Strip Id;Time [ticks]",
474 : nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ;
475 0 : Add2RawsList(hL3, kTimeHGLEDMon, expert, !image, !saveCorr) ;
476 :
477 : // how much above pedestal was the max sample? (bins are strips)
478 0 : TProfile * hL4 = new TProfile("hLowLEDMonEmcalRawMaxMinusMin", "LowLEDMon Gain EMC: Max - Min vs stripId;Strip Id;Max-Min [ADC counts]",
479 : nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ;
480 0 : Add2RawsList(hL4, kSigLGLEDMon, expert, !image, !saveCorr) ;
481 0 : TProfile * hL5 = new TProfile("hHighLEDMonEmcalRawMaxMinusMin", "HighLEDMon Gain EMC: Max - Min vs stripId;Strip Id;Max-Min [ADC counts]",
482 : nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ;
483 0 : Add2RawsList(hL5, kSigHGLEDMon, expert, !image, !saveCorr) ;
484 :
485 : // total counter: channels per event
486 0 : TH1I * hL6 = new TH1I("hLowLEDMonNtot", "LowLEDMon Gain EMC: Total Number of found strips;# of Strips;Counts", 200, 0, nTotLEDMon) ;
487 0 : hL6->Sumw2() ;
488 0 : Add2RawsList(hL6, kNtotLGLEDMon, expert, !image, !saveCorr) ;
489 0 : TH1I * hL7 = new TH1I("hHighLEDMonNtot", "HighLEDMon Gain EMC: Total Number of found strips;# of Strips;Counts", 200,0, nTotLEDMon) ;
490 0 : hL7->Sumw2() ;
491 0 : Add2RawsList(hL7, kNtotHGLEDMon, expert, !image, !saveCorr) ;
492 :
493 : // pedestal (bins are strips)
494 0 : TProfile * hL8 = new TProfile("hLowLEDMonEmcalRawPed", "LowLEDMon Gain EMC: Pedestal vs stripId;Strip Id;Pedestal [ADC counts]",
495 : nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ;
496 0 : Add2RawsList(hL8, kPedLGLEDMon, expert, !image, !saveCorr) ;
497 0 : TProfile * hL9 = new TProfile("hHighLEDMonEmcalRawPed", "HighLEDMon Gain EMC: Pedestal vs stripId;Strip Id;Pedestal [ADC counts]",
498 : nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ;
499 0 : Add2RawsList(hL9, kPedHGLEDMon, expert, !image, !saveCorr) ;
500 :
501 : // temp 2D amplitude histogram for the current run
502 0 : fHighEmcHistoH2F = new TH2F("h2DHighEC2", "High Gain EMC:Max - Min [ADC counts]", nbinsZ, -0.5 , nbinsZ-0.5, nbinsPhi, -0.5, nbinsPhi-0.5);
503 0 : fHighEmcHistoH2F->SetDirectory(0) ; // this histo must be memory resident
504 : // add ratio histograms: to comapre the current run with the reference data
505 0 : TH2F * h15 = new TH2F("h2DRatioAmp", "High Gain Ratio to Reference:Amplitude_{current run}/Amplitude_{reference run}", nbinsZ, -0.5 , nbinsZ-0.5,
506 : nbinsPhi, -0.5, nbinsPhi-0.5);
507 : // settings for display in amore
508 0 : h15->SetTitle("Amplitude_{current run}/Amplitude_{reference run}");
509 0 : h15->SetMaximum(2.0);
510 0 : h15->SetMinimum(0.1);
511 0 : h15->SetOption("COLZ");
512 0 : gStyle->SetOptStat(0);
513 0 : Int_t color[] = {4,3,2} ;
514 0 : gStyle->SetPalette(3,color);
515 0 : h15->GetZaxis()->SetNdivisions(3);
516 0 : h15->UseCurrentStyle();
517 0 : h15->SetDirectory(0);
518 0 : Add2RawsList(h15, k2DRatioAmp, !expert, image, !saveCorr) ;
519 :
520 0 : TH1F * h16 = new TH1F("hRatioDist", "Amplitude_{current run}/Amplitude_{reference run} ratio distribution", nTot, 0., 10000.);
521 : // h16->SetMinimum(0.1);
522 : // h16->SetMaximum(100.);
523 0 : gStyle->SetOptStat(0);
524 0 : h16->UseCurrentStyle();
525 0 : h16->SetDirectory(0);
526 0 : Add2RawsList(h16, kRatioDist, !expert, image, !saveCorr) ;
527 :
528 : // add two histograms for shifter from the LED monitor system: comapre LED monitor with the reference run
529 : // to be used for decision whether we need to change reference data
530 0 : TH1F * hL10 = new TH1F("hMaxMinusMinLEDMonRatio", "LEDMon amplitude, Ratio to reference run", nTotLEDMon, -0.5, nTotLEDMon-0.5) ;
531 : // settings for display in amore
532 0 : hL10->SetTitle("Amplitude_{LEDMon current}/Amplitude_{LEDMon reference}");
533 0 : hL10->SetMaximum(2.0);
534 0 : hL10->SetMinimum(0.1);
535 0 : gStyle->SetOptStat(0);
536 0 : hL10->UseCurrentStyle();
537 0 : hL10->SetDirectory(0);
538 : // hL10->SetOption("E");
539 0 : Add2RawsList(hL10, kLEDMonRatio, !expert, image, !saveCorr) ;
540 :
541 0 : TH1F * hL11 = new TH1F("hMaxMinusMinLEDMonRatioDist", "LEDMon amplitude, Ratio distribution", nTotLEDMon, 0, 2);
542 : // hL11->SetMinimum(0.1) ;
543 0 : gStyle->SetOptStat(0);
544 0 : hL11->UseCurrentStyle();
545 0 : hL11->SetDirectory(0);
546 0 : Add2RawsList(hL11, kLEDMonRatioDist, !expert, image, !saveCorr) ;
547 :
548 0 : GetCalibRefFromOCDB();
549 :
550 : // STU histgrams
551 :
552 : // histos
553 : Int_t nSTUCols = nbinsZ/2;
554 : Int_t nSTURows = nbinsPhi/2;
555 : // kAmpL1, kGL1, kJL1,
556 : // kGL1V0, kJL1V0, kSTUTRU
557 :
558 0 : TProfile2D *hS0 = new TProfile2D("hL1Amp", "Mean STU signal per Row and Column", nSTUCols, -0.5, nSTUCols-0.5, nSTURows, -0.5, nSTURows-0.5);
559 0 : Add2RawsList(hS0, kAmpL1, expert, !image, !saveCorr) ;
560 : //+5 for better visible error box
561 0 : TH2F *hS1 = new TH2F("hL1Gamma", "L1 Gamma patch position (FastOR top-left)", nSTUCols, -0.50, nSTUCols-0.5, nSTURows + 5, -0.5, nSTURows-0.5 + 5);
562 0 : Add2RawsList(hS1, kGL1, !expert, image, !saveCorr) ;
563 :
564 0 : TH2F *hS2 = new TH2F("hL1Jet", "L1 Jet patch position (FastOR top-left)", 12, -0.5, nSTUCols-0.5, 16, 0, nSTURows-0.5);
565 0 : Add2RawsList(hS2, kJL1, !expert, image, !saveCorr) ;
566 :
567 0 : TH2I *hS3 = new TH2I("hL1GV0", "L1 Gamma patch amplitude versus V0 signal", 500, 0, 50000, 1500, 0, 1500);
568 0 : Add2RawsList(hS3, kGL1V0, expert, image, !saveCorr) ;
569 :
570 0 : TH2I *hS4 = new TH2I("hL1JV0", "L1 Jet patch amplitude versus V0 signal", 500, 0, 50000, 1000, 0, 1000);
571 0 : Add2RawsList(hS4, kJL1V0, expert, !image, !saveCorr) ;
572 :
573 0 : TH1I *hS5 = new TH1I("hFrameR","Link between TRU and STU", AliEMCALTriggerMappingV2::fNTotalTRU, 0, AliEMCALTriggerMappingV2::fNTotalTRU);
574 0 : Add2RawsList(hS5, kSTUTRU, !expert, image, !saveCorr) ;
575 :
576 0 : hS0->SetOption("COLZ");
577 0 : hS1->SetOption("COLZ");
578 0 : hS2->SetOption("COLZ");
579 0 : hS3->SetOption("COLZ");
580 0 : hS4->SetOption("COLZ");
581 :
582 : //
583 0 : ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
584 0 : }
585 :
586 :
587 : //____________________________________________________________________________
588 : ///
589 : /// Make QA data from ESDs.
590 : ///
591 : /// \param esd: AliESDEvent
592 : ///
593 : void AliEMCALQADataMakerRec::MakeESDs(AliESDEvent * esd)
594 : {
595 : Int_t nTot = 0 ;
596 0 : for ( Int_t index = 0; index < esd->GetNumberOfCaloClusters() ; index++ ) {
597 0 : AliESDCaloCluster * clu = esd->GetCaloCluster(index) ;
598 0 : if( clu->IsEMCAL() ) {
599 0 : FillESDsData(kESDCaloClusE,clu->E()) ;
600 0 : nTot++ ;
601 0 : }
602 : }
603 0 : FillESDsData(kESDCaloClusM,nTot) ;
604 :
605 : // fill calo cells
606 0 : AliESDCaloCells* cells = esd->GetEMCALCells();
607 0 : FillESDsData(kESDCaloCellM,cells->GetNumberOfCells()) ;
608 :
609 0 : for ( Int_t index = 0; index < cells->GetNumberOfCells() ; index++ ) {
610 0 : FillESDsData(kESDCaloCellA,cells->GetAmplitude(index)) ;
611 : }
612 :
613 0 : IncEvCountCycleESDs();
614 0 : IncEvCountTotalESDs();
615 0 : }
616 :
617 : //____________________________________________________________________________
618 : ///
619 : /// Make the histograms for Raw data.
620 : ///
621 : /// \param rawReader: AliRawReader
622 : ///
623 : void AliEMCALQADataMakerRec::MakeRaws(AliRawReader* rawReader)
624 : {
625 : // Check that all the reference histograms exist before we try to use them - otherwise call InitRaws
626 : // RS: Attention: the counters are increments after custom modification of eventSpecie
627 0 : if (!fCalibRefHistoPro || !fCalibRefHistoH2F || !fLEDMonRefHistoPro || !fHighEmcHistoH2F) {
628 0 : InitRaws();
629 0 : }
630 :
631 : // make sure EMCal was readout during the event
632 0 : Int_t emcID = AliDAQ::DetectorID("EMCAL"); // bit 18..
633 0 : const UInt_t *detPattern = rawReader->GetDetectorPattern();
634 0 : UInt_t emcInReadout = ( ((1 << emcID) & detPattern[0]) >> emcID);
635 0 : if (! emcInReadout) return; // no poInt_t in looking at this event, if no EMCal data
636 :
637 : // setup
638 0 : rawReader->Reset() ;
639 0 : AliCaloRawStreamV3 in(rawReader,"EMCAL");
640 0 : rawReader->Select("EMCAL",0,AliDAQ::GetFirstSTUDDL()-1) ; // select EMCAL DDL's
641 :
642 0 : AliRecoParam::EventSpecie_t saveSpecie = fEventSpecie ;
643 0 : if (rawReader->GetType() == AliRawEventHeaderBase::kCalibrationEvent) {
644 0 : SetEventSpecie(AliRecoParam::kCalib) ;
645 0 : }
646 : const Int_t nTowColsPerSM= 2 * AliEMCALTriggerMappingV2::fNEta;
647 : const Int_t nTowRowsPerSM= 2 * AliEMCALTriggerMappingV2::fNPhi; // number of rows per SuperModule
648 :
649 : const Int_t nTowersPerSM = 2*AliEMCALTriggerMappingV2::fNEta*2*AliEMCALTriggerMappingV2::fNPhi; // number of towers in a SuperModule; 24x48
650 : const Int_t nRows = 2*AliEMCALTriggerMappingV2::fNPhi; // number of rows per SuperModule
651 : const Int_t nStripsPerSM = AliEMCALGeoParams::fgkEMCALLEDRefs; // number of strips per SuperModule
652 : const Int_t n2x2PerSM = AliEMCALTriggerMappingV2::fNTRU * AliEMCALTriggerMappingV2::fNModulesInTRU; // number of TRU 2x2's per SuperModule
653 : const Int_t n2x2PerTRU = AliEMCALTriggerMappingV2::fNModulesInTRU;
654 0 : const Int_t nTot2x2 = fSuperModules * n2x2PerSM; // total TRU channel
655 :
656 : Int_t maxNumL0PatchesPerTRU, nTotTRUs;
657 :
658 0 : if(fGeom->GetEMCGeometry()->GetGeoName().Contains("DCAL")){
659 : maxNumL0PatchesPerTRU = (AliEMCALTriggerMappingV2::fNModulesInTRUPhi-1)*(AliEMCALTriggerMappingV2::fNModulesInTRUEta-1); // when 4x4 PatchMode for L0 trigger is ON
660 : nTotTRUs = AliEMCALTriggerMappingV2::fNTotalTRU; // 52 TRUs : 32 EMCAL + 20 ( 14 + 6 unused ) DCAL
661 0 : }
662 : else{
663 : maxNumL0PatchesPerTRU = (AliEMCALGeoParams::fgkEMCALTRURows-1)*(AliEMCALGeoParams::fgkEMCALTRUCols -1);
664 : nTotTRUs = AliEMCALGeoParams::fgkEMCALTRUsPerSM * 10 + 2 ; //32 TRUs ( 3*10 Full_SM + 2 1/3_SM )
665 : }
666 :
667 : //const Int_t nTot2x2 = nTotTRUs* n2x2PerTRU;// total TRU channel
668 :
669 : // Set nTRUs array size to maximum possible 52, later it will be filled up to the real maximum
670 0 : vector <unsigned int> startBins [AliEMCALTriggerMappingV2::fNTotalTRU][n2x2PerTRU];
671 :
672 : // SM counters; decl. should be safe, assuming we don't get more than expected SuperModules..
673 0 : Int_t nTotalSMLG[AliEMCALGeoParams::fgkEMCALModules] = {0};
674 0 : Int_t nTotalSMHG[AliEMCALGeoParams::fgkEMCALModules] = {0};
675 0 : Int_t nTotalSMTRU[AliEMCALGeoParams::fgkEMCALModules] = {0};
676 0 : Int_t nTotalSMLGLEDMon[AliEMCALGeoParams::fgkEMCALModules] = {0};
677 0 : Int_t nTotalSMHGLEDMon[AliEMCALGeoParams::fgkEMCALModules] = {0};
678 :
679 0 : Int_t rmsForTRUL0[AliEMCALTriggerMappingV2::fSTURegionN]={0};
680 :
681 : const Int_t nTRUL0ChannelBits = 10; // used for L0 trigger bits checks
682 : int firstL0TimeBin = 999;
683 0 : int triggers[nTot2x2][24]; // auxiliary array for L0 trigger - TODO remove hardcoded 24
684 0 : memset(triggers, 0, sizeof(int) * 24 * nTot2x2);
685 :
686 : // The next 2 array must be up to 96 (n2x2PerTRU) to account for the possibility
687 : // to have 2x2 (single module) L0 trigger patches instead of 4x4 (2x2 modules)
688 : // Set nTRUs array size to maximum possible 52, later it will be filled up to the real maximum
689 0 : vector<Int_t> timeOfFiredPatches[AliEMCALTriggerMappingV2::fNTotalTRU][n2x2PerTRU];
690 :
691 : bool is2x2PatchModeActive = false; //default in Run2 is 4x4 Patch for L0 trigger
692 : Int_t iSM = 0; // SuperModule index
693 : // start loop over input stream
694 0 : while (in.NextDDL()) {
695 0 : Int_t iRCU = in.GetDDLNumber() % 2; // RCU0 or RCU1, within SuperModule
696 0 : Int_t iDDL = in.GetDDLNumber();
697 0 : fRawAnalyzer->SetIsZeroSuppressed( in.GetZeroSupp() );
698 :
699 0 : while (in.NextChannel()) {
700 0 : Int_t iBranch = in.GetBranch();
701 :
702 0 : iSM = in.GetModule(); // SuperModule
703 : //prInt_tf("iSM %d DDL %d", iSM, in.GetDDLNumber());
704 0 : if (iSM>=0 && iSM<fSuperModules) { // valid module reading
705 :
706 : Int_t nsamples = 0;
707 0 : vector<AliCaloBunchInfo> bunchlist;
708 0 : while (in.NextBunch()) {
709 0 : nsamples += in.GetBunchLength();
710 0 : bunchlist.push_back( AliCaloBunchInfo(in.GetStartTimeBin(), in.GetBunchLength(), in.GetSignals() ) );
711 : } //Storing of each bunch per channel
712 :
713 0 : if (nsamples > 0) { // this check is needed for when we have zero-supp. on, but not sparse readout
714 : Float_t time = 0.;
715 : Float_t amp = 0.;
716 : // indices for pedestal calc.
717 : Int_t firstPedSample = 0;
718 : Int_t lastPedSample = 0;
719 : bool isTRUL0IdData = false;
720 :
721 0 : if (! in.IsTRUData() ) { // high gain, low gain, LED Mon data - all have the same shaper/sampling
722 0 : AliCaloFitResults fitResults = fRawAnalyzer->Evaluate( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2());
723 0 : amp = fitResults.GetAmp();
724 0 : time = fitResults.GetTof();
725 0 : firstPedSample = fFirstPedestalSample;
726 0 : lastPedSample = fLastPedestalSample;
727 0 : }
728 : else { // TRU data is special, needs its own analyzer
729 0 : AliCaloFitResults fitResults = fRawAnalyzerTRU->Evaluate( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2());
730 0 : amp = fitResults.GetAmp();
731 0 : time = fitResults.GetTof();
732 0 : firstPedSample = fFirstPedestalSampleTRU;
733 0 : lastPedSample = fLastPedestalSampleTRU;
734 0 : if (in.GetColumn() >= n2x2PerTRU) {
735 : isTRUL0IdData = true;
736 0 : }
737 0 : }
738 :
739 : // pedestal samples
740 : Int_t nPed = 0;
741 0 : vector<Int_t> pedSamples;
742 :
743 : // select earliest bunch
744 : unsigned int bunchIndex = 0;
745 0 : unsigned int startBin = bunchlist.at(0).GetStartBin();
746 0 : if (bunchlist.size() > 0) {
747 0 : for(unsigned int ui=1; ui < bunchlist.size(); ui++ ) {
748 0 : if (startBin > bunchlist.at(ui).GetStartBin() ) {
749 0 : startBin = bunchlist.at(ui).GetStartBin();
750 : bunchIndex = ui;
751 0 : }
752 : }
753 0 : }//bunch size and select earliest bunch
754 :
755 : // check bunch for entries in the pedestal sample range
756 0 : Int_t bunchLength = bunchlist.at(bunchIndex).GetLength();
757 0 : const UShort_t *sig = bunchlist.at(bunchIndex).GetData();
758 : Int_t timebin = 0;
759 :
760 0 : if (! isTRUL0IdData) { // regular data, can look at pedestals
761 0 : for (Int_t i = 0; i<bunchLength; i++) {
762 0 : timebin = startBin--;
763 0 : if ( firstPedSample<=timebin && timebin<=lastPedSample ) {
764 0 : pedSamples.push_back( sig[i] );
765 0 : nPed++;
766 0 : }
767 : } // i
768 0 : }//PEDESTALS FOR REGULARE DATA!
769 :
770 : /***************/
771 : // Storing TRUL0Id Data
772 : else { // TRU L0 Id Data
773 : // which TRU the channel belongs to?
774 : //Int_t iTRUId = in.GetModule()*3 + (iRCU*in.GetBranch() + iRCU);
775 0 : Int_t iHWaddress = in.GetHWAddress();
776 0 : Int_t iTRUId = fGeom->GetTRUIndexFromOnlineHwAdd(iHWaddress,iRCU,iSM);
777 0 : for (Int_t i = 0; i< bunchLength; i++) {
778 0 : for( Int_t j = 0; j < nTRUL0ChannelBits; j++ ){
779 : // check if the bit j is 1
780 0 : if( (sig[i] & ( 1 << j )) > 0 ){
781 :
782 0 : Int_t iPatchInTRU = (in.GetColumn() - n2x2PerTRU)*nTRUL0ChannelBits+j;
783 :
784 0 : if(iPatchInTRU<n2x2PerTRU){
785 : //printf("iTRU %d\tiPatchinTRU %d\tstartBin %d",iTRUId,iPatchInTRU,startBin) ;
786 0 : timeOfFiredPatches[iTRUId][iPatchInTRU].push_back(startBin);
787 : //printf("\tnumber of times a patch has fired: %d\n",timeOfFiredPatches[iTRUId][iPatchInTRU].size());
788 0 : startBins[iTRUId][iPatchInTRU].push_back(startBin);
789 0 : if((int)startBin < firstL0TimeBin) firstL0TimeBin = startBin;
790 : }
791 : else{
792 : //only possible if in.GetColumn()>nFastORinTRU && in.GetColumn()==105 and the 8th bit of all sig[i] is 1
793 0 : if(iPatchInTRU==97)
794 : is2x2PatchModeActive=true;
795 : else
796 0 : continue;
797 : }
798 0 : }//check if bit j of sig i is 1
799 : }//loop over the 10 bits of each sig[i]
800 0 : startBin--;
801 : }//loop over the 13 time samples sig[i]
802 : }//TRU L0idData
803 : /***************/ //Go to line 282 for the rest of the L0 code
804 :
805 :
806 : // fill histograms
807 0 : Int_t icol = in.GetColumn();
808 0 : Int_t irow = in.GetRow();
809 :
810 : Int_t towerId = -1;
811 0 : if ( in.IsLowGain() || in.IsHighGain() ) { // regular towers
812 :
813 0 : if (iSM < 10) //FULL EMCAL MODULES
814 0 : towerId = iSM*nTowersPerSM + icol*nTowRowsPerSM + irow;
815 0 : else if (iSM > 9 && iSM < 12) //1/3 EMCAL = OFFSET_FULL_EMCAL + iSM,irow,icol ->tower_number (nrows=1/3nrows EMCAL FULL)
816 0 : towerId = 10*nTowersPerSM + (iSM-10)*nTowColsPerSM*(nTowRowsPerSM/3) + icol*(nTowRowsPerSM/3) + irow;
817 0 : else if (iSM > 11 && iSM < 18)//FULL DCAL = OFFSET_FULL_EMCAL+ OFFSET_1/3_EMCAL + iSM,irow,icol ->tower_number
818 0 : towerId = (iSM-2)*nTowersPerSM + 2*nTowColsPerSM*(nTowRowsPerSM/3) + icol*nTowRowsPerSM + irow;
819 : else //1/3 DCAL = OFFSET_FULL_EMCAL+ OFFSET_1/3_EMCAL+ OFFSET_FULL_DCAL+ iSM,irow,icol ->tower_number (nrows=1/3nrows EM(D)CAL FULL)
820 0 : towerId = 16*nTowersPerSM + (iSM-16)*nTowColsPerSM*(nTowRowsPerSM/3) + icol*(nTowRowsPerSM/3) + irow;
821 :
822 0 : if ( in.IsLowGain() ) {
823 0 : nTotalSMLG[iSM]++;
824 0 : if ( (amp > fMinSignalLG) && (amp < fMaxSignalLG) ) {
825 0 : FillRawsData(kSigLG,towerId, amp);
826 0 : FillRawsData(kTimeLG,towerId, time);
827 : }
828 0 : if (nPed > 0) {
829 0 : for (Int_t i=0; i<nPed; i++) {
830 0 : FillRawsData(kPedLG,towerId, pedSamples[i]);
831 : }
832 0 : }
833 : } // gain==0
834 0 : else if ( in.IsHighGain() ) {
835 0 : nTotalSMHG[iSM]++;
836 0 : if ( (amp > fMinSignalHG) && (amp < fMaxSignalHG) ) {
837 0 : FillRawsData(kSigHG,towerId, amp);
838 0 : FillRawsData(kTimeHG,towerId, time);
839 : }
840 0 : if (nPed > 0) {
841 0 : for (Int_t i=0; i<nPed; i++) {
842 0 : FillRawsData(kPedHG,towerId, pedSamples[i]);
843 : }
844 0 : }
845 : } // gain==1
846 : } // low or high gain
847 : // TRU
848 0 : else if ( in.IsTRUData() && in.GetColumn()<AliEMCALGeoParams::fgkEMCAL2x2PerTRU) {
849 : // for TRU data, the mapping class holds the TRU Int_ternal 2x2 number (0..95) in the Column var..
850 : // Int_t iTRU = (iRCU*in.GetBranch() + iRCU); // TRU0 is from RCU0, TRU1 from RCU1, TRU2 is from branch B on RCU1
851 : //Int_t iTRU2x2Id = iSM*n2x2PerSM + iTRU*AliEMCALGeoParams::fgkEMCAL2x2PerTRU + in.GetColumn();
852 0 : Int_t iHWaddress = in.GetHWAddress();
853 0 : Int_t iTRU = fGeom->GetTRUIndexFromOnlineHwAdd(iHWaddress,iRCU,iSM);
854 0 : nTotalSMTRU[iSM]++;
855 0 : Int_t iTRU2x2Id;
856 0 : Bool_t gotAbsFastORId=fGeom->GetAbsFastORIndexFromTRU(iTRU, in.GetColumn(), iTRU2x2Id);
857 0 : if(!gotAbsFastORId)
858 0 : continue;
859 : else{
860 0 : nTotalSMTRU[iSM]++;
861 0 : if ( (amp > fMinSignalTRU) && (amp < fMaxSignalTRU) ) {
862 0 : FillRawsData(kSigTRU,iTRU2x2Id, amp);
863 : // FillRawsData(kTimeTRU,iTRU2x2Id, time);
864 : }
865 : }
866 : // if (nPed > 0) {
867 : // for (Int_t i=0; i<nPed; i++) {
868 : // FillRawsData(kPedTRU,iTRU2x2Id, pedSamples[i]);
869 : // }
870 : // }
871 0 : }//end TRU
872 : // LED Mon
873 0 : else if ( in.IsLEDMonData() ) {
874 : // for LED Mon data, the mapping class holds the gain info in the Row variable
875 : // and the Strip number in the Column..
876 0 : Int_t gain = in.GetRow();
877 0 : Int_t stripId = iSM*nStripsPerSM + in.GetColumn();
878 :
879 0 : if ( gain == 0 ) {
880 0 : nTotalSMLGLEDMon[iSM]++;
881 0 : if ( (amp > fMinSignalLGLEDMon) && (amp < fMaxSignalLGLEDMon) ) {
882 0 : FillRawsData(kSigLGLEDMon,stripId, amp);
883 0 : FillRawsData(kTimeLGLEDMon,stripId, time);
884 : }
885 0 : if (nPed > 0) {
886 0 : for (Int_t i=0; i<nPed; i++) {
887 0 : FillRawsData(kPedLGLEDMon,stripId, pedSamples[i]);
888 : }
889 0 : }
890 : } // gain==0
891 0 : else if ( gain == 1 ) {
892 0 : nTotalSMHGLEDMon[iSM]++;
893 0 : if ( (amp > fMinSignalHGLEDMon) && (amp < fMaxSignalHGLEDMon) ) {
894 0 : FillRawsData(kSigHGLEDMon,stripId, amp);
895 0 : FillRawsData(kTimeHGLEDMon,stripId, time);
896 : }
897 0 : if (nPed > 0) {
898 0 : for (Int_t i=0; i<nPed; i++) {
899 0 : FillRawsData(kPedHGLEDMon,stripId, pedSamples[i]);
900 : }
901 0 : }//nPed>0
902 : } // low or high gain
903 0 : } // LEDMon
904 0 : } // SM index OK
905 0 : } // nsamples>0 check, some data found for this channel; not only trailer/header
906 0 : }// end while over channel
907 : }// end while over DDL's, of input stream
908 :
909 : /***************/
910 : //Filling histograms for TRUL0IdData
911 0 : Int_t AbsFastORId=-1;
912 0 : Int_t AbsFastORIndexesIn4x4Patch[4]={-1};
913 : Int_t AbsFastORFirstIndexIn4x4Patch;
914 0 : Int_t globTRUCol, globTRURow;
915 :
916 : bool worry=false;
917 0 : for(int k=0; k < nTotTRUs; k++){
918 0 : for(int h=0; h < maxNumL0PatchesPerTRU; h++){
919 : //printf("ciao: iTRU %d\tiPatchinTRU %d\t number of fired patches: %d\n",k,h,timeOfFiredPatches[k][h].size());
920 0 : if(timeOfFiredPatches[k][h].size()==0) continue;
921 : else{ //Run 1 or 2x2PatchModeON L0Channels = modules in TRU
922 : Int_t maxTsample=-1, minTsample=20;
923 : Float_t rms=0.;
924 0 : if(is2x2PatchModeActive || !(fGeom->GetEMCGeometry()->GetGeoName().Contains("DCAL"))){
925 0 : if(fGeom->GetAbsFastORIndexFromTRU(k, h, AbsFastORId)){
926 0 : fGeom->GetPositionInEMCALFromAbsFastORIndex(AbsFastORId, globTRUCol, globTRURow);
927 0 : for(int s=0; s<timeOfFiredPatches[k][h].size(); s++){
928 0 : FillRawsData(kNL0TRU, globTRUCol, globTRURow);
929 0 : FillRawsData(kTimeL0TRU, globTRUCol, globTRURow, timeOfFiredPatches[k][h].at(s));
930 :
931 0 : rms+=timeOfFiredPatches[k][h].at(s)*timeOfFiredPatches[k][h].at(s);
932 :
933 0 : if(timeOfFiredPatches[k][h].at(s)>maxTsample) maxTsample= timeOfFiredPatches[k][h].at(s);
934 0 : if(timeOfFiredPatches[k][h].at(s)<minTsample) minTsample= timeOfFiredPatches[k][h].at(s);
935 :
936 0 : triggers[AbsFastORId][startBins[k][h].at(s)] = 1;
937 : }
938 0 : FillRawsData(kNL0TRUSamples, globTRUCol, globTRURow,timeOfFiredPatches[k][h].size());
939 : //FillRawsData(kNL0TRURMS,globTRURow*48+globTRUCol,maxTsample-minTsample);
940 : //printf("rms calculated with SQRT(sum of times^2 / Ntimes samples) %f\n",TMath::Sqrt(rms/timeOfFiredPatches[k][h].size()));
941 0 : FillRawsData(kNL0TRURMS,globTRURow*48+globTRUCol,TMath::Sqrt(rms/timeOfFiredPatches[k][h].size()));
942 : }
943 0 : else continue;
944 : }
945 : else{ //Run2 default L0Channels = 4x4 towers patches = 2x2 modules in TRU
946 0 : if(fGeom->GetFastORIndexFromL0Index(k, h, AbsFastORIndexesIn4x4Patch, 4)){
947 0 : for(int i=0;i<4;i++)
948 : //printf("AbsID = %d of the %d module in the %d Patch of the %d TRU\n",AbsFastORIndexesIn4x4Patch[i],i,h,k);
949 0 : AbsFastORFirstIndexIn4x4Patch=AbsFastORIndexesIn4x4Patch[0];
950 0 : fGeom->GetPositionInEMCALFromAbsFastORIndex(AbsFastORFirstIndexIn4x4Patch, globTRUCol, globTRURow);
951 : //printf("TRU: %d \t PatchIndex:%d \t number of times for the fired patch: %d\n",k,h,timeOfFiredPatches[k][h].size());
952 : //printf("First Index %d of the 4 modules making the patch\n", AbsFastORFirstIndexIn4x4Patch);
953 0 : for(int s=0; s<timeOfFiredPatches[k][h].size(); s++){
954 : //printf("%d time the patch has been fired and time: %d\n",s+1,timeOfFiredPatches[k][h].at(s));
955 0 : rms+=timeOfFiredPatches[k][h].at(s)*timeOfFiredPatches[k][h].at(s);
956 0 : if(timeOfFiredPatches[k][h].at(s)>maxTsample) maxTsample= timeOfFiredPatches[k][h].at(s);
957 0 : if(timeOfFiredPatches[k][h].at(s)<minTsample) minTsample= timeOfFiredPatches[k][h].at(s);
958 :
959 0 : FillRawsData(kNL0TRU, globTRUCol, globTRURow);
960 0 : FillRawsData(kTimeL0TRU, globTRUCol, globTRURow, timeOfFiredPatches[k][h].at(s));
961 0 : triggers[AbsFastORFirstIndexIn4x4Patch][startBins[k][h].at(s)] = 1;
962 : }//number of times each module in a patch has fired the trigger
963 0 : FillRawsData(kNL0TRUSamples, globTRUCol, globTRURow,timeOfFiredPatches[k][h].size());
964 : //FillRawsData(kNL0TRURMS,globTRURow*48+globTRUCol,maxTsample-minTsample);
965 : //printf("rms calculated with SQRT(sum of times^2 / Ntimes samples) %f\n",TMath::Sqrt(rms/timeOfFiredPatches[k][h].size()));
966 : // printf("\tfilling the bin %d with this value \n",globTRURow*48+globTRUCol);
967 0 : FillRawsData(kNL0TRURMS,globTRURow*48+globTRUCol,TMath::Sqrt(rms/timeOfFiredPatches[k][h].size()));
968 : }//position of the patch FOUND!
969 : else
970 0 : continue;
971 : }//check which kind of patch has been SELECTED
972 0 : }//the patch "h" in TRU "k" has been fired
973 :
974 : }//loop over the max number of AVAILABLE patches per TRU
975 : }//loop on nTotTRUs (Run1 or Run2)
976 :
977 : /***************/
978 : // filling some L0 trigger histos
979 0 : if( firstL0TimeBin < 999 ){
980 0 : for(Int_t i = 0; i < nTot2x2; i++) {
981 0 : if( triggers[i][firstL0TimeBin] > 0 ) {
982 : // histo->Fill(i,j);
983 0 : FillRawsData(kNL0FirstTRU, i);
984 0 : FillRawsData(kTimeL0FirstTRU, i, firstL0TimeBin);
985 : }
986 : }
987 0 : }
988 :
989 : // calculate the ratio of the amplitude and fill the histograms, only if the events type is Calib
990 : // RS: operation on the group of histos kSigHG,k2DRatioAmp,kRatioDist,kLEDMonRatio,kLEDMonRatio,kSigLGLEDMon
991 : const int hGrp[] = {kSigHG,k2DRatioAmp,kRatioDist,kLEDMonRatio,kLEDMonRatioDist,kSigLGLEDMon};
992 0 : if ( rawReader->GetType() == AliRawEventHeaderBase::kCalibrationEvent &&
993 0 : CheckCloningConsistency(fRawsQAList, hGrp, sizeof(hGrp)/sizeof(int)) ) { // RS converting original code to loop over all matching triggers
994 0 : int nTrig =IsClonedPerTrigClass(kSigHG,fRawsQAList) ? GetNEventTrigClasses() : 0; // loop over triggers only if histos were cloned
995 : //
996 0 : for (int itr=-1;itr<nTrig;itr++) { // start from -1 to acknowledge original histos if they were kept
997 0 : TObjArray* trArr = GetMatchingRawsHistosSet(hGrp, sizeof(hGrp)/sizeof(int) ,itr);
998 0 : if (!trArr) continue; // no histos for current trigger
999 : //
1000 : Double_t binContent = 0.;
1001 0 : TProfile* prSigHG = (TProfile *)trArr->At(0); // kSigHG
1002 0 : TH1* th2DRatioAmp = (TH1*) trArr->At(1); // k2DRatioAmp
1003 0 : TH1* thRatioDist = (TH1*) trArr->At(2); // kRatioDist
1004 0 : TH1* thLEDMonRatio = (TH1*) trArr->At(3); // kLEDMonRatio
1005 0 : TH1* thLEDMonRatioDist = (TH1*) trArr->At(4); // kLEDMonRatio
1006 0 : TH1* hSigLGLEDMon = (TH1*) trArr->At(5); // kSigLGLEDMon
1007 0 : th2DRatioAmp->Reset("ICE");
1008 0 : thRatioDist->Reset("ICE");
1009 0 : thLEDMonRatio->Reset("ICE");
1010 0 : thLEDMonRatioDist->Reset("ICE");
1011 0 : th2DRatioAmp->ResetStats();
1012 0 : thRatioDist->ResetStats();
1013 0 : thLEDMonRatio->ResetStats();
1014 0 : thLEDMonRatioDist->ResetStats();
1015 :
1016 0 : ConvertProfile2H(prSigHG, fHighEmcHistoH2F);
1017 : //
1018 0 : for(Int_t ix = 1; ix <= fHighEmcHistoH2F->GetNbinsX(); ix++) {
1019 0 : for(Int_t iy = 1; iy <= fHighEmcHistoH2F->GetNbinsY(); iy++) {
1020 :
1021 : // if(fCalibRefHistoH2F->GetBinContent(ix, iy)){
1022 :
1023 0 : binContent = fHighEmcHistoH2F->GetBinContent(ix, iy);// /fCalibRefHistoH2F->GetBinContent(ix, iy);
1024 : // }
1025 :
1026 0 : th2DRatioAmp->SetBinContent(ix, iy, binContent);
1027 0 : thRatioDist->Fill(binContent);
1028 : }
1029 : }
1030 : //
1031 : // Now for LED monitor system, to calculate the ratio as well
1032 : Double_t binError = 0. ;
1033 : // For the binError, we add the relative errors, squared
1034 : Double_t relativeErrorSqr = 0. ;
1035 : //
1036 0 : for(int ib = 1; ib <= fLEDMonRefHistoPro->GetNbinsX(); ib++) {
1037 : //
1038 0 : if(fLEDMonRefHistoPro->GetBinContent(ib) != 0) {
1039 0 : binContent = hSigLGLEDMon->GetBinContent(ib) / fLEDMonRefHistoPro->GetBinContent(ib);
1040 0 : relativeErrorSqr = TMath::Power( (fLEDMonRefHistoPro->GetBinError(ib) / fLEDMonRefHistoPro->GetBinContent(ib)), 2);
1041 0 : if( hSigLGLEDMon->GetBinContent(ib) != 0) {
1042 0 : relativeErrorSqr += TMath::Power( (hSigLGLEDMon->GetBinError(ib)/hSigLGLEDMon->GetBinContent(ib)), 2);
1043 0 : }
1044 : }
1045 : else { // ref. run info is zero
1046 : binContent = -1;
1047 : relativeErrorSqr = 1;
1048 : }
1049 0 : thLEDMonRatio->SetBinContent(ib, binContent);
1050 :
1051 0 : binError = sqrt(relativeErrorSqr) * binContent;
1052 0 : thLEDMonRatio->SetBinError(ib, binError);
1053 0 : thLEDMonRatioDist->Fill(thLEDMonRatio->GetBinContent(ib));
1054 : }
1055 0 : } // loop over eventual trigger clones
1056 0 : }
1057 : // let's also fill the SM and event counter histograms
1058 : Int_t nTotalHG = 0;
1059 : Int_t nTotalLG = 0;
1060 : Int_t nTotalTRU = 0;
1061 : Int_t nTotalHGLEDMon = 0;
1062 : Int_t nTotalLGLEDMon = 0;
1063 0 : for (iSM=0; iSM<fSuperModules; iSM++) {
1064 0 : nTotalLG += nTotalSMLG[iSM];
1065 0 : nTotalHG += nTotalSMHG[iSM];
1066 0 : nTotalTRU += nTotalSMTRU[iSM];
1067 0 : nTotalLGLEDMon += nTotalSMLGLEDMon[iSM];
1068 0 : nTotalHGLEDMon += nTotalSMHGLEDMon[iSM];
1069 0 : FillRawsData(kNsmodLG,iSM, nTotalSMLG[iSM]);
1070 0 : FillRawsData(kNsmodHG,iSM, nTotalSMHG[iSM]);
1071 0 : FillRawsData(kNsmodTRU,iSM, nTotalSMTRU[iSM]);
1072 0 : FillRawsData(kNsmodLGLEDMon,iSM, nTotalSMLGLEDMon[iSM]);
1073 0 : FillRawsData(kNsmodHGLEDMon,iSM, nTotalSMHGLEDMon[iSM]);
1074 : }
1075 :
1076 0 : FillRawsData(kNtotLG,nTotalLG);
1077 0 : FillRawsData(kNtotHG,nTotalHG);
1078 0 : FillRawsData(kNtotTRU,nTotalTRU);
1079 0 : FillRawsData(kNtotLGLEDMon,nTotalLGLEDMon);
1080 0 : FillRawsData(kNtotHGLEDMon,nTotalHGLEDMon);
1081 :
1082 : //Last TRUL0 histogram to be filled with RMSs per channel, so AFTER all Channels hav been read
1083 :
1084 :
1085 0 : IncEvCountCycleESDs();
1086 0 : IncEvCountTotalESDs();
1087 0 : SetEventSpecie(saveSpecie) ;
1088 :
1089 0 : MakeRawsSTU(rawReader);
1090 :
1091 : // just in case the next rawreader consumer forgets to reset; let's do it here again..
1092 0 : rawReader->Reset() ;
1093 : return;
1094 0 : }
1095 :
1096 : //____________________________________________________________________________
1097 : ///
1098 : /// Make data from Digits.
1099 : ///
1100 : void AliEMCALQADataMakerRec::MakeDigits()
1101 : {
1102 0 : FillDigitsData(1,fDigitsArray->GetEntriesFast()) ;
1103 0 : TIter next(fDigitsArray) ;
1104 : AliEMCALDigit * digit ;
1105 0 : while ( (digit = dynamic_cast<AliEMCALDigit *>(next())) ) {
1106 0 : FillDigitsData(0, digit->GetAmplitude()) ;
1107 : }
1108 : //
1109 0 : }
1110 :
1111 : //____________________________________________________________________________
1112 : ///
1113 : /// Make data from Digit Tree.
1114 : ///
1115 : /// \param digitTree: TTree
1116 : ///
1117 : void AliEMCALQADataMakerRec::MakeDigits(TTree * digitTree)
1118 : {
1119 : // makes data from Digit Tree
1120 : // RS: Attention: the counters are increments in the MakeDigits()
1121 0 : if (fDigitsArray)
1122 0 : fDigitsArray->Clear("C") ;
1123 : else
1124 0 : fDigitsArray = new TClonesArray("AliEMCALDigit", 1000) ;
1125 :
1126 0 : TBranch * branch = digitTree->GetBranch("EMCAL") ;
1127 0 : if ( ! branch ) { AliWarning("EMCAL branch in Digit Tree not found"); return; }
1128 : //
1129 0 : branch->SetAddress(&fDigitsArray) ;
1130 0 : branch->GetEntry(0) ;
1131 0 : MakeDigits() ;
1132 : //
1133 0 : IncEvCountCycleDigits();
1134 0 : IncEvCountTotalDigits();
1135 : //
1136 0 : }
1137 :
1138 : //____________________________________________________________________________
1139 : ///
1140 : /// Make data from RecPoints.
1141 : ///
1142 : /// \param clustersTree: TTree
1143 : ///
1144 : void AliEMCALQADataMakerRec::MakeRecPoints(TTree * clustersTree)
1145 : {
1146 0 : TBranch *emcbranch = clustersTree->GetBranch("EMCALECARP");
1147 0 : if (!emcbranch) {
1148 0 : AliError("can't get the branch with the EMCAL clusters !");
1149 0 : return;
1150 : }
1151 :
1152 0 : TObjArray * emcRecPoints = new TObjArray(100) ;
1153 0 : emcbranch->SetAddress(&emcRecPoints);
1154 0 : emcbranch->GetEntry(0);
1155 :
1156 0 : FillRecPointsData(kRecPM,emcRecPoints->GetEntriesFast()) ;
1157 0 : TIter next(emcRecPoints) ;
1158 : AliEMCALRecPoint * rp ;
1159 0 : while ( (rp = dynamic_cast<AliEMCALRecPoint *>(next())) ) {
1160 0 : FillRecPointsData(kRecPE,rp->GetEnergy()) ;
1161 0 : FillRecPointsData(kRecPDigM,rp->GetMultiplicity());
1162 : }
1163 0 : emcRecPoints->Delete();
1164 0 : delete emcRecPoints;
1165 0 : IncEvCountCycleRecPoints();
1166 0 : IncEvCountTotalRecPoints();
1167 0 : }
1168 :
1169 : //____________________________________________________________________________
1170 : ///
1171 : /// Detector specific actions at start of cycle.
1172 : ///
1173 : void AliEMCALQADataMakerRec::StartOfDetectorCycle()
1174 : {
1175 :
1176 0 : }
1177 :
1178 : //____________________________________________________________________________
1179 : ///
1180 : /// Set fitting algorithm and initialize it if this same algorithm was not set before.
1181 : ///
1182 : /// \param fitAlgo: kind of fitting algorithm
1183 : ///
1184 : void AliEMCALQADataMakerRec::SetFittingAlgorithm(Int_t fitAlgo)
1185 : {
1186 4 : fFittingAlgorithm = fitAlgo; // Not sure we need this
1187 :
1188 2 : fRawAnalyzer = AliCaloRawAnalyzerFactory::CreateAnalyzer(fitAlgo);
1189 :
1190 : // Init also here the TRU algo, even if it is fixed type.
1191 2 : fRawAnalyzerTRU = AliCaloRawAnalyzerFactory::CreateAnalyzer(Algo::kFakeAltro);
1192 2 : fRawAnalyzerTRU->SetFixTau(kTRUE);
1193 2 : fRawAnalyzerTRU->SetTau(2.5); // default for TRU shaper
1194 2 : }
1195 :
1196 : //_____________________________________________________________________________________
1197 : ///
1198 : /// Convert TProfile to TH2
1199 : ///
1200 : /// \param p: TProfile
1201 : /// \param histo: TH2 histogram
1202 : ///
1203 : void AliEMCALQADataMakerRec::ConvertProfile2H(TProfile * p, TH2 * histo)
1204 : {
1205 : // reset histogram
1206 0 : histo->Reset("ICE") ;
1207 0 : histo->ResetStats();
1208 :
1209 0 : Int_t nbinsProf = p->GetNbinsX();
1210 :
1211 : // loop through the TProfile p and fill the TH2F histo
1212 : Double_t binContent = 0;
1213 : Int_t towerNum = 0; // global tower Id
1214 : // i = 0; // tower Id within SuperModule
1215 : Int_t iSM=0;
1216 : Int_t iSMSide = 0; // 0=A, 1=C side
1217 : Int_t iSMSector = 0; // 2 SM's per sector
1218 : // indices for 2D plots
1219 : Int_t col2d = 0;
1220 : Int_t row2d = 0;
1221 : Int_t kEMCALRows = 24; // TOWERs nRows
1222 : Int_t kEMCALCols = 48; // TOWERs nCols
1223 : Int_t kEMCALTowersPerSM = kEMCALRows * kEMCALCols; // nTOWERS in SM
1224 :
1225 0 : for (Int_t ibin = 1; ibin <= nbinsProf; ibin++)
1226 : {
1227 0 : towerNum = (Int_t) p->GetBinCenter(ibin);
1228 0 : binContent = p->GetBinContent(ibin);
1229 :
1230 0 : if(towerNum<11520){
1231 0 : iSM = towerNum/(kEMCALTowersPerSM);
1232 0 : col2d = (towerNum/kEMCALRows) % kEMCALCols;
1233 0 : row2d = towerNum % kEMCALRows;
1234 0 : }
1235 0 : else if(towerNum>11519 && towerNum<12288){
1236 0 : iSM = 10 + (towerNum-11520)/(kEMCALTowersPerSM/3);//for the 10th SM the second part returns 0 (division between integers)
1237 0 : col2d = ((towerNum-11520)/(kEMCALRows/3)) % kEMCALCols;
1238 0 : row2d = (towerNum-11520) % (kEMCALRows/3);
1239 0 : }
1240 0 : else if(towerNum>12287 && towerNum<19200){
1241 0 : iSM = 12 + (towerNum-12288)/(kEMCALTowersPerSM);//for the 12th SM the second part return 0 (division between integers)
1242 0 : col2d = ((towerNum-12288)/kEMCALRows) % kEMCALCols;
1243 0 : row2d = (towerNum-12288) % kEMCALRows;
1244 0 : }
1245 : else{ //10 EMCAL_FULL + 2 EMCAL_1/3 + 6 DCAL_FULL
1246 0 : iSM = 18 + (towerNum-19200)/(kEMCALTowersPerSM/3); //for the 18th SM the second part return 0 (division between integers)
1247 0 : col2d = ((towerNum-19200)/(kEMCALRows/3)) % kEMCALCols;
1248 0 : row2d = (towerNum-19200) % (kEMCALRows/3);
1249 : }
1250 :
1251 0 : iSMSector = iSM / 2;
1252 0 : iSMSide = iSM % 2;
1253 0 : if (iSMSide == 1) // C side, shown to the right
1254 0 : col2d += kEMCALCols;
1255 :
1256 0 : if (towerNum>=0 && towerNum<12288)//EMCAL (FULL and 1/3 SM)
1257 0 : row2d += iSMSector *kEMCALRows;
1258 0 : else if (towerNum>12287 && towerNum<19968)//DCAL = EMCAL Offset (120+8) + Offset in DCAL Sectors (here they continue from 6, not 9)
1259 0 : row2d += 5*kEMCALRows + (kEMCALRows/3) + (iSMSector-6)*kEMCALRows;
1260 :
1261 0 : histo->SetBinContent(col2d+1, row2d+1, binContent);
1262 : }
1263 0 : }
1264 :
1265 : /*
1266 : //____________________________________________________________________________
1267 : ///
1268 : /// Transform local to global indices.
1269 : ///
1270 : /// \param globRow = global row index
1271 : /// \param globColumn = global column index
1272 : /// \param module = number of the module
1273 : /// \param ddl = number of the ddl
1274 : /// \param branch = number of the branch
1275 : /// \param column = number of module column inside the TRU
1276 : ///
1277 : void AliEMCALQADataMakerRec::GetTruChannelPosition( Int_t &globRow, Int_t &globColumn, Int_t module, Int_t ddl, Int_t branch, Int_t column ) const
1278 : { // I THINK THIS WHOLE METHOD SHOULD BE CHANGED BUT NEED THE TRU SCHEME!
1279 : Int_t mrow;
1280 : Int_t mcol;
1281 : Int_t trow;
1282 : Int_t tcol;
1283 : Int_t drow;
1284 : Int_t rcu;
1285 : // RCU 0 or 1
1286 : rcu = ddl % 2;
1287 :
1288 : // 12 rows of 2x2s in a module (3 TRUs by 4 rows)
1289 : mrow = (module/2) * 12;
1290 : // 24 columns per module, odd module numbers increased by 24
1291 : mcol = (module%2) * 24;
1292 :
1293 : // position within TRU coordinates
1294 : tcol = column / 4;
1295 : trow = column % 4;
1296 :
1297 : // .combine
1298 : if( module%2 == 0 ){ // A side
1299 : // mirror rows
1300 : trow = 3 - trow;
1301 :
1302 : // TRU in module row addition
1303 : drow = (rcu*branch+rcu) * 4;
1304 :
1305 : }
1306 : else{ // C side
1307 : // mirror columns
1308 : tcol = 23 - tcol;
1309 :
1310 : // TRU in module row addition
1311 : drow = (2 - (rcu*branch+rcu)) * 4;
1312 : }
1313 :
1314 : // output global row/collumn position (0,0 = SMA0, phi = 0, |eta| = max)
1315 : globRow = mrow + drow + trow;
1316 : globColumn = mcol + tcol;
1317 : }
1318 :
1319 : // ____________________________________________________________________________
1320 : ///
1321 : /// Create the Raw STU histograms.
1322 : ///
1323 : /// \param AliRawReader
1324 : ///
1325 : void AliEMCALQADataMakerRec::MakeRawsSTU(AliRawReader* rawReader)
1326 : { // STU specifics
1327 : AliEMCALTriggerSTURawStream* inSTU = new AliEMCALTriggerSTURawStream(rawReader);
1328 : Int_t iEMCALtrig[AliEMCALTriggerMappingV2::fSTURegionNEta][AliEMCALTriggerMappingV2::fSTURegionNPhi]={{0}};
1329 :
1330 : for(int dete=0; dete<2; dete++){
1331 : if(dete==0){
1332 : rawReader->Reset();
1333 : rawReader->Select("EMCAL",AliDAQ::GetFirstSTUDDL(),AliDAQ::GetFirstSTUDDL());
1334 : }
1335 : else{
1336 : rawReader->Reset();
1337 : rawReader->Select("DCAL",AliDAQ::GetLastSTUDDL(),AliDAQ::GetLastSTUDDL());
1338 : }
1339 : printf("detector = %d \n",dete);
1340 : Int_t h=0; //helper for TRU-STU conversion
1341 : // L1 segmentation
1342 : Int_t sizeL1gsubr = 1;
1343 : Int_t sizeL1gpatch = 2;
1344 : Int_t sizeL1jsubr = 4;
1345 :
1346 : if (inSTU->ReadPayLoad()){
1347 : Int_t fw = inSTU->GetFwVersion();
1348 : Int_t sizeL1jpatch = 2+(fw >> 16);
1349 : printf("Firmware= 0x%x \t sizeL1jetpatch= %d \n",fw,sizeL1jpatch);
1350 :
1351 : Long64_t mask = inSTU->GetFrameReceived() ^ inSTU->GetRegionEnable();
1352 :
1353 : //32 STU for EMCAL and 14 for DCAL
1354 : printf("max number of STu for detector %d = %d\n",dete,(dete==0) ? 32 : 14);
1355 :
1356 : for (int i = 0; i < (dete==0) ? 32 : 14; i++)
1357 : {
1358 : if (!((mask >> i) & 0x1)) FillRawsData(kSTUTRU, i);
1359 : }
1360 :
1361 : // V0 signal in STU
1362 : Int_t iV0Sig = inSTU->GetV0A()+inSTU->GetV0C();
1363 : for (int i = 0; i < (dete==0) ? 32 : 14; i++)
1364 : {
1365 : printf("current STU : %d\n",i);
1366 : UInt_t adc[96];
1367 : for (Int_t j = 0; j < AliEMCALTriggerMappingV2::fNModulesInTRU; j++) adc[j] = 0;
1368 :
1369 : inSTU->GetADC(i, adc);
1370 : Int_t iTRU = fGeom->GetTRUIndexFromSTUIndex(h,dete);
1371 :
1372 : for (Int_t j = 0; j < AliEMCALTriggerMappingV2::fNModulesInTRU; j++)
1373 : {
1374 : Int_t idx;
1375 : fGeom->GetAbsFastORIndexFromTRU(iTRU, j, idx);// CHANGE WITH TRIGGERMAPPINGV2 METHOD
1376 :
1377 : Int_t px, py;
1378 : fGeom->GetPositionInEMCALFromAbsFastORIndex(idx, px, py); // CHANGE WITH TRIGGERMAPPINGV2 METHOD
1379 :
1380 : iEMCALtrig[px][py] = adc[j];
1381 : }
1382 : }
1383 :
1384 : // L1 Gamma patches
1385 : Int_t iTRUSTU, x, y, etaG, phiG;
1386 : printf("Number of High Threshold Gamma patches for Detector %d : %d\n", dete, inSTU->GetNL1GammaPatch(0));
1387 : for(Int_t i = 0; i < inSTU->GetNL1GammaPatch(0); i++)
1388 : {
1389 : etaG=0, phiG=0;
1390 : if (inSTU->GetL1GammaPatch(i, 0, iTRUSTU, x, y)) // col (0..7), row (0..11)
1391 : {
1392 : Int_t iTRU,id;
1393 :
1394 : iTRU = fGeom->GetTRUIndexFromSTUIndex(iTRUSTU,dete);
1395 :
1396 : if(!fGeom->GetAbsFastORIndexFromPositionInTRU(iTRU, x, y, id))continue;
1397 :
1398 : if(!(fGeom->GetPositionInEMCALFromAbsFastORIndex( id, etaG, phiG ))) continue;
1399 : else{
1400 : // Position of patch L1G (bottom-left FastOR of the patch)
1401 : //etaG = etaG - sizeL1gsubr * sizeL1gpatch + 1;
1402 : //phiG = phiG - sizeL1gsubr * sizeL1gpatch + 1;
1403 :
1404 : FillRawsData(kGL1, etaG, phiG);
1405 : Int_t iL1GPatchAmp = 0;
1406 : for(Int_t L1Gx = 0; L1Gx < sizeL1gpatch; L1Gx ++)
1407 : {
1408 : for(Int_t L1Gy = 0; L1Gy < sizeL1gpatch; L1Gy ++)
1409 : {
1410 : if (((etaG-L1Gx)> 0 && (etaG+L1Gx) < AliEMCALTriggerMappingV2::fSTURegionNEta) &&
1411 : ((phiG-L1Gy)>0 && (phiG+L1Gy) < AliEMCALTriggerMappingV2::fSTURegionNPhi))
1412 : iL1GPatchAmp += iEMCALtrig[etaG+L1Gx][phiG+L1Gy];
1413 : }
1414 : }
1415 : FillRawsData(kGL1V0, iV0Sig, iL1GPatchAmp);
1416 : }
1417 : }
1418 : }
1419 :
1420 : // L1 Jet patches
1421 : printf("Number of High Threshold Gamma patches for Detector %d : %d\n", dete, inSTU->GetNL1JetPatch(0));
1422 :
1423 : for (Int_t i = 0; i < inSTU->GetNL1JetPatch(0); i++)
1424 : {
1425 : if(inSTU->GetL1JetPatch(i, 0, x, y)) // / col (0,15), row (0,11)
1426 : {
1427 : //GetPositionInEMCALFrom Something that crosses the TRU boundaries.
1428 : //NEED To know how JET PATCHES ARE COMPUTED AND STORED.
1429 :
1430 : Int_t etaJ = x;
1431 : Int_t phiJ = y;
1432 :
1433 : //Int_t etaJ = sizeL1jsubr * (11-y-sizeL1jpatch + 1); // CHECK THIS FOR JETS
1434 : //64 EMCAL rows offset when reading DCAL patches
1435 : //Int_t phiJ = AliEMCALGeoParams::fgkEMCALSTURows*dete + sizeL1jsubr * (15-x-sizeL1jpatch + 1);
1436 :
1437 : // position of patch L1J (FOR bottom-left)
1438 : FillRawsData(kJL1, x,y);
1439 :
1440 : // loop the sum aplitude of FOR in the jet patch
1441 : Int_t iL1JPatchAmp = 0;
1442 : for (Int_t L1Jx = 0; L1Jx < sizeL1jpatch*4; L1Jx ++)
1443 : {
1444 : for (Int_t L1Jy = 0; L1Jy < sizeL1jpatch*4; L1Jy ++)
1445 : {
1446 : if (etaJ+L1Jx < AliEMCALTriggerMappingV2::fSTURegionNEta && phiJ+L1Jy < AliEMCALTriggerMappingV2::fSTURegionNPhi)
1447 : iL1JPatchAmp += iEMCALtrig[etaJ+L1Jx][phiJ+L1Jy];
1448 : }
1449 : }
1450 : // cout << "L1J amp =" << iL1JPatchAmp << endl;
1451 : FillRawsData(kJL1V0, iV0Sig, iL1JPatchAmp);
1452 : }//end-if
1453 : }//end patches loop
1454 : delete inSTU;
1455 : }//end inSTU->ReadPayload()
1456 : }//end detector loop
1457 :
1458 : // Fill FOR amplitude histo
1459 : for (Int_t i = 0; i < AliEMCALTriggerMappingV2::fSTURegionNEta; i++)
1460 : {
1461 : for (Int_t j = 0; j < AliEMCALTriggerMappingV2::fSTURegionNPhi; j++)
1462 : {
1463 : if (iEMCALtrig[i][j] != 0) FillRawsData(kAmpL1, i, j, iEMCALtrig[i][j]);
1464 : }
1465 : }
1466 : }
1467 : */
1468 :
1469 : // ____________________________________________________________________________
1470 : ///
1471 : /// Create the Raw STU histograms.
1472 : ///
1473 : /// \param rawReader: AliRawReaded
1474 : ///
1475 : void AliEMCALQADataMakerRec::MakeRawsSTU(AliRawReader* rawReader)
1476 : { // STU specifics
1477 : Int_t h=0; //helper for TRU-STU conversion
1478 : // L1 segmentation
1479 : // !!!! IMPORTANT THESE ARE in units of MODULES (2*2 towers) !!!!
1480 : Int_t sizeL1gsubr = 1;
1481 : Int_t sizeL1gpatch = 2;
1482 : Int_t sizeL1jsubr = 2;
1483 : Int_t sizeL1Jpatch, detPatchOffset, detPhiOffset;
1484 0 : for(int det=0;det<2;det++){
1485 : //printf("\n\n\n%d times inside the loop for detector",det);
1486 0 : if(det==0){
1487 0 : rawReader->Reset();
1488 0 : rawReader->Select("EMCAL",AliDAQ::GetFirstSTUDDL(),AliDAQ::GetFirstSTUDDL());
1489 : sizeL1Jpatch=2; //EMCAL 1 JetPatch = 4*4 subregions of 4x4 towers. = 4*4*2
1490 0 : }
1491 : else{
1492 : rawReader->Reset();
1493 0 : rawReader->Select("EMCAL",AliDAQ::GetLastSTUDDL(),AliDAQ::GetLastSTUDDL());
1494 : sizeL1Jpatch=1; //DCAL 1 JetPatch = 2*2 subregions of 4x4 towers= 2*2*1 * 4x4 towers.
1495 : }
1496 : detPhiOffset = AliEMCALGeoParams::fgkEMCALSTURows*det;
1497 0 : detPatchOffset = sizeL1jsubr*sizeL1jsubr*sizeL1Jpatch -1 ;
1498 : //Printf("detector : %c ", (det==0 ? 'E': 'D'));
1499 : //Printf("subregion %d patch %d detPatchOffset %d detphiOffset %d ", sizeL1jsubr,sizeL1Jpatch,detPatchOffset,detPhiOffset);
1500 0 : AliEMCALTriggerSTURawStream inSTU(rawReader);
1501 : // FOR DCAL
1502 0 : Int_t iEMCALtrig[AliEMCALTriggerMappingV2::fSTURegionNEta][AliEMCALTriggerMappingV2::fSTURegionNPhi]={{0}};
1503 : //memset(iEMCALtrig, 0, sizeof(int) * AliEMCALTriggerMappingV2::fSTURegionNEta * AliEMCALTriggerMappingV2::fSTURegionNPhi);
1504 : // Int_t iEMCALtrig[AliEMCALGeoParams::fgkEMCALSTUCols][AliEMCALGeoParams::fgkEMCALSTURows];
1505 : // memset(iEMCALtrig, 0, sizeof(int) * AliEMCALGeoParams::fgkEMCALSTUCols * AliEMCALGeoParams::fgkEMCALSTURows);
1506 :
1507 0 : if (inSTU.ReadPayLoad())
1508 : {
1509 : // Fw version (use in case of change in L1 jet
1510 0 : Int_t fw = inSTU.GetFwVersion();
1511 : //printf("\nFirmware value: 0x%x\n",fw);
1512 : //printf("Firmware masked 0xf000 = 0x%x\n",fw & 0xf000);
1513 0 : Int_t sizeL1jpatch = 2+(fw >> 16) ;
1514 : //Printf("sizeL1jetpatch : %d\n",sizeL1jpatch);
1515 : //Int_t sizeL1jpatch=sizeL1jpatchEta;
1516 : //Int_t sizeL1jpatchPhi ;
1517 :
1518 : //to be checked !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1519 : //printf("Firmware masked 0xf000 = 0x%x\n",fw & 0xf000);
1520 : /*
1521 : if(fw & 0xf000 == 0xb000){//EMCAL,same dimensions
1522 : sizeL1jpatchPhi=sizeL1jpatchEta;
1523 : }
1524 : else if(fw & 0xf000 == 0xd000){//DCAL,should be 16*10 //Let's see
1525 : sizeL1jpatchPhi= 10;
1526 : }
1527 : */
1528 :
1529 : // To check link
1530 0 : Long64_t mask = inSTU.GetFrameReceived() ^ inSTU.GetRegionEnable();
1531 :
1532 0 : for (int i = 0; i < AliEMCALTriggerMappingV2::fNTotalTRU; i++)
1533 : {
1534 0 : if (!((mask >> i) & 0x1)) FillRawsData(kSTUTRU, i);
1535 : }
1536 :
1537 : // V0 signal in STU
1538 0 : Int_t iV0Sig = inSTU.GetV0A()+inSTU.GetV0C();
1539 : // FastOR amplitude receive from TRU
1540 :
1541 0 : for (Int_t i = 0; i < (det==0 ? 32 : 14); i++)
1542 : {
1543 : // if(i==34 || i==35 || i==40 || i==41 || i==46 || i==47)continue;
1544 0 : UInt_t adc[96];
1545 0 : for (Int_t j = 0; j < 96; j++) adc[j] = 0;
1546 :
1547 : /* if(i>31) {
1548 : det=1; //Detector switch for STU (for TRUs EMCal and DCal are the same Detector
1549 : h=i-32; //General Offset DCAL STU / EMCAL+DCAL TRU
1550 : }
1551 : if(i>35) h=i-34; //1st row DCAL offset STU/TRU
1552 : if(i>41) h=i-36; //2nd row DCAL offset STU/TRU
1553 : if(i>47) h=i-38; //3rd row DCAL offset STU/TRU
1554 : */
1555 :
1556 0 : inSTU.GetADC(i, adc);
1557 0 : Int_t iTRU = fGeom->GetTRUIndexFromSTUIndex(i,det);
1558 :
1559 0 : for (Int_t j = 0; j < 96; j++)
1560 : {
1561 0 : Int_t idx;
1562 0 : if(fGeom->GetTriggerMappingVersion() == 1){
1563 0 : fGeom->GetAbsFastORIndexFromTRU(iTRU, j, idx);
1564 : } else {
1565 0 : Int_t jTRU = 0, jADC = 0;
1566 0 : fGeom->GetTRUFromSTU(i, j, jTRU, jADC, det);
1567 0 : fGeom->GetAbsFastORIndexFromTRU(jTRU, jADC, idx);
1568 0 : }
1569 :
1570 0 : Int_t px, py;
1571 0 : fGeom->GetPositionInEMCALFromAbsFastORIndex(idx, px, py);
1572 :
1573 0 : iEMCALtrig[px][py] = adc[j];
1574 0 : }
1575 0 : }
1576 :
1577 : // L1 Gamma patches
1578 0 : Int_t iTRUSTU, x, y,etaG,phiG;
1579 : //Printf("Gamma patches");
1580 : //for(detector=0; detector<2;detector++){ // 0 EMCAL , 1 DCAL
1581 : // printf("Number of L1GammaPatches high threshold: %d\n",inSTU.GetNL1GammaPatch(0) );
1582 0 : for(Int_t ithresh = 0; ithresh < 2; ithresh++)
1583 : {
1584 0 : for(Int_t i = 0; i < inSTU.GetNL1GammaPatch(ithresh); i++)
1585 : {
1586 0 : etaG=0,phiG=0;
1587 0 : if (inSTU.GetL1GammaPatch(i, ithresh, iTRUSTU, x, y)) // col (0..7), row (0..11)
1588 : {
1589 0 : Int_t iTRU, jTRU, id;
1590 :
1591 0 : if(fGeom->GetTriggerMappingVersion() == 1){
1592 0 : iTRU = fGeom->GetTRUIndexFromSTUIndex(iTRUSTU, det);
1593 0 : etaG = 23 - x;
1594 0 : phiG = y + 4 * int(iTRU / 2); // Position in EMCal frame
1595 0 : if (iTRU % 2) etaG += 24; // C side
1596 0 : etaG = etaG - 2;
1597 0 : } else {
1598 0 : if(!fGeom->GetTRUFromSTU(iTRUSTU, x, y, jTRU, etaG, phiG, det)) continue;
1599 : }
1600 :
1601 : // Position of patch L1G (bottom-left FastOR of the patch)
1602 : //Printf("position of the found patch (eta,phi)=([0,47],[0,63]) for EMCAL ([0,15]&&[32,47],[64,103]) for DCAL\t\t(%d,%d)",etaG,phiG);
1603 : // etaG = (etaG - sizeL1gsubr) * sizeL1gpatch + 1;
1604 : // phiG = (phiG - sizeL1gsubr) * sizeL1gpatch + 1;
1605 : //Printf("position of the found patch (eta,phi) AFTER CORRECTION FOR PATCH size\t\t(%d,%d)",etaG,phiG);
1606 0 : FillRawsData(kGL1, etaG, phiG);
1607 :
1608 : // New position in CALORIMETER!
1609 : // if (iTRU<30)
1610 : // Int_t phiG = 11 - y, etaG = x + 8 * int(iTRU/2); // position with new EMCAL TRU configuration !!check iTRU/2..
1611 : // else if ((iTRU>29 && iTRU<32) || (iTRU>43))
1612 : // Int_t etaG = 23 - x, phiG = y + 4 * int(iTRU/2); // position in EMCAL 1/3 SMs !!check iTRU/2
1613 : // else
1614 : // Int_t phiG = 11 - y, etaG = x + 8 * int(iTRU/2); // position in DCAL SMs !!!!Still have to check this!!!
1615 : // Int_t etaG = 23-x, phiG = y + 4 * int(iTRU/2); // position in EMCal
1616 : // if (iTRU%2) etaG += 24; // C-side// / NEED THE NEW TRU NUMBERING SCHEME !!!!!
1617 : // etaG = etaG - sizeL1gsubr * sizeL1gpatch + 1;
1618 :
1619 : // loop to sum amplitude of FOR in the gamma patch
1620 : Int_t iL1GPatchAmp = 0;
1621 0 : for(Int_t L1Gx = 0; L1Gx < sizeL1gpatch; L1Gx ++)
1622 : {
1623 0 : for(Int_t L1Gy = 0; L1Gy < sizeL1gpatch; L1Gy ++)
1624 : {
1625 0 : if (((etaG+L1Gx) < AliEMCALTriggerMappingV2::fSTURegionNEta) && ((phiG+L1Gy) < AliEMCALTriggerMappingV2::fSTURegionNPhi))
1626 0 : iL1GPatchAmp += iEMCALtrig[etaG+L1Gx][phiG+L1Gy];
1627 : // cout << iEMCALtrig[etaG+L1Gx][phiG+L1Gy] << endl;
1628 : }
1629 : }
1630 : // if (iL1GPatchAmp > 500) cout << "L1G amp =" << iL1GPatchAmp << endl;
1631 0 : FillRawsData(kGL1V0, iV0Sig, iL1GPatchAmp);
1632 0 : }
1633 : }
1634 : }
1635 : // L1 Jet patches
1636 : //for(detector=0; detector<2;detector++){ // 0 EMCAL , 1 DCAL
1637 : //printf("Number of L1JetPatches high threshold: %d\n",inSTU.GetNL1JetPatch(0) );
1638 0 : for(Int_t ithresh = 0; ithresh < 2; ++ithresh)
1639 : {
1640 0 : for (Int_t i = 0; i < inSTU.GetNL1JetPatch(ithresh); i++)
1641 : {
1642 0 : if(inSTU.GetL1JetPatch(i, ithresh, x, y)) // Position in patches units, should be the other way around (row, col)
1643 : {
1644 : //GetPositionInEMCALFrom Something that crosses the TRU boundaries.
1645 : Int_t etaJ, phiJ;
1646 0 : if (fGeom->GetTriggerMappingVersion() == 1) {
1647 0 : etaJ = 11 - y - sizeL1jpatch + 1;
1648 0 : phiJ = 15 - x - sizeL1jpatch + 1;
1649 0 : }
1650 : else {
1651 : etaJ = y;
1652 0 : phiJ = x;
1653 : }
1654 :
1655 0 : etaJ *= 4.;
1656 0 : phiJ *= 4.;
1657 :
1658 :
1659 : //NEED To know how JET PATCHES ARE COMPUTED AND STORED.
1660 : //printf("sizeL1jsubr %d\n",sizeL1jsubr);
1661 : //Printf("%dth patch in eta , %dth patch in phi",y , x);
1662 : //Int_t etaJ = y*sizeL1jsubr*sizeL1jsubr + detPatchOffset;
1663 : //Int_t etaJ = sizeL1jsubr * (10-y); // CHECK THIS FOR JETS
1664 : //64 EMCAL rows offset when reading DCAL patches
1665 : //Int_t phiJ = detPhiOffset + x*sizeL1jsubr*sizeL1jsubr + detPatchOffset;
1666 : //Printf("eta and phi EMCAL ([7,39],[7,55]) DCAL ([3,43],[67,99]) \t\t %d,%d\n\n",etaJ,phiJ);
1667 : //Int_t phiJ = AliEMCALGeoParams::fgkEMCALSTURows*det + sizeL1jsubr * ((det==0 ? 14 : 8) -x) ;
1668 : //printf("det %d JetPatch %d x and y for jet patch %d\t%d and etaJ and phiJ %d \t %d\n",det, i, x,y,etaJ, phiJ);
1669 : // position of patch L1J (FOR bottom-left)
1670 0 : FillRawsData(kJL1, etaJ +2, phiJ);
1671 :
1672 : // loop the sum aplitude of FOR in the jet patch
1673 : Int_t iL1JPatchAmp = 0;
1674 0 : for (Int_t L1Jx = 0; L1Jx < sizeL1jpatch*4; L1Jx ++)
1675 : {
1676 0 : for (Int_t L1Jy = 0; L1Jy < sizeL1jpatch*4; L1Jy ++)
1677 : {
1678 0 : if (etaJ+L1Jx < AliEMCALTriggerMappingV2::fSTURegionNEta && phiJ+L1Jy < AliEMCALTriggerMappingV2::fSTURegionNPhi)
1679 0 : iL1JPatchAmp += iEMCALtrig[etaJ+L1Jx][phiJ+L1Jy];
1680 : }
1681 : }
1682 :
1683 : // cout << "L1J amp =" << iL1JPatchAmp << endl;
1684 0 : FillRawsData(kJL1V0, iV0Sig, iL1JPatchAmp);
1685 0 : }//end-if
1686 : }//end patches loop
1687 : }//end detector loop
1688 0 : }//end inSTU.ReadPayload()
1689 :
1690 : // Fill FOR amplitude histo
1691 0 : for (Int_t i = 0; i < AliEMCALTriggerMappingV2::fSTURegionNEta; i++)
1692 : {
1693 0 : for (Int_t j = 0; j < AliEMCALTriggerMappingV2::fSTURegionNPhi; j++)
1694 : {
1695 0 : if (iEMCALtrig[i][j] != 0) FillRawsData(kAmpL1, i, j, iEMCALtrig[i][j]);
1696 : }
1697 : }
1698 :
1699 0 : }
1700 0 : }
1701 :
1702 :
|