]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/programs/rec-HLTOUT-bin.C
Fixing trigg.class issue
[u/mrichter/AliRoot.git] / HLT / programs / rec-HLTOUT-bin.C
1 // $Id$
2 /*
3  * Process and reconstruct the binary HLTOUT files as written to disk
4  * by the HLTOUT formatter on the online HLT system.
5  *
6  * Usage:
7  * <pre>
8  *   aliroot -b -q rec-HLTOUT-bin.C'("pattern", runno, keepFiles)'
9  *   aliroot -b -q rec-HLTOUT-bin.C'("")' # for help
10  * </pre>
11  *
12  * In the online HLT, output of the HLTOUT formatter can be written to disk.
13  * The resulting binary files contain the full DDL data. The macro
14  * reconstructs the events from a specified sample of binary files.
15  * 
16  * @ingroup alihlt_programs
17  * @author Matthias.Richter@ift.uib.no
18  */
19 void rec_HLTOUT_bin(const char* input="", int runno=0, bool keepFiles=false)
20 {
21   if (!input || input[0]==0) {
22     cerr << "rec-HLTOUT-bin.C: Process and reconstruct binary HLTOUT files" << endl;
23     cerr << "===============================================================" << endl;
24     cerr << "usage: aliroot -b -q -l rec-HLTOUT-bin.C'(\"pattern\" " << endl;
25     cerr << "                                          runNo," << endl;
26     cerr << "                                          keepFiles)'" << endl << endl;
27     cerr << "  Parameter:" << endl;
28     cerr << "       pattern   input file pattern, e.g. \"HLT-Output*.bin\"" << endl;
29     cerr << "       runNo     run no, default 0" << endl;
30     cerr << "       keepFiles keep the intermediate files, default false" << endl;
31     cerr << "===============================================================" << endl;
32     return;
33   }
34
35   if(!gSystem->AccessPathName("galice.root")){
36     cerr << "please delete the galice.root or run at different place." << endl;
37     return;
38   }
39
40   TString inputPattern=input;
41   if (!inputPattern.BeginsWith("/")) {
42     inputPattern=gSystem->pwd();
43     inputPattern+="/";
44     inputPattern+=input;
45   }
46   TString workingDir=gSystem->TempDirectory();
47   TUUID uuid;
48   workingDir+="/"; workingDir+=uuid.AsString(); workingDir+="/";
49   ///////////////////////////////////////////////////////////////////////////////////////////////////
50   //
51   // prepare the input
52   // in order to run the normal AliRoot reconstruction over the data, the files
53   // need to be assembled in a format readable by the AliRawReaderFile
54   // A shell script creates the rawx folders in the temporary working directory
55   // and links one binary input file in each
56   //
57   TString command="c=0; for file in ";
58   command+=inputPattern;
59   command+=" ; do directory=";
60   command+=workingDir;
61   command+="raw$c; mkdir -p $directory; (cd $directory; ln -s $file HLT_7680.ddl; touch run";
62   command+=runno;
63   command+="); let c++; done";
64  
65   if (gSystem->Exec(command)!=0) {
66     cerr << "failed to execute script" << endl << "================================================" << endl;
67     cerr << command << endl;
68     return;
69   }
70   
71   ///////////////////////////////////////////////////////////////////////////////////////////////////
72   //
73   // Init and run the reconstruction
74   // All but HLT reconstructio is switched off
75   //
76   AliReconstruction rec;
77   rec.SetInput(workingDir);
78   rec.SetRunVertexFinder(kFALSE);
79   rec.SetRunReconstruction("HLT");
80   rec.SetLoadAlignFromCDB(0);
81   rec.SetRunQA(":");
82   rec.SetOption("HLT", "loglevel=0x7c");
83   rec.Run();
84
85   if (keepFiles) {
86     cout << "event(s) reconstructed from " << workingDir << endl;
87   } else {
88     command="rm -r ";
89     command+=workingDir;
90     gSystem->Exec(command);
91   }
92 }