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
71 //____________________________________________________________________________
72 Bool_t AliEMCALRawDigit::GetTimeSample(const Int_t iSample, Int_t& timeBin, Int_t& amp) const
74 if (iSample > fNSamples || iSample < 0) return kFALSE;
76 amp = fSamples[iSample] & 0xFFF;
77 timeBin = (fSamples[iSample] >> 12) & 0xFF;
82 //____________________________________________________________________________
83 void AliEMCALRawDigit::Print(const Option_t* /*opt*/) const
85 printf("===\nDigit id: %4d / %d Time Samples: \n",fId,fNSamples);
86 for (Int_t i=0; i < fNSamples; i++)
89 GetTimeSample(i, timeBin, amp);
90 printf("(%d,%d) ",timeBin,amp);
96 //____________________________________________________________________________
97 Int_t AliEMCALRawDigit::Compare(const TObject* obj) const
99 // Compares two digits with respect to its Id
100 // to sort according increasing Id
104 AliEMCALRawDigit* digit = (AliEMCALRawDigit *)obj;
106 Int_t iddiff = fId - digit->GetId();
110 else if ( iddiff < 0 )
118 //____________________________________________________________________________
119 Bool_t AliEMCALRawDigit::operator==(AliEMCALRawDigit const & digit) const
121 // Two digits are equal if they have the same Id