Step by Step - Adding Histograms |
This page explains how to use histograms in your framework.
The following example is based on the stepbystep example. It is located under 'rome/examples/stepbystephisto'.
ROME histograms belong to tasks. Therefore you have to add a <histogram> section under the <task> tag.
<Tasks> <Task> <TaskName>PrintADCValues</TaskName> <Histogram> <HistName>ADC</HistName> <HistFolderName>adc</HistFolderName> <HistType>TH1F</HistType> <HistXLabel>ADC []</HistXLabel> <HistYLabel>Entries</HistYLabel> <HistXNbins>100</HistXNbins> <HistXmin>0</HistXmin> <HistXmax>100</HistXmax> </Histogram> </Task> </Tasks> |
To keep the example simple I also removed the <ArraySize> tag of the folder to have a single folder.
No changes are needed in the configuration file.
I removed the loops because I don't have an array folder anymore. And I fill now a Gaussian distribution to the folder. The folder content gets then filled to the histogram.
void SBSTPrintADCValues::Event() { gAnalyzer->GetPMTData()->SetADC(gRandom->Gaus(50,10)); GetADC()->Fill(gAnalyzer->GetPMTData()->GetADC()); if (gAnalyzer->GetGSP()->GetOutputOnOff()) { cout << gAnalyzer->GetPMTData()->GetADC() << endl; cout << endl; } } |
Run the ROMEBuilder and start the program. The program will run again endlessly. Stop the program by typing 's'. Then start the ROOT browser by typing :
> TBrowser t |
The histogram is located under 'SBS/histos/PrintADCValues/adc'. Double click the histogram to display it.
In the example above we didn't change the configuration file. Nevertheless, there is the possibility to add all histogram tags excluding the <HistName>, <HistFolderName> and <HistType> tag also to the configuration file. The advantage of adding them to the configuration file is that you don't have to run the ROMEBuilder every time the value of the tag changes. The tags can also be added to both the definition file and the configuration file. The value in the configuration file overwrites the value in the definition file.
For a description of all available tags of the definition file please see the XML framework definition schema documentation section of the users guide.
For a description of all available tags of the configuration file please see the XML configuration schema documentation section of the users guide.
Matthias Schneebeli, Ryu Sawada | |
e-mail: ryu.sawada@cern.ch |