]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/exa/sampleCalibrationProcessor.C
New class FEMTOSCOPY/AliFemtoUser/AliFemtoPairCutRadialDistance.cxx
[u/mrichter/AliRoot.git] / HLT / exa / sampleCalibrationProcessor.C
CommitLineData
8ef16e6a 1// $Id$
2/**
3 * @file sampleCalibrationProcessor.C
4 * @brief Run the SampleCalibration component (AliHLTSampleCalibrationComponent)
5 *
6 * <pre>
7 * Usage: aliroot -b -q -l \
8 * sampleCalibrationProcessor.C'("file", "cdb", minEvent, maxEvent)'
9 *
10 * Examples:
11 * sampleCalibrationProcessor.C'("alien:///alice/data/2009/.../....root")'
12 * sampleCalibrationProcessor.C'("raw.root", "local://$PWD", minEvent, MaxEvent)'
13 *
14 * Defaults
15 * cdb="local://$ALICE_ROOT/OCDB" -> take local OCDB
16 * minEvent=-1 -> no lower event selection
17 * maxEvent=-1 -> no upper event selection
18 *
19 * </pre>
20 *
21 * An HLT chain is set up with one publisher for raw data which the calibration
22 * component subscribes to. The output of the component is directed to a
23 * ROOTFileWriter producing the file 'calibdata.root'. Another FileWriter
24 * writes the data block designated for storage in the FXS.
25 * The HLT chain is run in the context of AliReconstruction.
26 *
27 * The input file can be a file on the grid, indicated by the tag
28 * 'alien://'.
29 * If either the file or the OCDB is taken from the GRID, the macros
30 * connects to the Grid in the beginning.
31 * Note: You need a valid GRID token, use 'alien-token-init' of your
32 * alien installation.
33 *
34 * This example uses the local OCDB as default, but other locations can
35 * be specified, like e.g. "raw://".
36 *
37 * @author Matthias.Richter@ift.uib.no
38 * @ingroup alihlt_tutorial
39 */
40void sampleCalibrationProcessor(const char *filename,
41 const char *cdbURI,
42 int minEvent=-1,
43 int maxEvent=-1)
44{
45 // connect to the GRID if we use a file or OCDB from the GRID
46 TString struri=cdbURI;
47 TString strfile=filename;
48 if (struri.BeginsWith("raw://") ||
49 strfile.Contains("://") && !strfile.Contains("local://")) {
50 TGrid::Connect("alien");
51 }
52
53 // Set the CDB storage location
54 AliCDBManager * man = AliCDBManager::Instance();
55 man->SetDefaultStorage(cdbURI);
2758f601 56 if (struri.BeginsWith("local://")) {
57 // set specific storage for GRP entry
58 // search in the working directory and one level above, the latter
59 // follows the standard simulation setup like e.g. in test/ppbench
60 if (!gSystem->AccessPathName("GRP/GRP/Data")) {
61 man->SetSpecificStorage("GRP/GRP/Data", "local://$PWD");
62 } else if (!gSystem->AccessPathName("../GRP/GRP/Data")) {
63 man->SetSpecificStorage("GRP/GRP/Data", "local://$PWD/..");
64 } else {
65 cerr << "can not find a GRP entry, please run the macro in the folder" << endl;
66 cerr << "of a simulated data sample, or specify a GRID OCDB" << endl;
67 sampleRawAnalysis();
68 return;
69 }
8ef16e6a 70 }
71
72 // Reconstruction settings
73 AliReconstruction rec;
74
75 if (minEvent>=0 || maxEvent>minEvent) {
76 if (minEvent<0) minEvent=0;
77 if (maxEvent<minEvent) maxEvent=minEvent;
78 rec.SetEventRange(minEvent,maxEvent);
79 }
80
81 rec.SetRunReconstruction("HLT");
82
83 // QA options
84 rec.SetRunQA(":") ;
85
86 // AliReconstruction settings
87 rec.SetWriteESDfriend(kFALSE);
88 rec.SetInput(filename);
89
90 rec.SetRunPlaneEff(kFALSE);
91 rec.SetRunVertexFinder(kFALSE);
2758f601 92 rec.SetRunMultFinder(kFALSE);
8ef16e6a 93
94 // switch off cleanESD
95 rec.SetCleanESD(kFALSE);
96
97 // setup the HLT chain
98 AliHLTSystem* pHLT=AliHLTPluginBase::GetInstance();
99
100 // publisher for raw data
101 AliHLTConfiguration rawpub("rawpub", "AliRawReaderPublisher", "", "-minid 768 -maxid 983 -datatype 'DDL_RAW ' SMPL");
102
103 // the configuration of the calibration component
104 // send the produced object not more than once every 2 sec
105 AliHLTConfiguration smplcalib("smplcalib", "SampleCalibration", "rawpub", "-pushback-period=2");
106
107 // writer for data objects produced by the calibration component during
108 // ProcessCalibration,
109 AliHLTConfiguration eventwriter("eventwriter", "ROOTFileWriter", "smplcalib", "-datafile calibdata.root -concatenate-events -overwrite -write-all-events");
110
111 // filter the output of the smplcalib component and forward only the blocks
112 // of type 'FXS_CAL ' designated for storage by the FXSSubscriber
113 AliHLTConfiguration fxsfilter("fxsfilter", "BlockFilter", "smplcalib", "-typeid 'FXS_CAL ' ");
114 // write the block, a file like 'EOR_*HLT:FXS_CAL' will be written containing the
115 // binary data block of the FXS header and the streamed object
116 AliHLTConfiguration fxswriter("fxswriter", "FileWriter", "fxsfilter", "-write-all-events");
117
118 rec.SetOption("HLT", "loglevel=0x7c ignore-hltout libAliHLTUtil.so libAliHLTSample.so chains=fxswriter,eventwriter");
119
120 AliLog::Flush();
121 rec.Run();
122
123}
124
125void sampleCalibrationProcessor(const char *filename,
126 int minEvent=-1,
127 int maxEvent=-1)
128{
129 sampleCalibrationProcessor(filename, "local://$ALICE_ROOT/OCDB", minEvent, maxEvent);
130}
131
132void sampleCalibrationProcessor()
133{
134 cout << "sampleCalibrationProcessor: Run AliRoot reconstruction locally" << endl;
135 cout << " Usage: aliroot -b -q -l \\" << endl;
136 cout << " sampleCalibrationProcessor.C'(\"file\", \"cdb\", minEvent, maxEvent)'" << endl;
137 cout << "" << endl;
138 cout << " Examples:" << endl;
139 cout << " sampleCalibrationProcessor.C'(\"alien:///alice/data/2009/.../....root\")' " << endl;
140 cout << " sampleCalibrationProcessor.C'(\"raw.root\", \"local://$PWD\", minEvent, MaxEvent)'" << endl;
141 cout << "" << endl;
142 cout << " Defaults" << endl;
143 cout << " cdb=\"local://$ALICE_ROOT/OCDB\" -> take local OCDB " << endl;
144 cout << " minEvent=-1 -> no lower event selection" << endl;
145 cout << " maxEvent=-1 -> no upper event selection" << endl;
146}