5 #include "StRFEmcTrigMaker.h"
7 #include "StMuDSTMaker/COMMON/StMuEvent.h"
8 #include "StMuDSTMaker/COMMON/StMuDst.h"
9 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
10 #include "StMuDSTMaker/COMMON/StMuEmcCollection.h"
11 #include "StMuDSTMaker/COMMON/StMuTrack.h"
12 #include "StMuDSTMaker/COMMON/StMuEmcPoint.h"
13 #include "StMuDSTMaker/COMMON/StMuTrack.h"
14 #include "StEmcUtil/geometry/StEmcGeom.h"
18 #include "StEventMaker/StEventMaker.h"
19 #include "StEvent/StEmcDetector.h"
20 #include "StEvent/StEmcCollection.h"
21 #include "StEventTypes.h"
22 #include "StEvent/StBbcTriggerDetector.h"
23 #include "TClonesArray.h"
52 StRFEmcTrigMaker::~StRFEmcTrigMaker(){
58 Int_t StRFEmcTrigMaker::Init(){
60 cout <<
"You are loading StMuDst" << endl;
62 cout <<
"You are loading StEvent!" << endl;
65 emcGeom = StEmcGeom::getEmcGeom(
"bemc");
68 return StMaker::Init();
73 void StRFEmcTrigMaker::Sum(
int *sum,
int *sumadd){
75 (*sum)=(*sumadd)+(*sum);
78 void StRFEmcTrigMaker::Max(
int *max,
int *maxcomp){
79 if ((*max) < (*maxcomp))
85 Int_t StRFEmcTrigMaker::getBBCtrig(){
89 Int_t StRFEmcTrigMaker::getBEMCtrigHT(
int thres){
92 if (BHTmaxt>thres) test=1;
93 if (BHTmaxt<=thres) test=0;
97 Int_t StRFEmcTrigMaker::getBEMCtrigJP(
int thres){
100 if (BJPmaxt>thres) test = 1;
101 if (BJPmaxt<=thres) test = 0;
105 Int_t StRFEmcTrigMaker::getBEMCtrigTOT(
int thres){
109 if (BJPsumt>thres) test = 1;
110 if (BJPsumt<=thres) test = 0;
114 Int_t StRFEmcTrigMaker::getEEMCtrigHT(
int thres){
117 if (EHTmaxt>thres) test=1;
118 if (EHTmaxt<=thres) test=0;
123 Int_t StRFEmcTrigMaker::getEEMCtrigJP(
int thres ){
127 if (EJPmaxt>thres) test = 1;
128 if (EJPmaxt<=thres) test = 0;
132 Int_t StRFEmcTrigMaker::getEEMCtrigTOT(
int thres ){
135 if (EJPsumt>thres) test = 1;
136 if (EJPsumt<=thres) test = 0;
141 Int_t StRFEmcTrigMaker::getEEMC_HT_ADC(){
148 Int_t StRFEmcTrigMaker::getEEMC_JP_ADC(){
155 Int_t StRFEmcTrigMaker::getEEMC_TOT_ADC(){
161 Int_t StRFEmcTrigMaker::getBEMC_HT_ADC(){
168 Int_t StRFEmcTrigMaker::getBEMC_JP_ADC(){
175 Int_t StRFEmcTrigMaker::getBEMC_TOT_ADC(){
183 void StRFEmcTrigMaker:: Clear(
const char *opt){
189 memset(jpBsum,0,
sizeof(jpBsum));
190 memset(jpBmax,0,
sizeof(jpBmax));
191 memset(jpB_hit_num,0,
sizeof(jpB_hit_num));
192 memset(tpBsum,0,
sizeof(tpBsum));
193 memset(tpBmax,0,
sizeof(tpBmax));
197 memset(jpEsum,0,
sizeof(jpEsum));
198 memset(jpEmax,0,
sizeof(jpEmax));
199 memset(jpE_hit_num,0,
sizeof(jpE_hit_num));
200 memset(tpEsum,0,
sizeof(tpEsum));
201 memset(tpEmax,0,
sizeof(tpEmax));
226 gMessMgr->Warning() <<
GetName()<<
" no muDstMaker !!! Game Over!"<< endm;
230 bbcCol=&(muEvent->bbcTriggerDetector());
235 stEvent = (
StEvent *) GetInputDS(
"StEvent");
237 gMessMgr->Warning() <<
GetName()<<
" no StEvent !!! Game Over!"<< endm;
241 bbcCol=&(TrigDet->bbc());
246 gMessMgr->Error() <<
GetName()<<
" Logic error 1, kill chain"<< endm;
253 if(activeBBC && !getBBCtrig())
return kStErr;
263 void StRFEmcTrigMaker::unpackEmcFromMu(){
265 gMessMgr->Warning() <<
GetName()<<
" no muEmcCollection"<< endm;
303 for (
int n=1; n<=BemcTow; n++){
304 emcGeom->
getBin(n,Bmod,Beta,Bsub);
305 BTowADC = muEmcCol->getTowerADC(n,det);
309 int jpBindex=(Bmod+Bsub+5)/10;
310 if (((Bmod+Bsub+5)>=60)&&((Bmod+Bsub+5)<=66)) {
313 if ((Bmod == 60)&&(Bsub==2)) jpBindex=0;
315 int tpBindex=((Bmod+Bsub-3)/2) + 30*((Beta-1)/4);
316 if ((Bmod==1)&&(Bsub==1)) {
317 tpBindex=(29 + 30*((Beta-1)/4));
320 tpBindex=150 + ((Bmod+Bsub-3)/2) + 30*((Beta-1)/4);
321 if ((Bmod==61)&&(Bsub==1)) {
322 tpBindex=150 + (59 + 30*((Beta+-1)/4));
325 Sum(&jpBsum[jpBindex],&BTowADC);
326 Max(&jpBmax[jpBindex],&BTowADC);
327 Sum(&tpBsum[tpBindex],&BTowADC);
328 Max(&tpBmax[tpBindex],&BTowADC);
329 jpB_hit_num[jpBindex]++;
334 for (
int q=0; q < 6; q++){
335 Sum(&BJPsumt,&jpBsum[q]);
336 Max(&BHTmaxt,&jpBmax[q]);
337 Max(&BJPmaxt,&jpBsum[q]);
360 NumETow=muEmcCol->getNEndcapTowerADC();
361 for (
int m=0; m<NumETow; m++){
362 muEmcCol->getEndcapTowerADC(m,ETowADC,Esec,Esub,Eeta);
366 if (Eid > 719) Eid=Eid-720;
367 int jpEindex=Eid/120;
372 if ((Eeta>3)&&(Eeta<8)) {
376 Sum(&jpEsum[jpEindex],&ETowADC);
377 Max(&jpEmax[jpEindex],&ETowADC);
378 Sum(&tpEsum[tpEindex],&ETowADC);
379 Max(&tpEmax[tpEindex],&ETowADC);
380 jpE_hit_num[jpEindex]++;
389 for (
int q=0; q < 6; q++){
391 Sum(&EJPsumt,&jpEsum[q]);
392 Max(&EHTmaxt,&jpEmax[q]);
393 Max(&EJPmaxt,&jpEsum[q]);
397 printf(
"EJPsum=%d ,EHTmax=%d,EJPmax=%d\n",EJPsumt,EHTmaxt,EJPmaxt);
398 printf(
"BJPsum=%d ,BHTmax=%d,BJPmax=%d\n",BJPsumt,BHTmaxt,BJPmaxt);
405 void StRFEmcTrigMaker::unpackEmcFromSt(){
407 gMessMgr->Warning() <<
GetName()<<
" no stEmcCollection"<< endm;
445 StDetectorId BemcId=StDetectorId(kBarrelEmcTowerId);
448 for (UInt_t mod=1;mod<=EmcDet->numberOfModules();mod++){
450 StSPtrVecEmcRawHit&
hit=module->hits();
451 for(UInt_t ih=0;ih<hit.size();ih++){
460 int jpBindex=(Bmod+Bsub+5)/10;
461 if (((Bmod+Bsub+5)>=60)&&((Bmod+Bsub+5)<=66)) {
464 if ((Bmod == 60)&&(Bsub==2)) jpBindex=0;
466 int tpBindex=((Bmod+Bsub-3)/2) + 30*((Beta-1)/4);
467 if ((Bmod==1)&&(Bsub==1)) {
468 tpBindex=(29 + 30*((Beta-1)/4));
471 tpBindex=150 + ((Bmod+Bsub-3)/2) + 30*((Beta-1)/4);
472 if ((Bmod==61)&&(Bsub==1)) {
473 tpBindex=150 + (59 + 30*((Beta+-1)/4));
476 Sum(&jpBsum[jpBindex],&BTowADC);
477 Max(&jpBmax[jpBindex],&BTowADC);
478 Sum(&tpBsum[tpBindex],&BTowADC);
479 Max(&tpBmax[tpBindex],&BTowADC);
480 jpB_hit_num[jpBindex]++;
487 for (
int q=0; q < 6; q++){
488 Sum(&BJPsumt,&jpBsum[q]);
489 Max(&BHTmaxt,&jpBmax[q]);
490 Max(&BJPmaxt,&jpBsum[q]);
510 StDetectorId EemcId=StDetectorId(kEndcapEmcTowerId);
511 EmcDet = stEmcCol->detector(EemcId);
513 for (UInt_t mod=1;mod<=EmcDet->numberOfModules();mod++){
515 StSPtrVecEmcRawHit& hit=module->hits();
516 for(UInt_t ih=0;ih<hit.size();ih++){
523 int m =60*(Esec-1) + 12*(Esub-1) + (Eeta-1);
527 if (Eid > 719) Eid=Eid-720;
528 int jpEindex=Eid/120;
533 if ((Eeta>3)&&(Eeta<8)) {
537 Sum(&jpEsum[jpEindex],&ETowADC);
538 Max(&jpEmax[jpEindex],&ETowADC);
539 Sum(&tpEsum[tpEindex],&ETowADC);
540 Max(&tpEmax[tpEindex],&ETowADC);
541 jpE_hit_num[jpEindex]++;
549 for (
int q=0; q < 6; q++){
551 Sum(&EJPsumt,&jpEsum[q]);
552 Max(&EHTmaxt,&jpEmax[q]);
553 Max(&EJPmaxt,&jpEsum[q]);
556 printf(
"EJPsum=%d ,EHTmax=%d,EJPmax=%d\n",EJPsumt,EHTmaxt,EJPmaxt);
557 printf(
"BJPsum=%d ,BHTmax=%d,BJPmax=%d\n",BJPsumt,BHTmaxt,BJPmaxt);
565 void StRFEmcTrigMaker::unpackBBC(){
567 gMessMgr->Warning() <<
GetName()<<
" no BBC Collection"<< endm;
570 int Npmt=bbcCol->numberOfPMTs();
575 for (
int pmt=0;pmt<Npmt;pmt++){
576 BBCadc[pmt]=bbcCol->adc(pmt);
577 int bbcadc=bbcCol->adc(pmt);
583 if (23<pmt && pmt<40) {
590 if ((Ebbc==1)&&(Wbbc==1)){
594 gMessMgr->Info() <<
GetName()<<
" BBCtrig="<<getBBCtrig()<<endm;
600 void StRFEmcTrigMaker::initHisto() {
603 ha[0]=
new TH1F(
"bHT",
"BEMC HT ADC",nAdc,-.5, mxAdc-.5);
604 ha[1]=
new TH1F(
"bJP",
"BEMC JP ADC",nAdc,-.5, mxAdc-.5);
605 ha[2]=
new TH1F(
"bTot",
"BEMC Tot ADC",nAdc,-.5, mxAdc-.5);
606 ha[3]=
new TH1F(
"eHT",
"EEMC HT ADC",nAdc,-.5, mxAdc-.5);
607 ha[4]=
new TH1F(
"eJP",
"EEMC JP ADC",nAdc,-.5, mxAdc-.5);
608 ha[5]=
new TH1F(
"eTot",
"EEMC Tot ADC",nAdc,-.5, mxAdc-.5);
613 void StRFEmcTrigMaker::fillHisto() {
615 ha[0]->Fill(getBEMC_HT_ADC());
616 ha[1]->Fill(getBEMC_JP_ADC());
617 ha[2]->Fill(getBEMC_TOT_ADC());
618 ha[3]->Fill(getEEMC_HT_ADC());
619 ha[4]->Fill(getEEMC_JP_ADC());
620 ha[5]->Fill(getEEMC_TOT_ADC());
static StMuEmcCollection * muEmcCollection()
returns pointer to current StMuEmcCollection
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
virtual const char * GetName() const
special overload
Int_t getBin(const Float_t phi, const Float_t eta, Int_t &m, Int_t &e, Int_t &s) const