#include #include #include #include "geometry.C" Int_t layer; Int_t index; Int_t evtype; char fname[200],fname2[200]; //the first file needed for the qulitative check of the punch through point and the second file needed for the gain adjustment script 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) }; //_________________________________________________________________________________________ void MyMainFrame::DoDraw(Int_t i) { /* */ int bar[32]={0}; int p_bar[32]={0}; int npads[7]={32, 30, 24, 22, 12, 12, 12}; geometry(&bar[],&p_bar[],layer); TCanvas *c1 = fEcan->GetCanvas(); char *line,*name,*cut; line=(char*)malloc(1000); name=(char*)malloc(1000); cut=(char*)malloc(1000); sprintf(name,"PMT %d left layer %d Vs PMT %d left layer %d",p_bar[i], layer-1,i,layer); TH2 *hist=new TH2F("hist",name,1000,0,3000,1000,0,3000); hist->SetMarkerStyle(2); if(i>hist",p_bar[i],layer,i); } else { sprintf(line,"NA.nd.p%d.la_c[%d]:NA.nd.p%d.la_c[%d]>>hist",layer-1,p_bar[i],layer,i); } sprintf(cut,"TMath::Abs(NA.nd.p%d.ypos[%d])<10 && fEvtHdr.fEvtType==%d",layer,i,evtype); T->Draw(line,cut); index++; c1->Paint(); c1->Update(); cout<<"Layer = "<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) { char *val,val2[50]; val=(char*)malloc(1000); ofstream file,file2; file.open(fname, ios::app); file2.open(fname2, ios::app); cout<<"bar =="<AbsPixeltoX(px),gPad->AbsPixeltoY(py)); sprintf(val2,"%d %.1f",index-1,gPad->AbsPixeltoX(px)); 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 NA_punch_left() { Int_t run; index=0; // layer=4; Int_t ans; char *file_name; file_name=(char*)malloc(10000); cout<<" Enter run number "<>run; cout<<" Enter Triger type for singles "<>evtype; cout<<" Enter Layer number to calibrate"<>layer; cout<<" Will remove previous dat file, Contiue (1) Exit(0)"<>ans; sprintf(fname,"punch_through_left_%d.dat",layer); sprintf(fname2,"L%d_adc.dat",layer); if(ans==0) break; if(ans==1) {remove(fname); remove(fname2);} // sprintf(file_name,"~/e05102/ROOTfiles/phys_%d.root",run); sprintf(file_name,"~/E01015/Rootfiles/e01015_ND_%d.root",run); TFile *f=new TFile(file_name); // Popup the GUI... new MyMainFrame(gClient->GetRoot(), 200, 200); }