X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EMCAL%2FAliEMCALDigit.cxx;h=a5664c3df51cfd9a678a927aa50d6889a8809e15;hb=925e65709851bc55cacc40068515d4c5a80fc419;hp=fbed5e9ab9e8b1b78a966c82835a7dd5607dc7af;hpb=814ad4bf0f652105e79d72fafdccb2e80473bdd1;p=u%2Fmrichter%2FAliRoot.git diff --git a/EMCAL/AliEMCALDigit.cxx b/EMCAL/AliEMCALDigit.cxx index fbed5e9ab9e..a5664c3df51 100644 --- a/EMCAL/AliEMCALDigit.cxx +++ b/EMCAL/AliEMCALDigit.cxx @@ -30,26 +30,32 @@ // --- Standard library --- -#include +#include // --- AliRoot header files --- #include "AliEMCALDigit.h" #include "AliEMCALGeometry.h" +#include "AliEMCALGetter.h" ClassImp(AliEMCALDigit) //____________________________________________________________________________ - AliEMCALDigit::AliEMCALDigit() + AliEMCALDigit::AliEMCALDigit() { // default ctor fIndexInList = -1 ; fNprimary = 0 ; - fNMaxPrimary = 21 ; - fNiparent = 0 ; - fNMaxiparent = fNMaxPrimary*10; + fNMaxPrimary = 5 ; + fNiparent = 0 ; + fNMaxiparent = 5; + fPrimary = 0 ; + fIparent = 0 ; + fMaxIter = 0; + fTime = 0. ; + fTimeR = 0. ; } //____________________________________________________________________________ @@ -57,19 +63,22 @@ AliEMCALDigit::AliEMCALDigit(Int_t primary, Int_t iparent, Int_t id, Int_t DigEn { // ctor with all data - fNMaxPrimary = 21 ; - fNMaxiparent = fNMaxPrimary*10; + fNMaxPrimary = 25 ; + fNMaxiparent = 150 ; + fPrimary = new Int_t[fNMaxPrimary] ; + fIparent = new Int_t[fNMaxiparent] ; fAmp = DigEnergy ; fTime = time ; + fTimeR = fTime ; fId = id ; fIndexInList = index ; + fMaxIter = 5; if( primary != -1){ fNprimary = 1 ; - fPrimary[0] = primary ; + fPrimary[0] = primary ; fNiparent = 1 ; fIparent[0] = iparent ; - - } +} else{ //If the contribution of this primary smaller than fDigitThreshold (AliEMCALv1) fNprimary = 0 ; fPrimary[0] = -1 ; @@ -81,18 +90,20 @@ AliEMCALDigit::AliEMCALDigit(Int_t primary, Int_t iparent, Int_t id, Int_t DigEn for ( i = 1; i < fNMaxPrimary ; i++) fPrimary[i] = -1 ; - for ( Int_t j =1; j< fNMaxiparent ; j++) - fIparent[j] = -1 ; + for ( i =1; i< fNMaxiparent ; i++) + fIparent[i] = -1 ; } //____________________________________________________________________________ -AliEMCALDigit::AliEMCALDigit(const AliEMCALDigit & digit) +AliEMCALDigit::AliEMCALDigit(const AliEMCALDigit & digit) : AliDigitNew(digit) { // copy ctor fNMaxPrimary = digit.fNMaxPrimary ; fNMaxiparent = digit.fNMaxiparent ; + fPrimary = new Int_t[fNMaxPrimary] ; + fIparent = new Int_t[fNMaxiparent] ; Int_t i ; for ( i = 0; i < fNMaxPrimary ; i++) fPrimary[i] = digit.fPrimary[i] ; @@ -101,7 +112,9 @@ AliEMCALDigit::AliEMCALDigit(const AliEMCALDigit & digit) fIparent[j] = digit.fIparent[j] ; fAmp = digit.fAmp ; fTime = digit.fTime ; + fTimeR = digit.fTimeR ; fId = digit.fId; + fMaxIter = digit.fMaxIter; fIndexInList = digit.fIndexInList ; fNprimary = digit.fNprimary ; fNiparent = digit.fNiparent ; @@ -111,7 +124,8 @@ AliEMCALDigit::AliEMCALDigit(const AliEMCALDigit & digit) AliEMCALDigit::~AliEMCALDigit() { // Delete array of primiries if any - + delete [] fPrimary ; + delete [] fIparent ; } //____________________________________________________________________________ @@ -138,18 +152,22 @@ Int_t AliEMCALDigit::Compare(const TObject * obj) const } //____________________________________________________________________________ -const Float_t AliEMCALDigit::GetEta() const +Float_t AliEMCALDigit::GetEta() const { Float_t eta=-10., phi=-10.; - AliEMCALGeometry::GetInstance()->EtaPhiFromIndex(fId,eta,phi); + Int_t id = GetId(); + const AliEMCALGeometry *g = AliEMCALGetter::Instance()->EMCALGeometry(); + g->EtaPhiFromIndex(id,eta,phi); return eta ; } //____________________________________________________________________________ -const Float_t AliEMCALDigit::GetPhi() const +Float_t AliEMCALDigit::GetPhi() const { Float_t eta=-10., phi=-10.; - AliEMCALGeometry::GetInstance()->EtaPhiFromIndex(fId,eta,phi); + Int_t id = GetId(); + const AliEMCALGeometry *g = AliEMCALGetter::Instance()->EMCALGeometry(); + g->EtaPhiFromIndex(id,eta,phi); return phi ; } @@ -158,7 +176,7 @@ Int_t AliEMCALDigit::GetPrimary(Int_t index) const { // retrieves the primary particle number given its index in the list Int_t rv = -1 ; - if ( index <= fNprimary && index > 0){ + if ( (index <= fNprimary) && (index > 0)){ rv = fPrimary[index-1] ; } @@ -179,10 +197,9 @@ Int_t AliEMCALDigit::GetIparent(Int_t index) const } - //____________________________________________________________________________ void AliEMCALDigit::ShiftPrimary(Int_t shift){ - //shifts primary nimber to BIG offset, to separate primary in different TreeK + //shifts primary number to BIG offset, to separate primary in different TreeK Int_t index ; for(index = 0; index digit.fTime) fTime = digit.fTime ; - + fTimeR = fTime ; + Int_t max1 = fNprimary ; Int_t max2 = fNiparent ; Int_t index ; - for (index = 0 ; index < digit.fNprimary ; index++){ + for (index = 0 ; index < digit.fNprimary ; index++){ Bool_t deja = kTRUE ; Int_t old ; for ( old = 0 ; (old < max1) && deja; old++) { //already have this primary? - if(fPrimary[old] == (digit.fPrimary)[index]) + if(fPrimary[old] == digit.fPrimary[index]) deja = kFALSE; } if(deja){ - fPrimary[fNprimary] = (digit.fPrimary)[index] ; + if(max1fNMaxPrimary) { - cout << "AliEMCALDigit >> Increase NMaxPrimary "<< endl ; - return *this ; + max1++;} + if(fNprimary==fNMaxPrimary) { + + TString mess = " NMaxPrimary = " ; + mess += fNMaxPrimary ; + mess += " is too small" ; + Fatal("AliEMCALDigit::Operator+ -->" , mess.Data()) ; + } } } @@ -234,15 +257,20 @@ AliEMCALDigit& AliEMCALDigit::operator+(AliEMCALDigit const & digit) Bool_t dejavu = kTRUE ; Int_t old ; for ( old = 0 ; (old < max2) && dejavu; old++) { //already have this primary? - if(fIparent[old] == (digit.fIparent)[index]) + if(fIparent[old] == digit.fIparent[index]) dejavu = kFALSE; } if(dejavu){ - fIparent[fNiparent] = (digit.fIparent)[index] ; + if(max2fNMaxiparent) { - cout << "AliEMCALDigit >> Increase NMaxiparent "<< endl ; - return *this ; + max2++;} + if(fNiparent==fNMaxiparent) { + + TString mess = " NMaxiparent = " ; + mess += fNMaxiparent ; + mess += " is too small" ; + Fatal("AliEMCALDigit::Operator+ -->", mess.Data()) ; + } } } @@ -250,6 +278,17 @@ AliEMCALDigit& AliEMCALDigit::operator+(AliEMCALDigit const & digit) return *this ; } +//____________________________________________________________________________ +AliEMCALDigit& AliEMCALDigit::operator*(Float_t factor) +{ + // Multiplies the amplitude by a factor + + Float_t tempo = static_cast(fAmp) ; + tempo *= factor ; + fAmp = static_cast(TMath::Ceil(tempo)) ; + return *this ; +} + //____________________________________________________________________________ ostream& operator << ( ostream& out , const AliEMCALDigit & digit) {