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
39 //_____________________________________________________________________________
\r
40 AliVZEROTrending::AliVZEROTrending(const char* name, const char* title) : TH1(), fNEntries(0), fMultiGraphs(NULL)
\r
44 for(int i=0; i<8;i++) fGraphs[i] = NULL;
\r
46 //_____________________________________________________________________________
\r
47 AliVZEROTrending::AliVZEROTrending(const AliVZEROTrending &trend) :
\r
48 TH1(), fNEntries(trend.fNEntries), fMultiGraphs(NULL)
\r
51 for(int i=0; i<8;i++) fGraphs[i] = NULL;
\r
52 SetName(trend.GetName());
\r
53 SetTitle(trend.GetTitle());
\r
54 for (int i = 0; i < kDataSize; i++) {
\r
55 fTime[i] = trend.fTime[i];
\r
56 for (int j = 0; j < 8; j++) {
\r
57 fData[j][i] = trend.fData[j][i];
\r
62 //_____________________________________________________________________________
\r
63 AliVZEROTrending::~AliVZEROTrending(){
\r
64 for (Int_t i=0; i<8; ++i) delete fGraphs[i];
\r
65 delete fMultiGraphs;
\r
67 // -----------------------------------------------------------------
\r
68 void AliVZEROTrending::AddEntry(Double_t * data, UInt_t time)
\r
71 if(fNEntries<kDataSize){
\r
72 for (int i = 0; i < 8; i++)
\r
74 fData[i][fNEntries] = data[i];
\r
75 fTime[fNEntries] = (double) time;
\r
80 for (int i = 0; i < kDataSize-1; i++){
\r
81 fTime[i] = fTime[i+1];
\r
82 for (int ich = 0; ich < 8; ich++){
\r
83 fData[ich][i] = fData[ich][i+1];
\r
86 for (int i = 0; i < 8; i++)
\r
88 fData[i][fNEntries-1] = data[i];
\r
89 fTime[fNEntries-1] = (double) time;
\r
93 // printf("sizeof UInt_t Double_t %d %d\n",sizeof(UInt_t),sizeof(Double_t));
\r
94 // printf("Add Entry %d @ %f : %f %f %f %f %f %f %f %f \n",fNEntries,fTime[fNEntries-1],
\r
95 // data[0],data[1],data[2],data[3],data[4],data[5],data[6],data[7]);
\r
97 // -----------------------------------------------------------------
\r
98 void AliVZEROTrending::PrintEntry(UInt_t entry)
\r
101 if(entry>=fNEntries){
\r
102 AliError(Form("maximum entry is %d\n",fNEntries-1));
\r
104 AliInfo(Form("Entry %d @ %f : %f %f %f %f %f %f %f %f \n",entry, fTime[entry],
\r
105 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
110 // -----------------------------------------------------------------
\r
111 void AliVZEROTrending::Draw(Option_t *option){
\r
112 TString opt = option;
\r
113 fMultiGraphs = new TMultiGraph();
\r
114 fMultiGraphs->SetTitle(GetTitle());
\r
116 for(int i=0;i<8;i++) {
\r
117 fGraphs[i] = new TGraph(GetNEntries(), GetTime(), GetChannel(i));
\r
118 fGraphs[i]->SetLineWidth(2);
\r
119 fGraphs[i]->SetLineColor(i<4 ? i+1 : i -3);
\r
120 fGraphs[i]->SetLineStyle(i<4 ? 1 : 2);
\r
121 fMultiGraphs->Add(fGraphs[i]);
\r
124 fMultiGraphs->Draw("AL");
\r
125 fMultiGraphs->GetXaxis()->SetTimeDisplay(1);
\r
126 fMultiGraphs->GetXaxis()->SetNdivisions(505,kFALSE);
\r
127 fMultiGraphs->Draw("AL");
\r
128 TLegend * legend = new TLegend(0.7,0.65,0.86,0.88);
\r
129 legend->AddEntry(fGraphs[4],"V0A - Ring0","l");
\r
130 legend->AddEntry(fGraphs[5],"V0A - Ring1","l");
\r
131 legend->AddEntry(fGraphs[6],"V0A - Ring2","l");
\r
132 legend->AddEntry(fGraphs[7],"V0A - Ring3","l");
\r
133 legend->AddEntry(fGraphs[0],"V0C - Ring0","l");
\r
134 legend->AddEntry(fGraphs[1],"V0C - Ring1","l");
\r
135 legend->AddEntry(fGraphs[2],"V0C - Ring2","l");
\r
136 legend->AddEntry(fGraphs[3],"V0C - Ring3","l");
\r