Extacting the OCDB in a separate module. The detectors have write permission in the...
[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
625d7886 10ReadRaw(const char* file=0, Int_t evno=0, bool old=false)
c2fc1258 11{
625d7886 12 TString src(file ? file : "");
c2fc1258 13 AliCDBManager* cdb = AliCDBManager::Instance();
2aeec17d 14 cdb->SetRun(0);
162637e4 15 cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
625d7886 16 AliLog::SetModuleDebugLevel("FMD", 1);
c2fc1258 17 AliFMDParameters::Instance()->Init();
625d7886 18 AliFMDParameters::Instance()->UseRcuTrailer(!old);
19 AliFMDParameters::Instance()->UseCompleteHeader(!old);
20 AliRawReader* r = 0;
21 if (src.IsNull()) {
22 std::cout << "Reading via AliRawReaderFile" << std::endl;
23 r = new AliRawReaderFile(0);
24 }
25 else if (src.EndsWith(".root")) {
26 std::cout << "Reading via AliRawReaderRoot" << std::endl;
27 r = new AliRawReaderRoot(src.Data(), evno);
28 }
29 else if (src.EndsWith(".raw")) {
30 std::cout << "Reading via AliRawReaderDate" << std::endl;
31 r = new AliRawReaderDate(src.Data());
32 }
33 else {
34 std::cerr << "Unknown raw type for source " << src
35 << " assuming simulated raw files in directory " << src
36 << std::endl;
37 r = new AliRawReaderFile(src);
38 }
c2fc1258 39 AliFMDRawReader* fr = new AliFMDRawReader(r, 0);
625d7886 40 TClonesArray* a = new TClonesArray("AliFMDDigit", 0);
c2fc1258 41 fr->ReadAdcs(a);
625d7886 42
43 std::cout << "Read " << a->GetEntriesFast() << " digits" << std::endl;
44
45 bool read[3][2][40][512];
46 for (UShort_t det = 0; det < 3; det++) {
47 for (UShort_t rng = 0; rng < 2; rng++) {
48 for (UShort_t sec = 0; sec < 40; sec++) {
49 for (UShort_t str = 0; str < 512; str++) {
50 read[det][rng][sec][str] = false;
51 }
52 }
53 }
54 }
55
56
57 TIter next(a);
58 AliFMDDigit* d = 0;
59 while ((d = static_cast<AliFMDDigit*>(next()))) {
60 UShort_t det = d->Detector() - 1;
61 UShort_t rng = d->Ring() == 'I' ? 0 : 1;
62 UShort_t sec = d->Sector();
63 UShort_t str = d->Strip();
64 read[det][rng][sec][str] = true;
65 }
66 const UShort_t lineLength = 64;
67 for (UShort_t det = 0; det < 3; det++) {
68 for (UShort_t rng = 0; rng < 2; rng++) {
69 if (det == 0 && rng == 1) continue;
70 Char_t rid = rng == 0 ? 'I' : 'O';
71 UShort_t nsec = rng == 0 ? 20 : 40;
72 UShort_t nstr = rng == 0 ? 512 : 256;
73 std::cout << "FMD" << det+1 << rid << ":" << std::endl;
74 for (UShort_t sec = 0; sec < nsec; sec++) {
75 std::cout << " Sector " << sec << "\n" << std::flush;
76 for (UShort_t str = 0; str < nstr; str++) {
77 bool on = read[det][rng][sec][str];
78 if (str % lineLength == 0) std::cout << " ";
79 std::cout << (on ? '+' : '-');
80 if (str % lineLength == lineLength-1) std::cout << "\n";
81 }
82 }
83 }
84 }
85 // a->ls();
c2fc1258 86}
87//____________________________________________________________________
88//
89// EOF
90//