#include #include #include #include #include using namespace std; #include #include #include "hdv_mainframe.h" #include "hdview2.h" #include "MyProcessor.h" #include "FDC/DFDCGeometry.h" #include "FCAL/DFCALGeometry.h" #include "DVector2.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include extern JApplication *japp; //TGeoVolume *MOTHER = NULL; //TGeoCombiTrans *MotherRotTrans = NULL; extern int GO; // These values are just used to draw the detectors for visualization. // These should be replaced by a database lookup or something similar // at some point. static float BCAL_Rmin=65.0; static float BCAL_Rmax = 90.0; static float BCAL_Zlen = 390.0; static float BCAL_Zmin = 17.0; static float FCAL_Zlen = 45.0; static float FCAL_Zmin = 622.8; static float FCAL_Rmin = 6.0; static float FCAL_Rmax = 212.0/2.0; static float CDC_Rmin = 9.0; static float CDC_Rmax = 59.0; static float CDC_Zlen = 150.0; static float CDC_Zmin = 17.0; static float TOF_Rmax = 125.0; static float TOF_Rmin = 6.0; static float TOF_Zlen = 2.54; static float TOF_Zmin = 618.8; static float FDC_Rmin = 3.5; static float FDC_Rmax = 48.5; static float TARGET_Zmid = 65.0; static float TARGET_Zlen = 30.0; // The DFCALGeometry object is not really available at the time we need it // when the program first starts. Cretae one of our own here. static DFCALGeometry *fcalgeom = new DFCALGeometry; //------------------- // Constructor //------------------- hdv_mainframe::hdv_mainframe(const TGWindow *p, UInt_t w, UInt_t h):TGMainFrame(p,w,h) { // First, define all of the of the graphics objects. Below that, make all // of the connections to the methods so these things will work! // The main GUI window is divided into three sections, top, middle, and bottom. // Create those frames here. TGLayoutHints *hints = new TGLayoutHints(kLHintsNormal|kLHintsExpandX|kLHintsExpandY, 5,5,5,5); TGLayoutHints *lhints = new TGLayoutHints(kLHintsNormal, 2,2,2,2); TGLayoutHints *rhints = new TGLayoutHints(kLHintsCenterY|kLHintsRight, 2,2,2,2); TGLayoutHints *chints = new TGLayoutHints(kLHintsCenterY|kLHintsCenterX, 2,2,2,2); TGLayoutHints *bhints = new TGLayoutHints(kLHintsBottom|kLHintsCenterX, 2,2,2,2); TGLayoutHints *xhints = new TGLayoutHints(kLHintsNormal|kLHintsExpandX, 2,2,2,2); TGLayoutHints *yhints = new TGLayoutHints(kLHintsNormal|kLHintsExpandY, 2,2,2,2); TGHorizontalFrame *topframe = new TGHorizontalFrame(this, w, h); TGHorizontalFrame *midframe = new TGHorizontalFrame(this, w, h); TGHorizontalFrame *botframe = new TGHorizontalFrame(this, w, h); AddFrame(topframe, lhints); AddFrame(midframe, hints); AddFrame(botframe, lhints); //========== TOP FRAME ============ TGGroupFrame *viewcontrols = new TGGroupFrame(topframe, "View Controls", kHorizontalFrame); TGGroupFrame *eventcontrols = new TGGroupFrame(topframe, "Event Controls", kHorizontalFrame); TGGroupFrame *eventinfo = new TGGroupFrame(topframe, "Info", kHorizontalFrame); TGHorizontalFrame *programcontrols = new TGHorizontalFrame(topframe); topframe->AddFrame(viewcontrols, lhints); topframe->AddFrame(eventcontrols, hints); topframe->AddFrame(eventinfo, yhints); topframe->AddFrame(programcontrols, yhints); //-------------Pan buttons TGHorizontalFrame *pan = new TGHorizontalFrame(viewcontrols); viewcontrols->AddFrame(pan, hints); TGTextButton *left = new TGTextButton(pan, "<-"); TGVerticalFrame *updown = new TGVerticalFrame(pan); TGTextButton *up = new TGTextButton(updown, "^"); TGTextButton *down = new TGTextButton(updown, "V"); updown->AddFrame(up, lhints); updown->AddFrame(down, lhints); TGTextButton *right = new TGTextButton(pan, "->"); pan->AddFrame(left, chints); pan->AddFrame(updown, chints); pan->AddFrame(right, chints); //------------- Zoom/Reset buttons TGVerticalFrame *zoom = new TGVerticalFrame(viewcontrols); viewcontrols->AddFrame(zoom, lhints); TGTextButton *zoomin = new TGTextButton(zoom, "Zoom In"); TGTextButton *zoomout = new TGTextButton(zoom, "Zoom Out"); TGTextButton *reset = new TGTextButton(zoom, "Reset"); zoom->AddFrame(zoomin, lhints); zoom->AddFrame(zoomout, lhints); zoom->AddFrame(reset, lhints); //-------------- Transverse Coordinates TGVButtonGroup *coordinates = new TGVButtonGroup(viewcontrols,"Transverse Coordinates"); viewcontrols->AddFrame(coordinates, lhints); TGRadioButton *xy = new TGRadioButton(coordinates, "x/y"); new TGRadioButton(coordinates, "r/phi"); //-------------- Next, Previous TGTextButton *prev = new TGTextButton(eventcontrols, "<-- Prev"); TGTextButton *next = new TGTextButton(eventcontrols, "Next -->"); TGVerticalFrame *contf = new TGVerticalFrame(eventcontrols); eventcontrols->AddFrame(prev, chints); eventcontrols->AddFrame(next, chints); eventcontrols->AddFrame(contf, lhints); // continuous, delay checkbuttons["continuous"] = new TGCheckButton(contf, "continuous"); TGHorizontalFrame *delayf = new TGHorizontalFrame(contf); contf->AddFrame(checkbuttons["continuous"], lhints); contf->AddFrame(delayf, lhints); TGLabel *delaylab = new TGLabel(delayf, "delay:"); delay = new TGComboBox(delayf, "0.25"); delay->Resize(50,20); float delays[]={0, 0.25, 0.5, 1, 2, 3, 5, 10}; for(int i=0; i<8; i++){ stringstream ss; ss<AddEntry(ss.str().c_str(),i); } delayf->AddFrame(delaylab, lhints); delayf->AddFrame(delay, lhints); //----------------- Event Info TGVerticalFrame *eventlabs = new TGVerticalFrame(eventinfo); TGVerticalFrame *eventvals = new TGVerticalFrame(eventinfo); eventinfo->AddFrame(eventlabs, lhints); eventinfo->AddFrame(eventvals, lhints); TGLabel *runlab = new TGLabel(eventlabs, "Run:"); TGLabel *eventlab = new TGLabel(eventlabs, "Event:"); run = new TGLabel(eventvals, "----------"); event = new TGLabel(eventvals, "----------"); eventlabs->AddFrame(runlab, rhints); eventlabs->AddFrame(eventlab,rhints); eventvals->AddFrame(run, lhints); eventvals->AddFrame(event, lhints); //-------------- Program Controls TGTextButton *quit = new TGTextButton(programcontrols, "&Quit"); programcontrols->AddFrame(quit, rhints); //========== MID FRAME ============ TGHorizontalFrame *detectorframe = new TGHorizontalFrame(midframe); midframe->AddFrame(detectorframe, hints); //------ Detector Frame ------ TGVerticalFrame *sideviews = new TGVerticalFrame(detectorframe); TGVerticalFrame *endviews = new TGVerticalFrame(detectorframe); TGVerticalFrame *drawopts = new TGVerticalFrame(detectorframe); detectorframe->AddFrame(sideviews, lhints); detectorframe->AddFrame(endviews, lhints); detectorframe->AddFrame(drawopts, lhints); // Side views int width=500; sideviewA = new TRootEmbeddedCanvas("sideviewA Canvas", sideviews, width, width/2, kSunkenFrame, GetWhitePixel()); sideviewB = new TRootEmbeddedCanvas("sideviewB Canvas", sideviews, width, width/2, kSunkenFrame, GetWhitePixel()); sideviews->AddFrame(sideviewA, lhints); sideviews->AddFrame(sideviewB, lhints); sideviewA->SetScrolling(TGCanvas::kCanvasNoScroll); sideviewB->SetScrolling(TGCanvas::kCanvasNoScroll); // End views endviewA = new TRootEmbeddedCanvas("endviewA Canvas", endviews, width/2, width/2, kSunkenFrame, GetWhitePixel()); endviewB = new TRootEmbeddedCanvas("endviewB Canvas", endviews, width/2, width/2, kSunkenFrame, GetWhitePixel()); endviews->AddFrame(endviewA, lhints); endviews->AddFrame(endviewB, lhints); endviewA->SetScrolling(TGCanvas::kCanvasNoScroll); endviewB->SetScrolling(TGCanvas::kCanvasNoScroll); // Draw opts TGGroupFrame *trkdrawopts = new TGGroupFrame(drawopts, "Track Draw Options", kVerticalFrame); TGGroupFrame *hitdrawopts = new TGGroupFrame(drawopts, "Hit Draw Options", kVerticalFrame); drawopts->AddFrame(trkdrawopts, lhints); drawopts->AddFrame(hitdrawopts, hints); // Track TGHorizontalFrame *candidatesf = new TGHorizontalFrame(trkdrawopts); checkbuttons["candidates"] = new TGCheckButton(candidatesf, "DTrackCandidate:"); candidatesfactory = new TGComboBox(candidatesf, "", 0); candidatesfactory->Resize(80,20); candidatesf->AddFrame(checkbuttons["candidates"], lhints); candidatesf->AddFrame(candidatesfactory, lhints); candidatesfactory->AddEntry("",0); trkdrawopts->AddFrame(candidatesf, lhints); TGHorizontalFrame *tracksf = new TGHorizontalFrame(trkdrawopts); checkbuttons["tracks"] = new TGCheckButton(tracksf, "DTrack:"); tracksfactory = new TGComboBox(tracksf, "", 0); tracksfactory->Resize(80,20); tracksf->AddFrame(checkbuttons["tracks"], lhints); tracksf->AddFrame(tracksfactory, lhints); tracksfactory->AddEntry("",0); trkdrawopts->AddFrame(tracksf, lhints); checkbuttons["thrown"] = new TGCheckButton(trkdrawopts, "DMCThrown"); checkbuttons["trajectories"] = new TGCheckButton(trkdrawopts, "DMCTrajectoryPoint"); trkdrawopts->AddFrame(checkbuttons["thrown"], lhints); trkdrawopts->AddFrame(checkbuttons["trajectories"], lhints); // Hit checkbuttons["cdc"] = new TGCheckButton(hitdrawopts, "CDC"); checkbuttons["cdctruth"] = new TGCheckButton(hitdrawopts, "CDCTruth"); checkbuttons["fdcwire"] = new TGCheckButton(hitdrawopts, "FDC Wire"); checkbuttons["fdcpseudo"] = new TGCheckButton(hitdrawopts, "FDC Pseudo"); checkbuttons["fdcintersection"] = new TGCheckButton(hitdrawopts, "FDC Intersection"); checkbuttons["fdctruth"] = new TGCheckButton(hitdrawopts, "FDCTruth"); checkbuttons["tof"] = new TGCheckButton(hitdrawopts, "TOF"); checkbuttons["toftruth"] = new TGCheckButton(hitdrawopts, "TOFTruth"); checkbuttons["fcal"] = new TGCheckButton(hitdrawopts, "FCAL"); checkbuttons["fcaltruth"] = new TGCheckButton(hitdrawopts, "FCALTruth"); checkbuttons["bcal"] = new TGCheckButton(hitdrawopts, "BCAL"); checkbuttons["bcaltruth"] = new TGCheckButton(hitdrawopts, "BCALTruth"); hitdrawopts->AddFrame(checkbuttons["cdc"], lhints); hitdrawopts->AddFrame(checkbuttons["cdctruth"], lhints); hitdrawopts->AddFrame(checkbuttons["fdcwire"], lhints); hitdrawopts->AddFrame(checkbuttons["fdcpseudo"], lhints); hitdrawopts->AddFrame(checkbuttons["fdcintersection"], lhints); hitdrawopts->AddFrame(checkbuttons["fdctruth"], lhints); hitdrawopts->AddFrame(checkbuttons["tof"], lhints); hitdrawopts->AddFrame(checkbuttons["toftruth"], lhints); hitdrawopts->AddFrame(checkbuttons["fcal"], lhints); hitdrawopts->AddFrame(checkbuttons["fcaltruth"], lhints); hitdrawopts->AddFrame(checkbuttons["bcal"], lhints); hitdrawopts->AddFrame(checkbuttons["bcaltruth"], lhints); //========== BOT FRAME ============ TGGroupFrame *trackinfo = new TGGroupFrame(botframe, "Track Info", kHorizontalFrame); botframe->AddFrame(trackinfo, xhints); //------ Track Info ------ TGGroupFrame *throwninfo = new TGGroupFrame(trackinfo, "Thrown", kHorizontalFrame); TGGroupFrame *reconinfo = new TGGroupFrame(trackinfo, "Reconstructed", kHorizontalFrame); trackinfo->AddFrame(throwninfo, lhints); trackinfo->AddFrame(reconinfo, lhints); // Column names vector colnames; colnames.push_back("trk"); colnames.push_back("type"); colnames.push_back("p"); colnames.push_back("theta"); colnames.push_back("phi"); colnames.push_back("z"); // Create a vertical frame for each column and insert the label as the first item for(unsigned int i=0; iAddFrame(tf, bhints); reconinfo->AddFrame(rf, bhints); // create column labels string lab = colnames[i]+":"; TGLabel *tl = new TGLabel(tf, lab.c_str()); TGLabel *rl = new TGLabel(rf, lab.c_str()); tf->AddFrame(tl, chints); rf->AddFrame(rl, chints); vector tv; vector rv; tv.push_back(tl); rv.push_back(rl); // Add 6 labels to each column // These have to be added in reverse order so we can pack them from // the bottom. Otherwise, it doesn't draw correctly. for(int j=0; j<6; j++){ stringstream ss; ss<<(5-j); tl = new TGLabel(tf, i==0 ? ss.str().c_str():"--------"); rl = new TGLabel(rf, i==0 ? ss.str().c_str():"--------"); tf->AddFrame(tl, bhints); rf->AddFrame(rl, bhints); tv.push_back(tl); rv.push_back(rl); } // Record the label object pointers for later use thrownlabs[colnames[i]] = tv; reconlabs[colnames[i]] = rv; } // Reconstruction factory reconfactory = new TGComboBox(reconinfo, "DTrackCandidate:", 0); reconfactory->Resize(160,20); reconfactory->AddEntry("DTrackCandidate:",0); reconinfo->AddFrame(reconfactory, lhints); //&&&&&&&&&&&&&&&& Defaults ReadPreferences(); //checkbuttons["tracks"]->SetState(kButtonDown); //checkbuttons["candidates"]->SetState(kButtonDown); //checkbuttons["thrown"]->SetState(kButtonDown); xy->SetState(kButtonDown,kTRUE); coordinatetype = COORD_XY; //checkbuttons["fdcwire"]->SetState(kButtonDown); //checkbuttons["fdcintersection"]->SetState(kButtonDown); //checkbuttons["trajectories"]->SetState(kButtonDown); r0 = 50.0; phi0 = M_PI; x0 = 0.0; y0 = 0.0; z0 = 350.0; zoom_factor = 1.0; //&&&&&&&&&&&&&&&& Connections left->Connect("Clicked","hdv_mainframe", this, "DoPanLeft()"); up->Connect("Clicked","hdv_mainframe", this, "DoPanUp()"); down->Connect("Clicked","hdv_mainframe", this, "DoPanDown()"); right->Connect("Clicked","hdv_mainframe", this, "DoPanRight()"); zoomin->Connect("Clicked","hdv_mainframe", this, "DoZoomIn()"); zoomout->Connect("Clicked","hdv_mainframe", this, "DoZoomOut()"); reset->Connect("Clicked","hdv_mainframe", this, "DoReset()"); coordinates->Connect("Clicked(Int_t)","hdv_mainframe", this, "DoSetCoordinates(Int_t)"); coordinates->Connect("Clicked(Int_t)","hdv_mainframe", this, "DoRedraw()"); quit->Connect("Clicked","hdv_mainframe", this, "DoQuit()"); next->Connect("Clicked","hdv_mainframe", this, "DoNext()"); prev->Connect("Clicked","hdv_mainframe", this, "DoPrev()"); checkbuttons["continuous"]->Connect("Clicked","hdv_mainframe", this, "DoCont()"); delay->Connect("Selected(Int_t)","hdv_mainframe", this, "DoSetDelay(Int_t)"); checkbuttons["candidates"]->Connect("Clicked","hdv_mainframe", this, "DoRedraw()"); checkbuttons["tracks"]->Connect("Clicked","hdv_mainframe", this, "DoRedraw()"); checkbuttons["thrown"]->Connect("Clicked","hdv_mainframe", this, "DoRedraw()"); checkbuttons["cdc"]->Connect("Clicked","hdv_mainframe", this, "DoRedraw()"); checkbuttons["cdctruth"]->Connect("Clicked","hdv_mainframe", this, "DoRedraw()"); checkbuttons["fdcwire"]->Connect("Clicked","hdv_mainframe", this, "DoRedraw()"); checkbuttons["fdcpseudo"]->Connect("Clicked","hdv_mainframe", this, "DoRedraw()"); checkbuttons["fdcintersection"]->Connect("Clicked","hdv_mainframe", this, "DoRedraw()"); checkbuttons["fdctruth"]->Connect("Clicked","hdv_mainframe", this, "DoRedraw()"); checkbuttons["tof"]->Connect("Clicked","hdv_mainframe", this, "DoRedraw()"); checkbuttons["toftruth"]->Connect("Clicked","hdv_mainframe", this, "DoRedraw()"); checkbuttons["bcal"]->Connect("Clicked","hdv_mainframe", this, "DoRedraw()"); checkbuttons["bcaltruth"]->Connect("Clicked","hdv_mainframe", this, "DoRedraw()"); checkbuttons["fcal"]->Connect("Clicked","hdv_mainframe", this, "DoRedraw()"); checkbuttons["fcaltruth"]->Connect("Clicked","hdv_mainframe", this, "DoRedraw()"); checkbuttons["trajectories"]->Connect("Clicked","hdv_mainframe", this, "DoRedraw()"); candidatesfactory->Connect("Selected(Int_t)","hdv_mainframe", this, "DoRedraw()"); tracksfactory->Connect("Selected(Int_t)","hdv_mainframe", this, "DoRedraw()"); reconfactory->Connect("Selected(Int_t)","hdv_mainframe", this, "DoUpdateTrackLabels()"); // Set up timer to call the DoTimer() method repeatedly // so events can be automatically advanced. timer = new TTimer(); timer->Connect("Timeout()", "hdv_mainframe", this, "DoTimer()"); sleep_time = 250; timer->Start(sleep_time, kFALSE); // Finish up and map the window SetWindowName("Hall-D Event Viewer"); SetIconName("HDView"); MapSubwindows(); Resize(GetDefaultSize()); MapWindow(); } //------------------- // ReadPreferences //------------------- void hdv_mainframe::ReadPreferences(void) { // Preferences file is "${HOME}/.hdview2" const char *home = getenv("HOME"); if(!home)return; // Try and open file string fname = string(home) + "/.hdview2"; ifstream ifs(fname.c_str()); if(!ifs.is_open())return; cout<<"Reading preferences from \""< tokens; string buf; // Have a buffer string stringstream ss(str); // Insert the string into a stream while (ss >> buf)tokens.push_back(buf); if(tokens.size()<1)continue; // Check first token to decide what to do if(tokens[0] == "checkbutton"){ if(tokens.size()!=4)continue; // should be of form "checkbutton name = value" with white space on either side of the "=" map::iterator it = checkbuttons.find(tokens[1]); if(it != checkbuttons.end()){ if(tokens[3] == "on")(it->second)->SetState(kButtonDown); } } if(tokens[0] == "DTrackCandidate"){ if(tokens.size()!=3)continue; // should be of form "DTrackCandidate = tag" with white space on either side of the "=" default_candidate = tokens[2]; } if(tokens[0] == "DTrack"){ if(tokens.size()!=3)continue; // should be of form "DTrack = tag" with white space on either side of the "=" default_track = tokens[2]; } if(tokens[0] == "Reconstructed"){ if(tokens.size()!=3)continue; // should be of form "Reconstructed = Factory:tag" with white space on either side of the "=" default_reconstructed = tokens[2]; } } // close file ifs.close(); } //------------------- // SavePreferences //------------------- void hdv_mainframe::SavePreferences(void) { // Preferences file is "${HOME}/.hdview2" const char *home = getenv("HOME"); if(!home)return; // Try deleting old file and creating new file string fname = string(home) + "/.hdview2"; unlink(fname.c_str()); ofstream ofs(fname.c_str()); if(!ofs.is_open()){ cout<<"Unable to create preferences file \""<::iterator iter; for(iter=checkbuttons.begin(); iter!=checkbuttons.end(); iter++){ TGCheckButton *but = iter->second; if(but->GetState() == kButtonDown){ ofs<<"checkbutton "<<(iter->first)<<" = on"<GetCanvas()->Range(-1, -1, 1, 1); // Set the ranges of all canvases based on // the current units (x/y or r/phi) and the zoom,pan // settings if(coordinatetype==COORD_XY){ // define range in each direction in cm double x_width = 350.0/zoom_factor; double y_width = x_width; double z_width = 2.0*x_width; double xlo = x0 - x_width/2.0; double xhi = x0 + x_width/2.0; double ylo = y0 - y_width/2.0; double yhi = y0 + y_width/2.0; double zlo = z0 - z_width/2.0; double zhi = z0 + z_width/2.0; sideviewA->GetCanvas()->cd(); sideviewA->GetCanvas()->Range(zlo, xlo, zhi, xhi); sideviewB->GetCanvas()->cd(); sideviewB->GetCanvas()->Range(zlo, ylo, zhi, yhi); // Zoom in a little on the end views double end_to_side_ratio=1.8; xlo/=end_to_side_ratio; xhi/=end_to_side_ratio; ylo/=end_to_side_ratio; yhi/=end_to_side_ratio; endviewA->GetCanvas()->cd(); endviewA->GetCanvas()->Range(xlo, ylo, xhi, yhi); endviewB->GetCanvas()->cd(); endviewB->GetCanvas()->Range(xlo*1.3, ylo*1.3, xhi*1.3, yhi*1.3); }else{ // define range in each direction in cm, radians double r_width = 400.0/zoom_factor; double phi_width = 2.0*M_PI/zoom_factor; double z_width = 2.0*r_width/zoom_factor; double rlo = r0 - r_width/2.0; double rhi = r0 + r_width/2.0; double philo = phi0 - phi_width/2.0; double phihi = phi0 + phi_width/2.0; double zlo = z0 - z_width/2.0; double zhi = z0 + z_width/2.0; philo = -0.2; phihi = 2.0*M_PI+0.2; sideviewA->GetCanvas()->cd(); sideviewA->GetCanvas()->Range(zlo, rlo, zhi, rhi); sideviewB->GetCanvas()->cd(); sideviewB->GetCanvas()->Range(zlo, philo, zhi, phihi); // Zoom in a little on the end views in A endviewA->GetCanvas()->cd(); endviewA->GetCanvas()->Range(philo, rlo/2.5, phihi, rhi/2.5); endviewB->GetCanvas()->cd(); endviewB->GetCanvas()->Range(philo, rlo/10.0, phihi, rhi/1.9); } } //------------------- // DoQuit //------------------- void hdv_mainframe::DoQuit(void) { SavePreferences(); japp->Quit(); japp->Fini(); delete japp; japp = NULL; // This is supposed to return from the Run() method in "main()" // since we call SetReturnFromRun(true), but it doesn't seem to work. gApplication->Terminate(0); } //------------------- // DoNext //------------------- void hdv_mainframe::DoNext(void) { if(eventloop)eventloop->OneEvent(); } //------------------- // DoPrev //------------------- void hdv_mainframe::DoPrev(void) { //eventloop->GotoEvent(current_eventnumber-1); //eventloop->OneEvent(); } //------------------- // DoStop //------------------- void hdv_mainframe::DoStop(void) { GO = 0; } //------------------- // DoCont //------------------- void hdv_mainframe::DoCont(void) { GO = 1; } //------------------- // DoTimer //------------------- void hdv_mainframe::DoTimer(void) { /// This gets called periodically (value is set in constructor) /// It is used to automatically call DoNext() periodically /// so long as the global GO is set to 1. if(GetCheckButton("continuous")){ DoNext(); if(sleep_time != (long)timer->GetTime())timer->SetTime(sleep_time); }else{ if(sleep_time == 0)timer->SetTime(10); } } //------------------- // DoPanLeft //------------------- void hdv_mainframe::DoPanLeft(void) { x0 -= 50/zoom_factor; SetRange(); DoRedraw(); //if(gMYPROC)gMYPROC->evnt(eventloop, current_eventnumber); } //------------------- // DoPanUp //------------------- void hdv_mainframe::DoPanUp(void) { y0 += 50/zoom_factor; SetRange(); DoRedraw(); //if(gMYPROC)gMYPROC->evnt(eventloop, current_eventnumber); } //------------------- // DoPanDown //------------------- void hdv_mainframe::DoPanDown(void) { y0 -= 50/zoom_factor; SetRange(); DoRedraw(); //if(gMYPROC)gMYPROC->evnt(eventloop, current_eventnumber); } //------------------- // DoPanRight //------------------- void hdv_mainframe::DoPanRight(void) { x0 += 50/zoom_factor; SetRange(); DoRedraw(); //if(gMYPROC)gMYPROC->evnt(eventloop, current_eventnumber); } //------------------- // DoZoomIn //------------------- void hdv_mainframe::DoZoomIn(void) { zoom_factor*=1.25; SetRange(); DoRedraw(); //if(gMYPROC)gMYPROC->evnt(eventloop, current_eventnumber); } //------------------- // DoZoomOut //------------------- void hdv_mainframe::DoZoomOut(void) { zoom_factor/=1.25; SetRange(); DoRedraw(); //if(gMYPROC)gMYPROC->evnt(eventloop, current_eventnumber); } //------------------- // DoReset //------------------- void hdv_mainframe::DoReset(void) { x0 = 0.0; y0 = 0.0; z0 = 350.0; zoom_factor = 1.0; DoRedraw(); } //------------------- // DoRedraw //------------------- void hdv_mainframe::DoRedraw(void) { // Make sure canvases have proper ranges SetRange(); // Delete any existing graphics objects for(unsigned int i=0; iFillGraphics(); // Draw detector hits and tracks for the correct coordinates in all views vector::iterator iter = gMYPROC->graphics.begin(); for(; iter!=gMYPROC->graphics.end(); iter++){ if(iter->type==MyProcessor::kMarker){ // Markers TPolyMarker *sA = new TPolyMarker(); TPolyMarker *sB = new TPolyMarker(); TPolyMarker *eA = new TPolyMarker(); sA->SetMarkerColor(iter->color); sB->SetMarkerColor(iter->color); eA->SetMarkerColor(iter->color); sA->SetMarkerSize(iter->size); sB->SetMarkerSize(iter->size); eA->SetMarkerSize(iter->size); sA->SetMarkerStyle(8); sB->SetMarkerStyle(8); eA->SetMarkerStyle(8); FillPoly(sA, sB, eA, iter->points); // in hdv_mainframe.h }else{ // Lines TPolyLine *sA = new TPolyLine(); TPolyLine *sB = new TPolyLine(); TPolyLine *eA = new TPolyLine(); sA->SetLineColor(iter->color); sB->SetLineColor(iter->color); eA->SetLineColor(iter->color); sA->SetLineWidth(iter->size); sB->SetLineWidth(iter->size); eA->SetLineWidth(iter->size); FillPoly(sA, sB, eA, iter->points); // in hdv_mainframe.h // Axial CDC wires will end up as having zero length in the end view // so we draw an additional marker in the end view for those cases. if(eA->GetN()==2){ double *x = eA->GetX(); double *y = eA->GetY(); if((x[0]==x[1]) && (y[0]==y[1])){ TMarker *m = new TMarker(x[0], y[0], 8); m->SetMarkerColor(iter->color); m->SetMarkerSize(0.5); graphics_endA.push_back(m); } } } } // Draw everything endviewA->GetCanvas()->cd(0); for(unsigned int i=0; iDraw(); endviewA->GetCanvas()->Update(); endviewB->GetCanvas()->cd(0); for(unsigned int i=0; iDraw("f"); for(unsigned int i=0; iDraw(); endviewB->GetCanvas()->Update(); sideviewA->GetCanvas()->cd(0); for(unsigned int i=0; iDraw(); sideviewA->GetCanvas()->Update(); sideviewB->GetCanvas()->cd(0); for(unsigned int i=0; iDraw(); sideviewB->GetCanvas()->Update(); // Update track labels DoUpdateTrackLabels(); } //------------------- // DoSetDelay //------------------- void hdv_mainframe::DoSetDelay(Int_t id) { stringstream ss; ss<GetSelectedEntry()->GetTitle(); double seconds; ss>>seconds; sleep_time = (int)(1000.0*seconds); timer->SetTime(sleep_time); } //------------------- // DoSetCoordinates //------------------- void hdv_mainframe::DoSetCoordinates(Int_t id) { coordinatetype = (coordsys_t)id; } //------------------- // DoUpdateTrackLabels //------------------- void hdv_mainframe::DoUpdateTrackLabels(void) { gMYPROC->UpdateTrackLabels(); } //------------------- // DrawDetectorsXY //------------------- void hdv_mainframe::DrawDetectorsXY(void) { //============== Side A { sideviewA->GetCanvas()->cd(0); sideviewA->GetCanvas()->Clear(); // ------ Target ------ TBox *target = new TBox(TARGET_Zmid-TARGET_Zlen/2.0, -0.5, TARGET_Zmid+TARGET_Zlen/2.0, +0.5); target->SetFillColor(13); graphics_sideA.push_back(target); // ----- BCAL ------ TBox *bcal1 = new TBox(BCAL_Zmin, BCAL_Rmin, BCAL_Zmin+BCAL_Zlen, BCAL_Rmax); TBox *bcal2 = new TBox(BCAL_Zmin, -BCAL_Rmin, BCAL_Zmin+BCAL_Zlen, -BCAL_Rmax); bcal1->SetFillColor(28); bcal2->SetFillColor(28); graphics_sideA.push_back(bcal1); graphics_sideA.push_back(bcal2); // ----- CDC ------ TBox *cdc1 = new TBox(CDC_Zmin, CDC_Rmin, CDC_Zmin + CDC_Zlen, CDC_Rmax); TBox *cdc2 = new TBox(CDC_Zmin, -CDC_Rmin, CDC_Zmin + CDC_Zlen, -CDC_Rmax); cdc1->SetFillColor(17); cdc2->SetFillColor(17); graphics_sideA.push_back(cdc1); graphics_sideA.push_back(cdc2); // ----- FDC ------ for(int i=0; i<4; i++){ // Get FDC package positions from FDC library float zu = (DFDCGeometry::GetDFDCWire(1+i*12,1))->origin.z(); float zd = (DFDCGeometry::GetDFDCWire(1+i*12+11,1))->origin.z(); TBox *fdc1 = new TBox(zu, FDC_Rmin, zd, FDC_Rmax); TBox *fdc2 = new TBox(zu, -FDC_Rmin, zd, -FDC_Rmax); fdc1->SetFillColor(21); fdc2->SetFillColor(21); graphics_sideA.push_back(fdc1); graphics_sideA.push_back(fdc2); } // ----- TOF ------ TBox *tof1 = new TBox(TOF_Zmin, TOF_Rmin, TOF_Zmin+TOF_Zlen, TOF_Rmax); TBox *tof2 = new TBox(TOF_Zmin, -TOF_Rmin, TOF_Zmin+TOF_Zlen, -TOF_Rmax); tof1->SetFillColor(11); tof2->SetFillColor(11); graphics_sideA.push_back(tof1); graphics_sideA.push_back(tof2); // ----- FCAL ------ TBox *fcal1 = new TBox(FCAL_Zmin, FCAL_Rmin, FCAL_Zmin+FCAL_Zlen, FCAL_Rmax); TBox *fcal2 = new TBox(FCAL_Zmin, -FCAL_Rmin, FCAL_Zmin+FCAL_Zlen, -FCAL_Rmax); fcal1->SetFillColor(40); fcal2->SetFillColor(40); graphics_sideA.push_back(fcal1); graphics_sideA.push_back(fcal2); // ------ scale ------ DrawScale(sideviewA->GetCanvas(), graphics_sideA); } //============== Side B { sideviewB->GetCanvas()->cd(0); sideviewB->GetCanvas()->Clear(); // Side B is exactly the same as side A so just copy it for(unsigned int i=0; iClone()); } } //============== End A { endviewB->GetCanvas()->cd(0); endviewB->GetCanvas()->Clear(); // ----- BCAL ------ TEllipse *bcal1 = new TEllipse(0.0, 0.0, BCAL_Rmax, BCAL_Rmax); TEllipse *bcal2 = new TEllipse(0.0, 0.0, BCAL_Rmin, BCAL_Rmin); bcal1->SetFillColor(28); bcal2->SetFillColor(10); graphics_endA.push_back(bcal1); graphics_endA.push_back(bcal2); // ----- CDC ------ TEllipse *cdc1 = new TEllipse(0.0, 0.0, CDC_Rmax, CDC_Rmax); TEllipse *cdc2 = new TEllipse(0.0, 0.0, CDC_Rmin, CDC_Rmin); cdc1->SetFillColor(17); cdc1->SetLineColor(17); cdc2->SetFillColor(10); graphics_endA.push_back(cdc1); graphics_endA.push_back(cdc2); // ----- FDC ------ TEllipse *fdc1 = new TEllipse(0.0, 0.0, FDC_Rmax, FDC_Rmax); TEllipse *fdc2 = new TEllipse(0.0, 0.0, FDC_Rmin, FDC_Rmin); fdc1->SetFillColor(21); fdc1->SetLineColor(21); fdc2->SetFillColor(10); fdc2->SetLineColor(10); graphics_endA.push_back(fdc1); graphics_endA.push_back(fdc2); // ----- TARGET ------ TEllipse *target = new TEllipse(0.0, 0.0, 0.5, 0.5); target->SetFillColor(13); graphics_endA.push_back(target); // ------ scale ------ DrawScale(endviewA->GetCanvas(), graphics_endA); } //============== End B { endviewB->GetCanvas()->cd(0); endviewB->GetCanvas()->Clear(); // ----- FCAL ------ // Get list of blocks. Loop over all getting x,y coordinates of corners for all active ones. // Set up 4 2-D vectors that point from the center of a block to its // corners. This makes it easier to represent each corner as a vector // in lab corrdinate whch we can extract r, phi from. double blocksize = fcalgeom->blockSize(); DVector2 shift[4]; shift[0].Set(-blocksize/2, -blocksize/2); // these are ordered such that they shift[1].Set(-blocksize/2, +blocksize/2); // go in a clockwise manner. This shift[2].Set(+blocksize/2, +blocksize/2); // ensures the r/phi cooridinates also shift[3].Set(+blocksize/2, -blocksize/2); // define a single enclosed space fcalblocks.clear(); #if 0 for(int chan=0; chanrow(chan); int col = fcalgeom->column(chan); if(!fcalgeom->isBlockActive(row, col))continue; double x[4], y[4]; for(int i=0; i<4; i++){ DVector2 pos = shift[i] + fcalgeom->positionOnFace(chan); x[i] = pos.X(); y[i] = pos.Y(); } TPolyLine *poly = new TPolyLine(4, x, y); poly->SetFillColor(18); poly->SetLineColor(kBlack); graphics_endB.push_back(poly); fcalblocks[chan] = poly; // record so we can set the color later } #endif // ------ scale ------ DrawScale(endviewB->GetCanvas(), graphics_endB); } //=============== Draw axes arrows // (this is done here since the sideB graphics are copied from sideA) DrawAxes(sideviewA->GetCanvas(), graphics_sideA, "Z", "X"); DrawAxes(sideviewB->GetCanvas(), graphics_sideB, "Z", "Y"); DrawAxes(endviewA->GetCanvas(), graphics_endA, "X", "Y"); DrawAxes(endviewB->GetCanvas(), graphics_endB, "X", "Y"); } //------------------- // DrawDetectorsRPhi //------------------- void hdv_mainframe::DrawDetectorsRPhi(void) { //============== Side A R vs. z { sideviewA->GetCanvas()->cd(0); sideviewA->GetCanvas()->Clear(); // ------ Target ------ TBox *target = new TBox(TARGET_Zmid-TARGET_Zlen/2.0, 0.0, TARGET_Zmid+TARGET_Zlen/2.0, 0.5); target->SetFillColor(13); graphics_sideA.push_back(target); // ----- BCAL ------ TBox *bcal1 = new TBox(BCAL_Zmin, BCAL_Rmin, BCAL_Zmin+BCAL_Zlen, BCAL_Rmax); bcal1->SetFillColor(28); graphics_sideA.push_back(bcal1); // ----- CDC ------ TBox *cdc1 = new TBox(CDC_Zmin, CDC_Rmin, CDC_Zmin + CDC_Zlen, CDC_Rmax); cdc1->SetFillColor(17); graphics_sideA.push_back(cdc1); // ----- FDC ------ for(int i=0; i<4; i++){ // Get FDC package positions from FDC library float zu = (DFDCGeometry::GetDFDCWire(1+i*6,1))->origin.z(); float zd = (DFDCGeometry::GetDFDCWire(1+i*6+5,1))->origin.z(); TBox *fdc1 = new TBox(zu, FDC_Rmin, zd, FDC_Rmax); fdc1->SetFillColor(21); graphics_sideA.push_back(fdc1); } // ----- TOF ------ TBox *tof1 = new TBox(TOF_Zmin, TOF_Rmin, TOF_Zmin+TOF_Zlen, TOF_Rmax); tof1->SetFillColor(11); graphics_sideA.push_back(tof1); // ----- FCAL ------ TBox *fcal1 = new TBox(FCAL_Zmin, FCAL_Rmin, FCAL_Zmin+FCAL_Zlen, FCAL_Rmax); fcal1->SetFillColor(40); graphics_sideA.push_back(fcal1); // ------ scale ------ DrawScale(endviewA->GetCanvas(), graphics_endA); } //============== Side B Phi vs. z { sideviewB->GetCanvas()->cd(0); sideviewB->GetCanvas()->Clear(); // ------ Target ------ TBox *target = new TBox(TARGET_Zmid-TARGET_Zlen/2.0, 0.0, TARGET_Zmid+TARGET_Zlen/2.0, 2.0*M_PI); target->SetFillColor(13); graphics_sideB.push_back(target); // ----- BCAL ------ TBox *bcal1 = new TBox(BCAL_Zmin, 0.0, BCAL_Zmin+BCAL_Zlen, 2.0*M_PI); bcal1->SetFillColor(28); graphics_sideB.push_back(bcal1); // ----- CDC ------ TBox *cdc1 = new TBox(CDC_Zmin, 0.0, CDC_Zmin + CDC_Zlen, 2.0*M_PI); cdc1->SetFillColor(17); graphics_sideB.push_back(cdc1); // ----- FDC ------ for(int i=0; i<4; i++){ // Get FDC package positions from FDC library float zu = (DFDCGeometry::GetDFDCWire(1+i*6,1))->origin.z(); float zd = (DFDCGeometry::GetDFDCWire(1+i*6+5,1))->origin.z(); TBox *fdc1 = new TBox(zu, 0.0, zd, 2.0*M_PI); fdc1->SetFillColor(21); graphics_sideB.push_back(fdc1); } // ----- TOF ------ TBox *tof1 = new TBox(TOF_Zmin, 0.0, TOF_Zmin+TOF_Zlen, 2.0*M_PI); tof1->SetFillColor(11); graphics_sideB.push_back(tof1); // ----- FCAL ------ TBox *fcal1 = new TBox(FCAL_Zmin, 0.0, FCAL_Zmin+FCAL_Zlen, 2.0*M_PI); fcal1->SetFillColor(40); graphics_sideB.push_back(fcal1); // ------ scale ------ DrawScale(endviewA->GetCanvas(), graphics_endA); } //============== End A R vs. phi { endviewA->GetCanvas()->cd(0); endviewA->GetCanvas()->Clear(); // ----- BCAL ------ TBox *bcal1 = new TBox(0.0, BCAL_Rmin, 2.0*M_PI, BCAL_Rmax); bcal1->SetFillColor(28); graphics_endA.push_back(bcal1); // ----- CDC ------ TBox *cdc1 = new TBox(0.0, CDC_Rmin, 2.0*M_PI, CDC_Rmax); cdc1->SetFillColor(17); graphics_endA.push_back(cdc1); // ----- FDC ------ TBox *fdc1 = new TBox(0.0, FDC_Rmin, 2.0*M_PI, FDC_Rmax); fdc1->SetFillColor(21); graphics_endA.push_back(fdc1); // ----- TARGET ------ TBox *target = new TBox(0.0, 0.0, 2.0*M_PI, 0.5); target->SetFillColor(13); graphics_endA.push_back(target); } //============== End B R vs. phi { endviewB->GetCanvas()->cd(0); endviewB->GetCanvas()->Clear(); // ----- FCAL ------ // Get list of blocks. Loop over all getting x,y coordinates of corners for all active ones. // Set up 4 2-D vectors that point from the center of a block to its // corners. This makes it easier to represent each corner as a vector // in lab corrdinate whch we can extract r, phi from. double blocksize = fcalgeom->blockSize(); DVector2 shift[4]; shift[0].Set(-blocksize/2, -blocksize/2); // these are ordered such that they shift[1].Set(-blocksize/2, +blocksize/2); // go in a clockwise manner. This shift[2].Set(+blocksize/2, +blocksize/2); // ensures the r/phi cooridinates also shift[3].Set(+blocksize/2, -blocksize/2); // define a single enclosed space fcalblocks.clear(); for(int chan=0; chanrow(chan); int col = fcalgeom->column(chan); if(!fcalgeom->isBlockActive(row, col))continue; double r[4], phi[4]; for(int i=0; i<4; i++){ DVector2 pos = shift[i] + fcalgeom->positionOnFace(chan); r[i] = pos.Mod(); phi[i] = pos.Phi_0_2pi(pos.Phi()); } TPolyLine *poly = new TPolyLine(4, phi, r); poly->SetFillColor(18); poly->SetLineColor(kBlack); graphics_endB.push_back(poly); fcalblocks[chan] = poly; // record so we can set the color later } } //=============== Draw axes arrows DrawAxes(sideviewA->GetCanvas(), graphics_sideA, "Z", "R"); DrawAxes(sideviewB->GetCanvas(), graphics_sideB, "Z", "#phi"); DrawAxes(endviewA->GetCanvas(), graphics_endA, "#phi", "R"); DrawAxes(endviewB->GetCanvas(), graphics_endB, "#phi", "R"); } //------------------- // DrawAxes //------------------- void hdv_mainframe::DrawAxes(TCanvas *c, vector &graphics, const char *xlab, const char *ylab) { /// Create arrows indicating x and y axes with labels on the specified canvas /// and add them to the specified container of graphics objects to be draw later. double x1 = c->GetX1(); double x2 = c->GetX2(); double y1 = c->GetY1(); double y2 = c->GetY2(); double deltax = x2-x1; deltax *= c->GetYsizeReal()/c->GetXsizeReal(); double deltay = y2-y1; double xlo = x1+0.04*deltax; double xhi = xlo + 0.075*deltax; double ylo = y1+0.04*deltay; double yhi = ylo + 0.075*deltay; TArrow *yarrow = new TArrow(xlo, ylo, xlo, yhi, 0.02, ">"); yarrow->SetLineWidth(1.5); graphics.push_back(yarrow); TLatex *ylabel = new TLatex(xlo, yhi+0.005*deltay, ylab); ylabel->SetTextAlign(21); graphics.push_back(ylabel); TArrow *xarrow = new TArrow(xlo, ylo, xhi, ylo, 0.02, ">"); xarrow->SetLineWidth(1.5); graphics.push_back(xarrow); TLatex *xlabel = new TLatex(xhi+0.005*deltax, ylo, xlab); xlabel->SetTextAlign(12); graphics.push_back(xlabel); } //------------------- // DrawScale //------------------- void hdv_mainframe::DrawScale(TCanvas *c, vector &graphics) { /// Create a scale label on the specified canvas and add it /// to the specified container of graphics objects to be draw later. double x1 = c->GetX1(); double x2 = c->GetX2(); double y1 = c->GetY1(); double y2 = c->GetY2(); double deltax = x2-x1; double deltay = y2-y1; double p = floor(log(0.1*deltax)/log(10.0)); double m = floor(0.1*deltax/pow(10.0, p) + 0.5); double xlo = x1+0.72*deltax; double xhi = xlo + m*pow(10.0, p); double y = y1+0.04*deltay; TArrow *arrow = new TArrow(xlo, y, xhi, y, 0.02, "|-|"); arrow->SetLineWidth(1.0); graphics.push_back(arrow); const char *units=""; switch((int)p){ case -5: units = "#mum"; break; case -4: m*=10.0; units = "#mum"; break; case -3: m*=100.0; units = "#mum"; break; case -2: units="mm"; break; case -1: m*=10.0; units="mm"; break; case 0: units = "cm"; break; case 1: m*=10.0; units = "cm"; break; case 2: units = "m"; break; case 3: m*=10.0; units = "m"; break; case 4: m*=100.0; units = "m"; break; case 5: units = "km"; break; case 6: m*=10.0; units = "km"; break; } char str[256]; sprintf(str,"%d %s", (int)m, units); TLatex *label = new TLatex(xhi+0.01*deltax, y, str); label->SetTextAlign(12); graphics.push_back(label); } //------------------- // SetEvent //------------------- void hdv_mainframe::SetEvent(int id) { char str[256]; sprintf(str,"%5d", id); event->SetTitle(str); event->Draw(); } //------------------- // SetTrackFactories //------------------- void hdv_mainframe::SetTrackFactories(vector &facnames) { /// Filter out the factories that provide "DTrack" objects /// and add their tags to the tracksfactory combobox. // Erase all current entries in the combobox and add back in // "". tracksfactory->RemoveAll(); tracksfactory->AddEntry("", 0); tracksfactory->Select(0, kFALSE); for(unsigned int i=0; i< facnames.size(); i++){ string name = "DTrack:"; string::size_type pos = facnames[i].find(name); if(pos==string::npos)continue; string tag = facnames[i]; tag.erase(0, name.size()); tracksfactory->AddEntry(tag.c_str(), i+1); if(tag==default_track){ tracksfactory->Select(i, kTRUE); tracksfactory->GetTextEntry()->SetText(tag.c_str()); } } tracksfactory->GetTextEntry()->SetText(""); } //------------------- // SetCandidateFactories //------------------- void hdv_mainframe::SetCandidateFactories(vector &facnames) { /// Filter out the factories that provide "DTrackCandidate" objects /// and add their tags to the tracksfactory combobox. // Erase all current entries in the combobox and add back in // "". candidatesfactory->RemoveAll(); candidatesfactory->AddEntry("", 0); candidatesfactory->Select(0, kFALSE); for(unsigned int i=0; i< facnames.size(); i++){ string name = "DTrackCandidate:"; string::size_type pos = facnames[i].find(name); if(pos==string::npos)continue; string tag = facnames[i]; tag.erase(0, name.size()); candidatesfactory->AddEntry(tag.c_str(), i); if(tag==default_candidate){ candidatesfactory->Select(i, kTRUE); candidatesfactory->GetTextEntry()->SetText(tag.c_str()); } } } //------------------- // SetReconstructedFactories //------------------- void hdv_mainframe::SetReconstructedFactories(vector &facnames) { /// Filter out the factories that provide "DTrack" objects /// and add them to the reconfactory combobox. // Erase all current entries in the combobox and add back in // "". int id =0; reconfactory->RemoveAll(); reconfactory->AddEntry("DTrackCandidate:", id++); reconfactory->Select(0, kFALSE); reconfactory->GetTextEntry()->SetText("DTrackCandidate:"); // Add DTrackCandidate factories for(unsigned int i=0; i< facnames.size(); i++){ string name = "DTrackCandidate:"; string::size_type pos = facnames[i].find(name); if(pos==string::npos)continue; string tag = facnames[i].substr(name.size(), facnames[i].size()-name.size()); reconfactory->AddEntry(facnames[i].c_str(), id++); if(facnames[i]==default_reconstructed){ reconfactory->Select(id-1, kTRUE); reconfactory->GetTextEntry()->SetText(facnames[i].c_str()); } } // Add DTrack factories reconfactory->AddEntry("DTrack:", id++); for(unsigned int i=0; i< facnames.size(); i++){ string name = "DTrack:"; string::size_type pos = facnames[i].find(name); if(pos==string::npos)continue; string tag = facnames[i].substr(name.size(), facnames[i].size()-name.size()); reconfactory->AddEntry(facnames[i].c_str(), id++); if(facnames[i]==default_reconstructed){ reconfactory->Select(id-1, kTRUE); reconfactory->GetTextEntry()->SetText(facnames[i].c_str()); } } } //------------------- // GetCheckButton //------------------- bool hdv_mainframe::GetCheckButton(string who) { map::iterator iter = checkbuttons.find(who); if(iter==checkbuttons.end())return false; return iter->second->GetState()==kButtonDown; } //------------------- // GetFactoryTag //------------------- const char* hdv_mainframe::GetFactoryTag(string who) { const char *tag = ""; if(who=="DTrack"){ tag = tracksfactory->GetSelectedEntry()->GetTitle(); } if(who=="DTrackCandidate"){ tag = candidatesfactory->GetSelectedEntry()->GetTitle(); } if(string(tag) == "")tag = ""; return tag; } //------------------- // GetReconFactory //------------------- void hdv_mainframe::GetReconFactory(string &name, string &tag) { string nametag(reconfactory->GetSelectedEntry()->GetTitle()); string::size_type pos = nametag.find(":"); name = nametag.substr(0, pos); tag = nametag.substr(pos+1, nametag.size()-(pos+1)); } //------------------- // GetFCALPolyLine //------------------- TPolyLine* hdv_mainframe::GetFCALPolyLine(int channel) { map::iterator iter = fcalblocks.find(channel); if(iter==fcalblocks.end())return NULL; return iter->second; } //------------------- // GetFCALPolyLine //------------------- TPolyLine* hdv_mainframe::GetFCALPolyLine(float x, float y) { if(!fcalgeom)return NULL; int row = fcalgeom->row(y); int column = fcalgeom->column(x); return GetFCALPolyLine(fcalgeom->channel(row, column)); } //------------------- // AddGraphicsSideA //------------------- void hdv_mainframe::AddGraphicsSideA(vector &v) { for(unsigned int i=0; i &v) { for(unsigned int i=0; i &v) { for(unsigned int i=0; i &v) { for(unsigned int i=0; i