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"
33 #include "StEmcTriggerMaker.h"
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;
62 for (
int i=0;i<50;i++) isTrig[i]=-1;
76 for (
int matrix=0;matrix<6;matrix++)
78 HT2_ID_2006[matrix]=-1;
79 JP0_ID_2006[matrix]=-1;
80 JP1_ID_2006[matrix]=-1;
83 for (
int i=0;i<50;i++) TowJetId[i] = -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;
103 for (
int i=0;i<50;i++) DsmAdc[i] = -1;
105 for (
int i=0;i<kNJet;i++){
109 for (
int i=0; i<kNTowers; i++){
114 for (
int i=0;i<(kNJet/2);i++){ BL1_2006_arrayADC[i]=-1;}
116 for (
int i=0; i<12; i++) {
119 if (i<6) numHTTP[i]=-1;
125 StEmcTriggerMaker::~StEmcTriggerMaker()
129 Int_t StEmcTriggerMaker::Init()
133 LOG_INFO <<
"StEmcTriggerMaker::Init()"<<endm;
135 return StMaker::Init();
141 LOG_DEBUG<<
"StEmcTriggerMaker::Make()"<<endm;
144 setTableMaker(tables);
147 if(!event)
return kStOk;
149 mBemcTrigger->setEvent(event);
151 if(mBemcTrigger->makeTrigger() !=
kStOK)
153 LOG_WARN <<
"StEmcTriggerMaker::Make() -- trigger information is not filled! Something is wrong!" << endm;
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();
172 mIs2003HT1=isTrig[0];
173 HT1_ID_2003=TowJetId[0];
174 HT1_DSM_2003=DsmAdc[0];
177 mIs2003HT2=isTrig[42];
178 HT2_ID_2003=TowJetId[42];
179 HT2_DSM_2003=DsmAdc[42];
182 mIs2004HT1=isTrig[1];
183 HT1_ID_2004=TowJetId[1];
184 HT1_DSM_2004=DsmAdc[1];
187 mIs2004HT2=isTrig[2];
188 HT2_ID_2004=TowJetId[2];
189 HT2_DSM_2004=DsmAdc[2];
192 mIs2004JP1=isTrig[3];
193 JP1_ID_2004=TowJetId[3];
194 JP1_DSM_2004=DsmAdc[3];
197 mIs2004JP2=isTrig[4];
198 JP2_ID_2004=TowJetId[4];
199 JP2_DSM_2004=DsmAdc[4];
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];
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];
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];
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];
238 mIs2005ADJ=isTrig[9];
239 ADJ_ID_2005=TowJetId[9];
240 ADJ_DSM_2005=DsmAdc[9];
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];
251 for (
int matrix=0;matrix<6;matrix++)
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);
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);
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);
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);
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);
299 BETOT_DSM_2006=DsmAdc[41];
300 for (
int i=0;i<kNJet/2;i++) BL1_2006_arrayADC[i]=BL12006arrayADC[i];
304 for (
int j=0;j<300;j++)
307 trigPatch[j]=mBemcTrigger->trgPatch[j];
319 void StEmcTriggerMaker::get2005HT1_TOWS(
int index,
int *
id){
321 if (index<kNTowers) *
id=HT1_2005_array[index];
324 void StEmcTriggerMaker::get2005HT2_TOWS(
int index,
int *
id){
326 if (index<kNTowers) *
id=HT2_2005_array[index];
329 void StEmcTriggerMaker::get2005JP1_PATCHES(
int index,
int *
id){
331 if (index<kNJet) *
id=JP1_2005_array[index];
334 void StEmcTriggerMaker::get2005JP2_PATCHES(
int index,
int *
id){
336 if (index<kNJet) *
id=JP2_2005_array[index];
339 void StEmcTriggerMaker::get2005JPSI_ADC(
int index,
int *
id){
341 if (index<kNJet) *
id=JPSI_2005_ADC[index];
344 void StEmcTriggerMaker::get2005JPSI_ID(
int index,
int *
id){
346 if (index<kNJet) *
id=JPSI_2005_ID[index];
350 void StEmcTriggerMaker::get2006BL1_ADC(
int index,
int *
id){
352 if (index<kNJet/2) *
id=BL1_2006_arrayADC[index];
363 case(127212):
return mIs2006HT2[0];
367 case(127501):
return mIs2006JP0[1];
369 case(127221):
return mIs2006JP1[1];
371 case(127821):
return mIs2006HTTP[1];
373 case(127611):
return -1;
375 case(127622):
return -1;
377 case(127213):
return mIs2006HT2[1];
379 case(117705):
return mIs2006JPSI[1];
381 case(117602):
return mIs2006HTTP[1];
385 case(137221):
return mIs2006JP1[2];
389 case(137501):
return mIs2006JP0[3];
391 case(137222):
return mIs2006JP1[3];
393 case(137821):
return mIs2006HTTP[3];
395 case(137622):
return -1;
397 case(137213):
return mIs2006HT2[3];
399 case(137602):
return mIs2006HTTP[3];
404 case(137822):
return mIs2006HTTP[4];
408 case(137611):
return -1;
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();
435 case(127212):
return (softId > 2400) ? 24:22;
436 case(127213):
case(137213):
return 24;
439 case(127501):
case(137501):
440 case(127221):
case(137221):
case(137222):
return 0;
443 case(127821):
return 12;
444 case(137821):
return 18;
445 case(137822):
return 16;
448 case(117705):
return (softId > 2400) ? 11:5;
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;
473 case(127212):
case(127213):
case(137213):
return 0;
476 case(127501):
case(137501):
477 case(127221):
case(137221):
case(137222):
return 0;
480 case(127821):
return 17;
481 case(137821):
return 20;
482 case(137822):
return 19;
485 case(117705):
return 0;
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;
503 case(127212):
case(127213):
case(137213):
return 0;
506 case(127501):
return 42;
507 case(127221):
case(137221):
return 58;
508 case(137501):
return 49;
509 case(137222):
return 60;
512 case(127821):
case(137821):
case(137822):
return 0;
515 case(117705):
return 0;
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;
535 int counter,softId,adc;
543 counter = numHT2_2006[0];
544 for(
int i=0; i<counter; i++) {
546 softId=HT2_2006_array[0][i];
547 if (softId == HT2_ID_2006[0]) adc = HT2_DSM_2006[0];
548 towers[softId] = adc;
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;
570 counter = numHT2_2006[1];
571 for(
int i=0; i<counter; i++) {
572 softId=HT2_2006_array[1][i];
574 if (softId == HT2_ID_2006[1]) adc = HT2_DSM_2006[1];
575 towers[softId] = adc;
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;
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;
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;
615 counter = numHT2_2006[3];
616 for(
int i=0; i<counter; i++) {
617 softId=HT2_2006_array[3][i];
619 if (softId == HT2_ID_2006[3]) adc = HT2_DSM_2006[3];
620 towers[softId] = adc;
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;
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;
652 counter = get2005HT1_NTOWS();
653 for(
int i=0; i<counter; i++) {
654 get2005HT1_TOWS(i,&softId);
656 if(softId == get2005HT1_ID()) adc = get2005HT1_ADC();
657 towers[softId] = adc;
663 counter = get2005HT2_NTOWS();
664 for(
int i=0; i<counter; i++) {
665 get2005HT2_TOWS(i,&softId);
667 if(softId == get2005HT2_ID()) adc = get2005HT2_ADC();
668 towers[softId] = adc;
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;
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;
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;
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;
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;
731 map<int,int> patches;
732 int counter,softId,adc;
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;
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;
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;
772 map<int,int> patches;
773 int counter,softId,adc;
780 counter = numJP0_2006[1];
781 for(
int i=0; i<counter; i++) {
783 softId=JP0_2006_array[1][i];
784 if(softId == JP0_ID_2006[1]) adc = JP0_DSM_2006[1];
785 patches[softId] = adc;
791 counter = numJP1_2006[1];
792 for(
int i=0; i<counter; i++) {
794 softId=JP1_2006_array[1][i];
795 if(softId == JP1_ID_2006[1]) adc = JP1_DSM_2006[1];
796 patches[softId] = adc;
802 counter = numJP1_2006[2];
803 for(
int i=0; i<counter; i++) {
805 softId=JP1_2006_array[2][i];
806 if(softId == JP1_ID_2006[2]) adc = JP1_DSM_2006[2];
807 patches[softId] = adc;
813 counter = numJP0_2006[3];
814 for(
int i=0; i<counter; i++) {
816 softId=JP0_2006_array[3][i];
817 if(softId == JP0_ID_2006[3]) adc = JP0_DSM_2006[3];
818 patches[softId] = adc;
824 counter = numJP1_2006[3];
825 for(
int i=0; i<counter; i++) {
827 softId=JP1_2006_array[3][i];
828 if(softId == JP1_ID_2006[3]) adc = JP1_DSM_2006[3];
829 patches[softId] = adc;
835 counter = get2005JP1_NPATCHES();
836 for(
int i=0; i<counter; i++) {
837 get2005JP1_PATCHES(i,&softId);
839 if(softId == get2005JP1_ID()) adc = get2005JP1_ADC();
840 patches[softId] = adc;
845 counter = get2005JP2_NPATCHES();
846 for(
int i=0; i<counter; i++) {
847 get2005JP2_PATCHES(i,&softId);
849 if(softId == get2005JP2_ID()) adc = get2005JP2_ADC();
850 patches[softId] = adc;
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;
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;
880 int StEmcTriggerMaker::barrelTriggerPatchForTower(
int softId) {
882 if(decoder == NULL) {
883 LOG_WARN <<
"Pointer to decoder is NULL! Can't get trigger patch for " << softId << endm;
891 LOG_WARN <<
"Decoder encountered a problem translating tower id = " << softId <<
" into a trigger patch" << endm;
899 case(127622):
case(127652):
case(137622):
case(137652):
return 109;
905 return BETOT_DSM_2006;
909 int StEmcTriggerMaker::endcapTowerThreshold(
int trigId) {
913 int StEmcTriggerMaker::endcapTriggerPatchThreshold(
int trigId) {
917 int StEmcTriggerMaker::endcapJetPatchThreshold(
int trigId) {
921 map<int,int> StEmcTriggerMaker::endcapTowersAboveThreshold(
int trigId) {
926 map<int,int> StEmcTriggerMaker::endcapTriggerPatchesAboveThreshold(
int trigId) {
927 map<int,int> trigPatches;
931 map<int,int> StEmcTriggerMaker::endcapJetPatchesAboveThreshold(
int trigId) {
932 map<int,int> jetPatches;
int totalEnergyThreshold(int trigId)
DSM ADC threshold for ETOT trigger. ADC > 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 > 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 > threshold required to fire trigger.
int barrelTriggerPatchThreshold(int trigId, int patchId=1)
Trigger Patch ADC > 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...
map< int, int > barrelTowersAboveThreshold(int trigId)
map contains (key,value) = (softId,ADC) of all towers above DSM threshold. map is empty if threshold ...
int GetTriggerPatchFromTowerId(int softId, int &patchId) const
Get trigger patch that contains software Id.
int isTrigger(int trigId)
1==Yes,0==No,-1==Don't Know. Same convention holds for other methods where appropriate.