{ //------------------------------------------ // change to cm3 // many changes to run over entire modules at once // 2012.12.19 changed a lot, adding temperature , only one 1st module //------------------------------------------ #include gROOT->LoadMacro("AtlasUtils.C"); ATLAS->SetPadTickY(0); ATLAS->SetPadTickX(0); ATLAS->SetPadRightMargin(0.02); ATLAS->SetPadLeftMargin(0.10); ATLAS->SetPadTopMargin(0.08); ATLAS->SetPadBottomMargin(0.10); gStyle->SetOptStat(0); char cid[90]; c1 = new TCanvas("c1","A Simple Graph",200,100,2100,1500); //----set start and end days , yminPlot and ymaxPlot for plot ---------- // Define the time offset as 2003, January 1st TDatime T0(2003,01,01,00,00,00); int X0 = T0.Convert(); gStyle->SetTimeOffset(X0); //================================================== double ymin=0., ymax = 190.; int YEAR=2014, MONTH=11,DAY1=17,DAY2=20; TDatime db(YEAR,MONTH,DAY1,00,00,00); int t1 = db.Convert()-X0; TDatime db(YEAR,MONTH,DAY2,00,00,00); int t2 = db.Convert()-X0; int currentFactor = 1; //------------------read-in date and integrated luminosity---------- int phibegin=0, ED=1, ETA=-6, LAYER=3 ; int ed0[6], layer0[6], eta0[6], phi0[6]; for (int i=0; i<6; i++) { ed0[i] = ED; layer0[i] = LAYER; eta0[i]=ETA; phi0[i] = i+phibegin; } //----------------------------------------- int NN=1000; double VOLT[6][NN],CURR[6][NN],timeV[6][NN],timeC[6][NN]; int bec,Q,layer,B302,Loop,phi,eta,day,month,year,hour,min,sec,subsec,ndata; //------------reading HVchVolt-------------------- double HVchVolt; sprintf(cid,"dcsHVchVolt_B%d_%02d-%02d-%d.txt\0",LAYER,DAY1,MONTH,YEAR); ifstream fin(cid); cout<<"reading data from "<>bec>>Q>>layer>>B302>>Loop>>phi>>eta>>HVchVolt>>day>>month>>year>>hour>>min>>sec>>subsec){ if(HVchVolt==0.) continue; n++; if(n%1000 == 0) cout<>bec>>Q>>layer>>B302>>Loop>>phi>>eta>>HVchCurr>>day>>month>>year>>hour>>min>>sec>>subsec){ if(HVchVolt==0.) continue; n++; if(n%1000 == 0) cout<cd(i+1); h1 = new TGraph(idataV[iplot],timeV[iplot],VOLT[iplot]); h2 = new TGraph(idataC[iplot],timeC[iplot],CURR[iplot]); h1->SetMarkerSize(1.5); h2->SetMarkerSize(1.5); h1->SetMarkerColor(2); h2->SetMarkerColor(4); h1->SetLineColor(1); h2->SetLineColor(4); h1->SetMaximum(ymax); h1->SetMinimum(ymin); h1->GetXaxis()->SetTitleOffset(0.8); h1->GetXaxis()->SetLabelSize(0.03); sprintf(cid,"HV [V] and Current [#muA]"); if(currentFactor > 1) sprintf(cid,"HV[V] and Current#times%d[#muA]",currentFactor); h1->GetYaxis()->SetTitle(cid); h1->GetXaxis()->SetLabelSize(0.00); h1->GetXaxis()->SetTickLength(0.0); h1->GetXaxis()->SetLabelSize(0.00); h1->GetYaxis()->SetLabelSize(0.03); h1->GetXaxis()->SetLabelOffset(0.02); h1->GetYaxis()->SetLabelOffset(0.01); h1->GetXaxis()->SetTitle("UTC time"); h1->GetXaxis()->SetTitleSize(0.03); h1->GetYaxis()->SetTitleSize(0.03); h1->GetXaxis()->SetTitleOffset(1.3); h1->GetYaxis()->SetTitleOffset(1.2); h1->GetXaxis()->SetTimeDisplay(1); h1->GetXaxis()->SetTimeFormat("#splitline{%b %d}{ %Y}"); h1->GetXaxis()->SetLimits(t1,t2); h1->GetXaxis()->SetNdivisions(510); h1->Draw("ALP"); h2->Draw("SAME LP"); //----------------------------------------------------- sprintf(cid,"Barrel layer B%d eta=%d phi=%d\0",layer0[iplot], eta0[iplot], phi0[iplot]); leg = new TLegend(0.10 ,0.94 ,0.30, 0.94, cid); leg->SetFillColor(10);leg->SetBorderSize(0); leg->SetTextSize(0.03);leg->Draw(); //------------------------------------------------ double y0 = 0.87; leg = new TLegend(0.15 ,y0 ,0.30, y0);leg->AddEntry(h1,"HV","lp"); leg->SetFillColor(10);leg->SetBorderSize(0); leg->SetTextSize(0.03);leg->Draw(); leg = new TLegend(0.25 ,y0 ,0.40, y0);leg->AddEntry(h2,"Current","lp"); leg->SetFillColor(10);leg->SetBorderSize(0); leg->SetTextSize(0.03);leg->Draw(); leg->SetFillColor(10);leg->SetBorderSize(0); leg->SetTextSize(0.03);leg->Draw(); //leg = new TLegend(0.75 ,y0 ,0.95, y0);leg->AddEntry(h4,"T (link 1)","lp"); //leg->SetFillColor(10);leg->SetBorderSize(0);leg->SetTextSize(0.03);leg->Draw(); //---------------------------------------------------- for (int j=1; j<13; j++) { for (int iy=2010; iy<2013; iy++){ TDatime db(iy,j+1,1,0,0,0); int t3 = db.Convert()-X0; if(t3t2) continue; z1 = new TLine(t3,ymin,t3,ymax); z1->SetLineStyle(2); z1->Draw(); } } //---------------every day --------------------------------- for (int i=1;i<31;i++) { TDatime dc(YEAR,MONTH,i,0,0,0); double tday =dc.Convert()-X0; if(tday < t1) continue; if(tday > t2) break; double yy1=(ymax-ymin)*0.03+ymin; if(i%5 == 0) yy1=(ymax-ymin)*0.05+ymin; z1=new TLine(tday,ymin,tday,yy1); z1->SetLineColor(1); z1->Draw(); z1=new TLine(tday,ymin,tday,ymax); z1->SetLineStyle(2); z1->Draw(); //--------hours------------------------ for (int h=1; h<24 ;h++) { TDatime dc(YEAR,MONTH,i,h,0,0); tday =dc.Convert()-X0; if(tday < t1 || tday > t2) continue; yy1=(ymax-ymin)*0.015+ymin; if(h%6 == 0) yy1=(ymax-ymin)*0.03+ymin; z1=new TLine(tday,ymin,tday,yy1); z1->SetLineColor(1); z1->Draw(); } //-------days--------------------- yy1=(ymax-ymin)*(-0.04)+ymin; TDatime dc(YEAR,MONTH,i,10,0,0); tday =dc.Convert()-X0; sprintf(cid,"Nov %d",i); t=new TText(tday,yy1,cid); t->SetTextSize(0.03); t->SetTextColor(1); t->Draw(); sprintf(cid," %d",YEAR); yy1=(ymax-ymin)*(-0.08)+ymin; t=new TText(tday,yy1,cid); t->SetTextSize(0.03); t->SetTextColor(1); t->Draw(); } //----------------------------------------------------- sprintf(cid,"HVDB_time_B%d_%d-%02d-%02d_%d.png\0",LAYER,YEAR,MONTH,DAY1,iplot); c1->Print(cid); } //------------------------------------------ }