]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/scripts/ReadRaw.C
Update master to aliroot
[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*/
ca20eb4a 6/**
7 * Default input file
8 * @ingroup FMD_script
9 */
10const char* df = "/data/alice/data/pp/LHC10c/raw/118561/physics_118561.root";
11/**
12 * @brief Read raw data into a TClonesArray - for testing
13 *
14 * @param file Input raw data
15 * @param nEv Number of events to process (<=0 means all)
16 * @param skip Number of events to skip
17 * @param debug Debug level
c2fc1258 18 */
19void
ca20eb4a 20ReadRaw(const char* src=df, Int_t nEv=10, Int_t skip=300, Int_t debug=4)
c2fc1258 21{
4125e138 22
c2fc1258 23 AliCDBManager* cdb = AliCDBManager::Instance();
162637e4 24 cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
3aba46fd 25 cdb->SetRun(0);
625d7886 26
4125e138 27 AliRawReader* reader = AliRawReader::Create(src);
28 AliFMDRawReader* fmdReader = new AliFMDRawReader(reader, 0);
29 TClonesArray* array = new TClonesArray("AliFMDDigit", 0);
ca20eb4a 30 fmdReader->SetVerbose(debug > 0);
31 AliLog::SetModuleDebugLevel("FMD", debug);
4125e138 32
33 Int_t evCnt = 0;
34 while (reader->NextEvent()) {
4125e138 35 evCnt++;
3aba46fd 36 if (skip > 0 && (evCnt-skip) < 0) {
37 continue;
38 }
39 if (nEv > 0 && (evCnt-skip) > nEv) {
40 break;
41 }
4125e138 42 array->Clear();
43 fmdReader->ReadAdcs(array);
44
3aba46fd 45 std::cout << "Event # " << std::setw(6) << evCnt
46 << ": read " << array->GetEntriesFast() << " digits" << std::endl;
625d7886 47
4125e138 48#if 0
1c1525f2 49 AliFMDBoolMap read(0);
50 read.Reset(kFALSE);
51
4125e138 52 TIter next(array);
53 AliFMDDigit* digit = 0;
54 while ((digit = static_cast<AliFMDDigit*>(next()))) {
55 UShort_t d = digit->Detector();
56 Char_t r = digit->Ring();
57 UShort_t s = digit->Sector();
58 UShort_t t = digit->Strip();
59 read(d,r,s,t) = true;
625d7886 60 }
4125e138 61 const UShort_t lineLength = 64;
62 for (UShort_t d = 1; d <= 3; d++) {
63 UShort_t nr = (d == 1 ? 1 : 2);
64 for (UShort_t q = 0; q < nr; q++) {
65 Char_t r = q == 0 ? 'I' : 'O';
66 UShort_t ns = q == 0 ? 20 : 40;
67 UShort_t nt = q == 0 ? 512 : 256;
68 std::cout << "FMD" << d << r << ":" << std::endl;
69 for (UShort_t s = 0; s < ns; s++) {
70 std::cout << " Sector " << s << "\n" << std::flush;
71 for (UShort_t t = 0; t < nt; t++) {
72 bool on = read(d,r,s,t);
73 if (t % lineLength == 0) std::cout << " ";
74 std::cout << (on ? '+' : '-');
75 if (t % lineLength == lineLength-1) std::cout << "\n";
76 }
625d7886 77 }
78 }
79 }
4125e138 80#endif
625d7886 81 }
82 // a->ls();
c2fc1258 83}
84//____________________________________________________________________
85//
86// EOF
87//