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