1 /**************************************************************************
\r
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
\r
4 * Author: The ALICE Off-line Project. *
\r
5 * Contributors are mentioned in the code where appropriate. *
\r
7 * Permission to use, copy, modify and distribute this software and its *
\r
8 * documentation strictly for non-commercial purposes is hereby granted *
\r
9 * without fee, provided that the above copyright notice appears in all *
\r
10 * copies and that both the copyright notice and this permission notice *
\r
11 * appear in the supporting documentation. The authors make no claims *
\r
12 * about the suitability of this software for any purpose. It is *
\r
13 * provided "as is" without express or implied warranty. *
\r
14 **************************************************************************/
\r
17 // Class AliVZEROTrending
\r
18 // ---------------------------
\r
20 // class used in QA to publish variables evolution versus time in AMORE.
\r
21 // These histo are the one which will be looked at by QA Shifter
\r
24 #include "TMultiGraph.h"
\r
25 #include "TLegend.h"
\r
26 #include "TString.h"
\r
29 #include "AliVZEROTrending.h"
\r
31 ClassImp(AliVZEROTrending)
\r
33 //_____________________________________________________________________________
\r
34 AliVZEROTrending::AliVZEROTrending() : TH1(), fNEntries(0), fMultiGraphs(NULL)
\r
36 // Default constructor
\r
37 for(int i=0; i<8;i++) fGraphs[i] = NULL;
\r
38 for (int i = 0; i < kDataSize; i++) {
\r
40 for (int j = 0; j < 8; j++) {
\r
45 //_____________________________________________________________________________
\r
46 AliVZEROTrending::AliVZEROTrending(const char* name, const char* title) : TH1(), fNEntries(0), fMultiGraphs(NULL)
\r
50 for(int i=0; i<8;i++) fGraphs[i] = NULL;
\r
51 for (int i = 0; i < kDataSize; i++) {
\r
53 for (int j = 0; j < 8; j++) {
\r
58 //_____________________________________________________________________________
\r
59 AliVZEROTrending::AliVZEROTrending(const AliVZEROTrending &trend) :
\r
60 TH1(), fNEntries(trend.fNEntries), fMultiGraphs(NULL)
\r
63 for(int i=0; i<8;i++) fGraphs[i] = NULL;
\r
64 SetName(trend.GetName());
\r
65 SetTitle(trend.GetTitle());
\r
66 for (int i = 0; i < kDataSize; i++) {
\r
67 fTime[i] = trend.fTime[i];
\r
68 for (int j = 0; j < 8; j++) {
\r
69 fData[j][i] = trend.fData[j][i];
\r
74 //_____________________________________________________________________________
\r
75 AliVZEROTrending::~AliVZEROTrending(){
\r
76 for (Int_t i=0; i<8; ++i) delete fGraphs[i];
\r
77 delete fMultiGraphs;
\r
79 // -----------------------------------------------------------------
\r
80 void AliVZEROTrending::AddEntry(Double_t * data, UInt_t time)
\r
83 if(fNEntries<kDataSize){
\r
84 for (int i = 0; i < 8; i++)
\r
86 fData[i][fNEntries] = data[i];
\r
87 fTime[fNEntries] = (double) time;
\r
92 for (int i = 0; i < kDataSize-1; i++){
\r
93 fTime[i] = fTime[i+1];
\r
94 for (int ich = 0; ich < 8; ich++){
\r
95 fData[ich][i] = fData[ich][i+1];
\r
98 for (int i = 0; i < 8; i++)
\r
100 fData[i][fNEntries-1] = data[i];
\r
101 fTime[fNEntries-1] = (double) time;
\r
105 // printf("sizeof UInt_t Double_t %d %d\n",sizeof(UInt_t),sizeof(Double_t));
\r
106 // printf("Add Entry %d @ %f : %f %f %f %f %f %f %f %f \n",fNEntries,fTime[fNEntries-1],
\r
107 // data[0],data[1],data[2],data[3],data[4],data[5],data[6],data[7]);
\r
109 // -----------------------------------------------------------------
\r
110 void AliVZEROTrending::PrintEntry(UInt_t entry)
\r
113 if(entry>=fNEntries){
\r
114 AliError(Form("maximum entry is %d\n",fNEntries-1));
\r
116 AliInfo(Form("Entry %d @ %f : %f %f %f %f %f %f %f %f \n",entry, fTime[entry],
\r
117 fData[0][entry],fData[1][entry],fData[2][entry],fData[3][entry],fData[4][entry],fData[5][entry],fData[6][entry],fData[7][entry]));
\r
122 // -----------------------------------------------------------------
\r
123 void AliVZEROTrending::Draw(Option_t *option){
\r
124 TString opt = option;
\r
125 fMultiGraphs = new TMultiGraph();
\r
126 fMultiGraphs->SetTitle(GetTitle());
\r
128 for(int i=0;i<8;i++) {
\r
129 fGraphs[i] = new TGraph(GetNEntries(), GetTime(), GetChannel(i));
\r
130 fGraphs[i]->SetLineWidth(2);
\r
131 fGraphs[i]->SetLineColor(i<4 ? i+1 : i -3);
\r
132 fGraphs[i]->SetLineStyle(i<4 ? 1 : 2);
\r
133 fMultiGraphs->Add(fGraphs[i]);
\r
136 fMultiGraphs->Draw("AL");
\r
137 fMultiGraphs->GetXaxis()->SetTimeDisplay(1);
\r
138 fMultiGraphs->GetXaxis()->SetNdivisions(505,kFALSE);
\r
139 fMultiGraphs->Draw("AL");
\r
140 TLegend * legend = new TLegend(0.7,0.65,0.86,0.88);
\r
141 legend->AddEntry(fGraphs[4],"V0A - Ring0","l");
\r
142 legend->AddEntry(fGraphs[5],"V0A - Ring1","l");
\r
143 legend->AddEntry(fGraphs[6],"V0A - Ring2","l");
\r
144 legend->AddEntry(fGraphs[7],"V0A - Ring3","l");
\r
145 legend->AddEntry(fGraphs[0],"V0C - Ring0","l");
\r
146 legend->AddEntry(fGraphs[1],"V0C - Ring1","l");
\r
147 legend->AddEntry(fGraphs[2],"V0C - Ring2","l");
\r
148 legend->AddEntry(fGraphs[3],"V0C - Ring3","l");
\r