]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/scripts/RunSimpleChain.C
renaming function to avoid library conflict (discovered in test/generators/TUHKMgen)
[u/mrichter/AliRoot.git] / FMD / scripts / RunSimpleChain.C
1 /**
2  * A script that will run the most simple chain possible. 
3  *
4  * What is done, depends on a bit mask:
5  *
6  *  Bit | Job
7  *  ----+-----------------------
8  *   0  | Make fake hits
9  *   1  | Make digits from hits
10  *   2  | Make sdigits from hits
11  *   3  | Make raw DDL files from digits
12  *   4  | Make ESD from raw ddl files
13  *   5  | Display the data
14  *
15  *  So a mask of 0x3f means do everything, while 0x2 means
16  *  only make digits from hits, and 0x1F is all but display.
17  * 
18  */
19
20 const char* path = "$ALICE_ROOT/FMD/scripts/";
21
22 void
23 RunAndDisplay(const char* script, bool show, const char* display)
24 {
25   gROOT->Macro(Form("%s/%s", path, script));
26   if (show) 
27     gSystem->Exec(Form("aliroot -q -l %s/%s &", path, display));
28 }
29
30 void
31 RunSimpleChain(Int_t what=0x3b)
32 {
33   if (what == 0) { 
34     std::cout << "Usage: RunSimpleChain(MASK)\n\n"
35               << "MASK is a bit mask of things to do:\n\n"
36               << "\tBit | Job\n"
37               << "\t----+-----------------------\n"
38               << "\t 0  | Make fake hits\n"
39               << "\t 1  | Make digits from hits\n"
40               << "\t 2  | Make sdigits from hits\n"
41               << "\t 3  | Make raw DDL files from digits\n"
42               << "\t 4  | Make ESD from raw ddl files\n"
43               << "\t 5  | Display the data\n\n"
44               << "So a mask of 0x3f means do everything, while 0x2 means\n"
45               << "only make digits from hits, and 0x1F is all but display.\n"
46               << "\n" << std::endl;
47     return;
48   }
49   Bool_t display = (what & (1 << 5));
50   
51   if (what & (1 << 0)) { 
52     std::cout << "Making fake hits" << std::endl;
53     RunAndDisplay("MakeFakeHits.C", display, "PatternHits.C");
54   }
55   
56   if (what & (1 << 1)) { 
57     std::cout << "Converting hits to digits" << std::endl;
58     RunAndDisplay("Hits2Digits.C", display, "PatternDigits.C");
59   }
60   
61   if (what & (1 << 2)) { 
62     std::cout << "Converting hits to summable digits" << std::endl;
63     RunAndDisplay("Hits2SDigits.C", display, "PatternSDigits.C");
64   }
65   
66   if (what & (1 << 3)) { 
67     std::cout << "Converting digits to raw data" << std::endl;
68     gSystem->Exec("rm -rf raw0");
69     RunAndDisplay("Digits2Raw.C", false, "");
70
71     std::cout << "Moving ddl files" << std::endl;
72     gSystem->mkdir("raw0");
73     gSystem->Exec("mv FMD_*.ddl raw0/");
74     gSystem->Exec("touch raw0/run0");
75     if (display)
76       gSystem->Exec(Form("aliroot -q %s/PatternRaw.C\\(\\\"\\\"\\) &", path));
77   }
78   
79   if (what & (1 << 4)) {
80     std::cout << "Making ESD from raw data" << std::endl;
81     RunAndDisplay("Raw2ESD.C", display, "PatternESD.C");
82   }
83   
84   std::cout << "All done" << std::endl;
85 }
86
87   
88 //
89 // EOF
90 //