]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/exa/EnableHLTInGRP.C
removing r43353: temporary workaround for loading of additional library dependencies
[u/mrichter/AliRoot.git] / HLT / exa / EnableHLTInGRP.C
CommitLineData
81e66135 1// $Id$
d5dab907 2
3#if !defined(__CINT__) || defined(__MAKECINT__)
4#include "Riostream.h"
5#include "AliCDBManager.h"
6#include "AliCDBEntry.h"
7#include "AliGRPObject.h"
8#include "AliDAQ.h"
9#endif
10
11/**
12 * @file EnableHLTInGRP.C
13 * @author Artur Szostak <artursz@iafrica.com>
14 * @ingroup alihlt_tutorial
15 * @brief Patches GRP to process recorded data with HT in mode A.
16 *
17 * Usage:
18 * <pre>
19 * aliroot -b -q 'EnableHLTInGRP.C(\<runNumber\>,\<grpPath\>)'
20 * </pre>
21 * Where \<runNumber\> is the number of the run the GRP corresponds to. This
22 * can be found from the file name of the GRP entry of interest in the CDB.
23 * \<grpPath\> is the path to the local GRP/GRP/Data directory where the GRP
24 * entry to be modified is stored. Setting a value for \<grpPath\> is optional
25 * and is the current working directory by default.
26 *
27 * Data recorded in mode A will not have the HT bit set in the GRP's active
28 * detector mask. Trying to process such data with the HT framework will fail.
29 * To be able to process such runs the GRP must be downloaded and patched with
30 * this macro. It will set the HT bit in the GRP and write a new version of
31 * the GRP with and incremented version number.
32 *
33 * @return true if the macro completed successfully and false otherwise.
34 */
35bool EnableHLTInGRP(Int_t runNumber, const char* grpPath = "local://./")
36{
37 AliCDBManager* cdb = AliCDBManager::Instance();
38 cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
39 cdb->SetSpecificStorage("GRP/GRP/Data", grpPath);
40 cdb->SetRun(runNumber);
41 AliCDBEntry* entry = (AliCDBEntry*)cdb->Get("GRP/GRP/Data")->Clone();
42 if (entry == NULL)
43 {
44 cerr << "ERROR: Could not fetch the GRP entry for run " << runNumber << " and path " << grpPath << endl;
45 return false;
46 }
47 AliGRPObject* grp = (AliGRPObject*)entry->GetObject();
48 if (grp == NULL)
49 {
50 cerr << "ERROR: Could not fetch the GRP object for run " << runNumber << " and path " << grpPath << endl;
51 return false;
52 }
53 grp->SetDetectorMask(grp->GetDetectorMask() | (0x1 << AliDAQ::kHLTId));
54 entry->SetVersion(entry->GetId().GetVersion() + 1);
55 cdb->Put(entry);
56 return true;
57}
58
59/// Just print the usage if no parameters are given.
60void EnableHLTInGRP()
61{
62 cout << "Usage: EnableHLTInGRP.C'(<runNumber> [, <grpPath>])'" << endl;
63 cout << "Where <runNumber> is the number of the run the GRP corresponds to." << endl;
64 cout << "This can be found from the file name of the GRP entry of interest in the CDB." << endl;
65 cout << "<grpPath> is the path to the local GRP/GRP/Data directory where the GRP entry to be modified is stored." << endl;
66 cout << "Setting a value for <grpPath> is optional and is the current working directory by default." << endl;
67}