+++ /dev/null
-// $Id: AliHLTCaloProcessor.cxx 29824 2008-11-10 13:43:55Z richterm $
-
-/**************************************************************************
- * This file is property of and copyright by the ALICE HLT Project *
- * All rights reserved. *
- * *
- * Primary Author: Per Thomas Hille <perthi@fys.uio.no> *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-#include "AliHLTCaloProcessor.h"
-#include "unistd.h"
-
-
-
-const AliHLTComponentDataType AliHLTCaloProcessor::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array
-
-
-AliHLTCaloProcessor::AliHLTCaloProcessor():AliHLTProcessor(),
- // AliHLTCaloBase(),
- fPhosEventCount(0),
- fModuleID(2),
- fPrintInfoModule(0),
- fPrintInfoFrequncyModule(1000),
- fRunNumber(0)
-{
- // ScanRunNumberFromFile();
-}
-
-
-
-AliHLTCaloProcessor::~AliHLTCaloProcessor()
-{
-
-}
-
-
-bool
-AliHLTCaloProcessor::CheckFileLog(const char *origin, const char *filename, const char *opt)
-{
- sprintf(fFilepath, "%s/%s", getenv("PWD"), filename);
- FILE *fp = fopen(filename, opt);
-
- if(fp == 0)
- {
- // if( (opt == "w") || (opt == "a")) \\OD
- if( (!strcmp(opt,"w")) || (!strcmp(opt,"a")))
- {
- sprintf(fMessage, "for writing please check that the directory exists and that you have write access to it" );
- }
- else
- {
- sprintf(fMessage, "for reading please check that the directory exists and that you have read access to it" );
- }
- Logging(kHLTLogFatal, origin , "cannot open file" , "Was not able to open file %s %s", fFilepath, fMessage);
- return false;
- }
- else
- {
- // if( (opt == "w") || (opt == "a")) \\OD
- if( (!strcmp(opt,"w")) || (!strcmp(opt,"a")))
- {
- sprintf(fMessage, "for writing" );
- }
- else
- {
- sprintf(fMessage, "for reading");
- }
- // Logging(kHLTLogInfo, origin , "opening file" , "Sucessfully opening %s %s", fFilepath, fMessage);
- fclose(fp);
- return true;
- }
-
-}
-
-
-void
-AliHLTCaloProcessor::DoneWritingLog(const char *origin, const char *filename)
-{
- // char filepath[1024];
- sprintf(fFilepath, "%s/%s", getenv("PWD"), filename);
- Logging(kHLTLogInfo, origin , "finnished writing file" , "wrote file %s", fFilepath);
-}
-
-
-void
-AliHLTCaloProcessor::ScanRunNumberFromFile()
-{
- char tmpDirectory[512];
- char tmpFileName[512];
- sprintf(tmpDirectory, "%s", getenv("HOME"));
-
- //TODO, remove hardcoded file path
-
-
- sprintf(tmpFileName, "%s%s", tmpDirectory, "/hlt/rundir/runNumber.txt");
- int tmp = 0;
- if(CheckFileLog( __FILE__ , tmpFileName , "r")== true)
- {
- FILE *fp = fopen(tmpFileName, "r");
- tmp = fscanf(fp, "%d", &fRunNumber);
- fclose(fp);
- }
-
-
-
-
- }
-
-const char*
-AliHLTCaloProcessor::IntToChar(int number)
-{
- sprintf(lineNumber,"%d", number);
- return lineNumber;
-}
-
-
-
-int
-AliHLTCaloProcessor::ScanArgumentsModule(int argc, const char** argv)
-{
- fPrintInfoModule = kFALSE;
- int iResult=0;
- TString argument="";
-
- for(int i=0; i<argc && iResult>=0; i++)
- {
- argument=argv[i];
-
- if (argument.IsNull())
- {
- continue;
- }
-
- if (argument.CompareTo("-printinfo") == 0)
- {
- if(i+1 <= argc)
- {
- argument=argv[i+1];
- fPrintInfoFrequncyModule = atoi(argv[i+1]);
- fPrintInfoModule = kTRUE;
- }
- else
- {
- Logging(kHLTLogWarning, __FILE__ , "inconsistency during init" , "asking for event info, but no update frequency is specified, option is ignored");
- }
- }
-
- }
- return 0;
-}
-
+++ /dev/null
-//-*- Mode: C++ -*-
-// $Id: AliHLTCaloProcessor.h 29824 2008-11-10 13:43:55Z richterm $
-
-#ifndef ALIHLTCALOPROCESSOR_H
-#define ALIHLTCALOPROCESSOR_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-#include "AliHLTProcessor.h"
-//#include "AliHLTCaloBase.h"
-#include "AliHLTCaloDefinitions.h"
-#include "AliHLTDataTypes.h"
-#include "AliHLTCaloConstants.h"
-
-using namespace CaloHLTConst;
-
-class AliHLTCaloProcessor:public AliHLTProcessor //public AliHLTCaloBase
-{
-
- public:
- AliHLTCaloProcessor();
- virtual ~AliHLTCaloProcessor();
- virtual int DoInit(int argc, const char** argv) = 0;
- virtual int Deinit() = 0;
- virtual const char* GetComponentID() = 0;
- virtual void GetInputDataTypes( std::vector <AliHLTComponentDataType>& list) =0;
- virtual AliHLTComponentDataType GetOutputDataType() =0;
- virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier) =0;
- virtual AliHLTComponent* Spawn() = 0;
-
-
- char lineNumber[256];
- const char *IntToChar(int number);
- /*
- *Check file and write messages to AliLog system
- */
- bool CheckFileLog(const char *origin, const char *filename, const char *opt);
- void DoneWritingLog(const char *origin, const char *filename);
-
- using AliHLTProcessor::DoEvent;
-
- protected:
- void ScanRunNumberFromFile();
- virtual int ScanArgumentsModule(int argc, const char** argv);
- int fPhosEventCount; /**<Global event counter for this component*/
- AliHLTUInt8_t fModuleID; /**<ID of the module this component read data from (0-4)*/
-
- Bool_t fPrintInfoModule; /**<wether or not to print debugg info to std out*/
- int fPrintInfoFrequncyModule; /**<Defines the update frequency for information printet to std out*/
-
- static const AliHLTComponentDataType fgkInputDataTypes[]; /**<List of datatypes that can be given to this component*/
- int fRunNumber;
- char fFilepath[1024];
- char fMessage[1024];
-
- private:
- AliHLTCaloProcessor(const AliHLTCaloProcessor & );
- AliHLTCaloProcessor & operator = (const AliHLTCaloProcessor &);
-
-};
-
-
-#endif