X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EMCAL%2FAliEMCALTriggerTRU.cxx;h=3d542d484e9f07db9785e6dcc90c6497e695e984;hb=37fc80e656b4a99a04b30cf94cceb01038c84c10;hp=a7c33a4354b69e4c9934d21e2707070c792fad18;hpb=8476b1c8308ef4582f7e2b018ae6acf2e484c7df;p=u%2Fmrichter%2FAliRoot.git diff --git a/EMCAL/AliEMCALTriggerTRU.cxx b/EMCAL/AliEMCALTriggerTRU.cxx index a7c33a4354b..3d542d484e9 100644 --- a/EMCAL/AliEMCALTriggerTRU.cxx +++ b/EMCAL/AliEMCALTriggerTRU.cxx @@ -42,8 +42,8 @@ namespace ClassImp(AliEMCALTriggerTRU) //________________ -AliEMCALTriggerTRU::AliEMCALTriggerTRU() : AliEMCALTriggerBoard() -,fDCSConfig(0x0) +AliEMCALTriggerTRU::AliEMCALTriggerTRU() : AliEMCALTriggerBoard(), +fDCSConfig(0x0) { // for (Int_t i=0;i<96;i++) for (Int_t j=0;j<256;j++) fADC[i][j] = 0; @@ -51,20 +51,30 @@ AliEMCALTriggerTRU::AliEMCALTriggerTRU() : AliEMCALTriggerBoard() //________________ AliEMCALTriggerTRU::AliEMCALTriggerTRU(AliEMCALTriggerTRUDCSConfig* dcsConf, const TVector2& rSize, Int_t mapType) : -AliEMCALTriggerBoard(rSize) -,fDCSConfig(dcsConf) +AliEMCALTriggerBoard(rSize), +fDCSConfig(dcsConf) { // for (Int_t i=0;i<96;i++) for (Int_t j=0;j<256;j++) fADC[i][j] = 0; - // FIXME: use of class AliEMCALTriggerParam to get size TVector2 size; - size.Set( 1. , 1. ); - SetSubRegionSize( size ); // 1 by 1 FOR - - size.Set( 2. , 2. ); - SetPatchSize( size ); // 2 by 2 subregions + if (dcsConf->GetL0SEL() & 0x0001) // 4-by-4 + { + size.Set( 1. , 1. ); + SetSubRegionSize( size ); + + size.Set( 2. , 2. ); + SetPatchSize( size ); + } + else // 2-by-2 + { + size.Set( 1. , 1. ); + SetSubRegionSize( size ); + + size.Set( 1. , 1. ); + SetPatchSize( size ); + } for (Int_t ietam=0;ietam<24;ietam++) { @@ -82,9 +92,7 @@ AliEMCALTriggerBoard(rSize) //________________ AliEMCALTriggerTRU::~AliEMCALTriggerTRU() { - // delete TRU digits only used as transient containers - // to compute FastOR from energy deposit - delete [] fADC; + // } //________________ @@ -127,17 +135,30 @@ Int_t AliEMCALTriggerTRU::L0() // compute the time sum for all the FastOR of a given TRU // and then move the space window - AliDebug(1,"=== Running TRU L0 algorithm ==="); + AliDebug(999,"=== Running TRU L0 algorithm ==="); const Int_t xsize = Int_t(fRegionSize->X()); - Int_t buffer[xsize][xsize][kNup+kNdown]; + const Int_t ysize = Int_t(fRegionSize->Y()); + const Int_t zsize = kNup+kNdown; + + Int_t ***buffer = new Int_t**[xsize]; + for (Int_t x = 0; x < xsize; x++) + { + buffer[x] = new Int_t*[ysize]; + + for (Int_t y = 0; y < ysize; y++) + { + buffer[x][y] = new Int_t[zsize]; + } + } - for (Int_t i=0; iX(); i++) for (Int_t j=0; jY(); j++) - for (Int_t k=0; kX(); i++) + for (Int_t j = 0; j < fRegionSize->Y(); j++) + for (Int_t k = 0; k < kNup + kNdown; k++) buffer[i][j][k] = 0; // Time sliding window algorithm for (Int_t i=0; i<=(kTimeBins-kTimeWindowSize); i++) { - AliDebug(1,Form("----------- Time window: %d\n",i)); + AliDebug(999,Form("----------- Time window: %d\n",i)); for (Int_t j=0; jX(); j++) { @@ -145,7 +166,6 @@ Int_t AliEMCALTriggerTRU::L0() { for (Int_t l=i; l 4) fRegion[j][k] = fRegion[j][k] >> 1; // truncate time sum to fit 14b } @@ -179,7 +194,11 @@ Int_t AliEMCALTriggerTRU::L0() continue; } - Int_t peaks[xsize][xsize]; + Int_t **peaks = new Int_t*[xsize]; + for (Int_t x = 0; x < xsize; x++) + { + peaks[x] = new Int_t[ysize]; + } for (Int_t j=0; jX(); j++) for (Int_t k=0; kY(); k++) peaks[j][k] = 0; @@ -205,16 +224,7 @@ Int_t AliEMCALTriggerTRU::L0() } } -/* - for (Int_t j=0; jX(); j++) - { - for (Int_t k=0; kY(); k++) - { - printf("peaks[%2d][%2d]: %d\n",j,k,peaks[j][k]); - } - } -*/ - if ( !nPeaks ) + if (!nPeaks) { ZeroRegion(); continue; @@ -226,13 +236,11 @@ Int_t AliEMCALTriggerTRU::L0() // return the list of patches above threshold // Theshold checked out from OCDB - SlidingWindow( kGamma, fDCSConfig->GetGTHRL0() ); + SlidingWindow(kL0, fDCSConfig->GetGTHRL0(), i); // for(Int_t j=0; jX(); j++) // for (Int_t k=0; kY(); k++) fRegion[j][k] = fRegion[j][k]>>2; // go to 12b before shipping to STU - Int_t nP = 0; - for (Int_t j=0; jGetEntriesFast(); j++) { AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)fPatches->At( j ); @@ -247,6 +255,8 @@ Int_t AliEMCALTriggerTRU::L0() const Int_t psize = sizeX * sizeY; // Number of FastOR in the patch + Int_t foundPeak = 0; + Int_t* idx = new Int_t[psize]; for (Int_t xx=0;xxX())+xx][int(v.Y()*fSubRegionSize->Y())+yy]; // Get current patch FastOR ADC channels - if (peaks[int(v.X()*fSubRegionSize->X())+xx][int(v.Y()*fSubRegionSize->Y())+yy]) nP++; + if (peaks[int(v.X() * fSubRegionSize->X()) + xx][int(v.Y() * fSubRegionSize->Y()) + yy]) + { + foundPeak++; + + p->SetPeak(xx, yy, sizeX, sizeY); + } - if ( AliDebugLevel() ) ShowFastOR(i,idx[index]); + if (AliDebugLevel() >= 999) ShowFastOR(i, idx[index]); } } - if ( nP ) + if ( !foundPeak ) { -// cout << "break patch loop" << endl; - break; - } + fPatches->RemoveAt( j ); + fPatches->Compress(); + } } - if ( !nP ) - fPatches->Delete(); - else + //Delete, avoid leak + for (Int_t x = 0; x < xsize; x++) { -// cout << "break time loop" << endl; - break; // Stop the algo when at least one patch is found ( thres & max ) + delete [] peaks[x]; } - - ZeroRegion(); // Clear fRegion for this time window before computing the next one + delete [] peaks; + + if ( !fPatches->GetEntriesFast() ) // No patch left + ZeroRegion(); + else // Stop the algo when at least one patch is found ( thres & max ) + { + for (Int_t xx = 0; xx < fRegionSize->X(); xx++) + { + for (Int_t yy = 0; yy < fRegionSize->Y(); yy++) + { + // Prepare data to be sent to STU for further L1 processing + // Sent time sum (rollback tuning) is the one before L0 is issued (maximum time sum) + fRegion[xx][yy] = buffer[xx][yy][1]; + } + } + + break; + } } -// cout << "Nof patches: " << fPatches->GetEntriesFast() << endl; - + //Delete, avoid leak + for (Int_t x = 0; x < xsize; x++) + { + for (Int_t y = 0; y < ysize; y++) + { + delete [] buffer[x][y]; + } + delete [] buffer[x]; + } + delete [] buffer; + return fPatches->GetEntriesFast(); } //________________ void AliEMCALTriggerTRU::SetADC( Int_t channel, Int_t bin, Int_t sig ) { - // - if (channel>95) AliError("TRU has 96 ADC channels only!"); - fADC[channel][bin] = sig; + //Set ADC value + if (channel > 95 || bin > 255) { + AliError("TRU has 96 ADC channels and 256 bins only!"); + } + else{ + fADC[channel][bin] = sig; + } } //________________