]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/scripts/ReadRaw.C
Fixed up this script
[u/mrichter/AliRoot.git] / FMD / scripts / ReadRaw.C
CommitLineData
c2fc1258 1/** @file ReadRaw.C
2 @author Christian Holm Christensen <cholm@nbi.dk>
3 @date Tue Mar 28 12:39:08 2006
4 @brief Script to read raw data
5*/
6/** @ingroup FMD_script
7 @brief Read raw data into a TClonesArray - for testing
8 */
9void
3aba46fd 10ReadRaw(const char* src=0, Int_t nEv=0, Int_t skip=0, Bool_t verb=false)
c2fc1258 11{
3aba46fd 12 // AliLog::SetModuleDebugLevel("FMD", 10);
4125e138 13
c2fc1258 14 AliCDBManager* cdb = AliCDBManager::Instance();
162637e4 15 cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
3aba46fd 16 cdb->SetRun(0);
625d7886 17
4125e138 18 AliRawReader* reader = AliRawReader::Create(src);
19 AliFMDRawReader* fmdReader = new AliFMDRawReader(reader, 0);
20 TClonesArray* array = new TClonesArray("AliFMDDigit", 0);
3aba46fd 21 fmdReader->SetVerbose(verb);
4125e138 22
23 Int_t evCnt = 0;
24 while (reader->NextEvent()) {
4125e138 25 evCnt++;
3aba46fd 26 if (skip > 0 && (evCnt-skip) < 0) {
27 continue;
28 }
29 if (nEv > 0 && (evCnt-skip) > nEv) {
30 break;
31 }
4125e138 32 array->Clear();
33 fmdReader->ReadAdcs(array);
34
3aba46fd 35 std::cout << "Event # " << std::setw(6) << evCnt
36 << ": read " << array->GetEntriesFast() << " digits" << std::endl;
625d7886 37
4125e138 38#if 0
1c1525f2 39 AliFMDBoolMap read(0);
40 read.Reset(kFALSE);
41
4125e138 42 TIter next(array);
43 AliFMDDigit* digit = 0;
44 while ((digit = static_cast<AliFMDDigit*>(next()))) {
45 UShort_t d = digit->Detector();
46 Char_t r = digit->Ring();
47 UShort_t s = digit->Sector();
48 UShort_t t = digit->Strip();
49 read(d,r,s,t) = true;
625d7886 50 }
4125e138 51 const UShort_t lineLength = 64;
52 for (UShort_t d = 1; d <= 3; d++) {
53 UShort_t nr = (d == 1 ? 1 : 2);
54 for (UShort_t q = 0; q < nr; q++) {
55 Char_t r = q == 0 ? 'I' : 'O';
56 UShort_t ns = q == 0 ? 20 : 40;
57 UShort_t nt = q == 0 ? 512 : 256;
58 std::cout << "FMD" << d << r << ":" << std::endl;
59 for (UShort_t s = 0; s < ns; s++) {
60 std::cout << " Sector " << s << "\n" << std::flush;
61 for (UShort_t t = 0; t < nt; t++) {
62 bool on = read(d,r,s,t);
63 if (t % lineLength == 0) std::cout << " ";
64 std::cout << (on ? '+' : '-');
65 if (t % lineLength == lineLength-1) std::cout << "\n";
66 }
625d7886 67 }
68 }
69 }
4125e138 70#endif
625d7886 71 }
72 // a->ls();
c2fc1258 73}
74//____________________________________________________________________
75//
76// EOF
77//