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