]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/CALO/AliHLTCaloProcessor.cxx
- fixing coverity
[u/mrichter/AliRoot.git] / HLT / CALO / AliHLTCaloProcessor.cxx
CommitLineData
c375e15d 1// $Id: AliHLTCaloProcessor.cxx 35966 2009-10-26 12:47:19Z odjuvsla $
2
3/**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * All rights reserved. *
6 * *
7 * Primary Author: Per Thomas Hille <perthi@fys.uio.no> *
8 * *
9 * Permission to use, copy, modify and distribute this software and its *
10 * documentation strictly for non-commercial purposes is hereby granted *
11 * without fee, provided that the above copyright notice appears in all *
12 * copies and that both the copyright notice and this permission notice *
13 * appear in the supporting documentation. The authors make no claims *
14 * about the suitability of this software for any purpose. It is *
15 * provided "as is" without express or implied warranty. *
16 **************************************************************************/
17
18#include "AliHLTCaloProcessor.h"
19#include "unistd.h"
20
21
22
23const AliHLTComponentDataType AliHLTCaloProcessor::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array
24
25
26AliHLTCaloProcessor::AliHLTCaloProcessor():AliHLTProcessor(),
27 fCaloEventCount(0),
28 fModuleID(2),
29 fPrintInfoModule(0),
30 fPrintInfoFrequncyModule(1000),
31 fRunNumber(0)
32{
33 // ScanRunNumberFromFile();
34}
35
36
37
38AliHLTCaloProcessor::~AliHLTCaloProcessor()
39{
40
41}
42
43
44bool
45AliHLTCaloProcessor::CheckFileLog(const char *origin, const char *filename, const char *opt)
46{
47 sprintf(fFilepath, "%s/%s", getenv("PWD"), filename);
48 FILE *fp = fopen(filename, opt);
49
50 if(fp == 0)
51 {
52 // if( (opt == "w") || (opt == "a")) \\OD
53 if( (!strcmp(opt,"w")) || (!strcmp(opt,"a")))
54 {
55 sprintf(fMessage, "for writing please check that the directory exists and that you have write access to it" );
56 }
57 else
58 {
59 sprintf(fMessage, "for reading please check that the directory exists and that you have read access to it" );
60 }
61 Logging(kHLTLogFatal, origin , "cannot open file" , "Was not able to open file %s %s", fFilepath, fMessage);
62 return false;
63 }
64 else
65 {
66 // if( (opt == "w") || (opt == "a")) \\OD
67 if( (!strcmp(opt,"w")) || (!strcmp(opt,"a")))
68 {
69 sprintf(fMessage, "for writing" );
70 }
71 else
72 {
73 sprintf(fMessage, "for reading");
74 }
75 // Logging(kHLTLogInfo, origin , "opening file" , "Sucessfully opening %s %s", fFilepath, fMessage);
76 fclose(fp);
77 return true;
78 }
79
80}
81
82
83void
e4d93924 84AliHLTCaloProcessor::DoneWritingLog(const char */*origin*/, const char * /*filename*/)
c375e15d 85{
86 // char filepath[1024];
e4d93924 87 // sprintf(fFilepath, "%s/%s", getenv("PWD"), filename);
88 // Logging(kHLTLogInfo, origin , "finnished writing file" , "wrote file %s", fFilepath);
89
90 // Logging(kHLTLogInfo, igin , "Don't use this function" , "Don't use this function", fFilepath);
91
c375e15d 92}
93
94
95void
96AliHLTCaloProcessor::ScanRunNumberFromFile()
97{
e4d93924 98 printf("AliHLTCaloProcessor::ScanRunNumberFromFile: don't use this function");
99}
c375e15d 100
101const char*
102AliHLTCaloProcessor::IntToChar(int number)
103{
104 sprintf(lineNumber,"%d", number);
105 return lineNumber;
106}
107
108
109
110int
111AliHLTCaloProcessor::ScanArgumentsModule(int argc, const char** argv)
112{
113 fPrintInfoModule = kFALSE;
114 int iResult=0;
115 TString argument="";
116
117 for(int i=0; i<argc && iResult>=0; i++)
118 {
119 argument=argv[i];
120
121 if (argument.IsNull())
122 {
123 continue;
124 }
125
126 if (argument.CompareTo("-printinfo") == 0)
127 {
128 if(i+1 <= argc)
129 {
130 argument=argv[i+1];
131 fPrintInfoFrequncyModule = atoi(argv[i+1]);
132 fPrintInfoModule = kTRUE;
133 }
134 else
135 {
136 Logging(kHLTLogWarning, __FILE__ , "inconsistency during init" , "asking for event info, but no update frequency is specified, option is ignored");
137 }
138 }
139
140 }
141 return 0;
142}
143