CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Static Public Member Functions
cscdqm::Utility Class Reference

General and CSCDQM Framework related utility routines. More...

#include <CSCDQM_Utility.h>

Static Public Member Functions

static bool checkError (const unsigned int N, const unsigned int n, const double threshold, const double sigfail)
 Check the hypothesis that error events (n) value above threshold comparing with the expected 0 and statistics is enough. More...
 
static short checkOccupancy (const unsigned int N, const unsigned int n, const double low_threshold, const double high_threshold, const double low_sigfail, const double high_sigfail)
 Check the hypothesis that observed events (n) value is too low or too high comparing with the expected N. More...
 
static uint32_t fastHash (const char *data, int len)
 Calculate super fast hash (from http://www.azillionmonkeys.com/qed/hash.html) More...
 
static uint32_t fastHash (const char *data)
 
static int getCSCTypeBin (const std::string &cstr)
 Get CSC y-axis position from chamber string. More...
 
static std::string getCSCTypeLabel (int endcap, int station, int ring)
 Get CSC label from CSC parameters. More...
 
static int getRUIfromDDUId (unsigned ddu_id)
 Get RUI Number from DDU source ID for post LS1 configuration. More...
 
static bool regexMatch (const std::string &expression, const std::string &message)
 Match RegExp expression string against string message and return result. More...
 
static bool regexMatch (const TPRegexp &re_expression, const std::string &message)
 Match RegExp expression against string message and return result. More...
 
static void regexReplace (const std::string &expression, std::string &message, const std::string replace="")
 Replace string part that matches RegExp expression with some string. More...
 
static void regexReplace (const TPRegexp &re_expression, std::string &message, const std::string replace="")
 Replace string part that matches RegExp expression with some string. More...
 
static std::string regexReplaceStr (const std::string &expression, const std::string &message, const std::string replace="")
 Replace string part that matches RegExp expression with some string. More...
 
static std::string regexReplaceStr (const TPRegexp &re_expression, const std::string &message, const std::string replace="")
 Replace string part that matches RegExp expression with some string. More...
 
static double SignificanceLevelHigh (const unsigned int N, const unsigned int n)
 Calculate error significance alpha for the given number of events based on reference number of errors for "hot" elements: actual number of events have to be larger then the reference. More...
 
static double SignificanceLevelLow (const unsigned int N, const unsigned int n, const double eps)
 Calculate error significance alpha for the given number of errors based on reference number of errors for "cold" elements: actual number of events have to be less then the reference. More...
 
static void splitString (const std::string &str, const std::string &delim, std::vector< std::string > &results)
 Split string according to delimiter. More...
 
static int tokenize (const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")
 Break string into tokens. More...
 
static void trimString (std::string &str)
 Trim string. More...
 

Detailed Description

General and CSCDQM Framework related utility routines.

Definition at line 71 of file CSCDQM_Utility.h.

Member Function Documentation

bool cscdqm::Utility::checkError ( const unsigned int  N,
const unsigned int  n,
const double  threshold,
const double  sigfail 
)
static

Check the hypothesis that error events (n) value above threshold comparing with the expected 0 and statistics is enough.

Parameters
NNumber of total events
nActual (observed) number of events errors
thresholdRate of tolerance (<1)
sigfailSignificance threshold for low value
Returns
check result: true - error is significant, false - otherwise

Definition at line 301 of file CSCDQM_Utility.cc.

short cscdqm::Utility::checkOccupancy ( const unsigned int  N,
const unsigned int  n,
const double  low_threshold,
const double  high_threshold,
const double  low_sigfail,
const double  high_sigfail 
)
static

Check the hypothesis that observed events (n) value is too low or too high comparing with the expected N.

Parameters
NExpected number of events
nActual (observed) number of events
low_thresholdRate of lower boundary of tolerance (< 1)
high_thresholdRate of higher boundary of tolerance (> 1)
low_sigfailSignificance threshold for low value
high_sigfailSignificance threshold for high value
Returns
check outcome: 1 - observed number of events too high wrt expected (HOT), -1 - observed number of events too low wrt expected (COLD), 0 - observed number of events is fine wrt expected

Definition at line 278 of file CSCDQM_Utility.cc.

uint32_t cscdqm::Utility::fastHash ( const char *  data,
int  len 
)
static

Calculate super fast hash (from http://www.azillionmonkeys.com/qed/hash.html)

Parameters
dataSource Data
lengthof data
Returns
hash result

Definition at line 221 of file CSCDQM_Utility.cc.

static uint32_t cscdqm::Utility::fastHash ( const char *  data)
inlinestatic

Definition at line 88 of file CSCDQM_Utility.h.

References fastHash().

Referenced by fastHash().

88 { return fastHash(data, strlen(data)); }
static uint32_t fastHash(const char *data, int len)
Calculate super fast hash (from http://www.azillionmonkeys.com/qed/hash.html)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
int cscdqm::Utility::getCSCTypeBin ( const std::string &  cstr)
static

Get CSC y-axis position from chamber string.

Parameters
cstrChamber string
Returns
chamber y-axis position

Definition at line 33 of file CSCDQM_Utility.cc.

std::string cscdqm::Utility::getCSCTypeLabel ( int  endcap,
int  station,
int  ring 
)
static

Get CSC label from CSC parameters.

Parameters
endcapEndcap number
stationStation number
ringRing number
Returns
chamber label

Definition at line 62 of file CSCDQM_Utility.cc.

int cscdqm::Utility::getRUIfromDDUId ( unsigned  ddu_id)
static

Get RUI Number from DDU source ID for post LS1 configuration.

Parameters
ddu_idDDI Source ID

Definition at line 364 of file CSCDQM_Utility.cc.

bool cscdqm::Utility::regexMatch ( const std::string &  expression,
const std::string &  message 
)
static

Match RegExp expression string against string message and return result.

Parameters
expressionRegExp expression in string to match
messagevalue to check
Returns
true if message matches RegExp expression

Definition at line 150 of file CSCDQM_Utility.cc.

Referenced by CSCOfflineClient::bookMonitorObject().

bool cscdqm::Utility::regexMatch ( const TPRegexp &  re_expression,
const std::string &  message 
)
static

Match RegExp expression against string message and return result.

Parameters
re_expressionRegExp expression to match
messagevalue to check
Returns
true if message matches RegExp expression

Definition at line 139 of file CSCDQM_Utility.cc.

void cscdqm::Utility::regexReplace ( const std::string &  expression,
std::string &  message,
const std::string  replace = "" 
)
static

Replace string part that matches RegExp expression with some string.

Parameters
expressionRegExp expression in string to match
messagevalue to check
replacestring to replace matched part

Definition at line 161 of file CSCDQM_Utility.cc.

void cscdqm::Utility::regexReplace ( const TPRegexp &  re_expression,
std::string &  message,
const std::string  replace = "" 
)
static

Replace string part that matches RegExp expression with some string.

Parameters
re_expressionRegExp expression to match
messagevalue to check
replacestring to replace matched part

Definition at line 172 of file CSCDQM_Utility.cc.

std::string cscdqm::Utility::regexReplaceStr ( const std::string &  expression,
const std::string &  message,
const std::string  replace = "" 
)
static

Replace string part that matches RegExp expression with some string.

Parameters
expressionRegExp expression in string to match
messagevalue to check
replacestring to replace matched part
Returns
modified string

Definition at line 187 of file CSCDQM_Utility.cc.

std::string cscdqm::Utility::regexReplaceStr ( const TPRegexp &  re_expression,
const std::string &  message,
const std::string  replace = "" 
)
static

Replace string part that matches RegExp expression with some string.

Parameters
re_expressionRegExp expression to match
messagevalue to check
replacestring to replace matched part
Returns
modified string

Definition at line 199 of file CSCDQM_Utility.cc.

double cscdqm::Utility::SignificanceLevelHigh ( const unsigned int  N,
const unsigned int  n 
)
static

Calculate error significance alpha for the given number of events based on reference number of errors for "hot" elements: actual number of events have to be larger then the reference.

Parameters
Nnumber of reference events
nnumber of actual events
Returns
error significance

no - n observed, ne - n expected

Definition at line 353 of file CSCDQM_Utility.cc.

double cscdqm::Utility::SignificanceLevelLow ( const unsigned int  N,
const unsigned int  n,
const double  eps 
)
static

Calculate error significance alpha for the given number of errors based on reference number of errors for "cold" elements: actual number of events have to be less then the reference.

Parameters
NNumber of events
nNumber of errors
epsRate of tolerance
Returns
Significance level

std::cout << "N = " << N << ", n = " << n << ", eps = " << eps << "\n";

Definition at line 322 of file CSCDQM_Utility.cc.

void cscdqm::Utility::splitString ( const std::string &  str,
const std::string &  delim,
std::vector< std::string > &  results 
)
static

Split string according to delimiter.

Parameters
strString to split
delimDelimiter
resultsVector to write results to
Returns

Definition at line 105 of file CSCDQM_Utility.cc.

int cscdqm::Utility::tokenize ( const std::string &  str,
std::vector< std::string > &  tokens,
const std::string &  delimiters = " " 
)
static

Break string into tokens.

Parameters
strsource string to break
tokenspointer to result vector
delimitersdelimiter string, default " "
Returns

Definition at line 87 of file CSCDQM_Utility.cc.

void cscdqm::Utility::trimString ( std::string &  str)
static

Trim string.

Parameters
strstring to trim

Definition at line 119 of file CSCDQM_Utility.cc.