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 **************************************************************************/
18 /////////////////////////////////////////////////////////////////////////
20 // AliTOFRawMap class //
22 // It enables fast check if the TDC channel was already engaged //
23 // for a measurement. //
24 // The index of a AliTOFrawData is saved in the each rawdatamap "cell" //
25 // (there is an offset +1, because the index can be zero and //
26 // zero means empty cell. //
28 /////////////////////////////////////////////////////////////////////////
30 #include "TClonesArray.h"
34 #include "AliTOFGeometry.h"
35 #include "AliTOFRawMap.h"
37 ClassImp(AliTOFRawMap)
39 AliTOFRawMap::AliTOFRawMap():
54 ////////////////////////////////////////////////////////////////////////
55 AliTOFRawMap::AliTOFRawMap(TClonesArray *dig)://, AliTOFGeometry *tofGeom:
57 fNtrm(AliTOFGeometry::NTRM()+2),
58 fNtrmChain(AliTOFGeometry::NChain()),
59 fNtdc(AliTOFGeometry::NTdc()),
60 fNtdcChannel(AliTOFGeometry::NCh()),
69 // of course, these constants must not be hardwired
72 fMaxIndex = fNtrm*fNtrmChain*fNtdc*fNtdcChannel;
73 fRawMap = new Int_t[fMaxIndex];
77 ////////////////////////////////////////////////////////////////////////
78 AliTOFRawMap::AliTOFRawMap(const AliTOFRawMap & rawMap) :
81 fNtrmChain(rawMap.fNtrmChain),
83 fNtdcChannel(rawMap.fNtdcChannel),
84 fRawData(rawMap.fRawData),
89 // Dummy copy constructor
92 fMaxIndex = fNtrm*fNtrmChain*fNtdc*fNtdcChannel;
93 fRawMap = new Int_t[fMaxIndex];
94 for (Int_t i=0; i<fMaxIndex; i++)
95 fRawMap[i]=rawMap.fRawMap[i];
99 ////////////////////////////////////////////////////////////////////////
100 AliTOFRawMap & AliTOFRawMap::operator=(const AliTOFRawMap & rawMap)
103 // Dummy copy constructor
110 fNtrmChain=rawMap.fNtrmChain;
112 fNtdcChannel=rawMap.fNtdcChannel;
113 fRawData=rawMap.fRawData;
114 fMaxIndex=fNtrm*fNtrmChain*fNtdc*fNtdcChannel;
115 fRawMap = new Int_t[fMaxIndex];
116 for (Int_t i=0; i<fMaxIndex; i++)
117 fRawMap[i]=rawMap.fRawMap[i];
123 ////////////////////////////////////////////////////////////////////////
124 AliTOFRawMap::~AliTOFRawMap()
134 ////////////////////////////////////////////////////////////////////////
135 void AliTOFRawMap::Clear(const char *)
140 memset(fRawMap,0,sizeof(int)*fMaxIndex);
143 ////////////////////////////////////////////////////////////////////////
144 Int_t AliTOFRawMap::CheckedIndex(const Int_t * const slot) const
147 // Return checked indices for vol
150 slot[0]*fNtrmChain*fNtdc*fNtdcChannel + // TRM
151 slot[1]*fNtdc*fNtdcChannel + // TRM chain
152 slot[2]*fNtdcChannel + // TDC
153 slot[3]; // TDC channel
155 if (index >= fMaxIndex) {
156 AliError("CheckedIndex - input outside bounds");
163 ////////////////////////////////////////////////////////////////////////
164 void AliTOFRawMap::SetHit(Int_t *slot, Int_t idigit)
167 // Assign digit to pad vol
170 // 0 means empty pad, we need to shift indeces by 1
171 fRawMap[CheckedIndex(slot)]=idigit+1;
174 ////////////////////////////////////////////////////////////////////////
175 void AliTOFRawMap::SetHit(Int_t *slot)
178 // Assign last digit to channel slot
181 // 0 means empty pad, we need to shift indeces by 1
182 fRawMap[CheckedIndex(slot)]=fRawData->GetLast()+1;
185 ////////////////////////////////////////////////////////////////////////
186 Int_t AliTOFRawMap::GetHitIndex(Int_t *slot) const
189 // Get contents of channel slot
192 // 0 means empty pad, we need to shift indeces by 1
193 return fRawMap[CheckedIndex(slot)]-1;
196 ////////////////////////////////////////////////////////////////////////
197 TObject* AliTOFRawMap::GetHit(Int_t *slot) const
200 // Get pointer to object at alot
201 // return 0 if vol out of bounds
202 Int_t index = GetHitIndex(slot);
203 return (index <0) ? 0 : fRawData->UncheckedAt(index);
206 ////////////////////////////////////////////////////////////////////////
207 FlagType AliTOFRawMap::TestHit(Int_t *slot) const
210 // Check if hit cell is empty, used or unused
212 Int_t inf = fRawMap[CheckedIndex(slot)];
215 } else if (inf == 0) {