1 // $Id: AliHLTCALOUtilities.cxx 34264 2009-08-14 18:29:23Z odjuvsla $
3 /**************************************************************************
4 * This file is property of and copyright by the Experimental Nuclear *
5 * Physics Group, Dep. of Physics *
6 * University of Oslo, Norway, 2007 *
8 * Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT Project.*
9 * Contributors are mentioned in the code where appropriate. *
10 * Please report bugs to perthi@fys.uio.no *
12 * Permission to use, copy, modify and distribute this software and its *
13 * documentation strictly for non-commercial purposes is hereby granted *
14 * without fee, provided that the above copyright notice appears in all *
15 * copies and that both the copyright notice and this permission notice *
16 * appear in the supporting documentation. The authors make no claims *
17 * about the suitability of this software for any purpose. It is *
18 * provided "as is" without express or implied warranty. *
19 **************************************************************************/
20 #include "AliHLTCaloUtilities.h"
24 AliHLTCaloUtilities::AliHLTCaloUtilities()
30 AliHLTCaloUtilities::~AliHLTCaloUtilities()
37 AliHLTCaloUtilities::ScanSingleIntArgument(int argc, const char** argv, const char *name, int *value)
39 // cout << "AliHLTCaloUtilities::ScanSingleIntArgument " << name <<" = " << DoExistArgument(argc, argv, name) <<endl;
40 int tmpIndex = DoExistArgument(argc, argv, name);
51 if(tmpIndex +1 < argc)
53 *value = atoi(argv[tmpIndex +1]);
67 AliHLTCaloUtilities::ScanSingleFloatArgument(int argc, const char** argv, const char *name, float *value)
69 // cout << "AliHLTCaloUtilities::ScanSingleFloatArgument " << name <<" = " << DoExistArgument(argc, argv, name) <<endl;
71 int tmpIndex = DoExistArgument(argc, argv, name);
82 if(tmpIndex +1 < argc)
84 *value = atof(argv[tmpIndex +1]);
99 AliHLTCaloUtilities::ScanSingleNameArgument(int argc, const char** argv, const char *name, char *outname)
101 // cout << "AliHLTCaloUtilities::ScanSingleNameArgument " << name <<" = " << DoExistArgument(argc, argv, name) <<endl;
103 int tmpIndex = DoExistArgument(argc, argv, name);
114 if(tmpIndex +1 < argc)
116 // *value = atoi(argv[tmpIndex +1]);
117 sprintf(outname, "%s", argv[tmpIndex +1] );
132 AliHLTCaloUtilities::ScanSingleArgument(int argc, const char** argv, const char *name)
134 // cout << "AliHLTCaloUtilities::ScanSingleArgument " << name <<" = " << DoExistArgument(argc, argv, name) <<endl;
136 if( DoExistArgument(argc, argv, name) >=0)
138 // cout << "AliHLTCaloUtilities::ScanSingleArgument " << name <<" > 0" <<endl;
143 // cout << "AliHLTCaloUtilities::ScanSingleArgument " << name <<" > 0" <<endl;
152 AliHLTCaloUtilities::CheckFile(const char *fileName, const char *opt) const
154 //returns true if the file specified by "fileName exists and has acceees rights specified by "opt",
155 //returns false if it doesnt exist, or it exists, but doesnt have the access right specified by "opt"
156 FILE *fp = fopen(fileName, opt);
170 // returns the index if the argument if it exists
171 // returns a negative value if it doesnt exist
173 AliHLTCaloUtilities::DoExistArgument(const int argc, const char** argv, const char *name) const
177 for(int i= 0; i< argc; i++)
183 // cout << "AliHLTCaloUtilities::DoExistArgumen , argument = " << name << " Exists" <<endl;
188 // cout << "AliHLTCaloUtilities::DoExistArgumen , argument = " << name << " does not exist " <<endl;