]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONTriggerElectronics.cxx
- data member was shadowed (fTree)
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerElectronics.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 /* $Id$ */
17
18 //-----------------------------------------------------------------------------
19 // Class AliMUONTriggerElectronics
20 //--------------------------------
21 // Manager class for muon trigger electronics
22 // Client of trigger board classes
23 // Debugged by Ph. Crochet & Ch. Finck
24 // Interfaced with new mapping Ch. Finck
25 //
26 // Author: Rachid Guernane (LPCCFd)
27 //-----------------------------------------------------------------------------
28
29 #include "AliLoader.h"
30 #include "AliLog.h"
31 #include "AliMUONCalibrationData.h"
32 #include "AliMUONVDigit.h"
33 #include "AliMUONVDigitStore.h"
34 #include "AliMUONGlobalTrigger.h"
35 #include "AliMUONGlobalTriggerBoard.h"
36 #include "AliMUONLocalTrigger.h"
37 #include "AliMUONLocalTriggerBoard.h"
38 #include "AliMUONRegionalTrigger.h"
39 #include "AliMUONRegionalTriggerBoard.h"
40 #include "AliMUONTriggerCrate.h"
41 #include "AliMUONTriggerCrateStore.h"
42 #include "AliMUONTriggerElectronics.h"
43 #include "AliMUONTriggerCrateConfig.h"
44 #include "AliMUONRegionalTriggerConfig.h"
45 #include "AliMUONGlobalCrateConfig.h"
46 #include "AliMUONVTriggerStore.h"
47 #include "AliMUONVCalibParam.h"
48 #include "AliMpCathodType.h"
49 #include "AliMpCDB.h"
50 #include "AliMpDEManager.h"
51 #include "AliMpSegmentation.h"
52 #include "AliMpVSegmentation.h"
53 #include "AliMpCathodType.h"
54 #include "AliMpTriggerCrate.h"
55 #include "AliMpLocalBoard.h"
56 #include "AliMpDDLStore.h"
57 #include "AliMpExMap.h"
58 #include "AliMpIntPair.h"
59
60 #include "AliLog.h"
61 #include "AliLoader.h"
62 #include "AliRun.h"
63 #include <TBits.h>
64 #include <TSystem.h>
65
66
67 /// \cond CLASSIMP
68 ClassImp(AliMUONTriggerElectronics)
69 /// \endcond
70
71 //___________________________________________
72 AliMUONTriggerElectronics::AliMUONTriggerElectronics(AliMUONCalibrationData* calibData) 
73 : TObject(),
74   fCrates(new AliMUONTriggerCrateStore),
75   fGlobalTriggerBoard(new AliMUONGlobalTriggerBoard)
76 {
77  /// CONSTRUCTOR
78 ///
79
80   for (Int_t i = 0; i < 2; ++i) {
81     fCopyXInput[i] = new TList();
82     fCopyXInput[i]->SetOwner();
83     fCopyYInput[i] = new TList();
84     fCopyYInput[i]->SetOwner();
85   }
86
87   // force loading of mapping if not already done
88   if ( !AliMpDDLStore::Instance(kFALSE) )
89   {
90     AliMpCDB::LoadDDLStore();
91   }
92   
93   SetCopyInput();
94   
95   Factory(calibData);
96   LoadMasks(calibData); 
97 }
98
99 //___________________________________________
100 AliMUONTriggerElectronics::~AliMUONTriggerElectronics()
101 {
102 /// DESTRUCTOR
103 ///
104   delete fGlobalTriggerBoard;
105   delete fCrates;
106   for (Int_t i = 0; i < 2; ++i) {
107     delete fCopyXInput[i];
108     delete fCopyYInput[i];
109   }
110
111 }
112
113 //___________________________________________
114 void AliMUONTriggerElectronics::SetCopyInput()
115 {  
116   /// set list of copy input
117   
118     for (Int_t iDDL = 0; iDDL < 2; ++iDDL) { 
119     
120       for(Int_t iReg = 0; iReg < 8; ++iReg){   //reg loop
121       
122         AliMpTriggerCrate* crateMapping = AliMpDDLStore::Instance()->GetTriggerCrate(iDDL, iReg);
123       
124         for(Int_t iLocal = 0; iLocal < crateMapping->GetNofLocalBoards(); ++iLocal) { 
125         
126           Int_t localBoardFromId = crateMapping->GetLocalBoardId(iLocal);
127           if (!localBoardFromId) continue; //empty slot, should not happen
128         
129           AliMpLocalBoard* localBoardFrom = AliMpDDLStore::Instance()->GetLocalBoard(localBoardFromId);
130           Int_t localBoardToId;
131           if ((localBoardToId = localBoardFrom->GetInputXto())) {
132               AliMpLocalBoard* localBoardTo = AliMpDDLStore::Instance()->GetLocalBoard(localBoardToId);
133               TString crateFrom = localBoardFrom->GetCrate();
134               Int_t   slotFrom  = localBoardFrom->GetSlot();
135               TString crateTo   = localBoardTo->GetCrate();
136               Int_t   slotTo    = localBoardTo->GetSlot();
137           
138               fCopyXInput[0]->Add(new AliMpIntPair(AliMpExMap::GetIndex(crateFrom), slotFrom));
139               fCopyXInput[1]->Add(new AliMpIntPair(AliMpExMap::GetIndex(crateTo), slotTo));
140               AliDebug(3, Form("copy xInputs from local  %s_%d to %s_%d\n", crateFrom.Data(), slotFrom, 
141                                crateTo.Data(), slotTo));
142           }
143         
144           if ((localBoardToId = localBoardFrom->GetInputYto())) {
145               AliMpLocalBoard* localBoardTo = AliMpDDLStore::Instance()->GetLocalBoard(localBoardToId);
146               TString crateFrom = localBoardFrom->GetCrate();
147               Int_t   slotFrom  = localBoardFrom->GetSlot();
148               TString crateTo   = localBoardTo->GetCrate();
149               Int_t   slotTo    = localBoardTo->GetSlot();
150           
151               fCopyYInput[0]->Add(new AliMpIntPair(AliMpExMap::GetIndex(crateFrom), slotFrom));
152               fCopyYInput[1]->Add(new AliMpIntPair(AliMpExMap::GetIndex(crateTo), slotTo));
153               AliDebug(3, Form("copy yInputs from local  %s_%d to %s_%d\n", crateFrom.Data(), slotFrom, 
154                                crateTo.Data(), slotTo));
155           
156           }
157  
158         }
159       }
160     }
161 }
162
163 //___________________________________________
164 void AliMUONTriggerElectronics::Factory(AliMUONCalibrationData* calibData)
165 {  
166  /// BUILD ALL ELECTRONICS
167  ///
168
169     fCrates->ReadFromFile(calibData);
170 }
171
172 //___________________________________________
173 void AliMUONTriggerElectronics::Feed(const AliMUONVDigitStore& digitStore)
174 {
175   /// FILL INPUTS
176   ///
177   
178   TIter next(digitStore.CreateTriggerIterator());
179   AliMUONVDigit* mdig;
180   
181   while ( ( mdig = static_cast<AliMUONVDigit*>(next()) ) )
182   {      
183     //       CHECKME ! The TrackCharge is not ok with new digitizerV3 !
184     //                  for (Int_t ichg=0; ichg<10; ichg++) schg += mdig->TrackCharge(ichg);
185     Int_t ichamber = AliMpDEManager::GetChamberId(mdig->DetElemId());
186     Int_t schg = (Int_t)(mdig->Charge() + 0.5);
187     
188     //       APPLY CONDITION ON SOFT BACKGROUND 
189     Int_t tchg = schg - (Int_t(schg/10))*10;    
190     
191     if (schg<=10 || tchg>0) 
192     {
193       Int_t detElemId  = mdig->DetElemId();
194       Int_t cathode    = mdig->Cathode();
195     
196       const AliMpVSegmentation* seg = 
197           AliMpSegmentation::Instance()
198           ->GetMpSegmentation(detElemId,AliMp::GetCathodType(cathode));
199   
200       Int_t ix = mdig->PadX(), iy = mdig->PadY();
201       
202       AliDebug(3,Form("cathode %d ix %d iy %d ",cathode,ix,iy));
203
204       AliMpPad pad = seg->PadByIndices(ix,iy,kTRUE);
205       
206       for (Int_t i=0; i<pad.GetNofLocations(); i++) 
207       {
208         Int_t nboard = pad.GetLocalBoardId(i);
209         
210         Int_t ibitxy = pad.GetLocalBoardChannel(i);
211         
212         AliMUONLocalTriggerBoard *b = fCrates->LocalBoard(nboard);
213         
214         if (b) 
215         {
216           if (cathode && b->GetSwitch(6)) ibitxy += 8;
217           
218           b->SetbitM(ibitxy,cathode,ichamber-10);
219         }
220         else
221         {
222           AliError(Form("Could not get local board number %d",b->GetNumber()));
223         }
224       }
225     }           
226   }
227
228   // Particular case of the columns with 22 local boards (2R(L) 3R(L))   
229   // fill copy input from mapping instead of hardcoded valued (Ch.F)
230   AliMUONTriggerCrate *crate = 0x0; TObjArray *bs = 0x0;
231
232   for (Int_t i = 0; i < fCopyXInput[0]->GetEntries(); ++i) 
233   {
234     AliMpIntPair* pair = (AliMpIntPair*)fCopyXInput[0]->At(i);
235     TString crateFrom  =  AliMpExMap::GetString(pair->GetFirst());
236     Int_t   slotFrom   =  pair->GetSecond();
237
238     pair = (AliMpIntPair*)fCopyXInput[1]->At(i);
239     TString crateTo  =  AliMpExMap::GetString(pair->GetFirst());
240     Int_t   slotTo   =  pair->GetSecond();
241
242     AliDebug(3, Form("copy xInputs from local  %s_%d to %s_%d\n", crateFrom.Data(), slotFrom, 
243                      crateTo.Data(), slotTo));
244
245     UShort_t cX[2];
246     crate = fCrates->Crate(crateFrom); 
247     bs = crate->Boards();
248     AliMUONLocalTriggerBoard *fromxb = (AliMUONLocalTriggerBoard*)bs->At(slotFrom);
249     crate = fCrates->Crate(crateTo); 
250     bs = crate->Boards();
251     AliMUONLocalTriggerBoard *desxb = (AliMUONLocalTriggerBoard*)bs->At(slotTo);
252     fromxb->GetX34(cX); desxb->SetX34(cX);
253
254
255   }
256
257   for (Int_t i = 0; i < fCopyYInput[0]->GetEntries(); ++i) 
258   {
259     AliMpIntPair* pair = (AliMpIntPair*)fCopyYInput[0]->At(i);
260     TString crateFrom  =  AliMpExMap::GetString(pair->GetFirst());
261     Int_t   slotFrom   =  pair->GetSecond();
262
263     pair = (AliMpIntPair*)fCopyYInput[1]->At(i);
264     TString crateTo  =  AliMpExMap::GetString(pair->GetFirst());
265     Int_t   slotTo   =  pair->GetSecond();
266
267     AliDebug(3, Form("copy yInputs from local  %s_%d to %s_%d\n", crateFrom.Data(), slotFrom, 
268                      crateTo.Data(), slotTo));
269
270     UShort_t cY[4];
271     crate = fCrates->Crate(crateFrom); 
272     bs = crate->Boards();
273     AliMUONLocalTriggerBoard *fromyb = (AliMUONLocalTriggerBoard*)bs->At(slotFrom);
274     crate = fCrates->Crate(crateTo); 
275     bs = crate->Boards();
276     AliMUONLocalTriggerBoard *desyb = (AliMUONLocalTriggerBoard*)bs->At(slotTo);
277     fromyb->GetY(cY); desyb->SetY(cY);
278   }
279   
280   // FILL UP/DOWN OF CURRENT BOARD (DONE VIA J3 BUS IN REAL LIFE)
281   AliMUONTriggerCrate* cr;
282   TIter next2(fCrates->CreateCrateIterator());
283   
284   while ( ( cr = static_cast<AliMUONTriggerCrate*>(next2()) ) )
285   {            
286     TObjArray *boards = cr->Boards();
287     
288     for (Int_t j = 1; j < boards->GetEntries()-1; j++)
289     {
290       TObject *o = boards->At(j);
291                         
292       if (!o) break;
293                         
294       AliMUONLocalTriggerBoard *currboard = (AliMUONLocalTriggerBoard*)o;
295                         
296       AliMUONLocalTriggerBoard *neighbour = (AliMUONLocalTriggerBoard*)boards->At(j+1);
297                         
298       UShort_t cXY[2][4];
299                         
300       if (j==1) {neighbour->GetXY(cXY); currboard->SetXYU(cXY);}
301                         
302       //       LAST BOARD IN THE CRATE HAS NO UP EXCEPT FOR CRATES 2 & 3
303       if (j < boards->GetEntries()-2)  
304       {
305               AliMUONLocalTriggerBoard *nextboard = (AliMUONLocalTriggerBoard*)boards->At(j+2);
306                                 
307               currboard->GetXY(cXY); neighbour->SetXYD(cXY);
308               nextboard->GetXY(cXY); neighbour->SetXYU(cXY);
309                                 
310               if (j==boards->GetEntries()-3) {neighbour->GetXY(cXY); nextboard->SetXYD(cXY);}
311       }
312     }
313   }
314  
315 }
316
317
318 //___________________________________________
319 void AliMUONTriggerElectronics::Feed(UShort_t pattern[2][4])
320 {
321   /// FILL INPUTS
322   ///
323   AliMUONTriggerCrate* cr;
324   TIter next(fCrates->CreateCrateIterator());
325    
326    while ( ( cr = static_cast<AliMUONTriggerCrate*>(next()) ) )
327    {                 
328      TObjArray *boards = cr->Boards();
329      
330      for (Int_t j = 1; j < boards->GetEntries(); j++)
331      {
332        TObject *o = boards->At(j);
333        
334        if (!o) break;
335        
336        AliMUONLocalTriggerBoard *board = (AliMUONLocalTriggerBoard*)o;
337        
338        board->SetXY(pattern);
339      }
340    }
341 }
342
343 //___________________________________________
344 void AliMUONTriggerElectronics::DumpOS()
345 {
346 /// DUMP IN THE OLD WAY
347 ///
348    for (Int_t i= 0; i < 234;i++)
349    {
350       AliMUONLocalTriggerBoard *board = fCrates->LocalBoard(i);
351
352       if (board) board->Scan("ALL");
353    }
354 }
355
356 //___________________________________________
357 void AliMUONTriggerElectronics::Scan(Option_t *option)
358 {
359   /// SCAN
360   ///
361
362   AliMUONTriggerCrate* cr;
363   TIter next(fCrates->CreateCrateIterator());  
364   
365   while ( ( cr = static_cast<AliMUONTriggerCrate*>(next()) ) )
366   {                
367     TObjArray *boards = cr->Boards();
368     
369     for (Int_t j = 0; j < boards->GetEntries(); j++)
370     {
371       TObject *o = boards->At(j);
372       
373       TString op = option;
374       
375       Bool_t cdtion = kFALSE;
376       
377       if (op.Contains("LOCAL"))    cdtion = o->IsA() == AliMUONLocalTriggerBoard::Class();
378       if (op.Contains("REGIONAL")) cdtion = o->IsA() == AliMUONRegionalTriggerBoard::Class();
379       if (op.Contains("GLOBAL"))   cdtion = o->IsA() == AliMUONGlobalTriggerBoard::Class();
380       
381       if (!o || !cdtion) continue;
382       
383       AliMUONLocalTriggerBoard *board = (AliMUONLocalTriggerBoard*)o;
384       
385       board->Scan();
386     }
387   }
388 }
389
390 //___________________________________________
391 void AliMUONTriggerElectronics::Reset()
392 {
393   /// RESET
394   ///
395   
396    AliMUONTriggerCrate* cr;
397   TIter next(fCrates->CreateCrateIterator());
398    while ( ( cr = static_cast<AliMUONTriggerCrate*>(next()) ) )
399    {            
400       TObjArray *boards = cr->Boards();
401             
402       for (Int_t j=0; j<boards->GetEntries(); j++)
403       {     
404          AliMUONTriggerBoard *b = (AliMUONTriggerBoard*)boards->At(j);
405
406          if (b) b->Reset();
407       }
408    }
409 }
410
411
412 //_______________________________________________________________________
413 void AliMUONTriggerElectronics::LoadMasks(AliMUONCalibrationData* calibData)
414 {
415   /// Load mask from config in CDB 
416   
417   // Set mask
418   
419   AliMUONRegionalTriggerConfig* regionalConfig = calibData->RegionalTriggerConfig();
420   if (!regionalConfig)
421      AliWarning("No valid regional trigger configuration in CDB");
422
423   
424   AliMUONTriggerCrate* cr;
425   TIter next(fCrates->CreateCrateIterator());
426   
427   Int_t irb(0);
428   
429   while ( ( cr = static_cast<AliMUONTriggerCrate*>(next()) ) )
430   {            
431     TObjArray *boards = cr->Boards();
432     
433     AliMUONRegionalTriggerBoard *regb = (AliMUONRegionalTriggerBoard*)boards->At(0);
434
435     AliMUONTriggerCrateConfig* crateConfig = regionalConfig->FindTriggerCrate(cr->GetName());
436     
437     if (!crateConfig)
438     {
439       AliError(Form("Crate %s not present in configuration !!!", cr->GetName()));
440       return;
441     }
442     
443     UShort_t rmask= crateConfig->GetMask();
444
445     regb->Mask(rmask);
446     
447     for (Int_t j = 1; j < boards->GetEntries(); j++)
448     {
449       AliMUONLocalTriggerBoard *b = (AliMUONLocalTriggerBoard*)boards->At(j);
450       
451       Int_t cardNumber = b->GetNumber();
452       
453       if (cardNumber) // interface board are not interested
454       {
455         AliMUONVCalibParam* localBoardMasks = calibData->LocalTriggerBoardMasks(cardNumber);
456         for ( Int_t i = 0; i < localBoardMasks->Size(); ++i )
457         {
458           UShort_t lmask = static_cast<UShort_t>(localBoardMasks->ValueAsInt(i) & 0xFFFF);
459           b->Mask(i,lmask);
460         }
461       }
462     }
463     ++irb;
464   }
465   
466    AliMUONGlobalCrateConfig * globalConfig = calibData->GlobalTriggerCrateConfig();
467   if (!globalConfig)
468      AliWarning("No valid trigger crate configuration in CDB");
469
470     UInt_t gmask = 0;
471     for (Int_t i = 0; i < 4; i++) {
472       gmask = globalConfig->GetGlobalMask(i);
473       fGlobalTriggerBoard->Mask(i,gmask);
474     }
475 }
476
477 //___________________________________________
478 void AliMUONTriggerElectronics::LocalResponse()
479 {
480 /// Compute the response for local cards
481         
482   AliMUONTriggerCrate* cr;
483   TIter next(fCrates->CreateCrateIterator());
484   
485   while ( ( cr = static_cast<AliMUONTriggerCrate*>(next()) ) )
486   {            
487     
488     TObjArray *boards = cr->Boards();
489     
490     AliMUONRegionalTriggerBoard *regb = (AliMUONRegionalTriggerBoard*)boards->At(0);
491     
492     UShort_t thisl[16]; for (Int_t j=0; j<16; j++) thisl[j] = 0;
493   
494     for (Int_t j = 1; j < boards->GetEntries(); j++)
495     {     
496         TObject *o = boards->At(j);
497       
498         if (!o) break;
499       
500         AliMUONLocalTriggerBoard *board = (AliMUONLocalTriggerBoard*)o;
501       
502         if (board) // check if empty slot
503         {
504           board->Response();
505                                 
506           UShort_t response = board->GetResponse();            
507         
508           // CRATE CONTAINING INTERFACE BOARD
509           if (board->GetNumber() == 0) // copy boards
510           {
511             if ( response != 0 ) 
512               AliWarning(Form("Interface board %s in slot %d of crate %s has a non zero response",
513                                           board->GetName(),j,cr->GetName()));
514             AliDebug(1, Form("local slot %d, number %d in crate %s\n", j, board->GetNumber(), cr->GetName()));
515
516           }
517         
518           thisl[j-1] = response;
519         }
520       }
521     
522     regb->SetLocalResponse(thisl);
523   }
524 }
525
526 //___________________________________________
527 void AliMUONTriggerElectronics::RegionalResponse()
528 {
529   /// Compute the response for all regional cards.
530   AliMUONTriggerCrate* cr;
531   TIter next(fCrates->CreateCrateIterator());
532   
533   while ( ( cr = static_cast<AliMUONTriggerCrate*>(next()) ) )
534   {            
535       TObjArray *boards = cr->Boards();
536
537       AliMUONRegionalTriggerBoard *regb = (AliMUONRegionalTriggerBoard*)boards->At(0);
538       
539       if (regb) 
540       {
541          regb->Response();
542       }  
543    }
544 }
545
546 //___________________________________________
547 void AliMUONTriggerElectronics::GlobalResponse()
548 {
549   /// Compute the global response
550
551   UShort_t regional[16];
552   
553   AliMUONTriggerCrate* cr;
554   Int_t irb(0);
555   
556   if ( !fCrates->NumberOfCrates() >= 16 ) 
557   {
558     AliFatal(Form("Something is wrong : too many crates %d",
559                   fCrates->NumberOfCrates()));
560   }
561
562   // send regional responses to the global trigger in right order
563   // do not used iterator order
564   
565   for (Int_t iSide = 0; iSide < 2; iSide++) // right & left side
566   {            
567     for (Int_t iReg = 0; iReg < 8; iReg++) // 8 crates/regional boards for each side.
568     {
569       cr = fCrates->Crate(iSide, iReg);     
570
571       AliMUONTriggerBoard* rb = 
572         static_cast<AliMUONTriggerBoard*>(cr->Boards()->At(0));
573       regional[irb] = rb->GetResponse();
574       ++irb;
575     }
576   }
577
578   fGlobalTriggerBoard->SetRegionalResponse(regional);
579   fGlobalTriggerBoard->Response();
580 }
581
582 //_______________________________________________________________________
583 void AliMUONTriggerElectronics::Digits2Trigger(const AliMUONVDigitStore& digitStore,
584                                                AliMUONVTriggerStore& triggerStore)
585 {
586   /// Main method to go from digits to trigger decision
587   AliMUONRegionalTrigger pRegTrig;
588   
589   triggerStore.Clear();
590   
591   // RUN THE FULL BEE CHAIN
592   Feed(digitStore);
593   LocalResponse();
594   RegionalResponse();      
595   GlobalResponse();
596   //    DumpOS();
597         
598   AliMUONTriggerCrate* cr;
599   AliMUONLocalTrigger localTrigger;
600   
601   // stored in right order
602   // do not used iterator order
603   
604   for (Int_t iSide = 0; iSide < 2; iSide++) // right & left side
605   {            
606     for (Int_t iReg = 0; iReg < 8; iReg++) // 8 crates/regional boards for each side.
607     {
608       cr = fCrates->Crate(iSide, iReg);     
609       TObjArray *boards = cr->Boards();
610       
611       UInt_t regInpLpt = 0;
612       UInt_t regInpHpt = 0;
613       
614       AliMUONRegionalTriggerBoard *regBoard = (AliMUONRegionalTriggerBoard*)boards->At(0);
615       
616       for (Int_t j = 1; j < boards->GetEntries(); j++)
617       {     
618         TObject *o = boards->At(j);
619         
620         if (!o) break;
621         
622         AliMUONLocalTriggerBoard *board = (AliMUONLocalTriggerBoard*)o;
623         
624         if (board) 
625         {
626           //          L0 TRIGGER
627           // pcrochet 181206: MOOD needs ALL boards
628           //      if (board->Triggered())
629           //      {
630           
631           Int_t icirc = board->GetNumber();
632           if (icirc != 0) { // pcrochet 181206: MOOD needs ALL boards
633             
634             localTrigger.SetLoCircuit(icirc);
635             localTrigger.SetLoStripX(board->GetStripX11());
636             localTrigger.SetLoDev(board->GetDev());
637             localTrigger.SetLoSdev(board->GetSdev());
638             localTrigger.SetLoTrigY(board->GetTrigY());
639             localTrigger.SetLoStripY(board->GetStripY11());
640             
641             //             SAVE LUT OUTPUT 
642             UShort_t response = board->GetResponse();
643             localTrigger.SetLoHpt((response & 12) >> 2);
644             localTrigger.SetLoLpt(response &  3);
645             
646             // calculates regional inputs from local for the moment
647             UInt_t hPt = (response >> 2) & 0x3;
648             UInt_t lPt =  response       & 0x3;
649             
650             regInpHpt |= hPt << (30 - (j-1)*2);
651             regInpLpt |= lPt << (30 - (j-1)*2);
652             
653             TBits rrr;
654             rrr.Set(6,&response);         
655             
656             //             SAVE BIT PATTERN
657             localTrigger.SetX1Pattern(board->GetXY(0,0));
658             localTrigger.SetX2Pattern(board->GetXY(0,1));
659             localTrigger.SetX3Pattern(board->GetXY(0,2));
660             localTrigger.SetX4Pattern(board->GetXY(0,3));
661             
662             localTrigger.SetY1Pattern(board->GetXY(1,0));
663             localTrigger.SetY2Pattern(board->GetXY(1,1));
664             localTrigger.SetY3Pattern(board->GetXY(1,2));
665             localTrigger.SetY4Pattern(board->GetXY(1,3));
666             
667             //             ADD A NEW LOCAL TRIGGER          
668             triggerStore.Add(localTrigger);  
669             
670           }
671           }
672         }
673       pRegTrig.SetId(iReg + 8*iSide);
674       pRegTrig.SetLocalOutput(regInpLpt, 0);
675       pRegTrig.SetLocalOutput(regInpHpt, 1);
676       pRegTrig.SetOutput(regBoard->GetResponse());
677       
678       triggerStore.Add(pRegTrig);  
679       }
680     }
681   
682   // GLOBAL TRIGGER INFORMATION
683   UShort_t global = fGlobalTriggerBoard->GetResponse();
684   UInt_t *globalInput = fGlobalTriggerBoard->GetGlobalInput();  
685
686   AliMUONGlobalTrigger globalTrigger;
687   
688   globalTrigger.SetFromGlobalResponse(global);
689   globalTrigger.SetFromGlobalInput(globalInput);
690   // ADD A LOCAL TRIGGER IN THE LIST 
691   triggerStore.SetGlobal(globalTrigger);
692   
693   // NOW RESET ELECTRONICS
694   Reset();
695 }