#include "TError.h"
#include "AliSegmentID.h"
#include "AliH2F.h"
-#include "AliArrayI.h"
-#include "AliArrayS.h"
+#include "TArrayI.h"
#include "AliDigits.h"
#include "AliSimDigits.h"
#include "AliTPCdigit.h"
ClassImp(AliSimDigits)
AliSimDigits::AliSimDigits()
+ :AliDigits(),
+ fTracks(0),
+ fTrIndex(0),
+ fNlevel(0),
+ fTrBufType(0)
{
// AliDigits::Invalite();
- fTracks = 0;
- fTrIndex = 0;
+
InvalidateTrack();
}
+//
+AliSimDigits::AliSimDigits(const AliSimDigits ¶m)
+ :AliDigits(),
+ fTracks(0),
+ fTrIndex(0),
+ fNlevel(0),
+ fTrBufType(0)
+{
+ //
+ // dummy
+ //
+ fTrIndex = param.fTrIndex;
+}
+//
AliSimDigits::~AliSimDigits()
{
}
}
+AliSimDigits & AliSimDigits::operator =(const AliSimDigits & param)
+{
+ //
+ // assignment operator - dummy
+ //
+ fTrIndex=param.fTrIndex;
+ return (*this);
+}
+//__________________________________________________________________
void AliSimDigits::InvalidateTrack()
{
//
//set default (invalid parameters)
if ( fTracks != 0) delete fTracks;
- fTracks = new AliArrayI;
+ fTracks = new TArrayI;
if ( fTrIndex != 0) delete fTrIndex;
- fTrIndex = new AliArrayI;
+ fTrIndex = new TArrayI;
for (Int_t i = 0; i<3; i++){
fTracks->Set(0);
Int_t all = fNrows*fNcols; //total number of digits
Int_t elems = all*fNlevel; //length of the buffer
- AliArrayI * buf = new AliArrayI;
+ TArrayI * buf = new TArrayI;
buf->Set(elems);
fTrIndex->Set(0);
//
num %= 10000000; //PH: take into account the case of underlying events
i++;
Int_t id = fTracks->At(i);
- for (j = 0; j<num; j++,row++) (*buf)[level*all+col*fNrows+row]=id;
+ for (j = 0; j<num; j++,row++) {
+ if (level*all+col*fNrows+row<elems) (*buf)[level*all+col*fNrows+row]=id;
+ }
}
if (row>=fNrows) {
row=0;
//
fTrBufType = 1;
- AliArrayI * buf = new AliArrayI; //create new buffer
+ TArrayI * buf = new TArrayI; //create new buffer
buf->Set(fNrows*fNcols*fNlevel); //lets have the nearly the "worst case"
- AliArrayI * index = new AliArrayI;
+ TArrayI * index = new TArrayI;
index->Set(fNcols*fNlevel);
// Int_t * pindex =
if (id <= 0) {
if ( inum> 0 ) { //if we have some tracks in buffer
icurrent++;
- if ((icurrent+1)>=buf->fN) buf->Expand(icurrent*2+1); //MI change - allocate +1
+ if ((icurrent+1)>=buf->fN) buf->Set(icurrent*2+1); //MI change - allocate +1
(*buf)[icurrent] = inum;
icurrent++;
(*buf)[icurrent] = lastID;
if ( izero > 0 ) {
//if we have currently izero count of non tracks digits
icurrent++;
- if (icurrent>=buf->fN) buf->Expand(icurrent*2+1);
+ if (icurrent>=buf->fN) buf->Set(icurrent*2+1);
(*buf)[icurrent]= -izero; //write how many under zero
inum++;
izero = 0;
else{
//if we change track id from another track id
icurrent++;
- if ((icurrent+1)>=buf->fN) buf->Expand(icurrent*2+1);
+ if ((icurrent+1)>=buf->fN) buf->Set(icurrent*2+1);
(*buf)[icurrent] = inum;
icurrent++;
(*buf)[icurrent] = lastID;
if ( izero > 0 ) {
//if we have currently izero count of non tracks digits
icurrent++;
- if (icurrent>=buf->fN) buf->Expand(icurrent*2);
+ if (icurrent>=buf->fN) buf->Set(icurrent*2);
(*buf)[icurrent]= -izero; //write how many under zero
}
if ( inum> 0 ) { //if we have some tracks in buffer
icurrent++;
- if ((icurrent+1)>=buf->fN) buf->Expand(icurrent*2);
+ if ((icurrent+1)>=buf->fN) buf->Set(icurrent*2);
(*buf)[icurrent] = inum;
icurrent++;
(*buf)[icurrent] = id;
}
}//end of loop over columns
}//end of loop over differnet track level
- buf->Expand(icurrent+1);
+ buf->Set(icurrent+1);
delete fTracks;
fTracks = buf;
delete fTrIndex;
}
return digits;
}
+void AliSimDigits::GlitchFilter(){
+ //
+ // glitch filter, optionally
+ //
+
+ for (Int_t i=0;i<fNcols;i++){ //pads
+ for(Int_t j=1;j<fNrows-1;j++){ //time bins
+ // first and last time bins are checked separately
+ if(GetDigitFast(j,i)){// nonzero digit
+ if (!GetDigitFast(j-1,i) && !GetDigitFast(j+1,i)) {
+ SetDigitFast(0,j,i);
+ SetTrackIDFast(-2,j,i,0);
+ SetTrackIDFast(-2,j,i,1);
+ SetTrackIDFast(-2,j,i,2);
+ }
+ }
+ }//time
+
+ if(GetDigitFast(0,i) && !GetDigitFast(1,i)) {
+ SetDigitFast(0,0,i);
+ SetTrackIDFast(-2,0,i,0);
+ SetTrackIDFast(-2,0,i,1);
+ SetTrackIDFast(-2,0,i,2);
+ }
+ if(GetDigitFast(fNrows-1,i) && !GetDigitFast(fNrows-2,i)){
+ SetDigitFast(0,fNrows-1,i);
+ SetTrackIDFast(-2,fNrows-1,i,0);
+ SetTrackIDFast(-2,fNrows-1,i,1);
+ SetTrackIDFast(-2,fNrows-1,i,2);
+ }
+ }//pads
+
+}