1 #include "TClonesArray.h"
3 #include "AliPHOSRawDigiProducer.h"
4 #include "AliPHOSRawDecoder.h"
5 #include "AliPHOSGeometry.h"
6 #include "AliPHOSDigit.h"
8 ClassImp(AliPHOSRawDigiProducer)
10 void AliPHOSRawDigiProducer::MakeDigits(TClonesArray *digits, AliPHOSRawDecoder* decoder)
14 AliPHOSGeometry* geo = AliPHOSGeometry::GetInstance();
15 if(!geo) geo = AliPHOSGeometry::GetInstance("IHEP");
20 Bool_t seen,lowGainFlag;
21 Int_t relId[4], absId =0;
23 while (decoder->NextDigit()) {
25 lowGainFlag = decoder->IsLowGain();
26 time = decoder->GetTime();
28 relId[0] = decoder->GetModule();
30 relId[2] = decoder->GetRow();
31 relId[3] = decoder->GetColumn();
32 geo->RelToAbsNumbering(relId, absId);
34 // Add low gain digit only
35 //if the high gain digit does not exist in the digits array
40 for (iOldDigit=iDigit-1; iOldDigit>=0; iOldDigit--) {
41 if ((dynamic_cast<AliPHOSDigit*>(digits->At(iOldDigit)))->GetId() == absId) {
47 new((*digits)[iDigit]) AliPHOSDigit(-1,absId,(Float_t)decoder->GetEnergy(),time);
52 // Add high gain digit only if it is not saturated;
53 // replace low gain digit by a high gain one
55 if (decoder->GetEnergy() >= 1023) continue;
56 for (iOldDigit=iDigit-1; iOldDigit>=0; iOldDigit--) {
57 if ((dynamic_cast<AliPHOSDigit*>(digits->At(iOldDigit)))->GetId() == absId) {
58 digits->RemoveAt(iOldDigit);
59 new((*digits)[iOldDigit]) AliPHOSDigit(-1,absId,(Float_t)decoder->GetEnergy(),time);
65 new((*digits)[iDigit]) AliPHOSDigit(-1,absId,(Float_t)decoder->GetEnergy(),time);