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()
47 // Default constructor
50 //______________________________________________________________________
51 AliITSUSensMap::AliITSUSensMap(const char* className, UInt_t dimCol,UInt_t dimRow,UInt_t dimCycle)
55 ,fItems(new TClonesArray(className,100))
58 // Standard constructor
61 //______________________________________________________________________
62 AliITSUSensMap::~AliITSUSensMap()
70 //______________________________________________________________________
71 AliITSUSensMap::AliITSUSensMap(const AliITSUSensMap &source)
73 ,fDimCol(source.fDimCol)
74 ,fDimRow(source.fDimRow)
75 ,fDimCycle(source.fDimCycle)
76 ,fItems( source.fItems ? new TClonesArray(*source.fItems) : 0)
80 fBTree = new TBtree();
82 for (int i=fItems->GetEntriesFast();i--;) {
83 TObject* obj = fItems->At(i);
84 if (obj && ! IsDisabled(obj)) continue;
91 //______________________________________________________________________
92 AliITSUSensMap& AliITSUSensMap::operator=(const AliITSUSensMap &source)
96 this->~AliITSUSensMap();
97 new(this) AliITSUSensMap(source);
102 //______________________________________________________________________
103 void AliITSUSensMap::Clear(Option_t*)
106 if (fItems) fItems->Clear();
107 if (fBTree) fBTree->Clear();
110 //______________________________________________________________________
111 void AliITSUSensMap::DeleteItem(UInt_t col,UInt_t row,Int_t cycle)
113 // Delete a particular AliITSUSensMapItems.
114 SetUniqueID( GetIndex(col,row,cycle) );
115 TObject* fnd = fBTree->FindObject(this);
121 //______________________________________________________________________
122 void AliITSUSensMap::DeleteItem(TObject* obj)
124 // Delete a particular AliITSUSensMapItems.
125 TObject* fnd = fBTree->FindObject(obj);
131 //______________________________________________________________________
132 void AliITSUSensMap::SetDimensions(UInt_t dimCol,UInt_t dimRow,UInt_t dimCycle)
134 // set dimensions for current sensor
135 const UInt_t kMaxPackDim = 0xffffffff;
139 if ((fDimCol*fDimRow*fDimCycle*2)>kMaxPackDim) AliFatal(Form("Dimension %dx%dx%d*2 cannot be packed to UInt_t",fDimCol,fDimRow,fDimCycle));