]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RAW/AliCaloRawStream.cxx
Typo corrected.
[u/mrichter/AliRoot.git] / RAW / AliCaloRawStream.cxx
CommitLineData
d84933b0 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
16/* $Id$ */
17
18///////////////////////////////////////////////////////////////////////////////
19///
20/// This class provides access to PHOS/EMCAL digits in raw data.
21///
22/// It loops over all PHOS/EMCAL 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.
26/// usage:
27/// root > AliRawReaderFile rawReader ;
28/// root > AliCaloRawStream input(&rawReader) ;
29/// root > while (input.Next()) .....
30///
31///Modification: Class exported from PHOS to be used by EMCAL and PHOS
32///November 2006 Gustavo Conesa Balbastre
33///////////////////////////////////////////////////////////////////////////////
34
35#include <TString.h>
36#include <TSystem.h>
37
38#include "AliCaloRawStream.h"
39#include "AliRawReader.h"
40#include "AliCaloAltroMapping.h"
41
42ClassImp(AliCaloRawStream)
43
44
45//_____________________________________________________________________________
46 AliCaloRawStream::AliCaloRawStream(AliRawReader* rawReader, TString calo) :
47 AliAltroRawStream(rawReader),
48 fModule(-1),
49 fPrevModule(-1),
50 fRow(-1),
51 fPrevRow(-1),
52 fColumn(-1),
53 fPrevColumn(-1),
54 fGain(0)
55{
56// create an object to read PHOS/EMCAL raw digits
57
58 SelectRawData(calo);
59
60 // PHOS and EMCAL have differen number of RCU per module
61 fNRCU = 4;
62 if(calo == "EMCAL") fNRCU = 2;
63
d5529455 64 TString path = gSystem->Getenv("ALICE_ROOT");
65 path += "/"+calo+"/mapping/RCU";
d84933b0 66 TString path2;
67 for(Int_t i = 0; i < fNRCU; i++) {
68 path2 = path;
69 path2 += i;
70 path2 += ".data";
71 fMapping[i] = new AliCaloAltroMapping(path2.Data());
72 }
73
74 SetNoAltroMapping(kFALSE);
75}
76
77//_____________________________________________________________________________
78AliCaloRawStream::AliCaloRawStream(const AliCaloRawStream& stream) :
79 AliAltroRawStream(stream),
80 fModule(-1),
81 fPrevModule(-1),
82 fRow(-1),
83 fPrevRow(-1),
84 fColumn(-1),
85 fPrevColumn(-1),
86 fGain(0),
87 fNRCU(0)
88{
89 Fatal("AliCaloRawStream", "copy constructor not implemented");
90}
91
92//_____________________________________________________________________________
93AliCaloRawStream& AliCaloRawStream::operator = (const AliCaloRawStream&
94 /* stream */)
95{
96 Fatal("operator =", "assignment operator not implemented");
97 return *this;
98}
99
100//_____________________________________________________________________________
101AliCaloRawStream::~AliCaloRawStream()
102{
103// destructor
104
105 for(Int_t i = 0; i < fNRCU; i++) delete fMapping[i];
106}
107
108//_____________________________________________________________________________
109void AliCaloRawStream::Reset()
110{
111 // reset phos/emcal raw stream params
112 AliAltroRawStream::Reset();
113 fModule = fPrevModule = fRow = fPrevRow = fColumn = fPrevColumn = -1;
114 fGain = 0;
115}
116
117//_____________________________________________________________________________
118Bool_t AliCaloRawStream::Next()
119{
120 // Read next PHOS/EMCAL signal
121 // Apply the PHOS/EMCAL altro mapping to get
122 // the module,row and column indeces
123 fPrevModule = fModule;
124 fPrevRow = fRow;
125 fPrevColumn = fColumn;
126 if (AliAltroRawStream::Next()) {
127 if (IsNewHWAddress())
128 ApplyAltroMapping();
129 return kTRUE;
130 }
131 else
132 return kFALSE;
133}
134
135//_____________________________________________________________________________
136void AliCaloRawStream::ApplyAltroMapping()
137{
138 // Take the DDL index, load
139 // the corresponding altro mapping
140 // object and fill the sector,row and pad indeces
141 Int_t ddlNumber = GetDDLNumber();
142 fModule = ddlNumber / fNRCU;
143
144 Int_t rcuIndex = ddlNumber % fNRCU;
145
146 Short_t hwAddress = GetHWAddress();
147 fRow = fMapping[rcuIndex]->GetPadRow(hwAddress);
148 fColumn = fMapping[rcuIndex]->GetPad(hwAddress);
149 fGain = fMapping[rcuIndex]->GetSector(hwAddress);
150
151}