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 #include "AliLog.h" // ALILOG_H
23 #include "AliFMD.h" // ALIFMD_H
24 #include "AliFMDDigit.h" // ALIFMDDIGIT_H
25 #include "AliFMDRawStream.h" // ALIFMDRAWSTREAM_H
26 #include "AliRawReader.h" // ALIRAWREADER_H
27 #include "AliFMDRawReader.h" // ALIFMDRAWREADER_H
28 #include "TArrayI.h" // ROOT_TArrayI
29 // #include <TClonesArray.h> // ROOT_TClonesArray
31 //____________________________________________________________________
32 ClassImp(AliFMDRawReader);
34 //____________________________________________________________________
35 AliFMDRawReader::AliFMDRawReader(AliFMD* fmd, AliRawReader* reader)
36 : TTask("FMDRawReader", "Reader of Raw ADC values from the FMD"),
44 //____________________________________________________________________
46 AliFMDRawReader::Exec(Option_t*)
48 if (!fReader->ReadHeader()) {
49 Error("ReadAdcs", "Couldn't read header");
53 // Use AliAltroRawStream to read the ALTRO format. No need to
54 // reinvent the wheel :-)
55 AliFMDRawStream input(fReader, fSampleRate);
57 fReader->Select(AliFMD::kBaseDDL >> 8);
61 UShort_t detector = 1; // Must be one here
62 UShort_t oldDetector = 0;
69 // Loop over data in file
74 Int_t ddl = fReader->GetDDLID();
75 if (ddl != oldDDL || input.IsNewStrip() || !next) {
76 // Make a new digit, if we have some data (oldDetector == 0,
77 // means that we haven't really read anything yet - that is,
78 // it's the first time we get here).
79 if (oldDetector > 0) {
81 AliDebug(10, Form("Add a new strip: FMD%d%c[%2d,%3d] "
82 "(current: FMD%d%c[%2d,%3d])",
83 oldDetector, input.PrevRing(),
84 input.PrevSector() , input.PrevStrip(),
85 detector , input.Ring(), input.Sector(),
87 fFMD->AddDigit(oldDetector,
91 counts[0], counts[1], counts[2]);
94 static_cast<AliFMDDigit*>(fFMD->Digits()->
95 UncheckedAt(fFMD->GetNdigits()-1));
100 AliDebug(10, Form("Read %d channels for FMD%d",
101 count + 1, detector));
106 // If we got a new DDL, it means we have a new detector.
109 AliDebug(10, Form("Read %d channels for FMD%d",
110 count + 1, detector));
111 // Reset counts, and update the DDL cache
114 // Check that we're processing a FMD detector
115 Int_t detId = fReader->GetDetectorID();
116 if (detId != (AliFMD::kBaseDDL >> 8)) {
117 Error("ReadAdcs", "Detector ID %d != %d",
118 detId, (AliFMD::kBaseDDL >> 8));
121 // Figure out what detector we're deling with
122 oldDetector = detector;
124 case 0: detector = 1; break;
125 case 1: detector = 2; break;
126 case 2: detector = 3; break;
128 Error("ReadAdcs", "Unknown DDL 0x%x for FMD", ddl);
131 AliDebug(10, Form("Reading ADCs for 0x%x - That is FMD%d",
132 fReader->GetEquipmentId(), detector));
137 counts[input.Sample()] = input.Count();
139 AliDebug(10, Form("ADC of FMD%d%c[%2d,%3d] += %d",
140 detector, input.Ring(), input.Sector(),
141 input.Strip(), input.Count()));
142 oldDetector = detector;
148 //____________________________________________________________________