#include <RecoParticleFlow/PFClusterTools/interface/Utils.h>
Static Public Member Functions | |
static std::string | Date () |
returns the date | |
static TCanvas * | DivideCanvas (TCanvas *cv, int nPads) |
divide a TCanvas in a nice way | |
static std::vector< std::string > | Glob (const char *pattern) |
get all files matching pattern | |
static bool | StringMatch (const char *string, const char *pattern) |
match a string to a regexp | |
static TVector3 | VectorEPRtoXYZ (const TVector3 &posepr) |
converts a vector (in eta,phi,R) to a vector in (x,y,z) |
Definition at line 16 of file Utils.h.
string Utils::Date | ( | ) | [static] |
returns the date
Definition at line 62 of file Utils.cc.
References in, and HLT_VtxMuL3::result.
00062 { 00063 string date("date +%d%b%Y_%H%M%S"); 00064 FILE *in = popen(date.c_str(), "r"); 00065 char result[100]; 00066 if(fscanf(in,"%s",result) != EOF) { 00067 return string(result); 00068 } 00069 else return string(""); 00070 }
TCanvas * Utils::DivideCanvas | ( | TCanvas * | cv, | |
int | nPads | |||
) | [static] |
divide a TCanvas in a nice way
Definition at line 30 of file Utils.cc.
References int, and funct::sqrt().
00030 { 00031 if( !cv ) return 0; 00032 00033 if( nPads<=1 ) return cv; 00034 int sqnP = (unsigned int) (sqrt( nPads )); 00035 int nC = sqnP; 00036 int nL = sqnP; 00037 00038 while( nC*nL < nPads ) 00039 if( nC < nL ) nC++; 00040 else nL++; 00041 00042 cv->Divide( nC, nL, 0.005, 0.005, 0 ); 00043 return cv; 00044 }
vector< string > Utils::Glob | ( | const char * | pattern | ) | [static] |
get all files matching pattern
Definition at line 46 of file Utils.cc.
References i, NULL, and bookConverter::results.
00046 { 00047 00048 glob_t globbuf; 00049 00050 globbuf.gl_offs = 2; 00051 glob(pattern, GLOB_TILDE|GLOB_BRACE|GLOB_MARK, NULL, &globbuf); 00052 00053 vector<string> results; 00054 for(unsigned i=0; i<globbuf.gl_pathc; i++) { 00055 results.push_back(globbuf.gl_pathv[i]); 00056 } 00057 00058 globfree(&globbuf); 00059 return results; 00060 }
bool Utils::StringMatch | ( | const char * | string, | |
const char * | pattern | |||
) | [static] |
match a string to a regexp
Definition at line 13 of file Utils.cc.
References NULL, and StDecayID::status.
00013 { 00014 int status; 00015 regex_t re; 00016 00017 if( regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB) != 0 ) 00018 return false; 00019 00020 status = regexec(&re, str, (size_t)0, NULL, 0); 00021 regfree(&re); 00022 00023 if (status != 0) 00024 return false; 00025 00026 return true; 00027 }
TVector3 Utils::VectorEPRtoXYZ | ( | const TVector3 & | posepr | ) | [static] |
converts a vector (in eta,phi,R) to a vector in (x,y,z)
Definition at line 73 of file Utils.cc.
References funct::exp(), theta, and muonGeometry::TVector3().
00073 { 00074 TVector3 posxyz(1,1,1); // to be called before a SetMag 00075 posxyz.SetMag( posepr.Z() ); 00076 double theta = 2*atan( exp( - posepr.X() ) ); 00077 posxyz.SetTheta( theta ); 00078 posxyz.SetPhi( posepr.Y() ); 00079 00080 return posxyz; 00081 }