6 #include "StBemcTrigger.h"
7 #include "StEvent/StEvent.h"
8 #include "StEvent/StEventTypes.h"
9 #include "StEmcUtil/geometry/StEmcGeom.h"
10 #include "StarRoot/TUnixTime.h"
11 #include "StDaqLib/EMC/StEmcDecoder.h"
13 #include "St_db_Maker/St_db_Maker.h"
14 #include "tables/St_emcPed_Table.h"
15 #include "StEmcUtil/database/StBemcTables.h"
16 #include "StEmcRawMaker/defines.h"
21 StBemcTrigger::StBemcTrigger():TObject()
23 mGeo=StEmcGeom::getEmcGeom(
"bemc");
29 StBemcTrigger::~StBemcTrigger()
33 void StBemcTrigger::resetConf(){
40 for(
int i = 0;i<kNTowers;i++) mTrigger.TowerStatus[i] = 1;
42 for(
int i = 0;i<kNPatches;i++) mTrigger.PatchStatus[i] = 1;
56 for (
int matrix=0;matrix<6;matrix++){
57 mIs2006JP0[matrix]=-1;
58 mIs2006HT2[matrix]=-1;
59 mIs2006JP1[matrix]=-1;
60 mIs2006JPSI[matrix]=-1;
61 mIs2006BHTTP[matrix]=-1;
63 for (
int i=0;i<50;i++)
78 for (
int matrix=0;matrix<6;matrix++){
79 HT2_ID_2006[matrix]=-1;
80 JP0_ID_2006[matrix]=-1;
81 JP1_ID_2006[matrix]=-1;
83 for (
int i=0;i<50;i++)
98 for (
int matrix=0;matrix<6;matrix++){
99 HT2_DSM_2006[matrix]=-1;
100 JP0_DSM_2006[matrix]=-1;
101 JP1_DSM_2006[matrix]=-1;
104 for (
int i=0;i<50;i++)
109 for(
int i=0;i<kNTowers;i++){
112 for (
int matrix=0;matrix<6;matrix++) mHT22006array[matrix][i]=-1;
114 for (
int i=0;i<kNJet;i++){
117 for (
int matrix=0;matrix<6;matrix++) mJP02006array[matrix][i]=-1;
118 for (
int matrix=0;matrix<6;matrix++) mJP12006array[matrix][i]=-1;
121 for (
int i=0;i<kNJet/2;i++) BL1_ADC_2006[i]=-1;
123 for (
int i=0;i<12;i++){
126 if (i<6) mnumHTTP[i]=0;
132 void StBemcTrigger::zero()
134 for(
int i=0;i<kNPatches;i++)
138 mTrigger.Patch[i]= 0;
141 for(
int i=0;i<kNJet;i++)
151 void StBemcTrigger::PatchMap()
158 for (
int i=0;i<20;i++)
169 JP_TP[6][i]=i+290-10;
177 for (
int i=20;i<25;i++)
182 JP_TP[0][i]=20+keven;
184 JP_TP[2][i]=70+keven;
185 JP_TP[3][i]=120+kodd;
186 JP_TP[4][i]=120+keven;
188 JP_TP[6][i]=160+kodd;
189 JP_TP[7][i]=160+keven;
190 JP_TP[8][i]=210+kodd;
191 JP_TP[9][i]=210+keven;
192 JP_TP[10][i]=260+kodd;
193 JP_TP[11][i]=260+keven;
196 for (
int i=0;i<12;i++)
200 line +=
" is sum of TP = ";
201 for (
int j=0;j<25;j++)
210 LOG_INFO << line << endm;
255 int StBemcTrigger::makeTrigger()
263 mIsTrig[0] =mIs2003HT1;
264 mTowJetId[0]=HT1_ID_2003;
265 mDsmAdc[0] =HT1_DSM_2003;
268 mIsTrig[42] =mIs2003HT2;
269 mTowJetId[42]=HT2_ID_2003;
270 mDsmAdc[42] =HT2_DSM_2003;
273 mIsTrig[1] =mIs2004HT1;
274 mTowJetId[1]=HT1_ID_2004;
275 mDsmAdc[1] =HT1_DSM_2004;
278 mIsTrig[2] =mIs2004HT2;
279 mTowJetId[2]=HT2_ID_2004;
280 mDsmAdc[2] =HT2_DSM_2004;
283 mIsTrig[3] =mIs2004JP1;
284 mTowJetId[3]=JP1_ID_2004;
285 mDsmAdc[3] =JP1_DSM_2004;
288 mIsTrig[4] =mIs2004JP2;
289 mTowJetId[4]=JP2_ID_2004;
290 mDsmAdc[4] =JP2_DSM_2004;
293 mIsTrig[5] =mIs2005HT1;
294 mTowJetId[5]=HT1_ID_2005;
295 mDsmAdc[5] =HT1_DSM_2005;
296 mnumHT[3] =numHT1_2005;
297 for (
int i=0;i<numHT1_2005;i++){
298 mHT12005array[i]=HT1_2005_array[i];
302 mIsTrig[6] =mIs2005HT2;
303 mTowJetId[6]=HT2_ID_2005;
304 mDsmAdc[6] =HT2_DSM_2005;
305 mnumHT[4] =numHT2_2005;
306 for (
int i=0;i<numHT2_2005;i++){
307 mHT22005array[i]=HT2_2005_array[i];
311 mIsTrig[7] =mIs2005JP1;
312 mTowJetId[7]=JP1_ID_2005;
313 mDsmAdc[7] =JP1_DSM_2005;
314 mnumJP[2] =numJP1_2005;
315 for (
int i=0;i<numJP1_2005;i++){
316 mJP12005array[i]=JP1_2005_array[i];
320 mIsTrig[8] =mIs2005JP2;
321 mTowJetId[8]=JP2_ID_2005;
322 mDsmAdc[8] =JP2_DSM_2005;
323 mnumJP[3] =numJP2_2005;
324 for (
int i=0;i<numJP2_2005;i++){
325 mJP22005array[i]=JP2_2005_array[i];
329 mIsTrig[9] =mIs2005ADJ;
330 mTowJetId[9]=ADJ_ID_2005;
331 mDsmAdc[9] =ADJ_DSM_2005;
335 mIsTrig[10] =mIs2005JPSI;
338 for (
int i=0;i<kNJet;i++){
339 mJPSI2005adc[i]=JPSI_2005_ADC[i];
340 mJPSI2005id[i]=JPSI_2005_ID[i];
345 for (
int matrix=0;matrix<6;matrix++){
348 mIsTrig[11+(matrix*5)] =mIs2006HT2[matrix];
349 mTowJetId[11+(matrix*5)]=HT2_ID_2006[matrix];
350 mDsmAdc[11+(matrix*5)] =HT2_DSM_2006[matrix];
351 mnumHT[5+matrix] =numHT2_2006[matrix];
352 for (
int i=0;i<numHT2_2006[matrix];i++){
353 mHT22006array[matrix][i]=HT2_2006_array[matrix][i];
357 mIsTrig[12+(matrix*5)] =mIs2006JP0[matrix];
358 mTowJetId[12+(matrix*5)]=JP0_ID_2006[matrix];
359 mDsmAdc[12+(matrix*5)] =JP0_DSM_2006[matrix];
360 mnumJP[5+(matrix*2)] =numJP0_2006[matrix];
361 for (
int i=0;i<numJP0_2006[matrix];i++){
362 mJP02006array[matrix][i]=JP0_2006_array[matrix][i];
366 mIsTrig[13+(matrix*5)] =mIs2006JP1[matrix];
367 mTowJetId[13+(matrix*5)]=JP1_ID_2006[matrix];
368 mDsmAdc[13+(matrix*5)] =JP1_DSM_2006[matrix];
369 mnumJP[6+(matrix*2)] =numJP1_2006[matrix];
370 for (
int i=0;i<numJP1_2006[matrix];i++){
371 mJP12006array[matrix][i]=JP1_2006_array[matrix][i];
375 mIsTrig[14+(matrix*5)] =mIs2006JPSI[matrix];
376 mTowJetId[14+(matrix*5)]=-1;
377 mDsmAdc[14+(matrix*5)]=-1;
378 for (
int i=0;i<kNJet;i++){
379 mJPSI2006adc[matrix][i]=JPSI_2006_ADC[matrix][i];
380 mJPSI2006id[matrix][i]=JPSI_2006_ID[matrix][i];
384 mIsTrig[15+(matrix*5)]=mIs2006BHTTP[matrix];
385 mTowJetId[15+(matrix*5)]=-1;
386 mDsmAdc[15+(matrix*5)]=-1;
388 mnumHTTP[matrix]=numHTTP_2006[matrix];
389 for (
int i=0; i<numHTTP_2006[matrix];i++){
390 mHTTP2006arrayHT[matrix][i]=BHTTP_2006_HT[matrix][i];
391 mHTTP2006arrayHTADC[matrix][i]=BHTTP_2006_HT_ADC[matrix][i];
392 mHTTP2006arrayTP[matrix][i]=BHTTP_2006_TP[matrix][i];
393 mHTTP2006arrayTPADC[matrix][i]=BHTTP_2006_TP_ADC[matrix][i];
400 mDsmAdc[41]=BETOT_DSM_2006;
401 for (
int i=0; i<(kNJet/2); i++){mBL12006arrayADC[i]=BL1_ADC_2006[i];}
409 int StBemcTrigger::get2003Trigger()
413 const int HT1_TH_2003 = 8;
414 const int HT2_TH_2003 = 13;
424 for(
int i=0;i<kNTowers;i++)
434 for(Int_t m=1;m<=60;m++)
439 StSPtrVecEmcRawHit& rawHit=module->hits();
440 for(UInt_t k=0;k<rawHit.size();k++)
444 Int_t mod=rawHit[k]->module();
445 Int_t e=rawHit[k]->eta();
446 Int_t s=abs(rawHit[k]->sub());
447 mGeo->getId(mod,e,s,did);
448 if(mTrigger.TowerStatus[did-1]==1)
450 adc12[did-1]=rawHit[k]->adc();
451 adc10[did-1] = adc12[did-1]>>2;
467 unixTime.GetGTime(dat,tim);
468 mDecoder->SetDateTime(dat,tim);
474 for(
int i = 0;i<kNPatches;i++)
475 if(mTrigger.PatchStatus[i]==1)
485 for(
int j=seq;j<seq+16;j++)
498 int SHIFT = mTrigger.HTBits;
504 mTrigger.HT[i] = HTL+(B5<<5);
505 { LOG_DEBUG <<
"Patch number "<<i<<
" Tower id = "<<
506 HTID<<
" adc12 = "<<adc12[HTID-1]<<
" adc10 = "<<
507 adc10[HTID-1]<<
" HT = "<<mTrigger.HT[i]<<endm; }
508 if (mTrigger.HT[i]>HTmax)
510 HTmax=mTrigger.HT[i];
515 if (HTmax>HT1_TH_2003)
528 if (HTmax>HT2_TH_2003)
547 int StBemcTrigger::get2004Trigger()
551 const int HT1_TH_2004 = 10;
552 const int HT2_TH_2004 = 20;
553 const int JP1_TH_2004 = 40;
554 const int JP2_TH_2004 = 60;
555 const int pedestalTargetValue2004 = 8;
573 for(
int i=0;i<kNTowers;i++)
581 int ped12bit, val12bit,operation;
587 for(Int_t m=1;m<=60;m++)
592 StSPtrVecEmcRawHit& rawHit=module->hits();
593 for(UInt_t k=0;k<rawHit.size();k++)
597 Int_t mod=rawHit[k]->module();
598 Int_t e=rawHit[k]->eta();
599 Int_t s=abs(rawHit[k]->sub());
600 mGeo->getId(mod,e,s,did);
601 if(mTrigger.TowerStatus[did-1]==1)
603 adc12[did-1]=rawHit[k]->adc();
604 adc10[did-1] = adc12[did-1]>>2;
611 ped12bit=(int) NEWped;
615 ped10[did-1] = ped12bit >> 2;
616 val12bit = ped12bit - pedestalTargetValue2004;
620 val12bit = -val12bit;
623 int val10bit = val12bit/4;
628 if (val12bit - val10bit*4 > 2)
633 val10bit = val10bit - 4*((val10bit-11)/4);
638 adc10[did-1] -= val10bit;
639 ped10[did-1] -= val10bit;
643 adc10[did-1] += val10bit;
644 ped10[did-1] += val10bit;
647 adc08[did-1] = adc10[did-1]>>2;
655 LOG_WARN <<
"StBemcTrigger::make2004Trigger() -- pointer to StEmcDetector is zero!" << endm;
662 unixTime.GetGTime(dat,tim);
663 mDecoder->SetDateTime(dat,tim);
668 for(
int i = 0;i<kNPatches;i++)
669 if(mTrigger.PatchStatus[i]==1)
679 for(
int j=seq;j<seq+16;j++)
690 patchPed+= (ped10[
id-1]>>2);
706 mTrigger.Patch[i] = PA - patchPed;
707 if(mTrigger.Patch[i] > 62)
708 mTrigger.Patch[i] = 62;
713 int SHIFT = mTrigger.HTBits;
720 mTrigger.HT[i] = HTL+(B5<<5);
721 { LOG_DEBUG <<
"Patch number "<<i<<
" Tower id = "<<HTID<<
" adc12 = "<<adc12[HTID-1]<<
" adc10 = "
722 <<adc10[HTID-1]<<
" adc08 = "<<adc08[HTID-1]<<
" HT10 = "<<HT<<
" PA12 = "<<PA
723 <<
" HT = "<<mTrigger.HT[i]<<
" PA = "<<mTrigger.Patch[i]<<endm; }
724 if (mTrigger.HT[i]>HTmax)
726 HTmax=mTrigger.HT[i];
731 if (HTmax>HT1_TH_2004)
743 if (HTmax>HT2_TH_2004)
756 for (
int i=0;i<300;i++)
759 trgPatch[i]=mTrigger.Patch[i];
766 for(
int i = 0;i<kNJet; i++)
772 for (
int j=p0;j<p1;j++)
775 mTrigger.Jet[i]+=mTrigger.Patch[k];
778 mTrigger.Et+=mTrigger.Jet[i];
779 if (mTrigger.Jet[i]>JPmax)
781 JPmax=mTrigger.Jet[i];
786 if (JPmax>JP1_TH_2004)
799 if (JPmax>JP2_TH_2004)
818 int StBemcTrigger::get2005Trigger()
826 const int JPSI_TH_2005 = 5;
827 const int HT1_TH_2005 = 13;
828 const int HT2_TH_2005 = 17;
829 const int JP1_TH_2005 = 66;
830 const int JP2_TH_2005 = 84;
831 const int pedestalTargetValue2005 = 24;
836 LOG_WARN <<
"StBemcTrigger::make2005Trigger() -- no StEvent!" << endm;
842 LOG_WARN <<
"StBemcTrigger::make2005Trigger() -- no StEmcCollection!" << endm;
850 for(
int i=0;i<kNTowers;i++){
855 HT1_2005_array[i]=-1;
856 HT2_2005_array[i]=-1;
867 for (
int i=0;i<kNJet;i++){
868 JP1_2005_array[i]=-1;
869 JP2_2005_array[i]=-1;
884 int ped12bit, val12bit;
892 for(Int_t m=1;m<=60;m++)
897 StSPtrVecEmcRawHit& rawHit=module->hits();
898 for(UInt_t k=0;k<rawHit.size();k++)
902 Int_t mod=rawHit[k]->module();
903 Int_t e=rawHit[k]->eta();
904 Int_t s=abs(rawHit[k]->sub());
905 mGeo->getId(mod,e,s,did);
906 if ((mTrigger.TowerStatus[did-1]==1)&&(mTables->
status(BTOW,did,
"calib")==1))
908 adc12[did-1]=rawHit[k]->adc();
909 adc10[did-1] = adc12[did-1]>>2;
918 ped12bit=(int) NEWped;
921 ped10[did-1] = ped12bit >> 2;
922 val12bit = ped12bit - pedestalTargetValue2005;
927 val12bit = -val12bit;
930 int val10bit = val12bit/4;
931 if(val12bit - val10bit*4 > 2)
936 val10bit = val10bit - 4*((val10bit-11)/4);
941 adc10[did-1] -= val10bit;
942 ped10[did-1] -= val10bit;
946 adc10[did-1] += val10bit;
947 ped10[did-1] += val10bit;
950 adc08[did-1] = adc10[did-1]>>2;
958 LOG_WARN <<
"StBemcTrigger::make2005Trigger() -- pointer to StEmcDetector is zero!" << endm;
965 unixTime.GetGTime(dat,tim);
966 mDecoder->SetDateTime(dat,tim);
972 for(
int i = 0;i<kNPatches;i++)
973 if(mTrigger.PatchStatus[i]==1)
985 for(
int j=seq;j<seq+16;j++)
995 patchPed+= (ped10[
id-1]>>2);
1011 mTrigger.Patch[i] = PA - (patchPed-1);
1012 if(mTrigger.Patch[i] > 62) mTrigger.Patch[i] = 62;
1014 if(PA<patchPed) mTrigger.Patch[i]=1;
1017 int SHIFT = mTrigger.HTBits;
1019 int HTL = HT & 0x1F;
1023 mTrigger.HT[i] = HTL+(B5<<5);
1024 mTrigger.HTID[i] = HTID;
1025 { LOG_DEBUG <<
"Patch number "<<i<<
" Tower id = "<<mTrigger.HTID[i]<<
" adc12 = "<<adc12[HTID-1]
1026 <<
" adc10 = "<<adc10[HTID-1]<<
" adc08 = "<<adc08[HTID-1]<<
" HT10 = "<<HT<<
" PA12 = "<<PA
1027 <<
" HT = "<<mTrigger.HT[i]<<
" PA = "<<mTrigger.Patch[i]<<endm; }
1029 if (mTrigger.HT[i]>HTmax){
1030 HTmax=mTrigger.HT[i];
1034 if (mTrigger.HT[i]>HT1_TH_2005){
1035 HT1_2005_array[numHT1_2005]=HTID;
1037 LOG_DEBUG<<HTID<<
" Passed HT1 threshold="<<numHT1_2005<<
" "<<HT1_2005_array[numHT1_2005-1]<<endm;
1040 if (mTrigger.HT[i]>HT2_TH_2005){
1041 HT2_2005_array[numHT2_2005]=HTID;
1043 LOG_DEBUG<<HTID<<
" Passed HT2 threshold="<<numHT2_2005<<
" "<<HT2_2005_array[numHT2_2005-1]<<endm;
1048 if (HTmax>HT1_TH_2005)
1051 HT1_ID_2005=HTmaxID;
1057 HT1_ID_2005=HTmaxID;
1060 if (HTmax>HT2_TH_2005)
1063 HT2_ID_2005=HTmaxID;
1069 HT2_ID_2005=HTmaxID;
1077 for(
int i = 0;i<kNJet; i++)
1083 for (
int j=p0;j<p1;j++)
1086 mTrigger.Jet[i]+=mTrigger.Patch[k];
1089 mTrigger.Et+=mTrigger.Jet[i];
1090 if (mTrigger.Jet[i]>JPmax)
1092 JPmax=mTrigger.Jet[i];
1097 if (mTrigger.Jet[i]>JP1_TH_2005)
1099 JP1_2005_array[numJP1_2005]=i;
1103 if (mTrigger.Jet[i]>JP2_TH_2005)
1105 JP2_2005_array[numJP2_2005]=i;
1111 if (JPmax>JP1_TH_2005)
1124 if (JPmax>JP2_TH_2005)
1139 int JpsiPatch[kNJet];
1140 for(
int i = 0;i<kNJet; i++)
1148 for (
int j=p0;j<p1;j++)
1151 if (mTrigger.HT[k]>JPSI_2005_ADC[i]) {
1152 JPSI_2005_ADC[i]=mTrigger.HT[k];
1153 JPSI_2005_ID[i]=mTrigger.HTID[k];
1155 LOG_DEBUG<<
"Jet id="<<i<<
" Patch id="<<j<<
" PatchHT="<<mTrigger.HT[k]<<
" PatchHTID="<<mTrigger.HTID[k]<<
" JPSI_2005_ADC="<<JPSI_2005_ADC[i]<<endm;
1157 if (JPSI_2005_ADC[i]>JPSI_TH_2005) {
1160 LOG_DEBUG<<
"Final JetPatchHT for JP"<<i<<
" is TowID="<<JPSI_2005_ID[i]<<
" with ADC= "<<JPSI_2005_ADC[i]<<
" and flag="<<JpsiPatch[i]<<endm;
1163 if ((JpsiPatch[0]&&(JpsiPatch[2]||JpsiPatch[3]||JpsiPatch[4])) ||
1164 (JpsiPatch[1]&&(JpsiPatch[3]||JpsiPatch[4]||JpsiPatch[5])) ||
1165 (JpsiPatch[2]&&(JpsiPatch[4]||JpsiPatch[5])) ||
1166 (JpsiPatch[3]&&JpsiPatch[5]) )
1182 int StBemcTrigger::get2006Trigger()
1189 const int HT0WEST_TH_2006[6]= { 5, 5, 5, 5, 5, 5};
1190 const int HT0EAST_TH_2006[6]= { 11, 11, 5, 5, 5, 5};
1191 const int HT1WEST_TH_2006[6]= { 12, 12, 16, 18, 16, 16};
1192 const int HT1EAST_TH_2006[6]= { 12, 12, 16, 18, 16, 16};
1193 const int HT2WEST_TH_2006[6]= { 22, 24, 24, 24, 24, 24};
1194 const int HT2EAST_TH_2006[6]= { 24, 24, 24, 24, 24, 24};
1195 const int HTTP0_TH_2006[6] = { 1, 1, 1, 1, 1, 1};
1196 const int HTTP1_TH_2006[6] = { 17, 17, 20, 20, 19, 19};
1197 const int HTTP2_TH_2006[6] = { 31, 31, 31, 31, 31, 31};
1198 const int JP0_TH_2006[6] = { 42, 42, 48, 49, 49, 49};
1199 const int JP1_TH_2006[6] = { 58, 58, 58, 60, 60, 60};
1203 const int pedestalTargetValue2006 = 24;
1209 LOG_WARN <<
"StBemcTrigger::make2006Trigger() -- no StEvent!" << endm;
1216 LOG_WARN <<
"StBemcTrigger::make2006Trigger() -- no StEmcCollection!" << endm;
1221 int adc12[kNTowers];
1222 int adc10[kNTowers];
1223 int adc08[kNTowers];
1224 int ped10[kNTowers];
1225 for(
int i = 0; i < kNTowers; ++i)
1232 for (
int matrix=0; matrix<6; matrix++){
1233 HT2_2006_array[matrix][i] = -1;
1234 mHT22006array[matrix][i] = -1;
1238 for(
int i = 0; i < kNJet; ++i)
1240 for (
int matrix=0;matrix<6;matrix++)
1242 JP0_2006_array[matrix][i] = -1;
1243 JP1_2006_array[matrix][i] = -1;
1244 mJP02006array[matrix][i] = -1;
1245 mJP12006array[matrix][i] = -1;
1246 mJPSI2006adc[matrix][i] = -1;
1247 mJPSI2006id[matrix][i] = -1;
1252 for(
int i = 0; i < kNPatches; ++i)
1254 for (
int matrix=0;matrix<6;matrix++)
1256 BHTTP_2006_HT[matrix][i]=-1;
1257 BHTTP_2006_HT_ADC[matrix][i]=-1;
1258 BHTTP_2006_TP[matrix][i]=-1;
1259 BHTTP_2006_TP_ADC[matrix][i]=-1;
1263 for (
int matrix=0;matrix<6;matrix++){
1264 numHT2_2006[matrix]=0;
1265 numJP0_2006[matrix]=0;
1266 numJP1_2006[matrix]=0;
1267 numHTTP_2006[matrix]=0;
1270 int ped12bit, val12bit, operation;
1279 for(Int_t m = 1; m <= 120; ++m)
1286 StSPtrVecEmcRawHit& rawHit=module->hits();
1287 for(UInt_t k = 0; k < rawHit.size(); ++k)
1294 Int_t mod=rawHit[k]->module();
1295 Int_t e=rawHit[k]->eta();
1296 Int_t s=abs(rawHit[k]->sub());
1297 mGeo->getId(mod,e,s,did);
1299 if ((mTrigger.TowerStatus[did-1]==1)&&(mTables->
status(BTOW,did,
"calib")==1))
1302 adc12[did-1]=rawHit[k]->adc();
1303 adc10[did-1] = adc12[did-1]>>2;
1308 ped12bit=(int) NEWped;
1311 ped10[did-1] = ped12bit >> 2;
1312 val12bit = ped12bit - pedestalTargetValue2006;
1316 val12bit = -val12bit;
1320 int val10bit = val12bit/4;
1321 if(val12bit - val10bit*4 > 2) val10bit+=1;
1326 val10bit = val10bit - 4*((val10bit-11)/4);
1331 adc10[did-1] -= val10bit;
1332 ped10[did-1] -= val10bit;
1336 adc10[did-1] += val10bit;
1337 ped10[did-1] += val10bit;
1340 adc08[did-1] = adc10[did-1]>>2;
1355 LOG_WARN <<
"StBemcTrigger::make2006Trigger() -- pointer to StEmcDetector is zero!" << endm;
1362 unixTime.GetGTime(dat,tim);
1363 mDecoder->SetDateTime(dat,tim);
1370 for(
int i = 0; i < kNPatches; ++i)
1373 if(mTrigger.PatchStatus[i]==1)
1388 for(
int j = seq; j < seq + 16; ++j)
1401 patchPed += ped10[
id-1] >> 2;
1416 mTrigger.Patch[i] = PA - (patchPed - 1);
1417 if(mTrigger.Patch[i] > 62) mTrigger.Patch[i] = 62;
1421 mTrigger.Patch[i] = 1;
1428 HT = HT >>(mTrigger.HTBits - 1);
1429 int HTL = HT & 0x1F;
1433 mTrigger.HT[i] = HTL+(B5<<5);
1434 mTrigger.HTID[i] = HTID;
1437 LOG_DEBUG <<
"Patch number "<<i<<
" Tower id = "<<mTrigger.HTID[i]<<
" adc12 = "<<adc12[HTID-1]
1438 <<
" adc10 = "<<adc10[HTID-1]<<
" adc08 = "<<adc08[HTID-1]<<
" HT10 = "<<HT<<
" PA12 = "<<PA
1439 <<
" HT = "<<mTrigger.HT[i]<<
" PA = "<<mTrigger.Patch[i]<<endm;
1442 if(mTrigger.HT[i]>HTmax)
1444 HTmax=mTrigger.HT[i];
1448 for (
int matrix=0; matrix<6; matrix++){
1451 if(mTrigger.HT[i]>HT2EAST_TH_2006[matrix])
1453 HT2_2006_array[matrix][numHT2_2006[matrix]]=HTID;
1454 numHT2_2006[matrix]++;
1459 if(mTrigger.HT[i]>HT2WEST_TH_2006[matrix])
1461 HT2_2006_array[matrix][numHT2_2006[matrix]]=HTID;
1462 numHT2_2006[matrix]++;
1470 for (
int matrix=0; matrix<6; matrix++){
1473 if (HTmax > HT2EAST_TH_2006[matrix])
1475 mIs2006HT2[matrix]=1;
1476 HT2_ID_2006[matrix]=HTmaxID;
1477 HT2_DSM_2006[matrix]=HTmax;
1481 mIs2006HT2[matrix]=0;
1482 HT2_ID_2006[matrix]=HTmaxID;
1483 HT2_DSM_2006[matrix]=HTmax;
1488 if (HTmax > HT2WEST_TH_2006[matrix])
1490 mIs2006HT2[matrix]=1;
1491 HT2_ID_2006[matrix]=HTmaxID;
1492 HT2_DSM_2006[matrix]=HTmax;
1496 mIs2006HT2[matrix]=0;
1497 HT2_ID_2006[matrix]=HTmaxID;
1498 HT2_DSM_2006[matrix]=HTmax;
1504 int BHTTPcounter[6];
1505 for (
int matrix=0; matrix<6; matrix++){
1507 mIs2006BHTTP[matrix]=0;
1508 BHTTPcounter[matrix]=0;
1510 for(
int i = 0; i < kNPatches; ++i)
1516 if (kNPatches < 150){
1517 if (mTrigger.HT[i] < HT0WEST_TH_2006[matrix]) HTBIT = 0;
1518 if (mTrigger.HT[i] > HT0WEST_TH_2006[matrix]) HTBIT = 1;
1519 if (mTrigger.HT[i] > HT1WEST_TH_2006[matrix]) HTBIT = 2;
1520 if (mTrigger.HT[i] > HT2WEST_TH_2006[matrix]) HTBIT = 3;
1523 if (kNPatches >= 150){
1524 if (mTrigger.HT[i] < HT0EAST_TH_2006[matrix]) HTBIT = 0;
1525 if (mTrigger.HT[i] > HT0EAST_TH_2006[matrix]) HTBIT = 1;
1526 if (mTrigger.HT[i] > HT1EAST_TH_2006[matrix]) HTBIT = 2;
1527 if (mTrigger.HT[i] > HT2EAST_TH_2006[matrix]) HTBIT = 3;
1530 if (mTrigger.Patch[i] < HTTP0_TH_2006[matrix]) TPBIT = 0;
1531 if (mTrigger.Patch[i] > HTTP0_TH_2006[matrix]) TPBIT = 1;
1532 if (mTrigger.Patch[i] > HTTP1_TH_2006[matrix]) TPBIT = 2;
1533 if (mTrigger.Patch[i] > HTTP2_TH_2006[matrix]) TPBIT = 3;
1535 if( TPBIT >= 2 && HTBIT >= 2)
1537 mIs2006BHTTP[matrix] = 1;
1538 BHTTP_2006_TP[matrix][BHTTPcounter[matrix]] = i;
1539 BHTTP_2006_TP_ADC[matrix][BHTTPcounter[matrix]] = mTrigger.Patch[i];
1540 BHTTP_2006_HT[matrix][BHTTPcounter[matrix]] = mTrigger.HTID[i];
1541 BHTTP_2006_HT_ADC[matrix][BHTTPcounter[matrix]] = mTrigger.HT[i];
1542 BHTTPcounter[matrix]++;
1545 numHTTP_2006[matrix]=BHTTPcounter[matrix];
1553 for(
int i = 0; i < kNJet; ++i)
1556 mTrigger.Jet[i] = 0;
1558 for(
int sequence = 0; sequence < kN_sequences; ++sequence)
1563 mTrigger.Jet[i] += mTrigger.Patch[k];
1570 for(
int i = 0; i < kNJet; ++i)
1573 if(mTrigger.Jet[i] > JPmax)
1575 JPmax = mTrigger.Jet[i];
1579 for (
int matrix=0;matrix<6;matrix++){
1581 if(mTrigger.Jet[i] > JP0_TH_2006[matrix])
1583 JP0_2006_array[matrix][numJP0_2006[matrix]] = i;
1584 ++numJP0_2006[matrix];
1587 if(mTrigger.Jet[i] > JP1_TH_2006[matrix])
1589 JP1_2006_array[matrix][numJP1_2006[matrix]] = i;
1590 ++numJP1_2006[matrix];
1596 for (
int matrix=0;matrix<6;matrix++){
1598 if(JPmax > JP0_TH_2006[matrix])
1600 mIs2006JP0[matrix]=1;
1601 JP0_ID_2006[matrix]=JPid;
1602 JP0_DSM_2006[matrix]=JPmax;
1606 mIs2006JP0[matrix]=0;
1607 JP0_ID_2006[matrix]=JPid;
1608 JP0_DSM_2006[matrix]=JPmax;
1611 if(JPmax > JP1_TH_2006[matrix])
1613 mIs2006JP1[matrix]=1;
1614 JP1_ID_2006[matrix]=JPid;
1615 JP1_DSM_2006[matrix]=JPmax;
1619 mIs2006JP1[matrix]=0;
1620 JP1_ID_2006[matrix]=JPid;
1621 JP1_DSM_2006[matrix]=JPmax;
1631 for(
int i = 0; i < 6; ++i)
1635 BL1_ADC_2006[i] = 0;
1638 TempSum = mTrigger.Jet[j] + mTrigger.Jet[j+1];
1639 EtotSum[i]=TempSum >> 2;
1640 if (EtotSum[i]>31) EtotSum[i]=31;
1641 mTrigger.Et += EtotSum[i];
1642 BL1_ADC_2006[i] = EtotSum[i];
1645 BETOT_DSM_2006=mTrigger.Et;
1651 int JpsiPatch[6][kNJet];
1652 for (
int matrix=0;matrix<6;matrix++)
1654 for(
int i = 0; i < kNJet; ++i)
1657 JPSI_2006_ADC[matrix][i]=0;
1658 JPSI_2006_ID[matrix][i]=0;
1659 JpsiPatch[matrix][i]=0;
1661 for(
int sequence = 0; sequence < kN_sequences; ++sequence)
1666 if(mTrigger.HT[k] > JPSI_2006_ADC[matrix][i])
1669 JPSI_2006_ADC[matrix][i]=mTrigger.HT[k];
1670 JPSI_2006_ID[matrix][i]=mTrigger.HTID[k];
1677 if(JPSI_2006_ADC[matrix][i] > HT0WEST_TH_2006[matrix]) JpsiPatch[matrix][i] = 1;
1682 if(JPSI_2006_ADC[matrix][i] > HT0EAST_TH_2006[matrix]) JpsiPatch[matrix][i] = 1;
1695 int ht_jpsi[6]={0,0,0,0,0,0};
1697 ht_jpsi[4] = JpsiPatch[matrix][0] || JpsiPatch[matrix][6];
1698 ht_jpsi[5] = JpsiPatch[matrix][1] || JpsiPatch[matrix][7];
1699 ht_jpsi[0] = JpsiPatch[matrix][2] || JpsiPatch[matrix][8];
1700 ht_jpsi[1] = JpsiPatch[matrix][3] || JpsiPatch[matrix][9];
1701 ht_jpsi[2] = JpsiPatch[matrix][4] || JpsiPatch[matrix][10];
1702 ht_jpsi[3] = JpsiPatch[matrix][5] || JpsiPatch[matrix][11];
1704 mIs2006JPSI[matrix] = ((ht_jpsi[0] && (ht_jpsi[2] || ht_jpsi[3] || ht_jpsi[4])) ||
1705 (ht_jpsi[1] && (ht_jpsi[3] || ht_jpsi[4] || ht_jpsi[5])) ||
1706 (ht_jpsi[2] && (ht_jpsi[4] || ht_jpsi[5])) || (ht_jpsi[3] && ht_jpsi[5]));
int status(int det, int softId, const char *option="") const
int GetTriggerPatchFromJetPatch(int jetPatch, int sequence, int &patchId) const
returns the trigger patch from big jet patch and the sequence in it
void getPedestal(Int_t det, Int_t softId, Int_t cap, Float_t &ped, Float_t &rms) const
Return pedestal mean and rms.
int GetTowerIdFromCrate(int crate, int sequence, int &softId) const
Get Software Id from Crate number and position in crate for towers.
int GetCrateAndSequenceFromTriggerPatch(int patchId, int &crate, int &sequence) const
returns the crate number and start point for a given trigger patch
void getTriggerPedestal(Int_t crate, Int_t index, Float_t &pedestal) const
Return tower pedestal loaded in trigger.
void SetFixTowerMapBug(bool fix)
Sets the tower map bug fix.