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