Back Midas Rome Roody Rootana
  Rome Analyzer Framework, Page 3 of 11  Not logged in ELOG logo
ID Date Author Topicup Subject
  97   29 Aug 2005 Ryu SawadaBug ReportTFile creation and TTree
When the filename base IO was added, it seems that TFile creation was moved from 
ROMEEventLoop::DAQInit to ROMEEventLoop:DAQEndOfRun.

So ROME makes TTrees without outputfile.

This is dangerous when a TTree becomes huge.
It can consume large amount of memory.
  98   30 Aug 2005 Matthias SchneebeliBug ReportTFile creation and TTree
> When the filename base IO was added, it seems that TFile creation was moved from 
> ROMEEventLoop::DAQInit to ROMEEventLoop:DAQEndOfRun.
> 
> So ROME makes TTrees without outputfile.
> 
> This is dangerous when a TTree becomes huge.
> It can consume large amount of memory.

Your right. I have changed it back.
  113   08 Feb 2006 Ryu SawadaBug ReportROMEEventLoop:Update
Recently the place to call ROMEEventLoop:Update was moved.
Probably because of this, in MIDAS online mode, event number is always incremented even when DAQ is not running.
  114   08 Feb 2006 Ryu SawadaBug ReportROMENetFolderServer
When I run ROME analyzer in online MIDAS mode.
It stopps with making core (segmentation fault).

It seems it makes core after "return" in main.cpp, namely finishing all code.

When I comment out following line in ROMEAnalyzer.cpp, it works propery.
tnet->StartServer(gROME->GetApplication(),gROME->GetPortNumber());

Probably it is relating to ROMENetServer or thread for this.
  115   09 Feb 2006 Ryu SawadaBug ReportROMENetFolderServer
I investigated the problem.

On my machine (Scientific Linux 4.2, gcc3.3.2, glibc2.3.2, ROOT5.08.00), following simple program reproduced the problem.
There was no probelm with ROOT version4.
Is it bug of ROOT ?

When I put -lpthread at the last. This problem stopped.
Actually without this option, my analyzer workes.
I guess -lpthread is not necessary.

I will check more and if not necessary, I will remove -lpthread.

--- Makefile ---
rootlibs := $(shell $(ROOTSYS)/bin/root-config --libs)
rootcflags := $(shell  $(ROOTSYS)/bin/root-config --cflags)

test: main.cpp
	g++ $(rootcflags) -o $@ $< -lpthread $(rootlibs) -lThread
------
--- main.cpp ---
#include <Riostream.h>
#include <TThread.h>

void* TestLoop(void *arg)
{
   return NULL;
}

int main(int argc, char *argv[])
{
   TThread *thread = new TThread("TestLoop", TestLoop);

   cout<<"OK"<<endl;
   return 0;
}  
------
  119   08 Mar 2006 Giovanni SignorelliBug ReportgAnalyzer->GetEventID() fails if EventID>127-48
This bug happened when reading a .MID file containing events with event_id=99.
The ReadMidas task is not able to read the event because it is not recognized.
This event_id, when recovered with GetEventID() method was transformed to a negative value. This probably happened because there is a +48 addition at some place (in SetEventID) and a -48 on GetEventID. This casuses the unsigned char to be recovered as a signed number (lots of FFFF in front of it).

Furthermore it is not writtenanywhere that EventID<0xFF.

I could solve the problem
1) by setting EventID = 16, for instance
2) by modifying ROMEAnalyzer.h as follows
// Event ID
Int_t GetEventID() { return (fEventID-48)&0xFF; }
char GetEventIDChar() { return (fEventID)&0xFF; }
  120   02 Apr 2006 Matthias SchneebeliBug ReportgAnalyzer->GetEventID() fails if EventID>127-48

Giovanni Signorelli wrote:
This bug happened when reading a .MID file containing events with event_id=99.
The ReadMidas task is not able to read the event because it is not recognized.
This event_id, when recovered with GetEventID() method was transformed to a negative value. This probably happened because there is a +48 addition at some place (in SetEventID) and a -48 on GetEventID. This casuses the unsigned char to be recovered as a signed number (lots of FFFF in front of it).

Furthermore it is not writtenanywhere that EventID<0xFF.

I could solve the problem
1) by setting EventID = 16, for instance
2) by modifying ROMEAnalyzer.h as follows
// Event ID
Int_t GetEventID() { return (fEventID-48)&0xFF; }
char GetEventIDChar() { return (fEventID)&0xFF; }




This should be fixed now.
  121   08 Jun 2006 Todd BredewegBug ReportUnable to run rome analyzer from crontab
I would like to use a bash script run from cron to analyze new midas event files automatically. Below is an abbreviated example script to test the way ROOT and ROME handle true batch mode
#! /bin/bash

BASEDIR=/data/0/PostRunQA		# Base directory for output files
ROMEDIR=${BASEDIR}/dance-rome		# Location of danceanalyzer

NRUN=7581
ROMECFG="romeConfig_Continuous.xml";

# Set PATH and LD_LIBRARY_PATH for correct versions of ...
# This also sets up the *SYS variables
source /opt/wnr/new/bin/newVersion --new root rome wnr

cd ${ROMEDIR};

# Check that ROOT works correctly
echo " Running ROOT batch mode test ";
root -b -q ../jmodScript.C

# Check that ROME works correctly
echo " Running danceanalyzer batch mode test ";
./danceanalyzer.exe -b -ns -q -i ${ROMECFG} -r ${NRUN}

The results for the ROOT section are the same when the script is run from the command line (full interactive environment) or when using at or crontab (non-interactive).
 Running ROOT batch mode test
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   5.10/00      1 March 2006   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************
                                                                                                                                  
Compiled on 3 April 2006 for linux with thread support.
                                                                                                                                  
CINT/ROOT C/C++ Interpreter version 5.16.8, February 9, 2006
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
 Executing rootlogon.C (31-MAY-2006)...  Finished setup
                                                                                                                                  
Processing ../jmodScript.C...
hello world
This is the end of ROOT -- Goodbye

jmodScript.C is merely a classic "hello world" script. The ROME test, on the other hand, returns quite different results for the two cases. When run from the command line it works as expected
 ...
 Running danceanalyzer batch mode test
 Executing rootlogon.C (31-MAY-2006)...  Finished setup
reading configuration from romeConfig_Continuous.xml
[bredeweg@enlil PostRunQA]$

but when run from at or crontab we get
 Running danceanalyzer batch mode test
 Executing rootlogon.C (31-MAY-2006)...  Finished setup
                                                                                                                                  
 *** Break *** segmentation violation
 Generating stack trace...
 0x081ec18b in main + 0x21b from ./danceanalyzer.exe
 0x0734678a in __libc_start_main + 0xda from /lib/tls/libc.so.6
 0x080dcd31 in TFile::TFile(char const*, char const*, char const*, int) + 0x51 from ./danceanalyzer.exe
/bin/bash: line 22: 28096 Aborted                 ./danceanalyzer.exe -b -ns -q -i ${ROMECFG} -r ${NRUN}

One question that we have been unable to answer as yet is whether rome is requiring a real TTY, which I do not believe is provided by cron.

We are using the following setup:
Redhat Enterprise Linux v3
ROOT v5.10.00
ROME RELEASE_2_4_R1004

I can provide additional information if needed.

Thanks in advance.

tab
  122   08 Jun 2006 Konstantin OlchanskiBug ReportUnable to run rome analyzer from crontab
(sorry for top-reply- I am trying to avoid elcode garbling my answer)

In the past, I have seen problems like yours, there are at least two issues:

1) "non interactive" ROOT running from cron or some other incomplete user
environment (no DISPLAY, no tty, no user)- a hello world script runs, but large
app does not, because some silly class somewhere requires an X11 connection. I
once had to fake it by running Xvnc and telling the cron jobs to use it as a
DISPLAY. I know ROOT now have a "dummy" graphics module exactly for this
purpose. I do not know how to activate it from the Rome environement, but I am
sure it is documented somewhere on the ROOT web site.

2) some programs coming from the MIDAS family assume existance of a keyboard and
display. Sometimes they can be faked by using "program < /dev/null", sometimes
not, I do not know what Rome does.

K.O.


[quote="Todd Bredeweg"]I would like to use a bash script run from cron to
analyze new midas event files automatically. Below is an abbreviated example
script to test the way ROOT and ROME handle true batch mode

[CODE]
#! /bin/bash

BASEDIR=/data/0/PostRunQA		# Base directory for output files
ROMEDIR=${BASEDIR}/dance-rome		# Location of danceanalyzer

NRUN=7581
ROMECFG="romeConfig_Continuous.xml";

# Set PATH and LD_LIBRARY_PATH for correct versions of ...
# This also sets up the *SYS variables
source /opt/wnr/new/bin/newVersion --new root rome wnr

cd ${ROMEDIR};

# Check that ROOT works correctly
echo " Running ROOT batch mode test ";
root -b -q ../jmodScript.C

# Check that ROME works correctly
echo " Running danceanalyzer batch mode test ";
./danceanalyzer.exe -b -ns -q -i ${ROMECFG} -r ${NRUN}
[/CODE]

The results for the ROOT section are the same when the script is run from the
command line (full interactive environment) or when using at or crontab
(non-interactive).

[CODE]
 Running ROOT batch mode test
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   5.10/00      1 March 2006   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************
                                                                               
                                                  
Compiled on 3 April 2006 for linux with thread support.
                                                                               
                                                  
CINT/ROOT C/C++ Interpreter version 5.16.8, February 9, 2006
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
 Executing rootlogon.C (31-MAY-2006)...  Finished setup
                                                                               
                                                  
Processing ../jmodScript.C...
hello world
This is the end of ROOT -- Goodbye
[/CODE]

jmodScript.C is merely a classic "hello world" script. The ROME test, on the
other hand, returns quite different results for the two cases. When run from the
command line it works as expected

[CODE]
 ...
 Running danceanalyzer batch mode test
 Executing rootlogon.C (31-MAY-2006)...  Finished setup
reading configuration from romeConfig_Continuous.xml
[bredeweg@enlil PostRunQA]$
[/CODE]

but when run from at or crontab we get 

[CODE] Running danceanalyzer batch mode test
 Executing rootlogon.C (31-MAY-2006)...  Finished setup
                                                                               
                                                  
 *** Break *** segmentation violation
 Generating stack trace...
 0x081ec18b in main + 0x21b from ./danceanalyzer.exe
 0x0734678a in __libc_start_main + 0xda from /lib/tls/libc.so.6
 0x080dcd31 in TFile::TFile(char const*, char const*, char const*, int) + 0x51
from ./danceanalyzer.exe
/bin/bash: line 22: 28096 Aborted                 ./danceanalyzer.exe -b -ns -q
-i ${ROMECFG} -r ${NRUN}[/CODE]

One question that we have been unable to answer as yet is whether rome is
requiring a real TTY, which I do not believe is provided by cron.

We are using the following setup:
    Redhat Enterprise Linux v3
    ROOT v5.10.00
    ROME RELEASE_2_4_R1004

I can provide additional information if needed.

Thanks in advance.

tab[/quote]
  139   09 Jun 2015 Farrukh AzfarBug ReportProblems with programming tabs when using TGraph
Dear Colleagues,
 
I have been using the ROME framework and have succesfully implemented a program 
to run on MIDAS input and plot histograms.

Not satisfied with the default settings of the Canvas, pads and text sizes etc I 
consulted Ryu who kindly showed me how to implement the event and init and update 
methods in the Tabs to bring the display closer to what I needed.

This has worked fine with histograms. However not with TGraphs:

I noticed that if I implemented the plotting of the TGraphs in the tab class then 
after setting points in the TGraph in the Fill tasks the Tab classes plot was 
empty -> is there something peculiar about TGraph ? Any tips would be great !

many thanks
Farrukh Azfar
  141   11 Jun 2015 Ryu SawadaBug ReportProblems with programming tabs when using TGraph
Dear Farrukh

I presume you implemented your tab which draws the graph.
Which option do you use for Draw function of the graph ?
I am afraid you might forget to add 'A' in the option.
For example, you need to use 'A' like,
  graph->Draw("APL");

Best regards,

Ryu

> Dear Colleagues,
>
> I have been using the ROME framework and have succesfully implemented a program
> to run on MIDAS input and plot histograms.
>
> Not satisfied with the default settings of the Canvas, pads and text sizes etc I
> consulted Ryu who kindly showed me how to implement the event and init and update
> methods in the Tabs to bring the display closer to what I needed.
>
> This has worked fine with histograms. However not with TGraphs:
>
> I noticed that if I implemented the plotting of the TGraphs in the tab class then
> after setting points in the TGraph in the Fill tasks the Tab classes plot was
> empty -> is there something peculiar about TGraph ? Any tips would be great !
>
> many thanks
> Farrukh Azfar
  Draft   13 Jun 2015 Farrukh AzfarBug ReportProblems with programming tabs when using TGraph
Hi Ryu,

thanks for your reply. yes I am(was) using it.


Ryu Sawada wrote:
Dear Farrukh

I presume you implemented your tab which draws the graph.
Which option do you use for Draw function of the graph ?
I am afraid you might forget to add 'A' in the option.
For example, you need to use 'A' like,
  graph->Draw("APL");

Best regards,

Ryu

> Dear Colleagues,
>
> I have been using the ROME framework and have succesfully implemented a program
> to run on MIDAS input and plot histograms.
>
> Not satisfied with the default settings of the Canvas, pads and text sizes etc I
> consulted Ryu who kindly showed me how to implement the event and init and update
> methods in the Tabs to bring the display closer to what I needed.
>
> This has worked fine with histograms. However not with TGraphs:
>
> I noticed that if I implemented the plotting of the TGraphs in the tab class then
> after setting points in the TGraph in the Fill tasks the Tab classes plot was
> empty -> is there something peculiar about TGraph ? Any tips would be great !
>
> many thanks
> Farrukh Azfar
  147   15 Jun 2015 Ryu SawadaBug ReportProblems with programming tabs when using TGraph
Dear Farrukh

If you attach your code related to the problem, I can investigate the problem.

Best regards,

Ryu


Farrukh Azfar wrote:
Hi Ryu,

thanks for your reply. yes I am(was) using it.


Ryu Sawada wrote:
Dear Farrukh

I presume you implemented your tab which draws the graph.
Which option do you use for Draw function of the graph ?
I am afraid you might forget to add 'A' in the option.
For example, you need to use 'A' like,
  graph->Draw("APL");

Best regards,

Ryu

> Dear Colleagues,
>
> I have been using the ROME framework and have succesfully implemented a program
> to run on MIDAS input and plot histograms.
>
> Not satisfied with the default settings of the Canvas, pads and text sizes etc I
> consulted Ryu who kindly showed me how to implement the event and init and update
> methods in the Tabs to bring the display closer to what I needed.
>
> This has worked fine with histograms. However not with TGraphs:
>
> I noticed that if I implemented the plotting of the TGraphs in the tab class then
> after setting points in the TGraph in the Fill tasks the Tab classes plot was
> empty -> is there something peculiar about TGraph ? Any tips would be great !
>
> many thanks
> Farrukh Azfar
  151   03 Sep 2015 Farrukh AzfarBug ReportSaving canvas as pdf via a button one vs many pads
Dear Colleagues 

we have implemented in one of our tabs a button to call a function which saves a 
canvas to a pdf file with a time date stamp.

1) This works fine when there is only one histogram on the canvas and this code 
is MIDTBCTab.cpp (attached)

2) When the canvas is divided up into a 5x11 pads with 55 histograms and 
we want to save the _whole_ canvas with the whole picture (_not_ any individual 
pads) the code crashes  and no file is generated - the tab code is MIDTRCTab.cpp
and this is also attached 

I am wondering what is going on - is there anything obviously wrong ?

many thanks 

Farrukh
Attachment 1: MIDTBCTab.cpp
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
// MIDTBCTab                                                                  //
//                                                                            //
// Begin_Html <!--
/*-->

<!--*/
// --> End_Html
//                                                                            //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////

/* Generated header file containing necessary includes                        */
#include "generated/MIDTBCTabGeneratedIncludes.h"

////////////////////////////////////////////////////////////////////////////////
/*  This header was generated by ROMEBuilder. Manual changes above the        *
 * following line will be lost next time ROMEBuilder is executed.             */
/////////////////////////////////////----///////////////////////////////////////

#include "generated/MIDWindow.h"
#include "generated/MIDAnalyzer.h"
#include "tabs/MIDTBCTab.h"
#include "tasks/MIDTFillHistogram.h"
#include "TAxis.h"
#include "TLatex.h"
#include <TGClient.h>
#include <TCanvas.h>

#include <TRandom.h>
#include <TGButton.h>
#include <TGFrame.h>
#include <TRootEmbeddedCanvas.h>
#include <RQ_OBJECT.h>
#include<TString.h>
#include<TDatime.h>
// uncomment if you want to include headers of all folders
//#include "MIDAllFolders.h"


ClassImp(MIDTBCTab)

using namespace std;
//______________________________________________________________________________
void MIDTBCTab::Init()
{
  // Create style for this tab                                                 
  TStyle *orgStyle = gStyle;
  fStyle = new TStyle(*orgStyle); // copy the original style                   
  fStyle->SetOptTitle(1);
  fStyle->SetTitleOffset(0.18, "y");
  fStyle->SetPadGridX(1);
  fStyle->SetPadGridY(1);
  fStyle->SetPadTickX(1);
  fStyle->SetPadTickY(1);
  fStyle->SetFrameBorderSize(0);
  fStyle->SetFrameBorderMode(0);
  fStyle->SetFrameFillStyle(0);
  fStyle->SetTitleSize(0.06, "t");
  fStyle->SetStatH(0.09);
  fStyle->SetStatW(0.09);
  fStyle->cd();
  // Create a vertical frame containing buttons and canvas                     
  fVert = new TGVerticalFrame(this, (UInt_t) (700 * gAnalyzer->GetWindow()->GetWindowScale()), (UInt_t) (700 *gAnalyzer->GetWindow()->GetWindowScale()));

  // Create an embedded canvas and add to the main frame, centered in x and y                                                
  //  TString canvasname = "Sample Canvas";
  
  // set data member 
  fCanvasName =  new TString ("Sample Canvas");
  
  

  fCanvas = new TRootEmbeddedCanvas(fCanvasName->Data(), fVert, (UInt_t) (600 * gAnalyzer->GetWindow()->GetWindowScale()), (UInt_t) (600 * gAnalyzer->GetWindow()->GetWindowScale()));


  fCanvas->GetCanvas()->Divide(1,1);
  TLatex title;
  title.SetTextFont(12);                                                        
  title.SetTextSize(0.03);                                                      
  title.SetNDC(); 


  //Create save button                                                                                                      
  ULong_t green;
  gClient->GetColorByName("Green",green);
  fSaveCanvas = new TGTextButton(fVert, "SaveCanvas");
  fSaveCanvas->ChangeBackground(green);
  fSaveCanvas->Associate(this);
  fVert->AddFrame(fSaveCanvas, new TGLayoutHints(kLHintsCenterX, 5, 5, 3, 4));
                                               
                                                                                                               
                                  
                                                                                                                        /// Create "Update" button                                                    
  ULong_t yellow;
  gClient->GetColorByName("Yellow",yellow);                                            
  fBUpdate = new TGTextButton(fVert, "Update");
  fBUpdate->ChangeBackground(yellow);
  fBUpdate->Associate(this);

  //  fVert->AddFrame(fCanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 4, 4, 4, 4));
  fVert->AddFrame(fBUpdate, new TGLayoutHints(kLHintsCenterX, 4, 4, 4, 4));
  // AddFrame(fVert, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 4, 4, 4, 4));



  //Create Exit button
  ULong_t red;
  gClient->GetColorByName("Red",red);                                    

  fExit = new TGTextButton(fVert,"&Exit", "gApplication->Terminate(0)");
  fExit->ChangeBackground(red);
  fExit->Associate(this);


  //  fVert->AddFrame(fCanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 4, 4, 4, 4));
  
fVert->AddFrame(fExit, new TGLayoutHints(kLHintsCenterX, 5, 5, 3, 4));
                                                                                    
   



 fVert->AddFrame(fCanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 5, 5, 3,  4)); 
 AddFrame(fVert, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 4, 4, 4, 4)); 


  ConnectAll();

  orgStyle->cd();



}

//______________________________________________________________________________
void MIDTBCTab::EndInit()
{
}

//______________________________________________________________________________
void MIDTBCTab::EventHandler()
{
}

//______________________________________________________________________________
void MIDTBCTab::MenuClicked(TGPopupMenu * /* menu */, Long_t /* param */)
{
}

//______________________________________________________________________________
void MIDTBCTab::TabSelected()
{
}

//______________________________________________________________________________
void MIDTBCTab::TabUnSelected()
{
}
  // Save Canvas:
  // you'll need a function of the same signature in your .h -> also make sure that TString is included in your .h
  void MIDTBCTab::SaveCanvas() 
{

 
  TString * fileName = new TString (fCanvasName->Data());

    //replace all spaces in your canvas name 
    fileName->ReplaceAll(" ", "");
    
    //generate data and time stamp -> Recall you'll have to make sure TDatime is included 
    TDatime  dateTime; // time and date remain frozen when this function was called
    TString dateAsString = Form("%d", dateTime.GetDate());
    TString timeAsString = Form("%d", dateTime.GetTime());

    // append time date etc to canvas name

    (*fileName) += ".";
    (*fileName) += dateAsString;
    (*fileName) += ".";
    (*fileName) += timeAsString;
    (*fileName) += ".pdf"; // pdf for now maybe think about png and other options for user later ? 

    // debug
    //    cout << " This is the filename " << fileName->Data() << endl;

    // now print it and hope it works ....
    fCanvas->GetCanvas()->Print(fileName->Data());
    //cout << " Already attempted to print this file  " << fileName->Data() << endl;
}









void MIDTBCTab::Update()
{

  TLatex title;                                                                 
  title.SetTextFont(12);                                                        
  title.SetTextSize(0.03);                                                      
  title.SetNDC(); 

  TStyle *orgStyle = gStyle;
  fStyle->cd();

  TH2 *histo;

  for (Int_t i = 0; i < 1; i++) {
    fCanvas->GetCanvas()->cd(i + 1);
    histo = (TH2D *) gAnalyzer->GetFillHistogramTask()->Geth2_dt_tcpgotheaderAt(i);
    if (!histo) {
      cout << "Histo h2_dt_tcpgotheader not available." << endl;
    } else {

 


      histo->SetMarkerColor(1);
      histo->GetXaxis()->SetRangeUser(-20000,100000);
     
      histo->Draw("COLZ");

                                           
      title.SetTextColor(2);                                                        
                                                                                
                                      
                                                                                
                                                            
                                                                                
      title.SetTextColor(2); 
      title.DrawLatex(0.01,0.32,"tcp header #rightarrow");


      title.SetTextColor(3); 
                           
      title.DrawLatex(0.01,0.4,"tcp data  #rightarrow");                                 

      title.SetTextColor(4); 
      title.DrawLatex(0.01,0.48,"copy to GPU #rightarrow");                         
      title.SetTextColor(5); 
      title.DrawLatex(0.01,0.56,"GPU processing #rightarrow");                      

      title.SetTextColor(6); 
      title.DrawLatex(0.01,0.64,"MFE start #rightarrow");                           
      title.SetTextColor(7); 
      title.DrawLatex(0.01,0.72,"MFE stop #rightarrow");  


    }
  }

  fCanvas->GetCanvas()->cd(0);
  fCanvas->GetCanvas()->Modified();
  fCanvas->GetCanvas()->Update();

  orgStyle->cd();

  return;
}

//______________________________________________________________________________                                              
void MIDTBCTab::ConnectAll()
{
  fBUpdate->Connect("Pressed()", "MIDTBCTab", this, "Update()");
  fExit->Connect("Pressed()", "MIDTBCTab", this, "&Exit()");
  fSaveCanvas->Connect("Pressed()","MIDTBCTab", this, "SaveCanvas()");  
}
//______________________________________________________________________________                                         
void MIDTBCTab::DisconnectAll()
{
  if (fBUpdate) { fBUpdate->Disconnect(this); }
  if (fExit) { fExit->Disconnect(this); }
  if(fSaveCanvas) { fSaveCanvas->Disconnect(this);} 
}

Attachment 2: MIDTRCTab.cpp
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
// MIDTRCTab                                                                  //
//                                                                            //
// Begin_Html <!--
/*-->

<!--*/
// --> End_Html
//                                                                            //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////

/* Generated header file containing necessary includes                        */
#include "generated/MIDTRCTabGeneratedIncludes.h"

////////////////////////////////////////////////////////////////////////////////
/*  This header was generated by ROMEBuilder. Manual changes above the        *
 * following line will be lost next time ROMEBuilder is executed.             */
/////////////////////////////////////----///////////////////////////////////////

#include "generated/MIDWindow.h"
#include "generated/MIDAnalyzer.h"
#include "tabs/MIDTRCTab.h"
#include "tasks/MIDTFillHistogramraw.h"


#include "TAxis.h"
#include "TLatex.h"
#include <TGClient.h>
#include <TCanvas.h>

#include <TRandom.h>
#include <TGButton.h>
#include <TGFrame.h>
#include <TRootEmbeddedCanvas.h>
#include <RQ_OBJECT.h>
#include<TString.h>
#include<TDatime.h>

// uncomment if you want to include headers of all folders
#include "MIDAllFolders.h"


ClassImp(MIDTRCTab)
using namespace std;
//______________________________________________________________________________
void MIDTRCTab::Init()
{
  // Create style for this tab                                                                                                                                         
  TStyle *orgStyle = gStyle;
  fStyle = new TStyle(*orgStyle); // copy the original style                                                                                                           
  fStyle->SetOptTitle(1);
  fStyle->SetTitleOffset(0.38, "y");
  fStyle->SetPadGridX(1);
  fStyle->SetPadGridY(1);
  fStyle->SetPadTickX(1);
  fStyle->SetPadTickY(1);
  fStyle->SetFrameBorderSize(0);
  fStyle->SetFrameBorderMode(0);
  fStyle->SetFrameFillStyle(0);
  fStyle->SetTitleSize(0.06, "t");
  fStyle->SetStatH(0.30);
  fStyle->SetStatW(0.30);
  fStyle->cd();
  // Create a vertical frame containing buttons and canvas                                                                                                             
  fVert = new TGVerticalFrame(this, (UInt_t) (700 * gAnalyzer->GetWindow()->GetWindowScale()), (UInt_t) (700 * gAnalyzer->GetWindow()->GetWindowScale()));

  // Create an embedded canvas and add to the main frame, centered in x and y                                            


  // set data member                                                                                
  fCanvasName =  new TString ("Sample Canvas");


                                              
  fCanvas = new TRootEmbeddedCanvas("Sample Canvas", fVert, (UInt_t) (600 * gAnalyzer->GetWindow()->GetWindowScale()), (UInt_t) (600 * gAnalyzer->GetWindow()->GetWindowScale()));
  fCanvas->GetCanvas()->Divide(5, 11);



  // Create "Update" button                                                    
  ULong_t yellow;
  gClient->GetColorByName("Yellow",yellow);                                                     
  fBUpdate = new TGTextButton(fVert, "Update");
  fBUpdate->ChangeBackground(yellow);
  fBUpdate->Associate(this);

  //  fVert->AddFrame(fCanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 4, 4, 4, 4));
  fVert->AddFrame(fBUpdate, new TGLayoutHints(kLHintsCenterX, 10, 10, 4, 4));
  AddFrame(fVert, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10, 10, 4, 4));


  //create Exit button
  ULong_t red;
  gClient->GetColorByName("Red",red);
  fExit = new TGTextButton(fVert, "&Exit", "gApplication->Terminate(0)");
  fExit->ChangeBackground(red);
  fExit->Associate(this);
  fVert->AddFrame(fExit, new TGLayoutHints(kLHintsCenterX, 10, 10, 4, 4));


  //create save button                                                                                                   
                                                                                                                         
  ULong_t green;
  gClient->GetColorByName("Green",green);
  fSaveCanvas = new TGTextButton(fVert, "SaveCanvas");
  fSaveCanvas->ChangeBackground(green);
  fSaveCanvas->Associate(this);
  fVert->AddFrame(fSaveCanvas, new TGLayoutHints(kLHintsCenterX, 10, 10, 4, 4));


  fVert->AddFrame(fCanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 4, 4, 4, 4));
  //  AddFrame(fVert, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 4, 4, 4, 4));



  ConnectAll();

  orgStyle->cd();

}

//______________________________________________________________________________
void MIDTRCTab::EndInit()
{
}

//______________________________________________________________________________
void MIDTRCTab::EventHandler()
{
}

//______________________________________________________________________________
void MIDTRCTab::MenuClicked(TGPopupMenu * /* menu */, Long_t /* param */)
{
}

//______________________________________________________________________________
void MIDTRCTab::TabSelected()
{
}

//______________________________________________________________________________
void MIDTRCTab::TabUnSelected()
{
}


  // Save Canvas:                                                                                   
  // you'll need a function of the same signature in your .h -> also make sure that TString is included in your .h                                                                                      
  void MIDTRCTab::SaveCanvas()
{

  // if following doesn't work blame Sabato Leo                                                     
  TString * fileName = new TString (fCanvasName->Data());

  //replace all spaces in your canvas name                                                        
  fileName->ReplaceAll(" ", "");

  //generate data and time stamp -> Recall you'll have to make sure TDatime is included           
  TDatime  dateTime; // time and date remain frozen when this function was called                 
  TString dateAsString = Form("%d", dateTime.GetDate());
  TString timeAsString = Form("%d", dateTime.GetTime());

  // append time date etc to canvas name                                                          

  (*fileName) += ".";
  (*fileName) += dateAsString;
  (*fileName) += ".";
  (*fileName) += timeAsString;
  (*fileName) += ".pdf"; // pdf for now maybe think about png and other options for user later ? 

  // debug                                                                                        
  //cout << " This is the filename " << fileName->Data() << endl;

  // now print it and hope it works ....                                                          
  fCanvas->GetCanvas()->Print(fileName->Data());
  //  cout << " Already attempted to print this file  " << fileName->Data() << endl;
  }





void MIDTRCTab::Update()
{
  TStyle *orgStyle = gStyle;
  fStyle->cd();

  TH1 *histo;

  for (Int_t i = 0; i < 55; i++) { //loop over all 55 pads
    fCanvas->GetCanvas()->cd(i + 1);
    histo = (TH1F *) gAnalyzer->GetFillHistogramrawTask()->Geth1_wfAt(i);
    if (!histo) {
      cout << "Histo ADC not available." << endl;
    } else {
      histo->Draw();
    }
  }

  fCanvas->GetCanvas()->cd(0);
  fCanvas->GetCanvas()->Modified();
  fCanvas->GetCanvas()->Update();

  orgStyle->cd();

  return;




}
//_____________________________________________________________________________\
_                                                                               
void MIDTRCTab::ConnectAll()
{
  fBUpdate->Connect("Pressed()", "MIDTRCTab", this, "Update()");
  fExit->Connect("Pressed()", "MIDTRCTab", this, "&Exit()");
  fSaveCanvas->Connect("Pressed()","MIDTRCTab", this, "SaveCanvas()");

}

//_____________________________________________________________________________\
_                                                                               
void MIDTRCTab::DisconnectAll()
{
  if (fBUpdate) { fBUpdate->Disconnect(this); }
  if (fExit) { fExit->Disconnect(this); }
  if(fSaveCanvas) { fSaveCanvas->Disconnect(this);}

}
  156   04 Sep 2015 SUDESHNA GANGULYBug ReportTMTT3.cpp -offset in index of the pads
Hi Ryu,

I have been working with your /rome/examples/argus/menu/tab/TMTT3.cpp cpde and
I've run your menu.xml with a dummy midas file run0001.mid in the offline mode,
and in the AREGUS monitor, when I click on "open and save" menu, it shows
options for 4 pads. But if you click on the first pad, it is empty, if you click
on pad 2, it will have hist1, pad3 has hist2, and pad4 is hist3 and there is no
hist4.
So there is an offset of 1. 

In case of my 55 histograms I am getting the same error. I am getting only upto
hist54 (my first hist is called hist00).

Could you please help me with this issue?
  160   07 Sep 2015 Ryu SawadaBug ReportSaving canvas as pdf via a button one vs many pads
Dear Farrukh

I tried your code, but the problem was not reproduced.
I can save the canvas as attached without crash.

Only the difference from your code is the histograms.
Since I don't have your task I took and draw 'ADC' histograms from 'FillHistogram' task.
No other changes were made from your code.
I edited .h file of the tab from the automatically generated ones.

Ryu



> Dear Colleagues 
> 
> we have implemented in one of our tabs a button to call a function which saves a 
> canvas to a pdf file with a time date stamp.
> 
> 1) This works fine when there is only one histogram on the canvas and this code 
> is MIDTBCTab.cpp (attached)
> 
> 2) When the canvas is divided up into a 5x11 pads with 55 histograms and 
> we want to save the _whole_ canvas with the whole picture (_not_ any individual 
> pads) the code crashes  and no file is generated - the tab code is MIDTRCTab.cpp
> and this is also attached 
> 
> I am wondering what is going on - is there anything obviously wrong ?
> 
> many thanks 
> 
> Farrukh
Attachment 1: SampleCanvas.20150907.175151.pdf
SampleCanvas.20150907.175151.pdf
  161   07 Sep 2015 Farrukh AzfarBug ReportSaving canvas as pdf via a button one vs many pads
Dear Ryu,

thanks very much for trying this out. Perhaps Sudeshna can verify that the problem is still 
there in her code or if its fixed ?

- thanks
Farrukh

> Dear Farrukh
> 
> I tried your code, but the problem was not reproduced.
> I can save the canvas as attached without crash.
> 
> Only the difference from your code is the histograms.
> Since I don't have your task I took and draw 'ADC' histograms from 'FillHistogram' task.
> No other changes were made from your code.
> I edited .h file of the tab from the automatically generated ones.
> 
> Ryu
> 
> 
> 
> > Dear Colleagues 
> > 
> > we have implemented in one of our tabs a button to call a function which saves a 
> > canvas to a pdf file with a time date stamp.
> > 
> > 1) This works fine when there is only one histogram on the canvas and this code 
> > is MIDTBCTab.cpp (attached)
> > 
> > 2) When the canvas is divided up into a 5x11 pads with 55 histograms and 
> > we want to save the _whole_ canvas with the whole picture (_not_ any individual 
> > pads) the code crashes  and no file is generated - the tab code is MIDTRCTab.cpp
> > and this is also attached 
> > 
> > I am wondering what is going on - is there anything obviously wrong ?
> > 
> > many thanks 
> > 
> > Farrukh
  195   05 Apr 2016 SUDESHNA GANGULYBug ReportRunning ROME remotely
Hi Ryu,

After following your instructions to run ROME remotely, using run mode 3 on the
client machine, and mode 0 on the server machine, we can see ARGUS display
appearing on the client machine.
But that does not work if we have the <ARGUS> block for tabbing in the user xml
file. I see a bunch of error messages and then ROME crashes on the client machine.
There might be some conflict with using ARGUS and using run mode 3?

If I take off the <ARGUS> tab block and write my own src/tabs/tab codes, then on
my client machine, using run mode 3 works, the display appears with histograms
without a crash.

Any thought on this issue will be much appreciated.

Thanks,
Sudeshna
  196   08 Apr 2016 Ryu SawadaBug ReportRunning ROME remotely
Dear Sudeshna

I modified ROME to try to fix problems related <ARGUS> block histograms in run-mode 3.
Could you please pull ROME and use the 'develop' branch ?
(You can switch branches with "git checkout develop' command)

There is an example, examples/argus/histogram.
I tested with the example and it works.

'romeproject' in the directory works as a server.

What you need to use the example for the test is,
0) 'make' in $ROMESYS
1) Build and compile both  examples/argus/histogram and  examples/argus/histogram/romeproject
2) Start analyzer in romeproject with using romeConfig.xml
3) Start monitor with using argusConfig.xml

In the second tab, you must see an <ARGUS> block histogram updated periodically.

Ryu


> Hi Ryu,
> 
> After following your instructions to run ROME remotely, using run mode 3 on the
> client machine, and mode 0 on the server machine, we can see ARGUS display
> appearing on the client machine.
> But that does not work if we have the <ARGUS> block for tabbing in the user xml
> file. I see a bunch of error messages and then ROME crashes on the client machine.
> There might be some conflict with using ARGUS and using run mode 3?
> 
> If I take off the <ARGUS> tab block and write my own src/tabs/tab codes, then on
> my client machine, using run mode 3 works, the display appears with histograms
> without a crash.
> 
> Any thought on this issue will be much appreciated.
> 
> Thanks,
> Sudeshna
  198   13 Apr 2016 SUDESHNA GANGULYBug ReportError with maximum number of tabs in Argus section
Hi Ryu,

I am trying to use <Argus> for tabbing like this:
  <Argus>
          <Tab>
            <TabName>Tab1</TabName>
            <ObjectArrayIndex>0</ObjectArrayIndex>

            <Index>0</Index>
 </Tab>
   <Tab>
            <TabName>Tab1</TabName>
            <ObjectArrayIndex>1</ObjectArrayIndex>
            <Index>1</Index>
          </Tab>
   <Tab>
            <TabName>Tab1</TabName>
            <ObjectArrayIndex>2</ObjectArrayIndex>

            <Index>2</Index>
          </Tab>




And I need to add 18 tabs with each tab having three pads.
Now I when ever I cross Tab6 with three pads on it, it gives me this error:

[sganguly@g2be1 rometest]$ /home/sganguly/dqm/rome/bin/romebuilder.exe -i
midas.xml -midas
Maximal number of Tabs in the Argus section of Histogram 'h1_wf' reached : 20 !

I have noticed that currently I can define 6 tabs and 5 pads on each tab maximum.

Could you please help me with this?

Thanks a lot!
Sudeshna
ELOG V3.1.4-2e1708b5