Hello,
First of all, the histograms are supposed to be drawn by the automatically generated code.
You don't need (and should not) draw them from a task.
If you do so, the histograms are drawn on the active pad (gPad) which is, in your case, the last pad on a tab.
I added a new feature to ROME development branch.
For using the feature, you can try
cd $ROMESYS
git checkout develop
git pull
make
cd your_project
make build
make
As you can see in the updated examples/histoGUI/histoGUI.xml, a new option <DrawSamePad>true</DrawSamePad> is
available.
When it is true, the array of histograms are drawn on the same pad.
If you have any problems, please let me know.
Best regards,
Ryu
> I need some suggestions regarding drawing multiple histograms on the same pad in
> ROME.
> Here is what I have been doing. I am making a summary histogram online dispaly
> with ARGUS. The displays is gonna show multiple different types of histograms.
>
> So I made a module with four different types of histograms all on the same canvas,
> so that I can look at them in real time in an online run.
>
> Now in one of the histograms, I am looping over multiple banks, so in one of the
> pads, I want to see two different lines of different colors (to indicate two
> different histograms of the same type from two banks).
> So I used histoGUI.xml (from examples/histoGUI) and used this way of histogram
> and tab declarations:
> <Tasks>
> <Task>
> <TaskName>FillHisto</TaskName>
> <Histogram>
> <HistName>h1_Esum</HistName>
>
>
> <HistArraySize>2</HistArraySize>
> <HistFolderName>myhistos</HistFolderName>
> <HistType>TH1F</HistType>
>
> <HistXLabel>ESum</HistXLabel>
> <HistYLabel>Entries</HistYLabel>
> <HistXNbins>300</HistXNbins>
> <HistXmin>0</HistXmin>
> <HistXmax>3.1</HistXmax>
> </Histogram>
>
>
>
>
> <Histogram>
> <HistName>h1_amplitude</HistName>
> <HistFolderName>myotherhistos</HistFolderName>
> <HistArraySize>108</HistArraySize>
>
>
> <HistType>TH1F</HistType>
> <HistXLabel>Amplitude</HistXLabel>
> <HistYLabel>Entries</HistYLabel>
> <HistXNbins>4096</HistXNbins>
> <HistXmin>-0.5</HistXmin>
> <HistXmax>4095.5</HistXmax>
> <Argus>
> <Tab>
> <TabName>GeneratedHisto</TabName>
>
> <ObjectArrayIndex>0</ObjectArrayIndex>
>
> <Index>1</Index>
> </Tab>
> </Argus>
> </Histogram>
>
> etc. and two other histograms have been defined in the same way.
>
> And then in the src/task: HGUITFillHisto.cpp
> I added this: (to draw two histograms on the same pad)
>
> if(icalo==1)
> {
> Geth1_EsumAt(0)->Fill(0.00009118*sum);
>
> Geth1_EsumAt(0)->SetLineColor(3);
>
> }
>
> Geth1_EsumAt(0)->Draw();
>
> if(icalo==2)
> {
> Geth1_EsumAt(1)->Fill(0.00009118*sum);
>
> }
>
> Geth1_EsumAt(1)->Draw("same");
>
> And attached is the screen shot from ARGUS.
>
> Now the problem is: when I add the Draw() and Draw("same") codes in the src/task
> code, it always creates two copies of the same pad. The 0th pad and the very last
> pad. So what ever is on the last pad in the attachment is being replaced by the
> same copy of the 0th pad. I kept chaning the Index number in histoGUI.xml, but what
> ever I do, if I try to draw two histograms on the same pad and add those codes in
> the srdc/task .cpp file, it always creates two copies.
>
> I don't know where to look at to fix the problem.
>
> Is there any other way I can add multiple histograms on a pad, while keeping the
> other pads on the canvas intact?
>
> Any help on this issue will be much appreciated. |