1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
5 * Primary Author: Per Thomas Hille <perthi@fys.uio.no> *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 #include "AliHLTPHOSProcessor.h"
21 const AliHLTComponentDataType AliHLTPHOSProcessor::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array
24 AliHLTPHOSProcessor::AliHLTPHOSProcessor():AliHLTProcessor(),
29 fPrintInfoFrequncyModule(1000),
32 // ScanRunNumberFromFile();
37 AliHLTPHOSProcessor::~AliHLTPHOSProcessor()
44 AliHLTPHOSProcessor::CheckFileLog(const char *origin, const char *filename, const char *opt)
46 sprintf(fFilepath, "%s/%s", getenv("PWD"), filename);
47 FILE *fp = fopen(filename, opt);
51 if( (opt == "w") || (opt == "a"))
53 sprintf(fMessage, "for writing please check that the directory exists and that you have write access to it" );
57 sprintf(fMessage, "for reading please check that the directory exists and that you have read access to it" );
59 Logging(kHLTLogFatal, origin , "cannot open file" , "Was not able to open file %s %s", fFilepath, fMessage);
64 if( (opt == "w") || (opt == "a"))
66 sprintf(fMessage, "for writing" );
70 sprintf(fMessage, "for reading");
72 // Logging(kHLTLogInfo, origin , "opening file" , "Sucessfully opening %s %s", fFilepath, fMessage);
81 AliHLTPHOSProcessor::DoneWritingLog(const char *origin, const char *filename)
83 // char filepath[1024];
84 sprintf(fFilepath, "%s/%s", getenv("PWD"), filename);
85 Logging(kHLTLogInfo, origin , "finnished writing file" , "wrote file %s", fFilepath);
90 AliHLTPHOSProcessor::ScanRunNumberFromFile()
92 char tmpDirectory[512];
93 char tmpFileName[512];
94 sprintf(tmpDirectory, "%s", getenv("HOME"));
96 //TODO, remove hardcoded file path
99 sprintf(tmpFileName, "%s%s", tmpDirectory, "/hlt/rundir/runNumber.txt");
101 if(CheckFileLog( __FILE__ , tmpFileName , "r")== true)
103 FILE *fp = fopen(tmpFileName, "r");
104 fscanf(fp, "%d", &fRunNumber);
114 AliHLTPHOSProcessor::IntToChar(int number)
116 sprintf(lineNumber,"%d", number);
123 AliHLTPHOSProcessor::ScanArgumentsModule(int argc, const char** argv)
125 fPrintInfoModule = kFALSE;
129 for(int i=0; i<argc && iResult>=0; i++)
133 if (argument.IsNull())
138 if (argument.CompareTo("-printinfo") == 0)
143 fPrintInfoFrequncyModule = atoi(argv[i+1]);
144 fPrintInfoModule = kTRUE;
148 Logging(kHLTLogWarning, __FILE__ , "inconsistency during init" , "asking for event info, but no update frequency is specified, option is ignored");