]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSOnlineSPDHitArray.cxx
Protection against missing timestamps
[u/mrichter/AliRoot.git] / ITS / AliITSOnlineSPDHitArray.cxx
1 /////////////////////////////////////////////////////////////////
2 // Author: Henrik Tydesjo                                      //
3 // This class is used as a container online.                   //
4 // One object for each half stave and step in a scan. It keeps //
5 // the nr of hits in each pixel.                               //
6 // This class should only be used through the interface of the //
7 // AliITSOnlineSPDscan class.                                  //
8 /////////////////////////////////////////////////////////////////
9
10 #include "AliITSOnlineSPDHitArray.h"
11
12 ClassImp(AliITSOnlineSPDHitArray)
13
14 AliITSOnlineSPDHitArray::AliITSOnlineSPDHitArray() {
15   // constructor
16   for (Int_t i=0; i<81920; i++) {
17     fHits[i]=0;
18   }
19 }
20
21 AliITSOnlineSPDHitArray* AliITSOnlineSPDHitArray::CloneThis() const {
22   // makes a copy of this object and returns it
23   AliITSOnlineSPDHitArray* returnpointer = new AliITSOnlineSPDHitArray();
24   for (Int_t chip=0; chip<10; chip++) {
25     for (Int_t col=0; col<32; col++) {
26       for (Int_t row=0; row<256; row++) {
27         returnpointer->SetHits(chip,col,row,fHits[GetKey(chip,col,row)]);
28       }
29     }
30   }
31   return returnpointer;
32 }
33
34 void   AliITSOnlineSPDHitArray::IncrementHits(UInt_t chip, UInt_t col, UInt_t row) {
35   fHits[GetKey(chip,col,row)] ++;
36 }
37 void   AliITSOnlineSPDHitArray::SetHits(UInt_t chip, UInt_t col, UInt_t row, UInt_t hits) {
38   fHits[GetKey(chip,col,row)] = hits;
39 }
40 UInt_t AliITSOnlineSPDHitArray::GetHits(UInt_t chip, UInt_t col, UInt_t row) const {
41   return fHits[GetKey(chip,col,row)];
42 }
43 UInt_t AliITSOnlineSPDHitArray::GetKey(UInt_t chip, UInt_t col, UInt_t row) const {
44   return chip*256*32 + col*256 + row;
45 }