AliRoot Core  3dc7879 (3dc7879)
TestRawIO.C
Go to the documentation of this file.
1 //____________________________________________________________________
2 //
3 // $Id$
4 //
5 // Test of AliFMDAltro{Reader,Writer}
6 //
9 UShort_t
10 MakeADC(UShort_t d, UShort_t q, UShort_t s, UShort_t t)
11 {
12  return t & 0x3FF;
13 }
14 void
15 MakeData(TClonesArray& array, AliFMDUShortMap& map)
16 {
17  size_t i = 0;
18  for (size_t d = 1; d <= 3; d++) {
19  size_t nRng = (d == 1 ? 1 : 2);
20  for (size_t q = 0; q < nRng; q++) {
21  Char_t r = (q == 0 ? 'I' : 'O');
22  size_t nSec = (q == 0 ? 20 : 40);
23  size_t nStr = (q == 0 ? 512 : 256);
24  for (size_t s = 0; s < nSec; s++) {
25  for (size_t t = 0; t < nStr; t++) {
26  UShort_t adc = MakeADC(d, q, s, t);
27  new (array[i++]) AliFMDDigit(d, r, s, t, adc, adc, adc, adc);
28  map(d,r,s,t) = adc;
29  }
30  }
31  }
32  }
33 }
34 void
35 CompareData(TClonesArray& in, const AliFMDUShortMap& map)
36 {
37  size_t i = 0;
38  for (size_t i = 0; i < in.GetEntries(); i++) {
39  AliFMDDigit* inD = static_cast<AliFMDDigit*>(in.At(i));
40  // AliFMDDigit* outD = static_cast<AliFMDDigit*>(out.At(i));
41 
42  UShort_t out = map(inD->Detector(),
43  inD->Ring(),
44  inD->Sector(),
45  inD->Strip());
46  if (out != inD->Counts()) {
47  std::cout << "Entries " << i << " does not match up - expected "
48  << out << "\n ";
49  inD->Print();
50  }
51  }
52 }
53 
54 void
56 {
58  cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
59  cdb->SetRun(0);
60 
62  param->Init();
63 
64  TClonesArray out("AliFMDDigit");
65  AliFMDUShortMap map(0);
66  MakeData(out, map);
67 
68  AliFMDRawWriter writer(0);
69  writer.WriteDigits(&out);
70 
71  // gSystem->mkdir("raw0");
72  // gSystem->Rename("FMD_3072.ddl", "raw0/FMD_3072.ddl");
73  // gSystem->Rename("FMD_3073.ddl", "raw0/FMD_3073.ddl");
74  // gSystem->Rename("FMD_3074.ddl", "raw0/FMD_3074.ddl");
75 
76  AliRawReader* raw = AliRawReader::Create("./");
77  AliFMDRawReader reader(raw, 0);
78  TClonesArray in("AliFMDDigit");
79  raw->NextEvent();
80  reader.ReadAdcs(&in);
81 
82  std::cout << "Got " << in.GetEntries() << std::endl;
83 
84  CompareData(in, map);
85 }
86 //____________________________________________________________________
87 //
88 // EOF
89 //
class for digits
Definition: AliFMDDigit.h:28
void MakeData(TClonesArray &array, AliFMDUShortMap &map)
Definition: TestRawIO.C:15
Map of an integer per strip.
void TestRawIO()
Definition: TestRawIO.C:55
void Print(Option_t *opt="") const
UShort_t Sector() const
Char_t Ring() const
Class to write ALTRO formated raw data from an array of AliFMDDigit objects.
This class is a singleton that handles various parameters of the FMD detectors. This class reads from...
Class to read ALTRO formated raw data from an AliRawReader object.
void CompareData(TClonesArray &in, const AliFMDUShortMap &map)
Definition: TestRawIO.C:35
TObjArray * array
Definition: AnalyzeLaser.C:12
UShort_t MakeADC(UShort_t d, UShort_t q, UShort_t s, UShort_t t)
Definition: TestRawIO.C:10
UShort_t Strip() const
virtual Bool_t ReadAdcs(TClonesArray *array)
virtual Long_t WriteDigits(TClonesArray *digits)
static AliFMDParameters * Instance()
void SetRun(Int_t run)
void SetDefaultStorage(const char *dbString)
UShort_t Detector() const
static AliCDBManager * Instance(TMap *entryCache=NULL, Int_t run=-1)
UShort_t Counts() const
Definition: AliFMDDigit.h:147
UShort_t Init(Bool_t forceReInit=kFALSE, UInt_t what=kAll)