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),
57 fExternalMapping(kFALSE)
59 // create an object to read PHOS/EMCAL raw digits
63 // PHOS and EMCAL have differen number of RCU per module
65 if(calo == "EMCAL") fNRCU = 2;
67 if (mapping == NULL) {
68 TString path = gSystem->Getenv("ALICE_ROOT");
69 path += "/"+calo+"/mapping/RCU";
71 for(Int_t i = 0; i < fNRCU; i++) {
75 fMapping[i] = new AliCaloAltroMapping(path2.Data());
79 fExternalMapping = kTRUE;
80 for(Int_t i = 0; i < fNRCU; i++)
81 fMapping[i] = mapping[i];
84 SetNoAltroMapping(kFALSE);
87 //_____________________________________________________________________________
88 AliCaloRawStream::AliCaloRawStream(const AliCaloRawStream& stream) :
89 AliAltroRawStream(stream),
99 fExternalMapping(kFALSE)
101 Fatal("AliCaloRawStream", "copy constructor not implemented");
104 //_____________________________________________________________________________
105 AliCaloRawStream& AliCaloRawStream::operator = (const AliCaloRawStream&
108 Fatal("operator =", "assignment operator not implemented");
112 //_____________________________________________________________________________
113 AliCaloRawStream::~AliCaloRawStream()
117 if (!fExternalMapping)
118 for(Int_t i = 0; i < fNRCU; i++)
122 //_____________________________________________________________________________
123 void AliCaloRawStream::Reset()
125 // reset phos/emcal raw stream params
126 AliAltroRawStream::Reset();
127 fModule = fPrevModule = fRow = fPrevRow = fColumn = fPrevColumn = -1;
128 fFilter = fCaloFlag = 0;
131 //_____________________________________________________________________________
132 Bool_t AliCaloRawStream::Next()
134 // Read next PHOS/EMCAL signal
135 // Apply the PHOS/EMCAL altro mapping to get
136 // the module,row and column indeces
137 fPrevModule = fModule;
139 fPrevColumn = fColumn;
140 if (AliAltroRawStream::Next()) {
141 if (IsNewHWAddress()) {
143 if ( fFilter > 0 ) { // some data should be filtered out
144 if ( (fFilter & (1<<fCaloFlag)) != 0) {
145 // this particular data should be filtered out
146 Next(); // go to the next address instead
156 //_____________________________________________________________________________
157 void AliCaloRawStream::ApplyAltroMapping()
159 // Take the DDL index, load
160 // the corresponding altro mapping
161 // object and fill the sector,row and pad indeces
162 Int_t ddlNumber = GetDDLNumber();
163 fModule = ddlNumber / fNRCU;
165 Int_t rcuIndex = ddlNumber % fNRCU;
167 Short_t hwAddress = GetHWAddress();
168 fRow = fMapping[rcuIndex]->GetPadRow(hwAddress);
169 fColumn = fMapping[rcuIndex]->GetPad(hwAddress);
170 fCaloFlag = fMapping[rcuIndex]->GetSector(hwAddress);