]> git.uio.no Git - u/mrichter/AliRoot.git/blob - VZERO/AliVZERODataFEE.cxx
Include EAs from offline c3 fits
[u/mrichter/AliRoot.git] / VZERO / AliVZERODataFEE.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15 // ---------------------
16 // Class AliVZERODataFEE
17 // ---------------------
18 // Used to process the TMap of DCS values comming from the shuttle.
19 // It stores into a TMap the FEE parameters for the given run number
20 //
21
22 #include <TTimeStamp.h>
23 #include <TObjString.h>
24 #include <TMap.h>
25
26 #include "AliDCSValue.h"
27 #include "AliLog.h"
28 #include "AliVZERODataFEE.h"
29
30 ClassImp(AliVZERODataFEE)
31
32 //_____________________________________________________________________________
33 AliVZERODataFEE::AliVZERODataFEE() :
34         TObject(),
35         fRun(0),
36         fStartTime(0),
37         fEndTime(0),
38         fIsProcessed(kFALSE),
39         fParameters(NULL)
40 {
41         // Default constructor
42 }
43
44 //_____________________________________________________________________________
45 AliVZERODataFEE::AliVZERODataFEE(Int_t nRun, UInt_t startTime, UInt_t endTime) : 
46         TObject(),
47         fRun(nRun),
48         fStartTime(startTime),
49         fEndTime(endTime),
50         fIsProcessed(kFALSE),
51         fParameters(new TMap())
52 {
53         // Constructor
54         AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", nRun,
55                                  TTimeStamp(startTime).AsString(),
56                                  TTimeStamp(endTime).AsString()));
57         fParameters->SetOwnerValue();
58         Init();
59 }
60
61 //_____________________________________________________________________________
62 AliVZERODataFEE::~AliVZERODataFEE()
63 {
64         delete fParameters;
65 }
66
67 //_____________________________________________________________________________
68 void AliVZERODataFEE::Init(){
69         // Initialization of DCS aliases
70         int iAlias = 0;
71
72         // CCIU Parameters
73         
74         fAliasNames[iAlias++] = "V00/FEE/CCIU/BBAThreshold";
75         fAliasNames[iAlias++] = "V00/FEE/CCIU/BBCThreshold";
76         fAliasNames[iAlias++] = "V00/FEE/CCIU/BGAThreshold";
77         fAliasNames[iAlias++] = "V00/FEE/CCIU/BGCThreshold";
78         fAliasNames[iAlias++] = "V00/FEE/CCIU/BBAForBGThreshold";
79         fAliasNames[iAlias++] = "V00/FEE/CCIU/BBCForBGThreshold";
80         fAliasNames[iAlias++] = "V00/FEE/CCIU/CentralityV0AThrLow";
81         fAliasNames[iAlias++] = "V00/FEE/CCIU/CentralityV0AThrHigh";
82         fAliasNames[iAlias++] = "V00/FEE/CCIU/CentralityV0CThrLow";
83         fAliasNames[iAlias++] = "V00/FEE/CCIU/CentralityV0CThrHigh";
84         fAliasNames[iAlias++] = "V00/FEE/CCIU/MultV0AThrLow";
85         fAliasNames[iAlias++] = "V00/FEE/CCIU/MultV0AThrHigh";
86         fAliasNames[iAlias++] = "V00/FEE/CCIU/MultV0CThrLow";
87         fAliasNames[iAlias++] = "V00/FEE/CCIU/MultV0CThrHigh";
88         for(int i=1;i<=5;i++) {
89                 fAliasNames[iAlias] = "V00/FEE/CCIU/TriggerSelect";
90                 fAliasNames[iAlias++] += Form("%d",i);
91         }
92         
93         // CIU  Parameters
94         
95         for(int iCIU = 0; iCIU<8 ; iCIU++){
96                 for(int iParam=0; iParam<kNCIUParam;iParam++){
97                         fAliasNames[iAlias] = "V00/FEE/";
98                         fAliasNames[iAlias] += Form("CIU%d/",iCIU);
99                         
100                         fAliasNames[iAlias] += GetFEEParamName(iParam);
101                         iAlias++;
102                 }
103                 for(int iParam=kNCIUParam; iParam<kNCIUParam+kNChannelParam;iParam++){
104                         for(int iCh=1;iCh<=8;iCh++){
105                                 fAliasNames[iAlias] = "V00/FEE/";
106                                 fAliasNames[iAlias] += Form("CIU%d/",iCIU);
107                         
108                                 fAliasNames[iAlias] += GetFEEParamName(iParam);
109                                 fAliasNames[iAlias] += Form("%d",iCh);
110                         
111                                 iAlias++;
112                         }
113                 }
114                 
115         }
116
117         if(iAlias!=kNAliases) 
118                 AliError(Form("Number of FEE Aliases defined not correct"));
119         
120 }
121 //_____________________________________________________________________________
122 void AliVZERODataFEE::ProcessData(TMap& aliasMap){
123 // Process the TMap of DCS data
124         
125         if(!(fAliasNames[0])) Init();
126         
127         TObjArray *aliasArr;
128         AliDCSValue* aValue;
129
130         // starting loop on aliases
131         for(int iAlias=0; iAlias<kNAliases; iAlias++){
132                 
133                 aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[iAlias].Data());
134                 if(!aliasArr){
135                         AliError(Form("Alias %s not found!", fAliasNames[iAlias].Data()));
136                         return;
137                 }
138                                 
139                 if(aliasArr->GetEntries()<1){
140                         AliError(Form("Alias %s has no entries!", fAliasNames[iAlias].Data()));
141                         continue;
142                 }
143                 
144                 TIter iterarray(aliasArr);
145                                 
146                 AliDCSValue * lastVal = NULL;
147                 while((aValue = (AliDCSValue*) iterarray.Next())) lastVal = aValue; // Take only the last value
148                 
149                 fParameters->Add(new TObjString(fAliasNames[iAlias].Data()),lastVal);
150                 
151         }
152         
153         fIsProcessed=kTRUE;
154         
155 }
156 //_____________________________________________________________________________
157
158 TString AliVZERODataFEE::GetFEEParamName(Int_t iParam){
159 // Return the name of the FEE Parameter iParam
160         TString result;
161         if(iParam>kNCIUParam + kNChannelParam -1) {
162                 AliError(Form("Requesting FEE parameter number %d. Max parameter number is : %d",iParam,kNCIUParam + kNChannelParam-1));
163                 return result;
164         }
165         switch (iParam) {
166                 case 0: result = "Clk1Win1"; break;
167                 case 1: result = "Clk2Win1"; break;
168                 case 2: result = "Clk1Win2"; break;
169                 case 3: result = "Clk2Win2"; break;
170                 case 4: result = "DelayClk1Win1"; break;
171                 case 5: result = "DelayClk2Win1"; break;
172                 case 6: result = "DelayClk1Win2"; break;
173                 case 7: result = "DelayClk2Win2"; break;
174                 case 8: result = "LatchWin1"; break;
175                 case 9: result = "LatchWin2"; break;
176                 case 10: result = "ResetWin1"; break;
177                 case 11: result = "ResetWin2"; break;
178                 case 12: result = "PedestalSubtraction"; break;
179                 case 13: result = "EnableCharge"; break;
180                 case 14: result = "EnableTiming"; break;
181                 case 15: result = "PedEven"; break;
182                 case 16: result = "PedOdd"; break;
183                 case 17: result = "PedCutEven"; break;
184                 case 18: result = "PedCutOdd"; break;
185                 case 19: result = "DelayHit"; break;
186                 case 20: result = "DiscriThr"; break;
187         }
188         return result;
189 }
190
191 void AliVZERODataFEE::PrintAliases(){
192         for(int i=0;i<kNAliases;i++) AliInfo(Form("%s",fAliasNames[i].Data()));
193 }
194