]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliSimDigits.h
Clean-up bug in Centered() corrected.
[u/mrichter/AliRoot.git] / TPC / AliSimDigits.h
1 #ifndef ALISIMDIGITS_H
2 #define ALISIMDIGITS_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 ////////////////////////////////////////////////
9 //  Manager class generaol Alice segment digits
10 //  segment is for example one pad row in TPC //
11 ////////////////////////////////////////////////
12 #include "TError.h"
13 #include   "AliArrayI.h"
14 #include   "AliArrayS.h"
15 class AliH2F;
16
17
18 class AliSimDigits : public AliDigits{
19 public: 
20   AliSimDigits();
21   ~AliSimDigits();
22   void AllocateTrack(Int_t length);  //construct empty buffer fTracks with size rows x column x length (number of tracks for one digit)
23   inline Int_t GetTrackIDFast(Int_t row, Int_t column,Int_t level);  //return track ID  at given row and collumn
24   inline void  SetTrackIDFast(Int_t value,Int_t row, Int_t column,Int_t level);  //set ID track at given row and collumn
25   virtual Int_t GetTrackID(Int_t row, Int_t column, Int_t level);
26   virtual void ExpandTrackBuffer();  //expand buffer to twodimensional array
27   virtual void CompresTrackBuffer(Int_t bufType); //compres buffer according buffertype algorithm 
28   AliH2F *  DrawTracks( const char *option=0,Int_t level=0, 
29                   Float_t x1=-1, Float_t x2=-1, Float_t y1=-1, Float_t y2=-1); //draw tracks
30   TClonesArray * GenerTPCClonesArray(TClonesArray * arr); //generate TClonnesArray of digits
31   //only for demonstration purpose
32 public:
33   void InvalidateTrack();
34  
35   Int_t GetTrackID1(Int_t row, Int_t column, Int_t level);  //returnb track ID of digits - for buffer compresion 1 
36   void  ExpandTrackBuffer1(); //comress track according algorithm 1 (track ID comression independent to the digit compression) 
37   void  CompresTrackBuffer1(); //comress track according algorithm 1 (track ID comression independent to the digit compression)
38  
39   Int_t GetTrackID2(Int_t row, Int_t column, Int_t level);  //returnb track ID of digits - for buffer compresion 2
40   void  ExpandTrackBuffer2(); //comress track according algorithm 2 (track ID comression according  digit compression)
41   void  CompresTrackBuffer2(); //comress track according algorithm 2 (track ID comression according  digit compression)
42
43   AliArrayI * fTracks;     //buffer of track index 
44   AliArrayI * fTrIndex;    //index position of column
45   Int_t       fNlevel;   //number of tracks etries  for one digit
46   Int_t       fTrBufType;  //buffer type of the tracks
47   // Bool_t      ClassError( ); //signalize class error 
48   ClassDef(AliSimDigits,1) 
49 };
50
51
52
53 Int_t AliSimDigits::GetTrackIDFast(Int_t row, Int_t column,Int_t level)
54 {
55   //
56   //return track ID  at given row and column
57   //  return fTracks[level].At(fTrIndex[level][column]+row); 
58   return fTracks->At(level*fNrows*fNcols+fNrows*column+row); 
59 }
60  
61 void AliSimDigits::SetTrackIDFast(Int_t value,Int_t row, Int_t column,Int_t level)
62 {
63 value+=2;
64   //set ID track at given row and collumn
65   //  fTracks[level][fTrIndex[level][column]+row]=value; 
66   if ( (row<0) || (row>=fNrows)  || (column<0) || (column>=fNcols) ) 
67        ::Error("AliSimDigits::SetTrackIDFast", "row %d  col %d out of bounds (size: %d x %d, this: 0x%08x)", 
68            row, column, fNrows, fNcols, this);
69   if ( (level<0) || (level>=fNlevel)) ::Error("AliSimDigits::SetTrackIDFast", "index %d out of bounds", level);
70   (*fTracks)[level*fNrows*fNcols+fNrows*column+row]=value; 
71 }
72
73
74
75 #endif