]>
Commit | Line | Data |
---|---|---|
c3173f30 | 1 | // $Id$ |
2 | // | |
3 | // @file run-compression.C | |
4 | // @brief Define and run custom chains for the TPC data compression | |
5 | // @author Matthias.Richter@ift.uib.no | |
6 | // | |
7 | // The macro can be used to either define chains to be run in the | |
8 | // AliRoot reconstruction or to run a chain standalone. Some of the | |
9 | // configurations can only be run embedded into AliRoot reconstruction | |
10 | // in order to couple to the input. | |
11 | // 1) AliRoot reconstruction examples, just use the macro in front of | |
12 | // the reconstruction macro, e.g. | |
bfa2d585 | 13 | // aliroot -b -q -l run-compression.C $ALICE_ROOT/HLT/exa/recraw-local.C'("raw.root", "local://OCDB", 0, 5, "HLT", "loglevel=0x7c chains=compressor-input-writer")' |
c3173f30 | 14 | // |
15 | // 2) standalone chains can be used if all input files are available | |
16 | // on disk and the configuration file for the publisher is existing | |
bfa2d585 | 17 | // aliroot -b -q -l run-compressor.C'(1, 2, 1, "writer", "compressor compressor-publisher", 167808, "local://OCDB")' |
c3173f30 | 18 | // |
19 | // Chains: | |
20 | // 'hltout-cluster-writer' writes clusters for every event in directory | |
21 | // hltout-compressed-cluster and a publisher configuration | |
22 | // file hltout-compressed-cluster.txt | |
23 | // | |
24 | // 'tpc-raw-writer' writes TPC raw DDL files per event in directory tpc-raw | |
25 | // and a publisher configuration file tpc-raw.txt | |
26 | // | |
27 | // 'compressor-input-writer' writes input to compression component (clusters | |
28 | // from HWCF and reconstructed tracks) to directory compressor-input | |
29 | // and publisher configuration file compressor-input.txt | |
30 | // | |
31 | // 'compressor' the compressor component is configured to write a | |
32 | // statistics file HLT.TPCDataCompression-histograms*.root | |
33 | // | |
34 | // 'huffmantrainer' huffman table trainer | |
35 | // | |
36 | // 'writer' cluster monitor component, requires to define input, e.g | |
37 | // "compressor compressor-publisher" | |
38 | // "compressed-cluster-publisher" | |
39 | // "monitor-publisher" | |
40 | // "hltout-publisher" | |
41 | // "TPC-hwcfdata TPC-compression" (note: defined by AliHLTTPCAgent) | |
42 | const int defaultMode=0; | |
43 | const int defaultDeflaterMode=2; | |
44 | const char* defaultMonitorInput="compressor compressor-publisher"; | |
45 | const char* defaultCDBUri="local://OCDB"; | |
46 | void run_compression(int mode=defaultMode, int deflaterMode=defaultDeflaterMode, int events=1, | |
47 | const char* chain=NULL, | |
48 | const char* monitorInput=defaultMonitorInput, | |
49 | int runno=-1, | |
50 | const char* cdbURI=defaultCDBUri) | |
51 | { | |
52 | // setup the OCDB access | |
53 | // required to load the GRP entry in order to initialize the magnetic field | |
54 | if (runno>=0) { | |
55 | AliCDBManager::Instance()->SetDefaultStorage(cdbURI); | |
56 | AliCDBManager::Instance()->SetRun(runno); | |
57 | AliGRPManager grpman; | |
58 | grpman.ReadGRPEntry(); | |
59 | grpman.SetMagField(); | |
60 | } | |
61 | ||
62 | // init the HLT system | |
63 | AliHLTSystem* pHLT=AliHLTPluginBase::GetInstance(); | |
64 | ||
65 | /////////////////////////////////////////////////////////////////////////////////////////// | |
66 | // | |
67 | // list of configurations | |
68 | // | |
69 | /////////////////////////////////////////////////////////////////////////////////////////// | |
70 | ||
71 | // handling of compressed clusters from HLTOUT | |
72 | // 'hltout-cluster-writer' writes clusters for every event in directory hltout-compressed-cluster | |
73 | // and a publisher configuration file hltout-compressed-cluster.txt | |
74 | // 'compressed-cluster-publisher' publishes according to list hltout-compressed-cluster.txt | |
75 | AliHLTConfiguration hltoutpublisher("hltout-publisher", "AliHLTOUTPublisher", "", "-datatype 'REMCLSCM' 'TPC '"); | |
76 | AliHLTConfiguration hltoutclusterwriter("hltout-cluster-writer", "FileWriter", "hltout-publisher", "-directory hltout-compressed-cluster -subdir -specfmt=_0x%08x -blocknofmt= -publisher-conf hltout-compressed-cluster.txt"); | |
77 | AliHLTConfiguration hltoutclusterpublisher("compressed-cluster-publisher", "FilePublisher", "", "-datafilelist hltout-compressed-cluster.txt"); | |
78 | ||
79 | // processing of TPC raw data | |
80 | // 'tpc-raw-writer' writes TPC raw DDL files per event in directory tpc-raw and a publisher | |
81 | // configuration file tpc-raw.txt | |
82 | // 'compressor-input-writer' writes input to compression component (clusters from HWCF and reconstructed tracks) | |
83 | // to directory compressor-input and publisher configuration file compressor-input.txt | |
84 | // 'compressor-publisher' publishes files according to configuration file | |
85 | AliHLTConfiguration tpcrawwriter("tpc-raw-writer", "FileWriter","TPC-raw-data", "-directory tpc-raw -subdir -specfmt=_0x%08x -blocknofmt= -publisher-conf tpc-raw.txt"); | |
86 | AliHLTConfiguration emulatorhwclust1writer("compressor-input-writer", "FileWriter","TPC-hwcfdata TPC-globalmerger", "-directory compressor-input -subdir -specfmt=_0x%08x -blocknofmt= -publisher-conf compressor-input.txt"); | |
87 | AliHLTConfiguration compressorpublisher("compressor-publisher", "FilePublisher", "", "-datafilelist compressor-input.txt"); | |
88 | ||
89 | // compressor configuration | |
90 | // input from file list created by 'compressor-input-writer' | |
91 | TString compressorArgument; | |
92 | if (mode>0) compressorArgument+=Form(" -mode %d", mode); // take default from configuration object if mode==0 | |
93 | if (deflaterMode>0) compressorArgument+=Form(" -deflater-mode %d", deflaterMode); // take default from configuration object if deflaterMode==0 | |
94 | compressorArgument+=Form(" -histogram-file HLT.TPCDataCompression-histograms-mode%d-%s.root -cluster-verification 0", mode, (deflaterMode==2?"huffman":"simple")); | |
95 | AliHLTConfiguration compressor("compressor", "TPCDataCompressor", "compressor-publisher", compressorArgument.Data()); | |
96 | ||
97 | // huffman trainer configuration | |
98 | // input from file list created by 'compressor-input-writer' | |
99 | TString trainerArgument; | |
100 | trainerArgument.Form("-deflater-mode 3 -mode %d", mode); | |
101 | AliHLTConfiguration trainer("huffmantrainer", "TPCDataCompressor", "compressor-publisher", trainerArgument.Data()); | |
102 | ||
103 | // writer component for the compressor output | |
104 | AliHLTConfiguration compressoroutputwriter("compressor-output-writer", "FileWriter","compressor", "-directory compressor-output -subdir -specfmt=_0x%08x -blocknofmt= -publisher-conf compressor-output.txt"); | |
105 | AliHLTConfiguration compressoroutputpublisher("compressor-data", "FilePublisher","", "-datafilelist compressor-output.txt"); | |
106 | ||
107 | // specifc configuration to publish some data blocks for the | |
108 | // monitoring component | |
109 | AliHLTConfiguration monitorpublisher("monitor-publisher", "FilePublisher", "", "-datafilelist monitor-input.txt"); | |
110 | ||
111 | // the monitoring ccomponent setup | |
112 | TString writerArguments(Form("-concatenate-events -overwrite -datafile HLT.TPCcluster-compression-mode%d-histograms.root",mode)); | |
113 | AliHLTConfiguration monitor("monitor", "TPCDataCompressorMonitor", monitorInput, ""); | |
114 | AliHLTConfiguration writer("writer", "ROOTFileWriter", "monitor", writerArguments); | |
115 | ||
116 | if (chain) { | |
117 | pHLT->ScanOptions("loglevel=0x7c"); | |
118 | pHLT->BuildTaskList(chain); | |
119 | pHLT->Run(events); | |
120 | } | |
121 | } | |
122 | ||
123 | // an abbreviated version setting default deflaterMode to 2 | |
124 | void run_compression(int mode, int events, | |
125 | const char* chain, | |
126 | const char* monitorInput=defaultMonitorInput, | |
127 | int runno=-1, | |
128 | const char* cdbURI=defaultCDBUri) | |
129 | { | |
130 | run_compression(mode, defaultDeflaterMode, events, chain, monitorInput, runno, cdbURI); | |
131 | } | |
132 | ||
133 | // an abbreviated version setting default deflaterMode to 2 and | |
134 | // omitting monitorInput | |
135 | // example: | |
bfa2d585 | 136 | // aliroot -b -q -l run-compression.C'(1, 5, "compressor", "", 167808)' |
c3173f30 | 137 | void run_compression(int mode, int events, |
138 | const char* chain, | |
139 | int runno, | |
140 | const char* cdbURI=defaultCDBUri) | |
141 | { | |
142 | run_compression(mode, defaultDeflaterMode, events, chain, defaultMonitorInput, runno, cdbURI); | |
143 | } |