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
25 // Several getters provide information about the current digit.
27 // AliRawReader *reader = AliRawReader::Create(fileName);
28 // AliCaloRawStreamV3 *stream = new AliCaloRawStreamV3(reader,calo);
29 // while (reader->NextEvent())
30 // while (stream->NextDDL())
31 // while (stream->NextChannel()) ...
33 /// Yuri Kharlov. 23 June 2009
34 ///////////////////////////////////////////////////////////////////////////////
39 #include "AliCaloRawStreamV3.h"
40 #include "AliRawReader.h"
41 #include "AliCaloAltroMapping.h"
43 ClassImp(AliCaloRawStreamV3)
46 //_____________________________________________________________________________
47 AliCaloRawStreamV3::AliCaloRawStreamV3(AliRawReader* rawReader, TString calo, AliAltroMapping **mapping) :
48 AliAltroRawStreamV3(rawReader),
57 fExternalMapping(kFALSE)
59 // create an object to read PHOS/EMCAL raw digits
62 // PHOS and EMCAL have differen number of RCU per module
67 TString sides[]={"A","C"};
68 if(fCalo == "EMCAL") {
73 if (mapping == NULL) {
74 TString path = gSystem->Getenv("ALICE_ROOT");
75 path += "/"+fCalo+"/mapping/RCU";
77 for(Int_t j = 0; j < fNSides; j++){
78 for(Int_t i = 0; i < fNRCU; i++) {
81 if(fCalo == "EMCAL") path2 += sides[j];
83 fMapping[j*fNRCU+ i] = new AliCaloAltroMapping(path2.Data());
88 fExternalMapping = kTRUE;
89 for(Int_t i = 0; i < fNRCU*fNSides; i++)
90 fMapping[i] = mapping[i];
94 //_____________________________________________________________________________
95 AliCaloRawStreamV3::AliCaloRawStreamV3(const AliCaloRawStreamV3& stream) :
96 AliAltroRawStreamV3(stream),
105 fExternalMapping(kFALSE)
107 Fatal("AliCaloRawStreamV3", "copy constructor not implemented");
110 //_____________________________________________________________________________
111 AliCaloRawStreamV3& AliCaloRawStreamV3::operator = (const AliCaloRawStreamV3&
114 Fatal("operator =", "assignment operator not implemented");
118 //_____________________________________________________________________________
119 AliCaloRawStreamV3::~AliCaloRawStreamV3()
123 if (!fExternalMapping)
124 for(Int_t i = 0; i < fNRCU*fNSides; i++)
128 //_____________________________________________________________________________
129 void AliCaloRawStreamV3::Reset()
131 // reset phos/emcal raw stream params
132 AliAltroRawStreamV3::Reset();
133 fModule = fRow = fColumn = -1;
134 fFilter = fCaloFlag = 0;
138 //_____________________________________________________________________________
139 Bool_t AliCaloRawStreamV3::NextChannel()
141 // Read next PHOS/EMCAL signal
142 // Apply the PHOS/EMCAL altro mapping to get
143 // the module,row and column indeces
145 if (AliAltroRawStreamV3::NextChannel()) {
147 if ( fFilter > 0 ) { // some data should be filtered out
148 if ( (fFilter & (1<<fCaloFlag)) != 0) {
149 // this particular data should be filtered out
150 NextChannel(); // go to the next address instead
159 //_____________________________________________________________________________
160 void AliCaloRawStreamV3::ApplyAltroMapping()
162 // Take the DDL index, load
163 // the corresponding altro mapping
164 // object and fill the sector,row and pad indeces
166 Int_t ddlNumber = GetDDLNumber();
167 fModule = ddlNumber / fNRCU;
169 Int_t rcuIndex = ddlNumber % fNRCU;
171 if(fCalo=="EMCAL"){ // EMCAL may need to increase RCU index for the maps
172 if (fModule%2 == 1) { rcuIndex += 2; } // other='C' side maps
175 Short_t hwAddress = GetHWAddress();
176 fRow = fMapping[rcuIndex]->GetPadRow(hwAddress);
177 fColumn = fMapping[rcuIndex]->GetPad(hwAddress);
178 fCaloFlag = fMapping[rcuIndex]->GetSector(hwAddress);