Version 0 of the AMORE implementation for TPC
[u/mrichter/AliRoot.git] / TPC / amoreTPC-QA / src / ui / UIQA.cxx
CommitLineData
e9d4890d 1/***************************************************************************
2 * Copyright (C) 2007 by Filimon Roukoutakis *
3 * Filimon.Roukoutakis@cern.ch *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20#include "UIQA.h"
21
22ClassImp(amore::TPC::ui::UIQA)
23
24#include <iostream>
25#include <sstream>
26#include <TCanvas.h>
27
28namespace amore {
29
30namespace TPC {
31
32namespace ui {
33
34using amore::subscriber::Subscribe;
35
36UIQA::UIQA() {
37
38 Construct(); // Temporary but important!!! Do not forget to put this call in the constructor for the time being!
39
40}
41
42
43UIQA::~UIQA()
44{
45}
46
47void UIQA::Construct() { // The custom GUI is constructed here. gRootFrame is the container of the custom widgets.
48
49 fTab=new TGTab(amore::ui::gRootFrame);
50 amore::ui::gRootFrame->AddFrame(fTab);
51 TGCompositeFrame* tempFrame=fTab->AddTab("My Tab 1");
52 fEC[0]=new TRootEmbeddedCanvas("fEC0", tempFrame, 800, 450);
53 tempFrame->AddFrame(fEC[0]);
54 fEC[0]->GetCanvas()->Divide(3, 3);
55 tempFrame=fTab->AddTab("My Tab 2");
56 amore::ui::gRootFrame->MapSubwindows();
57 amore::ui::gRootFrame->Resize();
58 amore::ui::gRootFrame->MapWindow();
59
60}
61
62void UIQA::SubscribeMonitorObjects() { // Before using any MonitorObject, a subscription should be made.
63
64 std::ostringstream stringStream;
65 amore::core::String_t sourceName="PHOSQA", subscription; // The agent name acting as a source could be concatenated with all the objects it contains
66 subscription=sourceName+"/moInt1";
67 Subscribe(moInt1, subscription.c_str());
68 subscription=sourceName+"/hHighPhosModules";
69 Subscribe(subscription.c_str()); // Here you put a series of subscriptions where the string corresponds to the object name as published in the Publisher Module. As these names are internal to the QA framework, the recommended way of having consistency between AMORE and QA is to factor-out of QA the function that represents the histogram naming convention as a separate AliRoot class/function and use it from inside QA and AMORE.
70 //...
71
72}
73
74void UIQA::Update() { // This is executed after getting the updated contents of the subscribed MonitorObjects. Notice that the output of moInt[i] and moString[i] varies with time for a specific i because on the dqmAgent the "quality" check fails or succeeds. This is the essence of automatic data quality checks in AMORE. Try to use the moString[i] on a text widget to alert the shifter, or -depending of the value of moInt[i], 0 or 1- make part of the screen change color...
75 std::ostringstream stringStream;
76
77 // Example of accessing a normal TObject. The name is the name of the object in the QA framework
78 amore::core::MonitorObjectTObject* ptr=gSubscriber->At<amore::core::MOTObj>("PHOSQA/hHighPhosModules");
79 TH1F* hHighPhosModules=0;
80 if(ptr) {
81 hHighPhosModules=(TH1F*)ptr->Object();
82 }
83 // End of access example
84
85 fEC[0]->GetCanvas()->cd(1);
86 if(hHighPhosModules) hHighPhosModules->Draw();
87 for(size_t i=1; i<=4; ++i) {
88 //Fill the other pads similarly...
89 }
90 fEC[0]->GetCanvas()->Update();
91
92}
93
94void UIQA::Process() {
95
96}
97
98void UIQA::StartOfCycle() {
99
100}
101
102void UIQA::EndOfCycle() {
103
104}
105
106};
107
108};
109
110};