]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/MUON/AliHLTMUONProcessor.cxx
Filling out AliHLTMUONDigitPublisherComponent code to generate dimuon raw data on...
[u/mrichter/AliRoot.git] / HLT / MUON / AliHLTMUONProcessor.cxx
CommitLineData
154cba94 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/// @file AliHLTMUONProcessor.cxx
21/// @author Artur Szostak <artursz@iafrica.com>
dba14d7d 22/// @date 19 May 2008
154cba94 23/// @brief Implementation of the abstract base dHLT processor component.
24///
25/// This component is the abstract base class of dHLT specific components.
26/// It implements some common methods used by all the dHLT components.
27///
28
29#include "AliHLTMUONProcessor.h"
dba14d7d 30#include "AliCDBManager.h"
31#include "AliCDBStorage.h"
32#include "AliMpCDB.h"
33#include "AliMpDDLStore.h"
34#include "AliMpDEStore.h"
154cba94 35
36ClassImp(AliHLTMUONProcessor)
37
dba14d7d 38
39int AliHLTMUONProcessor::FetchMappingStores(
40 const char* cdbPath, Int_t run, bool useDefault
41 ) const
42{
43 /// Fetches the DDL and detector element store objects for MUON mapping.
44 /// \param cdbPath The CDB path to use. If set to NULL and the path has
45 /// not been set in the CDB manager then the default path
46 /// "local://$ALICE_ROOT" is used if the 'useDefault' flag is also true.
47 /// \param run The run number to use. If set to -1 and the run number has
48 /// not been set in the CDB manager then a value of zero is used if
49 /// the 'useDefault' flag is also true.
50 /// \param useDefault If set to true then a default CDB path and run number
51 /// is used if they have not been set and 'cdbPath' == NULL or
52 /// 'run' == NULL.
53 /// \return Zero if the object could be loaded. Otherwise an error code is
54 /// returned, which is compatible with the HLT framework.
55 /// \note AliMpDDLStore::Instance() and AliMpDEStore::Instance() must be used
56 /// to fetch the objects after this method returns a code equal to zero.
57
550ea228 58 Bool_t warn = kFALSE;
59
dba14d7d 60 // Check if the objects are already loaded. If they are then exit early,
61 // otherwise we need to try load the objects.
550ea228 62 if (AliMpDDLStore::Instance(warn) != NULL and AliMpDEStore::Instance(warn) != NULL)
dba14d7d 63 return 0;
64
65 const char* defaultPath = "local://$ALICE_ROOT";
66 Int_t defaultRun = 0;
67
68 AliCDBManager* cdbManager = AliCDBManager::Instance();
69 if (cdbManager == NULL)
70 {
71 HLTError("CDB manager instance does not exist.");
72 return -EIO;
73 }
74
75 // Setup the CDB path.
76 const char* cdbPathUsed = "unknown (not set)";
77 if (cdbPath != NULL)
78 {
79 cdbManager->SetDefaultStorage(cdbPath);
80 cdbPathUsed = cdbPath;
81 }
82 else
83 {
84 AliCDBStorage* store = cdbManager->GetDefaultStorage();
85 if (store == NULL)
86 {
87 if (useDefault)
88 {
89 cdbManager->SetDefaultStorage(defaultPath);
90 cdbPathUsed = defaultPath;
91 }
92 }
93 else
94 {
95 cdbPathUsed = store->GetURI().Data();
96 }
97 }
98
99 // Now setup the run number.
100 if (run != -1)
101 {
102 cdbManager->SetRun(run);
103 }
104 else
105 {
106 if (useDefault) cdbManager->SetRun(defaultRun);
107 }
108 Int_t runUsed = cdbManager->GetRun();
109
110 // Now we can try load the DDL and DE store objects.
dba14d7d 111 if (not AliMpCDB::LoadDDLStore(warn))
112 {
113 HLTError("Failed to load DDL or detector element store specified"
114 " for CDB path '%s' and run no. %d.",
115 cdbPathUsed, runUsed
116 );
117 return -ENOENT;
118 }
119
550ea228 120 if (AliMpDDLStore::Instance(warn) == NULL or AliMpDEStore::Instance(warn) == NULL)
dba14d7d 121 {
122 HLTError("Could not find or load the DDL or detector element store instance.");
123 return -EIO;
124 }
125
126 return 0;
127}
128