Skip to content

Commit

Permalink
ALIROOT-5441 Fix digit amplitude sign bit
Browse files Browse the repository at this point in the history
  • Loading branch information
guernane authored and hristov committed May 26, 2014
1 parent 16bcb3e commit 5e30c63
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
32 changes: 18 additions & 14 deletions EMCAL/AliEMCALDigitizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ void AliEMCALDigitizer::Digits2FastOR(TClonesArray* digitsTMP, TClonesArray* dig

if (AliDebugLevel()) printf("Number of TRG digits: %d\n",digitsTMP->GetEntriesFast());

Int_t nSamples = 32;
Int_t nSamples = 32;
Int_t *timeSamples = new Int_t[nSamples];

NextDigit = TIter(digitsTMP);
Expand All @@ -909,20 +909,18 @@ void AliEMCALDigitizer::Digits2FastOR(TClonesArray* digitsTMP, TClonesArray* dig
if (AliDebugLevel()) printf("Deposited Energy: %f\n", depositedEnergy);

// FIXME: Check digit time!
if (depositedEnergy)
{
depositedEnergy += gRandom->Gaus(0., .08);

if (depositedEnergy) {
depositedEnergy += gRandom->Gaus(0., .08);
DigitalFastOR(time, depositedEnergy, timeSamples, nSamples);

for (Int_t j=0;j<nSamples;j++)
{
timeSamples[j] = ((j << 12) & 0xFF000) | (timeSamples[j] & 0xFFF);
for (Int_t j=0;j<nSamples;j++) {
if (AliDebugLevel()) printf("timeSamples[%d]: %d\n",j,timeSamples[j]);
timeSamples[j] = ((j << 16) | (timeSamples[j] & 0xFFFF));
}

new((*digitsTRG)[digitsTRG->GetEntriesFast()]) AliEMCALRawDigit(id, timeSamples, nSamples);
if (AliDebugLevel()) ((AliEMCALRawDigit*)digitsTRG->At(digitsTRG->GetEntriesFast() - 1))->Print("");

if (AliDebugLevel()) ((AliEMCALRawDigit*)digitsTRG->At(digitsTRG->GetEntriesFast() - 1))->Print("");
}
}
}
Expand All @@ -937,8 +935,8 @@ void AliEMCALDigitizer::DigitalFastOR( Double_t time, Double_t dE, Int_t timeSam
{
// parameters:
// id: 0..95
const Int_t reso = 11; // 11-bit resolution ADC
const Double_t vFSR = 1; // Full scale input voltage range
const Int_t reso = 12; // 11-bit resolution ADC
const Double_t vFSR = 2.; // Full scale input voltage range 2V (p-p)
// const Double_t dNe = 125; // signal of the APD per MeV of energy deposit in a tower: 125 photo-e-/MeV @ M=30
const Double_t dNe = 125/1.3; // F-ALTRO max V. FEE: factor 4
const Double_t vA = .136e-6; // CSP output range: 0.136uV/e-
Expand All @@ -957,8 +955,14 @@ void AliEMCALDigitizer::DigitalFastOR( Double_t time, Double_t dE, Int_t timeSam
{
// FIXME: add noise (probably not simply Gaussian) according to DA measurements
// probably plan an access to OCDB

timeSamples[iTime] = int((TMath::Power(2, reso) / vFSR) * signalF.Eval(iTime * kTimeBinWidth) + 0.5);
Double_t sig = signalF.Eval(iTime * kTimeBinWidth);
if (TMath::Abs(sig) > vFSR/2.) {
AliError("Signal overflow!");
timeSamples[iTime] = (1 << reso) - 1;
} else {
AliDebug(999,Form("iTime: %d sig: %f\n",iTime,sig));
timeSamples[iTime] = ((1 << reso) / vFSR) * sig + 0.5;
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions EMCAL/AliEMCALRawDigit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ Bool_t AliEMCALRawDigit::GetTimeSample(const Int_t iSample, Int_t& timeBin, Int_

if (iSample > fNSamples || iSample < 0) return kFALSE;

amp = fSamples[iSample] & 0xFFF;
timeBin = (fSamples[iSample] >> 12) & 0xFF;
amp = (Short_t)(fSamples[iSample] & 0xFFFF);
timeBin = (Short_t)(fSamples[iSample] >> 16 );

return kTRUE;
}
Expand Down
6 changes: 4 additions & 2 deletions EMCAL/AliEMCALTriggerBoard.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,19 @@ void AliEMCALTriggerBoard::SlidingWindow(Int_t thres)
for (int i = 0; i <= int(fRegionSize->X() - fPatchSize->X() * fSubRegionSize->X()); i += int(fSubRegionSize->X())) {
for (int j = 0; j <= int(fRegionSize->Y() - fPatchSize->Y() * fSubRegionSize->Y()); j += int(fSubRegionSize->Y())) {
//
AliDebug(999, Form("--- Current window at (%2d,%2d) ---",i,j));
int sum = 0;

for (int k = 0; k < int(fPatchSize->X() * fSubRegionSize->X()); k++) {
for (int l = 0; l < int(fPatchSize->Y() * fSubRegionSize->Y()); l++) {
//
sum += fRegion[i + k][j + l];
sum += fRegion[i + k][j + l];
AliDebug(999, Form("Adding fRegion[%2d + %2d][%2d + %2d]: %d and sum is %d",i,k,j,l,fRegion[i + k][j + l],sum));
}
}

if (sum > thres) {
AliDebug(999, Form("Adding new patch at (%2d,%2d)", i, j));
AliDebug(999, Form("Adding new patch at (%2d,%2d) w/ amplitude %d", i, j, sum));
new((*fPatches)[fPatches->GetEntriesFast()]) AliEMCALTriggerPatch(i, j, sum);
}
}
Expand Down

0 comments on commit 5e30c63

Please sign in to comment.