//======================================================================== // simulation of hole and electron trajectories of ATLAS SCT barrel strips // 2018.3.12 updated // 2016.10.14 combine with induced_charge.h updated for ROOT 6.02/12 // 2010.1.20 T. Kondo(KEK) //======================================================================== #include "Ramo.h" TCanvas *c1; TPad *pad[10]; void setupCanvasNXNY(int Nx, int Ny); const int TextFont=43, TextSize=16; double GetNDCX(double x) ; double GetNDCY(double y) ; void plot_induced_charge(){ setupCanvasNXNY(5,1); //------------set main parameters and initialization---------------- m_EfieldModel = 2; m_VD = 70.; m_VB = 150.; m_isSCTDigiModel = true; // (old) SCT Digitization model m_isSCTDigiModel = false; // induced charge model //m_transportTimeStep = 0.25; initialize(); // //m_B = 0.; m_x0 = 40.0 ; // ionization point [micron] m_y0 = 000.0 ; // ionization point [micron] m_coutLevel = 3; for (int n=0; n<9; n++) { m_x0 = int(n/3.) * 40.; m_y0 = n%3 * 130.; m_eventNumber++ ; execute(); } //------------write conditions at the top c1->cd(); pad[0]->cd(); sprintf(m_cid,"Induced charge model : B=%5.1fTesla, V_{D}=%4.1fV, V_{B}=%5.1fV, Flat Diode Model", m_B, m_VD, m_VB); if(m_EfieldModel==2) sprintf(m_cid,"Induced charge model : B=%5.1fTesla, V_{D}=%4.1fV, V_{B}=%5.1fV, FEM model", m_B, m_VD, m_VB); if( m_isSCTDigiModel ) sprintf(m_cid,"SCT Digitization Model : B=%5.1fTesla, V_{D}=%4.1fV, V_{B}=%5.1fV, Uniform Field Model", m_B, m_VD, m_VB); TLatex *txt = new TLatex(0.08, 0.960, m_cid); txt->SetTextFont(TextFont); txt->SetTextSize(TextSize); txt-> Draw(); //------------------------- if(m_isSCTDigiModel) c1->Print("SCTDigiModel_charge.png"); else c1->Print("Induced_charge.png"); return; } void execute() { // storage arrays for every 0.5 nsec double Q_m2[50], Q_m1[50], Q_00[50], Q_p1[50], Q_p2[50] ; double x0 = m_x0 / 10000. ; // conversion from [micron] to [cm] double y0 = m_y0 / 10000. ; // conversion from [micron] to [cm] //------------- one event loop --------------------------------- // clear charge arrays for induced current for (int it=0; it<50; it++) { Q_m2[it]=0.; Q_m1[it]=0.; Q_00[it]=0.; Q_p1[it]=0.; Q_p2[it]=0.; } // perform electron and hole transportation starting x0 and y0 if( !m_isSCTDigiModel) { holeTransport (x0, y0, Q_m2, Q_m1, Q_00, Q_p1, Q_p2) ; electronTransport(x0, y0, Q_m2, Q_m1, Q_00, Q_p1, Q_p2) ; } else { cout<<"old model"<cd(); pad[k+1]->cd(); double ylabel = 0.0, xlabel = 0.15; double ytitle = 0.0, xtitle = 0.00; switch(k) { case 0: h0 = new TGraph(50, nsec, Q_m2); ylabel = 0.15; ytitle = 0.13; break; case 1: h0 = new TGraph(50, nsec, Q_m1); break; case 2: h0 = new TGraph(50, nsec, Q_00); break; case 3: h0 = new TGraph(50, nsec, Q_p1); break; case 4: h0 = new TGraph(50, nsec, Q_p2); xtitle = 0.15; break; } h0->SetMaximum(ymax); h0->SetMinimum(ymin); h0->SetMarkerSize(0.3); h0->SetMarkerColor(m_eventNumber); h0->SetLineColor(m_eventNumber); h0->GetXaxis()->SetLabelFont(TextFont); h0->GetXaxis()->SetLabelSize(TextSize); h0->GetXaxis()->SetLabelOffset(0.01), h0->GetXaxis()->SetTitle("time [nsec]"); h0->GetXaxis()->SetTitleFont(TextFont); h0->GetXaxis()->SetTitleSize(TextSize); h0->GetXaxis()->SetTitleOffset(1.10), h0->GetYaxis()->SetLabelFont(TextFont); if(k==0) h0->GetYaxis()->SetLabelSize(TextSize); else h0->GetYaxis()->SetLabelSize(0); h0->GetYaxis()->SetLabelOffset(0.03); h0->GetYaxis()->SetTitle("Induced charge [e]"); h0->GetYaxis()->SetTitleFont(TextFont); if(k==0) h0->GetYaxis()->SetTitleSize(TextSize); else h0->GetYaxis()->SetTitleSize(0); h0->GetYaxis()->SetTitleOffset(4.50), h0->SetMaximum(ymax); h0->SetMinimum(ymin); //h0->GetXaxis()->SetLimits(0., 32.); h0->GetXaxis()->SetLimits(0., 18.); h0->GetXaxis()->SetNdivisions(505); if(m_eventNumber==1) h0->Draw("ALP"); else h0->Draw("SAME LP"); //-----------write strip number---------- if(m_eventNumber==1) { sprintf(m_cid,"strip %d", k-2); txt = new TLatex(5.,(ymax-ymin)*0.94+ymin, m_cid); txt->SetTextFont(TextFont); txt->SetTextSize(TextSize); txt-> Draw(); } //---------write legends---------------------- cout< AddEntry(h0,m_cid,"lp"); if(m_eventNumber != 9) continue; leg->SetBorderSize(0); leg->SetTextFont(TextFont); leg->SetTextSize(TextSize); leg->Draw(); txt = new TLatex(0.5, (ymax-ymin)*0.85+ymin, "eh origin (x,y)#mum"); txt->SetTextFont(TextFont); txt->SetTextSize(TextSize); txt-> Draw(); } //------------- end of one event loop ------------------------- return; } void setupCanvasNXNY(const int Nx, const int Ny) { //--------Taka Kondo (KEK) 2018.3.12------------------- //---- Adust following five parameters-------- double gapx=0.015; // gap width between plots double gapy=0.000; // gap width between plots double left_margin=0.08; // left_margin >= right_margin double right_margin=0.03; // left_margin >= right_margin double top_margin=0.060; // top margin double bottom_margin=0.090; // bottom margin //----------------------------------------------- c1 = new TCanvas("c1", "canvas", 700, 500); double apron=0.05; // pad aprons at top and bottom for label overlaps double sum=0.; double H[9] = {1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00}; for (int i=0; i=0; ipad--) { int ipad=0; for (int iy=0; iy<=Ny; iy++) { for (int ix=1; ix<=Nx; ix++) { if(iy==0 && ix!=1) continue; if(x1<0) x1=0; x2=1.0-right_margin-width-(Nx-ix-1)*(gapx+width); if(ix==Nx)x2=1.; if(ipad!=0 && ix==1) { pad_topM= gapy+apron; pad_bottomM=gapy+apron; if(iy==1) pad_topM=top_margin; if(iy==Ny) pad_bottomM=bottom_margin; height=pad_topM+H[iy-1]*plotspace+pad_bottomM; y1 = y2 - height; if(y1<0.01) y1=0.; } x1=x2-padWidth; if(x1<0.) x1=0.; if(ipad==0) pad[ipad]=new TPad("pad","pad",0.0,0.0,1.0,1.0); else pad[ipad]=new TPad("pad","pad",x1,y1,x2,y2); //cout<SetTopMargin(pad_topM/height); pad[ipad]->SetBottomMargin(pad_bottomM/height); pad[ipad]->SetRightMargin(gapx/padWidth); pad[ipad]->SetLeftMargin((padWidth-width-gapx)/padWidth); if(ix==Nx) y2 = y1 + gapy + 2*apron; } if(ix==Nx){ pad[ipad]->SetRightMargin((right_margin)/padWidth); pad[ipad]->SetLeftMargin((padWidth-width-right_margin)/padWidth); } //pad[ipad]->SetFillColorAlpha(ipad+1,0.10); //make pad transparent; pad[ipad]->SetFillColorAlpha(ipad,0.00); //make pad transparent; pad[ipad]->Draw(); ipad++; } } return; } double GetNDCX(double x) { // get NDC from user-coordinate y // see https://root-forum.cern.ch/t/from-user-to-ndc/9943/4 gPad->Update(); //this is necessary! return (x - gPad->GetX1())/(gPad->GetX2()-gPad->GetX1()); } double GetNDCY(double y) { // get NDC from user-coordinate y // see https://root-forum.cern.ch/t/from-user-to-ndc/9943/4 gPad->Update(); //this is necessary! return (y - gPad->GetY1())/(gPad->GetY2()-gPad->GetY1()); } //