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 PHOS/EMCAL digits in raw data.
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.
27 /// root > AliRawReaderFile rawReader ;
28 /// root > AliCaloRawStream input(&rawReader) ;
29 /// root > while (input.Next()) .....
31 ///Modification: Class exported from PHOS to be used by EMCAL and PHOS
32 ///November 2006 Gustavo Conesa Balbastre
33 ///////////////////////////////////////////////////////////////////////////////
38 #include "AliCaloRawStream.h"
39 #include "AliRawReader.h"
40 #include "AliCaloAltroMapping.h"
42 ClassImp(AliCaloRawStream)
45 //_____________________________________________________________________________
46 AliCaloRawStream::AliCaloRawStream(AliRawReader* rawReader, TString calo, AliAltroMapping **mapping) :
47 AliAltroRawStream(rawReader),
56 fExternalMapping(kFALSE)
58 // create an object to read PHOS/EMCAL raw digits
62 // PHOS and EMCAL have differen number of RCU per module
64 if(calo == "EMCAL") fNRCU = 2;
66 if (mapping == NULL) {
67 TString path = gSystem->Getenv("ALICE_ROOT");
68 path += "/"+calo+"/mapping/RCU";
70 for(Int_t i = 0; i < fNRCU; i++) {
74 fMapping[i] = new AliCaloAltroMapping(path2.Data());
78 fExternalMapping = kTRUE;
79 for(Int_t i = 0; i < fNRCU; i++)
80 fMapping[i] = mapping[i];
83 SetNoAltroMapping(kFALSE);
86 //_____________________________________________________________________________
87 AliCaloRawStream::AliCaloRawStream(const AliCaloRawStream& stream) :
88 AliAltroRawStream(stream),
97 fExternalMapping(kFALSE)
99 Fatal("AliCaloRawStream", "copy constructor not implemented");
102 //_____________________________________________________________________________
103 AliCaloRawStream& AliCaloRawStream::operator = (const AliCaloRawStream&
106 Fatal("operator =", "assignment operator not implemented");
110 //_____________________________________________________________________________
111 AliCaloRawStream::~AliCaloRawStream()
115 if (!fExternalMapping)
116 for(Int_t i = 0; i < fNRCU; i++)
120 //_____________________________________________________________________________
121 void AliCaloRawStream::Reset()
123 // reset phos/emcal raw stream params
124 AliAltroRawStream::Reset();
125 fModule = fPrevModule = fRow = fPrevRow = fColumn = fPrevColumn = -1;
129 //_____________________________________________________________________________
130 Bool_t AliCaloRawStream::Next()
132 // Read next PHOS/EMCAL signal
133 // Apply the PHOS/EMCAL altro mapping to get
134 // the module,row and column indeces
135 fPrevModule = fModule;
137 fPrevColumn = fColumn;
138 if (AliAltroRawStream::Next()) {
139 if (IsNewHWAddress())
147 //_____________________________________________________________________________
148 void AliCaloRawStream::ApplyAltroMapping()
150 // Take the DDL index, load
151 // the corresponding altro mapping
152 // object and fill the sector,row and pad indeces
153 Int_t ddlNumber = GetDDLNumber();
154 fModule = ddlNumber / fNRCU;
156 Int_t rcuIndex = ddlNumber % fNRCU;
158 Short_t hwAddress = GetHWAddress();
159 fRow = fMapping[rcuIndex]->GetPadRow(hwAddress);
160 fColumn = fMapping[rcuIndex]->GetPad(hwAddress);
161 fGain = fMapping[rcuIndex]->GetSector(hwAddress);