#include #include class MyMainFrame : public TGMainFrame { public: TRootEmbeddedCanvas *fEcan; MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h); virtual ~MyMainFrame(); void DoDraw(Int_t i); void DoExit(); void SetStatusText(const char *txt, Int_t pi); void EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected); ClassDef(MyMainFrame, 0) Int_t index; Int_t ind; }; //_________________________________________________________________________________________ void MyMainFrame::DoDraw(Int_t i) { /* */ TCanvas *c1 = fEcan->GetCanvas(); // cout<<"i ==== "<SetMarkerStyle(2); if(i<24) { sprintf(line,"BB.tp.de.LApedc[%d]:BB.tp.e.LApedc[%d]>>hist",i,i); sprintf(cut,"TMath::Abs(BB.tp.e.Yt_pos[%d])<0.1",i); T->Draw(line,cut); index++; c1->Paint(); c1->Update(); } else DoExit(); } //_________________________________________________________________________________________ void MyMainFrame::DoExit() { printf("Exit application..."); gApplication->Terminate(0); } //__________________________________________________________________________________________ void MyMainFrame::SetStatusText(const char *txt, Int_t pi) { // Set text in status bar. fStatusBar->SetText(txt,pi); } //_________________________________________________________________________________________ void MyMainFrame::EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected) { //if(event==11) DoDraw(index); char *val; val=(char*)malloc(1000); ofstream file; file.open("punch_through_Left.dat", ios::app); cout<<"bar =="<AbsPixeltoX(px),gPad->AbsPixeltoY(py)); file<GetCanvasWindowId(); TCanvas *myc = new TCanvas("MyCanvas", 10,10,wid); fEcan->AdoptCanvas(myc); DoDraw(index); myc->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)","MyMainFrame",this, "EventInfo(Int_t,Int_t,Int_t,TObject*)"); AddFrame(fEcan, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY,0,0,1,1)); // Set a name to the main frame SetWindowName("Embedded Canvas Status Info"); MapSubwindows(); // Initialize the layout algorithm via Resize() Resize(GetDefaultSize()); // Map main frame MapWindow(); TCanvas *c1 = fEcan->GetCanvas(); } //___________________________________________________________________________________ MyMainFrame::~MyMainFrame() { // Clean up main frame... Cleanup(); delete fEcan; } //____________________________________________________________________________________ void BB_punch_left() { Int_t run; Int_t index=0; //Int_t ind=0; Int_t ans; char *file_name; file_name=(char*)malloc(10000); cout<<" Enter run number "<>run; cout<<" Will remove 'punch_through.dat', Contiue (1) Exit(0)"<>ans; if(ans==0) break; if(ans==1) remove("punch_through_Left.dat"); sprintf(file_name,"~/e05102/ROOTfiles/phys_%d.root",run); TFile *f=new TFile(file_name); //T->Draw("fEvtHdr.fEvtType"); // Popup the GUI... new MyMainFrame(gClient->GetRoot(), 200, 200); }