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