SourceXtractorPlusPlus  0.10
Please provide a description of the project.
SE2BackgroundUtils.h
Go to the documentation of this file.
1 
17 /*
18  * Created on Jan 05, 2015
19  * @author: mkuemmel@usm.lmu.de
20  * Date: $Date$
21  * Revision: $Revision$
22  * Author: $Author$
23  */
24 #ifndef SE2BACKGROUNDUTILS_H
25 #define SE2BACKGROUNDUTILS_H
26 
27 #include <sstream>
28 #include "ElementsKernel/Logging.h" // for Logging::LogMessageStream, etc
30 
31 namespace SourceXtractor {
32 
34 
36 
37  public:
38  //SE2BackgroundUtils(){};
39  static int fqCmp(const void *p1, const void *p2) {
40  PIXTYPE f1=*((float *)p1);
41  PIXTYPE f2=*((float *)p2);
42  return f1>f2? 1 : (f1<f2? -1 : 0);
43  };
44 
45  static PIXTYPE fqMedian(PIXTYPE *ra, size_t n){
46  qsort(ra, n, sizeof(PIXTYPE), fqCmp);
47  if (n<2)
48  return *ra;
49  else
50  return n&1? ra[n/2] : (ra[n/2-1]+ra[n/2])/2.0;
51  };
52  //static void weightToVar(PIXTYPE *data, const size_t npix, const int wTypeFlag, const PIXTYPE sigFac=1.0);
53  //static void generalLogger(std::string logString);
54  //static void throwElementsException(std::string exceptionString);
55 };
56 
57 // general conversion from primitive types to string;
58 // mainly to avoid the C++11 featire "std::to_string()"
59 //template <typename T> std::string tostr(const T& t) {
60 // std::ostringstream os;
61 // os<<t;
62 // return os.str();
63 //}
64 } // end of namespace SourceXtractor
65 #endif // SE2BACKGROUNDUTILS_H
66 
static int fqCmp(const void *p1, const void *p2)
static Elements::Logging bck_model_logger
static PIXTYPE fqMedian(PIXTYPE *ra, size_t n)
T qsort(T... args)
static Logging getLogger(const std::string &name="")