TEveStraightLineSet* make_vertex_cross(const IlcESDVertex* v, Bool_t use_sigma, Float_t fx, Float_t fy, Float_t fz) { Double_t x[3], e[3]; v->GetXYZ(x); v->GetSigmaXYZ(e); TEveStraightLineSet* ls = new TEveStraightLineSet("Cross"); TString title; if (use_sigma) { e[0] *= fx; e[1] *= fy; e[2] *= fz; title += Form("+- %.1f*sigma_x, %.1f*sigma_y, %.1f*sigma_z", fx, fy, fz); } else { e[0] = fx; e[1] = fy; e[2] = fz; title += Form("+- %.1f cm x %.1f cm x %.1f cm", fx, fy, fz); } title += Form("\nx=%.5f, y=%.5f, z=%.5f\nsx=%.5f, sy=%.5f, sz=%.5f", x[0], x[1], x[2], e[0], e[1], e[2]); ls->SetTitle(title); ls->AddLine(e[0], 0, 0, -e[0], 0, 0); ls->AddLine(0, e[1], 0, 0, -e[1], 0); ls->AddLine(0, 0, e[2], 0, 0, -e[2]); ls->RefMainTrans().SetPos(x); return ls; }
TEveBoxSet* elliptic_boxset_cones(Float_t x=0, Float_t y=0, Float_t z=0, Int_t num=100, Bool_t register=kTRUE) { TEveManager::Create(); using namespace TMath; TEveManager::Create(); TEveStraightLineSet* lines = new TEveStraightLineSet("StraightLines"); lines->SetLineColor(kYellow); lines->SetLineWidth(2); TRandom r(0); TEveBoxSet* cones = new TEveBoxSet("EllipticConeSet"); cones->Reset(TEveBoxSet::kBT_EllipticCone, kTRUE, 64); cones->SetPickable(kTRUE); Float_t a = 40; // max distance between cones TEveVector dir, pos; Float_t theta, phi, height, rad; for (Int_t i=0; i<num; ++i) { theta = r.Uniform(0,TMath::Pi()); phi = r.Uniform (-TMath::Pi(), TMath::Pi()); height = r.Uniform(5, 15); rad = r.Uniform(3, 5); dir.Set(Cos(phi)*Cos(theta), Sin(phi)*Cos(theta), Sin(theta)); dir *= height; pos.Set(r.Uniform(-a,a), r.Uniform(-a, a), r.Uniform(-a, a)); cones->AddEllipticCone(pos, dir, rad, 0.5*rad, r.Uniform(0,360)); cones->DigitColor(r.Uniform(20, 255), r.Uniform(20, 255), r.Uniform(20, 255), r.Uniform(20, 255)); // draw axis line 30% longer than cone height TEveVector end = pos + dir*1.3f; lines->AddLine(pos.fX, pos.fY, pos.fZ, end.fX, end.fY, end.fZ); } // by default cone cap not drawn if (r.Integer(2)>0) cones->SetDrawConeCap(kTRUE); cones->RefitPlex(); TEveTrans& t = cones->RefMainTrans(); t.SetPos(x, y, z); gEve->AddElement(cones); gEve->AddElement(lines); gEve->Redraw3D(kTRUE); return cones; }
TEveStraightLineSet* primary_vertex_box_tpc(Bool_t use_sigma=kTRUE, Float_t fx=30, Float_t fy=30, Float_t fz=10) { IlcESDEvent *esd = IlcEveEventManager::AssertESD(); const IlcESDVertex *tpcv = esd->GetPrimaryVertexTPC(); if ( ! tpcv->GetStatus()) { Info("primary_vertex_box_tpc", "Primary vertex TPC not available."); return 0; } TEveStraightLineSet* ls = make_vertex_box(tpcv, use_sigma, fx, fy, fz); ls->ApplyVizTag("REC PVTX Box TPC"); assert_vertex_parent("Primary Vertex TPC", 5)->AddElement(ls); gEve->Redraw3D(); return ls; }
TEveStraightLineSet* primary_vertex_ellipse_spd(Bool_t use_sigma=kTRUE, Float_t fx=30, Float_t fy=30, Float_t fz=10) { IlcESDEvent *esd = IlcEveEventManager::AssertESD(); const IlcESDVertex *spdv = esd->GetPrimaryVertexSPD(); if ( ! spdv->GetStatus()) { Info("primary_vertex_ellipse_spd", "Primary vertex SPD not available."); return 0; } TEveStraightLineSet* ls = make_vertex_ellipse(spdv, use_sigma, fx, fy, fz); ls->ApplyVizTag("REC PVTX Ellipse SPD"); assert_vertex_parent("Primary Vertex SPD", 6)->AddElement(ls); gEve->Redraw3D(); return ls; }
TEveStraightLineSet* primary_vertex(Bool_t use_sigma=kTRUE, Float_t fx=1, Float_t fy=1, Float_t fz=1) { IlcESDEvent *esd = IlcEveEventManager::AssertESD(); const IlcESDVertex *pv = esd->GetPrimaryVertex(); if ( ! pv->GetStatus()) { Info("primary_vertex", "Primary vertex not available."); return 0; } TEveStraightLineSet* ls = make_vertex_cross(pv, use_sigma, fx, fy, fz); ls->ApplyVizTag("REC PVTX"); assert_vertex_parent("Primary Vertex", 7)->AddElement(ls); gEve->Redraw3D(); return ls; }
TEveStraightLineSet* make_vertex_ellipse(const IlcESDVertex* v, Bool_t use_sigma, Float_t fx, Float_t fy, Float_t fz) { Double_t x[3], e[3]; v->GetXYZ(x); v->GetSigmaXYZ(e); TEveStraightLineSet* ls = new TEveStraightLineSet("Ellipse"); TString title; if (use_sigma) { e[0] *= fx; e[1] *= fy; e[2] *= fz; title += Form("+- %.1f*sigma_x, %.1f*sigma_y, %.1f sigma_z", fx, fy, fz); } else { e[0] = fx; e[1] = fy; e[2] = fz; title += Form("+- %.1f cm x %.1f cm x %.1f cm", fx, fy, fz); } title += Form("\nx=%.5f, y=%.5f, z=%.5f\nsx=%.5f, sy=%.5f, sz=%.5f", x[0], x[1], x[2], e[0], e[1], e[2]); ls->SetTitle(title); const Int_t N = 32; const Float_t S = 2*TMath::Pi()/N; Float_t a = e[0], b = e[1]; for (Int_t i = 0; i<N; i++) ls->AddLine(a*TMath::Cos(i*S) , b*TMath::Sin(i*S) , 0, a*TMath::Cos(i*S+S), b*TMath::Sin(i*S+S), 0); a = e[0]; b = e[2]; for (Int_t i = 0; i<N; i++) ls->AddLine(a*TMath::Cos(i*S) , 0, b*TMath::Sin(i*S), a*TMath::Cos(i*S+S), 0, b*TMath::Sin(i*S+S)); a = e[1]; b = e[2]; for (Int_t i = 0; i<N; i++) ls->AddLine(0, a*TMath::Cos(i*S) , b*TMath::Sin(i*S), 0, a*TMath::Cos(i*S+S), b*TMath::Sin(i*S+S)); ls->RefMainTrans().SetPos(x); return ls; }
void jetcone() { TEveManager::Create(); using namespace TMath; TRandom r(0); // -- Set Constants Int_t nCones = 10; Int_t nTracks = 200; Float_t coneRadius = 0.4; Float_t length = 300.; // -- Define palette gStyle->SetPalette(1, 0); TEveRGBAPalette* pal = new TEveRGBAPalette(0, 500); // ----------------------------------------------------------------------- // -- Line sets // ----------------------------------------------------------------------- // -- Define cone center TEveStraightLineSet* axis = new TEveStraightLineSet("Cone Axis"); axis->SetLineColor(kGreen); axis->SetLineWidth(2); TEveStraightLineSet* tracksXYZ = new TEveStraightLineSet("StraightLinesXYZ"); tracksXYZ->SetLineColor(kRed); tracksXYZ->SetLineWidth(2); TEveStraightLineSet* tracksEtaPhi = new TEveStraightLineSet("StraightLinesEtaPhi"); tracksEtaPhi->SetLineColor(kYellow); tracksEtaPhi->SetLineWidth(2); TEveStraightLineSet* tracksSeedEtaPhi = new TEveStraightLineSet("StraightLinesEtaPhiSeed"); tracksSeedEtaPhi->SetLineColor(kBlue); tracksSeedEtaPhi->SetLineWidth(2); // ----------------------------------------------------------------------- // -- Draw track distribution in XYZ in TPC Volume +/-250, +/-250, +/-250 // ----------------------------------------------------------------------- for ( Int_t track=0; track < nTracks ; track++ ) { Float_t trackX = r.Uniform(-250.0, 250.0); Float_t trackY = r.Uniform(-250.0, 250.0); Float_t trackZ = r.Uniform(-250.0, 250.0); Float_t trackR = Sqrt(trackX*trackX + trackY*trackY + trackZ*trackZ); TEveVector trackDir(trackX/trackR, trackY/trackR ,trackZ/trackR); TEveVector trackEnd = trackDir * length; tracksXYZ->AddLine(0., 0., 0., trackEnd.fX, trackEnd.fY, trackEnd.fZ ); } // ----------------------------------------------------------------------- // -- Draw track distribution in eta phi in TPC Volume +/-0.9, {0, 2Pi} // ----------------------------------------------------------------------- for ( Int_t track=0; track < nTracks ; track++ ) { Float_t trackEta = r.Uniform(-0.9, 0.9); Float_t trackPhi = r.Uniform(0.0, TwoPi()); TEveVector trackDir( GetTEveVector(trackEta, trackPhi) ); TEveVector trackEnd = trackDir * length; if ( trackEta > coneRadius || trackEta < -coneRadius ) tracksEtaPhi->AddLine(0., 0., 0., trackEnd.fX, trackEnd.fY, trackEnd.fZ); else tracksSeedEtaPhi->AddLine(0., 0., 0., trackEnd.fX, trackEnd.fY, trackEnd.fZ); } // ----------------------------------------------------------------------- // -- Draw cones // ----------------------------------------------------------------------- for ( Int_t iter = 0; iter < nCones; ++iter ) { // -- Get Random ( eta ,phi ) Float_t coneEta = r.Uniform(-0.9, 0.9); Float_t conePhi = r.Uniform(0.0, TwoPi() ); // -- Primary vertx as origin TEveVector coneOrigin(0.0,0.0,0.0); // -- Get Cone Axis - axis line 10% longer than cone height TEveVector coneAxis ( GetTEveVector( coneEta, conePhi) ); coneAxis *= length * 1.1; axis->AddLine( 0., 0., 0., coneAxis.fX, coneAxis.fY, coneAxis.fZ ); // -- Draw jet cone TEveJetCone* jetCone = new TEveJetCone("JetCone"); jetCone->SetPickable(kTRUE); jetCone->SetCylinder( 250., 250. ); if ( (jetCone->AddCone( coneEta, conePhi, coneRadius ) ) != -1) gEve->AddElement( jetCone ); } // ----------------------------------------------------------------------- // -- Add cone axis gEve->AddElement(axis); // -- Add lines // gEve->AddElement(tracksXYZ); gEve->AddElement(tracksSeedEtaPhi); gEve->AddElement(tracksEtaPhi); // -- Load TPC geometry geomGentleTPC(); gEve->Redraw3D(kTRUE); return; }
void VizDB_scan_screen() { TEvePointSet *ps = 0; TEveStraightLineSet *ls = 0; //============================================================================ // Hits //============================================================================ ps = new TEvePointSet(); ps->SetMarkerColor(2); ps->SetMarkerSize(0.5); ps->SetMarkerStyle(2); gEve->InsertVizDBEntry("Hits", ps); ps = new TEvePointSet(); ps->SetMarkerColor(2); ps->SetMarkerSize(0.5); ps->SetMarkerStyle(2); gEve->InsertVizDBEntry("SIM Hits ITS", ps); ps = new TEvePointSet(); ps->SetMarkerColor(3); ps->SetMarkerSize(0.5); ps->SetMarkerStyle(2); gEve->InsertVizDBEntry("SIM Hits TPC", ps); ps = new TEvePointSet(); ps->SetMarkerColor(3); ps->SetMarkerSize(0.5); ps->SetMarkerStyle(4); gEve->InsertVizDBEntry("SIM Hits T0", ps); ps = new TEvePointSet(); ps->SetMarkerColor(2); ps->SetMarkerSize(0.5); ps->SetMarkerStyle(4); gEve->InsertVizDBEntry("SIM Hits FMD", ps); ps = new TEvePointSet(); ps->SetMarkerColor(2); ps->SetMarkerSize(.5); ps->SetMarkerStyle(4); gEve->InsertVizDBEntry("SIM Hits ACORDE", ps); ps = new TEvePointSet(); ps->SetMarkerColor(2); ps->SetMarkerSize(.5); ps->SetMarkerStyle(4); gEve->InsertVizDBEntry("SIM Hits EMCAL", ps); ps = new TEvePointSet(); ps->SetMarkerColor(2); ps->SetMarkerSize(.5); ps->SetMarkerStyle(4); gEve->InsertVizDBEntry("SIM Hits PMD", ps); ps = new TEvePointSet(); ps->SetMarkerColor(2); ps->SetMarkerSize(.5); ps->SetMarkerStyle(4); gEve->InsertVizDBEntry("SIM Hits TOF", ps); ps = new TEvePointSet(); ps->SetMarkerColor(7); ps->SetMarkerSize(.5); ps->SetMarkerStyle(4); gEve->InsertVizDBEntry("SIM Hits TRD", ps); ps = new TEvePointSet(); ps->SetMarkerColor(2); ps->SetMarkerSize(.5); ps->SetMarkerStyle(4); gEve->InsertVizDBEntry("SIM Hits VZERO", ps); //============================================================================ // Clusters //============================================================================ ps = new TEvePointSet(); ps->SetMarkerColor(2); ps->SetMarkerSize(0.5); ps->SetMarkerStyle(2); gEve->InsertVizDBEntry("Clusters", ps); ps = new TEvePointSet(); ps->SetMarkerColor(5); ps->SetMarkerSize(0.2); ps->SetMarkerStyle(2); gEve->InsertVizDBEntry("REC Clusters ITS", ps); ps = new TEvePointSet(); ps->SetMarkerColor(4); ps->SetMarkerSize(0.2); ps->SetMarkerStyle(2); gEve->InsertVizDBEntry("REC Clusters TPC", ps); ps = new TEvePointSet(); ps->SetMarkerColor(7); ps->SetMarkerSize(0.5); ps->SetMarkerStyle(4); gEve->InsertVizDBEntry("REC Clusters TRD", ps); ps = new TEvePointSet(); ps->SetMarkerColor(kOrange); ps->SetMarkerSize(0.5); ps->SetMarkerStyle(4); gEve->InsertVizDBEntry("REC Clusters TOF", ps); ps = new TEvePointSet(); ps->SetMarkerColor(4); ps->SetMarkerSize(0.2); ps->SetMarkerStyle(2); gEve->InsertVizDBEntry("REC Clusters HMPID", ps); ps = new TEvePointSet(); ps->SetMarkerColor(4); ps->SetMarkerSize(0.5); ps->SetMarkerStyle(2); gEve->InsertVizDBEntry("REC Clusters PHOS", ps); //============================================================================ // Primary vertex //============================================================================ // Combined vertex ls = new TEveStraightLineSet; ls->SetMarkerStyle(2); ls->SetMarkerColor(7); ls->SetLineColor(7); ls->SetLineWidth(3); gEve->InsertVizDBEntry("REC PVTX", ls); ls = new TEveStraightLineSet; ls->SetMarkerStyle(2); ls->SetMarkerColor(7); ls->SetLineColor(7); ls->SetLineWidth(1); gEve->InsertVizDBEntry("REC PVTX Ellipse", ls); ls = new TEveStraightLineSet; ls->SetMarkerStyle(2); ls->SetMarkerColor(7); ls->SetLineColor(7); ls->SetLineWidth(1); gEve->InsertVizDBEntry("REC PVTX Box", ls); // SPD vertex ls = new TEveStraightLineSet; ls->SetMarkerStyle(2); ls->SetMarkerColor(6); ls->SetLineColor(6); ls->SetLineWidth(3); gEve->InsertVizDBEntry("REC PVTX SPD", ls); ls = new TEveStraightLineSet; ls->SetMarkerStyle(2); ls->SetMarkerColor(6); ls->SetLineColor(6); ls->SetLineWidth(1); gEve->InsertVizDBEntry("REC PVTX Ellipse SPD", ls); ls = new TEveStraightLineSet; ls->SetMarkerStyle(2); ls->SetMarkerColor(6); ls->SetLineColor(6); ls->SetLineWidth(1); gEve->InsertVizDBEntry("REC PVTX Box SPD", ls); // TPC vertex ls = new TEveStraightLineSet; ls->SetMarkerStyle(2); ls->SetMarkerColor(5); ls->SetLineColor(5); ls->SetLineWidth(3); gEve->InsertVizDBEntry("REC PVTX TPC", ls); ls = new TEveStraightLineSet; ls->SetMarkerStyle(2); ls->SetMarkerColor(5); ls->SetLineColor(5); ls->SetLineWidth(1); gEve->InsertVizDBEntry("REC PVTX Ellipse TPC", ls); ls = new TEveStraightLineSet; ls->SetMarkerStyle(2); ls->SetMarkerColor(5); ls->SetLineColor(5); ls->SetLineWidth(1); gEve->InsertVizDBEntry("REC PVTX Box TPC", ls); //Tracks tl = new TEveTrackList("ESD Tracks"); tl->SetLineStyle(6); tl->SetMainColor(1); tl->SetLineWidth(1); gEve->InsertVizDBEntry("REC Tracks",tl); tl = new TEveTrackList("ESD Tracks MI"); tl->SetLineStyle(6); tl->SetMainColor(1); tl->SetLineWidth(1); gEve->InsertVizDBEntry("REC Tracks MI",tl); TEveElementList* el = new TEveElementList("ESD Tracks by category"); TEveTrackList *tltemp[7]; tltemp[0] = new TEveTrackList("Sigma < 3"); tltemp[0]->SetLineStyle(6); tltemp[0]->SetLineColor(1); tltemp[0]->SetLineWidth(1); el->AddElement(tltemp[0]); tltemp[1] = new TEveTrackList("3 < Sigma < 5"); tltemp[1]->SetLineStyle(6); tltemp[1]->SetLineColor(1); tltemp[1]->SetLineWidth(1); el->AddElement(tltemp[1]); tltemp[2] = new TEveTrackList("5 < Sigma"); tltemp[2]->SetLineStyle(6); tltemp[2]->SetLineColor(1); tltemp[2]->SetLineWidth(1); el->AddElement(tltemp[2]); tltemp[3] = new TEveTrackList("no ITS refit; Sigma < 5"); tltemp[3]->SetLineStyle(6); tltemp[3]->SetLineColor(1); tltemp[3]->SetLineWidth(1); el->AddElement(tltemp[3]); tltemp[4] = new TEveTrackList("no ITS refit; Sigma > 5"); tltemp[4]->SetLineStyle(6); tltemp[4]->SetLineColor(1); tltemp[4]->SetLineWidth(1); el->AddElement(tltemp[4]); tltemp[5] = new TEveTrackList("no TPC refit"); tltemp[5]->SetLineStyle(6); tltemp[5]->SetLineColor(1); tltemp[5]->SetLineWidth(1); el->AddElement(tltemp[5]); tltemp[6] = new TEveTrackList("ITS stand-alone"); tltemp[6]->SetLineStyle(6); tltemp[6]->SetLineColor(1); tltemp[6]->SetLineWidth(1); el->AddElement(tltemp[6]); el->SetVizTag("ESD Tracks by category"); gEve->AddElement(el); TEveElementList* el = new TEveElementList("ESD Tracks by anal cuts"); TEveTrackList *tlac[2]; tlac[0] = new TEveTrackList("Passed"); tlac[0]->SetLineStyle(6); tlac[0]->SetMainColor(1); tlac[0]->SetLineWidth(1); el->AddElement(tlac[0]); tlac[1] = new TEveTrackList("Rejected"); tlac[1]->SetLineStyle(6); tlac[1]->SetMainColor(1); tlac[1]->SetLineWidth(1); el->AddElement(tlac[1]); el->SetVizTag("ESD Tracks by anal cut"); gEve->AddElement(el); TEveElementList* el = new TEveElementList("ESD Tracklets SPD"); TEveTrackList *tlac[2]; tlac[0] = new TEveTrackList("Good"); tlac[0]->SetLineStyle(6); tlac[0]->SetMainColor(1); tlac[0]->SetLineWidth(1); el->AddElement(tlac[0]); tlac[1] = new TEveTrackList("Bad"); tlac[1]->SetLineStyle(6); tlac[1]->SetMainColor(1); tlac[1]->SetLineWidth(1); el->AddElement(tlac[1]); el->SetVizTag("ESD Tracklets SPD"); gEve->AddElement(el); }