223 for (
int diodei=0; diodei<
NDIODES; diodei++ ) {
224 for (
int diodej=0; diodej<
NDIODES; diodej++ ) {
235 for (
int diode=0; diode<
NDIODES; ++diode ) {
236 for (
int gain=0; gain<
NGAINS; gain++ ) {
244 for (
int diode=0; diode<
NDIODES+1; ++diode ) {
245 for (
int gain=0; gain<
NGAINS; gain++ ) {
257 for(
int pmt=0;pmt<
NPMTS;++pmt){
258 for (
int gain=0; gain<
NGAINS; gain++ ) {
284 for (
int gain=0; gain<
NGAINS; ++gain ) {
289 for (
int drawer=0; drawer<
NDRAWERS; ++drawer ) {
290 for (
int gain=0; gain<
NGAINS; ++gain ) {
291 for (
int fiber=0; fiber<
NFIBERS; ++fiber){
292 m_kappa[part][drawer][fiber][gain] = 0;
293 for (
int pmt1=0; pmt1<
NCOUPLES-1; ++pmt1){
294 for (
int pmt2=pmt1+1; pmt2<
NCOUPLES; ++pmt2){
300 for (
int channel=0; channel<
NCHANNELS; ++channel ) {
305 m_time[part][drawer][channel][gain] = 0;
306 m_time_S[part][drawer][channel][gain] = 0;
308 m_mean[part][drawer][channel][gain] = 0;
309 m_mean_S[part][drawer][channel][gain] = 0;
313 for (
int iSlice=0; iSlice<
NSLICES; ++iSlice ) {
319 for(
int diode=0; diode<
NDIODES; ++diode){
320 for (
int diode_gain=0; diode_gain<
NGAINS; diode_gain++) {
333 m_ratio[d][part][drawer][channel][gain] = 0;
334 m_ratio_S[d][part][drawer][channel][gain] = 0;
340 m_entries[part][drawer][channel][gain] = 0;
342 m_HV[part][drawer][channel] = 0.;
343 m_HVSet[part][drawer][channel] = 0.;
361 return StatusCode::SUCCESS;
372 const EventContext& ctx = Gaudi::Hive::currentContext();
375 const char* text[
NGAINS] = {
"LG DIODE ",
"HG DIODE "};
391 if(
m_LASERII)
ATH_MSG_DEBUG (
"LaserII version is " << laserObj->getVersion() <<
" DAQ Type = " << laserObj->getDaqType() );
392 else ATH_MSG_DEBUG (
"LaserI version is " << laserObj->getVersion() <<
" DAQ Type = " << laserObj->getDaqType() );
394 const uint32_t *cispar = dqStatus->
cispar();
396 m_las_time =
static_cast<double>(cispar[10])+
static_cast<double>(cispar[11])/1000000;
399 if(laserObj->getDiodeCurrOrd() == 0 || laserObj->getFiltNumber() == 0 || laserObj->getQDCTimeout()){
400 ATH_MSG_ERROR (
"No filter number or diode current: wheel moving or QDC timeout" );
401 return StatusCode::SUCCESS;
408 for (
int draw=0; draw<
NDRAWERS; draw++){
409 for (
int chan=0; chan<
NCHANNELS; chan++){
410 for (
int gain=0; gain<
NGAINS; gain++) {
411 pmt_values[part][draw][chan][gain]=0.;
417 static std::once_flag flag;
418 std::call_once(flag, [&]() {
421 for (
int drawer=0; drawer<
NDRAWERS; ++drawer ) {
423 for (
int channel=0; channel<
NCHANNELS; ++channel ) {
424 if ( dqStatus->
isChEmpty(ros,drawer,channel) ) {
427 for (
int gain=0; gain<
NGAINS; ++gain ) {
443 m_status[part][drawer][channel][gain] = 1 << (status-1);
455 switch ( laserObj->getCalibType() ) {
459 for (
int diode=0; diode<
NDIODES; ++diode ) {
460 for (
int gain=0; gain<
NGAINS; gain++ ) {
467 for (
int gain=0; gain<
NGAINS; gain++ ) {
473 for (
int gain=0; gain<
NGAINS; gain++ ) {
479 for (
int gain=0; gain<
NGAINS; gain++ ) {
492 for (
int diode=0; diode<
NDIODES; ++diode ) {
493 for (
int gain=0; gain<
NGAINS; gain++ ) {
499 for (
int gain=0; gain<
NGAINS; gain++ ) {
509 for (
int diode=0; diode<
NDIODES; ++diode ) {
510 for (
int gain=0; gain<
NGAINS; gain++ ) {
515 for (
int gain=0; gain<
NGAINS; gain++ ) {
525 ATH_MSG_ERROR (
"Got an invalid calibration type from LaserObject" );
526 return StatusCode::SUCCESS;
534 for (
int diode=0; diode<
NDIODES; ++diode ) {
535 for (
int gain=0; gain<
NGAINS; gain++ ) {
538 <<
" ( " << laserObj->isSet(diode, gain, 0) <<
" ) "
543 normalization[diode][gain] = ((float)laserObj->getDiodeADC(diode,gain)-
m_diode_Ped_LASERII[diode][gain]);
547 for (
int gain=0; gain<
NGAINS; ++gain ) {
548 for (
int diodei=0; diodei<
NDIODES; diodei++ ) {
549 for (
int diodej=0; diodej<
NDIODES; diodej++ ) {
551 if (gain==0){
m_rs_diode_ratio_low[diodei][diodej]->Push(normalization[diodei][gain]/normalization[diodej][gain]);}
552 if (gain==1){
m_rs_diode_ratio_high[diodei][diodej]->Push(normalization[diodei][gain]/normalization[diodej][gain]);}
558 for (
int pmt=0; pmt<
NPMTS; pmt++ ) {
559 for (
int gain=0; gain<
NGAINS; gain++ ) {
567 m_rs_diode_signal[d]->Push(laserObj->getDiodeADC(d,0)-laserObj->getDiodePedestal(d,0));
570 for(
int pmt=0; pmt<
NPMTS; pmt++){
571 m_rs_PMT_signal[pmt]->Push(laserObj->getPMADC(pmt,0)-laserObj->getPMPedestal(pmt,0));
596 m_hrate = laserObj->getHumidity();
597 m_flow = laserObj->getGasFlux();
603 for (
int pmt1=0; pmt1<
NCOUPLES-1; ++pmt1){
604 for (
int pmt2=0; pmt2<
NCOUPLES; ++pmt2){
612 for(
int gain=0;gain<
NGAINS;++gain){
623 for ( itColl=rawCnt->begin(); itColl != itCollEnd; ++itColl ) {
630 float ofctime = (*it)->time();
631 if(ofctime!=0.0 and std::abs(ofctime-15.0)<30.)
632 avg_time[part][gain]->
Push(ofctime);
636 for ( itColl=rawCnt->begin(); itColl != itCollEnd; ++itColl ) {
649 float amp = (*it)->amplitude();
650 float ofctime = (*it)->time();
651 float ped = (*it)->pedestal();
654 if(ofctime!=0.0) ofctime -= avg_time[part][gain]->
Mean();
656 if ( dqStatus->
isChEmpty(ros,drawer,chan) ) {
657 m_status[part][drawer][chan][0] = -1;
658 m_status[part][drawer][chan][1] = -1;
662 if ( !dqStatus->
isAdcDQgood(ros,drawer,chan,gain) ) {
663 m_status[part][drawer][chan][gain] |= 0x10;
667 int problem = int(ped + 500.)/10000;
671 m_status[part][drawer][chan][gain] |= 0x100;
675 m_status[part][drawer][chan][gain] |= 0x200;
679 m_status[part][drawer][chan][gain] |= 0x400;
683 m_status[part][drawer][chan][gain] |= 0x800;
687 m_status[part][drawer][chan][gain] |= 0x1000;
691 m_status[part][drawer][chan][gain] |= 0x2000;
698 m_rs_time[part][drawer][chan][gain]->Push(ofctime);
699 m_rs_signal[part][drawer][chan][gain]->Push(ampInPicoCoulombs);
703 for(
int diode=0; diode<
NDIODES; ++diode){
704 for (
int diode_gain=0; diode_gain<
NGAINS; diode_gain++ ) {
705 if ( normalization[diode][diode_gain]!=0. ){
706 if (is_good)
m_rs_ratio_LASERII_good[diode][diode_gain][part][drawer][chan][gain]->Push( ampInPicoCoulombs/normalization[diode][diode_gain] );
707 m_rs_ratio_LASERII[diode][diode_gain][part][drawer][chan][gain]->Push( ampInPicoCoulombs/normalization[diode][diode_gain] );
711 if (is_good)
m_entries[part][drawer][chan][gain]++;
714 if((laserObj->getDiodeADC(i,0)-laserObj->getDiodePedestal(i,0)) != 0) {
715 if (is_good)
m_rs_ratio_good[i][part][drawer][chan][gain]->Push(ampInPicoCoulombs/(laserObj->getDiodeADC(i,0)-laserObj->getDiodePedestal(i,0)));
716 m_rs_ratio[i][part][drawer][chan][gain]->Push(ampInPicoCoulombs/(laserObj->getDiodeADC(i,0)-laserObj->getDiodePedestal(i,0)));
719 if (is_good)
m_entries[part][drawer][chan][gain]++;
722 if ((is_good) && (!(
m_status[part][drawer][chan][gain]&0x4)) )
723 pmt_values[part][drawer][chan][gain]=ampInPicoCoulombs;
725 pmt_values[part][drawer][chan][gain]=0.;
733 for (
int drawer=0; drawer<
NDRAWERS; ++drawer){
734 for(
int pmt1=0; pmt1<
NCOUPLES-1; ++pmt1){
735 for (
int pmt2=0; pmt2<
NCOUPLES; ++pmt2){
740 for (
int gain=0; gain<
NGAINS; ++gain){
741 for (
int pmt1=0; pmt1<
NCOUPLES-1; ++pmt1){
743 if (chan1==-1)
continue;
745 for (
int pmt2=pmt1+1; pmt2<
NCOUPLES; ++pmt2){
747 if (chan2==-1)
continue;
749 Q1Q2[pmt1][pmt2]= pmt_values[part][drawer][chan1][gain]*pmt_values[part][drawer][chan2][gain];
750 if (Q1Q2[pmt1][pmt2]>0.){
757 for (
int pmt1=0; pmt1<
NCOUPLES-1; ++pmt1){
759 if (chan1==-1)
continue;
760 for (
int pmt2=pmt1+1; pmt2<
NCOUPLES; ++pmt2){
764 Q1Q2[pmt1][pmt2]= pmt_values[part][drawer][chan1][gain]*pmt_values[part][drawer][chan2][gain];
765 if (Q1Q2[pmt1][pmt2]>0.){
778 for(
int drawer=0; drawer<
NDRAWERS; ++drawer){
779 for (
int chan=0; chan<
NCHANNELS; ++chan){
780 for(
int gain=0;gain<
NGAINS;++gain){
783 chanref = 24 + chan%2;
798 chanref = 38 - chan%2;
801 if(pmt_values[part][drawer][chanref][gain]>0.001){
802 m_rs_pmt_ratios[part][drawer][chan][gain]->Push(pmt_values[part][drawer][chan][gain]/pmt_values[part][drawer][chanref][gain]);
811 for(
int gain=0;gain<
NGAINS;++gain){
812 m_rs_meantime[part][gain]->Push(avg_time[part][gain]->Mean());
813 delete(avg_time[part][gain]);
817 return StatusCode::SUCCESS;
828 for (
int diodei=0; diodei<
NDIODES; diodei++ ) {
829 for (
int diodej=0; diodej<
NDIODES; diodej++ ) {
838 for(
int pmt=0; pmt<
NPMTS; pmt++){
839 for (
int gain=0; gain<
NGAINS; ++gain ) {
845 for (
int gain=0; gain<
NGAINS; ++gain ) {
852 for(
int pmt=0; pmt<
NPMTS; pmt++){
864 for (
int partition=0; partition<
NPARTITIONS; partition++ ) {
865 for (
int gain=0; gain<
NGAINS; ++gain ) {
869 for (
int drawer=0; drawer<
NDRAWERS; ++drawer ) {
870 for (
int gain=0; gain<
NGAINS; ++gain ) {
875 int nCouplesEven=0, nCouplesOdd=0;
883 for (
int pmt1=0; pmt1<
NCOUPLES-1; ++pmt1){
884 for (
int pmt2=pmt1+1; pmt2<
NCOUPLES; ++pmt2){
887 q1 =
m_rs_signal[partition][drawer][chan1][gain]->Mean();
888 q2 =
m_rs_signal[partition][drawer][chan2][gain]->Mean();
896 if ((
m_rs_reducedKappa[partition][drawer][pmt1][pmt2][gain][1]->Mean()/(q1*q2)-1) > 0.01 ){
899 m_kappa[partition][drawer][1][gain] += (
m_rs_reducedKappa[partition][drawer][pmt1][pmt2][gain][1]->Mean()/(q1*q2)-1);
900 if (
m_kappa[partition][drawer][1][gain]<0.){
908 for (
int pmt1=0; pmt1<
NCOUPLES-1; ++pmt1){
909 for (
int pmt2=pmt1+1; pmt2<
NCOUPLES; ++pmt2){
912 q1 =
m_rs_signal[partition][drawer][chan1][gain]->Mean();
913 q2 =
m_rs_signal[partition][drawer][chan2][gain]->Mean();
921 if ((
m_rs_reducedKappa[partition][drawer][pmt1][pmt2][gain][0]->Mean()/(q1*q2)-1) >0.01){
924 m_kappa[partition][drawer][0][gain] += (
m_rs_reducedKappa[partition][drawer][pmt1][pmt2][gain][0]->Mean()/(q1*q2)-1);
926 if (
m_kappa[partition][drawer][0][gain]<0.){
932 if ( nCouplesEven!=0 ){
933 m_kappa[partition][drawer][0][gain] =
m_kappa[partition][drawer][0][gain]/nCouplesEven;
934 if (
m_kappa[partition][drawer][0][gain]>0.01){
935 ATH_MSG_DEBUG (
"Too big kappa value: " <<
m_kappa[partition][drawer][0][gain] <<
" " << nCouplesEven);
938 if ( nCouplesOdd!=0 ){
939 m_kappa[partition][drawer][1][gain] =
m_kappa[partition][drawer][1][gain]/nCouplesOdd;
940 if (
m_kappa[partition][drawer][1][gain]>0.01){
941 ATH_MSG_DEBUG (
"Too big kappa value: " <<
m_kappa[partition][drawer][1][gain] <<
" " << nCouplesOdd );
945 for(
int channel=0; channel<
NCHANNELS; ++channel){
946 m_time[partition][drawer][channel][gain] =
m_rs_time[partition][drawer][channel][gain]->Mean();
947 m_time_S[partition][drawer][channel][gain] =
m_rs_time[partition][drawer][channel][gain]->StandardDeviation();
948 m_mean[partition][drawer][channel][gain] =
m_rs_signal[partition][drawer][channel][gain]->Mean();
949 m_mean_S[partition][drawer][channel][gain] =
m_rs_signal[partition][drawer][channel][gain]->StandardDeviation();
955 int nSlices = std::min(
NSLICES,
m_rs_signal[partition][drawer][channel][gain]->GetNSlices());
956 for(
int iSlice=0; iSlice<nSlices; ++iSlice){
957 m_mean_slice[partition][drawer][channel][iSlice][gain] =
m_rs_signal[partition][drawer][channel][gain]->Mean(iSlice);
964 for (
int diode=0; diode<
NDIODES; diode++ ) {
965 for (
int diode_gain=0; diode_gain<
NGAINS; diode_gain++) {
973 if (std::abs(
m_rs_pmt_ratios[partition][drawer][channel][gain]->Mean())>100000.) {
974 ATH_MSG_DEBUG(
"too big value for " << partition <<
" " << drawer <<
" " << channel <<
" " << gain <<
" "
975 <<
m_rs_pmt_ratios[partition][drawer][channel][gain]->NumDataValues() <<
"status" <<
m_status[partition][drawer][channel][gain] );
982 m_ratio[d][partition][drawer][channel][gain] =
m_rs_ratio[d][partition][drawer][channel][gain]->Mean();
983 m_ratio_S[d][partition][drawer][channel][gain] =
m_rs_ratio[d][partition][drawer][channel][gain]->StandardDeviation();
1000 for(
int drawer=0; drawer<
NDRAWERS; ++drawer){
1001 for(
int channel=0; channel<
NCHANNELS; ++channel){
1002 m_HV[part][drawer][channel] =
m_tileDCS->getChannelHV(ros, drawer, channel);
1003 m_HVSet[part][drawer][channel] =
m_tileDCS->getChannelHVSet(ros, drawer, channel);
1010for (
int diodei=0; diodei<
NDIODES; diodei++ ) {
1011 for (
int diodej=0; diodej<
NDIODES; diodej++ ) {
1017 for (
int diode=0; diode<
NDIODES; ++diode ) {
1018 for (
int gain=0; gain<
NGAINS; gain++ ) {
1023 for(
int pmt=0;pmt<
NPMTS;++pmt){
1024 for (
int gain=0; gain<
NGAINS; gain++ ) {
1035 for (
int gain=0; gain<
NGAINS; ++gain ) {
1039 for (
int drawer=0; drawer<
NDRAWERS; ++drawer ) {
1040 for (
int gain=0; gain<
NGAINS; ++gain ) {
1041 for (
int fiber=0; fiber<
NFIBERS; ++fiber){
1042 for (
int pmt1=0; pmt1<
NCOUPLES-1; ++pmt1){
1043 for (
int pmt2=pmt1+1; pmt2<
NCOUPLES; ++pmt2){
1049 for (
int channel=0; channel<
NCHANNELS; ++channel ) {
1050 delete m_rs_time[part][drawer][channel][gain];
1054 for(
int diode=0; diode<
NDIODES; ++diode){
1055 for (
int diode_gain=0; diode_gain<
NGAINS; diode_gain++) {
1064 delete m_rs_ratio[d][part][drawer][channel][gain];
1073 return StatusCode::SUCCESS;
1187 std::pair<unsigned int, unsigned int> coupleOfPMTs;
1189 int chanLBOdd[
NCOUPLES] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 33, 35, 37, 39, 41, 45, 47};
1190 int chanLBEven[
NCOUPLES] = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 34, 36, 38, 40, 42, 44, 46};
1192 int chanEBOdd[
NCOUPLES] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 21, 23, 32, 35, 36, 37, 40, -1, -1, -1, -1, -1, -1};
1193 int chanEBEven[
NCOUPLES] = {0, 2, 4, 6, 8, 10, 12, 14, 16, 20, 22, 30, 31, 38, 39, 41, -1, -1, -1, -1, -1, -1};
1196 coupleOfPMTs.first = chanLBEven[couple];
1197 coupleOfPMTs.second = chanLBOdd[couple];
1199 coupleOfPMTs.first = chanEBEven[couple];
1200 coupleOfPMTs.second = chanEBOdd[couple];
1203 return coupleOfPMTs;