]> git.uio.no Git - u/mrichter/AliRoot.git/blob - VZERO/AliVZEROTrending.cxx
change to new trending convention
[u/mrichter/AliRoot.git] / VZERO / AliVZEROTrending.cxx
1 /**************************************************************************\r
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
3  *                                                                        *\r
4  * Author: The ALICE Off-line Project.                                    *\r
5  * Contributors are mentioned in the code where appropriate.              *\r
6  *                                                                        *\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
15 \r
16 // \r
17 // Class AliVZEROTrending\r
18 // ---------------------------\r
19 // \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
22 // \r
23 #include "TGraph.h"\r
24 \r
25 #include "AliLog.h"\r
26 #include "AliVZEROTrending.h"\r
27 \r
28 ClassImp(AliVZEROTrending)\r
29 \r
30 //_____________________________________________________________________________\r
31 AliVZEROTrending::AliVZEROTrending() : TH1(), fNEntries(0)\r
32 {\r
33         // Default constructor\r
34 }\r
35 //_____________________________________________________________________________\r
36 AliVZEROTrending::AliVZEROTrending(const char* name, const char* title) : TH1(), fNEntries(0)\r
37 {\r
38         SetName(name);\r
39         SetTitle(title);\r
40 }\r
41 //_____________________________________________________________________________\r
42 AliVZEROTrending::AliVZEROTrending(const AliVZEROTrending &trend) : \r
43         TH1(), fNEntries(trend.fNEntries)\r
44 {\r
45         // Copy constructor\r
46         SetName(trend.GetName());\r
47         SetTitle(trend.GetTitle());\r
48         for (int i = 0; i < kDataSize; i++) {\r
49                 fTime[i] = trend.fTime[i];\r
50                 for (int j = 0; j < 8; j++) {\r
51                         fData[j][i] = trend.fData[j][i];\r
52                 }\r
53         }\r
54 }\r
55 \r
56 //_____________________________________________________________________________\r
57 AliVZEROTrending::~AliVZEROTrending(){\r
58         // Destructor\r
59 }\r
60 // -----------------------------------------------------------------                    \r
61 void AliVZEROTrending::AddEntry(Double_t * data, UInt_t time)\r
62 {\r
63 \r
64         if(fNEntries<kDataSize){\r
65                 for (int i = 0; i < 8; i++)\r
66                 {\r
67                         fData[i][fNEntries] = data[i];\r
68                         fTime[fNEntries] = (double) time;\r
69                 }\r
70                 fNEntries++;    \r
71         }else{\r
72 \r
73                 for (int i = 0; i < kDataSize-1; i++){\r
74                         fTime[i] = fTime[i+1];\r
75                         for (int ich = 0; ich < 8; ich++){              \r
76                                 fData[ich][i] = fData[ich][i+1];\r
77                         }       \r
78                 }\r
79                 for (int i = 0; i < 8; i++)\r
80                 {\r
81                         fData[i][fNEntries-1] = data[i];\r
82                         fTime[fNEntries-1] = (double) time;\r
83                 }\r
84                 \r
85         }\r
86         //printf("sizeof UInt_t Double_t %d %d\n",sizeof(UInt_t),sizeof(Double_t));\r
87         //printf("Add Entry %d @ %f : %f %f %f %f %f %f %f %f \n",fNEntries,fTime[fNEntries-1], \r
88         //      data[0],data[1],data[2],data[3],data[4],data[5],data[6],data[7]);\r
89 }                       \r
90 // -----------------------------------------------------------------                    \r
91 void AliVZEROTrending::PrintEntry(UInt_t entry)\r
92 {\r
93 \r
94         if(entry>=fNEntries){\r
95                 AliError(Form("maximum entry is %d\n",fNEntries-1));\r
96         }else{\r
97                 AliInfo(Form("Entry %d @ %f : %f %f %f %f %f %f %f %f \n",entry, fTime[entry],\r
98                         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
99 \r
100         }\r
101 }                       \r