11 #ifndef __CONVENIENCE_FUNCTIONS_H__
12 #define __CONVENIENCE_FUNCTIONS_H__
14 #include <QtCore/QFileInfo>
15 #include <QtCore/QDir>
16 #include <QtCore/QString>
28 class DetectorBackend;
45 const std::string& key);
64 const std::string& key);
73 class threshold :
public std::binary_function<float, float, float>
79 return (value > thresh) ? value : 0.0;
182 const std::string newfilename(path.toStdString() + filename.toStdString());
196 if (fInfo.
suffix().isEmpty())
197 return (fname +
"_aa.h5");
200 return newfilename.toStdString();
215 QString newPath(dirs.join(
"/"));
217 const std::string newfilename(newPath.toStdString() + filename.toStdString());
235 if (alphaCounter[1] ==
'z')
237 const char first(alphaCounter[0]);
238 alphaCounter[0] = first + 1;
239 alphaCounter[1] =
'a';
243 const char second(alphaCounter[1]);
244 alphaCounter[1] = second + 1;
248 dirs.append(newSubdir);
249 QString newPath(dirs.join(
"/"));
254 const std::string newfilename(newPath.toStdString() + filename.toStdString());
268 QByteArray counter(filenameparts.last().toLatin1());
269 if (counter[1] ==
'z')
271 const char first(counter[0]);
272 counter[0] = first + 1;
277 const char second(counter[1]);
278 counter[1] = second + 1;
281 QString newfilename(fInfo.
path() +
"/" + filenameparts.join(
"__") +
"." + fInfo.
suffix());
282 return newfilename.toStdString();
300 for(
typename std::list<T>::iterator i1 = l.begin();
303 typename std::list<T>::iterator i2(i1);
305 while(l.end() != (i2 = find(i2, l.end(), *i1)))
317 template <
typename T>
320 return (std::abs(first-second) < std::numeric_limits<T>::epsilon());
328 template <
typename T>
331 return (val < sqrt(std::numeric_limits<T>::epsilon()));
bool fuzzycompare(const T &first, const T &second)
fuzzy compare two floating point variables
float operator()(const float first, const float second)
operator
std::tr1::shared_ptr< self_type > shared_pointer
a shared pointer of this class
Processor::result_t::shared_pointer set2DHist(const Processor::name_t &name)
function to set the 2d histogram properties from the ini file.
static std::string increaseDirCounter(const std::string &fname)
increase the alpha counter
float operator()(float currentValue, float Average_Nm1)
the operator calculates the average over the last _nEvents
std::string loadParticle(CASSSettings &s, const std::string &detector, int ppNbr, const std::string &key)
load particle for a specific detector
float operator()(float value, float thresh) const
operator
append(const QString &str)
fromStdString(const std::string &str)
Binary function for thresholding.
float _nEvents
nEvents for the average calculation
static std::string intializeFile(const std::string &fname)
initialize the filename
bool fuzzyIsNull(const T &val)
fuzzy compare a floating point number to 0
file contains global definitions for project cass
an alphabetical counter extension
weighted_minus(float first_weight, float second_weight)
constructor.
file contains processors baseclass declaration
binary function for averaging.
std::string loadDelayDet(CASSSettings &s, int ppNbr, const std::string &key)
load detector from file
void unique(std::list< T > &l)
Helper function to delete duplicates from a std::list.
static std::string removeAlphaSubdir(const std::string &fname)
remove the alpha counter subdir from filename
fromLatin1(const char *str, int size=-1)
TimeAverage(float nEvents)
constructor.
exists(const QString &name)
Processor::result_t::shared_pointer set1DHist(const Processor::name_t &name)
function to set the 1d histogram properties from the ini file.
static std::string increaseFileCounter(const std::string &fname)
increase the alpha counter in the file name
std::string name_t
define the name type
check if there is some light in the chamber based upon the GMD value
static std::string intializeDir(const std::string &fname)
initialize the directory
mkpath(const QString &dirPath)
binary function for weighted subtraction.