*file member=anxx_is_online library=snoman language=fortran77 date=08:Nov:2004 <<< logical function anxx_is_online(lcn,mask1,mask2) * A utility to determine if a given channel is online. * Contact: M. Huang, Texas. * Revision History: * ================ * 4.0196 A. Krumins first version. * 4.0196 P. Skensved simplify the code * 5.01 M. Huang modify to include more than one type of flagging * mechanisms and more than one ANXX banks, and load * different type of ANXX banks baed on user's request * Parameters: * ========== * lcn : logical channel number in question, 0 <= lcn <= 9727 * mask1 & mask2: * See SNOMAN companion for bit values of flagging types; * Mask1 & mask2 are integer bits corresponding to the type of * flagging mechanisms for PCA (or N16) and neutrino, respectively. * Please refer to SNOMAN companion for how to load mask1 and * mask2. * * If neither anxx_pca.dat nor anxx_n16.dat is provided, mask1 = 0. * If anxx_neutrion.dat is not provided, mask2 = 0. * Common Block Access: * =================== * (ignoring internal and environmental access) * /anxx_data_com/ * /anxx_load_com/ * Specification: * ============= * Return true if a given channel is online in accordance with a * particular mask. * * Revision History:- * ================ * 4.0196 A. Krumins first version. * 4.0196 P. Skensved simplify the code * 5.01 M. Huang modify to include more than one type of flagging * mechanisms and more than one ANXX banks, and load * different type of ANXX banks baed on user's request * 5.01 N. McCauley Don't change the value of mask1,2 set they could be * constants. implicit none include 'su_mnemonics.inc' include 'mt_mnemonics.inc' include 'mt.inc' include 'anxx_data_com.inc' include 'anxx_load_com.inc' include 'zunit.inc' * Argument Declarations: * ===================== integer lcn, mask1, mask2 * Local Variable Declarations: * =========================== integer status1, status2, tmask1,tmask2, + data_type1, data_type2, data_type3, data_pca_n16 integer anxx_online1(0:9727,2), anxx_online2(0:9727,2) logical first, check_pca_n16, check_neutrino data first /.TRUE./ save first, anxx_online1, anxx_online2 * We use tmask as mask values could be constant. tmask1 = mask1 tmask2 = mask2 * === Following assumes that ANXX Banks already exist ================= if( first ) then * ... load titles bank ANCT to grab data_type which is requsted by user ..... laanct(8) = 0 call mt_request_titles('ANCT',1,KMTT_COMPULSORY,laanct,KSU_ANX) * ... load titles bank ANXX depending on user's requst .... data_type1 = icons(ldanct+KANX_DATA_TYPE1) data_type2 = icons(ldanct+KANX_DATA_TYPE2) data_type3 = icons(ldanct+KANX_DATA_TYPE3) if (data_type1.gt.0 .and. data_type2.lt.0) then data_pca_n16 = data_type1 else if (data_type1.lt.0 .and. data_type2.gt.0) then data_pca_n16 = data_type2 else data_pca_n16 = -9 endif if (data_pca_n16 .gt. 0) then laanxx(8) = 0 call mt_request_titles('ANXX',data_pca_n16,KMTT_COMPULSORY, + laanxx,0) call anxx_load(anxx_online1) else tmask1 = 0 write(iqprnt,90001) write(iqlog,90001) endif if (data_type3 .gt. 0) then laanxx(8) = 0 call mt_request_titles('ANXX',data_type3,KMTT_COMPULSORY, + laanxx,0) call anxx_load(anxx_online2) else tmask2 = 0 write(iqprnt,90003) write(iqlog,90003) endif first = .FALSE. endif * === Check if a channel in question is online ==================== * status = 0 means the tube is good * status nonzero means the tube is bad * as a default, set anxx_is_online to TRUE anxx_is_online = .true. status1 = anxx_online1(lcn,1) status2 = anxx_online2(lcn,1) if (status1.ne.0 .or. status2.ne.0) then check_pca_n16 = iand(anxx_online1(lcn,2),tmask1) .ne. 0 check_neutrino = iand(anxx_online2(lcn,2),tmask2) .ne. 0 if (check_pca_n16 .or. check_neutrino) + anxx_is_online = .false. endif 90001 format + ('Neither PCA nor N16 titles bank is provided, set tmask1=0') 90003 format('Neutrino titles bank is not provided, set tmask2=0') return end *endfile member=anxx_is_online