]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Coding conventions for classes AliITSpList and AliITSpListItem
authormasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 19 Jan 2004 11:04:32 +0000 (11:04 +0000)
committermasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 19 Jan 2004 11:04:32 +0000 (11:04 +0000)
ITS/AliITSMap.h
ITS/AliITSMapA1.cxx
ITS/AliITSMapA1.h
ITS/AliITSMapA2.h
ITS/AliITSpList.cxx
ITS/AliITSpList.h
ITS/AliITSpListItem.cxx [new file with mode: 0644]
ITS/AliITSpListItem.h [new file with mode: 0644]

index 3ce043097d1a45b49cb88df3d67117379a467003..ca9b28b8d6f898244ce45d8278b3d480106f5a0f 100644 (file)
@@ -30,7 +30,7 @@ class AliITSMap : public TObject {
     // Flag a hit as used
     virtual  void  FlagHit(Int_t iz, Int_t ix)                     =0;    
     // Get index of hit in the list of digits
-    virtual Int_t  GetHitIndex(Int_t iz, Int_t ix)                 =0;
+    virtual Int_t  GetHitIndex(Int_t iz, Int_t ix) const           =0;
     // Get pointer to digit
     virtual TObject * GetHit(Int_t iz, Int_t ix)                   =0;
     // Test hit status
index f4f5f4782d2af5e548b41b02f8a94aa39eec541b..787d5759646ac2f5a670ae41dd66dfcf430b2130 100644 (file)
@@ -127,7 +127,7 @@ void AliITSMapA1::SetArray(TObjArray *obj){
     if (fObjects) fNobjects = fObjects->GetEntriesFast();
 }
 //______________________________________________________________________
-Int_t AliITSMapA1::CheckedIndex(Int_t iz, Int_t ix){
+Int_t AliITSMapA1::CheckedIndex(Int_t iz, Int_t ix) const {
     //check boundaries and return an index in array
     Int_t index=fNpx*iz+ix;
 
@@ -175,7 +175,7 @@ void AliITSMapA1::FlagHit(Int_t iz, Int_t ix){
     fHitMap[CheckedIndex(iz, ix)] = -TMath::Abs(fHitMap[CheckedIndex(iz, ix)]);
 }
 //______________________________________________________________________
-Int_t AliITSMapA1::GetHitIndex(Int_t iz, Int_t ix){
+Int_t AliITSMapA1::GetHitIndex(Int_t iz, Int_t ix) const {
     // return the digit index from a specific entry in array
 
     return TMath::Abs(fHitMap[CheckedIndex(iz, ix)])-1;
index 7a8bcc4a476540362ab0014ed273ab6095e51ccc..159c129ec4e611c4473d0ff1d5f456f1c94fa942 100644 (file)
@@ -40,7 +40,7 @@ class AliITSMapA1 : public AliITSMap{
     // Delete a single hit
     virtual  void  DeleteHit(Int_t iz, Int_t ix);
     // Get index of hit in the list of digits
-    virtual Int_t  GetHitIndex(Int_t iz, Int_t ix);
+    virtual Int_t  GetHitIndex(Int_t iz, Int_t ix) const ;
     // Get pointer to digit
     virtual TObject* GetHit(Int_t iz, Int_t ix);
     // Flag a hit as used
@@ -56,7 +56,7 @@ class AliITSMapA1 : public AliITSMap{
 
  protected:
     // Check index
-    Int_t   CheckedIndex(Int_t iz, Int_t ix);
+    Int_t   CheckedIndex(Int_t iz, Int_t ix) const;
 
     // Data members
     AliITSsegmentation *fSegmentation;   // segmentation class
index 8f7e260a0d61867108ca436bde39d7ce44902fcb..af26d8e7f1d7c9daa91540679ee26ed8eab27afe 100644 (file)
@@ -49,7 +49,7 @@ class AliITSMapA2 : public AliITSMapA1{
     virtual  void  DeleteHit(Int_t iz, Int_t ix){
        fHitMapD[CheckedIndex(iz, ix)]=0;}
     //return the index of an entry in array
-    virtual Int_t  GetHitIndex(Int_t iz, Int_t ix){
+    virtual Int_t  GetHitIndex(Int_t iz, Int_t ix) const {
        return CheckedIndex(iz, ix);};
     // Get object (1D histogram)
     virtual TObject *GetHit(Int_t iz, Int_t dummy);
index 9d3a58e49922a102a1ab7f127c24d4c6f3264606..07dfab04d0696efdc0ce2fc60b56e223979f7441 100644 (file)
  **************************************************************************/
 /* $Id$ */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <Riostream.h>
+//***********************************************************************
+//
+// It consist of a TObjectArray of 
+// AliITSpListItem objects
+// This array can be accessed via 2 indexed
+// it is used at digitization level by 
+// all the 3 ITS subdetectors
+//
+// ***********************************************************************
+
 #include <TObjArray.h>
-#include <TRandom.h>
-#include <TMath.h>
 
 #include "AliITSpList.h"
+#include "AliITSpListItem.h"
+
 
 //______________________________________________________________________
 
@@ -76,6 +83,7 @@ AliITSpList::~AliITSpList(){
     fa  = 0;
     fEnteries = 0;
 }
+
 //______________________________________________________________________
 void AliITSpList::ClearMap(){
     // Delete all AliITSpListItems and zero TObjArray.
@@ -140,16 +148,13 @@ AliITSpList& AliITSpList::operator=(const AliITSpList &source){
     return *this;
 }
 //______________________________________________________________________
-AliITSpList::AliITSpList(AliITSpList &source) : AliITSMap(source){
-    // Copy operator
-    // Inputs:
-    //    AliITSpList &source   A AliITSpList Object
-    // Outputs:
-    //    none.
-    // Return:
-    //    A copied AliITSpList object
+AliITSpList::AliITSpList(const AliITSpList &source) : AliITSMap(source){
+    // Copy constructor
 
-    *this = source;
+  fNi = source.fNi;
+  fNj = source.fNj;
+  fa = new TObjArray(*(source.fa));
+  fEnteries = source.fEnteries;
 }
 //______________________________________________________________________
 void AliITSpList::AddItemTo(Int_t fileIndex, AliITSpListItem *pl) {
@@ -219,389 +224,27 @@ void AliITSpList::AddNoise(Int_t i,Int_t j,Int_t mod,Double_t noise){
     if(index>=fEnteries) fEnteries = index +1;
 }
 //______________________________________________________________________
-
-ClassImp(AliITSpListItem)
-//______________________________________________________________________
-AliITSpListItem::AliITSpListItem(){
-    // Default constructor
-    // Inputs:
-    //    none.
-    // Outputs:
-    //    none.
-    // Return:
-    //    A zeroed/empty AliITSpListItem class.
-
-    fmodule = -1;
-    findex  = -1;
-    for(Int_t i=0;i<this->fkSize;i++){
-        this->fTrack[i]  = -2;
-        this->fHits[i]   = -1;
-        this->fSignal[i] = 0.0;
-    } // end if i
-    fTsignal = 0.0;
-    fNoise   = 0.0;
-    fSignalAfterElect = 0.0;
-}
-//______________________________________________________________________
-AliITSpListItem::AliITSpListItem(Int_t module,Int_t index,Double_t noise){
-    // Standard noise constructor
-    // Inputs:
-    //    Int_t module   The module where this noise occurred
-    //    Int_t index    The cell index where this noise occurred
-    //    Double_t noise The value of the noise.
-    // Outputs:
-    //    none.
-    // Return:
-    //    A setup and noise filled AliITSpListItem class.
-
-    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]   = -1;
-    } // end if i
-    this->fTsignal = 0.0;
-    this->fSignalAfterElect = 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
-    // Inputs:
-    //    Int_t track     The track number which produced this signal
-    //    Int_t hit       The hit number which produced this signal
-    //    Int_t module    The module where this signal occurred
-    //    Int_t index     The cell index where this signal occurred
-    //    Double_t signal The value of the signal (ionization)
-    // Outputs:
-    //    none.
-    // Return:
-    //    A setup and signal filled  AliITSpListItem class.
-
-    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]   = -1;
-    } // end if i
-    this->fTsignal = signal;
-    this->fNoise   = 0.0;
-    this->fSignalAfterElect   = 0.0;
-}
-//______________________________________________________________________
-AliITSpListItem::~AliITSpListItem(){
-    // Destructor
-    // Inputs:
-    //    none.
-    // Outputs:
-    //    none.
-    // Return:
-    //    A properly destroyed AliITSpListItem class.
-
-}
-//______________________________________________________________________
-AliITSpListItem& AliITSpListItem::operator=(const AliITSpListItem &source){
-    // = operator
-    // Inputs:
-    //    AliITSpListItem &source   A AliITSpListItem Object
-    // Outputs:
-    //    none.
-    // Return:
-    //    A copied AliITSpListItem object
-    Int_t i;
-
-    if(this == &source) return *this;
-
-    this->fmodule = source.fmodule;
-    this->findex  = source.findex;
-    for(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;
-    this->fSignalAfterElect   = source.fSignalAfterElect;
-    /*
-    cout <<"this fTrack[0-9]=";
-    for(i=0;i<this->fkSize;i++) cout <<this->fTrack[i]<<",";
-    cout <<" fHits[0-9]=";
-    for(i=0;i<this->fkSize;i++) cout <<this->fHits[i]<<",";
-    cout <<" fSignal[0-9]=";
-    for(i=0;i<this->fkSize;i++) cout <<this->fSignal[i]<<",";
-    cout << endl;
-    cout <<"source fTrack[0-9]=";
-    for(i=0;i<this->fkSize;i++) cout <<source.fTrack[i]<<",";
-    cout <<" fHits[0-9]=";
-    for(i=0;i<this->fkSize;i++) cout <<source.fHits[i]<<",";
-    cout <<" fSignal[0-9]=";
-    for(i=0;i<this->fkSize;i++) cout <<source.fSignal[i]<<",";
-    cout << endl;
-    */
-    return *this;
-}
-//______________________________________________________________________
-AliITSpListItem::AliITSpListItem(AliITSpListItem &source) : TObject(source){
-    // Copy operator
-    // Inputs:
-    //    AliITSpListItem &source   A AliITSpListItem Object
-    // Outputs:
-    //    none.
-    // Return:
-    //    A copied AliITSpListItem object
-
-    *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 signal to the pList and orders them
-    // Inputs:
-    //    Int_t track     The track number which produced this signal
-    //    Int_t hit       The hit number which produced this signal
-    //    Int_t module    The module where this signal occurred
-    //    Int_t index     The cell index where this signal occurred
-    //    Double_t signal The value of the signal (ionization)
-    // Outputs:
-    //    none.
-    // Return:
-    //    none.
-    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.
-
-    //    for(i=0;i<fkSize;i++) if( track==fTrack[i] && hit==fHits[i] ){
-    for(i=0;i<fkSize;i++) if( track==fTrack[i]  ){
-        fSignal[i] += signal;
-        flg = kTRUE;
-    } // end for i & if.
-    //cout << "track="<<track<<endl;
-    if(flg){ // resort arrays.  
-        for(i=1;i<fkSize;i++){
-            j = i;
-            while(j>0 && fSignal[j]>fSignal[j-1]){
-                trk = fTrack[j-1];
-                hts = fHits[j-1];
-                sig = fSignal[j-1];
-                fTrack[j-1]  = fTrack[j];
-                fHits[j-1]   = fHits[j];
-                fSignal[j-1] = fSignal[j];                
-                fTrack[j]  = trk;
-                fHits[j]   = hts;
-                fSignal[j] = sig;
-               //cout << "#fTrack["<<j-1<<"]="<<fTrack[j-1]<< " fTrack["<<
-               // j<<"]="<<fTrack[j]<<endl;
-                j--;
-            } // end while
-        } // end if i
-        return;
-    } // end if added to existing and resorted array
-
-    // new entry add it in order.
-    // if this signal is <= smallest then don't add it.
-    if(signal <= fSignal[fkSize-1]) return;
-    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+1] = signal;
-            fTrack[i+1]  = track;
-            fHits[i+1]   = hit;
-            return; // put it in the right place, now exit.
-        } //  end if
-       //cout << "$fTrack["<<i+1<<"]="<<fTrack[i+1]<< " fTrack["<<i<<"]="
-       //<<fTrack[i]<< " fHits["<<i+1<<"]="<<fHits[i+1]<< " fHits["<<i<<"]="
-       //<<fHits[i]<< " fSignal["<<i+1<<"]="<<fSignal[i+1]<< " fSignal["<<i
-       //<<"]="<<fSignal[i]<<endl;
-    } // end if; end for i
-    // Still haven't found the right place. Must be at top of list.
-    fSignal[0] = signal;
-    fTrack[0]  = track;
-    fHits[0]   = hit;
-    //cout << "$fTrack["<<0<<"]="<<fTrack[0]<<" fHits["<<0<<"]="<<fHits[0]
-    //<<" fSignal["<<0<<"]="<<fSignal[0]<<endl;
-    return;
-}
-//______________________________________________________________________
-void AliITSpListItem::AddNoise(Int_t module,Int_t index,Double_t noise){
-    // Adds noise to this existing list.
-    // Inputs:
-    //    Int_t module   The module where this noise occurred
-    //    Int_t index    The cell index where this noise occurred
-    //    Double_t noise The value of the noise.
-    // Outputs:
-    //    none.
-    // Return:
-    //    none.
-
-    if(findex!=index || fmodule!=module) 
-        Warning("AddNoise","index=%d != findex=%d or module=%d != fmodule=%d",
-            index,findex,module,fmodule);
-    fNoise += noise; // Keep track of sum signal.
-}
-//______________________________________________________________________
-void AliITSpListItem::AddSignalAfterElect(Int_t module,Int_t index,Double_t signal){
-    // Adds signal after electronics to this existing list.
-    // Inputs:
-    //    Int_t module   The module where this noise occurred
-    //    Int_t index    The cell index where this noise occurred
-    //    Double_t signal The value of the signal.
-    // Outputs:
-    //    none.
-    // Return:
-    //    none.
-
-    if(findex!=index || fmodule!=module) 
-        Warning("AddSignalAfterElect","index=%d != findex=%d or module=%d "
-               "!= fmodule=%d",index,findex,module,fmodule);
-    fSignalAfterElect += signal; // Keep track of sum signal.
-}
-//______________________________________________________________________
-void AliITSpListItem::Add(AliITSpListItem *pl){
-    // Adds the contents of pl to this
-    // pl could come from different module and index 
-    // Inputs:
-    //    AliITSpListItem *pl  an AliITSpListItem to be added to this class.
-    // Outputs:
-    //    none.
-    // Return:
-    //    none.
-    Int_t i;
-    Double_t sig  = 0.0;
-    Double_t sigT = 0.0;
-
-    for(i=0;i<pl->GetNsignals();i++){
-        sig = pl->GetSignal(i); 
-        if( sig <= 0.0 ) break; // no more signals
-        AddSignal(pl->GetTrack(i),pl->GetHit(i),fmodule,findex,sig);
-        sigT += sig;
-    } // end for i
-    fTsignal += (pl->fTsignal - sigT);
-    fNoise   += pl->fNoise;
-    return;
-}
-//______________________________________________________________________
-void AliITSpListItem::AddTo(Int_t fileIndex,AliITSpListItem *pl){
-    // Adds the contents of pl to this with track number off set given by
-    // fileIndex.
-    // Inputs:
-    //    Int_t fileIndex      track number offset value
-    //    AliITSpListItem *pl  an AliITSpListItem to be added to this class.
-    // Outputs:
-    //    none.
-    // Return:
-    //    none.
-    Int_t i,trk;
-    Double_t sig  = 0.0;
-
-    Int_t module = pl->GetModule();
-    Int_t index  = pl->GetIndex();
-    for(i=0;i<pl->GetNsignals();i++){
-        sig = pl->GetSignal(i); 
-        if( sig <= 0.0 ) break; // no more signals
-        trk = pl->GetTrack(i);
-        trk += fileIndex; 
-        AddSignal(trk,pl->GetHit(i),module,index,sig);
-    } // end for i
-    fSignalAfterElect += (pl->fSignalAfterElect + pl->fNoise - fNoise);
-    fNoise = pl->fNoise;
+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;
     return;
+  } // end if
+  i = index/fNj;
+  j = index - fNj*i;
+  return;
+}
+//______________________________________________________________________
+Int_t AliITSpList::GetIndex(Int_t i, Int_t j) const {
+ // returns the TObjArray index for a given set of map indexes.
+  if(i<0||i>=fNi || j<0||j>=fNj){
+    Warning("GetIndex","Index out of range 0<i=%d<%d and 0<0j=%d<%d",i,fNi,j,fNj);
+    return -1;
+  }
+  else {
+    return fNj*i+j;
+  }
 }
-//______________________________________________________________________
-Int_t AliITSpListItem::ShiftIndex(Int_t in,Int_t trk){
-    // Shift an index number to occupy the upper four bits. No longer used.
-    // Inputs:
-    //    Int_t in   The file number
-    //    Int_t trk  The track number
-    // Outputs:
-    //    none.
-    // Return:
-    //    Int_t The track number with the file number in the upper bits.
-    Int_t si = sizeof(Int_t) * 8;
-    UInt_t uin,utrk; // use UInt_t to avoid interger overflow-> goes negative.
-
-    uin = in;
-    utrk = trk;
-    for(Int_t i=0;i<si-4;i++) uin *= 2;
-    uin += utrk;
-    in = uin;
-    return in;
-}
-//______________________________________________________________________
-void AliITSpListItem::Print(ostream *os){
-    //Standard output format for this class
-    // Inputs:
-    //    ostream *os  The output stream
-    // Outputs:
-    //    none.
-    // Return:
-    //    none.
-    Int_t i;
-
-    *os << fmodule <<","<<findex<<",";
-    *os << fkSize <<",";
-    for(i=0;i<fkSize;i++) *os << fTrack[i] <<",";
-    for(i=0;i<fkSize;i++) *os << fHits[i] <<",";
-    for(i=0;i<fkSize;i++) *os << fSignal[i] <<",";
-    *os << fTsignal <<","<< fNoise << "," << fSignalAfterElect;
-}
-//______________________________________________________________________
-void AliITSpListItem::Read(istream *is){
-    // Standard output streaming function.
-    // Inputs:
-    //    istream *is The input stream
-    // Outputs:
-    //    none.
-    // Return:
-    //    none.
-    Int_t i,iss;
-
-    *is >> fmodule >> findex;
-    *is >> iss; // read in fkSize
-    for(i=0;i<fkSize&&i<iss;i++) *is >> fTrack[i];
-    for(i=0;i<fkSize&&i<iss;i++) *is >> fHits[i];
-    for(i=0;i<fkSize&&i<iss;i++) *is >> fSignal[i];
-    *is >> fTsignal >> fNoise >> fSignalAfterElect;
-}
-//______________________________________________________________________
-ostream &operator<<(ostream &os,AliITSpListItem &source){
-    // Standard output streaming function.
-    // Inputs:
-    //    ostream &os             The output stream
-    //    AliITSpListItem &source The AliITSpListItem object to be written out.
-    // Outputs:
-    //    none.
-    // Return:
-    //    ostream  The output stream
-
-    source.Print(&os);
-    return os;
-}
-//______________________________________________________________________
-istream &operator>>(istream &os,AliITSpListItem &source){
-    // Standard output streaming function.
-    // Inputs:
-    //    istream os              The input stream
-    //    AliITSpListItem &source The AliITSpListItem object to be inputted
-    // Outputs:
-    //    none.
-    // Return:
-    //    istream The input stream.
-
-    source.Read(&os);
-    return os;
-}
-
index 24efb7e60409ef8163d31cd7ff71fbe32debe39c..5f9f200345c24daf6d1829af8c9576a73c636935 100644 (file)
-#ifndef ALIITSPLISTSSDITEM_H
-#define ALIITSPLISTSSDITEM_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice     */
-
-/* $Id$ */
-
-#include <TObject.h>
-
-
-class AliITSpListItem: public TObject {
- public:
-    // Default Constructor
-    AliITSpListItem();
-    // Standard Signal Constructor
-    AliITSpListItem(Int_t track,Int_t hit,Int_t module,Int_t index,
-                  Double_t signal);
-    // Standard Noise Constructor
-    AliITSpListItem(Int_t module,Int_t index,Double_t signal);
-    // Class destrutor
-    virtual ~AliITSpListItem();
-    // Copy Oporator
-    AliITSpListItem(AliITSpListItem &source);
-    // = Opoerator
-    virtual AliITSpListItem& operator=(const AliITSpListItem &source);
-    // Returns the signal value in the list of signals
-    virtual Double_t GetSignal(Int_t i){
-                           return ( (i>=0&&i<fkSize) ? fSignal[i] : 0.0);}
-    virtual Double_t GetSignal(){
-                           return fTsignal;}
-    virtual Double_t GetSignalAfterElect(){
-                           return fSignalAfterElect;}
-    // Returns the Sum/Total signal
-    virtual Double_t GetSumSignal() const {return fTsignal+fNoise;}
-    // Returns the  noise
-    virtual Double_t GetNoise() const {return fNoise;}
-    // Returns the number of stored singals.
-    virtual Int_t GetNsignals() const {return fkSize;}
-    // Addes track number and signal to this existing list.
-    virtual void AddSignal(Int_t track,Int_t hit,Int_t module,
-                          Int_t index,Double_t signal);
-    // Adds signal after electronics to this existing list.
-    virtual void AddSignalAfterElect(Int_t module,Int_t index,Double_t signal);
-    // Addes noise to this existing list.
-    virtual void AddNoise(Int_t module,Int_t index,Double_t noise);
-    // Returns track number.
-    virtual Int_t GetTrack(Int_t i){
-                           return ((i>=0&&i<fkSize) ? fTrack[i] : 0);}
-    // Returns hit number.
-    virtual Int_t GetHit(Int_t i){
-                           return ((i>=0&&i<fkSize) ? fHits[i] : 0);}
-    // Returns module number.
-    virtual Int_t GetModule(){
-                           return fmodule;}
-    // Returns index number.
-    virtual Int_t GetIndex(){
-                           return findex;}
-    // Adds the contents of pl to this 
-    virtual void Add(AliITSpListItem *pl);
-    // Adds the contents of pl to this with track number off set given by
-    // fileIndex.
-    virtual void AddTo(Int_t fileIndex,AliITSpListItem *pl);
-    // Shift an index number to occupy the upper four bits.
-    virtual Int_t ShiftIndex(Int_t in,Int_t trk);
-    // Standard ascii class print function
-    void Print(ostream *os);
-    // Standard ascii class read function
-    void Read(istream *is);
-    // Returns max size of array for for Tracks, Hits, and signals.
-    static Int_t GetMaxKept() {return fkSize;};
-
- private:
-    static const Int_t fkSize = 10; // Array sizes
-    Int_t    fmodule;         // module number
-    Int_t    findex;          // Strip/row,col number linearlized.
-    Int_t    fTrack[fkSize];  //[fkSize] track Number
-    Int_t    fHits[fkSize];   //[fkSize] hit number
-    Double_t fSignal[fkSize]; //[fkSize] Signals
-    Double_t fTsignal;        // Total signal (no noise)
-    Double_t fNoise;          // Total noise, coupling, ...
-    Double_t fSignalAfterElect; // Signal after electronics
-
-    ClassDef(AliITSpListItem,3) // Item list of signals and track numbers
-};     
-// Input and output functions for standard C++ input/output.
-ostream & operator<<(ostream &os,AliITSpListItem &source);
-istream & operator>>(istream &is,AliITSpListItem &source);
-
-
-#endif
-
-#ifndef ALIITSPLISTSSD_H
-#define ALIITSPLISTSSD_H
+#ifndef ALIITSPLIST_H
+#define ALIITSPLIST_H
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice     */
 
 #include "AliITSMap.h"
-
+#include "AliITSpListItem.h"
 class TObjArray;
-class AliITSpListItem;
+// class AliITSpListItem;
 
 class AliITSpList: public AliITSMap {
- private:
-    // returns the TObjArray index for a give set of map indecies.
-    Int_t GetIndex(Int_t i,Int_t j){
-       if(i<0||i>=fNi || j<0||j>=fNj){
-           Warning("GetIndex","Index out of range 0<i=%d<%d and 0<0j=%d<%d",
-                   i,fNi,j,fNj);
-           return -1;
-       } // end if
-       return fNj*i+j;
-    }
 
  public:
     // Default Constructor
@@ -118,66 +17,66 @@ class AliITSpList: public AliITSMap {
     AliITSpList(Int_t imax,Int_t jmax);
     // Class destrutor
     virtual ~AliITSpList();
-    // Copy Oporator
-    AliITSpList(AliITSpList &source);
-    // = Opoerator
+    // Copy constructor
+    AliITSpList(const AliITSpList &source);
+    // = Operator
     virtual AliITSpList& operator=(const AliITSpList &source);
     // Returns the max mape index values
-    void GetMaxMapIndex(Int_t &ni,Int_t &nj){ni=fNi;nj=fNj;return;}
+    void GetMaxMapIndex(Int_t &ni,Int_t &nj) const {ni=fNi;nj=fNj;return;}
     // returns the max index value.
-    Int_t GetMaxIndex(){return fNi*fNj;}
+    Int_t GetMaxIndex() const {return fNi*fNj;}
     // returns the largest non-zero entry kept in the array fa.
-    Int_t GetEntries(){return fEnteries;}
+    Int_t GetEntries() const {return fEnteries;}
     // returns the max number of track/hit entries per cell.
-    Int_t GetNEnteries(){return AliITSpListItem::GetMaxKept();}
+    Int_t GetNEnteries() const {return AliITSpListItem::GetMaxKept();}
     // for a give TObjArray index it returns the corresponding map index
-    void  GetMapIndex(Int_t index,Int_t &i,Int_t &j){
+    void  GetMapIndex(Int_t index,Int_t &i,Int_t &j) const {
        i = index/fNj;j = index - fNj*i;
        if(i<0||i>=fNi || j<0||j>=fNj){i=-1;j=-1; return;}
     }
     // Returns the signal+noise for a give map coordinate
-    Double_t GetSignal(Int_t index){
+    Double_t GetSignal(Int_t index) {
        if(GetpListItem(index)==0) return 0.0;
        return GetpListItem(index)->GetSumSignal();
     }
     // Returns the signal+noise for a give map coordinate
-    Double_t GetSignal(Int_t i,Int_t j){
+    virtual Double_t GetSignal(Int_t i,Int_t j)  {
        if(GetpListItem(i,j)==0) return 0.0;
        return GetpListItem(i,j)->GetSumSignal();
     }
     // Returns the signal only for a give map coordinate
-    Double_t GetSignalOnly(Int_t i,Int_t j){
+    Double_t GetSignalOnly(Int_t i,Int_t j) {
        if(GetpListItem(i,j)==0) return 0.0;
        return GetpListItem(i,j)->GetSignal();
     }
     // Returns the noise for a give map coordinate
-    Double_t GetNoise(Int_t i,Int_t j){
+    Double_t GetNoise(Int_t i,Int_t j) {
        if(GetpListItem(i,j)==0) return 0.0;
        return GetpListItem(i,j)->GetNoise();
     }
     // returns the track number which generated the signal at a given map
     // coordinate. If there is no signal or only noise, then -2 is returned.
     // k is the track rank number.
-    Double_t GetTSignal(Int_t i,Int_t j,Int_t k){
+    Double_t GetTSignal(Int_t i,Int_t j,Int_t k) {
        if(GetpListItem(i,j)==0) return 0.0;
        return GetpListItem(i,j)->GetSignal(k);
     }
     // returns the track number which generated the signal at a given map
     // coordinate. If there is no signal or only noise, then -2 is returned.
     // k is the track rank number.
-    Int_t GetTrack(Int_t i,Int_t j,Int_t k){
+    Int_t GetTrack(Int_t i,Int_t j,Int_t k) {
        if(GetpListItem(i,j)==0) return -2;
        return GetpListItem(i,j)->GetTrack(k);
     }
     // returns the hit number which generated the signal at a given map
     // coordinate. If there is no signal or only noise, then -2 is returned.
     // k is the hit rank number.
-    Int_t GetHit(Int_t i,Int_t j,Int_t k){
+    Int_t GetHit(Int_t i,Int_t j,Int_t k) {
        if(GetpListItem(i,j)==0) return -2;
        return GetpListItem(i,j)->GetHit(k);
     }
     // returns the number of Signal values
-    Int_t GetNSignals(Int_t i,Int_t j){
+    Int_t GetNSignals(Int_t i,Int_t j) {
        if(GetpListItem(i,j)==0) return 0;
        return GetpListItem(i,j)->GetNsignals();
     }
@@ -189,15 +88,15 @@ class AliITSpList: public AliITSMap {
     // Adds a Noise value to the map. Creating and expanding arrays as needed.
     void AddNoise(Int_t i,Int_t j,Int_t mod,Double_t noise);
     // Delete all AliITSpListItems and zero the TObjArray
-    void ClearMap();
+    virtual void ClearMap();
     // Delete a particular AliITSpListItem in the TObjArray.
-    void DeleteHit(Int_t i,Int_t j);
+    virtual void DeleteHit(Int_t i,Int_t j);
     // returns hit index in TObjArray
-    Int_t GetHitIndex(Int_t i,Int_t j){return GetIndex(i,j);}
+    virtual Int_t GetHitIndex(Int_t i,Int_t j) const {return GetIndex(i,j);}
     // returns "hit" AliITSpListItem as a TObject.
     TObject * GetHit(Int_t i,Int_t j){return (TObject*)GetpListItem(i,j);}
     // tests hit status.
-    FlagType TestHit(Int_t i,Int_t j){if(GetpListItem(i,j)==0) return kEmpty;
+    virtual FlagType TestHit(Int_t i,Int_t j){if(GetpListItem(i,j)==0) return kEmpty;
     else if(GetSignal(i,j)<=0) return kUnused; else return kUsed;}
     // Returns the pointer to the TObjArray of pList Items
     TObjArray * GetpListItems(){return fa;}
@@ -206,41 +105,31 @@ class AliITSpList: public AliITSMap {
        if(fa!=0)return (AliITSpListItem*) (fa->At(index));
        else return 0;}
     // returns the pList Item stored in the TObject array
-    AliITSpListItem* GetpListItem(Int_t i,Int_t j){
+    AliITSpListItem* GetpListItem(Int_t i,Int_t j) const {
        if(fa!=0)return (AliITSpListItem*) (fa->At(GetIndex(i,j)));
        else return 0;}
 
     // Fill pList from digits. Not functional yet
-    void FillMap(){;}
+    virtual void FillMap(){NotImplemented("FillMap");}
     // Sets threshold for significance. Not of relavance in this case.
-    void SetThreshold(Int_t i){i=0;}
+    virtual void SetThreshold(Int_t /* i */){NotImplemented("SetThreshold");}
     // Sets a single hit. Not of relavance in this case.
-    void SetHit(Int_t i,Int_t j,Int_t k){i=j=k=0;}
+    virtual void SetHit(Int_t /* i */,Int_t /* j */,Int_t /* k */){NotImplemented("SetHit");}
     // Flags a hit. Not of relavence in this case.
-    void FlagHit(Int_t i,Int_t j){i=j=0;}
-    // returns the i,j index numbers from the liniarized index computed
-    // from GetIndex above.
-    void GetCell(Int_t index,Int_t &i,Int_t &j){
-       if(index<0 || index>=fNi*fNj){
-           Warning("GetCell","Index out of range 0<=index=%d<%d",
-                   index,fNi*fNj);
-           i=-1;j=-1;
-           return;
-       } // end if
-       i = index/fNj;
-       j = index - fNj*i;
-       return;
-    }
+    virtual void FlagHit(Int_t /* i */,Int_t /* j */){NotImplemented("FlagHit");}
+    virtual void GetCell(Int_t index,Int_t &i,Int_t &j) const;
 
  private:
+
+// private methods
+    Int_t GetIndex(Int_t i,Int_t j) const;
+    void NotImplemented(const char *method) const {if(gDebug>0)
+         Warning(method,"This method is not implemented for this class");}
+// data members
     Int_t     fNi,fNj;   // The max index in i,j.
     TObjArray *fa;       // array of pList items
     Int_t     fEnteries; // keepts track of the number of non-zero entries.
 
     ClassDef(AliITSpList,3) // list of signals and track numbers
 };     
-// Input and output functions for standard C++ input/output.
-ostream & operator<<(ostream &os,AliITSpList &source);
-istream & operator>>(istream &is,AliITSpList &source);
-
 #endif
diff --git a/ITS/AliITSpListItem.cxx b/ITS/AliITSpListItem.cxx
new file mode 100644 (file)
index 0000000..8f4e0f6
--- /dev/null
@@ -0,0 +1,408 @@
+/**************************************************************************
+ * Copyright(c) 1998-2004, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+#include <Riostream.h>
+#include "AliITSpListItem.h"
+// ************************************************************************
+// the data member "fa" of the AliITSpList class
+// is a TObjectArray of AliITSpListItem objects
+// each AliITSpListItem object contains information related to
+// the digitization such signal, noise, module number,...
+// plus some info related to the simulation (hits/track)
+// in order to allow efficiency studies
+//************************************************************************
+ClassImp(AliITSpListItem)
+//______________________________________________________________________
+AliITSpListItem::AliITSpListItem(){
+    // Default constructor
+    // Inputs:
+    //    none.
+    // Outputs:
+    //    none.
+    // Return:
+    //    A zeroed/empty AliITSpListItem class.
+
+    fmodule = -1;
+    findex  = -1;
+    for(Int_t i=0;i<this->fgksize;i++){
+        this->fTrack[i]  = -2;
+        this->fHits[i]   = -1;
+        this->fSignal[i] = 0.0;
+    } // end if i
+    fTsignal = 0.0;
+    fNoise   = 0.0;
+    fSignalAfterElect = 0.0;
+}
+//______________________________________________________________________
+AliITSpListItem::AliITSpListItem(Int_t module,Int_t index,Double_t noise){
+    // Standard noise constructor
+    // Inputs:
+    //    Int_t module   The module where this noise occurred
+    //    Int_t index    The cell index where this noise occurred
+    //    Double_t noise The value of the noise.
+    // Outputs:
+    //    none.
+    // Return:
+    //    A setup and noise filled AliITSpListItem class.
+
+    this->fmodule    = module;
+    this->findex     = index;
+    for(Int_t i=0;i<this->fgksize;i++){
+        this->fTrack[i]  = -2;
+        this->fSignal[i] = 0.0;
+        this->fHits[i]   = -1;
+    } // end if i
+    this->fTsignal = 0.0;
+    this->fSignalAfterElect = 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
+    // Inputs:
+    //    Int_t track     The track number which produced this signal
+    //    Int_t hit       The hit number which produced this signal
+    //    Int_t module    The module where this signal occurred
+    //    Int_t index     The cell index where this signal occurred
+    //    Double_t signal The value of the signal (ionization)
+    // Outputs:
+    //    none.
+    // Return:
+    //    A setup and signal filled  AliITSpListItem class.
+
+    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->fgksize;i++){
+        this->fTrack[i]  = -2;
+        this->fSignal[i] = 0.0;
+        this->fHits[i]   = -1;
+    } // end if i
+    this->fTsignal = signal;
+    this->fNoise   = 0.0;
+    this->fSignalAfterElect   = 0.0;
+}
+//______________________________________________________________________
+AliITSpListItem::~AliITSpListItem(){
+    // Destructor
+    // Inputs:
+    //    none.
+    // Outputs:
+    //    none.
+    // Return:
+    //    A properly destroyed AliITSpListItem class.
+
+}
+//______________________________________________________________________
+AliITSpListItem& AliITSpListItem::operator=(const AliITSpListItem &source){
+    // = operator
+    // Inputs:
+    //    AliITSpListItem &source   A AliITSpListItem Object
+    // Outputs:
+    //    none.
+    // Return:
+    //    A copied AliITSpListItem object
+    Int_t i;
+
+    if(this == &source) return *this;
+
+    this->fmodule = source.fmodule;
+    this->findex  = source.findex;
+    for(i=0;i<this->fgksize;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;
+    this->fSignalAfterElect   = source.fSignalAfterElect;
+    /*
+    cout <<"this fTrack[0-9]=";
+    for(i=0;i<this->fgksize;i++) cout <<this->fTrack[i]<<",";
+    cout <<" fHits[0-9]=";
+    for(i=0;i<this->fgksize;i++) cout <<this->fHits[i]<<",";
+    cout <<" fSignal[0-9]=";
+    for(i=0;i<this->fgksize;i++) cout <<this->fSignal[i]<<",";
+    cout << endl;
+    cout <<"source fTrack[0-9]=";
+    for(i=0;i<this->fgksize;i++) cout <<source.fTrack[i]<<",";
+    cout <<" fHits[0-9]=";
+    for(i=0;i<this->fgksize;i++) cout <<source.fHits[i]<<",";
+    cout <<" fSignal[0-9]=";
+    for(i=0;i<this->fgksize;i++) cout <<source.fSignal[i]<<",";
+    cout << endl;
+    */
+    return *this;
+}
+//______________________________________________________________________
+AliITSpListItem::AliITSpListItem(AliITSpListItem &source) : TObject(source){
+    // Copy operator
+    // Inputs:
+    //    AliITSpListItem &source   A AliITSpListItem Object
+    // Outputs:
+    //    none.
+    // Return:
+    //    A copied AliITSpListItem object
+
+    *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 signal to the pList and orders them
+    // Inputs:
+    //    Int_t track     The track number which produced this signal
+    //    Int_t hit       The hit number which produced this signal
+    //    Int_t module    The module where this signal occurred
+    //    Int_t index     The cell index where this signal occurred
+    //    Double_t signal The value of the signal (ionization)
+    // Outputs:
+    //    none.
+    // Return:
+    //    none.
+    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.
+
+    //    for(i=0;i<fgksize;i++) if( track==fTrack[i] && hit==fHits[i] ){
+    for(i=0;i<fgksize;i++) if( track==fTrack[i]  ){
+        fSignal[i] += signal;
+        flg = kTRUE;
+    } // end for i & if.
+    //cout << "track="<<track<<endl;
+    if(flg){ // resort arrays.  
+        for(i=1;i<fgksize;i++){
+            j = i;
+            while(j>0 && fSignal[j]>fSignal[j-1]){
+                trk = fTrack[j-1];
+                hts = fHits[j-1];
+                sig = fSignal[j-1];
+                fTrack[j-1]  = fTrack[j];
+                fHits[j-1]   = fHits[j];
+                fSignal[j-1] = fSignal[j];                
+                fTrack[j]  = trk;
+                fHits[j]   = hts;
+                fSignal[j] = sig;
+               //cout << "#fTrack["<<j-1<<"]="<<fTrack[j-1]<< " fTrack["<<
+               // j<<"]="<<fTrack[j]<<endl;
+                j--;
+            } // end while
+        } // end if i
+        return;
+    } // end if added to existing and resorted array
+
+    // new entry add it in order.
+    // if this signal is <= smallest then don't add it.
+    if(signal <= fSignal[fgksize-1]) return;
+    for(i=fgksize-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+1] = signal;
+            fTrack[i+1]  = track;
+            fHits[i+1]   = hit;
+            return; // put it in the right place, now exit.
+        } //  end if
+       //cout << "$fTrack["<<i+1<<"]="<<fTrack[i+1]<< " fTrack["<<i<<"]="
+       //<<fTrack[i]<< " fHits["<<i+1<<"]="<<fHits[i+1]<< " fHits["<<i<<"]="
+       //<<fHits[i]<< " fSignal["<<i+1<<"]="<<fSignal[i+1]<< " fSignal["<<i
+       //<<"]="<<fSignal[i]<<endl;
+    } // end if; end for i
+    // Still haven't found the right place. Must be at top of list.
+    fSignal[0] = signal;
+    fTrack[0]  = track;
+    fHits[0]   = hit;
+    //cout << "$fTrack["<<0<<"]="<<fTrack[0]<<" fHits["<<0<<"]="<<fHits[0]
+    //<<" fSignal["<<0<<"]="<<fSignal[0]<<endl;
+    return;
+}
+//______________________________________________________________________
+void AliITSpListItem::AddNoise(Int_t module,Int_t index,Double_t noise){
+    // Adds noise to this existing list.
+    // Inputs:
+    //    Int_t module   The module where this noise occurred
+    //    Int_t index    The cell index where this noise occurred
+    //    Double_t noise The value of the noise.
+    // Outputs:
+    //    none.
+    // Return:
+    //    none.
+
+    if(findex!=index || fmodule!=module) 
+        Warning("AddNoise","index=%d != findex=%d or module=%d != fmodule=%d",
+            index,findex,module,fmodule);
+    fNoise += noise; // Keep track of sum signal.
+}
+//______________________________________________________________________
+void AliITSpListItem::AddSignalAfterElect(Int_t module,Int_t index,Double_t signal){
+    // Adds signal after electronics to this existing list.
+    // Inputs:
+    //    Int_t module   The module where this noise occurred
+    //    Int_t index    The cell index where this noise occurred
+    //    Double_t signal The value of the signal.
+    // Outputs:
+    //    none.
+    // Return:
+    //    none.
+
+    if(findex!=index || fmodule!=module) 
+        Warning("AddSignalAfterElect","index=%d != findex=%d or module=%d "
+               "!= fmodule=%d",index,findex,module,fmodule);
+    fSignalAfterElect += signal; // Keep track of sum signal.
+}
+//______________________________________________________________________
+void AliITSpListItem::Add(AliITSpListItem *pl){
+    // Adds the contents of pl to this
+    // pl could come from different module and index 
+    // Inputs:
+    //    AliITSpListItem *pl  an AliITSpListItem to be added to this class.
+    // Outputs:
+    //    none.
+    // Return:
+    //    none.
+    Int_t i;
+    Double_t sig  = 0.0;
+    Double_t sigT = 0.0;
+
+    for(i=0;i<pl->GetNsignals();i++){
+        sig = pl->GetSignal(i); 
+        if( sig <= 0.0 ) break; // no more signals
+        AddSignal(pl->GetTrack(i),pl->GetHit(i),fmodule,findex,sig);
+        sigT += sig;
+    } // end for i
+    fTsignal += (pl->fTsignal - sigT);
+    fNoise   += pl->fNoise;
+    return;
+}
+//______________________________________________________________________
+void AliITSpListItem::AddTo(Int_t fileIndex,AliITSpListItem *pl){
+    // Adds the contents of pl to this with track number off set given by
+    // fileIndex.
+    // Inputs:
+    //    Int_t fileIndex      track number offset value
+    //    AliITSpListItem *pl  an AliITSpListItem to be added to this class.
+    // Outputs:
+    //    none.
+    // Return:
+    //    none.
+    Int_t i,trk;
+    Double_t sig  = 0.0;
+
+    Int_t module = pl->GetModule();
+    Int_t index  = pl->GetIndex();
+    for(i=0;i<pl->GetNsignals();i++){
+        sig = pl->GetSignal(i); 
+        if( sig <= 0.0 ) break; // no more signals
+        trk = pl->GetTrack(i);
+        trk += fileIndex; 
+        AddSignal(trk,pl->GetHit(i),module,index,sig);
+    } // end for i
+    fSignalAfterElect += (pl->fSignalAfterElect + pl->fNoise - fNoise);
+    fNoise = pl->fNoise;
+    return;
+}
+//______________________________________________________________________
+Int_t AliITSpListItem::ShiftIndex(Int_t in,Int_t trk) const {
+    // Shift an index number to occupy the upper four bits. No longer used.
+    // Inputs:
+    //    Int_t in   The file number
+    //    Int_t trk  The track number
+    // Outputs:
+    //    none.
+    // Return:
+    //    Int_t The track number with the file number in the upper bits.
+    Int_t si = sizeof(Int_t) * 8;
+    UInt_t uin,utrk; // use UInt_t to avoid interger overflow-> goes negative.
+
+    uin = in;
+    utrk = trk;
+    for(Int_t i=0;i<si-4;i++) uin *= 2;
+    uin += utrk;
+    in = uin;
+    return in;
+}
+//______________________________________________________________________
+void AliITSpListItem::Print(ostream *os) const {
+    //Standard output format for this class
+    // Inputs:
+    //    ostream *os  The output stream
+    // Outputs:
+    //    none.
+    // Return:
+    //    none.
+    Int_t i;
+
+    *os << fmodule <<","<<findex<<",";
+    *os << fgksize <<",";
+    for(i=0;i<fgksize;i++) *os << fTrack[i] <<",";
+    for(i=0;i<fgksize;i++) *os << fHits[i] <<",";
+    for(i=0;i<fgksize;i++) *os << fSignal[i] <<",";
+    *os << fTsignal <<","<< fNoise << "," << fSignalAfterElect;
+}
+//______________________________________________________________________
+void AliITSpListItem::Read(istream *is){
+    // Standard output streaming function.
+    // Inputs:
+    //    istream *is The input stream
+    // Outputs:
+    //    none.
+    // Return:
+    //    none.
+    Int_t i,iss;
+
+    *is >> fmodule >> findex;
+    *is >> iss; // read in fgksize
+    for(i=0;i<fgksize&&i<iss;i++) *is >> fTrack[i];
+    for(i=0;i<fgksize&&i<iss;i++) *is >> fHits[i];
+    for(i=0;i<fgksize&&i<iss;i++) *is >> fSignal[i];
+    *is >> fTsignal >> fNoise >> fSignalAfterElect;
+}
+//______________________________________________________________________
+ostream &operator<<(ostream &os,AliITSpListItem &source){
+    // Standard output streaming function.
+    // Inputs:
+    //    ostream &os             The output stream
+    //    AliITSpListItem &source The AliITSpListItem object to be written out.
+    // Outputs:
+    //    none.
+    // Return:
+    //    ostream  The output stream
+
+    source.Print(&os);
+    return os;
+}
+//______________________________________________________________________
+istream &operator>>(istream &os,AliITSpListItem &source){
+    // Standard output streaming function.
+    // Inputs:
+    //    istream os              The input stream
+    //    AliITSpListItem &source The AliITSpListItem object to be inputted
+    // Outputs:
+    //    none.
+    // Return:
+    //    istream The input stream.
+
+    source.Read(&os);
+    return os;
+}
diff --git a/ITS/AliITSpListItem.h b/ITS/AliITSpListItem.h
new file mode 100644 (file)
index 0000000..ce1614f
--- /dev/null
@@ -0,0 +1,90 @@
+#ifndef ALIITSPLISTITEM_H
+#define ALIITSPLISTITEM_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice     */
+
+/* $Id$ */
+
+#include <TObject.h>
+
+
+class AliITSpListItem: public TObject {
+ public:
+    // Default Constructor
+    AliITSpListItem();
+    // Standard Signal Constructor
+    AliITSpListItem(Int_t track,Int_t hit,Int_t module,Int_t index,
+                  Double_t signal);
+    // Standard Noise Constructor
+    AliITSpListItem(Int_t module,Int_t index,Double_t signal);
+    // Class destrutor
+    virtual ~AliITSpListItem();
+    // Copy Oporator
+    AliITSpListItem(AliITSpListItem &source);
+    // = Opoerator
+    virtual AliITSpListItem& operator=(const AliITSpListItem &source);
+    // Returns the signal value in the list of signals
+    virtual Double_t GetSignal(Int_t i) const {
+                           return ( (i>=0&&i<fgksize) ? fSignal[i] : 0.0);}
+    virtual Double_t GetSignal() const {
+                           return fTsignal;}
+    virtual Double_t GetSignalAfterElect() const {
+                           return fSignalAfterElect;}
+    // Returns the Sum/Total signal
+    virtual Double_t GetSumSignal() const {return fTsignal+fNoise;}
+    // Returns the  noise
+    virtual Double_t GetNoise() const {return fNoise;}
+    // Returns the number of stored singals.
+    virtual Int_t GetNsignals() const {return fgksize;}
+    // Addes track number and signal to this existing list.
+    virtual void AddSignal(Int_t track,Int_t hit,Int_t module,
+                          Int_t index,Double_t signal);
+    // Adds signal after electronics to this existing list.
+    virtual void AddSignalAfterElect(Int_t module,Int_t index,Double_t signal);
+    // Addes noise to this existing list.
+    virtual void AddNoise(Int_t module,Int_t index,Double_t noise);
+    // Returns track number.
+    virtual Int_t GetTrack(Int_t i) const {
+                           return ((i>=0&&i<fgksize) ? fTrack[i] : 0);}
+    // Returns hit number.
+    virtual Int_t GetHit(Int_t i) const {
+                           return ((i>=0&&i<fgksize) ? fHits[i] : 0);}
+    // Returns module number.
+    virtual Int_t GetModule() const {
+                           return fmodule;}
+    // Returns index number.
+    virtual Int_t GetIndex() const {
+                           return findex;}
+    // Adds the contents of pl to this 
+    virtual void Add(AliITSpListItem *pl);
+    // Adds the contents of pl to this with track number off set given by
+    // fileIndex.
+    virtual void AddTo(Int_t fileIndex,AliITSpListItem *pl);
+    // Shift an index number to occupy the upper four bits.
+    virtual Int_t ShiftIndex(Int_t in,Int_t trk) const;
+    // Standard ascii class print function
+    void Print(ostream *os) const;
+    // Standard ascii class read function
+    void Read(istream *is);
+    // Returns max size of array for for Tracks, Hits, and signals.
+    static Int_t GetMaxKept() {return fgksize;};
+
+ private:
+    static const Int_t fgksize = 10; // Array sizes
+    Int_t    fmodule;         // module number
+    Int_t    findex;          // Strip/row,col number linearlized.
+    Int_t    fTrack[fgksize];  //[fgksize] track Number
+    Int_t    fHits[fgksize];   //[fgksize] hit number
+    Double_t fSignal[fgksize]; //[fgksize] Signals
+    Double_t fTsignal;        // Total signal (no noise)
+    Double_t fNoise;          // Total noise, coupling, ...
+    Double_t fSignalAfterElect; // Signal after electronics
+
+    ClassDef(AliITSpListItem,3) // Item list of signals and track numbers
+};     
+// Input and output functions for standard C++ input/output.
+ostream & operator<<(ostream &os,AliITSpListItem &source);
+istream & operator>>(istream &is,AliITSpListItem &source);
+
+
+#endif