1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 // --- ROOT system ---
17 #include <Riostream.h>
20 // --- Standard library ---
22 // --- AliRoot header files ---
24 #include "AliEMCALRawDigit.h"
26 ClassImp(AliEMCALRawDigit)
28 //____________________________________________________________________________
29 AliEMCALRawDigit::AliEMCALRawDigit() : TObject(),
37 //____________________________________________________________________________
38 AliEMCALRawDigit::AliEMCALRawDigit(Int_t id, Int_t timeSamples[], Int_t nSamples) : TObject(),
44 fSamples = new Int_t[fNSamples] ;
45 for (Int_t i=0; i < fNSamples; i++) fSamples[i] = timeSamples[i];
48 //____________________________________________________________________________
49 AliEMCALRawDigit::AliEMCALRawDigit(const AliEMCALRawDigit& digit) : TObject(),//AliDigitNew(digit),
51 fNSamples(digit.fNSamples),
56 // Data members of the base class (AliNewDigit)
59 // fIndexInList = digit.fIndexInList;
60 fSamples = new Int_t[fNSamples];
61 for (Int_t i=0; i < digit.fNSamples; i++) fSamples[i] = digit.fSamples[i];
64 //____________________________________________________________________________
65 AliEMCALRawDigit::~AliEMCALRawDigit()
67 // Delete array of time samples
68 if(fSamples) delete [] fSamples;
71 //____________________________________________________________________________
72 void AliEMCALRawDigit::Clear(Option_t *)
74 // Delete array of time samples
75 if(fSamples) delete [] fSamples;
79 //____________________________________________________________________________
80 Bool_t AliEMCALRawDigit::GetTimeSample(const Int_t iSample, Int_t& timeBin, Int_t& amp) const
82 if (iSample > fNSamples || iSample < 0) return kFALSE;
84 amp = fSamples[iSample] & 0xFFF;
85 timeBin = (fSamples[iSample] >> 12) & 0xFF;
90 //____________________________________________________________________________
91 void AliEMCALRawDigit::Print(const Option_t* /*opt*/) const
93 printf("===\nDigit id: %4d / %d Time Samples: \n",fId,fNSamples);
94 for (Int_t i=0; i < fNSamples; i++)
96 Int_t timeBin=-1, amp=0;
97 GetTimeSample(i, timeBin, amp);
98 printf("(%d,%d) ",timeBin,amp);
104 //____________________________________________________________________________
105 Int_t AliEMCALRawDigit::Compare(const TObject* obj) const
107 // Compares two digits with respect to its Id
108 // to sort according increasing Id
112 AliEMCALRawDigit* digit = (AliEMCALRawDigit *)obj;
114 Int_t iddiff = fId - digit->GetId();
118 else if ( iddiff < 0 )
126 //____________________________________________________________________________
127 Bool_t AliEMCALRawDigit::operator==(AliEMCALRawDigit const & digit) const
129 // Two digits are equal if they have the same Id