18 #ifdef CSC_RENDER_PLUGIN 34 if (cstr ==
"ME-4/2")
return 0;
35 if (cstr ==
"ME-4/1")
return 1;
36 if (cstr ==
"ME-3/2")
return 2;
37 if (cstr ==
"ME-3/1")
return 3;
38 if (cstr ==
"ME-2/2")
return 4;
39 if (cstr ==
"ME-2/1")
return 5;
40 if (cstr ==
"ME-1/3")
return 6;
41 if (cstr ==
"ME-1/2")
return 7;
42 if (cstr ==
"ME-1/1")
return 8;
43 if (cstr ==
"ME+1/1")
return 9;
44 if (cstr ==
"ME+1/2")
return 10;
45 if (cstr ==
"ME+1/3")
return 11;
46 if (cstr ==
"ME+2/1")
return 12;
47 if (cstr ==
"ME+2/2")
return 13;
48 if (cstr ==
"ME+3/1")
return 14;
49 if (cstr ==
"ME+3/2")
return 15;
50 if (cstr ==
"ME+4/1")
return 16;
51 if (cstr ==
"ME+4/2")
return 17;
64 std::ostringstream st;
65 if ((endcap > 0) && (station > 0) && (ring > 0)) {
67 st <<
"ME+" << station <<
"/" <<
ring;
69 }
else if (endcap==2) {
70 st <<
"ME-" << station <<
"/" <<
ring;
90 while (std::string::npos != pos || std::string::npos != lastPos) {
91 tokens.push_back(str.substr(lastPos, pos - lastPos));
92 lastPos = str.find_first_not_of(delimiters, pos);
93 pos = str.find_first_of(delimiters, lastPos);
108 while (std::string::npos != pos || std::string::npos != lastPos) {
109 results.push_back(str.substr(lastPos, pos - lastPos));
110 lastPos = str.find_first_not_of(delim, pos);
111 pos = str.find_first_of(delim, lastPos);
121 if(pos != std::string::npos) {
123 pos = str.find_first_not_of(
' ');
124 if(pos != std::string::npos) {
128 str.erase(str.begin(), str.end());
140 TPRegexp *re =
const_cast<TPRegexp*
>(&re_expression);
141 return re->MatchB(message);
151 return regexMatch(TPRegexp(expression), message);
174 TPRegexp *re =
const_cast<TPRegexp*
>(&re_expression);
175 re->Substitute(s, replace);
176 message =
static_cast<const char *
>(
s);
201 TPRegexp *re =
const_cast<TPRegexp*
>(&re_expression);
202 re->Substitute(s, replace);
207 #if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) || defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__) 208 #define get16bits(d) (*((const uint16_t *) (d))) 211 #if !defined (get16bits) 212 #define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8) + (uint32_t)(((const uint8_t *)(d))[0]) ) 225 if (len <= 0 || data ==
nullptr)
return 0;
230 for (;len > 0; len--) {
233 hash = (hash << 16) ^ tmp;
234 data += 2*
sizeof (uint16_t);
242 hash ^= data[
sizeof (uint16_t)] << 18;
249 case 1: hash += *
data;
278 short 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) {
280 double eps_meas = (1.0 *
n) / (1.0 * N);
281 if (eps_meas < low_threshold) {
283 if (S > low_sigfail)
return -1;
285 if (eps_meas > high_threshold) {
287 if (S > high_sigfail)
return 1;
303 const double eps_meas = (1.0 *
n) / (1.0 * N);
304 if (eps_meas > threshold) {
327 if (l_eps <= 0.0) l_eps = 0.000001;
328 if (l_eps >= 1.0) l_eps = 0.999999;
330 double eps_meas = (1.0 *
n) / (1.0 * N);
331 double a = 1.0,
b = 1.0;
334 for (
unsigned int r = 0;
r <
n;
r++) a = a * (eps_meas / l_eps);
338 for (
unsigned int r = 0;
r < (N -
n);
r++)
b =
b * (1 - eps_meas) / (1 - l_eps);
354 if (N > n)
return 0.0;
356 double no = 1.0 *
n,
ne = 1.0 *
N;
357 return sqrt(2.0 * (no * (
log(no / ne) - 1) + ne));
366 const unsigned postLS1_map [] = { 841, 842, 843, 844, 845, 846, 847, 848, 849,
367 831, 832, 833, 834, 835, 836, 837, 838, 839,
368 861, 862, 863, 864, 865, 866, 867, 868, 869,
369 851, 852, 853, 854, 855, 856, 857, 858, 859 };
372 for (
int i = 0;
i < 36;
i++)
374 if (ddu_id == postLS1_map[
i]) { rui = i+1;
return rui;}
static void splitString(const std::string &str, const std::string &delim, std::vector< std::string > &results)
Split string according to delimiter.
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...
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.
static int getRUIfromDDUId(unsigned ddu_id)
Get RUI Number from DDU source ID for post LS1 configuration.
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...
def replace(string, replacements)
static bool regexMatch(const std::string &expression, const std::string &message)
Match RegExp expression string against string message and return result.
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 st...
static uint32_t fastHash(const char *data, int len)
Calculate super fast hash (from http://www.azillionmonkeys.com/qed/hash.html)
static void trimString(std::string &str)
Trim string.
static std::string getCSCTypeLabel(int endcap, int station, int ring)
Get CSC label from CSC parameters.
static int getCSCTypeBin(const std::string &cstr)
Get CSC y-axis position from chamber string.
double S(const TLorentzVector &, const TLorentzVector &)
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 expecte...
std::vector< std::vector< double > > tmp
char data[epos_bytes_allocation]
static void regexReplace(const std::string &expression, std::string &message, const std::string replace="")
Replace string part that matches RegExp expression with some string.
static int tokenize(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")
Break string into tokens.