Integrating the Cooked Matrix tracker into the commom reconstruction framework
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUSensMap.cxx
CommitLineData
451f5018 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 $ */
16
17//***********************************************************************
18//
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
24//
25//
26// The items should be added to the map like this:
27// map->RegisterItem( new(map->GetFree()) ItemConstructor(...) );
28//
29// The items must be sortable with the same sorting algorithm like
02d6eccc 30// for AliITSUSensMap::IsSortable,IsEqual,Compare
451f5018 31//
32// ***********************************************************************
33
34#include "AliITSUSensMap.h"
35#include "AliLog.h"
36//______________________________________________________________________
37
38ClassImp(AliITSUSensMap)
39//______________________________________________________________________
40AliITSUSensMap::AliITSUSensMap()
b2679935 41: fDimCol(0)
42 ,fDimRow(0)
43 ,fDimCycle(0)
451f5018 44 ,fItems(0)
45 ,fBTree(0)
451f5018 46{
47 // Default constructor
48}
49
50//______________________________________________________________________
b2679935 51AliITSUSensMap::AliITSUSensMap(const char* className, UInt_t dimCol,UInt_t dimRow,UInt_t dimCycle)
52 :fDimCol(dimCol)
53 ,fDimRow(dimRow)
54 ,fDimCycle(dimCycle)
451f5018 55 ,fItems(new TClonesArray(className,100))
56 ,fBTree(new TBtree())
451f5018 57{
58 // Standard constructor
59}
60
61//______________________________________________________________________
62AliITSUSensMap::~AliITSUSensMap()
63{
64 // Default destructor
65 delete fItems;
66 delete fBTree;
67}
68
69
70//______________________________________________________________________
71AliITSUSensMap::AliITSUSensMap(const AliITSUSensMap &source)
72 :TObject(source)
b2679935 73 ,fDimCol(source.fDimCol)
74 ,fDimRow(source.fDimRow)
75 ,fDimCycle(source.fDimCycle)
451f5018 76 ,fItems( source.fItems ? new TClonesArray(*source.fItems) : 0)
77 ,fBTree( 0 )
451f5018 78{
79 if (source.fBTree) {
80 fBTree = new TBtree();
44785f3e 81 if (fItems) {
82 for (int i=fItems->GetEntriesFast();i--;) {
83 TObject* obj = fItems->At(i);
84 if (obj && ! IsDisabled(obj)) continue;
85 RegisterItem(obj);
86 }
451f5018 87 }
88 }
89}
90
91//______________________________________________________________________
92AliITSUSensMap& AliITSUSensMap::operator=(const AliITSUSensMap &source)
93{
94 // = operator
95 if (this!=&source) {
96 this->~AliITSUSensMap();
97 new(this) AliITSUSensMap(source);
98 }
99 return *this;
100}
101
102//______________________________________________________________________
103void AliITSUSensMap::Clear(Option_t*)
104{
105 // clean everything
106 if (fItems) fItems->Clear();
107 if (fBTree) fBTree->Clear();
451f5018 108}
109
110//______________________________________________________________________
fbcb7a55 111void AliITSUSensMap::DeleteItem(UInt_t col,UInt_t row,Int_t cycle)
451f5018 112{
113 // Delete a particular AliITSUSensMapItems.
fbcb7a55 114 SetUniqueID( GetIndex(col,row,cycle) );
02d6eccc 115 TObject* fnd = fBTree->FindObject(this);
451f5018 116 if (!fnd) return;
117 Disable(fnd);
118 fBTree->Remove(fnd);
119}
120
121//______________________________________________________________________
122void AliITSUSensMap::DeleteItem(TObject* obj)
123{
124 // Delete a particular AliITSUSensMapItems.
125 TObject* fnd = fBTree->FindObject(obj);
126 if (!fnd) return;
127 Disable(fnd);
128 fBTree->Remove(fnd);
129}
130
131//______________________________________________________________________
b2679935 132void AliITSUSensMap::SetDimensions(UInt_t dimCol,UInt_t dimRow,UInt_t dimCycle)
133{
134 // set dimensions for current sensor
135 const UInt_t kMaxPackDim = 0xffffffff;
136 fDimCol = dimCol;
137 fDimRow = dimRow;
138 fDimCycle=dimCycle;
98e63fc3 139 if ((fDimCol*fDimRow*fDimCycle)>kMaxPackDim/2) AliFatal(Form("Dimension %dx%dx%d*2 cannot be packed to UInt_t",fDimCol,fDimRow,fDimCycle));
b2679935 140}
fbcb7a55 141