StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEmcTriggerMaker.cxx
1 //
3 //
4 // StEmcTriggerMaker R. Fatemi (Oct 26, 2006)
5 //
6 // The structure of this class was first developed by J.Klay and A. Suaide in 2001.
7 // It was originally designed to fill StEvent with the simulated L0 trigger response
8 // but to my understanding was never fully implemented
9 //
10 // Early in 2005, using code originally developed by Alex Stopolsky to emulate the BEMC
11 // FEE output, I expanded the code to return full BEMC L0 trigger emulation. This code
12 // was motivated by the need to run the same trigger algorithm over data and simulation.
13 // All DSM outputs are stored, for data only, in StTriggerDetector class. The ultimate
14 // design vision is that StEmcTriggerMaker serves as access to the StBemcTrigger and
15 // StEemcTrigger classes which mock up the BEMC/EEMC FEE + L0 DSM trigger algorithms.
16 // Interface to L2 should also take place in this class.
17 //
18 //
20 
21 #include <Stiostream.h>
22 #include "StChain.h"
23 #include "TFile.h"
24 #include <math.h>
25 
26 #include "StMaker.h"
27 #include "St_DataSetIter.h"
28 #include "StEvent/StEvent.h"
29 #include "StEvent/StEventTypes.h"
30 #include "StEmcUtil/database/StBemcTables.h"
31 #include "StDaqLib/EMC/StEmcDecoder.h"
32 
33 #include "StEmcTriggerMaker.h"
34 
35 
36 ClassImp(StEmcTriggerMaker)
37 
38 //_____________________________________________________________________________
39 StEmcTriggerMaker::StEmcTriggerMaker(const char *name):StMaker(name)
40 {
41  mBemcTrigger = new StBemcTrigger();
42 
43  mIs2003HT1=-1;
44  mIs2003HT2=-1;
45  mIs2004HT1=-1;
46  mIs2004JP1=-1;
47  mIs2004HT2=-1;
48  mIs2004JP2=-1;
49  mIs2005HT1=-1;
50  mIs2005JP1=-1;
51  mIs2005HT2=-1;
52  mIs2005JP2=-1;
53  mIs2005ADJ=-1;
54  mIs2005JPSI=-1;
55  for (int matrix=0;matrix<6;matrix++){
56  mIs2006JP0[matrix]=-1;
57  mIs2006HT2[matrix]=-1;
58  mIs2006JP1[matrix]=-1;
59  mIs2006JPSI[matrix]=-1;
60  mIs2006HTTP[matrix]=-1;
61  }
62  for (int i=0;i<50;i++) isTrig[i]=-1;
63 
64 
65  HT1_ID_2003=-1;
66  HT2_ID_2003=-1;
67  HT1_ID_2004=-1;
68  HT2_ID_2004=-1;
69  JP1_ID_2004=-1;
70  JP2_ID_2004=-1;
71  HT1_ID_2005=-1;
72  HT2_ID_2005=-1;
73  JP1_ID_2005=-1;
74  JP2_ID_2005=-1;
75  ADJ_ID_2005=-1;
76  for (int matrix=0;matrix<6;matrix++)
77  {
78  HT2_ID_2006[matrix]=-1;
79  JP0_ID_2006[matrix]=-1;
80  JP1_ID_2006[matrix]=-1;
81  }
82 
83  for (int i=0;i<50;i++) TowJetId[i] = -1;
84 
85  HT1_DSM_2003=-1;
86  HT2_DSM_2003=-1;
87  HT1_DSM_2004=-1;
88  HT2_DSM_2004=-1;
89  JP1_DSM_2004=-1;
90  JP2_DSM_2004=-1;
91  HT1_DSM_2005=-1;
92  HT2_DSM_2005=-1;
93  JP1_DSM_2005=-1;
94  JP2_DSM_2005=-1;
95  ADJ_DSM_2005=-1;
96  for ( int matrix=0;matrix<6;matrix++){
97  HT2_DSM_2006[matrix]=-1;
98  JP0_DSM_2006[matrix]=-1;
99  JP1_DSM_2006[matrix]=-1;
100  }
101  BETOT_DSM_2006=-1;
102 
103  for (int i=0;i<50;i++) DsmAdc[i] = -1;
104 
105  for (int i=0;i<kNJet;i++){
106  JP12005array[i]=-1;
107  JP22005array[i]=-1;
108  }
109  for (int i=0; i<kNTowers; i++){
110  HT12005array[i]=-1;
111  HT22005array[i]=-1;
112  }
113 
114  for (int i=0;i<(kNJet/2);i++){ BL1_2006_arrayADC[i]=-1;}
115 
116  for (int i=0; i<12; i++) {
117  numHT[i]=-1;
118  numJP[i]=-1;
119  if (i<6) numHTTP[i]=-1;
120  }
121 
122 }
123 
124 //____________________________________________________________________________
125 StEmcTriggerMaker::~StEmcTriggerMaker()
126 {}
127 
128 //_____________________________________________________________________________
129 Int_t StEmcTriggerMaker::Init()
130 {
131  tables=new StBemcTables();
132 
133  LOG_INFO <<"StEmcTriggerMaker::Init()"<<endm;
134 
135  return StMaker::Init();
136 }
137 //_____________________________________________________________________________
139 {
140 
141  LOG_DEBUG<<"StEmcTriggerMaker::Make()"<<endm;
142 
143  tables->loadTables(this);
144  setTableMaker(tables);
145 
146  StEvent* event=(StEvent*)GetInputDS("StEvent");
147  if(!event) return kStOk;
148 
149  mBemcTrigger->setEvent(event);
150 
151  if(mBemcTrigger->makeTrigger() != kStOK)
152  {
153  LOG_WARN << "StEmcTriggerMaker::Make() -- trigger information is not filled! Something is wrong!" << endm;
154  }
155 
156  int* isTrig = mBemcTrigger->isTrigEvent();
157  int* TowJetId = mBemcTrigger->getTowPatchId();
158  int* DsmAdc = mBemcTrigger->getTowPatchDSM();
159  int* numHT = mBemcTrigger->getNHT();
160  int* numJP = mBemcTrigger->getNJP();
161  int* numHTTP =mBemcTrigger->getNHTTP();
162  int* HT12005array = mBemcTrigger->getHT12005array();
163  int* HT22005array = mBemcTrigger->getHT22005array();
164  int* JP12005array = mBemcTrigger->getJP12005array();
165  int* JP22005array = mBemcTrigger->getJP22005array();
166  int* JPSI2005adc = mBemcTrigger->getJPSI2005adc();
167  int* JPSI2005id = mBemcTrigger->getJPSI2005id();
168  int* BL12006arrayADC=mBemcTrigger->getBL12006arrayADC();
169 
170 
171  //2003 HT1 == 1101/2201
172  mIs2003HT1=isTrig[0];
173  HT1_ID_2003=TowJetId[0];
174  HT1_DSM_2003=DsmAdc[0];
175 
176  //2003 HT2 == 2202
177  mIs2003HT2=isTrig[42];
178  HT2_ID_2003=TowJetId[42];
179  HT2_DSM_2003=DsmAdc[42];
180 
181  //2004 HT1 == 45201
182  mIs2004HT1=isTrig[1];
183  HT1_ID_2004=TowJetId[1];
184  HT1_DSM_2004=DsmAdc[1];
185 
186  //2004 HT2 == 45202
187  mIs2004HT2=isTrig[2];
188  HT2_ID_2004=TowJetId[2];
189  HT2_DSM_2004=DsmAdc[2];
190 
191  //2004 JP1 == 45206
192  mIs2004JP1=isTrig[3];
193  JP1_ID_2004=TowJetId[3];
194  JP1_DSM_2004=DsmAdc[3];
195 
196  //2004 JP2 == 45207
197  mIs2004JP2=isTrig[4];
198  JP2_ID_2004=TowJetId[4];
199  JP2_DSM_2004=DsmAdc[4];
200 
201  //2005 HT1=96201
202  mIs2005HT1=isTrig[5];
203  HT1_ID_2005=TowJetId[5];
204  HT1_DSM_2005=DsmAdc[5];
205  numHT1_2005=numHT[3];
206  for (int i=0;i<numHT1_2005;i++){
207  HT1_2005_array[i]=HT12005array[i];
208  }
209 
210  //2005 HT2=96211
211  mIs2005HT2=isTrig[6];
212  HT2_ID_2005=TowJetId[6];
213  HT2_DSM_2005=DsmAdc[6];
214  numHT2_2005=numHT[4];
215  for (int i=0;i<numHT2_2005;i++){
216  HT2_2005_array[i]=HT22005array[i];
217  }
218 
219  //2005 JP1=96221
220  mIs2005JP1=isTrig[7];
221  JP1_ID_2005=TowJetId[7];
222  JP1_DSM_2005=DsmAdc[7];
223  numJP1_2005=numJP[2];
224  for (int i=0;i<numJP1_2005;i++){
225  JP1_2005_array[i]=JP12005array[i];
226  }
227 
228  //2005 JP2=96233
229  mIs2005JP2=isTrig[8];
230  JP2_ID_2005=TowJetId[8];
231  JP2_DSM_2005=DsmAdc[8];
232  numJP2_2005=numJP[3];
233  for (int i=0;i<numJP2_2005;i++){
234  JP2_2005_array[i]=JP22005array[i];
235  }
236 
237  //2005 ADJP = 96241
238  mIs2005ADJ=isTrig[9];
239  ADJ_ID_2005=TowJetId[9];
240  ADJ_DSM_2005=DsmAdc[9];
241 
242  //2005 JPSI = 20
243  mIs2005JPSI=isTrig[10];
244  for (int i=0;i<kNJet; i++){
245  JPSI_2005_ADC[i]=JPSI2005adc[i];
246  JPSI_2005_ID[i]=JPSI2005id[i];
247  }
248 
249 
250 
251  for (int matrix=0;matrix<6;matrix++)
252  {
253  //2006 HT2
254  mIs2006HT2[matrix]=isTrig[11+(matrix*5)];
255  HT2_ID_2006[matrix]=TowJetId[11+(matrix*5)];
256  HT2_DSM_2006[matrix]=DsmAdc[11+(matrix*5)];
257  numHT2_2006[matrix]=numHT[5+matrix];
258  for (int i=0;i<numHT2_2006[matrix];i++){
259  HT2_2006_array[matrix][i]=mBemcTrigger->getHT22006array(matrix,i);
260  }
261 
262  //2006 JP0
263  mIs2006JP0[matrix]=isTrig[12+(matrix*5)];
264  JP0_ID_2006[matrix]=TowJetId[12+(matrix*5)];
265  JP0_DSM_2006[matrix]=DsmAdc[12+(matrix*5)];
266  numJP0_2006[matrix]=numJP[5+(matrix*2)];
267  for (int i=0;i<numJP0_2006[matrix];i++) {
268  JP0_2006_array[matrix][i]=mBemcTrigger->getJP02006array(matrix,i);
269  }
270 
271  //2006 JP1
272  mIs2006JP1[matrix]=isTrig[13+(matrix*5)];
273  JP1_ID_2006[matrix]=TowJetId[13+(matrix*5)];
274  JP1_DSM_2006[matrix]=DsmAdc[13+(matrix*5)];
275  numJP1_2006[matrix]=numJP[6+(matrix*2)];
276  for (int i=0;i<numJP1_2006[matrix];i++){
277  JP1_2006_array[matrix][i]=mBemcTrigger->getJP12006array(matrix,i);
278  }
279 
280  //2006 JPSI
281  mIs2006JPSI[matrix]=isTrig[14+(matrix*5)];
282  for (int i=0;i<kNJet; i++){
283  JPSI_2006_ADC[matrix][i]=mBemcTrigger->getJPSI2006adc(matrix,i);
284  JPSI_2006_ID[matrix][i]=mBemcTrigger->getJPSI2006id(matrix,i);
285  }
286 
287  //2006 HTTP && UPSILON
288  mIs2006HTTP[matrix]=isTrig[15+(matrix*5)];
289  numHTTP_2006[matrix]=numHTTP[matrix];
290  for (int i=0; i<numHTTP_2006[matrix]; i++){
291  HTTP_2006_arrayTP[matrix][i]=mBemcTrigger->getHTTP2006arrayTP(matrix,i);
292  HTTP_2006_arrayHT[matrix][i]=mBemcTrigger->getHTTP2006arrayHT(matrix,i);
293  HTTP_2006_arrayTP_ADC[matrix][i]=mBemcTrigger->getHTTP2006arrayTPADC(matrix,i);
294  HTTP_2006_arrayHT_ADC[matrix][i]=mBemcTrigger->getHTTP2006arrayHTADC(matrix,i);
295  }
296  }
297 
298  //2006 BETOT
299  BETOT_DSM_2006=DsmAdc[41];
300  for (int i=0;i<kNJet/2;i++) BL1_2006_arrayADC[i]=BL12006arrayADC[i];
301 
302 
303  //access TP 6 bit DSMsum
304  for (int j=0;j<300;j++)
305  {
306  trigPatch[j]=0;
307  trigPatch[j]=mBemcTrigger->trgPatch[j];
308  }
309 
310  return kStOK;
311 }
312 
313 
315 {
316  return StMaker::Finish();
317 }
318 
319 void StEmcTriggerMaker::get2005HT1_TOWS(int index, int *id){
320  *id=-1;
321  if (index<kNTowers) *id=HT1_2005_array[index];
322 }
323 
324 void StEmcTriggerMaker::get2005HT2_TOWS(int index, int *id){
325  *id=-1;
326  if (index<kNTowers) *id=HT2_2005_array[index];
327 }
328 
329 void StEmcTriggerMaker::get2005JP1_PATCHES(int index, int *id){
330  *id=-1;
331  if (index<kNJet) *id=JP1_2005_array[index];
332 }
333 
334 void StEmcTriggerMaker::get2005JP2_PATCHES(int index, int *id){
335  *id=-1;
336  if (index<kNJet) *id=JP2_2005_array[index];
337 }
338 
339 void StEmcTriggerMaker::get2005JPSI_ADC(int index, int *id){
340  *id=-1;
341  if (index<kNJet) *id=JPSI_2005_ADC[index];
342 }
343 
344 void StEmcTriggerMaker::get2005JPSI_ID(int index, int *id){
345  *id=-1;
346  if (index<kNJet) *id=JPSI_2005_ID[index];
347 }
348 
349 
350 void StEmcTriggerMaker::get2006BL1_ADC(int index, int *id){
351  *id=-1;
352  if (index<kNJet/2) *id=BL1_2006_arrayADC[index];
353 }
354 
355 
357 
358  switch(trigId)
359  {
360 
361  //matrix==0
362  //bemc-ht2-mb-emul
363  case(127212): return mIs2006HT2[0];
364 
365  //matrix==1
366  //bemc-jp0-mb
367  case(127501): return mIs2006JP0[1];
368  //bemc-jp1-mb
369  case(127221): return mIs2006JP1[1];
370  //bemc-http-mb-fast
371  case(127821): return mIs2006HTTP[1];
372  //bemc-http-mb-l2gamma
373  case(127611): return -1;
374  //bemc-jp0-etot-mb-L2jet
375  case(127622): return -1;
376  //bemc-ht2-mb-emul
377  case(127213): return mIs2006HT2[1];
378  //jpsi-mb
379  case(117705): return mIs2006JPSI[1];
380  //Upsilon
381  case(117602): return mIs2006HTTP[1];
382 
383  //matrix==2 only a few triggers commissioned
384  //bemc-jp1-mb
385  case(137221): return mIs2006JP1[2];
386 
387  //matrix==3
388  //bemc-jp0-mb
389  case(137501): return mIs2006JP0[3];
390  //bemc-jp1-mb
391  case(137222): return mIs2006JP1[3];
392  //bemc-http-mb-fast
393  case(137821): return mIs2006HTTP[3];
394  //bemc-jp0-etot-mb-L2jet
395  case(137622): return -1;
396  //bemc-ht2-mb-emul
397  case(137213): return mIs2006HT2[3];
398  //Upsilon
399  case(137602): return mIs2006HTTP[3];
400 
401 
402  //matrix==4 change HT1 and TP th
403  //bemc-http-mb-fast
404  case(137822): return mIs2006HTTP[4];
405 
406  //matrix==5 add L2 gamma trigger
407  //bemc-http-mb-l2gamma
408  case(137611): return -1;
409 
410  //2003-2005
411  case(96201): return is2005HT1();
412  case(96211): return is2005HT2();
413  case(96221): return is2005JP1();
414  case(96233): return is2005JP2();
415  case(45201): return is2004HT1();
416  case(45202): return is2004HT2();
417  case(45206): return is2004JP1();
418  case(45207): return is2004JP2();
419  case(1101): return is2003HT1();
420  case(2201): return is2003HT1();
421  case(2202): return is2003HT2();
422 
423  }
424 
425  //if we got here then we don't know how to interpret the trigger
426  return -1;
427 }
428 
429 
430 int StEmcTriggerMaker::barrelTowerThreshold(int trigId, int softId)
431 {
432  switch(trigId)
433  {
434  //high tower
435  case(127212): return (softId > 2400) ? 24:22;
436  case(127213):case(137213): return 24;
437 
438  //jet patch
439  case(127501):case(137501):
440  case(127221):case(137221):case(137222): return 0;
441 
442  //http
443  case(127821): return 12;
444  case(137821): return 18;
445  case(137822): return 16;
446 
447  //jpsi E==11, W==5
448  case(117705): return (softId > 2400) ? 11:5;
449 
450  //2003-2005
451  case(96201): return 13;
452  case(96211): return 17;
453  case(96221): case(96233): return 0;
454  case(45201): return 10;
455  case(45202): return 20;
456  case(45206): case(45207): return 0;
457  case(1101): return 8;
458  case(2201): return 8;
459  case(2202): return 13;
460 
461 
462  }
463 
464  //if we got here then we don't know how to interpret the trigger
465  return -1;
466 }
467 
469 {
470  switch(trigId)
471  {
472  //high tower
473  case(127212):case(127213):case(137213): return 0;
474 
475  //jet patch
476  case(127501):case(137501):
477  case(127221):case(137221):case(137222): return 0;
478 
479  //http
480  case(127821): return 17;
481  case(137821): return 20;
482  case(137822): return 19;
483 
484  //jpsi
485  case(117705): return 0;
486 
487  //run 2003-2005
488  case(96201): case(96211): case(96221): case(96233): return 0;
489  case(45201): case(45202): case(45206): case(45207): return 0;
490  case(1101): case(2201): case(2202): return 0;
491 
492  }
493 
494  //if we got here then we don't know how to interpret the trigger
495  return -1;
496 }
497 
498 int StEmcTriggerMaker::barrelJetPatchThreshold(int trigId, int patchId)
499 {
500  switch(trigId)
501  {
502  //high tower
503  case(127212):case(127213):case(137213): return 0;
504 
505  //jet patch
506  case(127501):return 42;
507  case(127221):case(137221): return 58;
508  case(137501):return 49;
509  case(137222):return 60;
510 
511  //http
512  case(127821):case(137821):case(137822): return 0;
513 
514  //jpsi
515  case(117705): return 0;
516 
517  //run 2003+2004+2005
518  case(96201): case(96211): return 0;
519  case(96221): return 66;
520  case(96233): return 84;
521  case(45201): case(45202): return 0;
522  case(45206): return 40;
523  case(45207): return 60;
524  case(1101): case(2201): case(2202): return 0;
525 
526 
527  }
528 
529  //if we got here then we don't know how to interpret the trigger
530  return -1;
531 }
532 
534  map<int,int> towers;
535  int counter,softId,adc;
536 
537  switch(trigId)
538  {
539 
540  //matrix==0
541  //bemc-ht2-mb-emul
542  case(127212):
543  counter = numHT2_2006[0];
544  for(int i=0; i<counter; i++) {
545  adc=-1;
546  softId=HT2_2006_array[0][i];
547  if (softId == HT2_ID_2006[0]) adc = HT2_DSM_2006[0];
548  towers[softId] = adc;
549  }
550  break;
551 
552  //matrix==1
553  //bemc-http-mb-fast
554  case(127821):
555  counter = numHTTP_2006[1];
556  for(int i=0; i<counter; i++) {
557  softId= HTTP_2006_arrayHT[1][i];
558  adc = HTTP_2006_arrayHT_ADC[1][i];
559  towers[softId] = adc;
560  }
561  break;
562 
563  //bemc-http-mb-l2gamma
564  //case(127611): return -1;
565  //bemc-jp0-etot-mb-L2jet
566  //case(127622): return -1;
567 
568  //bemc-ht2-mb-emul
569  case(127213):
570  counter = numHT2_2006[1];
571  for(int i=0; i<counter; i++) {
572  softId=HT2_2006_array[1][i];
573  adc=-1;
574  if (softId == HT2_ID_2006[1]) adc = HT2_DSM_2006[1];
575  towers[softId] = adc;
576  }
577  break;
578 
579  //jpsi-mb
580  case(117705):
581  counter = kNJet;
582  for(int i=0; i<counter; i++) {
583  softId=JPSI_2006_ID[1][i];
584  adc=JPSI_2006_ADC[1][i];
585  towers[softId] = adc;
586  }
587  break;
588 
589  //Upsilon
590  case(117602):
591  counter = numHTTP_2006[1];
592  for(int i=0; i<counter; i++) {
593  softId= HTTP_2006_arrayHT[1][i];
594  adc = HTTP_2006_arrayHT_ADC[1][i];
595  towers[softId] = adc;
596  }
597  break;
598 
599  //matrix==2 only a few triggers commissioned
600  //bemc-jp1-mb
601 
602  //matrix==3
603  //bemc-http-mb-fast
604  case(137821):
605  counter = numHTTP_2006[3];
606  for(int i=0; i<counter; i++) {
607  softId= HTTP_2006_arrayHT[3][i];
608  adc = HTTP_2006_arrayHT_ADC[3][i];
609  towers[softId] = adc;
610  }
611  break;
612 
613  //bemc-ht2-mb-emul
614  case(137213):
615  counter = numHT2_2006[3];
616  for(int i=0; i<counter; i++) {
617  softId=HT2_2006_array[3][i];
618  adc=-1;
619  if (softId == HT2_ID_2006[3]) adc = HT2_DSM_2006[3];
620  towers[softId] = adc;
621  }
622  break;
623 
624  //Upsilon
625  case(137602):
626  counter = numHTTP_2006[3];
627  for(int i=0; i<counter; i++) {
628  softId= HTTP_2006_arrayHT[3][i];
629  adc = HTTP_2006_arrayHT_ADC[3][i];
630  towers[softId] = adc;
631  }
632  break;
633 
634  //matrix==4 change HT1 and TP th
635  //bemc-http-mb-fast
636  case(137822):
637  counter = numHTTP_2006[4];
638  for(int i=0; i<counter; i++) {
639  softId= HTTP_2006_arrayHT[4][i];
640  adc = HTTP_2006_arrayHT_ADC[4][i];
641  towers[softId] = adc;
642  }
643  break;
644 
645  //matrix==5 add L2 gamma trigger
646  //bemc-http-mb-l2gamma
647  //case(137611):
648 
649 
650  //2005 ht1
651  case(96201):
652  counter = get2005HT1_NTOWS();
653  for(int i=0; i<counter; i++) {
654  get2005HT1_TOWS(i,&softId);
655  adc = -1;
656  if(softId == get2005HT1_ID()) adc = get2005HT1_ADC();
657  towers[softId] = adc;
658  }
659  break;
660 
661  //2005 ht2
662  case(96211):
663  counter = get2005HT2_NTOWS();
664  for(int i=0; i<counter; i++) {
665  get2005HT2_TOWS(i,&softId);
666  adc = -1;
667  if(softId == get2005HT2_ID()) adc = get2005HT2_ADC();
668  towers[softId] = adc;
669  }
670  break;
671 
672  case(1101):
673  if (is2003HT1()==0) counter=0;
674  if (is2003HT1()==1) counter=1;
675  for(int i=0; i<counter; i++) {
676  softId=get2003HT1_ID();
677  adc = get2003HT1_ADC();
678  towers[softId] = adc;
679  }
680  break;
681 
682  case(2201):
683  if (is2003HT1()==0) counter=0;
684  if (is2003HT1()==1) counter=1;
685  for(int i=0; i<counter; i++) {
686  softId=get2003HT1_ID();
687  adc = get2003HT1_ADC();
688  towers[softId] = adc;
689  }
690  break;
691 
692  case(2202):
693  if (is2003HT2()==0) counter=0;
694  if (is2003HT2()==1) counter=1;
695  for(int i=0; i<counter; i++) {
696  softId=get2003HT2_ID();
697  adc = get2003HT2_ADC();
698  towers[softId] = adc;
699  }
700  break;
701 
702  case(45201):
703  if (is2004HT1()==0) counter=0;
704  if (is2004HT1()==1) counter=1;
705  for(int i=0; i<counter; i++) {
706  softId=get2004HT1_ID();
707  adc = get2004HT1_ADC();
708  towers[softId] = adc;
709  }
710  break;
711 
712  case(45202):
713  if (is2004HT2()==0) counter=0;
714  if (is2004HT2()==1) counter=1;
715  for(int i=0; i<counter; i++) {
716  softId=get2004HT2_ID();
717  adc = get2004HT2_ADC();
718  towers[softId] = adc;
719  }
720  break;
721 
722 
723 
724  }
725 
726  return towers;
727 }
728 
729 
731  map<int,int> patches;
732  int counter,softId,adc;
733 
734  switch(trigId)
735  {
736 
737  //bemc-http-mb-fast
738  case(127821):
739  counter = numHTTP_2006[1];
740  for(int i=0; i<counter; i++) {
741  softId=HTTP_2006_arrayTP[1][i];
742  adc=HTTP_2006_arrayTP_ADC[1][i];
743  patches[softId] = adc;
744  }
745  break;
746 
747  //bemc-http-mb-fast
748  case(137821):
749  counter = numHTTP_2006[3];
750  for(int i=0; i<counter; i++) {
751  softId=HTTP_2006_arrayTP[3][i];
752  adc=HTTP_2006_arrayTP_ADC[3][i];
753  patches[softId] = adc;
754  }
755  break;
756 
757  //bemc-http-mb-fast
758  case(137822):
759  counter = numHTTP_2006[4];
760  for(int i=0; i<counter; i++) {
761  softId=HTTP_2006_arrayTP[4][i];
762  adc=HTTP_2006_arrayTP_ADC[4][i];
763  patches[softId] = adc;
764  }
765  break;
766  }
767 
768  return patches;
769 }
770 
772  map<int,int> patches;
773  int counter,softId,adc;
774 
775  switch(trigId)
776  {
777 
778  //bemc-jp0-mb matrix==1
779  case(127501):
780  counter = numJP0_2006[1];
781  for(int i=0; i<counter; i++) {
782  adc=-1;
783  softId=JP0_2006_array[1][i];
784  if(softId == JP0_ID_2006[1]) adc = JP0_DSM_2006[1];
785  patches[softId] = adc;
786  }
787  break;
788 
789  //bemc-jp1-mb matrix==1
790  case(127221):
791  counter = numJP1_2006[1];
792  for(int i=0; i<counter; i++) {
793  adc=-1;
794  softId=JP1_2006_array[1][i];
795  if(softId == JP1_ID_2006[1]) adc = JP1_DSM_2006[1];
796  patches[softId] = adc;
797  }
798  break;
799 
800  //bemc-jp1-mb matrix==2
801  case(137221):
802  counter = numJP1_2006[2];
803  for(int i=0; i<counter; i++) {
804  adc=-1;
805  softId=JP1_2006_array[2][i];
806  if(softId == JP1_ID_2006[2]) adc = JP1_DSM_2006[2];
807  patches[softId] = adc;
808  }
809  break;
810 
811  //bemc-jp0-mb matrix==3
812  case(137501):
813  counter = numJP0_2006[3];
814  for(int i=0; i<counter; i++) {
815  adc=-1;
816  softId=JP0_2006_array[3][i];
817  if(softId == JP0_ID_2006[3]) adc = JP0_DSM_2006[3];
818  patches[softId] = adc;
819  }
820  break;
821 
822  //bemc-jp1-mb matrix==3
823  case(137222):
824  counter = numJP1_2006[3];
825  for(int i=0; i<counter; i++) {
826  adc=-1;
827  softId=JP1_2006_array[3][i];
828  if(softId == JP1_ID_2006[3]) adc = JP1_DSM_2006[3];
829  patches[softId] = adc;
830  }
831  break;
832 
833 
834  case(96221):
835  counter = get2005JP1_NPATCHES();
836  for(int i=0; i<counter; i++) {
837  get2005JP1_PATCHES(i,&softId);
838  adc = -1;
839  if(softId == get2005JP1_ID()) adc = get2005JP1_ADC();
840  patches[softId] = adc;
841  }
842  break;
843 
844  case(96233):
845  counter = get2005JP2_NPATCHES();
846  for(int i=0; i<counter; i++) {
847  get2005JP2_PATCHES(i,&softId);
848  adc = -1;
849  if(softId == get2005JP2_ID()) adc = get2005JP2_ADC();
850  patches[softId] = adc;
851  }
852  break;
853 
854 
855  case(45206):
856  if (is2004JP1()==0) counter=0;
857  if (is2004JP1()==1) counter=1;
858  for(int i=0; i<counter; i++) {
859  softId=get2004JP1_ID();
860  adc = get2004JP1_ADC();
861  patches[softId] = adc;
862  }
863  break;
864 
865  case(45207):
866  if (is2004JP2()==0) counter=0;
867  if (is2004JP2()==1) counter=1;
868  for(int i=0; i<counter; i++) {
869  softId=get2004JP2_ID();
870  adc = get2004JP2_ADC();
871  patches[softId] = adc;
872  }
873  break;
874 
875  }
876 
877  return patches;
878 }
879 
880 int StEmcTriggerMaker::barrelTriggerPatchForTower(int softId) {
881  const StEmcDecoder *decoder = mBemcTrigger->decoder();
882  if(decoder == NULL) {
883  LOG_WARN << "Pointer to decoder is NULL! Can't get trigger patch for " << softId << endm;
884  return -1;
885  }
886  int patchId;
887  if(decoder->GetTriggerPatchFromTowerId(softId,patchId) != 0) {
888  return patchId;
889  }
890  else {
891  LOG_WARN << "Decoder encountered a problem translating tower id = " << softId << " into a trigger patch" << endm;
892  return -1;
893  }
894 }
895 
897  switch(trigId)
898  {
899  case(127622):case(127652):case(137622):case(137652): return 109;
900  default: return 0;
901  }
902 }
903 
905  return BETOT_DSM_2006;
906 }
907 
908 //the remaining methods still need underlying functionality before they can be implemented
909 int StEmcTriggerMaker::endcapTowerThreshold(int trigId) {
910  return -1;
911 }
912 
913 int StEmcTriggerMaker::endcapTriggerPatchThreshold(int trigId) {
914  return -1;
915 }
916 
917 int StEmcTriggerMaker::endcapJetPatchThreshold(int trigId) {
918  return -1;
919 }
920 
921 map<int,int> StEmcTriggerMaker::endcapTowersAboveThreshold(int trigId) {
922  map<int,int> towers;
923  return towers;
924 }
925 
926 map<int,int> StEmcTriggerMaker::endcapTriggerPatchesAboveThreshold(int trigId) {
927  map<int,int> trigPatches;
928  return trigPatches;
929 }
930 
931 map<int,int> StEmcTriggerMaker::endcapJetPatchesAboveThreshold(int trigId) {
932  map<int,int> jetPatches;
933  return jetPatches;
934 }
935 
936 // $Id: StEmcTriggerMaker.cxx,v 1.23 2007/08/22 15:06:53 kocolosk Exp $
937 //
938 // $Log: StEmcTriggerMaker.cxx,v $
939 // Revision 1.23 2007/08/22 15:06:53 kocolosk
940 // added #include statements that should have always been there. We didn't catch the problem
941 // because StBemcTables provided them in the past.
942 //
943 // Revision 1.22 2007/05/12 12:45:53 rfatemi
944 // Added BHT2 for 2003, new access scheme extends back to 2003+2004, remove all access to StEmcPedestal tables
945 //
946 // Revision 1.21 2007/05/02 17:36:22 kocolosk
947 // added decoder wrapper method that correlates tower and trigger patch.
948 // Useful for HTTP in particular.
949 //
950 // Revision 1.20 2007/04/30 01:53:14 rfatemi
951 // Remove cout statements
952 //
953 // Revision 1.19 2007/04/30 00:59:37 rfatemi
954 // Update new trigger interface
955 //
956 // Revision 1.17 2007/04/24 15:53:17 kocolosk
957 // added new interface methods to get trigger thresholds and decisions based on trigId
958 //
virtual Int_t Make()
int totalEnergyThreshold(int trigId)
DSM ADC threshold for ETOT trigger. ADC &gt; threshold required to fire trigger.
map< int, int > barrelTriggerPatchesAboveThreshold(int trigId)
map contains (key,value) = (patchId,ADC) of all TP above DSM threshold. map is empty if threshold = 0...
int barrelJetPatchThreshold(int trigId, int patchId=1)
Jet Patch ADC &gt; threshold required to fire trigger.
int totalEnergy()
ADC calculated for ETOT trigger.
void loadTables(StMaker *anyMaker)
load tables.
int barrelTowerThreshold(int trigId, int softId=1)
Tower ADC &gt; threshold required to fire trigger.
int barrelTriggerPatchThreshold(int trigId, int patchId=1)
Trigger Patch ADC &gt; threshold required to fire trigger.
map< int, int > barrelJetPatchesAboveThreshold(int trigId)
map contains (key,value) = (patchId,ADC) of all JP above DSM threshold. map is empty if threshold = 0...
Definition: Stypes.h:40
map< int, int > barrelTowersAboveThreshold(int trigId)
map contains (key,value) = (softId,ADC) of all towers above DSM threshold. map is empty if threshold ...
virtual Int_t Finish()
int GetTriggerPatchFromTowerId(int softId, int &patchId) const
Get trigger patch that contains software Id.
virtual Int_t Finish()
Definition: StMaker.cxx:776
int isTrigger(int trigId)
1==Yes,0==No,-1==Don&#39;t Know. Same convention holds for other methods where appropriate.
Definition: Stypes.h:41