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