]>
Commit | Line | Data |
---|---|---|
4347b38f | 1 | #include <iomanip> |
2 | ||
3 | void | |
4 | ReadRaw(Int_t det=2, bool verbose=false, Int_t event=0) | |
5 | { | |
6 | TString file(Form("raw%d/FMD_%d.ddl", event, AliFMD::kBaseDDL + det - 1)); | |
7 | ||
8 | std::cout << "Reading raw data file " << file << std::endl; | |
9 | ||
10 | TH1* h = new TH1F("rawData", "Raw Data", 90, 0, 90); | |
11 | ||
12 | ||
13 | // This method creates a text file containing the same information | |
14 | // stored in an Altro file. The information in the text file is | |
15 | // organized pad by pad and and for each pad it consists in a | |
16 | // sequence of bunches (Bunch length +2, Time bin of the last | |
17 | // amplitude sample in the bunch, amplitude values) It is used | |
18 | // mainly //for debugging | |
19 | ||
20 | AliAltroBuffer buff(file.Data(),0); | |
21 | Int_t numWords,padNum,rowNum,secNum=0; | |
22 | Int_t value = 0; | |
23 | Int_t zero = 0; | |
24 | // if (!buff.ReadDataHeader()) { | |
25 | // std::cout<< file << " isn't a valid data file!" << std::endl; | |
26 | // } | |
27 | ||
28 | while(buff.ReadTrailerBackward(numWords,padNum,rowNum,secNum)){ | |
29 | if (verbose) | |
30 | std::cout << "Ring: " << (secNum == 0 ? 'I' : 'O') | |
31 | << " Sector: " << std::setw(2) << rowNum | |
32 | << " Strip: " << std::setw(3) << padNum | |
33 | << " Words: " << std::setw(4) << numWords << std::endl; | |
34 | if (numWords == 0) zero++; | |
35 | if (numWords % 4){ | |
36 | if (verbose) | |
37 | std::cout << "Skipping trailer of " | |
38 | << (4 - numWords % 4) << " words" << std::endl; | |
39 | for(Int_t j = 0; j < (4 - numWords % 4); j++) | |
40 | value=buff.GetNextBackWord(); | |
41 | }//end if | |
42 | for(Int_t i = 0; i <numWords; i++) { | |
43 | value=buff.GetNextBackWord(); | |
44 | if (verbose) { | |
45 | std::cout << std::setw(5) << value << std::flush; | |
46 | if (i % 16 == 15) std::cout << std::endl; | |
47 | } | |
48 | h->Fill(value); | |
49 | }//end for | |
50 | if (verbose) | |
51 | std::cout << std::endl; | |
52 | if (zero > 1) { | |
53 | std::cout << "Error: Read zero channels - should not happen" | |
54 | << std::endl; | |
55 | break; | |
56 | } | |
57 | }//end while | |
58 | h->Draw(); | |
59 | return; | |
60 | } |