#ifndef L1CADraw_h #define L1CADraw_h 1 #define DRAW #include "CbmL1.h" #include "TApplication.h" #include "TStyle.h" #include "TCanvas.h" #include "TFrame.h" #include "TMarker.h" #include "TPolyMarker.h" #include "TPaveText.h" #include "TEllipse.h" #include "TText.h" #include "TPolyLine.h" static TApplication *myapp; static TCanvas *XZ, *XY; //static bool ask = true; static bool ask = false; void InitL1Draw(){ static bool first_call_of_draw = 1; if( first_call_of_draw ){ first_call_of_draw = 0; //myapp = new TApplication("myapp", 0, 0); gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasBorderSize(1); gStyle->SetCanvasColor(0); XZ = new TCanvas ("XZ", "XZ Top View", -1, 0, 500, 500); XZ->Range(-5.0, -50.0, 105.0, 50.0); XZ->Clear(); XZ->Draw(); //XZ->Flush(); //XZ->Update(); XY = new TCanvas ("XY", "XY Frontal View", -506, 0, 500, 500); XY->Range(-50.0, -50.0, 50.0, 50.0); XY->Clear(); XY->Draw(); //XY->Flush(); //XY->Update(); } } void DrawAsk(){ char symbol; if (ask){ std::cout << "ask>"; do{ std::cin.get(symbol); if (symbol == 'r') ask = false; } while (symbol != '\n'); std::cout << endl; } } void Draw1(){ L1Algo *algo = CbmL1::Instance()->algo; XZ->cd(); XZ->Clear(); XZ->Draw(); XY->cd(); XY->Clear(); XY->Draw(); //TMarker *mhit = new TMarker(0.0, 0.0, 6); //mhit->SetMarkerColor(kBlue); int nhits = algo->vStsHits.size(); Double_t x_poly[nhits], y_poly[nhits], z_poly[nhits]; Double_t x_poly_fake[nhits], y_poly_fake[nhits], z_poly_fake[nhits]; for (int ista = algo->NStations-1; ista>=0; ista--){// //start downstream chambers //for (int ista = 0; istaStsHitsStartIndex[ista]; ih<=algo->StsHitsStopIndex[ista]; ih++){ L1StsHit &h = algo->vStsHits[ih]; int iMC = CbmL1::Instance()->vHitMCRef[ih]; //if( (vSFlag[h.f] | vSFlagB[h.b] )&0x02 ) continue; // if used L1Station &st = algo->vStations[ista]; double x = algo->vStsStrips[h.f].u; double y = h.y; double z = st.z[0]; if( iMC>=0 ){ x_poly[n_poly] = x; y_poly[n_poly] = y; z_poly[n_poly] = z; n_poly++; }else{ x_poly_fake[n_poly_fake] = x; y_poly_fake[n_poly_fake] = y; z_poly_fake[n_poly_fake] = z; n_poly_fake++; } TEllipse *ellipse = new TEllipse(0.0, 0.0, st.Rmax[0]); ellipse->SetLineColor(17); XY->cd(); ellipse->Draw(); TLine *line = new TLine(); line->SetLineColor(17); XZ->cd(); line->DrawLine(st.z[0], -st.Rmax[0], st.z[0], st.Rmax[0]); } XZ->cd(); TPolyMarker *pmxz = new TPolyMarker(n_poly, z_poly, x_poly); pmxz->SetMarkerColor(ista+1); pmxz->SetMarkerStyle(20); pmxz->SetMarkerSize(0.4); pmxz->Draw(); //delete pmxz; TPolyMarker *pmxz_fake = new TPolyMarker(n_poly_fake, z_poly_fake, x_poly_fake); //pmxz_fake->SetMarkerColor(kBlack); pmxz_fake->SetMarkerColor(ista+1); pmxz_fake->SetMarkerStyle(20); pmxz_fake->SetMarkerSize(0.4); pmxz_fake->Draw(); //delete pmxz; XY->cd(); TPolyMarker *pmxy = new TPolyMarker(n_poly, y_poly, x_poly); pmxy->SetMarkerColor(ista+1); pmxy->SetMarkerStyle(20); pmxy->SetMarkerSize(0.4); pmxy->Draw(); //delete pmxy; TPolyMarker *pmxy_fake = new TPolyMarker(n_poly_fake, y_poly_fake, x_poly_fake); //pmxy_fake->SetMarkerColor(kBlack); pmxy_fake->SetMarkerColor(ista+1); pmxy_fake->SetMarkerStyle(20); pmxy_fake->SetMarkerSize(0.4); pmxy_fake->Draw(); //delete pmxy; } double lx[1000], ly[1000], lz[1000]; CbmL1 &L1 = *CbmL1::Instance(); for( vector::iterator it = L1.vMCTracks.begin(); it != L1.vMCTracks.end(); ++it){ CbmL1MCTrack &T = *it; //if( T.nContStations<4 ) continue; if( T.nContStations<1 ) continue; if( T.p<.2 ) continue; lx[0] = T.x; ly[0] = T.y; lz[0] = T.z; int nhits = T.StsHits.size(); for( int ih=0; ihvStsHits[jh]; int ista = algo->vSFlag[h.f]/4; L1Station &st = algo->vStations[ista]; double x = algo->vStsStrips[h.f].u; double y = h.y; double z = st.z[0]; lx[ih+1] = x; ly[ih+1] = y; lz[ih+1] = z; } TPolyLine *pline = new TPolyLine(); pline->SetLineColor(kRed); XZ->cd(); //pline->DrawPolyLine(nhits+1, lz, lx ); TPolyLine *pline1 = new TPolyLine(); pline1->SetLineColor(kRed); XY->cd(); //pline1->DrawPolyLine(nhits+1, ly, lx ); } XZ->cd(); XZ->Flush(); XZ->Draw(); XY->cd(); XY->Flush(); XY->Draw(); } #endif