]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/scripts/ReadRaw.C
Removing the tasks from the digitization (Ruben)
[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     std::cout << "Read " << array->GetEntriesFast() << " digits" << std::endl;
32   
33 #if 0
34     AliFMDBoolMap read(0);
35     read.Reset(kFALSE);
36
37     TIter next(array);
38     AliFMDDigit* digit = 0;
39     while ((digit = static_cast<AliFMDDigit*>(next()))) {
40       UShort_t d = digit->Detector();
41       Char_t   r = digit->Ring();
42       UShort_t s = digit->Sector();
43       UShort_t t = digit->Strip();
44       read(d,r,s,t) = true;
45     }
46     const UShort_t lineLength = 64;
47     for (UShort_t d = 1; d <= 3; d++) {
48       UShort_t nr = (d == 1 ? 1 : 2);
49       for (UShort_t q = 0; q < nr; q++) { 
50         Char_t   r  = q == 0 ? 'I' : 'O';
51         UShort_t ns = q == 0 ?  20 :  40;
52         UShort_t nt = q == 0 ? 512 : 256;
53         std::cout << "FMD" << d << r << ":" << std::endl;
54         for (UShort_t s = 0; s < ns; s++) {
55           std::cout << " Sector " << s << "\n" << std::flush;
56           for (UShort_t t = 0; t < nt; t++) { 
57             bool on = read(d,r,s,t);
58             if (t % lineLength == 0) std::cout << "  ";
59             std::cout << (on ? '+' : '-');
60             if (t % lineLength == lineLength-1) std::cout << "\n";
61           }
62         }
63       }
64     }
65 #endif
66   }
67   // a->ls();
68 }
69 //____________________________________________________________________
70 //
71 // EOF
72 //