705 {
706
708
709
732
733
735
736
737
738
747
748 const unsigned int lumiBlock = eventInfo.
lumiBlock();
750 auto good_bcid = eventInfo.
bcid();
751
754
755 ATH_CHECK( checkTRTReadoutIntegrity(eventInfo) );
756 int numberOfStacks_b[2];
757 numberOfStacks_b[0] = s_numberOfBarrelStacks * 3;
758 numberOfStacks_b[1] = s_numberOfEndCapStacks * 2;
760 int numberOfStrawsMod[3];
761 numberOfStrawsMod[0] = 329;
762 numberOfStrawsMod[1] = 520;
763 numberOfStrawsMod[2] = 793;
764 int numberOfStrawsWheel[2];
765 numberOfStrawsWheel[0] = 2304;
766 numberOfStrawsWheel[1] = 1536;
767 int moduleHits_B[192];
768 int moduleHits_E[128];
769 int HLmoduleHits_B[192];
770 int HLmoduleHits_E[128];
771 int nHitsperLB_B = 0;
772 int nHLHitsperLB_B = 0;
773 int nHitsperLB_E[2] = {0, 0};
774 int nHLHitsperLB_E[2] = {0, 0};
775
776 for (
int i = 0;
i < 192;
i++) {
778 HLmoduleHits_B[
i] = 0;
779 }
780
781 for (
int i = 0;
i < 128;
i++) {
783 HLmoduleHits_E[
i] = 0;
784 }
785
786 auto scale_hHitWMap_B_passed = std::make_unique<short int[][s_Straw_max[0]]>(2);
787 auto scale_hHitWMap_E_passed = std::make_unique<short int[][2][s_Straw_max[1]]>(2);
788
789 auto scale_hHitHWMapS_B_passed = std::make_unique<short int[][s_Straw_max[0]]>(s_numberOfBarrelStacks*2);
790 auto scale_hHitHWMapC_B_passed = std::make_unique<short int[][s_iChip_max[0]]>(s_numberOfBarrelStacks*2);
791 auto scale_hHitWMapS_B_passed = std::make_unique<short int[][s_Straw_max[0]]>(s_numberOfBarrelStacks*2);
792 auto scale_hHitWMapC_B_passed = std::make_unique<short int[][s_iChip_max[0]]>(s_numberOfBarrelStacks*2);
793 auto scale_hHitAMapS_B_passed = std::make_unique<short int[][s_Straw_max[0]]>(s_numberOfBarrelStacks*2);
794 auto scale_hHitAMapC_B_passed = std::make_unique<short int[][s_iChip_max[0]]>(s_numberOfBarrelStacks*2);
795 auto scale_hHitAWMapS_B_passed = std::make_unique<short int[][s_Straw_max[0]]>(s_numberOfBarrelStacks*2);
796 auto scale_hHitAWMapC_B_passed = std::make_unique<short int[][s_iChip_max[0]]>(s_numberOfBarrelStacks*2);
797 auto scale_hHitHMapS_B_passed = std::make_unique<short int[][s_Straw_max[0]]>(s_numberOfBarrelStacks*2);
798 auto scale_hHitHMapC_B_passed = std::make_unique<short int[][s_iChip_max[0]]>(s_numberOfBarrelStacks*2);
799
800 auto scale_hHitHWMapS_E_passed = std::make_unique<short int[][s_Straw_max[1]]>(s_numberOfEndCapStacks*2);
801 auto scale_hHitHWMapC_E_passed = std::make_unique<short int[][s_iChip_max[1]]>(s_numberOfEndCapStacks*2);
802 auto scale_hHitWMapS_E_passed = std::make_unique<short int[][s_Straw_max[1]]>(s_numberOfEndCapStacks*2);
803 auto scale_hHitWMapC_E_passed = std::make_unique<short int[][s_iChip_max[1]]>(s_numberOfEndCapStacks*2);
804 auto scale_hHitAMapS_E_passed = std::make_unique<short int[][s_Straw_max[1]]>(s_numberOfEndCapStacks*2);
805 auto scale_hHitAMapC_E_passed = std::make_unique<short int[][s_iChip_max[1]]>(s_numberOfEndCapStacks*2);
806 auto scale_hHitAWMapS_E_passed = std::make_unique<short int[][s_Straw_max[1]]>(s_numberOfEndCapStacks*2);
807 auto scale_hHitAWMapC_E_passed = std::make_unique<short int[][s_iChip_max[1]]>(s_numberOfEndCapStacks*2);
808 auto scale_hHitHMapS_E_passed = std::make_unique<short int[][s_Straw_max[1]]>(s_numberOfEndCapStacks*2);
809 auto scale_hHitHMapC_E_passed = std::make_unique<short int[][s_iChip_max[1]]>(s_numberOfEndCapStacks*2);
810
811 int goodid_status = 0;
812 int prev_bcid = 0;
813
814 if (trtBCIDCollection) {
815 InDetTimeCollection::const_iterator itrt_bcid = trtBCIDCollection->begin();
816
817 while (goodid_status == 0 && itrt_bcid != trtBCIDCollection->end()) {
818
819 const unsigned int trt_bcid = (*itrt_bcid).second;
820
821 if (itrt_bcid > trtBCIDCollection->begin() && prev_bcid - trt_bcid == 0) {
822 goodid_status = 1;
823 } else if (itrt_bcid > trtBCIDCollection->begin() && prev_bcid - trt_bcid != 0) {
825 std::hex << (*itrt_bcid).first << " trt bcid from ROD is " <<
826 std::hex << trt_bcid);
827 }
828
829 prev_bcid = trt_bcid;
830 ++itrt_bcid;
831 }
832 }
833
834
835 if (!
m_sumTool.name().empty() && m_doExpert) {
838 }
839
840
842 for (int ibe = 0; ibe < 2; ibe++) {
844
845
846
847
848 }
849
850 int nhitsall = 0;
851
852 std::map<int,std::map<int, std::vector<straw_struct>>> straw_map;
853 std::map<int,std::map<int, std::vector<chip_struct>>> chip_map;
854 std::map<int,std::vector<straw_shifter_struct>> straw_shifter_map;
855 std::map<int,std::map<int, std::vector<straw_struct_prob>>> straw_map_prob;
856 std::map<int,std::map<int, std::vector<chip_struct_prob>>> chip_map_prob;
857
858 std::vector<std::vector<std::vector<int>>> scale_hHitWMap =
initScaleVectors(ctx);
859
860 for (; RDO_CollectionBegin != RDO_CollectionEnd; ++RDO_CollectionBegin) {
861 const InDetRawDataCollection<TRT_RDORawData> *TRT_Collection(*RDO_CollectionBegin);
862
863 if (!TRT_Collection) continue;
864
866
867 for (; p_rdo != TRT_Collection->end(); ++p_rdo) {
868 int middleHTbit = (*p_rdo)->getWord() & 0x00020000;
869
870 int hitinvaliditygate = (*p_rdo)->getWord() & 0x000DFE80;
871
872 bool is_middleHTbit_high = (middleHTbit != 0);
873 bool is_anybininVgate_high = (hitinvaliditygate != 0);
874 TRT_Identifier = (*p_rdo)->identify();
875
876 if (m_doMaskStraws &&
m_sumTool->get_status(TRT_Identifier, ctx))
continue;
877
879
880 const TRT_LoLumRawData *p_lolum = dynamic_cast<const TRT_LoLumRawData *>(*p_rdo);
881
882 if (!p_lolum) continue;
883
884 nhitsall++;
885 int ibe = abs(barrel_ec) - 1;
886 int iside = barrel_ec > 0 ? 0 : 1;
887
888
889 if (ibe != 1 && ibe != 0) {
890 ATH_MSG_DEBUG(
"TRT part retrieved from TRT Identifier is not a barrel or an endcap");
891 continue;
892 }
893
894 int moduleNumber_barrel1[2];
895 int moduleNumber_barrel2[2];
896 int moduleNumber_barrel3[2];
897 int moduleNumber_endcapA[2];
898 int moduleNumber_endcapB[2];
899
900
901
902 TRT_Identifier = p_lolum->
identify();
903
909 int thisStrawNumber;
910 int chip = 0;
911 int board = -1;
912
914
915
916 if ( is_barrel && ibe == 0 ) {
917 thisStrawNumber =
strawNumber(straw, straw_layer, layer_or_wheel);
918
919 if (thisStrawNumber >= 0 && thisStrawNumber < s_Straw_max[ibe]) {
921 }
922
924
925 } else if ( !is_barrel && ibe == 1 ) {
926 thisStrawNumber =
strawNumberEndCap(straw, straw_layer, layer_or_wheel, phi_module, barrel_ec);
927
928 if (thisStrawNumber >= 0 && thisStrawNumber < s_Straw_max[ibe]) {
930 }
931
933 } else {
934 thisStrawNumber = -1;
935 }
936
937 if (thisStrawNumber < 0 || thisStrawNumber >= s_Straw_max[ibe]) {
938 ATH_MSG_WARNING(
"Found m_strawNumber = " << thisStrawNumber <<
" out of range.");
939 continue;
940 }
943 const bool highlevel = is_middleHTbit_high;
947 moduleNumber_barrel1[0] = phi_module;
948 moduleNumber_barrel1[1] = phi_module + 96;
950 moduleNumber_barrel2[1] = phi_module + s_numberOfBarrelStacks + 96;
951 moduleNumber_barrel3[0] = phi_module + 2*s_numberOfBarrelStacks;
952 moduleNumber_barrel3[1] = phi_module + 2*s_numberOfBarrelStacks + 96;
953 moduleNumber_endcapA[0] = phi_module;
954 moduleNumber_endcapA[1] = phi_module + 64;
956 moduleNumber_endcapB[1] = phi_module + s_numberOfEndCapStacks + 64;
957 int iphi_module = -999;
958
959 if (iside == 0) {
960 iphi_module = phi_module;
961 } else if (iside == 1) {
962 iphi_module = phi_module + 32;
963 }
964
965 if (m_doStraws) {
966 straw_shifter_struct& this_struct = straw_shifter_map[barrel_ec].emplace_back();
968 this_struct.
isAr = isArgonStraw;
971 if (abs(barrel_ec) == 1) scale_hHitWMap_B_passed[isArgonStraw ? 1 : 0][thisStrawNumber]++;
972 if (abs(barrel_ec) == 2) scale_hHitWMap_E_passed[barrel_ec < 0 ? 1 : 0][isArgonStraw ? 1 : 0][thisStrawNumber]++;
973 }
974
976 if (ibe == 0) {
977
978 if (m_doShift) {
979 nHitsperLB_B++;
980
981 if (highlevel) {
982 nHLHitsperLB_B++;
983 }
984 }
985 } else if (ibe == 1) {
987
988 if (m_doShift) {
989 nHitsperLB_E[iside]++;
990
991 if (highlevel) {
992 nHLHitsperLB_E[iside]++;
993 }
994 }
995 }
996
997 if (m_doExpert) {
998 if (m_doStraws) {
999 straw_struct_prob& this_struct = straw_map_prob[ibe][iphi_module].emplace_back();
1001 this_struct.
HitHWMapS_cut = highlevel && is_middleHTbit_high;
1011 if (ibe == 0) {
1012 if (highlevel && is_middleHTbit_high) scale_hHitHWMapS_B_passed[iphi_module][thisStrawNumber]++;
1015 if (is_anybininVgate_high) scale_hHitAWMapS_B_passed[iphi_module][thisStrawNumber]++;
1016 if (highlevel) scale_hHitHMapS_B_passed[iphi_module][thisStrawNumber]++;
1017 }
1018 if (ibe == 1) {
1019 if (highlevel && is_middleHTbit_high) scale_hHitHWMapS_E_passed[iphi_module][thisStrawNumber]++;
1022 if (is_anybininVgate_high) scale_hHitAWMapS_E_passed[iphi_module][thisStrawNumber]++;
1023 if (highlevel) scale_hHitHMapS_E_passed[iphi_module][thisStrawNumber]++;
1024 }
1025 }
1026
1028
1029 if (m_doStraws) {
1030 straw_struct& this_struct = straw_map[ibe][iphi_module].emplace_back();
1037
1038 if (highlevel) {
1039 HtoLMapS = thisStrawNumber;
1040 HtoLMapS_passed = 1.0;
1041 fill(
"RDOStackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HtoLMapS_passed, HtoLMapS);
1042 } else {
1043 HtoLMapS = thisStrawNumber;
1044 HtoLMapS_passed = 0.0;
1045 fill(
"RDOStackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HtoLMapS_passed, HtoLMapS);
1046 }
1047 }
1048
1049 if (m_doChips) {
1050 chip_struct_prob& this_struct = chip_map_prob[ibe][iphi_module].emplace_back();
1052 this_struct.
HitHWMapC_cut = highlevel && is_middleHTbit_high;
1062 if (ibe == 0) {
1063 if (highlevel && is_middleHTbit_high) scale_hHitHWMapC_B_passed[iphi_module][chip - 1]++;
1066 if (is_anybininVgate_high) scale_hHitAWMapC_B_passed[iphi_module][chip - 1]++;
1067 if (highlevel) scale_hHitHMapC_B_passed[iphi_module][chip - 1]++;
1068 }
1069 if (ibe == 1) {
1070 if (highlevel && is_middleHTbit_high) scale_hHitHWMapC_E_passed[iphi_module][chip - 1]++;
1073 if (is_anybininVgate_high) scale_hHitAWMapC_E_passed[iphi_module][chip - 1]++;
1074 if (highlevel) scale_hHitHMapC_E_passed[iphi_module][chip - 1]++;
1075 }
1076 }
1077
1078 if (m_doChips) {
1079 chip_struct& this_struct = chip_map[ibe][iphi_module].emplace_back();
1092 }
1093
1098 }
1099
1104 }
1105
1106 if (highlevel) {
1107 HtoLMapC = chip - 1;
1108 HtoLMapC_passed = 1.0;
1109 fill(
"RDOStackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HtoLMapC_passed, HtoLMapC);
1110 } else {
1111 HtoLMapC = chip - 1;
1112 HtoLMapC_passed = 0.0;
1113 fill(
"RDOStackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HtoLMapC_passed, HtoLMapC);
1114 }
1115 }
1116 }
1117
1118
1119 int moduleNumber = -1;
1120
1121 if (ibe == 0) {
1122 if (layer_or_wheel == 0) {
1123 moduleNumber = moduleNumber_barrel1[iside];
1124 moduleHits_B[moduleNumber]++;
1125 } else if (layer_or_wheel == 1) {
1126 moduleNumber = moduleNumber_barrel2[iside];
1127 moduleHits_B[moduleNumber]++;
1128 } else if (layer_or_wheel == 2) {
1129 moduleNumber = moduleNumber_barrel3[iside];
1130 moduleHits_B[moduleNumber]++;
1131 }
1132
1133 if (highlevel) {
1134 if (layer_or_wheel == 0) {
1135 moduleNumber = moduleNumber_barrel1[iside];
1136 HLmoduleHits_B[moduleNumber]++;
1137 } else if (layer_or_wheel == 1) {
1138 moduleNumber = moduleNumber_barrel2[iside];
1139 HLmoduleHits_B[moduleNumber]++;
1140 } else if (layer_or_wheel == 2) {
1141 moduleNumber = moduleNumber_barrel3[iside];
1142 HLmoduleHits_B[moduleNumber]++;
1143 }
1144 }
1145 } else if (ibe == 1) {
1146 if (layer_or_wheel < 6) {
1147 moduleNumber = moduleNumber_endcapA[iside];
1148 moduleHits_E[moduleNumber]++;
1149 } else if (layer_or_wheel > 5) {
1150 moduleNumber = moduleNumber_endcapB[iside];
1151 moduleHits_E[moduleNumber]++;
1152 }
1153
1154 if (highlevel) {
1155 if (layer_or_wheel < 6) {
1156 moduleNumber = moduleNumber_endcapA[iside];
1157 HLmoduleHits_E[moduleNumber]++;
1158 } else if (layer_or_wheel > 5) {
1159 moduleNumber = moduleNumber_endcapB[iside];
1160 HLmoduleHits_E[moduleNumber]++;
1161 }
1162 }
1163 }
1164 }
1165 }
1166
1167
1169 for (int iGas = 0; iGas < 2; iGas++) {
1170 try {
1171 if (scale_hHitWMap[0][iGas].at(k) - scale_hHitWMap_B_passed[iGas][k] >= 0) {
1172 for (int j = 0; j < scale_hHitWMap[0][iGas].at(k) - scale_hHitWMap_B_passed[iGas][k]; j++) {
1173 if (m_doStraws) {
1174 straw_shifter_struct& this_struct = straw_shifter_map[1].emplace_back();
1176 this_struct.
isAr = iGas > 0 ? true :
false;
1179 }
1180 }
1181 } else {
1182 ATH_MSG_ERROR(
"Scale value " << scale_hHitWMap[0][iGas].at(k) - scale_hHitWMap_B_passed[iGas][k] <<
1183 " is less than zero in scaling for Barrel, iGas = " << iGas << ", k = " << k);
1184 }
1185 } catch (out_of_range &e) {
1186 ATH_MSG_ERROR(
"Index " << k <<
" out of range in scaling for Barrel");
1187 }
1188 }
1189 }
1190
1191
1192 for (
int k = 0;
k < s_Straw_max[1];
k++) {
1193 for (int iside = 0; iside < 2; iside++) {
1194 for (int iGas = 0; iGas < 2; iGas++) {
1195 try {
1196 if (scale_hHitWMap[iside + 1][iGas].at(k) - scale_hHitWMap_E_passed[iside][iGas][k] >= 0) {
1197 for (int j = 0; j < scale_hHitWMap[iside + 1][iGas].at(k) - scale_hHitWMap_E_passed[iside][iGas][k]; j++) {
1198 if (m_doStraws) {
1199 straw_shifter_struct& this_struct = straw_shifter_map[iside == 0 ? 2 : -2].emplace_back();
1201 this_struct.
isAr = iGas > 0 ? true :
false;
1204 }
1205 }
1206 } else {
1207 ATH_MSG_ERROR(
"Scale value " << scale_hHitWMap[iside + 1][iGas].at(k) - scale_hHitWMap_E_passed[iside][iGas][k] <<
1208 " is less than zero in scaling for Endcap, iside = " << iside << ", iGas = " << iGas << ", k = " << k);
1209 }
1210 } catch (out_of_range &e) {
1211 ATH_MSG_ERROR(
"Index " << k <<
" out of range in scaling for Endcap");
1212 }
1213 }
1214 }
1215 }
1216
1217 if (m_doExpert) {
1218
1219 for (
int k = 0;
k < s_Straw_max[0];
k++) {
1220 for (int iside = 0; iside < 2; iside++) {
1221 for (int phi_module = 0; phi_module < s_numberOfBarrelStacks; phi_module++) {
1222 int iphi_module = -999;;
1223 if (iside == 0) iphi_module = phi_module; else if (iside == 1) iphi_module = phi_module + 32;
1224 if (scale_hHitHWMapS_B_passed[iphi_module][k] < 2 || scale_hHitWMapS_B_passed[iphi_module][k] < 2 ||
1225 scale_hHitAMapS_B_passed[iphi_module][k] < 2 || scale_hHitAWMapS_B_passed[iphi_module][k] < 2 ||
1226 scale_hHitHMapS_B_passed[iphi_module][k] < 2) {
1227 for (
int l = 0;
l < 1 - scale_hHitHWMapS_B_passed[iphi_module][
k];
l++){
1228 straw_struct_prob& this_struct = straw_map_prob[0][iphi_module].emplace_back();
1232 }
1233 for (
int l = 0;
l < 1 - scale_hHitWMapS_B_passed[iphi_module][
k];
l++){
1234 straw_struct_prob& this_struct = straw_map_prob[0][iphi_module].emplace_back();
1238 }
1239 for (
int l = 0;
l < 1 - scale_hHitAMapS_B_passed[iphi_module][
k];
l++){
1240 straw_struct_prob& this_struct = straw_map_prob[0][iphi_module].emplace_back();
1244 }
1245 for (
int l = 0;
l < 1 - scale_hHitAWMapS_B_passed[iphi_module][
k];
l++){
1246 straw_struct_prob& this_struct = straw_map_prob[0][iphi_module].emplace_back();
1250 }
1251 for (
int l = 0;
l < 1 - scale_hHitHMapS_B_passed[iphi_module][
k];
l++){
1252 straw_struct_prob& this_struct = straw_map_prob[0][iphi_module].emplace_back();
1256 }
1257 } else{
1258 ATH_MSG_ERROR(
"Scale value is less than zero in normalization for Barrel straw!");
1259 }
1260 }
1261 }
1262 }
1263
1264
1266 for (int iside = 0; iside < 2; iside++) {
1267 for (int phi_module = 0; phi_module < s_numberOfBarrelStacks; phi_module++) {
1268 int iphi_module = -999;;
1269 if (iside == 0) iphi_module = phi_module; else if (iside == 1) iphi_module = phi_module + 32;
1270 if (scale_hHitHWMapC_B_passed[iphi_module][k] < 17 || scale_hHitWMapC_B_passed[iphi_module][k] < 17 ||
1271 scale_hHitAMapC_B_passed[iphi_module][k] < 17 || scale_hHitAWMapC_B_passed[iphi_module][k] < 17 ||
1272 scale_hHitHMapC_B_passed[iphi_module][k] < 17) {
1273 for (
int l = 0;
l < 16*1. - scale_hHitHWMapC_B_passed[iphi_module][
k];
l++){
1274 chip_struct_prob& this_struct = chip_map_prob[0][iphi_module].emplace_back();
1278 }
1279 for (
int l = 0;
l < 16*1. - scale_hHitWMapC_B_passed[iphi_module][
k];
l++){
1280 chip_struct_prob& this_struct = chip_map_prob[0][iphi_module].emplace_back();
1284 }
1285 for (
int l = 0;
l < 16*1. - scale_hHitAMapC_B_passed[iphi_module][
k];
l++){
1286 chip_struct_prob& this_struct = chip_map_prob[0][iphi_module].emplace_back();
1290 }
1291 for (
int l = 0;
l < 16*1. - scale_hHitAWMapC_B_passed[iphi_module][
k];
l++){
1292 chip_struct_prob& this_struct = chip_map_prob[0][iphi_module].emplace_back();
1296 }
1297 for (
int l = 0;
l < 16*1. - scale_hHitHMapC_B_passed[iphi_module][
k];
l++){
1298 chip_struct_prob& this_struct = chip_map_prob[0][iphi_module].emplace_back();
1302 }
1303 } else{
1304 ATH_MSG_ERROR(
"Scale value is less than zero in normalization for Barrel chip!");
1305 }
1306 }
1307 }
1308 }
1309
1310
1311 for (
int k = 0;
k < s_Straw_max[1];
k++) {
1312 for (int iside = 0; iside < 2; iside++) {
1313 for (int phi_module = 0; phi_module < s_numberOfEndCapStacks; phi_module++) {
1314 int iphi_module = -999;;
1315 if (iside == 0) iphi_module = phi_module; else if (iside == 1) iphi_module = phi_module + 32;
1316 if (scale_hHitHWMapS_E_passed[iphi_module][k] < 2 || scale_hHitWMapS_E_passed[iphi_module][k] < 2 ||
1317 scale_hHitAMapS_E_passed[iphi_module][k] < 2 || scale_hHitAWMapS_E_passed[iphi_module][k] < 2 ||
1318 scale_hHitHMapS_E_passed[iphi_module][k] < 2) {
1319 for (
int l = 0;
l < 1. - scale_hHitHWMapS_E_passed[iphi_module][
k];
l++){
1320 straw_struct_prob& this_struct = straw_map_prob[1][iphi_module].emplace_back();
1324 }
1325 for (
int l = 0;
l < 1. - scale_hHitWMapS_E_passed[iphi_module][
k];
l++){
1326 straw_struct_prob& this_struct = straw_map_prob[1][iphi_module].emplace_back();
1330 }
1331 for (
int l = 0;
l < 1. - scale_hHitAMapS_E_passed[iphi_module][
k];
l++){
1332 straw_struct_prob& this_struct = straw_map_prob[1][iphi_module].emplace_back();
1336 }
1337 for (
int l = 0;
l < 1. - scale_hHitAWMapS_E_passed[iphi_module][
k];
l++){
1338 straw_struct_prob& this_struct = straw_map_prob[1][iphi_module].emplace_back();
1342 }
1343 for (
int l = 0;
l < 1. - scale_hHitHMapS_E_passed[iphi_module][
k];
l++){
1344 straw_struct_prob& this_struct = straw_map_prob[1][iphi_module].emplace_back();
1348 }
1349 } else{
1350 ATH_MSG_ERROR(
"Scale value is less than zero in normalization for Endcap straw!");
1351 }
1352 }
1353 }
1354 }
1355
1356
1357 for (
int k = 0;
k < s_iChip_max[1];
k++) {
1358 for (int iside = 0; iside < 2; iside++) {
1359 for (int phi_module = 0; phi_module < s_numberOfEndCapStacks; phi_module++) {
1360 int iphi_module = -999;;
1361 if (iside == 0) iphi_module = phi_module; else if (iside == 1) iphi_module = phi_module + 32;
1362 if (scale_hHitHWMapC_E_passed[iphi_module][k] < 17 || scale_hHitWMapC_E_passed[iphi_module][k] < 17 ||
1363 scale_hHitAMapC_E_passed[iphi_module][k] < 17 || scale_hHitAWMapC_E_passed[iphi_module][k] < 17 ||
1364 scale_hHitHMapC_E_passed[iphi_module][k] < 17) {
1365 for (
int l = 0;
l < 16*1. - scale_hHitHWMapC_E_passed[iphi_module][
k];
l++){
1366 chip_struct_prob& this_struct = chip_map_prob[1][iphi_module].emplace_back();
1370 }
1371 for (
int l = 0;
l < 16*1. - scale_hHitWMapC_E_passed[iphi_module][
k];
l++){
1372 chip_struct_prob& this_struct = chip_map_prob[1][iphi_module].emplace_back();
1376 }
1377 for (
int l = 0;
l < 16*1. - scale_hHitAMapC_E_passed[iphi_module][
k];
l++){
1378 chip_struct_prob& this_struct = chip_map_prob[1][iphi_module].emplace_back();
1382 }
1383 for (
int l = 0;
l < 16*1. - scale_hHitAWMapC_E_passed[iphi_module][
k];
l++){
1384 chip_struct_prob& this_struct = chip_map_prob[1][iphi_module].emplace_back();
1388 }
1389 for (
int l = 0;
l < 16*1. - scale_hHitHMapC_E_passed[iphi_module][
k];
l++){
1390 chip_struct_prob& this_struct = chip_map_prob[1][iphi_module].emplace_back();
1394 }
1395 } else{
1396 ATH_MSG_ERROR(
"Scale value is less than zero in normalization for Endcap chip!");
1397 }
1398 }
1399 }
1400 }
1401 }
1402
1403 for (const auto& ibarrel_ecpair : straw_shifter_map) {
1404 int ibe = abs(ibarrel_ecpair.first) - 1;
1405 int iside = ibarrel_ecpair.first > 0 ? 0 : 1;
1407 auto HitWMap_passed =
Monitored::Collection(
"HitWMap_passed", ibarrel_ecpair.second, [](
const auto& s){return s.HitWMap_passed;});
1408 auto HitWMap_Ar_passed =
Monitored::Collection(
"HitWMap_Ar_passed", ibarrel_ecpair.second, [](
const auto& s){return s.HitWMap_Ar_passed;});
1409 auto isAr =
Monitored::Collection(
"isAr", ibarrel_ecpair.second, [](
const auto& s){return s.isAr;});
1410 auto isNotAr =
Monitored::Collection(
"isNotAr", ibarrel_ecpair.second, [](
const auto& s){return not s.isAr;});
1411 if (ibe == 0) {
1412 fill(
"RDOHistograms0", strawNumber, HitWMap_passed, HitWMap_Ar_passed, isAr, isNotAr);
1413 } else if (ibe == 1) {
1414 fill(
"RDOHistograms1"+std::to_string(iside), strawNumber, HitWMap_passed, HitWMap_Ar_passed, isAr, isNotAr);
1415 }
1416 }
1417
1418 if (m_doExpert) {
1419 for (const auto& ibepair : straw_map_prob) {
1420 for (const auto& iphi_modulepair : ibepair.second ) {
1422 auto HitHWMapS_passed =
Monitored::Collection(
"HitHWMapS_passed", iphi_modulepair.second, [](
const auto& s){return s.HitHWMapS_passed;});
1423 auto HitWMapS_passed =
Monitored::Collection(
"HitWMapS_passed", iphi_modulepair.second, [](
const auto& s){return s.HitWMapS_passed;});
1424 auto HitAMapS_passed =
Monitored::Collection(
"HitAMapS_passed", iphi_modulepair.second, [](
const auto& s){return s.HitAMapS_passed;});
1425 auto HitAWMapS_passed =
Monitored::Collection(
"HitAWMapS_passed", iphi_modulepair.second, [](
const auto& s){return s.HitAWMapS_passed;});
1426 auto HitHMapS_passed =
Monitored::Collection(
"HitHMapS_passed", iphi_modulepair.second, [](
const auto& s){return s.HitHMapS_passed;});
1427 auto HitHWMapS_cut =
Monitored::Collection(
"HitHWMapS_cut", iphi_modulepair.second, [](
const auto& s){return s.HitHWMapS_cut;});
1428 auto HitWMapS_cut =
Monitored::Collection(
"HitWMapS_cut", iphi_modulepair.second, [](
const auto& s){return s.HitWMapS_cut;});
1429 auto HitAMapS_cut =
Monitored::Collection(
"HitAMapS_cut", iphi_modulepair.second, [](
const auto& s){return s.HitAMapS_cut;});
1430 auto HitAWMapS_cut =
Monitored::Collection(
"HitAWMapS_cut", iphi_modulepair.second, [](
const auto& s){return s.HitAWMapS_cut;});
1431 auto HitHMapS_cut =
Monitored::Collection(
"HitHMapS_cut", iphi_modulepair.second, [](
const auto& s){return s.HitHMapS_cut;});
1432
1433 fill(
"RDOStackHistograms"+std::to_string(ibepair.first)+std::to_string(iphi_modulepair.first), strawNumber, HitHWMapS_passed, HitHWMapS_cut,
1434 HitWMapS_passed, HitWMapS_cut, HitAMapS_passed, HitAMapS_cut, HitAWMapS_passed, HitAWMapS_cut, HitHMapS_passed, HitHMapS_cut);
1435 }
1436 }
1437
1438 for (const auto& ibepair : chip_map_prob) {
1439 for (const auto& iphi_modulepair : ibepair.second ) {
1440 auto chipNumber =
Monitored::Collection(
"chipNumber", iphi_modulepair.second, [](
const auto& s){return s.chipNumber;});
1441 auto HitHWMapC_passed =
Monitored::Collection(
"HitHWMapC_passed", iphi_modulepair.second, [](
const auto& s){return s.HitHWMapC_passed;});
1442 auto HitWMapC_passed =
Monitored::Collection(
"HitWMapC_passed", iphi_modulepair.second, [](
const auto& s){return s.HitWMapC_passed;});
1443 auto HitAMapC_passed =
Monitored::Collection(
"HitAMapC_passed", iphi_modulepair.second, [](
const auto& s){return s.HitAMapC_passed;});
1444 auto HitAWMapC_passed =
Monitored::Collection(
"HitAWMapC_passed", iphi_modulepair.second, [](
const auto& s){return s.HitAWMapC_passed;});
1445 auto HitHMapC_passed =
Monitored::Collection(
"HitHMapC_passed", iphi_modulepair.second, [](
const auto& s){return s.HitHMapC_passed;});
1446 auto HitHWMapC_cut =
Monitored::Collection(
"HitHWMapC_cut", iphi_modulepair.second, [](
const auto& s){return s.HitHWMapC_cut;});
1447 auto HitWMapC_cut =
Monitored::Collection(
"HitWMapC_cut", iphi_modulepair.second, [](
const auto& s){return s.HitWMapC_cut;});
1448 auto HitAMapC_cut =
Monitored::Collection(
"HitAMapC_cut", iphi_modulepair.second, [](
const auto& s){return s.HitAMapC_cut;});
1449 auto HitAWMapC_cut =
Monitored::Collection(
"HitAWMapC_cut", iphi_modulepair.second, [](
const auto& s){return s.HitAWMapC_cut;});
1450 auto HitHMapC_cut =
Monitored::Collection(
"HitHMapC_cut", iphi_modulepair.second, [](
const auto& s){return s.HitHMapC_cut;});
1451
1452 fill(
"RDOStackHistograms"+std::to_string(ibepair.first)+std::to_string(iphi_modulepair.first), chipNumber, HitHWMapC_passed, HitHWMapC_cut,
1453 HitWMapC_passed, HitWMapC_cut, HitAMapC_passed, HitAMapC_cut, HitAWMapC_passed, HitAWMapC_cut, HitHMapC_passed, HitHMapC_cut);
1454 }
1455 }
1456 }
1457
1458 for (const auto& ibepair : straw_map) {
1459 for (const auto& iphi_modulepair : ibepair.second ) {
1461 auto HitTrMapS_y =
Monitored::Collection(
"HitTrMapS_y", iphi_modulepair.second, [](
const auto& s){return s.HitTrMapS_y;});
1462 auto HitToTMapS_y =
Monitored::Collection(
"HitToTMapS_y", iphi_modulepair.second, [](
const auto& s){return s.HitToTMapS_y;});
1463 auto HitToTLong_cut =
Monitored::Collection(
"HitToTLong_cut", iphi_modulepair.second, [](
const auto& s){return s.HitToTLong_cut;});
1464 auto HitTrWMapS_y =
Monitored::Collection(
"HitTrWMapS_y", iphi_modulepair.second, [](
const auto& s){return s.HitTrWMapS_y;});
1465 auto HitTrWMapS_cut =
Monitored::Collection(
"HitTrWMapS_cut", iphi_modulepair.second, [](
const auto& s){return s.HitTrWMapS_cut;});
1466
1467 fill(
"RDOStackHistograms"+std::to_string(ibepair.first)+std::to_string(iphi_modulepair.first), strawNumber,
1468 HitTrMapS_y, HitToTMapS_y, HitToTLong_cut, HitTrWMapS_y, HitTrWMapS_cut);
1469 }
1470 }
1471
1472 for (const auto& ibepair : chip_map) {
1473 for (const auto& iphi_modulepair : ibepair.second ) {
1474 auto chipNumber =
Monitored::Collection(
"chipNumber", iphi_modulepair.second, [](
const auto& s){return s.chipNumber;});
1475 auto HitTrMapC_y =
Monitored::Collection(
"HitTrMapC_y", iphi_modulepair.second, [](
const auto& s){return s.HitTrMapC_y;});
1476 auto HitToTMapC_y =
Monitored::Collection(
"HitToTMapC_y", iphi_modulepair.second, [](
const auto& s){return s.HitToTMapC_y;});
1477 auto HtoBCMapC_x =
Monitored::Collection(
"HtoBCMapC_x", iphi_modulepair.second, [](
const auto& s){return s.HtoBCMapC_x;});
1478 auto HtoBCMapB_x =
Monitored::Collection(
"HtoBCMapB_x", iphi_modulepair.second, [](
const auto& s){return s.HtoBCMapB_x;});
1479 auto HtoBCMapB_y =
Monitored::Collection(
"HtoBCMapB_y", iphi_modulepair.second, [](
const auto& s){return s.HtoBCMapB_y;});
1480 auto HtoBCMap_cut =
Monitored::Collection(
"HtoBCMap_cut", iphi_modulepair.second, [](
const auto& s){return s.HtoBCMap_cut;});
1481 auto HitTrWMapC_cut =
Monitored::Collection(
"HitTrWMapC_cut", iphi_modulepair.second, [](
const auto& s){return s.HitTrWMapC_cut;});
1482
1483 fill(
"RDOStackHistograms"+std::to_string(ibepair.first)+std::to_string(iphi_modulepair.first),
1484 chipNumber, HitTrMapC_y, HitToTMapC_y, HtoBCMapC_x, HtoBCMapB_x, HtoBCMapB_y, HtoBCMap_cut, HitTrWMapC_cut);
1485 }
1486 }
1487
1488 OccAll = nhitsall/350848.;
1489 fill(
"RDOHistograms0", OccAll);
1490
1491
1492 for (int ibe = 0; ibe < 2; ibe++) {
1493 if (m_doShift) {
1494 if (ibe == 0) {
1495 BCIDvsOcc_x = good_bcid;
1496 BCIDvsOcc_y =
nTRTHits[ibe]/105088.0;
1497 fill(
"RDOHistograms0", BCIDvsOcc_x, BCIDvsOcc_y);
1498 } else if (ibe == 1) {
1499 BCIDvsOcc_x = good_bcid;
1500 BCIDvsOcc_y =
nTRTHits[ibe]/245760.0;
1501 fill(
"RDOHistograms1", BCIDvsOcc_x, BCIDvsOcc_y);
1502 }
1503
1504 for (int iside = 0; iside < 2; iside++) {
1505 for (
int i = 1;
i <= numberOfStacks_b[ibe];
i++) {
1506
1507 int index_tmp = 0;
1508 int modulenum_tmp = 0;
1509
1510 if (iside == 0) {
1512 modulenum_tmp =
i - 1;
1513 } else if (iside == 1) {
1515
1516 if (ibe == 0) modulenum_tmp = (
i - 1) + 96;
1517 else if (ibe == 1) modulenum_tmp = (
i - 1) + 64;
1518 }
1519
1520 int nclass = -1;
1521
1522 if (i <= s_numberOfBarrelStacks) {
1523 nclass = 0;
1524 } else if (i <= 2 * s_numberOfBarrelStacks && i > s_numberOfBarrelStacks) {
1525 nclass = 1;
1526 } else if (i > 2 * s_numberOfBarrelStacks) {
1527 nclass = 2;
1528 }
1529 int LLocc_index = index_tmp - 32 * nclass;
1530
1531 if (nclass >= 0) {
1532 if (ibe == 0) {
1533
1535 float occLL =
float(moduleHits_B[modulenum_tmp]) /
float(numberOfStrawsMod[nclass]);
1536 float occHL =
float(HLmoduleHits_B[modulenum_tmp]) /
float(numberOfStrawsMod[nclass]);
1537 AvgLLOcc_side_x =
i - (32 * nclass);
1538 AvgLLOcc_side_y = occLL;
1539 AvgHLOcc_side_x =
i - (32 * nclass);
1540 AvgHLOcc_side_y = occHL;
1541 AvgLLOccMod_side_x =
i;
1542 AvgLLOccMod_side_y = occLL;
1543 AvgHLOccMod_side_x =
i;
1544 AvgHLOccMod_side_y = occHL;
1545 } else if (ibe == 1) {
1546 float occLL =
float(moduleHits_E[modulenum_tmp]) /
float(numberOfStrawsWheel[nclass]);
1547 float occHL =
float(HLmoduleHits_E[modulenum_tmp]) /
float(numberOfStrawsWheel[nclass]);
1548
1549 if (LLocc_index < 64) {
1550 } else {
1552 }
1553 AvgLLOcc_side_x =
i - (32 * nclass);
1554 AvgLLOcc_side_y = occLL;
1555 AvgHLOcc_side_x =
i - (32 * nclass);
1556 AvgHLOcc_side_y = occHL;
1557 AvgLLOccMod_side_x =
i;
1558 AvgLLOccMod_side_y = occLL;
1559 AvgHLOccMod_side_x =
i;
1560 AvgHLOccMod_side_y = occHL;
1561 }
1562 fill(
"RDOLLHLOccHistograms"+std::to_string(ibe)+std::to_string(iside), AvgLLOcc_side_x, AvgLLOcc_side_y, AvgHLOcc_side_x, AvgHLOcc_side_y,
1563 AvgLLOccMod_side_x, AvgLLOccMod_side_y, AvgHLOccMod_side_x, AvgHLOccMod_side_y);
1564 }
1565 }
1566 }
1567 }
1568
1569
1570 }
1571
1572 if (m_doShift) {
1575 int lastLumiBlock = -99;
1576 if ((int)lumiBlock != lastLumiBlock) {
1578 }
1579 float evtLumiBlock = 1.;
1580 float lumiBlockScale = (evtLumiBlock > 0) ? (1. / evtLumiBlock) : 0;
1581 const float barrelConst = 1. / 105088;
1582 const float endcapConst = 1. / 122880;
1583
1584 if (m_doTracksMon && evtLumiBlock > 0) {
1585 NHitsperLB_x = lastLumiBlock;
1586 NHitsperLB_y = (
float)nHitsperLB_B * lumiBlockScale * barrelConst;
1587 fill(
"RDOShiftRebinnedBarrelHistograms0", NHitsperLB_x, NHitsperLB_y);
1588 NHLHitsperLB_x = lastLumiBlock;
1589 NHLHitsperLB_y = (
float)nHLHitsperLB_B * lumiBlockScale * barrelConst;
1590 fill(
"RDOShiftRebinnedBarrelHistograms0", NHLHitsperLB_x, NHLHitsperLB_y);
1591
1592 for (int iside = 0; iside < 2; iside++) {
1593 NHitsperLB_x = lastLumiBlock;
1594 NHitsperLB_y = (
float)nHitsperLB_E[iside] * lumiBlockScale * endcapConst;
1595 fill(
"RDOShiftRebinnedEndcapHistograms1"+std::to_string(iside), NHitsperLB_x, NHitsperLB_y);
1596 NHLHitsperLB_x = lastLumiBlock;
1597 NHLHitsperLB_y = (
float)nHLHitsperLB_E[iside] * lumiBlockScale * endcapConst;
1598 fill(
"RDOShiftRebinnedEndcapHistograms1"+std::to_string(iside), NHLHitsperLB_x, NHLHitsperLB_y);
1599 }
1600
1601 nHitsperLB_B = 0;
1602 nHLHitsperLB_B = 0;
1603
1604 for (int iside = 0; iside < 2; iside++) {
1605 nHitsperLB_E[iside] = 0;
1606 nHLHitsperLB_E[iside] = 0;
1607 }
1608 }
1609 }
1610
1612
1613
1619 const unsigned int rod_id_base[2][2] = { { 0x310000, 0x320000 }, { 0x330000, 0x340000 } };
1620 const unsigned int nChipsTotal[2][2] = { { 3328, 3328 }, { 7680, 7680 } };
1621 const unsigned int nRobsTotal[2][2] = { { 32, 32 }, { 64, 64 } };
1622 float nBSErrors[2][2] = { { 0, 0 }, { 0, 0 } };
1623 float nRobErrors[2][2] = { { 0, 0 }, { 0, 0 } };
1624 const std::set<std::pair<uint32_t, uint32_t> > *errorset1[2] = { BCIDErrorSet, L1IDErrorSet };
1625
1626 for (int iset = 0; iset < 2; ++iset) {
1627 for (
auto setIt = errorset1[iset]->
begin(); setIt != errorset1[iset]->end(); ++setIt) {
1628 for (int ibe = 0; ibe < 2; ++ibe) {
1629 for (int iside = 0; iside < 2; ++iside) {
1630 if (((setIt->first >> 8) & 0xFF0000) == rod_id_base[ibe][iside]) {
1631 nBSErrors[ibe][iside] += 1. / nChipsTotal[ibe][iside];
1632 }
1633 }
1634 }
1635 }
1636 }
1637
1638 const std::set<uint32_t> *errorset2[2] = { MissingErrorSet, SidErrorSet };
1639
1640 for (int iset = 0; iset < 2; ++iset) {
1641 for (
auto setIt = errorset2[iset]->
begin(); setIt != errorset2[iset]->end(); ++setIt) {
1642 for (int ibe = 0; ibe < 2; ++ibe) {
1643 for (int iside = 0; iside < 2; ++iside) {
1644 if (((*setIt >> 8) & 0xFF0000) == rod_id_base[ibe][iside]) {
1645 nBSErrors[ibe][iside] += 1. / nChipsTotal[ibe][iside];
1646 }
1647 }
1648 }
1649 }
1650 }
1651
1652 for (int ibe = 0; ibe < 2; ++ibe) {
1653 for (int iside = 0; iside < 2; ++iside) {
1655 ChipBSErrorsVsLB_y = nBSErrors[ibe][iside];
1657
1658 fill(
"RDOShiftSmryRebinnedHistograms"+std::to_string(ibe)+std::to_string(iside), ChipBSErrorsVsLB_x, ChipBSErrorsVsLB_y);
1659 }
1660 }
1661 }
1662
1663 for (auto setIt = RobStatusErrorSet->begin(); setIt != RobStatusErrorSet->end(); ++setIt) {
1664 for (int ibe = 0; ibe < 2; ++ibe) {
1665 for (int iside = 0; iside < 2; ++iside) {
1666 if (setIt->first % rod_id_base[ibe][iside] < 0xffff) {
1667 nRobErrors[ibe][iside] += 1. / nRobsTotal[ibe][iside];
1668 }
1669 }
1670 }
1671 }
1672
1673 for (int ibe = 0; ibe < 2; ++ibe) {
1674 for (int iside = 0; iside < 2; ++iside) {
1676 RobBSErrorsVsLB_y = nRobErrors[ibe][iside];
1678
1679 fill(
"RDOShiftSmryRebinnedHistograms"+std::to_string(ibe)+std::to_string(iside), RobBSErrorsVsLB_x, RobBSErrorsVsLB_y);
1680 }
1681 }
1682 }
1683
1685 return StatusCode::SUCCESS;
1686}
virtual Identifier identify() const override final
std::vector< std::vector< std::vector< int > > > initScaleVectors(const EventContext &ctx) const
static const int s_numberOfEndCapStacks
int chipToBoard_EndCap(int chip) const
static const int s_numberOfBarrelStacks
FloatProperty m_longToTCut
static const int s_iChip_max[2]
int chipToBoard(int chip) const
ServiceHandle< ITRT_ByteStream_ConditionsSvc > m_BSSvc
bool is_barrel(const Identifier &id) const
Test for barrel.
virtual double timeOverThreshold() const override final
bool firstBinHigh() const
virtual int driftTimeBin() const override final
uint32_t bcid() const
The bunch crossing ID of the event.
float nTRTHits(const U &p)
l
Printing final latex table to .tex output file.
#define CXXUTILS_TRAPPING_FP