时间扫描有时能成功,有时不能成功
在实验室对ROC 1的FEB 0 的 Tiger 0 和 Tiger 1 做时间扫描,有的时候能成功,有的时候不能成功。
bug 发现(来源于 GUFI 的bug):
发现在GEM_COM->set_counter函数中,第三个参数为0, 而在gemroc_cmd_LV_settings包中, 第三个参数表示 CHANNEL_for_counter, //0-63 for single channel hits, 64 for chip total。 说明读取的都是通道0的error count. 所以都是使用通道0的错误计数来做最终的计算,无法得出正确的TD值。
bug解决:
将第三个参数改为64.
结果:
也还是有的时候能成功,有的时候不成功。。。
86 TIGER_for_counter = 0 ; //TIGER on which we count error or hits
87 HIT_counter_disable = 0 ; // 1= counting errors, 0= counting hits
88 CHANNEL_for_counter =64; //0-63 for single channel hits, 64 for chip total
89 RX_ERR_CNT_RST =0 ; //counter reset
90
91 command_string = command_string_param;
840 void communication::set_counter(uint32_t TIGER_for_counter, uint32_t ERROR_counter_enable, uint32_t CHANNEL_for_counter, uint32_t* command_echo){
841 gemroc_LV_XX->TIGER_for_counter = TIGER_for_counter;
842 gemroc_LV_XX->HIT_counter_disable = ERROR_counter_enable; // 1=counting errors, 0=counting hits
843 gemroc_LV_XX->CHANNEL_for_counter = CHANNEL_for_counter;
844 std::string COMMAND_STRING = "CMD_GEMROC_LV_CFG_WR";
845 send_GEMROC_LV_CMD(COMMAND_STRING, command_echo);
846 }
424 for ( int Ts=0; Ts<4; Ts++) {
425 if ( time_for_step < 0 ) {// why would this happen ?
426 GEM_COM->SynchReset_to_TgtFEB(command_echo, 0, 1);
427 GEM_COM->set_counter((Ts * 2), 1, 0, command_echo); // counting errors 第三个参数改成64
428 GEM_COM->reset_counter(command_echo);
429 usleep(time_for_step*1000000);// time_for_step sec
430 counter1 = GEM_COM->GEMROC_counter_get();
431
432 GEM_COM->SynchReset_to_TgtFEB(command_echo, 0, 1);
433 GEM_COM->set_counter((Ts * 2+1), 1, 0, command_echo); // counting errors 第三个参数改成64
434 GEM_COM->reset_counter(command_echo);
435 usleep(time_for_step*1000000);// time_for_step sec
436 counter2 = GEM_COM->GEMROC_counter_get();
437 } else {
438 GEM_COM->set_counter((Ts * 2), 1, 0, command_echo); // Tiger Ts*2, counting errors 第三个参数改成64
439 GEM_COM->SynchReset_to_TgtFEB(command_echo, 0, 1);
440 GEM_COM->reset_counter(command_echo);
441 usleep(time_for_step*1000000);
442 counter1 = GEM_COM->GEMROC_counter_get(); // get error counters
443 GEM_COM->set_counter((Ts * 2+1), 1, 0, command_echo); // Tiger Ts*2+1, counting errors 第三个参数改成64
444 counter2 = GEM_COM->GEMROC_counter_get(); // get error counters
445 }
446 error_matrix[Ts * 2][TD] = counter1;
447 error_matrix[Ts*2 +1][TD] = counter2;
448 std::cout << "Tiger:" << Ts * 2<< ", TD=" << TD << ", counter="<<counter1<<std::endl;
449 std::cout << "Tiger:" << Ts * 2+1<< ", TD=" << TD << ", counter="<<counter2<<std::endl;
450 }
451 }
GUFI 4.1 源码
848 for TD in range (0,64):
849 print ("Setting delay {}".format(TD))
850 self.GEM_COM.set_FEB_timing_delays(TD, TD, TD, TD)
851 self.GEM_COM.DAQ_set(0, 0xff, 1, 256, 1, 1, False)
852 # self.GEM_COM.SynchReset_to_TgtTCAM(0, 1)
853 for Ts in range(0, 4):
854 if time_for_step<0:
855 self.GEM_COM.SynchReset_to_TgtFEB(0, 1)
856 self.GEM_COM.set_counter((Ts * 2), 1, 0)
857 self.GEM_COM.reset_counter()
858 time.sleep(time_for_step)
859 counter1=self.GEM_COM.GEMROC_counter_get()
860 self.GEM_COM.SynchReset_to_TgtFEB(0, 1)
861 self.GEM_COM.set_counter((Ts * 2+1), 1, 0)
862 self.GEM_COM.reset_counter()
863 time.sleep(time_for_step)
864 counter2=self.GEM_COM.GEMROC_counter_get()
865 else:
866 self.GEM_COM.set_counter((Ts * 2), 1, 0)
867 self.GEM_COM.SynchReset_to_TgtFEB(0, 1)
868 self.GEM_COM.reset_counter()
869 time.sleep(time_for_step)
870 counter1=self.GEM_COM.GEMROC_counter_get()
871 self.GEM_COM.set_counter((Ts * 2+1), 1, 0)
872 counter2=self.GEM_COM.GEMROC_counter_get()
873 error_matrix[Ts * 2,TD]=counter1
874 error_matrix[Ts*2 +1,TD]=counter2
Edited by zengtx@ihep.ac.cn