Add more user oriented options to costumize the tender - Jiri
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALDigit.cxx
CommitLineData
61e0abb5 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
090026bf 16/* $Id$ */
61e0abb5 17
18//_________________________________________________________________________
ffa6d63b 19// EMCAL digit:
20// A Digit is the sum of the energy lost in an EMCAL Tower
21// It also stores information on Primary, and enterring particle
22// tracknumbers Digits are created using AliEMCALSDigitizer, followed
23// by AliEMCALDigitizer
61e0abb5 24//
ffa6d63b 25//*-- Author: Sahal Yacoob (LBL)
26// based on : AliPHOSDigit
814ad4bf 27//__________________________________________________________________________
61e0abb5 28
29// --- ROOT system ---
090026bf 30#include <Riostream.h>
31#include <TMath.h>
61e0abb5 32
33// --- Standard library ---
34
61e0abb5 35// --- AliRoot header files ---
36
37#include "AliEMCALDigit.h"
814ad4bf 38#include "AliEMCALGeometry.h"
a520bcd0 39#include "AliLog.h"
61e0abb5 40
41ClassImp(AliEMCALDigit)
42
43//____________________________________________________________________________
514da33c 44AliEMCALDigit::AliEMCALDigit() :
829ba234 45AliDigitNew(),
46 fAmpFloat(0.),
47 fNSamples(0),
48 fSamples(0x0),
49 fNSamplesHG(0),
50 fSamplesHG(0x0),
514da33c 51 fNprimary(0),
52 fNMaxPrimary(5),
53 fPrimary(0x0),
af5bdd85 54 fDEPrimary(0x0),
514da33c 55 fNiparent(0),
56 fNMaxiparent(5),
57 fIparent(0x0),
af5bdd85 58 fDEParent(0x0),
514da33c 59 fMaxIter(0),
60 fTime(0.),
829ba234 61 fTimeR(0.),
62 fChi2(0.),
63 fNDF(0),
8a84b948 64 fDigitType(kUnknown),
65 fAmpCalib(-1)
61e0abb5 66{
67 // default ctor
68
af5bdd85 69 // Need to initialise for reading old files
f4a4dc82 70 fPrimary = new Int_t[fNMaxPrimary] ;
af5bdd85 71 fDEPrimary = new Float_t[fNMaxPrimary] ;
f4a4dc82 72 fIparent = new Int_t[fNMaxiparent] ;
73 fDEParent = new Float_t[fNMaxiparent] ;
af5bdd85 74 for ( Int_t i = 0; i < fNMaxPrimary ; i++) {
f4a4dc82 75 fPrimary[i] = -1 ;
af5bdd85 76 fDEPrimary[i] = 0 ;
77 }
78
0ae8ae77 79 for ( Int_t i = 0; i < fNMaxiparent ; i++) {
f4a4dc82 80 fIparent[i] = -1 ;
af5bdd85 81 fDEParent[i] = 0 ;
82 }
61e0abb5 83}
84
85//____________________________________________________________________________
2cd0ffda 86AliEMCALDigit::AliEMCALDigit(Int_t primary, Int_t iparent, Int_t id, Float_t digEnergy, Float_t time, Int_t type, Int_t index, Float_t chi2, Int_t ndf, Float_t dE)
18a21c7c 87 : AliDigitNew(),
829ba234 88 fAmpFloat(digEnergy),
89 fNSamples(0),
f4a4dc82 90 fSamples(0x0),
829ba234 91 fNSamplesHG(0),
92 fSamplesHG(0x0),
18a21c7c 93 fNprimary(0),
94 fNMaxPrimary(25),
95 fPrimary(0x0),
af5bdd85 96 fDEPrimary(0x0),
18a21c7c 97 fNiparent(0),
98 fNMaxiparent(150),
99 fIparent(0x0),
af5bdd85 100 fDEParent(0x0),
18a21c7c 101 fMaxIter(5),
102 fTime(time),
829ba234 103 fTimeR(time),
2cd0ffda 104 fChi2(chi2),
105 fNDF(ndf),
8a84b948 106 fDigitType(type),
107 fAmpCalib(-1)
61e0abb5 108{
109 // ctor with all data
110
514da33c 111 // data memebrs of the base class (AliNewDigit)
829ba234 112 fAmp = 0;
514da33c 113 fId = id ;
114 fIndexInList = index ;
115
829ba234 116 // data member
f4a4dc82 117 fPrimary = new Int_t[fNMaxPrimary] ;
af5bdd85 118 fDEPrimary = new Float_t[fNMaxPrimary] ;
f4a4dc82 119 fIparent = new Int_t[fNMaxiparent] ;
120 fDEParent = new Float_t[fNMaxiparent] ;
61e0abb5 121 if( primary != -1){
122 fNprimary = 1 ;
7b62cd84 123 fPrimary[0] = primary ;
af5bdd85 124 fDEPrimary[0] = dE ;
61e0abb5 125 fNiparent = 1 ;
126 fIparent[0] = iparent ;
af5bdd85 127 fDEParent[0] = dE ;
128 }
61e0abb5 129 else{ //If the contribution of this primary smaller than fDigitThreshold (AliEMCALv1)
130 fNprimary = 0 ;
131 fPrimary[0] = -1 ;
af5bdd85 132 fDEPrimary[0] = 0 ;
61e0abb5 133 fNiparent = 0 ;
af5bdd85 134 fIparent[0] = -1 ;
135 fDEParent[0] = 0 ;
61e0abb5 136 }
137 Int_t i ;
af5bdd85 138 for ( i = 1; i < fNMaxPrimary ; i++) {
61e0abb5 139 fPrimary[i] = -1 ;
af5bdd85 140 fDEPrimary[i] = 0 ;
141 }
61e0abb5 142
af5bdd85 143 for ( i = 1; i< fNMaxiparent ; i++) {
f807c3bd 144 fIparent[i] = -1 ;
af5bdd85 145 fDEParent[i] = 0 ;
146 }
61e0abb5 147}
148
149//____________________________________________________________________________
18a21c7c 150AliEMCALDigit::AliEMCALDigit(const AliEMCALDigit & digit)
151 : AliDigitNew(digit),
f4a4dc82 152 fAmpFloat(digit.fAmpFloat),
153 fNSamples(digit.fNSamples),
e0dc3f7d 154 fSamples(),
829ba234 155 fNSamplesHG(digit.fNSamplesHG),
e0dc3f7d 156 fSamplesHG(),
18a21c7c 157 fNprimary(digit.fNprimary),
158 fNMaxPrimary(digit.fNMaxPrimary),
e0dc3f7d 159 fPrimary(),
160 fDEPrimary(),
18a21c7c 161 fNiparent(digit.fNiparent),
162 fNMaxiparent(digit.fNMaxiparent),
e0dc3f7d 163 fIparent(),
164 fDEParent(),
18a21c7c 165 fMaxIter(digit.fMaxIter),
166 fTime(digit.fTime),
829ba234 167 fTimeR(digit.fTimeR),
168 fChi2(digit.fChi2),
169 fNDF(digit.fNDF),
8a84b948 170 fDigitType(digit.fDigitType),
171 fAmpCalib(digit.fAmpCalib)
61e0abb5 172{
173 // copy ctor
514da33c 174 // data memebrs of the base class (AliNewDigit)
175 fAmp = digit.fAmp ;
176 fId = digit.fId;
177 fIndexInList = digit.fIndexInList ;
61e0abb5 178
829ba234 179 // data members
e0dc3f7d 180 if (fSamples ) delete [] fSamples ; fSamples = NULL ;
181 if (fSamplesHG ) delete [] fSamplesHG ; fSamplesHG = NULL ;
182 if (fPrimary ) delete [] fPrimary ; fPrimary = NULL ;
183 if (fDEPrimary) delete [] fDEPrimary ; fDEPrimary = NULL ;
184 if (fIparent ) delete [] fIparent ; fIparent = NULL ;
185 if (fDEParent) delete [] fDEParent ; fDEParent = NULL ;
186
187 if (fNSamples){
84f6f119 188 fSamples = new Int_t[fNSamples];
189 for (Int_t i=0; i < digit.fNSamples; i++) fSamples[i] = digit.fSamples[i];
190 }
e0dc3f7d 191
192 if (fNSamplesHG){
84f6f119 193 fSamplesHG = new Int_t[fNSamplesHG];
194 for (Int_t i=0; i < digit.fNSamplesHG; i++) fSamplesHG[i] = digit.fSamplesHG[i];
af5bdd85 195 }
e0dc3f7d 196
197
198 if (fNMaxPrimary){
84f6f119 199 fPrimary = new Int_t [fNMaxPrimary] ;
200 fDEPrimary = new Float_t[fNMaxPrimary] ;
201 for ( Int_t i = 0; i < fNMaxPrimary ; i++) {
202 fPrimary[i] = digit.fPrimary[i] ;
203 fDEPrimary[i] = digit.fDEPrimary[i] ;
204 }
205 }
e0dc3f7d 206
207 if (fNMaxiparent){
84f6f119 208 fIparent = new Int_t [fNMaxiparent] ;
209 fDEParent = new Float_t[fNMaxiparent] ;
210 for (Int_t j = 0; j< fNMaxiparent ; j++) {
af5bdd85 211 fIparent[j] = digit.fIparent[j] ;
84f6f119 212 fDEParent[j] = digit.fDEParent[j] ;
213 }
e0dc3f7d 214 }
215
61e0abb5 216}
217
218//____________________________________________________________________________
219AliEMCALDigit::~AliEMCALDigit()
220{
e0dc3f7d 221 // Delete array of primaries if any
222
223 if (fSamples ) delete [] fSamples ; fSamples = NULL ;
224 if (fSamplesHG ) delete [] fSamplesHG ; fSamplesHG = NULL ;
225 if (fPrimary ) delete [] fPrimary ; fPrimary = NULL ;
226 if (fDEPrimary) delete [] fDEPrimary ; fDEPrimary = NULL ;
227 if (fIparent ) delete [] fIparent ; fIparent = NULL ;
228 if (fDEParent) delete [] fDEParent ; fDEParent = NULL ;
229
230}
231
232
233//____________________________________________________________________________
234void AliEMCALDigit::Clear(const Option_t*)
235{
236 // Delete array of primaries if any
237 if (fSamples ) delete [] fSamples ; fSamples = NULL ;
238 if (fSamplesHG ) delete [] fSamplesHG ; fSamplesHG = NULL ;
239 if (fPrimary ) delete [] fPrimary ; fPrimary = NULL ;
240 if (fDEPrimary) delete [] fDEPrimary ; fDEPrimary = NULL ;
241 if (fIparent ) delete [] fIparent ; fIparent = NULL ;
242 if (fDEParent) delete [] fDEParent ; fDEParent = NULL ;
829ba234 243
61e0abb5 244}
245
246//____________________________________________________________________________
247Int_t AliEMCALDigit::Compare(const TObject * obj) const
248{
249 // Compares two digits with respect to its Id
250 // to sort according increasing Id
251
53e430a3 252 Int_t rv = 2 ;
61e0abb5 253
254 AliEMCALDigit * digit = (AliEMCALDigit *)obj ;
255
256 Int_t iddiff = fId - digit->GetId() ;
257
258 if ( iddiff > 0 )
259 rv = 1 ;
260 else if ( iddiff < 0 )
261 rv = -1 ;
262 else
263 rv = 0 ;
264
265 return rv ;
266
267}
268
269//____________________________________________________________________________
88cb7938 270Float_t AliEMCALDigit::GetEta() const
14ce0a6e 271{
272 //return pseudorapidity for this digit
273 // should be change in EMCALGeometry - 19-nov-04
814ad4bf 274 Float_t eta=-10., phi=-10.;
563aa66c 275 Int_t id = GetId();
5dee926e 276 const AliEMCALGeometry *g = AliEMCALGeometry::GetInstance();
563aa66c 277 g->EtaPhiFromIndex(id,eta,phi);
814ad4bf 278 return eta ;
279}
280
281//____________________________________________________________________________
88cb7938 282Float_t AliEMCALDigit::GetPhi() const
14ce0a6e 283{
284 //return phi coordinate of digit
285 // should be change in EMCALGeometry - 19-nov-04
814ad4bf 286 Float_t eta=-10., phi=-10.;
563aa66c 287 Int_t id = GetId();
5dee926e 288 const AliEMCALGeometry *g = AliEMCALGeometry::GetInstance();
563aa66c 289 g->EtaPhiFromIndex(id,eta,phi);
814ad4bf 290 return phi ;
291}
292
293//____________________________________________________________________________
829ba234 294Bool_t AliEMCALDigit::GetFALTROSample(const Int_t iSample, Int_t& timeBin, Int_t& amp) const
295{
296 //Get FALTRO sample in time bin iSample
f4a4dc82 297 if (iSample >= fNSamples || iSample < 0 || fDigitType==kTrigger) return kFALSE;
829ba234 298
299 amp = fSamples[iSample] & 0xFFF;
300 timeBin = (fSamples[iSample] >> 12) & 0xFF;
301
302 return kTRUE;
303}
304//____________________________________________________________________________
305Bool_t AliEMCALDigit::GetALTROSampleLG(const Int_t iSample, Int_t& timeBin, Int_t& amp) const
306{
307 //Get Low Gain ALTRO sample in time bin iSample
f4a4dc82 308 if (iSample >= fNSamples || iSample < 0 || fDigitType==kLG) return kFALSE;
829ba234 309
310 amp = fSamples[iSample] & 0xFFF;
311 timeBin = (fSamples[iSample] >> 12) & 0xFF;
312
313 return kTRUE;
314}
315
316//____________________________________________________________________________
317void AliEMCALDigit::SetALTROSamplesLG(const Int_t nSamples, Int_t *samples)
318{
319 //Set array of ALTRO samples, Low Gain or FALTRO
320 fNSamples = nSamples;
321 fSamples = new Int_t[fNSamples];
322 for (Int_t i=0; i < fNSamples; i++) fSamples[i] = samples[i];
323}
324
325//____________________________________________________________________________
326void AliEMCALDigit::SetALTROSamplesHG(const Int_t nSamples, Int_t *samples)
327{
328 //Set array of ALTRO samples, High Gain.
329 fNSamplesHG = nSamples;
330 fSamplesHG = new Int_t[fNSamplesHG];
331 for (Int_t i=0; i < fNSamplesHG; i++) fSamplesHG[i] = samples[i];
332}
333
334
335//____________________________________________________________________________
336Bool_t AliEMCALDigit::GetALTROSampleHG(const Int_t iSample, Int_t& timeBin, Int_t& amp) const
337{
338 //Get High Gain ALTRO sample in time bin iSample
f4a4dc82 339 if (iSample >= fNSamplesHG || iSample < 0 || fDigitType==kHG) return kFALSE;
829ba234 340
341 amp = fSamplesHG[iSample] & 0xFFF;
342 timeBin = (fSamplesHG[iSample] >> 12) & 0xFF;
343
344 return kTRUE;
345}
346
347
348//____________________________________________________________________________
61e0abb5 349Int_t AliEMCALDigit::GetPrimary(Int_t index) const
350{
351 // retrieves the primary particle number given its index in the list
fdebddeb 352 if ( (index <= fNprimary) && (index > 0)){
af5bdd85 353 return fPrimary[index-1] ;
61e0abb5 354 }
355
af5bdd85 356 return -1 ;
357}
358
359//____________________________________________________________________________
360Float_t AliEMCALDigit::GetDEPrimary(Int_t index) const
361{
362 // retrieves the primary particle energy contribution
363 // given its index in the list
364 if ( (index <= fNprimary) && (index > 0)){
365 return fDEPrimary[index-1] ;
366 }
367
368 return 0 ;
61e0abb5 369
370}
371
372//____________________________________________________________________________
373Int_t AliEMCALDigit::GetIparent(Int_t index) const
374{
375 // retrieves the primary particle number given its index in the list
af5bdd85 376 if ( index <= fNiparent && index > 0){
377 return fIparent[index-1] ;
61e0abb5 378 }
379
af5bdd85 380 return -1 ;
61e0abb5 381
382}
383
61e0abb5 384//____________________________________________________________________________
af5bdd85 385Float_t AliEMCALDigit::GetDEParent(Int_t index) const
386{
387 // retrieves the parent particle energy contribution
388 // given its index in the list
389 if ( (index <= fNiparent) && (index > 0)){
390 return fDEParent[index-1] ;
391 }
392
393 return 0;
394}
395
396//____________________________________________________________________________
61e0abb5 397void AliEMCALDigit::ShiftPrimary(Int_t shift){
fdebddeb 398 //shifts primary number to BIG offset, to separate primary in different TreeK
61e0abb5 399 Int_t index ;
400 for(index = 0; index <fNprimary; index++ ){
401 fPrimary[index] = fPrimary[index]+ shift * 10000000 ;}
402 for(index =0; index <fNiparent; index++){
403 fIparent[index] = fIparent[index] + shift * 10000000 ;}
404}
0bd264d5 405
406
407//____________________________________________________________________________
408AliEMCALDigit& AliEMCALDigit::operator= (const AliEMCALDigit &digit)
409{
410 // assignment operator
411
412 if(&digit == this) return *this;
413
414 fAmpFloat = digit.fAmpFloat;
415 fNSamples = digit.fNSamples;
416 fNSamplesHG = digit.fNSamplesHG;
417 fNprimary = digit.fNprimary;
418 fNMaxPrimary = digit.fNMaxPrimary;
419 fNiparent = digit.fNiparent;
420 fNMaxiparent = digit.fNMaxiparent;
421 fMaxIter = digit.fMaxIter;
422 fTime = digit.fTime;
423 fTimeR = digit.fTimeR;
424 fChi2 = digit.fChi2;
425 fNDF = digit.fNDF;
426 fDigitType = digit.fDigitType;
427 fAmpCalib = digit.fAmpCalib;
428 fAmp = digit.fAmp ;
429 fId = digit.fId;
430 fIndexInList = digit.fIndexInList ;
431
432 // data members
433 if (fSamples ) delete [] fSamples ; fSamples = NULL ;
434 if (fSamplesHG ) delete [] fSamplesHG ; fSamplesHG = NULL ;
435 if (fPrimary ) delete [] fPrimary ; fPrimary = NULL ;
436 if (fDEPrimary) delete [] fDEPrimary ; fDEPrimary = NULL ;
437 if (fIparent ) delete [] fIparent ; fIparent = NULL ;
438 if (fDEParent) delete [] fDEParent ; fDEParent = NULL ;
439
440 if (fNSamples){
441 fSamples = new Int_t[fNSamples];
442 for (Int_t i=0; i < digit.fNSamples; i++) fSamples[i] = digit.fSamples[i];
443 }
444
445 if (fNSamplesHG){
446 fSamplesHG = new Int_t[fNSamplesHG];
447 for (Int_t i=0; i < digit.fNSamplesHG; i++) fSamplesHG[i] = digit.fSamplesHG[i];
448 }
449
450
451 if (fNMaxPrimary){
452 fPrimary = new Int_t [fNMaxPrimary] ;
453 fDEPrimary = new Float_t[fNMaxPrimary] ;
454 for ( Int_t i = 0; i < fNMaxPrimary ; i++) {
455 fPrimary[i] = digit.fPrimary[i] ;
456 fDEPrimary[i] = digit.fDEPrimary[i] ;
457 }
458 }
459
460 if (fNMaxiparent){
461 fIparent = new Int_t [fNMaxiparent] ;
462 fDEParent = new Float_t[fNMaxiparent] ;
463 for (Int_t j = 0; j< fNMaxiparent ; j++) {
464 fIparent[j] = digit.fIparent[j] ;
465 fDEParent[j] = digit.fDEParent[j] ;
466 }
467 }
468
469 return *this;
470
471}
472
61e0abb5 473//____________________________________________________________________________
474Bool_t AliEMCALDigit::operator==(AliEMCALDigit const & digit) const
475{
476 // Two digits are equal if they have the same Id
477
478 if ( fId == digit.fId )
479 return kTRUE ;
480 else
481 return kFALSE ;
482}
483
484//____________________________________________________________________________
0a4cb131 485AliEMCALDigit AliEMCALDigit::operator+(const AliEMCALDigit &digit)
61e0abb5 486{
487 // Adds the amplitude of digits and completes the list of primary particles
488 // if amplitude is larger than
489
829ba234 490 fAmpFloat += digit.fAmpFloat ;
491 for (Int_t i=0; i < fNSamples ; i++) fSamples[i] += digit.fSamples[i];
492 for (Int_t i=0; i < fNSamplesHG; i++) fSamplesHG[i] += digit.fSamplesHG[i];
d8c2bd69 493
829ba234 494 fAmp += digit.fAmp ;
814ad4bf 495 if(fTime > digit.fTime)
496 fTime = digit.fTime ;
3c80fef6 497 if (digit.fTimeR < fTimeR)
498 fTimeR = digit.fTimeR ;
d8c2bd69 499
61e0abb5 500 Int_t max1 = fNprimary ;
501 Int_t max2 = fNiparent ;
502 Int_t index ;
7b62cd84 503 for (index = 0 ; index < digit.fNprimary ; index++){
af5bdd85 504 Bool_t newPrim = kTRUE ;
61e0abb5 505 Int_t old ;
af5bdd85 506 for ( old = 0 ; (old < max1) && newPrim; old++) { //already have this primary?
507 if(fPrimary[old] == digit.fPrimary[index]) {
d8c2bd69 508 newPrim = kFALSE;
509 fDEPrimary[old] += digit.fDEPrimary[index];
af5bdd85 510 }
61e0abb5 511 }
af5bdd85 512 if (newPrim) {
513 if(max1<fNMaxPrimary){
d8c2bd69 514 fPrimary[max1] = digit.fPrimary[index] ;
515 fDEPrimary[max1] = digit.fDEPrimary[index] ;
516 fNprimary++ ;
517 max1++;
af5bdd85 518 }
7b62cd84 519 if(fNprimary==fNMaxPrimary) {
d8c2bd69 520
521 TString mess = " NMaxPrimary = " ;
522 mess += fNMaxPrimary ;
523 mess += " is too small" ;
524 AliFatal(mess.Data()) ;
525
61e0abb5 526 }
527 }
528 }
529
530 for (index = 0 ; index < digit.fNiparent ; index++){
af5bdd85 531 Bool_t newParent = kTRUE ;
61e0abb5 532 Int_t old ;
af5bdd85 533 for ( old = 0 ; (old < max2) && newParent; old++) { //already have this primary?
534 if(fIparent[old] == digit.fIparent[index]) {
d8c2bd69 535 newParent = kFALSE;
536 fDEParent[old] += digit.fDEParent[index];
af5bdd85 537 }
61e0abb5 538 }
af5bdd85 539 if(newParent){
540 if(max2<fNMaxiparent) {
d8c2bd69 541 fIparent[max2] = digit.fIparent[index] ;
542 fDEParent[max2] = digit.fDEParent[index] ;
543 fNiparent++ ;
544 max2++;
af5bdd85 545 }
7b62cd84 546 if(fNiparent==fNMaxiparent) {
d8c2bd69 547
548 TString mess = " NMaxiparent = " ;
549 mess += fNMaxiparent ;
550 mess += " is too small" ;
551 AliFatal(mess.Data()) ;
552
61e0abb5 553 }
554 }
555 }
556
557 return *this ;
558}
559
560//____________________________________________________________________________
0a4cb131 561AliEMCALDigit AliEMCALDigit::operator*(Float_t factor)
563aa66c 562{
563 // Multiplies the amplitude by a factor
564
829ba234 565 //Float_t tempo = static_cast<Float_t>(fAmp) ;
566 //tempo *= factor ;
567 //fAmp = static_cast<Int_t>(TMath::Floor(tempo)) ;
568
569 fAmpFloat *= factor;
570 for (Int_t i=0; i < fNSamples ; i++) fSamples[i] = Int_t(factor*fSamples[i]);
571 for (Int_t i=0; i < fNSamplesHG; i++) fSamplesHG[i] = Int_t(factor*fSamplesHG[i]);
572
af5bdd85 573 for(Int_t i=0; i < fNprimary; i++)
574 fDEPrimary[i] *= factor;
575 for(Int_t i=0; i < fNiparent; i++)
576 fDEParent[i] *= factor;
577
563aa66c 578 return *this ;
579}
580
581//____________________________________________________________________________
61e0abb5 582ostream& operator << ( ostream& out , const AliEMCALDigit & digit)
583{
584 // Prints the data of the digit
585
814ad4bf 586 out << "ID " << digit.fId << " Energy = " << digit.fAmp << " Time = " << digit.fTime << endl ;
53e430a3 587 for(Int_t i=0;i<digit.fNprimary;i++)
af5bdd85 588 out << "Primary " << i+1 << " = " << digit.fPrimary[i]
589 << " : DE " << digit.fDEPrimary[i] << endl ;
61e0abb5 590
53e430a3 591 for(Int_t j=0;j<digit.fNiparent;j++)
af5bdd85 592 out << "Iparent " << j+1 << " = " << digit.fIparent[j]
593 << " : DE " << digit.fDEParent[j] << endl ;
594 out << "Position in list = " << digit.fIndexInList << endl ;
61e0abb5 595 return out ;
596}
597
829ba234 598//____________________________________________________________________________
599void AliEMCALDigit::Print(const Option_t* /*opt*/) const
600{
601 //Print
f4a4dc82 602 printf("===\nDigit id: %4d / Energy %2.3f ; Time %e ; Time samples %d ; Chi2 %2.3f, NDF %d, Type? %d \n",
603 fId, fAmpFloat,fTime, fNSamples, fChi2, fNDF, fDigitType);
604 if(fDigitType==kTrigger){
829ba234 605 printf("FALTRO: ");
606 for (Int_t i=0; i < GetNFALTROSamples(); i++)
607 {
608 Int_t timeBin, amp;
609 GetFALTROSample(i, timeBin, amp);
610 printf(" (%d,%d) ",timeBin,amp);
611 }
612 printf("\n");
613 }//trigger
614 else{
615 printf("ALTRO, Low Gain: ");
616 for (Int_t i=0; i < GetNALTROSamplesLG(); i++)
617 {
618 Int_t timeBin, amp;
619 GetALTROSampleLG(i, timeBin, amp);
620 printf(" (%d,%d) ",timeBin,amp);
621 }
622 printf("\n");
623 printf("ALTRO, High Gain: ");
624 for (Int_t i=0; i < GetNALTROSamplesHG(); i++)
625 {
626 Int_t timeBin, amp;
627 GetALTROSampleHG(i, timeBin, amp);
628 printf(" (%d,%d) ",timeBin,amp);
629 }
630 printf("\n");
631 }//trigger
632
633}
634
635
61e0abb5 636