]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONRawData.cxx
Add one more word for trigger End of DDL (Christian)
[u/mrichter/AliRoot.git] / MUON / AliMUONRawData.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 ////////////////////////////////////
17 //
18 // MUON Raw Data generator in ALICE-MUON
19 //
20 // This class version 1 (further details could be found in Alice-note coming soon right in our direction)
21 // Generates raw data for MUON tracker and finally for trigger
22 // * a simple mapping is used (see below)
23 // * the bus patch id is calculated with an absolute number 0 - 999
24 // * one DDL per 1/2 chamber is created for both cathode.
25 // For trigger there is no mapping (mapping could be found in AliMUONTriggerCircuit)
26 // don't need for digits2raw but needed in raw2Reco
27 // the position are given per local card
28 ////////////////////////////////////
29
30 #include <TClonesArray.h>
31 #include "AliMUONRawData.h"
32 #include "AliMUONDigit.h"
33 #include "AliMUONTriggerDecision.h"
34 #include "AliMUONConstants.h"
35 #include "AliMUONData.h"
36 #include "AliRun.h" 
37 #include "AliRunLoader.h"
38 #include "AliLoader.h"
39 #include "AliBitPacking.h" 
40 #include "AliMUONDDLTracker.h"
41 #include "AliMUONDDLTrigger.h"
42
43 #include "AliMUON.h"
44 #include "AliMUONLocalTrigger.h"
45 #include "AliMUONGlobalTrigger.h"
46 #include "AliMUONTriggerCircuit.h"
47
48 const Int_t AliMUONRawData::fgkDefaultPrintLevel = 0;
49
50 ClassImp(AliMUONRawData) // Class implementation in ROOT context
51
52 //__________________________________________________________________________
53 AliMUONRawData::AliMUONRawData(AliLoader* loader)
54   : TObject(),
55     fDebug(0)
56 {
57   // Standard Constructor
58  
59   fPrintLevel = fgkDefaultPrintLevel;
60
61   // initialize loader's
62   fLoader = loader;
63
64   // initialize container
65   fMUONData  = new AliMUONData(fLoader,"MUON","MUON");
66
67   // trigger decision, temp solution, local & global has to move to Digits Tree
68 //   fTrigDec = new AliMUONTriggerDecision(fLoader);
69 //   fTrigData = fTrigDec->GetMUONData();
70
71   // initialize array
72   fSubEventArray[0] = new TClonesArray("AliMUONSubEventTracker",1000);
73   fSubEventArray[1] = new TClonesArray("AliMUONSubEventTracker",1000);
74
75   // initialize array
76   fSubEventTrigArray[0] = new TClonesArray("AliMUONSubEventTrigger",1000);
77   fSubEventTrigArray[1] = new TClonesArray("AliMUONSubEventTrigger",1000);
78
79   // ddl pointer
80   fDDLTracker = new AliMUONDDLTracker();
81   fDDLTrigger= new  AliMUONDDLTrigger();
82 }
83
84 //__________________________________________________________________________
85 AliMUONRawData::AliMUONRawData()
86   : TObject(),
87     fMUONData(0),
88     fPrintLevel(fgkDefaultPrintLevel),
89     fDebug(0),
90     fLoader(0)
91 {
92   // Default Constructor
93 }
94
95 //_______________________________________________________________________
96 AliMUONRawData::AliMUONRawData (const AliMUONRawData& rhs)
97   : TObject(rhs)
98 {
99 // Protected copy constructor
100
101   Fatal("AliMUONRawData", "Not implemented.");
102 }
103
104 //_______________________________________________________________________
105 AliMUONRawData & 
106 AliMUONRawData::operator=(const AliMUONRawData& rhs)
107 {
108 // Protected assignement operator
109
110   if (this == &rhs) return *this;
111
112   Fatal("operator=", "Not implemented.");
113     
114   return *this;  
115 }
116
117 //__________________________________________________________________________
118 AliMUONRawData::~AliMUONRawData(void)
119 {
120   if (fMUONData)
121     delete fMUONData;
122   if (fSubEventArray[0])
123     fSubEventArray[0]->Delete(); //using delete cos allocating memory in copy ctor.
124   if (fSubEventArray[1])
125     fSubEventArray[1]->Delete();
126
127   if (fSubEventTrigArray[0])
128     fSubEventTrigArray[0]->Delete();
129   if (fSubEventTrigArray[1])
130     fSubEventTrigArray[1]->Delete();
131
132   if (fDDLTracker)
133     delete fDDLTracker;
134   if (fDDLTrigger)
135     delete fDDLTrigger;
136
137   return;
138 }
139 //____________________________________________________________________
140 Int_t AliMUONRawData::WriteRawData()
141 {
142  // convert digits of the current event to raw data
143
144   Int_t DDLId;
145   Char_t name[20];
146
147   fLoader->LoadDigits("READ");
148
149   fMUONData->SetTreeAddress("D,GLT");
150
151
152   // tracking chambers
153
154   for (Int_t ich = 0; ich < AliMUONConstants::NTrackingCh(); ich++) {
155  
156     // open files
157     DDLId = ich * 2  + 0x900;
158     sprintf(name, "MUON_%d.ddl",DDLId);
159     fFile1 = fopen(name,"w");
160
161     DDLId = (ich * 2) + 1 + 0x900;
162     sprintf(name, "MUON_%d.ddl",DDLId);
163     fFile2 = fopen(name,"w");
164
165     WriteTrackerDDL(ich);
166   
167     // reset and close
168     fclose(fFile1);
169     fclose(fFile2);
170     fMUONData->ResetDigits();
171   }
172  
173   // trigger chambers
174  
175   // open files
176   DDLId = 0xA00;
177   sprintf(name, "MUTR_%d.ddl",DDLId);
178   fFile1 = fopen(name,"w");
179
180   DDLId = 0xA00 + 1;
181   sprintf(name, "MUTR_%d.ddl",DDLId);
182   fFile2 = fopen(name,"w");
183
184   WriteTriggerDDL();
185   
186   // reset and close
187   fclose(fFile1);
188   fclose(fFile2);
189   fMUONData->ResetTrigger();
190   
191   fLoader->UnloadDigits();
192
193   return kTRUE;
194 }
195 //____________________________________________________________________
196 Int_t AliMUONRawData::WriteTrackerDDL(Int_t iCh)
197 {
198   // resets
199   TClonesArray* muonDigits = 0;
200   fSubEventArray[0]->Clear();
201   fSubEventArray[1]->Clear();
202
203   //
204   TArrayI nbInBus[2];
205
206   nbInBus[0].Set(5000);
207   nbInBus[1].Set(5000);
208
209   nbInBus[0].Reset();
210   nbInBus[1].Reset();
211
212   // DDL header
213   AliRawDataHeader header = fDDLTracker->GetHeader();
214   Int_t headerSize = fDDLTracker->GetHeaderSize();
215
216   // DDL event one per half chamber
217   AliMUONSubEventTracker* subEvent;
218
219   // data format
220   Char_t parity = 0x4;
221   UShort_t manuId = 0;
222   UChar_t channelId = 0;
223   UShort_t charge = 0;
224   Int_t busPatchId = 0;
225
226   UInt_t word;
227   Int_t nEntries = 0;
228   Int_t* buffer = 0;
229   Int_t index;
230   Int_t indexDsp;
231   Int_t indexBlk;
232
233   Int_t nDigits;
234   const AliMUONDigit* digit;
235
236    if (fPrintLevel == 1)
237       printf("WriteDDL chamber %d\n", iCh+1);
238
239   for (Int_t iCath = 0; iCath < 2; iCath++) {
240
241     fMUONData->ResetDigits();
242     fMUONData->GetCathode(iCath);
243     muonDigits = fMUONData->Digits(iCh);
244
245     nDigits = muonDigits->GetEntriesFast();
246     if (fPrintLevel == 2)
247       printf("ndigits = %d\n",nDigits);
248
249     // open DDL file, on per 1/2 chamber
250  
251     for (Int_t idig = 0; idig < nDigits; idig++) {
252
253       digit = (AliMUONDigit*) muonDigits->UncheckedAt(idig);
254
255       // mapping
256       GetDummyMapping(iCh, iCath, digit, busPatchId, manuId, channelId, charge);
257
258       //packing word
259       AliBitPacking::PackWord((UInt_t)parity,word,29,31);
260       AliBitPacking::PackWord((UInt_t)manuId,word,18,28);
261       AliBitPacking::PackWord((UInt_t)channelId,word,12,17);
262       AliBitPacking::PackWord((UInt_t)charge,word,0,11);
263
264       // set sub Event
265       subEvent = new AliMUONSubEventTracker();
266       subEvent->AddData(word);
267       subEvent->SetBusPatchId(busPatchId);
268       if (digit->PadX() > 0) {
269         nbInBus[0][busPatchId]++;
270         AddData1(subEvent);
271       } else {
272         nbInBus[1][busPatchId]++;
273         AddData2(subEvent);
274       }
275       delete subEvent;
276     }
277   }
278   fSubEventArray[0]->Sort();
279   fSubEventArray[1]->Sort();
280
281   // gather datas from same bus patch
282    for (Int_t iDDL = 0; iDDL < 2; iDDL++) {
283     nEntries = fSubEventArray[iDDL]->GetEntriesFast();
284
285     for (Int_t i = 0; i < nEntries; i++) {
286       AliMUONSubEventTracker* temp = (AliMUONSubEventTracker*)fSubEventArray[iDDL]->At(i);
287       busPatchId = temp->GetBusPatchId();
288
289       // add bus patch header, length and total length managed by subevent class
290       temp->SetTriggerWord(0xdeadbeef);
291       for (Int_t j = 0; j < nbInBus[iDDL][busPatchId]-1; j++) {
292         AliMUONSubEventTracker* temp1 =  (AliMUONSubEventTracker*)fSubEventArray[iDDL]->At(++i);
293         temp->AddData(temp1->GetData(0));
294         fSubEventArray[iDDL]->RemoveAt(i) ;
295       }
296     }
297     fSubEventArray[iDDL]->Compress();
298
299     if (fPrintLevel == 3) {
300       nEntries = fSubEventArray[iDDL]->GetEntriesFast();
301       for (Int_t i = 0; i < nEntries; i++) {
302         AliMUONSubEventTracker* temp =  (AliMUONSubEventTracker*)fSubEventArray[iDDL]->At(i);
303         printf("busPatchid back %d\n",temp->GetBusPatchId());
304         for (Int_t j = 0; j < temp->GetLength(); j++) {
305           printf("manuId back %d, ",temp->GetManuId(j));
306           printf("channelId back %d, ",temp->GetChannelId(j));
307           printf("charge back %d\n",temp->GetCharge(j));
308         }
309       }
310       printf("\n");
311     }
312   
313   }
314   
315   Int_t iBusPatch;
316   Int_t iEntries;
317
318   for (Int_t iDDL = 0; iDDL < 2; iDDL++) {
319  
320
321     // filling buffer
322     nEntries = fSubEventArray[iDDL]->GetEntriesFast();
323     buffer = new Int_t [(2048+24)*50]; // 24 words in average for one buspatch and 2048 manu info at most
324
325     indexBlk = 0;
326     indexDsp = 0;
327     index = 0;
328     iBusPatch = 0;
329     iEntries = 0;
330
331     for (Int_t iBlock = 0; iBlock < 2; iBlock++) {
332
333       // block header
334       fDDLTracker->SetTotalBlkLength(0xFFFFFFFF);
335       memcpy(&buffer[index],fDDLTracker->GetBlkHeader(),32);
336       indexBlk = index;
337       index += 8; 
338
339       for (Int_t iDsp = 0; iDsp < 5; iDsp++) {
340
341         // DSP header
342         fDDLTracker->SetTotalDspLength(0xEEEEEEEE);
343         memcpy(&buffer[index],fDDLTracker->GetDspHeader(),32);
344         indexDsp = index;
345         index += 8; 
346
347         for (Int_t i = 0; i < 5; i++) {
348
349           iBusPatch = i + iBlock*25 + iDsp*5 + 50*(2*iCh + iDDL);
350
351           AliMUONSubEventTracker* temp = (AliMUONSubEventTracker*)fSubEventArray[iDDL]->At(iEntries);
352           if (nEntries > 0) 
353             busPatchId = temp->GetBusPatchId();
354            else
355             busPatchId = -1;
356
357           if (busPatchId == iBusPatch) {
358             // add bus patch structure
359             memcpy(&buffer[index],temp->GetAddress(),16);
360             index+= 4;
361             for (Int_t j = 0; j < temp->GetLength(); j++) 
362               buffer[index++] =  temp->GetData(j);
363             if (iEntries < nEntries-1)
364               iEntries++;
365           } else {
366             buffer[index++] = 4; // total length
367             buffer[index++] = 0; // raw data length
368             buffer[index++] = iBusPatch; // bus patch
369             buffer[index++] = 0xdeadbeef; // trigger word
370           }
371         } // bus patch
372         buffer[indexDsp] = index - indexDsp;
373         buffer[indexDsp+1] = index - indexDsp -8;
374         if ((index - indexDsp) % 2 == 0)
375           buffer[indexDsp+7] = 0;
376         else
377           buffer[indexDsp+7] = 1;
378       } // dsp
379       buffer[indexBlk] = index - indexBlk;
380       buffer[indexBlk+1] = index - indexBlk -8;
381     }
382     if (iDDL == 0) {
383       // write DDL 1
384       header.fSize = index + headerSize;// total length in word
385       fwrite((char*)(&header),headerSize*4,1,fFile1);
386       fwrite(buffer,sizeof(int),index,fFile1);
387     } 
388     if (iDDL == 1) {
389       // write DDL 2
390       header.fSize = index + headerSize;// total length in word
391       fwrite((char*)(&header),headerSize*4,1,fFile2);
392       fwrite(buffer,sizeof(int),index,fFile2);
393     }
394     delete[] buffer;
395   }
396
397   return kTRUE;
398 }
399 //____________________________________________________________________
400 Int_t AliMUONRawData::WriteTriggerDDL()
401 {
402
403  // DDL event one per half chamber
404   AliMUONSubEventTrigger* subEvent = 0x0;
405
406
407   // stored local id number 
408   TArrayI isFired(256);
409   isFired.Reset();
410
411
412  // DDL header
413   AliRawDataHeader header = fDDLTrigger->GetHeader();
414   Int_t headerSize = fDDLTrigger->GetHeaderSize();
415
416   TClonesArray* localTrigger;
417   TClonesArray* globalTrigger;
418   AliMUONGlobalTrigger* gloTrg;
419   AliMUONLocalTrigger* locTrg = 0x0;
420
421   fMUONData->GetTriggerD();
422
423   // global trigger for trigger pattern
424   globalTrigger = fMUONData->GlobalTrigger(); 
425   gloTrg = (AliMUONGlobalTrigger*)globalTrigger->UncheckedAt(0);
426   Int_t gloTrigPat = GetGlobalTriggerPattern(gloTrg);
427
428   // local trigger 
429   localTrigger = fMUONData->LocalTrigger();    
430
431   UInt_t word;
432   Int_t* buffer = 0;
433   Int_t index;
434   Int_t iEntries = 0;
435   Int_t iLocCard, locCard;
436   Char_t locDec, trigY, posY, devX, posX;
437   Int_t version = 1; // software version
438   Int_t eventType =1; // trigger type: 1 for physics ?
439   Int_t serialNb = 0xF; // serial nb of card: all bits on for the moment
440
441   Int_t nEntries = (Int_t) (localTrigger->GetEntries());// 234 local cards
442   // stored the local card id that's fired
443   for (Int_t i = 0; i <  nEntries; i++) {
444     locTrg = (AliMUONLocalTrigger*)localTrigger->At(i);
445     isFired[locTrg->LoCircuit()] = 1;
446   }
447
448   if (!nEntries)
449     Error("AliMUONRawData::WriteTriggerDDL","No Trigger information available");
450
451   buffer = new Int_t [680]; // [16(local)*5 words + 4 words]*8(reg) + 8 words = 680
452
453   for (Int_t iDDL = 0; iDDL < 2; iDDL++) {
454     
455     index = 0; 
456
457     // DDL enhanced header
458     word =0;
459     AliBitPacking::PackWord((UInt_t)iDDL+1,word,30,31); //see AliMUONDDLTrigger.h for details
460     AliBitPacking::PackWord((UInt_t)version,word,22,29);
461     AliBitPacking::PackWord((UInt_t)serialNb,word,18,21);
462     AliBitPacking::PackWord((UInt_t)eventType,word,14,17);
463
464     fDDLTrigger->SetDDLWord(word);
465     fDDLTrigger->SetGlobalOutput(gloTrigPat);
466     memcpy(&buffer[index],fDDLTrigger->GetEnhancedHeader(),24);
467     index += 6; 
468
469     for (Int_t iReg = 0; iReg < 8; iReg++) {
470
471       subEvent = new AliMUONSubEventTrigger();
472
473       // Regional card header
474       word = 0;
475       AliBitPacking::PackWord((UInt_t)serialNb,word,27,31); //see  AliMUONSubEventTrigger.h for details
476       AliBitPacking::PackWord((UInt_t)iReg,word,22,26);
477       AliBitPacking::PackWord((UInt_t)version,word,14,21);
478       subEvent->SetRegWord(word);
479       memcpy(&buffer[index++],subEvent->GetAddress(),4);
480
481       for (Int_t iLoc = 0; iLoc < 16; iLoc++) {
482
483         iLocCard = iLoc + iReg*16 + iDDL*128;
484
485         if (isFired[iLocCard]) {
486           locTrg = (AliMUONLocalTrigger*)localTrigger->At(iEntries);
487           locCard = locTrg->LoCircuit();
488           locDec = locTrg->GetLoDecision();
489           trigY = 0;
490           posY = locTrg->LoStripY();
491           posX = locTrg->LoStripX();
492           devX = locTrg->LoDev();
493           if (fPrintLevel == 4) 
494             printf("loctrg %d, posX %d, posY %d, devX %d\n", 
495                    locTrg-> LoCircuit(),locTrg->LoStripX(),locTrg->LoStripY(),locTrg->LoDev());
496         } else { //no trigger (see PRR chpt 3.4)
497           locCard = -1;
498           locDec = 0;
499           trigY = 1;
500           posY = 15;
501           posX = 0;
502           devX = 0x8000;
503         }
504
505         //packing word
506         word = 0;
507         AliBitPacking::PackWord((UInt_t)(iLocCard % 16),word,19,22); //card id number in crate
508         AliBitPacking::PackWord((UInt_t)locDec,word,15,18);
509         AliBitPacking::PackWord((UInt_t)trigY,word,14,14);
510         AliBitPacking::PackWord((UInt_t)posY,word,10,13);
511         AliBitPacking::PackWord((UInt_t)devX,word,5,9);
512         AliBitPacking::PackWord((UInt_t)posX,word,0,4);
513
514         if (locCard == iLocCard) {
515           // add local cards structure
516           buffer[index++] = (locTrg->GetX1Pattern() | (locTrg->GetX2Pattern() << 16));
517           buffer[index++] = (locTrg->GetX3Pattern() | (locTrg->GetX4Pattern() << 16));
518           buffer[index++] = (locTrg->GetY1Pattern() | (locTrg->GetY2Pattern() << 16));
519           buffer[index++] = (locTrg->GetY3Pattern() | (locTrg->GetY4Pattern() << 16));
520           buffer[index++] = (Int_t)word; // data word
521           if (iEntries < nEntries-1)
522             iEntries++;
523         } else {
524           buffer[index++] = 0; // 4 words for x1, x2, y1, y2
525           buffer[index++] = 0; 
526           buffer[index++] = 0; 
527           buffer[index++] = 0; 
528           buffer[index++] = (Int_t)word; // data word
529
530         }
531       } // local card 
532       buffer[index++] = 0;// 2 words of regional input
533       buffer[index++] = 0;
534       buffer[index++] = 0;// regional output
535
536       delete subEvent;  
537
538     } // Regional card
539     
540     buffer[index++] = fDDLTrigger->GetEoD(); // End of DDL word
541     buffer[index++] = fDDLTrigger->GetEoD(); // End of DDL word for 64 bits transfer purpose
542
543     
544     if (iDDL == 0) {
545       // write DDL 1
546       header.fSize = index + headerSize;// total length in word
547       fwrite((char*)(&header),headerSize*4,1,fFile1);
548       fwrite(buffer,sizeof(int),index,fFile1);
549     } 
550     if (iDDL == 1) {
551       // write DDL 2
552       header.fSize = index + headerSize;// total length in word
553       fwrite((char*)(&header),headerSize*4,1,fFile2);
554       fwrite(buffer,sizeof(int),index,fFile2);
555     }
556   }
557   delete[] buffer;
558
559   return kTRUE;
560 }
561 //____________________________________________________________________
562 void AliMUONRawData::GetDummyMapping(Int_t iCh, Int_t iCath, const AliMUONDigit* digit,
563                                      Int_t &busPatchId, UShort_t &manuId, UChar_t &channelId, UShort_t &charge)
564 {
565
566   Int_t offsetX = 0; // offet row
567   Int_t offsetY = 0; // offset columns
568   Int_t offsetCath = 0; //offset from one cathod to the other
569   Int_t maxChannel = 0; // maximum nb of channel in 1/2 chamber
570   Int_t id;
571       switch (iCh+1) {
572       case 1:
573       case 2:
574       case 3:
575       case 4:
576         offsetX = 512;
577         offsetY = 256;
578         offsetCath = 65536;
579         maxChannel = (offsetY * offsetX + 2* offsetY + offsetCath);
580         break;
581       case 5:
582       case 6:
583       case 7:
584       case 8:
585       case 9:
586       case 10:
587         offsetX = 1024;
588         offsetY = 0;
589         offsetCath = 65536;
590         maxChannel = (256 * offsetX + offsetX + offsetCath);
591         break;
592       }
593       // dummy mapping
594       // manu Id directly from a matrix 8*8, same segmentation for B and NB
595       // 50 buspatches for 1/2 chamber
596
597       id =  (TMath::Abs(digit->PadX()) * offsetX + digit->PadY() + offsetY +
598              offsetCath * iCath);
599       Int_t chPerBus = maxChannel/50;
600       busPatchId = id/chPerBus; // start at zero 
601       if (digit->PadX() > 0)
602         busPatchId += 50*iCh*2;
603       else 
604         busPatchId += 50*(2*iCh+1);
605       // 64 manu cards for one buspatch
606       manuId = (id % chPerBus)/64; //start at zero 
607       manuId &= 0x7FF; // 11 bits 
608
609       // channel id
610       channelId = (id % chPerBus) % 64; //start at zero 
611       channelId &= 0x3F; // 6 bits
612
613 //       id =  (TMath::Abs(digit->PadX()) * offsetX + digit->PadY() + offsetY +
614 //           offsetCath * iCath);
615 //       busPatchId = id/50;
616
617 //       Int_t inBusId = id - (maxChannel/50 * busPatchId);// id channel in buspatch
618 //       Int_t manuPerBus = (maxChannel/(50*64)); // number of manus per buspatch
619
620 //       // 64 manu cards for one buspatch
621 //       manuId = inBusId/manuPerBus;
622 //       manuId &= 0x7FF; // 11 bits 
623
624 //       // channel id
625 //       channelId = (inBusId % manuPerBus);
626 //       channelId &= 0x3F; // 6 bits
627
628       if (fPrintLevel == 2)
629         printf("id: %d, busPatchId %d, manuId: %d, channelId: %d, maxchannel: %d, chPerBus %d\n",
630                id, busPatchId, manuId, channelId, maxChannel, chPerBus);
631       // charge
632       charge = digit->Signal();
633       charge &= 0xFFF;
634
635       if (fPrintLevel == 2)
636         printf("id: %d, busPatchId %d, manuId: %d, channelId: %d, padx: %d pady %d, charge %d\n",
637                id, busPatchId, manuId, channelId, digit->PadX(), digit->PadY(), digit->Signal());
638
639 }
640
641 //____________________________________________________________________
642 Int_t AliMUONRawData::GetGlobalTriggerPattern(AliMUONGlobalTrigger* gloTrg)
643 {
644   Int_t gloTrigPat = 0;
645
646   if (gloTrg->SinglePlusLpt())  gloTrigPat|= 0x1;
647   if (gloTrg->SinglePlusHpt())  gloTrigPat|= 0x2;
648   if (gloTrg->SinglePlusApt())  gloTrigPat|= 0x4;
649  
650   if (gloTrg->SingleMinusLpt()) gloTrigPat|= 0x8;
651   if (gloTrg->SingleMinusHpt()) gloTrigPat|= 0x10;
652   if (gloTrg->SingleMinusApt()) gloTrigPat|= 0x20;
653  
654   if (gloTrg->SingleUndefLpt()) gloTrigPat|= 0x40;
655   if (gloTrg->SingleUndefHpt()) gloTrigPat|= 0x80;
656   if (gloTrg->SingleUndefApt()) gloTrigPat|= 0x100;
657  
658   if (gloTrg->PairUnlikeLpt())  gloTrigPat|= 0x200;
659   if (gloTrg->PairUnlikeHpt())  gloTrigPat|= 0x400;
660   if (gloTrg->PairUnlikeApt())  gloTrigPat|= 0x800;
661
662   if (gloTrg->PairLikeLpt())    gloTrigPat|= 0x1000;
663   if (gloTrg->PairLikeHpt())    gloTrigPat|= 0x2000;
664   if (gloTrg->PairLikeApt())    gloTrigPat|= 0x4000;
665
666   return gloTrigPat;
667 }