void phatic(Int_t flag = 0) { // Macro phatic.C for interactive control of the MDC1 overall event // loop macro phat.C; phatic isn't needed if running batch. DMcL 8/22/98 // phatic uses the simple tools TButton and the methods obtained // by loading the root tutorial macro dialog.C (done in phat.C). // phatic calls another macro phatset which stores as static the // results of button changes so they may be retrieved by phat.C // asynchronously. // For flag = 1, the initial canvas is brought up which allows one // to turn on one or more phat "processors"; these all run in batch. // For flag = 2, the run phase canvas appears with run state and // display controls. // For flag = 3, final displays and output writing are controlled. // //////////////////////////////////////////////////////////////////////////// if(flag == 1) { // Draw the bar canvas on which the control buttons appear bar = new TCanvas("PHAT INIT","PHAT INIT",-50,670,900,150); bar->SetEditable(0); bar->SetFillColor(38); bar->SetFillStyle(3014); bar->Draw(); // "GO" button at left TButton *but1 = new TButton("GO","phatset(5,1);", .02,.12,.15,.88); but1->SetFillColor(2); but1->SetTextColor(10); but1->SetTextSize(0.70); but1->Draw(); // "Input" button TButton *but2 = new TButton("Input","phatset(1,1);", .18,.55,.28,.88); but2->SetFillColor(7); but2->SetTextColor(1); but2->SetTextSize(0.50); but2->Draw(); // "Output" button TButton *but3 = new TButton("Output","phatset(2,1);", .18,.12,.28,.45); but3->SetFillColor(7); but3->SetTextColor(1); but3->SetTextSize(0.50); but3->Draw(); // "Events" button TButton *but4 = new TButton("Events","phatset(3,1);", .30,.55,.40,.88); but4->SetFillColor(7); but4->SetTextColor(1); but4->SetTextSize(0.50); but4->Draw(); // "Runs" button TButton *but5 = new TButton("Runs","phatset(4,1);", .30,.12,.40,.45); but5->SetFillColor(7); but5->SetTextColor(1); but5->SetTextSize(0.50); but5->Draw(); // "Vtx" button TButton *but6 = new TButton("Vtx","phatset(8,1);", .42,.12,.48,.45); but6->SetFillColor(4); but6->SetTextColor(10); but6->SetFraming(kTRUE); but6->SetTextSize(0.50); but6->Draw(); // "Onl" button TButton *but7 = new TButton("Onl","phatset(9,1);", .50,.12,.56,.45); but7->SetFillColor(4); but7->SetTextColor(10); but7->SetTextSize(0.50); but7->SetFraming(kTRUE); but7->Draw(); // "Mul" button TButton *but8 = new TButton("Mul","phatset(10,1);", .58,.12,.64,.45); but8->SetFillColor(4); but8->SetTextColor(10); but8->SetTextSize(0.50); but8->SetFraming(kTRUE); but8->Draw(); // "Spc" button TButton *but9 = new TButton("Spc","phatset(11,1);", .66,.12,.72,.45); but9->SetFillColor(4); but9->SetTextColor(10); but9->SetTextSize(0.50); but9->SetFraming(kTRUE); but9->Draw(); // "Out" button TButton *but10 = new TButton("Out","phatset(12,1);", .74,.12,.80,.45); but10->SetFillColor(4); but10->SetTextColor(10); but10->SetTextSize(0.50); but10->Draw(); // "HELP" button at right TButton *but11 = new TButton("HELP","gSystem.Exec("$PHATHELP");", .82,.12,.98,.88); but11->SetFillColor(8); but11->SetTextColor(10); but11->SetTextSize(0.70); but11->Draw(); // Add a label on the canvas TText *label = new TText(0.44,0.60,"Turn on processors"); label->SetTextSize(0.25); label->SetTextColor(10); label->Draw(); bar->Modified(); bar->cd(); bar->Update(); } //////////////////////////////////////////////////////////////////////////// if(flag == 2) { // Delete the canvas left from flag = 1: bar->Close(); // Draw the bar canvas on which the control buttons appear bar = new TCanvas("PHAT RUN","PHAT RUN",-50,670,900,150); bar->SetEditable(0); bar->SetFillColor(38); bar->SetFillStyle(3014); bar->Draw(); // "STOP" button at left TButton *but1 = new TButton("STOP","phatset(6,1);", .02,.12,.15,.88); but1->SetFillColor(2); but1->SetTextColor(10); but1->SetTextSize(0.70); but1->Draw(); // "Pause" button TButton *but2 = new TButton("Pause run","phatset(7,1);", .18,.55,.40,.88); but2->SetFillColor(7); but2->SetTextColor(1); but2->SetTextSize(0.50); but2->Draw(); // "Resume" button TButton *but3 = new TButton("Resume run","phatset(7,0);", .18,.12,.40,.45); but3->SetFillColor(7); but3->SetTextColor(1); but3->SetTextSize(0.50); but3->Draw(); // "Vtx" button TButton *but6 = new TButton("Vtx","phatset(13,0);", .45,.12,.51,.45); but6->SetFillColor(4); but6->SetTextColor(10); but6->SetTextSize(0.50); but6->Draw(); // "Onl" button TButton *but7 = new TButton("Onl","phatset(14,0);", .53,.12,.59,.45); but7->SetFillColor(4); but7->SetTextColor(10); but7->SetTextSize(0.50); but7->Draw(); // "Mul" button TButton *but8 = new TButton("Mul","phatset(15,0);", .61,.12,.67,.45); but8->SetFillColor(4); but8->SetTextColor(10); but8->SetTextSize(0.50); but8->Draw(); // "Spc" button TButton *but9 = new TButton("Spc","phatset(16,0);", .69,.12,.75,.45); but9->SetFillColor(4); but9->SetTextColor(10); but9->SetTextSize(0.50); but9->Draw(); // "HELP" button at right TButton *but11 = new TButton("HELP","gSystem.Exec("$PHATHELP");", .82,.12,.98,.88); but11->SetFillColor(8); but11->SetFillColor(8); but11->SetTextColor(10); but11->SetTextSize(0.70); but11->Draw(); // Add a label on the canvas TText *text = new TText(0.44,0.60,"Set the display type"); text->SetTextSize(0.25); text->SetTextColor(10); text->Draw(); bar->Modified(); bar->cd(); bar->Update(); } //////////////////////////////////////////////////////////////////////////// if(flag == 3) { // Delete the canvas left from flag = 2: bar->Close(); // Draw the bar canvas on which the control buttons appear bar = new TCanvas("PHAT END","PHAT END",-50,670,900,150); bar->SetEditable(0); bar->SetFillColor(38); bar->SetFillStyle(3014); bar->Draw(); // "EXIT" button at left; sends special code (10) to doGo TButton *but1 = new TButton("EXIT","phatset(6,10);", .02,.12,.15,.88); but1->SetFillColor(2); but1->SetTextColor(10); but1->SetTextSize(0.70); but1->Draw(); // A lot of blank space for 2 missing buttons, temporarily. // The following set the display type using fl***, just as in // the second (event loop) phase. // "Vtx" button TButton *but6 = new TButton("Vtx","phatset(13,0);", .45,.12,.51,.45); but6->SetFillColor(4); but6->SetTextColor(10); but6->SetTextSize(0.50); but6->Draw(); // "Onl" button TButton *but7 = new TButton("Onl","phatset(14,0);", .53,.12,.59,.45); but7->SetFillColor(4); but7->SetTextColor(10); but7->SetTextSize(0.50); but7->Draw(); // "Mul" button TButton *but8 = new TButton("Mul","phatset(15,0);", .61,.12,.67,.45); but8->SetFillColor(4); but8->SetTextColor(10); but8->SetTextSize(0.50); but8->Draw(); // "Spc" button TButton *but9 = new TButton("Spc","phatset(16,0);", .69,.12,.75,.45); but9->SetFillColor(4); but9->SetTextColor(10); but9->SetTextSize(0.50); but9->Draw(); //Same as before: // "HELP" button at right TButton *but11 = new TButton("HELP","gSystem.Exec("$PHATHELP");", .82,.12,.98,.88); but11->SetFillColor(8); but11->SetTextColor(10); but11->SetTextSize(0.70); but11->Draw(); // Add a label on the canvas TText *text = new TText(0.44,0.60,"Set the display type"); text->SetTextSize(0.25); text->SetTextColor(10); text->Draw(); bar->Modified(); bar->cd(); bar->Update(); } }