Added a first documentation draft
[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"
45af6e68 21#include "AliTPCCalibCE.h"
25eb8f52 22#include "AliTPCdataQA.h"
45af6e68 23#include <AmoreDA.h>
e9d4890d 24
25ClassImp(amore::TPC::ui::UIQA)
26
27#include <iostream>
28#include <sstream>
29#include <TCanvas.h>
30
31namespace amore {
32
33namespace TPC {
34
35namespace ui {
36
37using amore::subscriber::Subscribe;
38
45af6e68 39
40
41
e9d4890d 42UIQA::UIQA() {
43
44 Construct(); // Temporary but important!!! Do not forget to put this call in the constructor for the time being!
45
46}
47
48
49UIQA::~UIQA()
50{
51}
52
53void UIQA::Construct() { // The custom GUI is constructed here. gRootFrame is the container of the custom widgets.
54
55 fTab=new TGTab(amore::ui::gRootFrame);
56 amore::ui::gRootFrame->AddFrame(fTab);
57 TGCompositeFrame* tempFrame=fTab->AddTab("My Tab 1");
58 fEC[0]=new TRootEmbeddedCanvas("fEC0", tempFrame, 800, 450);
59 tempFrame->AddFrame(fEC[0]);
60 fEC[0]->GetCanvas()->Divide(3, 3);
61 tempFrame=fTab->AddTab("My Tab 2");
62 amore::ui::gRootFrame->MapSubwindows();
63 amore::ui::gRootFrame->Resize();
64 amore::ui::gRootFrame->MapWindow();
65
66}
67
68void UIQA::SubscribeMonitorObjects() { // Before using any MonitorObject, a subscription should be made.
69
45af6e68 70 //std::ostringstream stringStream;
71 //amore::core::String_t sourceName="CEDA/", subscription; // The agent name acting as a source could be concatenated with all the objects it contains
72 //subscription=sourceName+"CE";
73 //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.
e9d4890d 74 //...
25eb8f52 75 amore::core::String_t sourceName="TPCQA/", subscription;
76 subscription=sourceName+"TPCRAW";
77 Subscribe(subscription.c_str());
78 subscription=sourceName+"hist";
79 Subscribe(subscription.c_str());
80
e9d4890d 81}
82
83void 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...
84 std::ostringstream stringStream;
e9d4890d 85 // Example of accessing a normal TObject. The name is the name of the object in the QA framework
25eb8f52 86
87
88 //amore::core::MonitorObjectTObject* ptr=gSubscriber->At<amore::core::MOTObj>("TPCQA/TPCRAW");
89 amore::core::MonitorObjectTObject* ptr=gSubscriber->At<amore::core::MOTObj>("TPCQA/hist");
90 AliTPCdataQA *tpcqa=0;
91 printf("Pointer - %p\n",ptr);
92 if(ptr) {
93 ptr->Object()->Print();
94 }
95
96 ptr=gSubscriber->At<amore::core::MOTObj>("TPCQA/TPCRAW");
97 tpcqa=0;
98 printf("Pointer - %p\n",ptr);
99 if(ptr) {
100 tpcqa=(AliTPCdataQA*)ptr->Object();
101 printf("Pointertpcqa - %p\n",tpcqa);
102 tpcqa->Print();
103 }
104
105
e9d4890d 106 // End of access example
45af6e68 107
25eb8f52 108 //amore::da::AmoreDA amoreDA;
45af6e68 109 // hCalibCE->Dump();
25eb8f52 110 // TObject *temp=0;
111 //amoreDA.Receive("CEDA/CE",temp);
112 //temp->Dump();
45af6e68 113
e9d4890d 114
115}
116
117void UIQA::Process() {
118
119}
120
121void UIQA::StartOfCycle() {
122
123}
124
125void UIQA::EndOfCycle() {
126
127}
128
129};
130
131};
132
133};