/*
$Log$
+Revision 1.9 2001/05/07 08:08:05 cblume
+Update of TRD code
+
+Revision 1.8 2000/11/23 14:34:08 cblume
+Fixed bug in expansion routine of arrays (initialize buffers properly)
+
+Revision 1.7 2000/11/20 08:56:07 cblume
+Cleanup of data arrays
+
Revision 1.6 2000/11/01 14:53:20 cblume
Merge with TRD-develop
Int_t over = 0;
for (Bool_t cont = First(); cont == kTRUE; cont = Next()) {
- if ((fCurrentIdx1 < 0) || (fCurrentIdx1 > fNdim1)) continue;
- if ((fCurrentIdx2 < 0) || (fCurrentIdx2 > fNdim2)) continue;
+ if ((fCurrentIdx1 < 0) || (fCurrentIdx1 >= fNdim1)) continue;
+ if ((fCurrentIdx2 < 0) || (fCurrentIdx2 >= fNdim2)) continue;
if (fElements->At(fCurrentIndex) > threshold) over++;
}
}
+//_____________________________________________________________________________
+Float_t AliTRDdataArrayF::GetDataFast(Int_t idx1, Int_t idx2) const
+{
+ //
+ // Returns the data value at a given position of the array
+ // No boundary checking
+ //
+
+ return fElements->At(fIndex->At(idx2)+idx1);
+
+}
+
//_____________________________________________________________________________
void AliTRDdataArrayF::Compress(Int_t bufferType, Float_t threshold)
{
fNelems = fNdim1 * fNdim2;
Float_t *buf = new Float_t[fNelems];
+ memset(buf,0,fNelems*sizeof(Float_t));
fIndex->Set(fNdim2);
// Negative sign counts the unwritten values (under threshold)
if ((*fElements)[i] < 0) {
- //idx1 -= (Int_t) fElements->At(i);
idx1 -= TMath::Nint(fElements->At(i));
}
else {
- buf[(*fIndex)[idx2] + idx1] = fElements->At(i);
+ buf[(*fIndex)[idx2] + idx1] = (*fElements)[i];
idx1++;
}
if (idx1 == fNdim1) {
// Compress a buffer of type 1
//
- //AliTRDarrayF buf;
- //buf.Set(fNelems);
- //AliTRDarrayI index;
- //index.Set(fNdim2);
AliTRDarrayF *buf = new AliTRDarrayF();
buf->Set(fNelems);
AliTRDarrayI *index = new AliTRDarrayI();
for (Int_t idx2 = 0; idx2 < fNdim2; idx2++){
// Set the idx2 pointer
- //index[idx2] = icurrent + 1;
(*index)[idx2] = icurrent + 1;
// Reset the zero counter
if (izero > 0) {
// If we have currently izero counts under threshold
icurrent++;
- //if (icurrent >= buf.fN) buf.Expand(icurrent*2);
if (icurrent >= buf->fN) buf->Expand(icurrent*2);
// Store the number of entries below zero
- //buf[icurrent] = -izero;
(*buf)[icurrent] = -izero;
izero = 0;
}
icurrent++;
- //if (icurrent >= buf.fN) buf.Expand(icurrent*2);
if (icurrent >= buf->fN) buf->Expand(icurrent*2);
- //buf[icurrent] = GetDataFast(idx1,idx2);
(*buf)[icurrent] = GetDataFast(idx1,idx2);
} // If signal larger than threshold
} // End of loop over idx1
if (izero > 0) {
icurrent++;
- //if (icurrent >= buf.fN) buf.Expand(icurrent*2);
if (icurrent >= buf->fN) buf->Expand(icurrent*2);
// Store the number of entries below zero
- //buf[icurrent] = -izero;
(*buf)[icurrent] = -izero;
}
}
- //buf.Expand(icurrent+1);
- //(*fElements) = buf;
- //fNelems = fElements->fN;
- //fBufType = 1;
- //(*fIndex) = index;
buf->Expand(icurrent+1);
if (fElements) delete fElements;
fElements = buf;
//
Int_t i, k;
+
Float_t *buf = new Float_t[fNelems];
+ memset(buf,0,fNelems*sizeof(Float_t));
fNelems = fNdim1 * fNdim2;
fIndex->Set(fNdim2);
}
-//____________________________________________________________________________
-Float_t AliTRDdataArrayF::GetDataFast(Int_t idx1, Int_t idx2) const
-{
- //
- // Returns the value at a given position in the array
- //
-
- return fElements->At(fIndex->At(idx2) + idx1);
-
-}
-
//_____________________________________________________________________________
void AliTRDdataArrayF::SetData(Int_t row, Int_t col, Int_t time, Float_t value)
{
}
//_____________________________________________________________________________
-void AliTRDdataArrayF::SetDataFast(Int_t idx1, Int_t idx2, Float_t value)
+void AliTRDdataArrayF::SetDataFast(Int_t idx1, Int_t idx2, Float_t value)
{
//
- // Set the value at a given position in the array
+ // Sets the data value at a given position of the array
+ // No boundary checking
//
- if ((idx1 < 0) || (idx1 >= fNdim1) ||
- (idx2 < 0) || (idx2 >= fNdim2)) {
- TObject::Error("SetDataFast"
- ,"idx1 %d idx2 %d out of bounds (size: %d x %d, this: 0x%08x)"
- ,idx1,idx2,fNdim1,fNdim2,this);
- }
-
- (*fElements)[fIndex->fArray[idx2] + idx1] = value;
+ (*fElements)[fIndex->fArray[idx2]+idx1] = value;
}