10 void PixUtil::setPlotStyle() {
11 const Int_t NRGBs = 5;
12 const Int_t NCont = 255;
14 Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
15 Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
16 Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
17 Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
18 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
19 gStyle->SetNumberContours(NCont);
25 if (from.empty())
return;
27 while((start_pos = str.find(from, start_pos)) != string::npos) {
28 str.replace(start_pos, from.length(), to);
29 start_pos += to.length();
34 double PixUtil::dEff(
int in,
int iN) {
35 double n = (double)in;
36 double N = (double)iN;
37 return TMath::Sqrt(((n+1)*(N-n+1))/((N+3)*(N+2)*(N+2)));
41 double PixUtil::dBinomial(
int in,
int iN) {
42 double n = (double)in;
43 double N = (double)iN;
45 if (n == N)
return 0.05;
46 if (n == 0)
return 0.3/TMath::Sqrt(N);
47 return TMath::Sqrt(TMath::Abs(w*(1-w)/N));
52 if (irow < 0 || irow > 79)
return -1;
53 if (icol < 0 || icol > 51)
return -1;
54 return iroc*80*52 + icol*80 + irow;
61 int r = idx - iroc*4160;
68 replaceAll(s,
"\t",
" ");
69 string::size_type s1 = s.find(
"#");
70 if (string::npos != s1) s.erase(s1);
71 if (0 == s.length())
return;
72 string::iterator new_end = unique(s.begin(), s.end(), bothAreSpaces);
73 s.erase(new_end, s.end());
74 if (s.substr(0, 1) == string(
" ")) s.erase(0, 1);
75 if (s.substr(s.length()-1, 1) ==
string(
" ")) s.erase(s.length()-1, 1);
80 return (lhs == rhs) && (lhs ==
' ');
static void replaceAll(std::string &str, const std::string &from, const std::string &to)
in str, replace all occurences of from to to
static int rcr2idx(int iroc, int icol, int irow)
convert ROC/COL/ROW into idx
static bool bothAreSpaces(char lhs, char rhs)
what would you expect?
static void idx2rcr(int idx, int &iroc, int &icol, int &irow)
and back again
static void cleanupString(std::string &)
cleanup a string: remove everything behind #, concatenate multiple spaces into one, translate tabs into spaces