void drawhamptonbox(float x, float y, bool left=true) { double supportwidth = 40.6 ; //?? double supportheight = 17.8 ; double scintillatorwidth = 40.0 ; double scintillatorheight = 2.5 ; double scintillatory = 9 ; // center of scintillator till bottom of support double xoffset = x ; double yoffset = y ; if(!left) xoffset-= supportwidth ; TBox * support = new TBox( xoffset, yoffset, xoffset + supportwidth, yoffset + supportheight) ; support->SetFillColor(7) ; support->Draw() ; double scintx = xoffset + 0.5*(supportwidth - scintillatorwidth ) ; double scinty = yoffset + scintillatory - 0.5*scintillatorheight ; TBox * scintillator = new TBox( scintx, scinty, scintx+scintillatorwidth,scinty+scintillatorheight) ; scintillator->SetFillColor(1) ; scintillator->Draw() ; // double scintillator // TBox* support = new TBox(x + } void drawTRTSector(double xpos, double ypos, int isector, int color) { static const double dphi = TMath::Pi() / 16 ; static const double radius[4] = {108,108-22,108-22-16,108-22-16-12} ; // sector is defined by 8 points double x[8] ; double y[8] ; const double phi = (-isector+1+16) * dphi ; for(int i=0;i<4; ++i) { double thisphi = phi ; if(i%2) thisphi -= 0.5*dphi ; x[i] = xpos + radius[i%4] * cos(thisphi) ; y[i] = ypos + radius[i%4] * sin(thisphi) ; x[7-i] = xpos + radius[i%4] * cos(thisphi + dphi) ; y[7-i] = ypos + radius[i%4] * sin(thisphi + dphi) ; } //TPolyLine* line = new TPolyLine(8,x,y) ; //line->Draw() ; TLine single ; single.SetLineColor(color) ; for(int i=0; i<3; ++i) { single.DrawLine(x[i],y[i],x[7-i],y[7-i]) ; single.DrawLine(x[i],y[i],x[i+1],y[i+1]) ; single.DrawLine(x[7-i],y[7-i],x[6-i],y[6-i]) ; } single.DrawLine(x[0],y[0],x[6],y[6]) ; single.DrawLine(x[2],y[2],x[6],y[6]) ; single.DrawLine(x[2],y[2],x[4],y[4]) ; single.DrawLine(x[3],y[3],x[4],y[4]) ; const char textstr[256] ; sprintf(textstr,"%d",isector) ; TText textje ; textje.SetTextFont(132) ; textje.SetTextSize(0.03) ; textje.SetTextColor(color) ; textje.SetTextAlign(22) ; textje.DrawText(xpos+115*cos(thisphi+dphi), ypos+115*sin(thisphi+dphi),textstr) ; } void drawTRT(float xpos, float ypos) { //c1 = new TCanvas("c1","",500,500) ; //c1->DrawFrame(-120,-120,120,120) ; for(int isec=1; isec<=32; ++isec) drawTRTSector(xpos,ypos,isec,1) ; drawTRTSector(xpos,ypos,7,2) ; drawTRTSector(xpos,ypos,8,2) ; drawTRTSector(xpos,ypos,23,2) ; drawTRTSector(xpos,ypos,24,2) ; drawTRTSector(xpos,ypos,1,4) ; } void scintillators() { c1 = new TCanvas("c1","",500,800) ; //gPad->DrawFrame(-200,-300,200,300) ; //TCanvas *EDC = new TCanvas("EDC","TRT Wheel Fast Analysis (Channel)", 800,800); gPad->DrawFrame(-200,-250,200,400) ; gPad->SetGridx() ; gPad->SetGridy() ; drawTRT(0,169) ; // first draw the floor TLine line ; line.SetLineWidth(1) ; line.SetLineColor(42) ; TBox * floor = new TBox(-200,0,200,-20) ; floor->SetFillStyle(3004) ; floor->SetFillColor(42) ; floor->SetLineWidth(2) ; floor->SetLineStyle(1) ; floor->Draw() ; line.DrawLine(-200,0,200,0) ; line.DrawLine(-200,-20,200,-20) ; // draw the false floor TBox * falsefloor = new TBox(-200,-215,200,-250) ; falsefloor->SetFillStyle(3004) ; falsefloor->SetFillColor(42) ; falsefloor->SetLineWidth(3) ; falsefloor->Draw() ; line.DrawLine(-200,-215,200,-215) ; // draw the support structure, just for fun { double xmin = -120 ; double xmax = 120 ; double ymin = 48.3 ; double ymax = 283 ; double dx = 70 ; double dy = dx ; float x[] = { xmax-dx,xmax,xmax,xmax-dx,xmin+dx,xmin,xmin,xmin+dx,xmax-dx} ; float y[] = { ymin, ymin+dy, ymax-dy, ymax,ymax, ymax-dy,ymin+dy,ymin,ymin} ; TPolyLine* pline = new TPolyLine(8,x,y) ; pline->Draw() ; TBox* bottom = new TBox(-120,27,120,48.3) ; bottom->SetFillStyle(0) ; bottom->Draw() ; } // now draw the upper scintillator drawhamptonbox(-58,360,false) ; // and the lower //drawhamptonbox(287.5-120,-215) ; drawhamptonbox(100,-215) ; // and the centre drawhamptonbox(40,0) ; // draw the 22.5 degree center { TLine cline(0,0,0,0) ; ; cline.SetLineColor(kBlue) ; cline.SetLineWidth(1) ; cline.SetLineStyle(2) ; double dydx = tan( -5.5*TMath::Pi()/16.) ; cline.DrawLine( (400-169)/dydx, 400, (-250-169)/dydx, -250) ; dydx = tan( -7.*TMath::Pi()/16.) ; cline.DrawLine( (400-169)/dydx, 400, (-250-169)/dydx, -250) ; //dydx = tan( -5.5*TMath::Pi()/16.) ; //cline.DrawLine( (400-169)/dydx, 400, (-250-169)/dydx, -250) ; } c1->Print("scintillators.eps") ; }