]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/UPGRADE/AliITSUSensMap.h
Fix up a warning about casts
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUSensMap.h
CommitLineData
451f5018 1#ifndef ALIITSUSENSMAP_H
2#define ALIITSUSENSMAP_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6//***********************************************************************
7//
8// It consist of a TClonesArray of objects
9// and B-tree for fast sorted access
10// This array can be accessed via 2 indexed
11// it is used at digitization level by
12// all the ITS subdetectors
13//
14// The items should be added to the map like this:
15// map->RegisterItem( new(map->GetFree()) ItemConstructor(...) );
16//
17// ***********************************************************************
18#include <TClonesArray.h>
19#include <TBtree.h>
20
21
22class AliITSUSensMap: public TObject
23{
24
25 public:
26 enum {kDisableBit=BIT(14)};
27 //
28 AliITSUSensMap();
29 AliITSUSensMap(const char* className, UInt_t dim0,UInt_t dim1);
30 virtual ~AliITSUSensMap();
31 AliITSUSensMap(const AliITSUSensMap &source);
32 AliITSUSensMap& operator=(const AliITSUSensMap &source);
33 void Clear(Option_t* option = "");
34 void DeleteItem(UInt_t i,UInt_t j);
35 void DeleteItem(TObject* obj);
36 //
37 void SetDimensions(UInt_t dim0,UInt_t dim1) {fDim0 = dim0; fDim1 = dim1;}
38 void GetMaxIndex(UInt_t &ni,UInt_t &nj) const {ni=fDim0;nj=fDim1;}
39 Int_t GetMaxIndex() const {return fDim0*fDim1;}
40 Int_t GetEntries() const {return fBTree->GetEntries();}
41 Int_t GetEntriesUnsorted() const {return fItems->GetEntriesFast();}
42 void GetMapIndex(UInt_t index,UInt_t &i,UInt_t &j) const {return GetCell(index, i,j);}
02d6eccc 43 TObject* GetItem(UInt_t i,UInt_t j) {SetUniqueID(GetIndex(i,j)); return fBTree->FindObject(this);}
44 TObject* GetItem(UInt_t index) {SetUniqueID(index); return fBTree->FindObject(this);}
451f5018 45 TObject* GetItem(const TObject* obj) {return fBTree->FindObject(obj);}
46 TObject* At(Int_t i) const {return fBTree->At(i);} //!!! Access in sorted order !!!
47 TObject* AtUnsorted(Int_t i) const {return fItems->At(i);} //!!! Access in unsorted order !!!
48 TObject* RegisterItem(TObject* obj) {fBTree->Add(obj); return obj;}
49 TObject* GetFree() {return (*fItems)[fItems->GetEntriesFast()];}
50 //
51 void GetCell(UInt_t index,UInt_t &i,UInt_t &j) const;
52 UInt_t GetIndex(UInt_t i,UInt_t j) const {return j+i*fDim1;}
53 //
54 TClonesArray* GetItems() const {return fItems;}
55 TBtree* GetItemsBTree() const {return fBTree;}
56 //
02d6eccc 57 Bool_t IsSortable() const {return kTRUE;}
58 Bool_t IsEqual(const TObject* obj) const {return GetUniqueID()==obj->GetUniqueID();}
59 Int_t Compare(const TObject* obj) const {return (GetUniqueID()<obj->GetUniqueID()) ? -1 : ((GetUniqueID()>obj->GetUniqueID()) ? 1 : 0 );}
60 //
451f5018 61 static Bool_t IsDisabled(TObject* obj) {return obj ? obj->TestBit(kDisableBit) : kFALSE;}
62 static void Disable(TObject* obj) {if (obj) obj->SetBit(kDisableBit);}
63 static void Enable(TObject* obj) {if (obj) obj->ResetBit(kDisableBit);}
64 //
451f5018 65 protected:
66 //
67 UInt_t fDim0; // 1st dimension of the matrix
68 UInt_t fDim1; // 2nd dimention of the matrix
69 TClonesArray* fItems; // pListItems array
70 TBtree* fBTree; // tree for ordered access
451f5018 71 //
72 ClassDef(AliITSUSensMap,1) // list of sensor signals (should be sortable objects)
73};
74#endif