-
- if(GetpListItem(i,j)==0){ // most create AliITSpListItem
- fa->AddAt(new AliITSpListItem(mod,GetIndex(i,j),noise),
- GetIndex(i,j));
- }else{ // AliITSpListItem exists, just add signal to it.
- GetpListItem(i,j)->AddNoise(mod,GetIndex(i,j),noise);
- } // end if
-}
-//______________________________________________________________________
-
-ClassImp(AliITSpListItem)
-//______________________________________________________________________
-AliITSpListItem::AliITSpListItem(){
- // Default constructor
-
- fmodule = -1;
- findex = -1;
- for(Int_t i=0;i<this->fkSize;i++){
- this->fTrack[i] = -2;
- this->fHits[i] = -2;
- this->fSignal[i] = 0.0;
- } // end if i
- fTsignal = 0.0;
- fNoise = 0.0;
-}
-//______________________________________________________________________
-AliITSpListItem::AliITSpListItem(Int_t module,Int_t index,Double_t noise){
- // Standard noise constructor
-
- this->fmodule = module;
- this->findex = index;
- for(Int_t i=0;i<this->fkSize;i++){
- this->fTrack[i] = -2;
- this->fSignal[i] = 0.0;
- this->fHits[i] = 0;
- } // end if i
- this->fTsignal = 0.0;
- this->fNoise = noise;
-}
-//______________________________________________________________________
-AliITSpListItem::AliITSpListItem(Int_t track,Int_t hit,Int_t module,
- Int_t index,Double_t signal){
- // Standard signal constructor
-
- this->fmodule = module;
- this->findex = index;
- this->fTrack[0] = track;
- this->fHits[0] = hit;
- this->fSignal[0] = signal;
- for(Int_t i=1;i<this->fkSize;i++){
- this->fTrack[i] = -2;
- this->fSignal[i] = 0.0;
- this->fHits[i] = 0;
- } // end if i
- this->fTsignal = signal;
- this->fNoise = 0.0;
-}
-//______________________________________________________________________
-AliITSpListItem::~AliITSpListItem(){
- // Denstructor
-
- this->fmodule = 0;
- this->findex =0;
- for(Int_t i=0;i<=this->GetNsignals();i++){
- this->fTrack[i] = 0;
- this->fSignal[i] = 0.0;
- this->fHits[i] = 0;
- } // end if i
- this->fTsignal = 0.0;
- this->fNoise =0.0;
-}
-//______________________________________________________________________
-AliITSpListItem& AliITSpListItem::operator=(const AliITSpListItem &source){
- // = operator
-
- if(this == &source) return *this;
-
- this->fmodule = source.fmodule;
- this->findex = source.findex;
- for(Int_t i=0;i<this->fkSize;i++){
- this->fTrack[i] = source.fTrack[i];
- this->fSignal[i] = source.fSignal[i];
- this->fHits[i] = source.fHits[i];
- } // end if i
- this->fTsignal = source.fTsignal;
- this->fNoise = source.fNoise;
-
- return *this;
-}
-//______________________________________________________________________
-AliITSpListItem::AliITSpListItem(AliITSpListItem &source){
- // Copy operator
-
- *this = source;
-}
-//______________________________________________________________________
-void AliITSpListItem::AddSignal(Int_t track,Int_t hit,Int_t module,
- Int_t index,Double_t signal){
- // Adds this track number and sinal to the pList and orders them
- Int_t i,j,trk,hts;
- Double_t sig;
- Bool_t flg=kFALSE;
-
- if(findex!=index || fmodule!=module)
- Warning("AddSignal","index=%d != findex=%d or module=%d != fmodule=%d",
- index,findex,module,fmodule);
- fTsignal += signal; // Keep track of sum signal.
- if(signal<=fSignal[fkSize-1]) return; // smaller than smallest
- for(i=0;i<fkSize;i++)if(track==fTrack[i] && hit ==fHits[i]){
- fSignal[i] += signal;
- flg = kTRUE;
- } // end for i & if.
- if(flg){ // resort arrays. fkSize is small use Insertin sort.
- for(i=1;i<fkSize;i++){
- trk = fTrack[i];
- hts = fHits[i];
- sig = fSignal[i];
- j = i-1;
- while(j>=0 && fSignal[i]>signal){
- fTrack[j+1] = fTrack[j];
- fHits[j+1] = fHits[j];
- fSignal[j+1] = fSignal[j];
- j--;
- } // end while
- fTrack[j+1] = trk;
- fHits[j+1] = hts;
- fSignal[j+1] = sig;
- } // end if i
- }else{ // new entry add it in order.
- if(!(signal <= fSignal[fkSize-1])) for(i=fkSize-2;i>=0;i--){
- if(signal > fSignal[i]){
- fSignal[i+1] = fSignal[i];
- fTrack[i+1] = fTrack[i];
- fHits[i+1] = fHits[i];
- }else{
- fSignal[i] = signal;
- fTrack[i] = track;
- fHits[i] = hit;
- } // end if
- } // end if; end for i
- } // end if flg
-}
-//______________________________________________________________________
-void AliITSpListItem::AddNoise(Int_t module,Int_t index,Double_t noise){
- // Addes noise to this existing list.
-
- if(findex!=index || fmodule!=module)
- Warning("AddSignal","index=%d != findex=%d or module=%d != fmodule=%d",
- index,findex,module,fmodule);
- fNoise += noise; // Keep track of sum signal.
-}
-//______________________________________________________________________
-void AliITSpListItem::AddTo(Int_t fileIndex,AliITSpListItem *pl){
- // Adds the contents of pl to this with track number off set given by
- // fileIndex.
- Int_t i,trk;
- Double_t sig=0.0;
-
- for(i=0;i<pl->GetNsignals()&&i<this->GetNsignals();i++){
- trk = pl->GetTrack(i);
- trk = pl->ShiftIndex(fileIndex,trk);
- this->AddSignal(trk,pl->GetHit(i),pl->GetModule(),pl->GetIndex(),pl->GetSignal(i));
- sig += pl->GetSignal(i);
- } // end for i
- this->fNoise += pl->fNoise;
+ // Inputs:
+ // Int_t i Row number for this noise
+ // Int_t j Column number for this noise
+ // Double_t noise The noise signal value.
+ // Outputs:
+ // none.
+ // Return:
+ // none.
+ Int_t index = GetIndex(i,j);
+ if (index<0) return;
+ AliITSpListItem &lit = fa[index];
+ if(!lit.IsUsed()){
+ lit.Build(mod,index,noise);
+ }
+ else {
+ lit.AddNoise(mod,index,noise);
+ }
+ if(index>=fEntries) fEntries = index +1;
+}
+//______________________________________________________________________
+void AliITSpList::GetCell(Int_t index,Int_t &i,Int_t &j) const {
+ // returns the i,j index numbers from the linearized index computed
+ // with GetIndex
+ if(index<0 || index>=fNi*fNj){
+ Warning("GetCell","Index out of range 0<=index=%d<%d",
+ index,fNi*fNj);
+ i=-1;j=-1;