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 ///////////////////////////////////////////////////////////////////////////////
29 #include "AliPMDRawStream.h"
30 #include "AliRawReader.h"
32 ClassImp(AliPMDRawStream)
35 //_____________________________________________________________________________
36 AliPMDRawStream::AliPMDRawStream(AliRawReader* rawReader) :
37 fRawReader(rawReader),
48 // create an object to read PMD raw digits
50 fRawReader->Select(12);
53 //_____________________________________________________________________________
54 AliPMDRawStream::AliPMDRawStream(const AliPMDRawStream& stream) :
69 Fatal("AliPMDRawStream", "copy constructor not implemented");
72 //_____________________________________________________________________________
73 AliPMDRawStream& AliPMDRawStream::operator = (const AliPMDRawStream&
76 // assignment operator
78 Fatal("operator =", "assignment operator not implemented");
82 //_____________________________________________________________________________
83 AliPMDRawStream::~AliPMDRawStream()
90 //_____________________________________________________________________________
91 Bool_t AliPMDRawStream::Next()
93 // read the next raw digit
94 // returns kFALSE if there is no digit left
96 fPrevModule = fModule;
99 if (!fRawReader->ReadNextInt(data)) return kFALSE;
101 fSignal = data & 0x0FFF;
102 fChannel = (data >> 12) & 0x003F;
103 fMCM = (data >> 18) & 0x07FF;
105 Int_t iddl = fRawReader->GetDDLID();
108 GetRowCol(iddl, fMCM, fChannel, ium, fRow, fColumn);
109 ConvertDDL2SMN(iddl, ium, fSMN, fModule, fDetector);
110 TransformH2S(fSMN, fRow, fColumn);
114 //_____________________________________________________________________________
115 void AliPMDRawStream::GetRowCol(Int_t ddlno, UInt_t mcmno, UInt_t chno,
116 Int_t &um, Int_t &row, Int_t &col) const
118 // decode: ddlno, mcmno, chno -> um, row, col
124 static const UInt_t kCh[64] = { 21, 25, 29, 28, 17, 24, 20, 16,
125 12, 13, 8, 4, 0, 1, 9, 5,
126 10, 6, 2, 3, 14, 7, 11, 15,
127 19, 18, 23, 27, 31, 30, 22, 26,
128 53, 57, 61, 60, 49, 56, 52, 48,
129 44, 45, 40, 36, 32, 33, 41, 37,
130 42, 38, 34, 35, 46, 39, 43, 47,
131 51, 50, 55, 59, 63, 62, 54, 58 };
133 if (ddlno == 0 || ddlno == 1)
136 Int_t mcmnonew = mcmno - 72*um;
137 Int_t rowcol = kCh[chno];
138 Int_t irownew = rowcol/4;
139 Int_t icolnew = rowcol%4;
141 remmcm = mcmnonew%12;
142 divmcm = mcmnonew/12;
144 row = 16*divmcm + irownew;
145 col = 4*remmcm + icolnew;
146 // This obtatined row and col (0,0) are the top left corner.
147 // Needs transformation to get the Geant (0,0)
150 else if (ddlno == 2 || ddlno == 3)
153 Int_t mcmnonew = mcmno - 72*um;
154 Int_t rowcol = kCh[chno];
155 Int_t irownew = rowcol/4;
156 Int_t icolnew = rowcol%4;
158 remmcm = mcmnonew%24;
159 divmcm = mcmnonew/24;
161 row = 16*divmcm + irownew;
162 col = 4*remmcm + icolnew;
163 // This obtatined row and col (0,0) are the top left corner.
164 // Needs transformation to get the Geant (0,0)
167 else if (ddlno == 4 || ddlno == 5)
170 Int_t mcmnonew = mcmno - 72*um;
171 Int_t rowcol = kCh[chno];
172 Int_t irownew = rowcol/4;
173 Int_t icolnew = rowcol%4;
177 remmcm = mcmnonew%12;
178 divmcm = mcmnonew/12;
182 remmcm = mcmnonew%24;
183 divmcm = mcmnonew/24;
186 row = 16*divmcm + irownew;
187 col = 4*remmcm + icolnew;
188 // This obtatined row and col (0,0) are the top left corner.
189 // Needs transformation to get the Geant (0,0)
194 //_____________________________________________________________________________
195 void AliPMDRawStream::ConvertDDL2SMN(Int_t iddl, Int_t ium, Int_t &smn,
196 Int_t &module, Int_t &detector) const
198 // This converts the DDL number to Module Number which runs from 0-47
199 // Serial module number in one detector which runs from 0-23
200 // Also gives the detector number (0:PRE plane, 1:CPV plane)
203 module = iddl*6 + ium;
237 //_____________________________________________________________________________
238 void AliPMDRawStream::TransformH2S(Int_t smn, Int_t &row, Int_t &col) const
240 // Transform the Hardware (0,0) coordinate to Software (0,0) coordinate
241 // and also writes in the digit form
242 // i.e., For SuperModule 1 &2, instead of 96x48 it is 48x96
243 // For Supermodule 3 & 4, 48x96
249 // Transform all the (0,0) coordinates to the geant frame
255 else if(smn >= 6 && smn < 12)
260 else if(smn >= 12 && smn < 18)
265 else if(smn >= 18 && smn < 24)
271 // for smn < 12 : row = 96, column = 48
272 // for smn>= 12 and < 24 : row = 48, column = 96
273 // In order to make it uniform dimension, smn < 12 are inverted
274 // i.e., row becomes column and column becomes row
275 // for others it remains same
276 // This is further inverted back while calculating eta and phi
279 // SupeModule 1 and 2 : Rows are inverted to columns and vice versa
280 // and at the time of calculating the eta,phi it is again reverted
285 else if( smn >= 12 && smn < 24)
294 //_____________________________________________________________________________