]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/exa/EnableHLTInGRP.C
Update master to aliroot
[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 */
6c9f826d 35bool EnableHLTInGRP(Int_t runNumber,
36 const char* cdbURI = "local://$ALICE_ROOT/OCDB",
37 const char* grpPath = "local://./")
d5dab907 38{
39 AliCDBManager* cdb = AliCDBManager::Instance();
6c9f826d 40 cdb->SetDefaultStorage(cdbURI);
d5dab907 41 cdb->SetSpecificStorage("GRP/GRP/Data", grpPath);
42 cdb->SetRun(runNumber);
43 AliCDBEntry* entry = (AliCDBEntry*)cdb->Get("GRP/GRP/Data")->Clone();
44 if (entry == NULL)
45 {
46 cerr << "ERROR: Could not fetch the GRP entry for run " << runNumber << " and path " << grpPath << endl;
47 return false;
48 }
49 AliGRPObject* grp = (AliGRPObject*)entry->GetObject();
50 if (grp == NULL)
51 {
52 cerr << "ERROR: Could not fetch the GRP object for run " << runNumber << " and path " << grpPath << endl;
53 return false;
54 }
55 grp->SetDetectorMask(grp->GetDetectorMask() | (0x1 << AliDAQ::kHLTId));
56 entry->SetVersion(entry->GetId().GetVersion() + 1);
57 cdb->Put(entry);
58 return true;
59}
60
61/// Just print the usage if no parameters are given.
62void EnableHLTInGRP()
63{
64 cout << "Usage: EnableHLTInGRP.C'(<runNumber> [, <grpPath>])'" << endl;
65 cout << "Where <runNumber> is the number of the run the GRP corresponds to." << endl;
66 cout << "This can be found from the file name of the GRP entry of interest in the CDB." << endl;
67 cout << "<grpPath> is the path to the local GRP/GRP/Data directory where the GRP entry to be modified is stored." << endl;
68 cout << "Setting a value for <grpPath> is optional and is the current working directory by default." << endl;
69}