]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/macros/CreateTriggerRecoLookupTables.C
4c3e822d9c2bf4687464797edf68602e9bfa4c94
[u/mrichter/AliRoot.git] / HLT / MUON / macros / CreateTriggerRecoLookupTables.C
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project        *
3  * All rights reserved.                                                   *
4  *                                                                        *
5  * Primary Authors:                                                       *
6  *   Artur Szostak <artursz@iafrica.com>                                  *
7  *                                                                        *
8  * Permission to use, copy, modify and distribute this software and its   *
9  * documentation strictly for non-commercial purposes is hereby granted   *
10  * without fee, provided that the above copyright notice appears in all   *
11  * copies and that both the copyright notice and this permission notice   *
12  * appear in the supporting documentation. The authors make no claims     *
13  * about the suitability of this software for any purpose. It is          *
14  * provided "as is" without express or implied warranty.                  *
15  **************************************************************************/
16
17 /* $Id$ */
18
19 /**
20  * \ingroup macros
21  * \file CreateTriggerRecoLookupTables.C
22  * \brief Macro used to generate lookup tables for the trigger reconstructor components.
23  *
24  * This macro is used to generate the lookup tables for the trigger reconstructor
25  * component. All alignment and geometry data is taken from the CDB.
26  *
27  * \note The LUT files must be generated on the same platform / machine on which
28  * they will be used, since they may not be binary compatible across platforms.
29  *
30  * To run this macro copy "rootlogon.C" from $ALICE_ROOT/HLT/MUON/macros
31  * into the current directory, then from the shell command prompt run one of
32  * the following commands:
33  * \code
34  *   > aliroot $ALICE_ROOT/HLT/MUON/macros/CreateTriggerRecoLookupTables.C
35  * \endcode
36  * or
37  * \code
38  *   > aliroot -b -q -l $ALICE_ROOT/HLT/MUON/macros/CreateTriggerRecoLookupTables.C+
39  * \endcode
40  *
41  * \author Artur Szostak <artursz@iafrica.com>
42  */
43
44 #if !defined(__CINT__) || defined(__MAKECINT__)
45 #include "Riostream.h"
46 #include "AliHLTMUONTriggerReconstructorComponent.h"
47 #include "TSystem.h"
48 #endif
49
50 /**
51  * Generates the lookup tables for the AliHLTMUONTriggerReconstructorComponent
52  * components. The tables are generated from the CDB database information.
53  * \param CDBPath  This is the CDB path to use as the DB storage.
54  *                 (Default = local://$ALICE_ROOT)
55  * \param run  This is the run number to use for the CDB (Default = 0).
56  * \param useCrateId  Indicates if the crate ID should be used for the lookup table
57  *            indexing rather than just a sequencial number (Default = true).
58  */
59 void CreateTriggerRecoLookupTables(
60                 const char* CDBPath = "local://$ALICE_ROOT",
61                 Int_t run = 0,
62                 bool useCrateId = true
63         )
64 {
65         gSystem->Load("libAliHLTMUON.so");
66
67         for (Int_t ddl = 20; ddl < 22; ddl++)
68         {
69                 Char_t filename[64];
70                 sprintf(filename, "Lut%d.dat", ddl+1);
71                 cout << "Generating LUT for DDL " << ddl+1
72                         << " and writing output to file " << filename << endl;
73                 bool ok = AliHLTMUONTriggerReconstructorComponent::GenerateLookupTable(
74                                 ddl, filename, CDBPath, run, useCrateId
75                         );
76                 if (! ok) return;
77         }
78         
79         cout << "Lookup tables have been generated successfully." << endl;
80 }