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 /// This class provides access to PMD digits in raw data.
22 /// It loops over all PMD digits in the raw data given by the AliRawReader.
23 /// The Next method goes to the next digit. If there are no digits left
24 /// it returns kFALSE.
25 /// Several getters provide information about the current digit.
27 ///////////////////////////////////////////////////////////////////////////////
30 #include "AliPMDRawStream.h"
31 #include "AliRawReader.h"
33 ClassImp(AliPMDRawStream)
36 //_____________________________________________________________________________
37 AliPMDRawStream::AliPMDRawStream(AliRawReader* rawReader) :
38 fRawReader(rawReader),
49 // create an object to read PMD raw digits
51 fRawReader->Select(12);
54 //_____________________________________________________________________________
55 AliPMDRawStream::AliPMDRawStream(const AliPMDRawStream& stream) :
70 AliFatal("Copy constructor not implemented");
73 //_____________________________________________________________________________
74 AliPMDRawStream& AliPMDRawStream::operator = (const AliPMDRawStream&
77 // assignment operator
79 AliFatal("operator = assignment operator not implemented");
83 //_____________________________________________________________________________
84 AliPMDRawStream::~AliPMDRawStream()
91 //_____________________________________________________________________________
92 Bool_t AliPMDRawStream::Next()
94 // read the next raw digit
95 // returns kFALSE if there is no digit left
97 fPrevModule = fModule;
100 if (!fRawReader->ReadNextInt(data)) return kFALSE;
102 fSignal = data & 0x0FFF;
103 fChannel = (data >> 12) & 0x003F;
104 fMCM = (data >> 18) & 0x07FF;
106 Int_t iddl = fRawReader->GetDDLID();
109 GetRowCol(iddl, fMCM, fChannel, ium, fRow, fColumn);
110 ConvertDDL2SMN(iddl, ium, fSMN, fModule, fDetector);
111 TransformH2S(fSMN, fRow, fColumn);
115 //_____________________________________________________________________________
116 void AliPMDRawStream::GetRowCol(Int_t ddlno, UInt_t mcmno, UInt_t chno,
117 Int_t &um, Int_t &row, Int_t &col) const
119 // decode: ddlno, mcmno, chno -> um, row, col
125 static const UInt_t kCh[64] = { 21, 25, 29, 28, 17, 24, 20, 16,
126 12, 13, 8, 4, 0, 1, 9, 5,
127 10, 6, 2, 3, 14, 7, 11, 15,
128 19, 18, 23, 27, 31, 30, 22, 26,
129 53, 57, 61, 60, 49, 56, 52, 48,
130 44, 45, 40, 36, 32, 33, 41, 37,
131 42, 38, 34, 35, 46, 39, 43, 47,
132 51, 50, 55, 59, 63, 62, 54, 58 };
134 if (ddlno == 0 || ddlno == 1)
137 Int_t mcmnonew = mcmno - 72*um;
138 Int_t rowcol = kCh[chno];
139 Int_t irownew = rowcol/4;
140 Int_t icolnew = rowcol%4;
142 remmcm = mcmnonew%12;
143 divmcm = mcmnonew/12;
145 row = 16*divmcm + irownew;
146 col = 4*remmcm + icolnew;
147 // This obtatined row and col (0,0) are the top left corner.
148 // Needs transformation to get the Geant (0,0)
151 else if (ddlno == 2 || ddlno == 3)
154 Int_t mcmnonew = mcmno - 72*um;
155 Int_t rowcol = kCh[chno];
156 Int_t irownew = rowcol/4;
157 Int_t icolnew = rowcol%4;
159 remmcm = mcmnonew%24;
160 divmcm = mcmnonew/24;
162 row = 16*divmcm + irownew;
163 col = 4*remmcm + icolnew;
164 // This obtatined row and col (0,0) are the top left corner.
165 // Needs transformation to get the Geant (0,0)
168 else if (ddlno == 4 || ddlno == 5)
171 Int_t mcmnonew = mcmno - 72*um;
172 Int_t rowcol = kCh[chno];
173 Int_t irownew = rowcol/4;
174 Int_t icolnew = rowcol%4;
178 remmcm = mcmnonew%12;
179 divmcm = mcmnonew/12;
183 remmcm = mcmnonew%24;
184 divmcm = mcmnonew/24;
187 row = 16*divmcm + irownew;
188 col = 4*remmcm + icolnew;
189 // This obtatined row and col (0,0) are the top left corner.
190 // Needs transformation to get the Geant (0,0)
195 //_____________________________________________________________________________
196 void AliPMDRawStream::ConvertDDL2SMN(Int_t iddl, Int_t ium, Int_t &smn,
197 Int_t &module, Int_t &detector) const
199 // This converts the DDL number to Module Number which runs from 0-47
200 // Serial module number in one detector which runs from 0-23
201 // Also gives the detector number (0:PRE plane, 1:CPV plane)
204 module = iddl*6 + ium;
238 //_____________________________________________________________________________
239 void AliPMDRawStream::TransformH2S(Int_t smn, Int_t &row, Int_t &col) const
241 // Transform the Hardware (0,0) coordinate to Software (0,0) coordinate
242 // and also writes in the digit form
243 // i.e., For SuperModule 1 &2, instead of 96x48 it is 48x96
244 // For Supermodule 3 & 4, 48x96
250 // Transform all the (0,0) coordinates to the geant frame
256 else if(smn >= 6 && smn < 12)
261 else if(smn >= 12 && smn < 18)
266 else if(smn >= 18 && smn < 24)
272 // for smn < 12 : row = 96, column = 48
273 // for smn>= 12 and < 24 : row = 48, column = 96
274 // In order to make it uniform dimension, smn < 12 are inverted
275 // i.e., row becomes column and column becomes row
276 // for others it remains same
277 // This is further inverted back while calculating eta and phi
280 // SupeModule 1 and 2 : Rows are inverted to columns and vice versa
281 // and at the time of calculating the eta,phi it is again reverted
286 else if( smn >= 12 && smn < 24)
295 //_____________________________________________________________________________