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 // Class to read ADC values from a AliRawReader object.
22 // This class uses the AliFMDRawStreamer class to read the ALTRO
30 // +-----------------+ <<references>> +--------------+
31 // | AliFMDRawReader |<>----------------| AliRawReader |
32 // +-----------------+ +--------------+
36 // +-----------------+ <<uses>> |
37 // | AliFMDRawStream |------------------------+
38 // +-----------------+
45 #include <AliLog.h> // ALILOG_H
46 #include "AliFMD.h" // ALIFMD_H
47 #include "AliFMDDigit.h" // ALIFMDDIGIT_H
48 #include "AliFMDRawStream.h" // ALIFMDRAWSTREAM_H
49 #include "AliRawReader.h" // ALIRAWREADER_H
50 #include "AliFMDRawReader.h" // ALIFMDRAWREADER_H
51 #include <TArrayI.h> // ROOT_TArrayI
52 // #include <TClonesArray.h> // ROOT_TClonesArray
54 //____________________________________________________________________
55 ClassImp(AliFMDRawReader);
57 //____________________________________________________________________
58 AliFMDRawReader::AliFMDRawReader(AliFMD* fmd, AliRawReader* reader)
59 : TTask("FMDRawReader", "Reader of Raw ADC values from the FMD"),
64 SetSampleRate(fmd->GetSampleRate());
68 //____________________________________________________________________
70 AliFMDRawReader::Exec(Option_t*)
72 // Read raw data into the digits array
73 if (!fReader->ReadHeader()) {
74 Error("ReadAdcs", "Couldn't read header");
78 // Use AliAltroRawStream to read the ALTRO format. No need to
79 // reinvent the wheel :-)
80 AliFMDRawStream input(fReader, fSampleRate);
82 fReader->Select(AliFMD::kBaseDDL >> 8);
86 UShort_t detector = 1; // Must be one here
87 UShort_t oldDetector = 0;
94 // Loop over data in file
99 Int_t ddl = fReader->GetDDLID();
100 if (ddl != oldDDL || input.IsNewStrip() || !next) {
101 // Make a new digit, if we have some data (oldDetector == 0,
102 // means that we haven't really read anything yet - that is,
103 // it's the first time we get here).
104 if (oldDetector > 0) {
106 AliDebug(10, Form("Add a new strip: FMD%d%c[%2d,%3d] "
107 "(current: FMD%d%c[%2d,%3d])",
108 oldDetector, input.PrevRing(),
109 input.PrevSector() , input.PrevStrip(),
110 detector , input.Ring(), input.Sector(),
112 fFMD->AddDigit(oldDetector,
116 counts[0], counts[1], counts[2]);
119 static_cast<AliFMDDigit*>(fFMD->Digits()->
120 UncheckedAt(fFMD->GetNdigits()-1));
125 AliDebug(10, Form("Read %d channels for FMD%d",
126 count + 1, detector));
131 // If we got a new DDL, it means we have a new detector.
134 AliDebug(10, Form("Read %d channels for FMD%d",
135 count + 1, detector));
136 // Reset counts, and update the DDL cache
139 // Check that we're processing a FMD detector
140 Int_t detId = fReader->GetDetectorID();
141 if (detId != (AliFMD::kBaseDDL >> 8)) {
142 Error("ReadAdcs", "Detector ID %d != %d",
143 detId, (AliFMD::kBaseDDL >> 8));
146 // Figure out what detector we're deling with
147 oldDetector = detector;
149 case 0: detector = 1; break;
150 case 1: detector = 2; break;
151 case 2: detector = 3; break;
153 Error("ReadAdcs", "Unknown DDL 0x%x for FMD", ddl);
156 AliDebug(10, Form("Reading ADCs for 0x%x - That is FMD%d",
157 fReader->GetEquipmentId(), detector));
162 counts[input.Sample()] = input.Count();
164 AliDebug(10, Form("ADC of FMD%d%c[%2d,%3d] += %d",
165 detector, input.Ring(), input.Sector(),
166 input.Strip(), input.Count()));
167 oldDetector = detector;
173 //____________________________________________________________________