20 TString lasttime =
TString::Format(
"Last updated on: %s", tnow.AsString());
22 TLatex *ltx =
MiscText(0.94,0.9,0.03,lasttime);
24 ltx->SetTextAngle(-90);
30 for(
int db=1;
db<=14;
db++){
31 TPave *box =
new TPave(0.26+0.02*
db,0.945,0.28+0.02*
db,0.975,4,
"BR NDC");
33 box->SetShadowColor(0);
34 box->SetFillStyle(1001);
37 int bit =
pow(2,
db-1);
38 int isgood = ( (dbcfg - dbcfg % bit) / bit ) % 2;
39 if(isgood) box->SetFillColor(
kGreen);
40 else box->SetFillColor(kWhite);
56 gStyle->SetTimeOffset(0);
59 int GMToffset = (t.Convert(
true) - t.Convert());
61 gSystem->Setenv(
"TZ",
"UTC");
63 TString stdP1 =
"run>11495&&par==1";
65 int maxt = t.Convert();
66 int mint = TDatime(20130729,0).Convert();
72 if(ptype==0) dt *= 30;
74 TString tsel =
TString::Format(
"&& lastsec > %d && lastsec < %d",maxt - dt + 2*GMToffset, maxt + 2*GMToffset);
80 TString tlab =
"Date (dd/mm/yy - Central Time)";
81 TString tform =
"%d/%m/%y";
82 TString suf =
"Month";
87 tlab =
"Date (dd/mm - Central Time)";
94 tlab =
"Central Time (hour:min)";
99 TChain *
mytree =
new TChain(
"mytree");
100 mytree->Add(
"MetricsTree_All.root");
104 TCanvas *
c1 =
new TCanvas(
"c1",
"c1",1000,600);
105 c1->SetBottomMargin(0.12);
106 c1->SetLeftMargin(0.12);
107 c1->SetRightMargin(0.07);
108 c1->SetTopMargin(0.07);
117 mytree->SetBranchAddress(
"dbencoded",&dbencoded);
118 mytree->SetBranchAddress(
"dbaencoded",&dbaencoded);
119 mytree->SetBranchAddress(
"lastsec",&lastsec);
120 mytree->SetBranchAddress(
"run",&run);
121 mytree->SetBranchAddress(
"subrun",&subrun);
122 mytree->SetBranchAddress(
"par",&par);
123 mytree->SetBranchAddress(
"pass_all",&pass_all);
124 mytree->SetBranchAddress(
"preliminary",&preliminary);
128 int nentries = mytree->GetEntries();
130 TH2D *
h2 =
new TH2D(
"",
"",dt/10,maxt-dt,maxt,14,1,15);
132 vector<int> dbconfigs;
140 if(par!=1 || lastsec - 2*GMToffset < maxt - dt){
147 dbconfigs.push_back(dbencoded);
149 for(
int db=1;
db<=14;
db++){
150 int bit =
pow(2,
db-1);
151 int isgood = ( (dbencoded - dbencoded % bit) / bit ) % 2;
152 int isactive = ( (dbaencoded - dbaencoded % bit) / bit ) % 2;
154 if(isgood) h2->Fill(lastsec - 2*GMToffset,
db,2);
155 else if(isactive) h2->Fill(lastsec - 2*GMToffset,
db,1);
158 if(isgood) h2->Fill(lastsec - 2*GMToffset,
db,1.75);
159 else if(isactive) h2->Fill(lastsec - 2*GMToffset,
db,1.25);
165 if(dbconfigs.size()==0) dbconfigs.push_back(0);
167 int *
idx =
new int[dbconfigs.size()];
169 TMath::Sort(
int(dbconfigs.size()),&dbconfigs[0],idx,kFALSE);
177 for(
int i=0;
i<
int(dbconfigs.size());
i++){
178 if(tempcfg != dbconfigs[idx[
i]]){
184 tempcfg = dbconfigs[idx[
i]];
198 h2->GetYaxis()->SetNdivisions(14);
201 h2->SetTitle(
";"+tlab+
";Diblock Number;");
202 h2->GetXaxis()->SetTimeDisplay(1);
203 h2->GetXaxis()->SetTimeFormat(tform);
204 h2->GetXaxis()->SetNdivisions(tdiv);
205 h2->SetStats(kFALSE);
206 h2->GetXaxis()->CenterTitle();
207 h2->GetYaxis()->CenterTitle();
208 h2->GetYaxis()->SetLabelSize(0.06);
211 const Int_t
NRGBs = 5;
212 const Int_t
NCont = 255;
213 Double_t
stops[
NRGBs] = { 0.00, 0.25, 0.50, 0.75, 1.00 };
214 Double_t
red[
NRGBs] = { 1.00, 1.00, 1.00, 0.60, 0.00 };
215 Double_t
green[
NRGBs] = { 0.00, 0.70, 1.00, 0.80, 0.80 };
216 Double_t
blue[
NRGBs] = { 0.00, 0.70, 1.00, 0.60, 0.00 };
217 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
218 gStyle->SetNumberContours(NCont);
220 h2->GetZaxis()->SetRangeUser(1,2);
232 if(dbconfigs.size()==1 && dbconfigs[0]==0) maxapp = 0;
234 TString bestcfg =
TString::Format(
"# of Subruns = %d; Percentage = %2.1f%%",
235 maxapp,100.*maxapp/dbconfigs.size());
237 MiscText(0.13,0.95,0.035,
"Most Common = ");
242 c1->SaveAs(
"pngfiles/FarDet-t02-P1GoodDataSelDetConfig"+suf+
".png");
251 for(
int db=1;
db<=14;
db++){
252 int bit =
pow(2,
db-1);
253 int isgood = ( (dbcfg - dbcfg % bit) / bit ) % 2;
254 if(isgood) out +=
"1";
void SetHist(TH1 *hist, int col=1, bool fill=false)
TLatex * MiscText(float x, float y, float size, TString text)
void DrawConfig(int dbcfg)
void PlotDB_Web(int ptype=2)
TString GetConfig(int dbcfg)
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
void UpdateStamp(int ptype, int maxt)