Coding convetion violations fixed.
[u/mrichter/AliRoot.git] / VZERO / AliVZEROTriggerData.cxx
CommitLineData
a08520b8 1\r
2/**************************************************************************\r
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
4 * *\r
5 * Author: The ALICE Off-line Project. *\r
6 * Contributors are mentioned in the code where appropriate. *\r
7 * *\r
8 * Permission to use, copy, modify and distribute this software and its *\r
9 * documentation strictly for non-commercial purposes is hereby granted *\r
10 * without fee, provided that the above copyright notice appears in all *\r
11 * copies and that both the copyright notice and this permission notice *\r
12 * appear in the supporting documentation. The authors make no claims *\r
13 * about the suitability of this software for any purpose. It is *\r
14 * provided "as is" without express or implied warranty. *\r
15 **************************************************************************/\r
16\r
e370cdfe 17// Class AliVZEROTriggerData\r
18// -------------------------\r
19// Retrieves and hold the FEE parameters\r
20// The parameters are recieved from the shuttle \r
21// AliVZEROTriggerData is then used in the AliVZEROTriggerSimulator\r
22//\r
a08520b8 23\r
a08520b8 24#include <TObjString.h>\r
e370cdfe 25#include <TMap.h>\r
a08520b8 26\r
27#include "AliLog.h"\r
28#include "AliDCSValue.h"\r
29#include "AliVZEROTriggerData.h"\r
30\r
31ClassImp(AliVZEROTriggerData)\r
32//________________________________________________________________\r
33\r
34AliVZEROTriggerData::AliVZEROTriggerData() :\r
35 TNamed(),\r
36 fBBAThreshold(0),\r
37 fBBCThreshold(0) , \r
38 fBGAThreshold(0) , \r
39 fBGCThreshold(0) , \r
40 fBBAForBGThreshold(0) , \r
41 fBBCForBGThreshold(0) , \r
42 fCentralityVOAThrLow(0) , \r
43 fCentralityVOAThrHigh(0) , \r
44 fCentralityVOCThrLow(0) , \r
45 fCentralityVOCThrHigh(0) , \r
46 fMultV0AThrLow(0) , \r
47 fMultV0AThrHigh(0) , \r
48 fMultV0CThrLow(0) , \r
49 fMultV0CThrHigh(0),\r
50 fRun(0),\r
51 fStartTime(0),\r
52 fEndTime(0),\r
53 fIsProcessed(kFALSE) \r
54\r
55{\r
e370cdfe 56 // default constructor\r
a08520b8 57 for(int i=0; i<kNCIUBoards ;i++) {\r
58 fClk1Win1[i] = fClk1Win2[i] = 0;\r
59 fDelayClk1Win1[i] = fDelayClk1Win2[i] = 0;\r
60 fClk2Win1[i] = fClk2Win2[i] = 0;\r
61 fDelayClk2Win1[i] = fDelayClk2Win2[i] = 0;\r
62 fLatchWin1[i] = fLatchWin2[i] = 0;\r
63 fResetWin1[i] = fResetWin2[i] = 0;\r
64 fPedestalSubtraction[i] = kFALSE;\r
cefb5c2a 65 for(Int_t j = 0; j < kNChannels; ++j) {\r
66 fEnableCharge[i][j] = fEnableTiming[i][j] = kFALSE;\r
67 fDiscriThr[i][j] = fDelayHit[i][j] = 0;\r
68 fPedestalOdd[i][j] = fPedestalEven[i][j] = 0;\r
69 fPedestalCutOdd[i][j] = fPedestalCutEven[i][j] = 0;\r
70 }\r
a08520b8 71 }\r
3a855906 72 for(Int_t i = 0; i < kNTriggerOutputs; ++i) fTriggerSelected[i] = 0;\r
a08520b8 73}\r
74//________________________________________________________________\r
75AliVZEROTriggerData::AliVZEROTriggerData(Int_t nRun, UInt_t startTime, UInt_t endTime) :\r
76 TNamed(),\r
77 fBBAThreshold(0),\r
78 fBBCThreshold(0) , \r
79 fBGAThreshold(0) , \r
80 fBGCThreshold(0) , \r
81 fBBAForBGThreshold(0) , \r
82 fBBCForBGThreshold(0) , \r
83 fCentralityVOAThrLow(0) , \r
84 fCentralityVOAThrHigh(0) , \r
85 fCentralityVOCThrLow(0) , \r
86 fCentralityVOCThrHigh(0) , \r
87 fMultV0AThrLow(0) , \r
88 fMultV0AThrHigh(0) , \r
89 fMultV0CThrLow(0) , \r
90 fMultV0CThrHigh(0),\r
91 fRun(nRun),\r
92 fStartTime(startTime),\r
93 fEndTime(endTime),\r
94 fIsProcessed(kFALSE)\r
95{\r
e370cdfe 96 // Constructor\r
a08520b8 97 for(int i=0; i<kNCIUBoards ;i++) {\r
98 fClk1Win1[i] = fClk1Win2[i] = 0;\r
99 fDelayClk1Win1[i] = fDelayClk1Win2[i] = 0;\r
100 fClk2Win1[i] = fClk2Win2[i] = 0;\r
101 fDelayClk2Win1[i] = fDelayClk2Win2[i] = 0;\r
102 fLatchWin1[i] = fLatchWin2[i] = 0;\r
103 fResetWin1[i] = fResetWin2[i] = 0;\r
104 fPedestalSubtraction[i] = kFALSE;\r
cefb5c2a 105 for(Int_t j = 0; j < kNChannels; ++j) {\r
106 fEnableCharge[i][j] = fEnableTiming[i][j] = kFALSE;\r
107 fDiscriThr[i][j] = fDelayHit[i][j] = 0;\r
108 fPedestalOdd[i][j] = fPedestalEven[i][j] = 0;\r
109 fPedestalCutOdd[i][j] = fPedestalCutEven[i][j] = 0;\r
110 }\r
a08520b8 111 }\r
3a855906 112 for(Int_t i = 0; i < kNTriggerOutputs; ++i) fTriggerSelected[i] = 0;\r
cefb5c2a 113\r
d5deaaa5 114 TString namst = "VZERO_Trigger_FEE";\r
a08520b8 115 SetName(namst.Data());\r
116 SetTitle(namst.Data());\r
117 \r
118}\r
a08520b8 119\r
120//________________________________________________________________\r
121AliVZEROTriggerData::~AliVZEROTriggerData(){\r
e370cdfe 122 // destructor\r
a08520b8 123}\r
124//_____________________________________________________________________________\r
125void AliVZEROTriggerData::FillData(AliVZERODataFEE * data){\r
e370cdfe 126 // Set all parameters from the data get by the shuttle\r
a08520b8 127 TMap * params = data->GetParameters();\r
128 TIter iter(params); \r
129 TObjString* aliasName;\r
130 \r
131 while (( aliasName = (TObjString*) iter.Next() )) {\r
132 AliDCSValue* aValue = (AliDCSValue*) params->GetValue(aliasName);\r
5978520a 133 Int_t val;\r
e58b4e66 134 if(aValue) {\r
692e31a4 135 val = aValue->GetUInt();\r
5978520a 136 AliInfo(Form("%s : %d",aliasName->String().Data(), val));\r
e58b4e66 137 SetParameter(aliasName->String(),val);\r
138 }\r
a08520b8 139 } \r
140}\r
141\r
142//_____________________________________________________________________________\r
5978520a 143void AliVZEROTriggerData::SetParameter(TString name, Int_t val){\r
e370cdfe 144 // Set given parameter\r
145 \r
a08520b8 146 Int_t iBoard = -1;\r
147 Int_t iChannel = -1;\r
148\r
149 TSeqCollection* nameSplit = name.Tokenize("/");\r
150 TObjString * boardName = (TObjString *)nameSplit->At(2);\r
151 if(!boardName->String().Contains("CCIU")) sscanf(boardName->String().Data(),"CIU%d",&iBoard);\r
152 \r
153 TString paramName = ((TObjString *)nameSplit->At(3))->String();\r
154 Char_t channel[2] ; channel[1] = '\0';\r
155 channel[0] = paramName[paramName.Sizeof()-2];\r
156 sscanf(channel,"%d",&iChannel);\r
157 \r
4bc15c46 158 if(name.Contains("DelayClk1Win1")) SetDelayClk1Win1((UShort_t) val,iBoard);\r
159 else if(name.Contains("Clk1Win1")) SetClk1Win1((UShort_t) val,iBoard);\r
160 else if(name.Contains("DelayClk1Win2")) SetDelayClk1Win2((UShort_t) val,iBoard);\r
161 else if(name.Contains("Clk1Win2")) SetClk1Win2((UShort_t) val,iBoard);\r
162 else if(name.Contains("DelayClk2Win1")) SetDelayClk2Win1((UShort_t) val,iBoard);\r
163 else if(name.Contains("Clk2Win1")) SetClk2Win1((UShort_t) val,iBoard);\r
164 else if(name.Contains("DelayClk2Win2")) SetDelayClk2Win2((UShort_t) val,iBoard);\r
165 else if(name.Contains("Clk2Win2")) SetClk2Win2((UShort_t) val,iBoard);\r
166 else if(name.Contains("LatchWin1")) SetLatchWin1((UShort_t) val,iBoard);\r
167 else if(name.Contains("LatchWin2")) SetLatchWin2((UShort_t) val,iBoard);\r
168 else if(name.Contains("ResetWin1")) SetResetWin1((UShort_t) val,iBoard);\r
169 else if(name.Contains("ResetWin2")) SetResetWin2((UShort_t) val,iBoard);\r
170 else if(name.Contains("PedestalSubtraction")) SetPedestalSubtraction((Bool_t) val,iBoard);\r
a08520b8 171 else if(name.Contains("BBAThreshold")) SetBBAThreshold((UShort_t) val);\r
172 else if(name.Contains("BBCThreshold")) SetBBCThreshold((UShort_t) val);\r
173 else if(name.Contains("BGAThreshold")) SetBGAThreshold((UShort_t) val);\r
174 else if(name.Contains("BGCThreshold")) SetBGCThreshold((UShort_t) val);\r
175 else if(name.Contains("BBAForBGThreshold")) SetBBAForBGThreshold((UShort_t) val);\r
176 else if(name.Contains("BBCForBGThreshold")) SetBBCForBGThreshold((UShort_t) val);\r
177 else if(name.Contains("CentralityV0AThrLow")) SetCentralityV0AThrLow((UShort_t) val);\r
178 else if(name.Contains("CentralityV0AThrHigh")) SetCentralityV0AThrHigh((UShort_t) val);\r
179 else if(name.Contains("CentralityV0CThrLow")) SetCentralityV0CThrLow((UShort_t) val);\r
180 else if(name.Contains("CentralityV0CThrHigh")) SetCentralityV0CThrHigh((UShort_t) val);\r
181 else if(name.Contains("MultV0AThrLow")) SetMultV0AThrLow((UShort_t) val);\r
182 else if(name.Contains("MultV0AThrHigh")) SetMultV0AThrHigh((UShort_t) val);\r
183 else if(name.Contains("MultV0CThrLow")) SetMultV0CThrLow((UShort_t) val);\r
184 else if(name.Contains("MultV0CThrHigh")) SetMultV0CThrHigh((UShort_t) val);\r
5978520a 185 else if(name.Contains("TriggerSelect")) SetTriggerSelected((UShort_t) val, iChannel-1 );\r
4bc15c46 186 else if(name.Contains("EnableCharge")) SetEnableCharge((Bool_t) val, iBoard , iChannel-1);\r
187 else if(name.Contains("EnableTiming")) SetEnableTiming((Bool_t) val, iBoard , iChannel-1);\r
188 else if(name.Contains("DiscriThr")) SetDiscriThr((UShort_t) val, iBoard, iChannel-1);\r
189 else if(name.Contains("DelayHit")) SetDelayHit((UShort_t) val, iBoard, iChannel-1);\r
190 else if(name.Contains("PedOdd")) SetPedestal((UShort_t) val, 1, iBoard, iChannel-1);\r
191 else if(name.Contains("PedEven")) SetPedestal((UShort_t) val, 0, iBoard, iChannel-1);\r
192 else if(name.Contains("PedCutOdd")) SetPedestalCut((UShort_t) val, 1, iBoard, iChannel-1);\r
193 else if(name.Contains("PedCutEven")) SetPedestalCut((UShort_t) val, 0, iBoard, iChannel-1);\r
a08520b8 194 else AliError(Form("No Setter found for FEE parameter : %s",name.Data()));\r
195}\r
196//________________________________________________________________\r
197void AliVZEROTriggerData::SetPedestalCut(UShort_t val,Int_t integrator, Int_t board, Int_t channel)\r
198{\r
e370cdfe 199 // Set Pedestal Cut of individual channel \r
4bc15c46 200 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) {\r
a08520b8 201 if(integrator) fPedestalCutOdd[board][channel] = val;\r
202 else fPedestalCutEven[board][channel] = val;\r
203 } else AliError(Form("Impossible to write at : Board %d ; Channel %d",board,channel));\r
204}\r
205//________________________________________________________________\r
206UShort_t AliVZEROTriggerData::GetPedestalCut(Int_t integrator, Int_t board, Int_t channel)\r
207{\r
e370cdfe 208 // Get Pedestal Cut of individual channel \r
4bc15c46 209 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) {\r
a08520b8 210 if(integrator) return(fPedestalCutOdd[board][channel]);\r
211 else return(fPedestalCutEven[board][channel]);\r
212 }else AliError(Form("Impossible to read at : Board %d ; Channel %d",board,channel));\r
213 return 0;\r
214}\r
215//________________________________________________________________\r
216void AliVZEROTriggerData::SetPedestal(UShort_t val, Int_t integrator, Int_t board, Int_t channel)\r
217{\r
e370cdfe 218 // Set Pedestal of individual channel \r
4bc15c46 219 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) {\r
a08520b8 220 if(integrator) fPedestalOdd[board][channel] = val;\r
221 else fPedestalEven[board][channel] = val;\r
222 } else AliError(Form("Impossible to write at : Board %d ; Channel %d ; Integrator %d ",board,channel,integrator));\r
223}\r
224//________________________________________________________________\r
225UShort_t AliVZEROTriggerData::GetPedestal(Int_t integrator, Int_t board, Int_t channel)\r
226{\r
e370cdfe 227 // Get Pedestal of individual channel \r
4bc15c46 228 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) {\r
a08520b8 229 if(integrator) return(fPedestalOdd[board][channel]);\r
230 else return(fPedestalEven[board][channel]);\r
231 } else AliError(Form("Impossible to read at : Board %d ; Channel %d",board,channel));\r
232 return 0;\r
233}\r
234//________________________________________________________________\r
235void AliVZEROTriggerData::SetDelayHit(UShort_t val,Int_t board, Int_t channel)\r
236{\r
e370cdfe 237 // Set Delay of individual channel \r
4bc15c46 238 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) fDelayHit[board][channel] = val;\r
a08520b8 239 else AliError(Form("Impossible to write at : Board %d ; Channel %d",board,channel));\r
240}\r
241//________________________________________________________________\r
242UShort_t AliVZEROTriggerData::GetDelayHit(Int_t board, Int_t channel)\r
243{\r
e370cdfe 244 // Get Delay of individual channel \r
4bc15c46 245 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) return(fDelayHit[board][channel]);\r
a08520b8 246 else AliError(Form("Impossible to read at : Board %d ; Channel %d",board,channel));\r
247 return 0;\r
248}\r
249//________________________________________________________________\r
250void AliVZEROTriggerData::SetDiscriThr(UShort_t val,Int_t board, Int_t channel)\r
251{\r
e370cdfe 252 // Set discriminator threshold\r
4bc15c46 253 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) fDiscriThr[board][channel] = val;\r
a08520b8 254 else AliError(Form("Impossible to write at : Board %d ; Channel %d",board,channel));\r
255}\r
256//________________________________________________________________\r
257UShort_t AliVZEROTriggerData::GetDiscriThr(Int_t board, Int_t channel)\r
258{\r
e370cdfe 259 // Get discriminator threshold\r
4bc15c46 260 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) return(fDiscriThr[board][channel]);\r
a08520b8 261 else AliError(Form("Impossible to read at : Board %d ; Channel %d",board,channel));\r
262 return 0;\r
263}\r
264//________________________________________________________________\r
265void AliVZEROTriggerData::SetEnableCharge(Bool_t val,Int_t board, Int_t channel)\r
266{\r
e370cdfe 267 // Set the channels enabled for Charge triggers\r
4bc15c46 268 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) fEnableCharge[board][channel] = val;\r
a08520b8 269 else AliError(Form("Impossible to write at : Board %d ; Channel %d",board,channel));\r
270}\r
271//________________________________________________________________\r
272Bool_t AliVZEROTriggerData::GetEnableCharge(Int_t board, Int_t channel)\r
273{\r
e370cdfe 274 // Get the channels enabled for Charge triggers\r
4bc15c46 275 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) return(fEnableCharge[board][channel]);\r
a08520b8 276 else AliError(Form("Impossible to read at : Board %d ; Channel %d",board,channel));\r
277 return kFALSE;\r
278}\r
279//________________________________________________________________\r
280void AliVZEROTriggerData::SetEnableTiming(Bool_t val,Int_t board, Int_t channel)\r
281{\r
e370cdfe 282 // Set the channels enabled for Timing triggers\r
4bc15c46 283 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) fEnableTiming[board][channel] = val;\r
a08520b8 284 else AliError(Form("Impossible to write at : Board %d ; Channel %d",board,channel));\r
285}\r
286//________________________________________________________________\r
287Bool_t AliVZEROTriggerData::GetEnableTiming(Int_t board, Int_t channel)\r
288{\r
e370cdfe 289 // Get the channels enabled for Timing triggers\r
4bc15c46 290 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) return(fEnableTiming[board][channel]);\r
a08520b8 291 else AliError(Form("Impossible to read at : Board %d ; Channel %d",board,channel));\r
292 return kFALSE;\r
293}\r
294//________________________________________________________________\r
295void AliVZEROTriggerData::SetTriggerSelected(UShort_t trigger, Int_t output)\r
296{\r
e370cdfe 297 // Set the trigger selected on the outputs to CTP\r
4bc15c46 298 if(output>=0 && output<kNTriggerOutputs) fTriggerSelected[output] = trigger;\r
a08520b8 299 else AliError(Form("Trigger output number %d not valid",output));\r
300}\r
301\r
302//________________________________________________________________\r
303void AliVZEROTriggerData::SetClk1Win1(UShort_t* clks)\r
304{\r
e370cdfe 305 // Set Win clock of BB\r
a08520b8 306 if(clks) for(int t=0; t<kNCIUBoards; t++) SetClk1Win1(clks[t],t);\r
4bc15c46 307 else AliError("Profil Clock1 Win1 Not defined.");\r
a08520b8 308}\r
309//________________________________________________________________\r
310void AliVZEROTriggerData::SetClk2Win1(UShort_t* clks)\r
311{\r
e370cdfe 312 // Set Win clock of BB\r
a08520b8 313 if(clks) for(int t=0; t<kNCIUBoards; t++) SetClk2Win1(clks[t],t);\r
4bc15c46 314 else AliError("Profil Clock2 Win1 Not defined.");\r
a08520b8 315}\r
316//________________________________________________________________\r
317void AliVZEROTriggerData::SetClk1Win1(UShort_t clk, Int_t board)\r
318{\r
e370cdfe 319 // Set Win clock of BB\r
4bc15c46 320 if((board>=0) && (board<kNCIUBoards)) {\r
321 fClk1Win1[board] = clk;\r
322 if(!IsClkValid(clk)) AliWarning(Form("Profil Clock1 Win1 of board %d is not valid : %d",board,clk));\r
323 }else {\r
324 AliError(Form("Impossible to Write at Board %d",board));\r
325 }\r
a08520b8 326}\r
327//________________________________________________________________\r
328void AliVZEROTriggerData::SetClk2Win1(UShort_t clk, Int_t board)\r
329{\r
e370cdfe 330 // Set Win clock of BB\r
4bc15c46 331 if((board>=0) && (board<kNCIUBoards)) {\r
332 fClk2Win1[board] = clk;\r
333 if(!IsClkValid(clk)) AliWarning(Form("Profil Clock2 Win1 of board %d is not valid : %d",board,clk));\r
334 }else {\r
335 AliError(Form("Impossible to Write at Board %d",board));\r
336 }\r
a08520b8 337}\r
338//________________________________________________________________\r
339void AliVZEROTriggerData::SetClk1Win2(UShort_t* clks)\r
340{\r
e370cdfe 341 // Set Win clock of BG\r
a08520b8 342 if(clks) for(int t=0; t<kNCIUBoards; t++) SetClk1Win2(clks[t],t);\r
4bc15c46 343 else AliError("Profil Clock1 Win2 Not defined.");\r
a08520b8 344}\r
345//________________________________________________________________\r
346void AliVZEROTriggerData::SetClk2Win2(UShort_t* clks)\r
347{\r
e370cdfe 348 // Set Win clock of BG\r
a08520b8 349 if(clks) for(int t=0; t<kNCIUBoards; t++) SetClk2Win2(clks[t],t);\r
4bc15c46 350 else AliError("Profil Clock2 Win2 Not defined.");\r
a08520b8 351}\r
352//________________________________________________________________\r
353void AliVZEROTriggerData::SetClk1Win2(UShort_t clk, Int_t board)\r
354{\r
e370cdfe 355 // Set Win clock of BG\r
4bc15c46 356 if((board>=0) && (board<kNCIUBoards)) {\r
357 fClk1Win2[board] = clk;\r
358 if(!IsClkValid(clk)) AliWarning(Form("Profil Clock1 Win2 of board %d is not valid : %d",board,clk));\r
359 }else {\r
360 AliError(Form("Impossible to Write at Board %d",board));\r
361 }\r
a08520b8 362}\r
363//________________________________________________________________\r
364void AliVZEROTriggerData::SetClk2Win2(UShort_t clk, Int_t board)\r
365{\r
e370cdfe 366 // Set Win clock of BG\r
4bc15c46 367 if((board>=0) && (board<kNCIUBoards)) {\r
368 fClk2Win2[board] = clk;\r
369 if(!IsClkValid(clk)) AliWarning(Form("Profil Clock2 Win2 of board %d is not valid : %d",board,clk));\r
370 }else {\r
371 AliError(Form("Impossible to Write at Board %d",board));\r
372 }\r
a08520b8 373}\r
374//________________________________________________________________\r
375void AliVZEROTriggerData::SetDelayClk1Win1(UShort_t* delays)\r
376{\r
e370cdfe 377 // Set Delay for Win clock of BB\r
a08520b8 378 if(delays) for(int t=0; t<kNCIUBoards; t++) SetDelayClk1Win1(delays[t],t);\r
4bc15c46 379 else AliError("Profil Clock1 Win1 Delays Not defined.");\r
a08520b8 380}\r
381//________________________________________________________________\r
382void AliVZEROTriggerData::SetDelayClk1Win1(UShort_t delay, Int_t board)\r
383{\r
e370cdfe 384 // Set Delay for Win clock of BB\r
a08520b8 385 if(delay>1023){\r
386 AliWarning(Form("Profil Clock1 Win1 Delay of board %d should be less 1023 is currently %d. Truncated to the first 10 bits",board, delay));\r
387 delay = delay & 0x3FF;\r
388 }\r
4bc15c46 389 if((board>=0) && (board<kNCIUBoards)) fDelayClk1Win1[board] = delay;\r
390 else AliError(Form("Trying to write out of the array Board = %d",board));\r
a08520b8 391}\r
392//________________________________________________________________\r
393void AliVZEROTriggerData::SetDelayClk2Win1(UShort_t* delays)\r
394{\r
e370cdfe 395 // Set Delay for Win clock of BB\r
a08520b8 396 if(delays) for(int t=0; t<kNCIUBoards; t++) SetDelayClk2Win1(delays[t],t);\r
4bc15c46 397 else AliError("Profil Clock2 Win1 Delays Not defined.");\r
a08520b8 398}\r
399//________________________________________________________________\r
400void AliVZEROTriggerData::SetDelayClk2Win1(UShort_t delay, Int_t board)\r
401{\r
e370cdfe 402 // Set Delay for Win clock of BB\r
a08520b8 403 if(delay>1023){\r
404 AliWarning(Form("Profil Clock2 Win1 Delay of board %d should be less 1023 is currently %d. Truncated to the first 10 bits",board, delay));\r
405 delay = delay & 0x3FF;\r
406 }\r
4bc15c46 407 if((board>=0) && (board<kNCIUBoards)) fDelayClk2Win1[board] = delay;\r
408 else AliError(Form("Trying to write out of the array Board = %d",board));\r
a08520b8 409}\r
410//________________________________________________________________\r
411void AliVZEROTriggerData::SetDelayClk1Win2(UShort_t* delays)\r
412{\r
e370cdfe 413 // Set Delay for Win clock of BG\r
a08520b8 414 if(delays) for(int t=0; t<kNCIUBoards; t++) SetDelayClk1Win2(delays[t],t);\r
4bc15c46 415 else AliError("Profil Clock1 Win2 Delays Not defined.");\r
a08520b8 416}\r
417//________________________________________________________________\r
418void AliVZEROTriggerData::SetDelayClk1Win2(UShort_t delay, Int_t board)\r
419{\r
e370cdfe 420 // Set Delay for Win clock of BG\r
a08520b8 421 if(delay>1023){\r
422 AliWarning(Form("Profil Clock1 Win2 Delay of board %d should be less 1023 is currently %d. Truncated to the first 10 bits",board, delay));\r
423 delay = delay & 0x3FF;\r
424 }\r
4bc15c46 425 if((board>=0) && (board<kNCIUBoards)) fDelayClk1Win2[board] = delay;\r
426 else AliError(Form("Trying to write out of the array Board = %d",board));\r
a08520b8 427}\r
428//________________________________________________________________\r
429void AliVZEROTriggerData::SetDelayClk2Win2(UShort_t* delays)\r
430{\r
e370cdfe 431 // Set Delay for Win clock of BG\r
a08520b8 432 if(delays) for(int t=0; t<kNCIUBoards; t++) SetDelayClk2Win2(delays[t],t);\r
4bc15c46 433 else AliError("Profil Clock2 Win2 Delays Not defined.");\r
a08520b8 434}\r
435//________________________________________________________________\r
436void AliVZEROTriggerData::SetDelayClk2Win2(UShort_t delay, Int_t board)\r
437{\r
e370cdfe 438 // Set Delay for Win clock of BG\r
a08520b8 439 if(delay>1023){\r
440 AliWarning(Form("Profil Clock2 Win2 Delay of board %d should be less 1023 is currently %d. Truncated to the first 10 bits",board, delay));\r
441 delay = delay & 0x3FF;\r
442 }\r
4bc15c46 443 if((board>=0) && (board<kNCIUBoards)) fDelayClk2Win2[board] = delay;\r
444 else AliError(Form("Trying to write out of the array Board = %d",board));\r
a08520b8 445}\r
446//________________________________________________________________\r
447void AliVZEROTriggerData::SetLatchWin1(UShort_t *latchs){\r
e370cdfe 448 // Set Latch Win clock for BB\r
a08520b8 449 if(latchs) for(int t=0; t<kNCIUBoards; t++) SetLatchWin1(latchs[t],t);\r
4bc15c46 450 else AliError("Latch Win1 profil Not defined.");\r
a08520b8 451}\r
452//________________________________________________________________\r
453void AliVZEROTriggerData::SetLatchWin1(UShort_t latch, Int_t board)\r
454{\r
e370cdfe 455 // Set Latch Win clock for BB\r
4bc15c46 456 if((board>=0) && (board<kNCIUBoards)) {\r
457 fLatchWin1[board] = latch;\r
458 if(!IsClkValid(latch)) AliWarning(Form("Latch Win1 of board %d is not valid : %d",board,latch));\r
459 }else {\r
460 AliError(Form("Impossible to Write at Board %d",board));\r
461 }\r
a08520b8 462}\r
463//________________________________________________________________\r
464void AliVZEROTriggerData::SetLatchWin2(UShort_t *latchs){\r
e370cdfe 465 // Set Latch Win clock for BG\r
a08520b8 466 if(latchs) for(int t=0; t<kNCIUBoards; t++) SetLatchWin2(latchs[t],t);\r
4bc15c46 467 else AliError("Latch Win2 profil Not defined.");\r
a08520b8 468}\r
469//________________________________________________________________\r
470void AliVZEROTriggerData::SetLatchWin2(UShort_t latch, Int_t board)\r
471{\r
e370cdfe 472 // Set Latch Win clock for BG\r
4bc15c46 473 if((board>=0) && (board<kNCIUBoards)) {\r
474 fLatchWin2[board] = latch;\r
475 if(!IsClkValid(latch)) AliWarning(Form("Latch Win2 of board %d is not valid : %d",board,latch));\r
476 }else {\r
477 AliError(Form("Impossible to Write at Board %d",board));\r
478 }\r
a08520b8 479}\r
480//________________________________________________________________\r
481void AliVZEROTriggerData::SetResetWin1(UShort_t *resets){\r
e370cdfe 482 // Set Reset Win clock for BB\r
a08520b8 483 if(resets) for(int t=0; t<kNCIUBoards; t++) SetResetWin1(resets[t],t);\r
4bc15c46 484 else AliError("Reset Win1 profil Not defined.");\r
a08520b8 485}\r
486//________________________________________________________________\r
487void AliVZEROTriggerData::SetResetWin1(UShort_t reset, Int_t board)\r
488{\r
e370cdfe 489 // Set Reset Win clock for BB\r
4bc15c46 490 if((board>=0) && (board<kNCIUBoards)) {\r
491 fResetWin1[board] = reset;\r
492 if(!IsClkValid(reset)) AliWarning(Form("Reset Win1 of board %d is not valid : %d",board,reset));\r
493 }else {\r
494 AliError(Form("Impossible to Write at Board %d",board));\r
495 }\r
a08520b8 496}\r
497//________________________________________________________________\r
498void AliVZEROTriggerData::SetResetWin2(UShort_t *resets){\r
e370cdfe 499 // Set Reset Win clock for BG\r
a08520b8 500 if(resets) for(int t=0; t<kNCIUBoards; t++) SetResetWin2(resets[t],t);\r
4bc15c46 501 else AliError("Reset Win2 profil Not defined.");\r
a08520b8 502}\r
503//________________________________________________________________\r
504void AliVZEROTriggerData::SetResetWin2(UShort_t reset, Int_t board)\r
505{\r
e370cdfe 506 // Set Reset Win clock for BG\r
4bc15c46 507 if((board>=0) && (board<kNCIUBoards)) {\r
508 fResetWin2[board] = reset;\r
509 if(!IsClkValid(reset)) AliWarning(Form("Reset Win2 of board %d is not valid : %d",board,reset));\r
510 }else {\r
511 AliError(Form("Impossible to Write at Board %d",board));\r
512 }\r
a08520b8 513}\r
514//________________________________________________________________\r
515void AliVZEROTriggerData::SetPedestalSubtraction(Bool_t *peds){\r
e370cdfe 516 // Set Pedestal Subtraction Parameter\r
a08520b8 517 if(peds) for(int t=0; t<kNCIUBoards; t++) SetPedestalSubtraction(peds[t],t);\r
4bc15c46 518 else AliError("Pedestal Subtraction Not defined.");\r
a08520b8 519 \r
520}\r
521//________________________________________________________________\r
522void AliVZEROTriggerData::SetPedestalSubtraction(Bool_t ped, Int_t board)\r
523{\r
e370cdfe 524 // Set Pedestal Subtraction Parameter\r
4bc15c46 525 if((board>=0) && (board<kNCIUBoards)) fPedestalSubtraction[board] = ped;\r
a08520b8 526 else AliError(Form("Board %d is not valid",board));\r
527}\r
528\r
529//________________________________________________________________\r
e370cdfe 530Bool_t AliVZEROTriggerData::IsClkValid(UShort_t clock) const {\r
531 // Check if the given clock has a valid profil.\r
a08520b8 532 Bool_t word[5];\r
533 Bool_t isValid = kTRUE;\r
e370cdfe 534 Short_t risingEdge = 0;\r
535 Short_t fallingEdge = 0;\r
a08520b8 536 for(int i=0 ; i<5 ; i++) word[i] = (clock >> i) & 0x1;\r
537 \r
538 if(word[0] != word[4]){\r
e370cdfe 539 if(word[4]) fallingEdge++;\r
540 else risingEdge++;\r
a08520b8 541 } \r
542 for(int i=1 ; i<5 ; i++){\r
543 if(word[i] != word[i-1]) {\r
e370cdfe 544 if(word[i-1]) fallingEdge++;\r
545 else risingEdge++;\r
a08520b8 546 }\r
547 }\r
e370cdfe 548 if((fallingEdge>1)||(risingEdge>1)) isValid = kFALSE;\r
549 if(((risingEdge==0)&&(fallingEdge==0)) &&(!word[0])) isValid = kFALSE;\r
a08520b8 550 return isValid;\r
551}\r
552\r
f3051e80 553\r
e370cdfe 554\r