]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/scripts/ReadRaw.C
coverity 15108 fixed
[u/mrichter/AliRoot.git] / FMD / scripts / ReadRaw.C
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  */
9 void
10 ReadRaw(const char* src=0, Int_t nEv=0, Int_t skip=0)
11 {
12   AliLog::SetModuleDebugLevel("FMD", 10);
13
14   AliCDBManager* cdb = AliCDBManager::Instance();
15   cdb->SetRun(0);
16   cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
17
18   AliRawReader*    reader    = AliRawReader::Create(src);
19   AliFMDRawReader* fmdReader = new AliFMDRawReader(reader, 0);
20   TClonesArray*    array     = new TClonesArray("AliFMDDigit", 0);
21
22   Int_t evCnt = 0;
23   while (reader->NextEvent()) {
24     if (nEv > 0 && (evCnt-skip) > nEv) break;
25     evCnt++;
26     array->Clear();
27     fmdReader->ReadAdcs(array);
28
29     std::cout << "Event # " << evCnt << std::endl;
30
31     AliFMDBoolMap read(0);
32     read.Reset(kFALSE);
33     std::cout << "Read " << array->GetEntriesFast() << " digits" << std::endl;
34   
35 #if 0
36     TIter next(array);
37     AliFMDDigit* digit = 0;
38     while ((digit = static_cast<AliFMDDigit*>(next()))) {
39       UShort_t d = digit->Detector();
40       Char_t   r = digit->Ring();
41       UShort_t s = digit->Sector();
42       UShort_t t = digit->Strip();
43       read(d,r,s,t) = true;
44     }
45     const UShort_t lineLength = 64;
46     for (UShort_t d = 1; d <= 3; d++) {
47       UShort_t nr = (d == 1 ? 1 : 2);
48       for (UShort_t q = 0; q < nr; q++) { 
49         Char_t   r  = q == 0 ? 'I' : 'O';
50         UShort_t ns = q == 0 ?  20 :  40;
51         UShort_t nt = q == 0 ? 512 : 256;
52         std::cout << "FMD" << d << r << ":" << std::endl;
53         for (UShort_t s = 0; s < ns; s++) {
54           std::cout << " Sector " << s << "\n" << std::flush;
55           for (UShort_t t = 0; t < nt; t++) { 
56             bool on = read(d,r,s,t);
57             if (t % lineLength == 0) std::cout << "  ";
58             std::cout << (on ? '+' : '-');
59             if (t % lineLength == lineLength-1) std::cout << "\n";
60           }
61         }
62       }
63     }
64 #endif
65   }
66   // a->ls();
67 }
68 //____________________________________________________________________
69 //
70 // EOF
71 //