1 // $Id: AliHLTCaloProcessor.cxx 35966 2009-10-26 12:47:19Z odjuvsla $
3 /**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * All rights reserved. *
7 * Primary Author: Per Thomas Hille <perthi@fys.uio.no> *
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 **************************************************************************/
18 #include "AliHLTCaloProcessor.h"
23 const AliHLTComponentDataType AliHLTCaloProcessor::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array
26 AliHLTCaloProcessor::AliHLTCaloProcessor():AliHLTProcessor(),
30 fPrintInfoFrequncyModule(1000),
33 // ScanRunNumberFromFile();
38 AliHLTCaloProcessor::~AliHLTCaloProcessor()
45 AliHLTCaloProcessor::CheckFileLog(const char *origin, const char *filename, const char *opt)
47 sprintf(fFilepath, "%s/%s", getenv("PWD"), filename);
48 FILE *fp = fopen(filename, opt);
52 // if( (opt == "w") || (opt == "a")) \\OD
53 if( (!strcmp(opt,"w")) || (!strcmp(opt,"a")))
55 sprintf(fMessage, "for writing please check that the directory exists and that you have write access to it" );
59 sprintf(fMessage, "for reading please check that the directory exists and that you have read access to it" );
61 Logging(kHLTLogFatal, origin , "cannot open file" , "Was not able to open file %s %s", fFilepath, fMessage);
66 // if( (opt == "w") || (opt == "a")) \\OD
67 if( (!strcmp(opt,"w")) || (!strcmp(opt,"a")))
69 sprintf(fMessage, "for writing" );
73 sprintf(fMessage, "for reading");
75 // Logging(kHLTLogInfo, origin , "opening file" , "Sucessfully opening %s %s", fFilepath, fMessage);
84 AliHLTCaloProcessor::DoneWritingLog(const char *origin, const char *filename)
86 // char filepath[1024];
87 sprintf(fFilepath, "%s/%s", getenv("PWD"), filename);
88 Logging(kHLTLogInfo, origin , "finnished writing file" , "wrote file %s", fFilepath);
93 AliHLTCaloProcessor::ScanRunNumberFromFile()
95 char tmpDirectory[512];
96 char tmpFileName[512];
97 sprintf(tmpDirectory, "%s", getenv("HOME"));
99 //TODO, remove hardcoded file path
102 sprintf(tmpFileName, "%s%s", tmpDirectory, "/hlt/rundir/runNumber.txt");
104 if(CheckFileLog( __FILE__ , tmpFileName , "r")== true)
106 FILE *fp = fopen(tmpFileName, "r");
107 tmp = fscanf(fp, "%d", &fRunNumber);
117 AliHLTCaloProcessor::IntToChar(int number)
119 sprintf(lineNumber,"%d", number);
126 AliHLTCaloProcessor::ScanArgumentsModule(int argc, const char** argv)
128 fPrintInfoModule = kFALSE;
132 for(int i=0; i<argc && iResult>=0; i++)
136 if (argument.IsNull())
141 if (argument.CompareTo("-printinfo") == 0)
146 fPrintInfoFrequncyModule = atoi(argv[i+1]);
147 fPrintInfoModule = kTRUE;
151 Logging(kHLTLogWarning, __FILE__ , "inconsistency during init" , "asking for event info, but no update frequency is specified, option is ignored");