12 using namespace pftools;
13 bool Utils::StringMatch(
const char* str,
const char*
pattern) {
17 if( regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB) != 0 )
20 status = regexec(&re, str, (
size_t)0,
NULL, 0);
30 TCanvas* Utils::DivideCanvas( TCanvas *
cv,
int nPads ) {
33 if( nPads<=1 )
return cv;
34 int sqnP = (
unsigned int) (
sqrt( nPads ));
38 while( nC*nL < nPads )
42 cv->Divide( nC, nL, 0.005, 0.005, 0 );
46 vector<string> Utils::Glob(
const char*
pattern) {
51 glob(pattern, GLOB_TILDE|GLOB_BRACE|GLOB_MARK,
NULL, &globbuf);
54 for(
unsigned i=0;
i<globbuf.gl_pathc;
i++) {
55 results.push_back(globbuf.gl_pathv[
i]);
62 string Utils::Date() {
63 string date(
"date +%d%b%Y_%H%M%S");
64 FILE *
in = popen(date.c_str(),
"r");
66 if(fscanf(in,
"%s",result) != EOF) {
73 TVector3 Utils::VectorEPRtoXYZ(
const TVector3& posepr ) {
74 TVector3 posxyz(1,1,1);
75 posxyz.SetMag( posepr.Z() );
76 double theta = 2*atan(
exp( - posepr.X() ) );
77 posxyz.SetTheta( theta );
78 posxyz.SetPhi( posepr.Y() );
Geom::Theta< T > theta() const