Coding convention violations: suppression
[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
65 }\r
66}\r
67//________________________________________________________________\r
68AliVZEROTriggerData::AliVZEROTriggerData(Int_t nRun, UInt_t startTime, UInt_t endTime) :\r
69 TNamed(),\r
70 fBBAThreshold(0),\r
71 fBBCThreshold(0) , \r
72 fBGAThreshold(0) , \r
73 fBGCThreshold(0) , \r
74 fBBAForBGThreshold(0) , \r
75 fBBCForBGThreshold(0) , \r
76 fCentralityVOAThrLow(0) , \r
77 fCentralityVOAThrHigh(0) , \r
78 fCentralityVOCThrLow(0) , \r
79 fCentralityVOCThrHigh(0) , \r
80 fMultV0AThrLow(0) , \r
81 fMultV0AThrHigh(0) , \r
82 fMultV0CThrLow(0) , \r
83 fMultV0CThrHigh(0),\r
84 fRun(nRun),\r
85 fStartTime(startTime),\r
86 fEndTime(endTime),\r
87 fIsProcessed(kFALSE)\r
88{\r
e370cdfe 89 // Constructor\r
a08520b8 90 for(int i=0; i<kNCIUBoards ;i++) {\r
91 fClk1Win1[i] = fClk1Win2[i] = 0;\r
92 fDelayClk1Win1[i] = fDelayClk1Win2[i] = 0;\r
93 fClk2Win1[i] = fClk2Win2[i] = 0;\r
94 fDelayClk2Win1[i] = fDelayClk2Win2[i] = 0;\r
95 fLatchWin1[i] = fLatchWin2[i] = 0;\r
96 fResetWin1[i] = fResetWin2[i] = 0;\r
97 fPedestalSubtraction[i] = kFALSE;\r
98 }\r
d5deaaa5 99 TString namst = "VZERO_Trigger_FEE";\r
a08520b8 100 SetName(namst.Data());\r
101 SetTitle(namst.Data());\r
102 \r
103}\r
a08520b8 104\r
105//________________________________________________________________\r
106AliVZEROTriggerData::~AliVZEROTriggerData(){\r
e370cdfe 107 // destructor\r
a08520b8 108}\r
109//_____________________________________________________________________________\r
110void AliVZEROTriggerData::FillData(AliVZERODataFEE * data){\r
e370cdfe 111 // Set all parameters from the data get by the shuttle\r
a08520b8 112 TMap * params = data->GetParameters();\r
113 TIter iter(params); \r
114 TObjString* aliasName;\r
115 \r
116 while (( aliasName = (TObjString*) iter.Next() )) {\r
117 AliDCSValue* aValue = (AliDCSValue*) params->GetValue(aliasName);\r
5978520a 118 Int_t val;\r
e58b4e66 119 if(aValue) {\r
692e31a4 120 val = aValue->GetUInt();\r
5978520a 121 AliInfo(Form("%s : %d",aliasName->String().Data(), val));\r
e58b4e66 122 SetParameter(aliasName->String(),val);\r
123 }\r
a08520b8 124 } \r
125}\r
126\r
127//_____________________________________________________________________________\r
5978520a 128void AliVZEROTriggerData::SetParameter(TString name, Int_t val){\r
e370cdfe 129 // Set given parameter\r
130 \r
a08520b8 131 Int_t iBoard = -1;\r
132 Int_t iChannel = -1;\r
133\r
134 TSeqCollection* nameSplit = name.Tokenize("/");\r
135 TObjString * boardName = (TObjString *)nameSplit->At(2);\r
136 if(!boardName->String().Contains("CCIU")) sscanf(boardName->String().Data(),"CIU%d",&iBoard);\r
137 \r
138 TString paramName = ((TObjString *)nameSplit->At(3))->String();\r
139 Char_t channel[2] ; channel[1] = '\0';\r
140 channel[0] = paramName[paramName.Sizeof()-2];\r
141 sscanf(channel,"%d",&iChannel);\r
142 \r
4bc15c46 143 if(name.Contains("DelayClk1Win1")) SetDelayClk1Win1((UShort_t) val,iBoard);\r
144 else if(name.Contains("Clk1Win1")) SetClk1Win1((UShort_t) val,iBoard);\r
145 else if(name.Contains("DelayClk1Win2")) SetDelayClk1Win2((UShort_t) val,iBoard);\r
146 else if(name.Contains("Clk1Win2")) SetClk1Win2((UShort_t) val,iBoard);\r
147 else if(name.Contains("DelayClk2Win1")) SetDelayClk2Win1((UShort_t) val,iBoard);\r
148 else if(name.Contains("Clk2Win1")) SetClk2Win1((UShort_t) val,iBoard);\r
149 else if(name.Contains("DelayClk2Win2")) SetDelayClk2Win2((UShort_t) val,iBoard);\r
150 else if(name.Contains("Clk2Win2")) SetClk2Win2((UShort_t) val,iBoard);\r
151 else if(name.Contains("LatchWin1")) SetLatchWin1((UShort_t) val,iBoard);\r
152 else if(name.Contains("LatchWin2")) SetLatchWin2((UShort_t) val,iBoard);\r
153 else if(name.Contains("ResetWin1")) SetResetWin1((UShort_t) val,iBoard);\r
154 else if(name.Contains("ResetWin2")) SetResetWin2((UShort_t) val,iBoard);\r
155 else if(name.Contains("PedestalSubtraction")) SetPedestalSubtraction((Bool_t) val,iBoard);\r
a08520b8 156 else if(name.Contains("BBAThreshold")) SetBBAThreshold((UShort_t) val);\r
157 else if(name.Contains("BBCThreshold")) SetBBCThreshold((UShort_t) val);\r
158 else if(name.Contains("BGAThreshold")) SetBGAThreshold((UShort_t) val);\r
159 else if(name.Contains("BGCThreshold")) SetBGCThreshold((UShort_t) val);\r
160 else if(name.Contains("BBAForBGThreshold")) SetBBAForBGThreshold((UShort_t) val);\r
161 else if(name.Contains("BBCForBGThreshold")) SetBBCForBGThreshold((UShort_t) val);\r
162 else if(name.Contains("CentralityV0AThrLow")) SetCentralityV0AThrLow((UShort_t) val);\r
163 else if(name.Contains("CentralityV0AThrHigh")) SetCentralityV0AThrHigh((UShort_t) val);\r
164 else if(name.Contains("CentralityV0CThrLow")) SetCentralityV0CThrLow((UShort_t) val);\r
165 else if(name.Contains("CentralityV0CThrHigh")) SetCentralityV0CThrHigh((UShort_t) val);\r
166 else if(name.Contains("MultV0AThrLow")) SetMultV0AThrLow((UShort_t) val);\r
167 else if(name.Contains("MultV0AThrHigh")) SetMultV0AThrHigh((UShort_t) val);\r
168 else if(name.Contains("MultV0CThrLow")) SetMultV0CThrLow((UShort_t) val);\r
169 else if(name.Contains("MultV0CThrHigh")) SetMultV0CThrHigh((UShort_t) val);\r
5978520a 170 else if(name.Contains("TriggerSelect")) SetTriggerSelected((UShort_t) val, iChannel-1 );\r
4bc15c46 171 else if(name.Contains("EnableCharge")) SetEnableCharge((Bool_t) val, iBoard , iChannel-1);\r
172 else if(name.Contains("EnableTiming")) SetEnableTiming((Bool_t) val, iBoard , iChannel-1);\r
173 else if(name.Contains("DiscriThr")) SetDiscriThr((UShort_t) val, iBoard, iChannel-1);\r
174 else if(name.Contains("DelayHit")) SetDelayHit((UShort_t) val, iBoard, iChannel-1);\r
175 else if(name.Contains("PedOdd")) SetPedestal((UShort_t) val, 1, iBoard, iChannel-1);\r
176 else if(name.Contains("PedEven")) SetPedestal((UShort_t) val, 0, iBoard, iChannel-1);\r
177 else if(name.Contains("PedCutOdd")) SetPedestalCut((UShort_t) val, 1, iBoard, iChannel-1);\r
178 else if(name.Contains("PedCutEven")) SetPedestalCut((UShort_t) val, 0, iBoard, iChannel-1);\r
a08520b8 179 else AliError(Form("No Setter found for FEE parameter : %s",name.Data()));\r
180}\r
181//________________________________________________________________\r
182void AliVZEROTriggerData::SetPedestalCut(UShort_t val,Int_t integrator, Int_t board, Int_t channel)\r
183{\r
e370cdfe 184 // Set Pedestal Cut of individual channel \r
4bc15c46 185 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) {\r
a08520b8 186 if(integrator) fPedestalCutOdd[board][channel] = val;\r
187 else fPedestalCutEven[board][channel] = val;\r
188 } else AliError(Form("Impossible to write at : Board %d ; Channel %d",board,channel));\r
189}\r
190//________________________________________________________________\r
191UShort_t AliVZEROTriggerData::GetPedestalCut(Int_t integrator, Int_t board, Int_t channel)\r
192{\r
e370cdfe 193 // Get Pedestal Cut of individual channel \r
4bc15c46 194 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) {\r
a08520b8 195 if(integrator) return(fPedestalCutOdd[board][channel]);\r
196 else return(fPedestalCutEven[board][channel]);\r
197 }else AliError(Form("Impossible to read at : Board %d ; Channel %d",board,channel));\r
198 return 0;\r
199}\r
200//________________________________________________________________\r
201void AliVZEROTriggerData::SetPedestal(UShort_t val, Int_t integrator, Int_t board, Int_t channel)\r
202{\r
e370cdfe 203 // Set Pedestal of individual channel \r
4bc15c46 204 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) {\r
a08520b8 205 if(integrator) fPedestalOdd[board][channel] = val;\r
206 else fPedestalEven[board][channel] = val;\r
207 } else AliError(Form("Impossible to write at : Board %d ; Channel %d ; Integrator %d ",board,channel,integrator));\r
208}\r
209//________________________________________________________________\r
210UShort_t AliVZEROTriggerData::GetPedestal(Int_t integrator, Int_t board, Int_t channel)\r
211{\r
e370cdfe 212 // Get Pedestal of individual channel \r
4bc15c46 213 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) {\r
a08520b8 214 if(integrator) return(fPedestalOdd[board][channel]);\r
215 else return(fPedestalEven[board][channel]);\r
216 } else AliError(Form("Impossible to read at : Board %d ; Channel %d",board,channel));\r
217 return 0;\r
218}\r
219//________________________________________________________________\r
220void AliVZEROTriggerData::SetDelayHit(UShort_t val,Int_t board, Int_t channel)\r
221{\r
e370cdfe 222 // Set Delay of individual channel \r
4bc15c46 223 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) fDelayHit[board][channel] = val;\r
a08520b8 224 else AliError(Form("Impossible to write at : Board %d ; Channel %d",board,channel));\r
225}\r
226//________________________________________________________________\r
227UShort_t AliVZEROTriggerData::GetDelayHit(Int_t board, Int_t channel)\r
228{\r
e370cdfe 229 // Get Delay of individual channel \r
4bc15c46 230 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) return(fDelayHit[board][channel]);\r
a08520b8 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::SetDiscriThr(UShort_t val,Int_t board, Int_t channel)\r
236{\r
e370cdfe 237 // Set discriminator threshold\r
4bc15c46 238 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) fDiscriThr[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::GetDiscriThr(Int_t board, Int_t channel)\r
243{\r
e370cdfe 244 // Get discriminator threshold\r
4bc15c46 245 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) return(fDiscriThr[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::SetEnableCharge(Bool_t val,Int_t board, Int_t channel)\r
251{\r
e370cdfe 252 // Set the channels enabled for Charge triggers\r
4bc15c46 253 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) fEnableCharge[board][channel] = val;\r
a08520b8 254 else AliError(Form("Impossible to write at : Board %d ; Channel %d",board,channel));\r
255}\r
256//________________________________________________________________\r
257Bool_t AliVZEROTriggerData::GetEnableCharge(Int_t board, Int_t channel)\r
258{\r
e370cdfe 259 // Get the channels enabled for Charge triggers\r
4bc15c46 260 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) return(fEnableCharge[board][channel]);\r
a08520b8 261 else AliError(Form("Impossible to read at : Board %d ; Channel %d",board,channel));\r
262 return kFALSE;\r
263}\r
264//________________________________________________________________\r
265void AliVZEROTriggerData::SetEnableTiming(Bool_t val,Int_t board, Int_t channel)\r
266{\r
e370cdfe 267 // Set the channels enabled for Timing triggers\r
4bc15c46 268 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) fEnableTiming[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::GetEnableTiming(Int_t board, Int_t channel)\r
273{\r
e370cdfe 274 // Get the channels enabled for Timing triggers\r
4bc15c46 275 if((board>=0 && board<kNCIUBoards) && (channel>=0 && channel<kNChannels)) return(fEnableTiming[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::SetTriggerSelected(UShort_t trigger, Int_t output)\r
281{\r
e370cdfe 282 // Set the trigger selected on the outputs to CTP\r
4bc15c46 283 if(output>=0 && output<kNTriggerOutputs) fTriggerSelected[output] = trigger;\r
a08520b8 284 else AliError(Form("Trigger output number %d not valid",output));\r
285}\r
286\r
287//________________________________________________________________\r
288void AliVZEROTriggerData::SetClk1Win1(UShort_t* clks)\r
289{\r
e370cdfe 290 // Set Win clock of BB\r
a08520b8 291 if(clks) for(int t=0; t<kNCIUBoards; t++) SetClk1Win1(clks[t],t);\r
4bc15c46 292 else AliError("Profil Clock1 Win1 Not defined.");\r
a08520b8 293}\r
294//________________________________________________________________\r
295void AliVZEROTriggerData::SetClk2Win1(UShort_t* clks)\r
296{\r
e370cdfe 297 // Set Win clock of BB\r
a08520b8 298 if(clks) for(int t=0; t<kNCIUBoards; t++) SetClk2Win1(clks[t],t);\r
4bc15c46 299 else AliError("Profil Clock2 Win1 Not defined.");\r
a08520b8 300}\r
301//________________________________________________________________\r
302void AliVZEROTriggerData::SetClk1Win1(UShort_t clk, Int_t board)\r
303{\r
e370cdfe 304 // Set Win clock of BB\r
4bc15c46 305 if((board>=0) && (board<kNCIUBoards)) {\r
306 fClk1Win1[board] = clk;\r
307 if(!IsClkValid(clk)) AliWarning(Form("Profil Clock1 Win1 of board %d is not valid : %d",board,clk));\r
308 }else {\r
309 AliError(Form("Impossible to Write at Board %d",board));\r
310 }\r
a08520b8 311}\r
312//________________________________________________________________\r
313void AliVZEROTriggerData::SetClk2Win1(UShort_t clk, Int_t board)\r
314{\r
e370cdfe 315 // Set Win clock of BB\r
4bc15c46 316 if((board>=0) && (board<kNCIUBoards)) {\r
317 fClk2Win1[board] = clk;\r
318 if(!IsClkValid(clk)) AliWarning(Form("Profil Clock2 Win1 of board %d is not valid : %d",board,clk));\r
319 }else {\r
320 AliError(Form("Impossible to Write at Board %d",board));\r
321 }\r
a08520b8 322}\r
323//________________________________________________________________\r
324void AliVZEROTriggerData::SetClk1Win2(UShort_t* clks)\r
325{\r
e370cdfe 326 // Set Win clock of BG\r
a08520b8 327 if(clks) for(int t=0; t<kNCIUBoards; t++) SetClk1Win2(clks[t],t);\r
4bc15c46 328 else AliError("Profil Clock1 Win2 Not defined.");\r
a08520b8 329}\r
330//________________________________________________________________\r
331void AliVZEROTriggerData::SetClk2Win2(UShort_t* clks)\r
332{\r
e370cdfe 333 // Set Win clock of BG\r
a08520b8 334 if(clks) for(int t=0; t<kNCIUBoards; t++) SetClk2Win2(clks[t],t);\r
4bc15c46 335 else AliError("Profil Clock2 Win2 Not defined.");\r
a08520b8 336}\r
337//________________________________________________________________\r
338void AliVZEROTriggerData::SetClk1Win2(UShort_t clk, Int_t board)\r
339{\r
e370cdfe 340 // Set Win clock of BG\r
4bc15c46 341 if((board>=0) && (board<kNCIUBoards)) {\r
342 fClk1Win2[board] = clk;\r
343 if(!IsClkValid(clk)) AliWarning(Form("Profil Clock1 Win2 of board %d is not valid : %d",board,clk));\r
344 }else {\r
345 AliError(Form("Impossible to Write at Board %d",board));\r
346 }\r
a08520b8 347}\r
348//________________________________________________________________\r
349void AliVZEROTriggerData::SetClk2Win2(UShort_t clk, Int_t board)\r
350{\r
e370cdfe 351 // Set Win clock of BG\r
4bc15c46 352 if((board>=0) && (board<kNCIUBoards)) {\r
353 fClk2Win2[board] = clk;\r
354 if(!IsClkValid(clk)) AliWarning(Form("Profil Clock2 Win2 of board %d is not valid : %d",board,clk));\r
355 }else {\r
356 AliError(Form("Impossible to Write at Board %d",board));\r
357 }\r
a08520b8 358}\r
359//________________________________________________________________\r
360void AliVZEROTriggerData::SetDelayClk1Win1(UShort_t* delays)\r
361{\r
e370cdfe 362 // Set Delay for Win clock of BB\r
a08520b8 363 if(delays) for(int t=0; t<kNCIUBoards; t++) SetDelayClk1Win1(delays[t],t);\r
4bc15c46 364 else AliError("Profil Clock1 Win1 Delays Not defined.");\r
a08520b8 365}\r
366//________________________________________________________________\r
367void AliVZEROTriggerData::SetDelayClk1Win1(UShort_t delay, Int_t board)\r
368{\r
e370cdfe 369 // Set Delay for Win clock of BB\r
a08520b8 370 if(delay>1023){\r
371 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
372 delay = delay & 0x3FF;\r
373 }\r
4bc15c46 374 if((board>=0) && (board<kNCIUBoards)) fDelayClk1Win1[board] = delay;\r
375 else AliError(Form("Trying to write out of the array Board = %d",board));\r
a08520b8 376}\r
377//________________________________________________________________\r
378void AliVZEROTriggerData::SetDelayClk2Win1(UShort_t* delays)\r
379{\r
e370cdfe 380 // Set Delay for Win clock of BB\r
a08520b8 381 if(delays) for(int t=0; t<kNCIUBoards; t++) SetDelayClk2Win1(delays[t],t);\r
4bc15c46 382 else AliError("Profil Clock2 Win1 Delays Not defined.");\r
a08520b8 383}\r
384//________________________________________________________________\r
385void AliVZEROTriggerData::SetDelayClk2Win1(UShort_t delay, Int_t board)\r
386{\r
e370cdfe 387 // Set Delay for Win clock of BB\r
a08520b8 388 if(delay>1023){\r
389 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
390 delay = delay & 0x3FF;\r
391 }\r
4bc15c46 392 if((board>=0) && (board<kNCIUBoards)) fDelayClk2Win1[board] = delay;\r
393 else AliError(Form("Trying to write out of the array Board = %d",board));\r
a08520b8 394}\r
395//________________________________________________________________\r
396void AliVZEROTriggerData::SetDelayClk1Win2(UShort_t* delays)\r
397{\r
e370cdfe 398 // Set Delay for Win clock of BG\r
a08520b8 399 if(delays) for(int t=0; t<kNCIUBoards; t++) SetDelayClk1Win2(delays[t],t);\r
4bc15c46 400 else AliError("Profil Clock1 Win2 Delays Not defined.");\r
a08520b8 401}\r
402//________________________________________________________________\r
403void AliVZEROTriggerData::SetDelayClk1Win2(UShort_t delay, Int_t board)\r
404{\r
e370cdfe 405 // Set Delay for Win clock of BG\r
a08520b8 406 if(delay>1023){\r
407 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
408 delay = delay & 0x3FF;\r
409 }\r
4bc15c46 410 if((board>=0) && (board<kNCIUBoards)) fDelayClk1Win2[board] = delay;\r
411 else AliError(Form("Trying to write out of the array Board = %d",board));\r
a08520b8 412}\r
413//________________________________________________________________\r
414void AliVZEROTriggerData::SetDelayClk2Win2(UShort_t* delays)\r
415{\r
e370cdfe 416 // Set Delay for Win clock of BG\r
a08520b8 417 if(delays) for(int t=0; t<kNCIUBoards; t++) SetDelayClk2Win2(delays[t],t);\r
4bc15c46 418 else AliError("Profil Clock2 Win2 Delays Not defined.");\r
a08520b8 419}\r
420//________________________________________________________________\r
421void AliVZEROTriggerData::SetDelayClk2Win2(UShort_t delay, Int_t board)\r
422{\r
e370cdfe 423 // Set Delay for Win clock of BG\r
a08520b8 424 if(delay>1023){\r
425 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
426 delay = delay & 0x3FF;\r
427 }\r
4bc15c46 428 if((board>=0) && (board<kNCIUBoards)) fDelayClk2Win2[board] = delay;\r
429 else AliError(Form("Trying to write out of the array Board = %d",board));\r
a08520b8 430}\r
431//________________________________________________________________\r
432void AliVZEROTriggerData::SetLatchWin1(UShort_t *latchs){\r
e370cdfe 433 // Set Latch Win clock for BB\r
a08520b8 434 if(latchs) for(int t=0; t<kNCIUBoards; t++) SetLatchWin1(latchs[t],t);\r
4bc15c46 435 else AliError("Latch Win1 profil Not defined.");\r
a08520b8 436}\r
437//________________________________________________________________\r
438void AliVZEROTriggerData::SetLatchWin1(UShort_t latch, Int_t board)\r
439{\r
e370cdfe 440 // Set Latch Win clock for BB\r
4bc15c46 441 if((board>=0) && (board<kNCIUBoards)) {\r
442 fLatchWin1[board] = latch;\r
443 if(!IsClkValid(latch)) AliWarning(Form("Latch Win1 of board %d is not valid : %d",board,latch));\r
444 }else {\r
445 AliError(Form("Impossible to Write at Board %d",board));\r
446 }\r
a08520b8 447}\r
448//________________________________________________________________\r
449void AliVZEROTriggerData::SetLatchWin2(UShort_t *latchs){\r
e370cdfe 450 // Set Latch Win clock for BG\r
a08520b8 451 if(latchs) for(int t=0; t<kNCIUBoards; t++) SetLatchWin2(latchs[t],t);\r
4bc15c46 452 else AliError("Latch Win2 profil Not defined.");\r
a08520b8 453}\r
454//________________________________________________________________\r
455void AliVZEROTriggerData::SetLatchWin2(UShort_t latch, Int_t board)\r
456{\r
e370cdfe 457 // Set Latch Win clock for BG\r
4bc15c46 458 if((board>=0) && (board<kNCIUBoards)) {\r
459 fLatchWin2[board] = latch;\r
460 if(!IsClkValid(latch)) AliWarning(Form("Latch Win2 of board %d is not valid : %d",board,latch));\r
461 }else {\r
462 AliError(Form("Impossible to Write at Board %d",board));\r
463 }\r
a08520b8 464}\r
465//________________________________________________________________\r
466void AliVZEROTriggerData::SetResetWin1(UShort_t *resets){\r
e370cdfe 467 // Set Reset Win clock for BB\r
a08520b8 468 if(resets) for(int t=0; t<kNCIUBoards; t++) SetResetWin1(resets[t],t);\r
4bc15c46 469 else AliError("Reset Win1 profil Not defined.");\r
a08520b8 470}\r
471//________________________________________________________________\r
472void AliVZEROTriggerData::SetResetWin1(UShort_t reset, Int_t board)\r
473{\r
e370cdfe 474 // Set Reset Win clock for BB\r
4bc15c46 475 if((board>=0) && (board<kNCIUBoards)) {\r
476 fResetWin1[board] = reset;\r
477 if(!IsClkValid(reset)) AliWarning(Form("Reset Win1 of board %d is not valid : %d",board,reset));\r
478 }else {\r
479 AliError(Form("Impossible to Write at Board %d",board));\r
480 }\r
a08520b8 481}\r
482//________________________________________________________________\r
483void AliVZEROTriggerData::SetResetWin2(UShort_t *resets){\r
e370cdfe 484 // Set Reset Win clock for BG\r
a08520b8 485 if(resets) for(int t=0; t<kNCIUBoards; t++) SetResetWin2(resets[t],t);\r
4bc15c46 486 else AliError("Reset Win2 profil Not defined.");\r
a08520b8 487}\r
488//________________________________________________________________\r
489void AliVZEROTriggerData::SetResetWin2(UShort_t reset, Int_t board)\r
490{\r
e370cdfe 491 // Set Reset Win clock for BG\r
4bc15c46 492 if((board>=0) && (board<kNCIUBoards)) {\r
493 fResetWin2[board] = reset;\r
494 if(!IsClkValid(reset)) AliWarning(Form("Reset Win2 of board %d is not valid : %d",board,reset));\r
495 }else {\r
496 AliError(Form("Impossible to Write at Board %d",board));\r
497 }\r
a08520b8 498}\r
499//________________________________________________________________\r
500void AliVZEROTriggerData::SetPedestalSubtraction(Bool_t *peds){\r
e370cdfe 501 // Set Pedestal Subtraction Parameter\r
a08520b8 502 if(peds) for(int t=0; t<kNCIUBoards; t++) SetPedestalSubtraction(peds[t],t);\r
4bc15c46 503 else AliError("Pedestal Subtraction Not defined.");\r
a08520b8 504 \r
505}\r
506//________________________________________________________________\r
507void AliVZEROTriggerData::SetPedestalSubtraction(Bool_t ped, Int_t board)\r
508{\r
e370cdfe 509 // Set Pedestal Subtraction Parameter\r
4bc15c46 510 if((board>=0) && (board<kNCIUBoards)) fPedestalSubtraction[board] = ped;\r
a08520b8 511 else AliError(Form("Board %d is not valid",board));\r
512}\r
513\r
514//________________________________________________________________\r
e370cdfe 515Bool_t AliVZEROTriggerData::IsClkValid(UShort_t clock) const {\r
516 // Check if the given clock has a valid profil.\r
a08520b8 517 Bool_t word[5];\r
518 Bool_t isValid = kTRUE;\r
e370cdfe 519 Short_t risingEdge = 0;\r
520 Short_t fallingEdge = 0;\r
a08520b8 521 for(int i=0 ; i<5 ; i++) word[i] = (clock >> i) & 0x1;\r
522 \r
523 if(word[0] != word[4]){\r
e370cdfe 524 if(word[4]) fallingEdge++;\r
525 else risingEdge++;\r
a08520b8 526 } \r
527 for(int i=1 ; i<5 ; i++){\r
528 if(word[i] != word[i-1]) {\r
e370cdfe 529 if(word[i-1]) fallingEdge++;\r
530 else risingEdge++;\r
a08520b8 531 }\r
532 }\r
e370cdfe 533 if((fallingEdge>1)||(risingEdge>1)) isValid = kFALSE;\r
534 if(((risingEdge==0)&&(fallingEdge==0)) &&(!word[0])) isValid = kFALSE;\r
a08520b8 535 return isValid;\r
536}\r
537\r
f3051e80 538\r
e370cdfe 539\r