1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15 /* $Id: AliITSUSensMap.cxx 39464 2010-03-09 14:59:19Z masera $ */
17 //***********************************************************************
19 // It consist of a TClonesArray of
20 // AliITSUSensMapItem objects
21 // This array can be accessed via 2 indexed
22 // it is used at digitization level by
23 // all the 3 ITS subdetectors
26 // The items should be added to the map like this:
27 // map->RegisterItem( new(map->GetFree()) ItemConstructor(...) );
29 // The items must be sortable with the same sorting algorithm like
30 // for AliITSUSensMap::IsSortable,IsEqual,Compare
32 // ***********************************************************************
34 #include "AliITSUSensMap.h"
36 //______________________________________________________________________
38 ClassImp(AliITSUSensMap)
39 //______________________________________________________________________
40 AliITSUSensMap::AliITSUSensMap()
46 // Default constructor
49 //______________________________________________________________________
50 AliITSUSensMap::AliITSUSensMap(const char* className, UInt_t dim0,UInt_t dim1)
53 ,fItems(new TClonesArray(className,100))
56 // Standard constructor
59 //______________________________________________________________________
60 AliITSUSensMap::~AliITSUSensMap()
68 //______________________________________________________________________
69 AliITSUSensMap::AliITSUSensMap(const AliITSUSensMap &source)
73 ,fItems( source.fItems ? new TClonesArray(*source.fItems) : 0)
77 fBTree = new TBtree();
79 for (int i=fItems->GetEntriesFast();i--;) {
80 TObject* obj = fItems->At(i);
81 if (obj && ! IsDisabled(obj)) continue;
88 //______________________________________________________________________
89 AliITSUSensMap& AliITSUSensMap::operator=(const AliITSUSensMap &source)
93 this->~AliITSUSensMap();
94 new(this) AliITSUSensMap(source);
99 //______________________________________________________________________
100 void AliITSUSensMap::Clear(Option_t*)
103 if (fItems) fItems->Clear();
104 if (fBTree) fBTree->Clear();
107 //______________________________________________________________________
108 void AliITSUSensMap::DeleteItem(UInt_t i,UInt_t j)
110 // Delete a particular AliITSUSensMapItems.
111 SetUniqueID( GetIndex(i,j) );
112 TObject* fnd = fBTree->FindObject(this);
118 //______________________________________________________________________
119 void AliITSUSensMap::DeleteItem(TObject* obj)
121 // Delete a particular AliITSUSensMapItems.
122 TObject* fnd = fBTree->FindObject(obj);
128 //______________________________________________________________________
129 void AliITSUSensMap::GetCell(UInt_t index,UInt_t &i,UInt_t &j) const
131 // returns the i,j index numbers from the linearized index computed
133 if(index>=fDim0*fDim1){
134 Warning("GetCell","Index out of range 0<=index=%d<%d",index,fDim0*fDim1);
138 #ifdef _ROWWISE_SORT_
139 i = index%fDim0; // sorted in row, then in column
142 i = index/fDim1; // sorted in column, then in row