]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/util/AliHLTRecoParamComponent.cxx
using safe string operations
[u/mrichter/AliRoot.git] / HLT / BASE / util / AliHLTRecoParamComponent.cxx
1 // $Id$
2
3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project        * 
5 //* ALICE Experiment at CERN, All rights reserved.                         *
6 //*                                                                        *
7 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
8 //*                  for The ALICE HLT Project.                            *
9 //*                                                                        *
10 //* Permission to use, copy, modify and distribute this software and its   *
11 //* documentation strictly for non-commercial purposes is hereby granted   *
12 //* without fee, provided that the above copyright notice appears in all   *
13 //* copies and that both the copyright notice and this permission notice   *
14 //* appear in the supporting documentation. The authors make no claims     *
15 //* about the suitability of this software for any purpose. It is          *
16 //* provided "as is" without express or implied warranty.                  *
17 //**************************************************************************
18
19 /// @file   AliHLTRecoParamComponent.cxx
20 /// @author Matthias Richter
21 /// @date   2010-10-18
22 /// @brief  Online HLT RecoParam generator component
23 ///
24
25 #include <cstring>
26
27 #include "AliHLTRecoParamComponent.h"
28 #include "AliHLTReadoutList.h"
29
30 /** ROOT macro for the implementation of ROOT specific class methods */
31 ClassImp(AliHLTRecoParamComponent)
32
33 AliHLTRecoParamComponent::AliHLTRecoParamComponent()
34   : AliHLTCalibrationProcessor()
35   , fOnlineConfig()
36   , fOutputSize(0)
37 {
38   // see header file for class documentation
39   // or
40   // refer to README to build package
41   // or
42   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
43
44 }
45
46 AliHLTRecoParamComponent::~AliHLTRecoParamComponent()
47 {
48   // see header file for class documentation
49 }
50
51 void AliHLTRecoParamComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
52 {
53   // see header file for class documentation
54   list.push_back(kAliHLTAnyDataType);
55 }
56
57 AliHLTComponentDataType AliHLTRecoParamComponent::GetOutputDataType()
58 {
59   // see header file for class documentation
60   return kAliHLTDataTypeFXSCalib;
61 }
62
63 void AliHLTRecoParamComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
64 {
65   // see header file for class documentation
66   const UInt_t streamerInfoEstSize = 1024; // Estimated size of streamer info
67   // total size: FXSHeader + StreamerInfo + XML configuration
68   constBase = AliHLTCalibrationProcessor::fgkFXSProtocolHeaderSize +
69     streamerInfoEstSize + fOutputSize;
70   inputMultiplier = 0;
71 }
72
73 void AliHLTRecoParamComponent::GetOCDBObjectDescription( TMap* const /*targetArray*/)
74 {
75   // see header file for class documentation
76 }
77
78 int AliHLTRecoParamComponent::InitCalibration()
79 {
80   // see header file for class documentation
81
82   int iResult=0;
83
84   return iResult;
85 }
86
87 int AliHLTRecoParamComponent::DeinitCalibration()
88 {
89   // see header file for class documentation
90
91   int iResult=0;
92
93   return iResult;
94 }
95
96 int AliHLTRecoParamComponent::ProcessCalibration( const AliHLTComponentEventData& /*evtData*/,
97                                                             AliHLTComponentTriggerData& /*trigData*/ )
98 {
99   // see header file for class documentation
100   int iResult=0;
101
102   return iResult;
103 }
104
105 int AliHLTRecoParamComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/,
106                                                        AliHLTComponentTriggerData& /*trigData*/)
107 {
108   // see header file for class documentation
109
110   AliHLTReadoutList rdList(AliHLTReadoutList::kHLT);
111   PushToFXS(&fOnlineConfig, "HLT", "OnlineRecoParam", &rdList);
112   return 0;
113 }
114
115 int AliHLTRecoParamComponent::ScanConfigurationArgument(int argc, const char** argv)
116 {
117   // see header file for class documentation
118   int iResult=0;
119   int result=0;
120   char* configFile;
121   if (argc == 1) {
122     int argLen = strlen(argv[0]);
123     char argument[argLen+1];
124     strncpy(argument, argv[0], argLen+1);
125     argument[argLen] = '\0';
126     if (strstr(argument, "-configfile")) {
127       strtok(argument, "=");
128       configFile = strtok(0, "=");
129       if (configFile)
130         result = fOnlineConfig.LoadConfiguration(configFile);
131       if (result > 0) {
132         fOutputSize = result; // configuration file was successfully read
133         iResult = 1;
134       }
135     }
136   }
137   if (result == 0) {
138     HLTError("Missing argument -configfile");
139     iResult = -EPROTO;
140   }
141   else if (result < 0) {
142     HLTError("Could not read configuration file %s", configFile);
143     iResult = -ENOENT;
144   }
145   return iResult;
146 }