/*:>-------------------------------------------------------------------- **: FILE: mMvdTrig.c.template **: HISTORY: **: 00jan93-v000a-hpl- Created by stic Version **: Id: idl.y,v 1.17 1997/03/25 19:22:52 ward Exp **:<------------------------------------------------------------------*/ #include "mMvdTrig.h" void getmulti( DMVBSKEV_ST *bSkev, DMVDTRIGPAR_ST *tPar, short *multi, short index, short last); void MvdMess_(char *name_of_function, short ierror, short level, char *message, ...); #define NO_ERROR 0 /* used for message output with no error */ #define LOUD 2 /* messages which are usually output */ #define QUIET 1 /* used for messages which are output at default setting */ #define SILENT 0 /* for messages which are usually not output */ long mMvdTrig_( TABLE_HEAD_ST *bRaw_h, DMVBRAW_ST *bRaw , TABLE_HEAD_ST *cRaw_h, DMVCRAW_ST *cRaw , TABLE_HEAD_ST *Cntrl_h,DMVDTRIGCONTROL_ST *Cntrl , TABLE_HEAD_ST *tPar_h, DMVDTRIGPAR_ST *tPar , TABLE_HEAD_ST *bSkev_h, DMVBSKEV_ST *bSkev , TABLE_HEAD_ST *cSkev_h, DMVCSKEV_ST *cSkev ) { /*:>-------------------------------------------------------------------- **: ROUTINE : mMvdTrig_ **: **: DESCRIPTION : calculate the multiplicity of inner shell and determine **: trigger condition **: **: AUTHOR : **: J.H.Park, S.S.Ryu (YonSei Univ.) (Nov 10 97) **: Translated from the original Fortran version VER_TRIG.f, **: VER_CLMP.f, VER_GETO.f written by J.P.Sullivan **: **: ARGUMENTS: **: IN: **: bRaw - barrel detector raw ADC data **: bRaw_h - header Structure for bRaw **: cRaw - pad detector raw ADC data **: cRaw_h - header Structure for cRaw **: INOUT: **: Cntrl - trigger condition and occupancy **: Cntrl_h - header Structure for Cntrl **: tPar - trigger parameters **: tPar_h - header Structure for tPar **: bSkev - calibrated barrel detector data **: bSkev_h - header Structure for bSkev **: cSkev - calibrated pad detector data **: cSkev_h - header Structure for cSkev **: OUT: **: RETURNS: STAF Condition Value **: Revision History **: Name Date Comment **: J.H.Park Feb. 10, 1998 calculate the multiplicity **: based on inner shell **: **: J.P.Sullivan Apr. 14, 1998 replace printf with Mvdmess calls **: S.S.Ryu 06-Jul-99 changes the variable "Cntl" to "Cntrl" to make **: this variable consistent throughout the MVD **: codes. **:>------------------------------------------------------------------*/ short i,j,k; short last; short total=0; short innertotal=0; short multi=0; DMVBRAW_ST *TableIndex=bRaw; MvdMess_("mMvdTrig",NO_ERROR,LOUD,"\nmMvdTrig{"); /* setup vertex Trig Parametes */ if ( tPar_h->nok ==0){ tPar->NHITMIN=2; tPar->THRESH_KEV=25.; tPar->OCC_CUT=0.45; tPar_h->nok=1; } for (i=0;inok;++i) if ( bRaw[i].shell== 0) /* inner shell */ innertotal++; /* # of tables of inner shell */ last=innertotal-2; for (i=0;i tPar->NHITMIN) Cntrl->itrig=1; else Cntrl->itrig=0; if (Cntrl_h->nok== 0 ) Cntrl_h->nok=1; MvdMess_("mMvdTrig",NO_ERROR,SILENT, "\tMVD multiplicity : %d ",multi); MvdMess_("mMvdTrig",NO_ERROR,LOUD,"}"); return STAFCV_OK; } void getmulti( DMVBSKEV_ST *bSkev, DMVDTRIGPAR_ST *tPar, short *multi, short index , short last ){ if ( bSkev[index].skev > tPar->THRESH_KEV) { if ( bSkev[index+1].skev > tPar->THRESH_KEV){ if((bSkev[index].shell ==bSkev[index+1].shell) && (bSkev[index].row ==bSkev[index+1].row ) && (bSkev[index].cell ==bSkev[index+1].cell ) && (bSkev[index].strip+1==bSkev[index+1].strip) ) ; else (*multi)++; } else (*multi)++; } if ( index==last) { if ( bSkev[index+1].skev > tPar->THRESH_KEV) (*multi)++; } }