{ //-----plot_Dortmund_with_noError_1.C------------------------ // 2012.1.26 change log term correctly // 2012.1.30 bug fixed // 2012.1.31 add hour and minutes in input // 2012.2.22 added both polarity in error, 4.5%->3.7% in fluence error // 2012.3.1 data and model with 1.21 // 2012.3.3. Atlas Perliminary // 2012.3.15 int. lum deliv. -> right axis // 2012.3.17 Y axis title: leak-> vol // 2012.3.22 change to sigma band and cleanup //----------------------------------------------- //----------------------------------------------- #include gROOT->LoadMacro("AtlasUtils.C"); ATLAS->SetPadTickX(1); ATLAS->SetPadTickY(0); ATLAS->SetPadRightMargin(0.12); ATLAS->SetPadLeftMargin(0.12); c1 = new TCanvas("c1","A Simple Graph",500,30,700,500); //c1->SetGrid(); //TDatime db(2010,06,01,00,00,00); TDatime db(2010,07,01,00,00,00); int t1 = db.Convert(); //TDatime db(2011,04,01,00,00,00); TDatime db(2012,1,01,23,59,59); int t2 = db.Convert(); gStyle->SetOptStat(0); gPad->SetLogy(); int isGrid = 1; //c1->SetGrid(); //------------------create the arrays for the points------------------------- char cid[40]; double Tplot = 0.; Double_t ymax= 1000.0; Double_t ymin= 0.001; double Tscale=ymax*0.1/10., Toffset = ymax*0.2; //double Tscale=0.01/10., Toffset = 0.02; Int_t n = 3000; // number of weeks double intL[n],Temp[4][n],Temp_plot[4][n], Tbias=3.6; double time[n], Ttime[n]; double weekL[n], energy[n]; double leak[4][n],dleak[4][n],leakop[4][n],dleakop[4][n], leak3[5][n],dleak3[5][n]; for (int i=0; i>bec>>layer>>year2>>month2>>day2>>hour2>>min2>>tempdata>>error) { //cout<3) continue; int m = idata[L]; TDatime da(year2,month2,day2,hour2, min2,0); dtime[L][m]=da.Convert(); data[L][m]=tempdata/Vsensor; cout<>year1>>month1>>day1>>hour1>>min1>>year2>>month2>>day2>>hour2>>min2>>energy[iweek]>> weekL[iweek]>>intL[iweek]>>Temp[0][iweek]>>Temp[1][iweek]>>Temp[2][iweek]>>Temp[3][iweek] ) { if(iweek<10) cout< t2) continue; if(iweek==1) time[0] = time1; TDatime d2(year2,month2,day2,hour2,min2,60); time[iweek]=d2.Convert(); Ttime[iT]=time1; for(int layer=0; layer<4; layer++){ Temp[layer][iweek] = Temp[layer][iweek] - Tbias; // Temp_plot[layer][iT] = Temp[layer][iweek]*Tscale+Toffset; Temp_plot[layer][iT] = pow(10., 2.+(Temp[layer][iweek]+10.)/40.); } iT++; Ttime[iT]=time[iweek]; for(int layer=0; layer<4; layer++) //Temp_plot[layer][iT] = Temp[layer][iweek]*Tscale+Toffset; Temp_plot[layer][iT] = pow(10., 2.+(Temp[layer][iweek]+10)/40.); iT++; iweek++; } fin.close(); cout<<"number of time intervals= "<< iweek << endl; cout<<"last week: from "< 0.) ierror = jerror + nError; //--------------------------------------------------- double alphaI = alphaI0; double k0I = k0I0; double EI = EI0; double alpha0star = alpha0star0; double beta = beta0; double EIstar = EIstar0; Tsensor = Tsensor0; double fluence_thisweek = fluence0; double Eg = Eg0; // if( jerror==1 ) alphaI += pol*dalphaI; if( jerror==2 && pol>0.) k0I += dk0I_plus; if( jerror==2 && pol<0.) k0I -= dk0I_minus; if( jerror==3 ) EI += pol*dEI; if( jerror==4 ) alpha0star += pol*dalpha0star; if( jerror==5 ) beta += pol * dbeta; if( jerror==6 ) EIstar += pol * dEIstar; if( jerror==7 && pol<0.) Eg -= dEg_minus; if( jerror==7 && pol>0.) Eg += dEg_plus; if( jerror==8 && Tsensor0 < 10.) Tsensor += pol * 1.0; if( jerror==8 && Tsensor0 >=10.) Tsensor += pol * 2.0; if( jerror==9 ) fluence_thisweek *= (1. + pol*dfluence) ; fluences[layer][iw][ierror] = fluence_thisweek; //-----leak_week = new leakcurrent due to new flux during this week ----------- double Arrhenius = exp(-EIstar/kB*(1/(Tsensor+T0)-1/Tref)); double W=pow((Tplot+T0)/Tref,2)*exp(-Eg/2./kB*(1./(Tplot+T0)-1./Tref)); double tauI = 1./ (k0I * exp(-EI/kB/(Tsensor+T0))); double leak_week_exp = W * fluence_thisweek * alphaI *exp(-0.5*days/tauI); double leak_week_log = W * fluence_thisweek * (alpha0star - beta * log(0.368*days/t0)); ileak_exp[layer][iw][ierror] = leak_week_exp + ileak_exp[layer][iw-1][ierror] * exp(-days/tauI); days_eff[layer][iw][ierror] = days * Arrhenius; double sum_fluence = 0.; double beta_term = 0.; if( iw != 1) { for (int jw = 1; jw"<SetMaximum(ymax); hu->SetMinimum(ymin); sprintf(cid,"I_{vol}@%d^{o}C (#muA/cm^{3})\0",(int)Tplot); hu->GetYaxis()->SetTitle(cid); hu->GetXaxis()->SetTitle("Date"); hu->GetXaxis()->SetTitleOffset(1.5); hu->GetXaxis()->SetLabelOffset(0.05); hu->GetXaxis()->SetLabelSize(0.04); hu->GetYaxis()->SetTitleSize(0.05); hu->GetYaxis()->SetTitleOffset(1.0); hu->GetYaxis()->SetLabelOffset(0.01); hu->GetXaxis()->SetTimeDisplay(1); hu->GetXaxis()->SetTimeFormat("#splitline{ %Y}{%b %d}"); hu->GetXaxis()->SetLimits(t1,t2); hu->GetXaxis()->SetNdivisions(207); int kColor=kRed; if(layer==1) kColor = kGreen; if(layer==2) kColor = kBlue; if(layer==3) kColor = kMagenta; hu->SetFillColor(kColor-9); hu->SetFillStyle(3001); hu->GetXaxis()->SetNdivisions(0); if(layer==0)hu->Draw("ALF"); if(layer!=0)hu->Draw("SAME LF"); leg4->AddEntry(hu," ","f"); if(layer==0)leg0->AddEntry(hu,"B3",""); if(layer==1)leg0->AddEntry(hu,"B4",""); if(layer==2)leg0->AddEntry(hu,"B5",""); if(layer==3)leg0->AddEntry(hu,"B6",""); } //----------draw central values and data points ------------------------- for (int layer=0; layer<4; layer++){ double yplot[iweek]; for (int iw=0; iwSetLineColor(kColor+2); g2->SetMarkerColor(kColor+2); hc->Draw("SAME L"); g2->SetMarkerSize(0.8); g2->Draw("SAME P"); leg1->AddEntry(hc," #pm1#sigma","L"); leg2->AddEntry(g2," ","P"); } //-------------------------plot temperature-------------------------- gT3 = new TGraph(iT,Ttime,Temp_plot[0]); gT4 = new TGraph(iT,Ttime,Temp_plot[1]); gT5 = new TGraph(iT,Ttime,Temp_plot[2]); gT6 = new TGraph(iT,Ttime,Temp_plot[3]); gT3->SetLineStyle(1); gT3->SetLineColor(kRed+2);gT3->Draw("SAME L"); gT4->SetLineStyle(1); gT4->SetLineColor(kGreen+2);gT4->Draw("SAME L"); gT5->SetLineStyle(1); gT5->SetLineColor(kBlue+2);gT5->Draw("SAME L"); gT6->SetLineStyle(1); gT6->SetLineColor(kMagenta+2);gT6->Draw("SAME L"); //-------------------plot integrated luminosity--------------- for (int i=0; iDraw("SAME L"); TDatime db(2010,11,15,00,00,00); int t4 = db.Convert(); lum = new TLatex(t4 ,0.60 ,"int. lum. deliv."); lum->SetTextSize(0.035); lum->Draw(); //-------------------- write years and days on X label-------------- int day1=16; double ylabel1= ymin*0.4, ylabel2=ymin*0.2; for (int m=1; m<13; m+=3){ TDatime db(2010,m-1,day1,00,00,00);int t4 = db.Convert(); if(t4>t1-3000000) { sprintf(cid,"%d/01\0",m); legA = new TText(t4 ,ylabel1 ,cid); legA->SetTextSize(0.040); legA->Draw(); legA = new TText(t4 ,ylabel2 ,"2010"); legA->SetTextSize(0.040);legA->Draw(); } TDatime db(2011,m-1,day1,00,00,00);int t4 = db.Convert(); sprintf(cid,"%d/01\0",m); legA = new TText(t4 ,ylabel1 ,cid); legA->SetTextSize(0.040);legA->Draw(); legA = new TText(t4 ,ylabel2 ,"2011"); legA->SetTextSize(0.040);legA->Draw(); TDatime db(2012,m-1,day1,00,00,00);int t4 = db.Convert(); if(t4SetTextSize(0.040); if( t4Draw(); legA = new TText(t4 ,ylabel2 ,"2012"); legA->SetTextSize(0.040);legA->Draw(); } //----grid----- if(isGrid !=0) { TDatime db(2010,m,01,00,00,00); t4 = db.Convert(); tick = new TLine(t4, 0, t4, ymax); tick->SetLineStyle(3); if(t4>t1)tick->Draw(); TDatime db(2011,m,01,00,00,00); t4 = db.Convert(); tick = new TLine(t4, 0, t4, ymax); tick->SetLineStyle(3);tick->Draw(); } } //--- tick marks------ for (int i=1;i<13;i++) { TDatime db(2010,i,01,00,00,00); int t4 = db.Convert(); if(t4>t1){ tick = new TLine(t4, ymin, t4, ymin*1.3); tick->SetLineStyle(1);tick->Draw(); tick = new TLine(t4, ymax*0.8, t4, ymax); tick->SetLineStyle(1);tick->Draw(); } TDatime db(2011,i,01,00,00,00); int t4 = db.Convert(); tick = new TLine(t4, ymin, t4, ymin*1.3); tick->SetLineStyle(1);tick->Draw(); tick = new TLine(t4, ymax*0.8, t4, ymax); tick->SetLineStyle(1);tick->Draw(); } //-----------horizontal bar------------------------ if(isGrid !=0) { for (double y=ymin; ySetLineStyle(3);tick->Draw(); } } //----------Legend----------------- legd->SetFillColor(10); legd->SetBorderSize(1); leg0->SetFillColor(10); leg0->SetBorderSize(0); leg0->SetTextSize(0.035); leg1->SetFillColor(10); leg1->SetBorderSize(0); leg1->SetTextSize(0.035); leg2->SetFillColor(10); leg2->SetBorderSize(0); leg2->SetTextSize(0.035); leg4->SetFillColor(10); leg4->SetBorderSize(0); leg4->SetTextSize(0.01); legd->Draw(); leg0->Draw(); leg2->Draw(); leg1->Draw(); leg4->Draw(); //---------------draw Temperature axis on the right side----------------- TGaxis *axis = new TGaxis(t2,ymax/10.*pow(10.,0.25),t2, ymax,0.,30.,404,"+L"); axis->SetTitle("T (#circC)"); axis->SetLabelOffset(0.01); axis->SetTitleOffset(1.0); axis->SetTitleSize(0.035); axis->SetLabelSize(0.035); axis->SetLabelFont(42); axis->SetTitleFont(42); axis->Draw(); //-----------------------draw an axis on the right side---------------- TGaxis *axis = new TGaxis(t2,ymin,t2, ymax/10.,ymin/10.,ymax/100.,505,"+LG"); axis->SetTitle("Int. Lum. Deliv. (fb^{-1}) "); axis->SetLabelOffset(0.0); axis->SetTitleOffset(1.0); axis->SetTitleSize(0.035); axis->SetLabelSize(0.035); axis->SetLabelFont(42); axis->SetTitleFont(42); axis->Draw(); //-------------------write sensor temperature --------------- TDatime db(2011,2,10,00,00,00); int t4 = db.Convert(); TDatime db(2011,7,25,00,00,00); int t5 = db.Convert(); p = new TPave(t4, ymax*0.6,t5, ymax*0.95); p->SetFillColor(10); p->SetBorderSize(0), p->Draw(); TDatime db(2011,2,15,00,00,00); int t4 = db.Convert(); lum = new TLatex(t4 ,600 ,"sensor temperature"); lum->SetTextSize(0.040); lum->Draw(); //----------------- write ATLAS preliminary-------------------------- TDatime db(2010,07,15,00,00,00); int t5 = db.Convert(); t=new TLatex(t5,ymax*0.05,"ATLAS preliminary"); t->SetTextSize(0.05); t->Draw(); //-----------------------print ------------------------- c1->Print("Barrel_log_2011end_2.png"); //c1->Print("Barrel_log_2011end_2.pdf"); //c1->Print("Barrel_log_2011end_2.eps"); }