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();
78 for (int i=fItems->GetEntriesFast();i--;) {
79 TObject* obj = fItems->At(i);
80 if (obj && ! IsDisabled(obj)) continue;
86 //______________________________________________________________________
87 AliITSUSensMap& AliITSUSensMap::operator=(const AliITSUSensMap &source)
91 this->~AliITSUSensMap();
92 new(this) AliITSUSensMap(source);
97 //______________________________________________________________________
98 void AliITSUSensMap::Clear(Option_t*)
101 if (fItems) fItems->Clear();
102 if (fBTree) fBTree->Clear();
105 //______________________________________________________________________
106 void AliITSUSensMap::DeleteItem(UInt_t i,UInt_t j)
108 // Delete a particular AliITSUSensMapItems.
109 SetUniqueID( GetIndex(i,j) );
110 TObject* fnd = fBTree->FindObject(this);
116 //______________________________________________________________________
117 void AliITSUSensMap::DeleteItem(TObject* obj)
119 // Delete a particular AliITSUSensMapItems.
120 TObject* fnd = fBTree->FindObject(obj);
126 //______________________________________________________________________
127 void AliITSUSensMap::GetCell(UInt_t index,UInt_t &i,UInt_t &j) const
129 // returns the i,j index numbers from the linearized index computed
131 if(index>=fDim0*fDim1){
132 Warning("GetCell","Index out of range 0<=index=%d<%d",index,fDim0*fDim1);