5 #define FILLEVENTNORMALIZATION(NBINS, MIN, WIDTH, VALUE, VARPASSED, VAR, HISTGROUP) \
6 for (int i = 1; i <= NBINS; i++) \
7 if (MIN + WIDTH*(i-1) >= VALUE || MIN + WIDTH*(i+1) <= VALUE) \
11 fill(HISTGROUP, VARPASSED, VAR); \
49 ,m_pTRTHelper(nullptr)
51 ,m_sumTool(
"TRT_StrawStatusSummaryTool", this)
52 ,m_TRTStrawNeighbourSvc(
"TRT_StrawNeighbourSvc",
name)
53 ,m_BSSvc(
"TRT_ByteStream_ConditionsSvc",
name)
54 ,m_trackSelTool(
"InDet::InDetTrackSelectionTool/TrackSelectionTool", this)
151 for (
int ibe = 0; ibe < 2; ibe++) {
153 IdentifierHash idHash =
index;
165 idSide = idBarrelEndcap ? 1 : -1;
167 if (
isBarrel && (idBarrelEndcap == -1)) {
171 }
else if (ibe == 1) {
172 idSide = idBarrelEndcap ? 1 : 0;
174 if (!
isBarrel && ((idBarrelEndcap == -2) || (idBarrelEndcap == 2))) {
180 if (sectorflag == 1) {
181 if (!element)
continue;
183 for (
unsigned int istraw = 0; istraw < element->
nStraws(); istraw++) {
184 std::vector<Identifier> neighbourIDs;
191 if (idLayerWheel == 1) i_chip += 21;
193 if (idLayerWheel == 2) i_chip += 54;
195 int tempStrawNumber =
strawNumber(istraw, idStrawLayer, idLayerWheel);
197 if (tempStrawNumber < 0 || tempStrawNumber > (
s_Straw_max[ibe] - 1)) {
198 ATH_MSG_WARNING(
"Found tempStrawNumber = " << tempStrawNumber <<
" out of range.");
200 m_mat_chip_B.at(idPhiModule).at(tempStrawNumber) = i_chip;
201 m_mat_chip_B.at(idPhiModule + 32).at(tempStrawNumber) = i_chip;
203 }
else if (ibe == 1) {
205 int tempStrawNumber =
strawNumberEndCap(istraw, idStrawLayer, idLayerWheel, idPhiModule, idSide);
207 if (tempStrawNumber < 0 || tempStrawNumber > (
s_Straw_max[ibe] - 1)) {
208 ATH_MSG_WARNING(
"Found tempStrawNumber = " << tempStrawNumber <<
" out of range.");
210 m_mat_chip_E.at(idPhiModule).at(tempStrawNumber) = i_chip;
211 m_mat_chip_E.at(idPhiModule + 32).at(tempStrawNumber) = i_chip;
219 return StatusCode::SUCCESS;
226 std::vector<std::vector<std::vector<int>>> scale_hHitWMap;
227 std::vector<std::vector<int>> scale_hHitWMap_B, scale_hHitWMap_EA, scale_hHitWMap_EC;
228 std::vector<int> scale_B_Xe, scale_B_Ar, scale_EA_Xe, scale_EA_Ar, scale_EC_Xe, scale_EC_Ar;
230 scale_hHitWMap.clear();
231 scale_hHitWMap_B.clear();
232 scale_hHitWMap_EA.clear();
233 scale_hHitWMap_EC.clear();
248 for (
int j = 0; j < 32; j++ ) {
251 bool isArgonStraw = (
Straw_Gastype(
m_sumTool->getStatusHT(Dummy_Identifier, Gaudi::Hive::currentContext()) ) == GasType::Ar);
259 scale_B_Xe.push_back(countXe);
260 scale_B_Ar.push_back(countAr);
264 scale_EA_Xe.push_back(32);
265 scale_EA_Ar.push_back(32);
266 scale_EC_Xe.push_back(32);
267 scale_EC_Ar.push_back(32);
270 scale_hHitWMap_B.push_back(scale_B_Xe);
271 scale_hHitWMap_B.push_back(scale_B_Ar);
272 scale_hHitWMap_EA.push_back(scale_EA_Xe);
273 scale_hHitWMap_EA.push_back(scale_EA_Ar);
274 scale_hHitWMap_EC.push_back(scale_EC_Xe);
275 scale_hHitWMap_EC.push_back(scale_EC_Ar);
276 scale_hHitWMap.push_back(scale_hHitWMap_B);
277 scale_hHitWMap.push_back(scale_hHitWMap_EA);
278 scale_hHitWMap.push_back(scale_hHitWMap_EC);
281 return scale_hHitWMap;
301 bsErrCont=bsErrContHdl.cptr();
315 const std::set<std::pair<uint32_t, uint32_t> > &L1IDErrorSet = bsErrCont->
getL1ErrorSet();
316 const std::set<std::pair<uint32_t, uint32_t> > &BCIDErrorSet = bsErrCont->
getBCIDErrorSet();
318 const std::set<uint32_t> &SidErrorSet = bsErrCont->
getSidErrorSet();
319 const std::set<std::pair<uint32_t, uint32_t> > &RobStatusErrorSet = bsErrCont->
getRobErrorSet();
321 const unsigned int rod_id_base[2][2] = { { 0x310000, 0x320000 }, { 0x330000, 0x340000 } };
322 const unsigned int nChipsTotal[2][2] = { { 3328, 3328 }, { 7680, 7680 } };
323 const unsigned int nRobsTotal[2][2] = { { 32, 32 }, { 64, 64 } };
324 float nBSErrors[2][2] = { { 0, 0 }, { 0, 0 } };
325 float nRobErrors[2][2] = { { 0, 0 }, { 0, 0 } };
327 const std::set<std::pair<uint32_t, uint32_t> > *errorset1[2] = { &BCIDErrorSet, &L1IDErrorSet };
329 for (
int iset = 0; iset < 2; ++iset) {
330 for (
auto setIt = errorset1[iset]->
begin(); setIt != errorset1[iset]->end(); ++setIt) {
331 for (
int ibe = 0; ibe < 2; ++ibe) {
332 for (
int iside = 0; iside < 2; ++iside) {
333 if (((setIt->first >> 8) & 0xFF0000) == rod_id_base[ibe][iside]) {
334 nBSErrors[ibe][iside] += 1. / nChipsTotal[ibe][iside];
341 const std::set<uint32_t> *errorset2[2] = { &MissingErrorSet, &SidErrorSet };
343 for (
int iset = 0; iset < 2; ++iset) {
344 for (
auto setIt = errorset2[iset]->
begin(); setIt != errorset2[iset]->end(); ++setIt) {
345 for (
int ibe = 0; ibe < 2; ++ibe) {
346 for (
int iside = 0; iside < 2; ++iside) {
347 if (((*setIt >> 8) & 0xFF0000) == rod_id_base[ibe][iside]) {
348 nBSErrors[ibe][iside] += 1. / nChipsTotal[ibe][iside];
355 for (
int ibe = 0; ibe < 2; ++ibe) {
356 for (
int iside = 0; iside < 2; ++iside) {
358 ChipBSErrorsVsLB_y = nBSErrors[ibe][iside];
364 for (
auto setIt = RobStatusErrorSet.begin(); setIt != RobStatusErrorSet.end(); ++setIt) {
365 for (
int ibe = 0; ibe < 2; ++ibe) {
366 for (
int iside = 0; iside < 2; ++iside) {
367 if (setIt->first % rod_id_base[ibe][iside] < 0xffff) {
368 nRobErrors[ibe][iside] += 1. / nRobsTotal[ibe][iside];
374 for (
int ibe = 0; ibe < 2; ++ibe) {
375 for (
int iside = 0; iside < 2; ++iside) {
377 RobBSErrorsVsLB_y = nRobErrors[ibe][iside];
400 const int list[] = {10, 11, 15, 9, 9, 11, 12, 13, 14};
404 for (
int i = 0;
i < 9;
i++) {
407 if (chip <
count)
return i + 1;
408 else if (chip == 104)
return 9;
411 assert(
count == 104);
438 for (; RDO_CollectionBegin != RDO_CollectionEnd; ++RDO_CollectionBegin) {
441 if (!TRT_Collection)
continue;
445 for (; p_rdo != TRT_Collection->
end(); ++p_rdo) {
448 if (!p_lolum)
continue;
465 int addToStrawNumber = 0;
466 int addToStrawNumberNext = 0;
468 const int numberOfStraws[75] = {
495 addToStrawNumber += numberOfStraws[
i - 1];
496 addToStrawNumberNext = addToStrawNumber + numberOfStraws[
i];
501 if (strawNumber < 0 || strawNumber >
s_Straw_max[0] - 1) {
512 const int numberOfStraws[75] = {
539 for (
i = 1; inp_strawnumber >= 0;
i++) {
540 inp_strawnumber -= numberOfStraws[
i];
555 static const int TripletOrientation[2][32] = {
557 1, 1, 1, 1, 1, 1, 1, 1,
558 0, 0, 0, 0, 0, 0, 0, 0,
559 1, 1, 1, 1, 1, 1, 1, 1,
560 0, 0, 0, 0, 0, 0, 0, 0
563 1, 1, 1, 1, 1, 1, 1, 1,
564 0, 0, 0, 0, 0, 0, 0, 0,
565 1, 1, 1, 1, 1, 1, 1, 1,
566 0, 0, 0, 0, 0, 0, 0, 0
571 if (
side == 2) phi1 = phi_stack,
side = 1;
572 else if (
side == -2) phi1 = 31 - phi_stack,
side = 0;
575 if (TripletOrientation[
side][phi1]) {
601 int strawNumberNew = 0;
603 if (LayerNumber < 6 && strawLayerNumber > 7) {
604 strawNumberNew = strawNumberNew + (384 * LayerNumber);
607 strawNumberNew = strawNumberNew + (384 * LayerNumber);
610 strawNumberNew = strawNumberNew + 2304 + 192 * (LayerNumber - 6);
613 strawNumberNew = strawNumberNew + 2304 + 192 * (LayerNumber - 6);
619 if (strawNumber < 0 || strawNumber >
s_Straw_max[1] - 1) {
631 switch (LayerNumber) {
651 if (strawLayerNumInp < 19) {
654 }
else if (strawLayerNumInp < 43) {
668 float degreeValue = radValue /
M_PI * 180;
670 if (degreeValue < 0) degreeValue += 360;
779 auto good_bcid = eventInfo.
bcid();
785 int numberOfStacks_b[2];
789 int numberOfStrawsMod[3];
790 numberOfStrawsMod[0] = 329;
791 numberOfStrawsMod[1] = 520;
792 numberOfStrawsMod[2] = 793;
793 int numberOfStrawsWheel[2];
794 numberOfStrawsWheel[0] = 2304;
795 numberOfStrawsWheel[1] = 1536;
796 int moduleHits_B[192];
797 int moduleHits_E[128];
798 int HLmoduleHits_B[192];
799 int HLmoduleHits_E[128];
800 int nHitsperLB_B = 0;
801 int nHLHitsperLB_B = 0;
802 int nHitsperLB_E[2] = {0, 0};
803 int nHLHitsperLB_E[2] = {0, 0};
805 for (
int i = 0;
i < 192;
i++) {
807 HLmoduleHits_B[
i] = 0;
810 for (
int i = 0;
i < 128;
i++) {
812 HLmoduleHits_E[
i] = 0;
815 auto scale_hHitWMap_B_passed = std::make_unique<short int[][s_Straw_max[0]]>(2);
816 auto scale_hHitWMap_E_passed = std::make_unique<short int[][2][s_Straw_max[1]]>(2);
840 int goodid_status = 0;
843 if (trtBCIDCollection) {
844 InDetTimeCollection::const_iterator itrt_bcid = trtBCIDCollection->begin();
846 while (goodid_status == 0 && itrt_bcid != trtBCIDCollection->end()) {
848 const unsigned int trt_bcid = (*itrt_bcid).second;
850 if (itrt_bcid > trtBCIDCollection->begin() && prev_bcid - trt_bcid == 0) {
852 }
else if (itrt_bcid > trtBCIDCollection->begin() && prev_bcid - trt_bcid != 0) {
854 std::hex << (*itrt_bcid).first <<
" trt bcid from ROD is " <<
855 std::hex << trt_bcid);
858 prev_bcid = trt_bcid;
866 ATH_MSG_VERBOSE(
"TRT_StrawStatusTool reports status = " <<
m_sumTool->getStatus(TRT_Identifier, Gaudi::Hive::currentContext()));
871 for (
int ibe = 0; ibe < 2; ibe++) {
881 std::map<int,std::map<int, std::vector<straw_struct>>> straw_map;
882 std::map<int,std::map<int, std::vector<chip_struct>>> chip_map;
883 std::map<int,std::vector<straw_shifter_struct>> straw_shifter_map;
884 std::map<int,std::map<int, std::vector<straw_struct_prob>>> straw_map_prob;
885 std::map<int,std::map<int, std::vector<chip_struct_prob>>> chip_map_prob;
887 std::vector<std::vector<std::vector<int>>> scale_hHitWMap =
initScaleVectors();
889 for (; RDO_CollectionBegin != RDO_CollectionEnd; ++RDO_CollectionBegin) {
892 if (!TRT_Collection)
continue;
896 for (; p_rdo != TRT_Collection->
end(); ++p_rdo) {
897 int middleHTbit = (*p_rdo)->getWord() & 0x00020000;
899 int hitinvaliditygate = (*p_rdo)->getWord() & 0x000DFE80;
901 bool is_middleHTbit_high = (middleHTbit != 0);
902 bool is_anybininVgate_high = (hitinvaliditygate != 0);
903 TRT_Identifier = (*p_rdo)->identify();
911 if (!p_lolum)
continue;
914 int ibe = abs(barrel_ec) - 1;
915 int iside = barrel_ec > 0 ? 0 : 1;
918 if (ibe != 1 && ibe != 0) {
919 ATH_MSG_DEBUG(
"TRT part retrieved from TRT Identifier is not a barrel or an endcap");
923 int moduleNumber_barrel1[2];
924 int moduleNumber_barrel2[2];
925 int moduleNumber_barrel3[2];
926 int moduleNumber_endcapA[2];
927 int moduleNumber_endcapB[2];
931 TRT_Identifier = p_lolum->
identify();
933 const bool isArgonStraw = (
Straw_Gastype(
m_sumTool->getStatusHT(TRT_Identifier,Gaudi::Hive::currentContext()) ) == GasType::Ar);
945 if ( is_barrel && ibe == 0 ) {
948 if (thisStrawNumber >= 0 && thisStrawNumber <
s_Straw_max[ibe]) {
954 }
else if ( !is_barrel && ibe == 1 ) {
957 if (thisStrawNumber >= 0 && thisStrawNumber <
s_Straw_max[ibe]) {
963 thisStrawNumber = -1;
966 if (thisStrawNumber < 0 || thisStrawNumber >=
s_Straw_max[ibe]) {
967 ATH_MSG_WARNING(
"Found m_strawNumber = " << thisStrawNumber <<
" out of range.");
972 const bool highlevel = is_middleHTbit_high;
976 moduleNumber_barrel1[0] = phi_module;
977 moduleNumber_barrel1[1] = phi_module + 96;
982 moduleNumber_endcapA[0] = phi_module;
983 moduleNumber_endcapA[1] = phi_module + 64;
986 int iphi_module = -999;
989 iphi_module = phi_module;
990 }
else if (iside == 1) {
991 iphi_module = phi_module + 32;
997 this_struct.
isAr = isArgonStraw;
1000 if (abs(barrel_ec) == 1) scale_hHitWMap_B_passed[isArgonStraw ? 1 : 0][thisStrawNumber]++;
1001 if (abs(barrel_ec) == 2) scale_hHitWMap_E_passed[barrel_ec < 0 ? 1 : 0][isArgonStraw ? 1 : 0][thisStrawNumber]++;
1014 }
else if (ibe == 1) {
1018 nHitsperLB_E[iside]++;
1021 nHLHitsperLB_E[iside]++;
1028 straw_struct_prob& this_struct = straw_map_prob[ibe][iphi_module].emplace_back();
1030 this_struct.
HitHWMapS_cut = highlevel && is_middleHTbit_high;
1041 if (highlevel && is_middleHTbit_high) scale_hHitHWMapS_B_passed[iphi_module][thisStrawNumber]++;
1044 if (is_anybininVgate_high) scale_hHitAWMapS_B_passed[iphi_module][thisStrawNumber]++;
1045 if (highlevel) scale_hHitHMapS_B_passed[iphi_module][thisStrawNumber]++;
1048 if (highlevel && is_middleHTbit_high) scale_hHitHWMapS_E_passed[iphi_module][thisStrawNumber]++;
1051 if (is_anybininVgate_high) scale_hHitAWMapS_E_passed[iphi_module][thisStrawNumber]++;
1052 if (highlevel) scale_hHitHMapS_E_passed[iphi_module][thisStrawNumber]++;
1059 straw_struct& this_struct = straw_map[ibe][iphi_module].emplace_back();
1068 HtoLMapS = thisStrawNumber;
1069 HtoLMapS_passed = 1.0;
1072 HtoLMapS = thisStrawNumber;
1073 HtoLMapS_passed = 0.0;
1079 chip_struct_prob& this_struct = chip_map_prob[ibe][iphi_module].emplace_back();
1081 this_struct.
HitHWMapC_cut = highlevel && is_middleHTbit_high;
1092 if (highlevel && is_middleHTbit_high) scale_hHitHWMapC_B_passed[iphi_module][chip - 1]++;
1095 if (is_anybininVgate_high) scale_hHitAWMapC_B_passed[iphi_module][chip - 1]++;
1096 if (highlevel) scale_hHitHMapC_B_passed[iphi_module][chip - 1]++;
1099 if (highlevel && is_middleHTbit_high) scale_hHitHWMapC_E_passed[iphi_module][chip - 1]++;
1102 if (is_anybininVgate_high) scale_hHitAWMapC_E_passed[iphi_module][chip - 1]++;
1103 if (highlevel) scale_hHitHMapC_E_passed[iphi_module][chip - 1]++;
1108 chip_struct& this_struct = chip_map[ibe][iphi_module].emplace_back();
1136 HtoLMapC = chip - 1;
1137 HtoLMapC_passed = 1.0;
1140 HtoLMapC = chip - 1;
1141 HtoLMapC_passed = 0.0;
1148 int moduleNumber = -1;
1151 if (layer_or_wheel == 0) {
1152 moduleNumber = moduleNumber_barrel1[iside];
1153 moduleHits_B[moduleNumber]++;
1154 }
else if (layer_or_wheel == 1) {
1155 moduleNumber = moduleNumber_barrel2[iside];
1156 moduleHits_B[moduleNumber]++;
1157 }
else if (layer_or_wheel == 2) {
1158 moduleNumber = moduleNumber_barrel3[iside];
1159 moduleHits_B[moduleNumber]++;
1163 if (layer_or_wheel == 0) {
1164 moduleNumber = moduleNumber_barrel1[iside];
1165 HLmoduleHits_B[moduleNumber]++;
1166 }
else if (layer_or_wheel == 1) {
1167 moduleNumber = moduleNumber_barrel2[iside];
1168 HLmoduleHits_B[moduleNumber]++;
1169 }
else if (layer_or_wheel == 2) {
1170 moduleNumber = moduleNumber_barrel3[iside];
1171 HLmoduleHits_B[moduleNumber]++;
1174 }
else if (ibe == 1) {
1175 if (layer_or_wheel < 6) {
1176 moduleNumber = moduleNumber_endcapA[iside];
1177 moduleHits_E[moduleNumber]++;
1178 }
else if (layer_or_wheel > 5) {
1179 moduleNumber = moduleNumber_endcapB[iside];
1180 moduleHits_E[moduleNumber]++;
1184 if (layer_or_wheel < 6) {
1185 moduleNumber = moduleNumber_endcapA[iside];
1186 HLmoduleHits_E[moduleNumber]++;
1187 }
else if (layer_or_wheel > 5) {
1188 moduleNumber = moduleNumber_endcapB[iside];
1189 HLmoduleHits_E[moduleNumber]++;
1198 for (
int iGas = 0; iGas < 2; iGas++) {
1200 if (scale_hHitWMap[0][iGas].at(
k) - scale_hHitWMap_B_passed[iGas][
k] >= 0) {
1201 for (
int j = 0; j < scale_hHitWMap[0][iGas].at(
k) - scale_hHitWMap_B_passed[iGas][
k]; j++) {
1205 this_struct.
isAr = iGas > 0 ? true :
false;
1211 ATH_MSG_ERROR(
"Scale value " << scale_hHitWMap[0][iGas].at(
k) - scale_hHitWMap_B_passed[iGas][
k] <<
1212 " is less than zero in scaling for Barrel, iGas = " << iGas <<
", k = " <<
k);
1214 }
catch (out_of_range &
e) {
1215 ATH_MSG_ERROR(
"Index " <<
k <<
" out of range in scaling for Barrel");
1222 for (
int iside = 0; iside < 2; iside++) {
1223 for (
int iGas = 0; iGas < 2; iGas++) {
1225 if (scale_hHitWMap[iside + 1][iGas].at(
k) - scale_hHitWMap_E_passed[iside][iGas][
k] >= 0) {
1226 for (
int j = 0; j < scale_hHitWMap[iside + 1][iGas].at(
k) - scale_hHitWMap_E_passed[iside][iGas][
k]; j++) {
1230 this_struct.
isAr = iGas > 0 ? true :
false;
1236 ATH_MSG_ERROR(
"Scale value " << scale_hHitWMap[iside + 1][iGas].at(
k) - scale_hHitWMap_E_passed[iside][iGas][
k] <<
1237 " is less than zero in scaling for Endcap, iside = " << iside <<
", iGas = " << iGas <<
", k = " <<
k);
1239 }
catch (out_of_range &
e) {
1240 ATH_MSG_ERROR(
"Index " <<
k <<
" out of range in scaling for Endcap");
1249 for (
int iside = 0; iside < 2; iside++) {
1251 int iphi_module = -999;;
1252 if (iside == 0) iphi_module = phi_module;
else if (iside == 1) iphi_module = phi_module + 32;
1253 if (scale_hHitHWMapS_B_passed[iphi_module][
k] < 2 || scale_hHitWMapS_B_passed[iphi_module][
k] < 2 ||
1254 scale_hHitAMapS_B_passed[iphi_module][
k] < 2 || scale_hHitAWMapS_B_passed[iphi_module][
k] < 2 ||
1255 scale_hHitHMapS_B_passed[iphi_module][
k] < 2) {
1256 for (
int l = 0;
l < 1 - scale_hHitHWMapS_B_passed[iphi_module][
k];
l++){
1262 for (
int l = 0;
l < 1 - scale_hHitWMapS_B_passed[iphi_module][
k];
l++){
1268 for (
int l = 0;
l < 1 - scale_hHitAMapS_B_passed[iphi_module][
k];
l++){
1274 for (
int l = 0;
l < 1 - scale_hHitAWMapS_B_passed[iphi_module][
k];
l++){
1280 for (
int l = 0;
l < 1 - scale_hHitHMapS_B_passed[iphi_module][
k];
l++){
1287 ATH_MSG_ERROR(
"Scale value is less than zero in normalization for Barrel straw!");
1295 for (
int iside = 0; iside < 2; iside++) {
1297 int iphi_module = -999;;
1298 if (iside == 0) iphi_module = phi_module;
else if (iside == 1) iphi_module = phi_module + 32;
1299 if (scale_hHitHWMapC_B_passed[iphi_module][
k] < 17 || scale_hHitWMapC_B_passed[iphi_module][
k] < 17 ||
1300 scale_hHitAMapC_B_passed[iphi_module][
k] < 17 || scale_hHitAWMapC_B_passed[iphi_module][
k] < 17 ||
1301 scale_hHitHMapC_B_passed[iphi_module][
k] < 17) {
1302 for (
int l = 0;
l < 16*1. - scale_hHitHWMapC_B_passed[iphi_module][
k];
l++){
1303 chip_struct_prob& this_struct = chip_map_prob[0][iphi_module].emplace_back();
1308 for (
int l = 0;
l < 16*1. - scale_hHitWMapC_B_passed[iphi_module][
k];
l++){
1309 chip_struct_prob& this_struct = chip_map_prob[0][iphi_module].emplace_back();
1314 for (
int l = 0;
l < 16*1. - scale_hHitAMapC_B_passed[iphi_module][
k];
l++){
1315 chip_struct_prob& this_struct = chip_map_prob[0][iphi_module].emplace_back();
1320 for (
int l = 0;
l < 16*1. - scale_hHitAWMapC_B_passed[iphi_module][
k];
l++){
1321 chip_struct_prob& this_struct = chip_map_prob[0][iphi_module].emplace_back();
1326 for (
int l = 0;
l < 16*1. - scale_hHitHMapC_B_passed[iphi_module][
k];
l++){
1327 chip_struct_prob& this_struct = chip_map_prob[0][iphi_module].emplace_back();
1333 ATH_MSG_ERROR(
"Scale value is less than zero in normalization for Barrel chip!");
1341 for (
int iside = 0; iside < 2; iside++) {
1343 int iphi_module = -999;;
1344 if (iside == 0) iphi_module = phi_module;
else if (iside == 1) iphi_module = phi_module + 32;
1345 if (scale_hHitHWMapS_E_passed[iphi_module][
k] < 2 || scale_hHitWMapS_E_passed[iphi_module][
k] < 2 ||
1346 scale_hHitAMapS_E_passed[iphi_module][
k] < 2 || scale_hHitAWMapS_E_passed[iphi_module][
k] < 2 ||
1347 scale_hHitHMapS_E_passed[iphi_module][
k] < 2) {
1348 for (
int l = 0;
l < 1. - scale_hHitHWMapS_E_passed[iphi_module][
k];
l++){
1354 for (
int l = 0;
l < 1. - scale_hHitWMapS_E_passed[iphi_module][
k];
l++){
1360 for (
int l = 0;
l < 1. - scale_hHitAMapS_E_passed[iphi_module][
k];
l++){
1366 for (
int l = 0;
l < 1. - scale_hHitAWMapS_E_passed[iphi_module][
k];
l++){
1372 for (
int l = 0;
l < 1. - scale_hHitHMapS_E_passed[iphi_module][
k];
l++){
1379 ATH_MSG_ERROR(
"Scale value is less than zero in normalization for Endcap straw!");
1387 for (
int iside = 0; iside < 2; iside++) {
1389 int iphi_module = -999;;
1390 if (iside == 0) iphi_module = phi_module;
else if (iside == 1) iphi_module = phi_module + 32;
1391 if (scale_hHitHWMapC_E_passed[iphi_module][
k] < 17 || scale_hHitWMapC_E_passed[iphi_module][
k] < 17 ||
1392 scale_hHitAMapC_E_passed[iphi_module][
k] < 17 || scale_hHitAWMapC_E_passed[iphi_module][
k] < 17 ||
1393 scale_hHitHMapC_E_passed[iphi_module][
k] < 17) {
1394 for (
int l = 0;
l < 16*1. - scale_hHitHWMapC_E_passed[iphi_module][
k];
l++){
1395 chip_struct_prob& this_struct = chip_map_prob[1][iphi_module].emplace_back();
1400 for (
int l = 0;
l < 16*1. - scale_hHitWMapC_E_passed[iphi_module][
k];
l++){
1401 chip_struct_prob& this_struct = chip_map_prob[1][iphi_module].emplace_back();
1406 for (
int l = 0;
l < 16*1. - scale_hHitAMapC_E_passed[iphi_module][
k];
l++){
1407 chip_struct_prob& this_struct = chip_map_prob[1][iphi_module].emplace_back();
1412 for (
int l = 0;
l < 16*1. - scale_hHitAWMapC_E_passed[iphi_module][
k];
l++){
1413 chip_struct_prob& this_struct = chip_map_prob[1][iphi_module].emplace_back();
1418 for (
int l = 0;
l < 16*1. - scale_hHitHMapC_E_passed[iphi_module][
k];
l++){
1419 chip_struct_prob& this_struct = chip_map_prob[1][iphi_module].emplace_back();
1425 ATH_MSG_ERROR(
"Scale value is less than zero in normalization for Endcap chip!");
1432 for (
const auto& ibarrel_ecpair : straw_shifter_map) {
1433 int ibe = abs(ibarrel_ecpair.first) - 1;
1434 int iside = ibarrel_ecpair.first > 0 ? 0 : 1;
1436 auto HitWMap_passed =
Monitored::Collection(
"HitWMap_passed", ibarrel_ecpair.second, [](
const auto&
s){return s.HitWMap_passed;});
1437 auto HitWMap_Ar_passed =
Monitored::Collection(
"HitWMap_Ar_passed", ibarrel_ecpair.second, [](
const auto&
s){return s.HitWMap_Ar_passed;});
1439 auto isNotAr =
Monitored::Collection(
"isNotAr", ibarrel_ecpair.second, [](
const auto&
s){return not s.isAr;});
1441 fill(
"RDOHistograms0",
strawNumber, HitWMap_passed, HitWMap_Ar_passed, isAr, isNotAr);
1442 }
else if (ibe == 1) {
1448 for (
const auto& ibepair : straw_map_prob) {
1449 for (
const auto& iphi_modulepair : ibepair.second ) {
1451 auto HitHWMapS_passed =
Monitored::Collection(
"HitHWMapS_passed", iphi_modulepair.second, [](
const auto&
s){return s.HitHWMapS_passed;});
1452 auto HitWMapS_passed =
Monitored::Collection(
"HitWMapS_passed", iphi_modulepair.second, [](
const auto&
s){return s.HitWMapS_passed;});
1453 auto HitAMapS_passed =
Monitored::Collection(
"HitAMapS_passed", iphi_modulepair.second, [](
const auto&
s){return s.HitAMapS_passed;});
1454 auto HitAWMapS_passed =
Monitored::Collection(
"HitAWMapS_passed", iphi_modulepair.second, [](
const auto&
s){return s.HitAWMapS_passed;});
1455 auto HitHMapS_passed =
Monitored::Collection(
"HitHMapS_passed", iphi_modulepair.second, [](
const auto&
s){return s.HitHMapS_passed;});
1456 auto HitHWMapS_cut =
Monitored::Collection(
"HitHWMapS_cut", iphi_modulepair.second, [](
const auto&
s){return s.HitHWMapS_cut;});
1457 auto HitWMapS_cut =
Monitored::Collection(
"HitWMapS_cut", iphi_modulepair.second, [](
const auto&
s){return s.HitWMapS_cut;});
1458 auto HitAMapS_cut =
Monitored::Collection(
"HitAMapS_cut", iphi_modulepair.second, [](
const auto&
s){return s.HitAMapS_cut;});
1459 auto HitAWMapS_cut =
Monitored::Collection(
"HitAWMapS_cut", iphi_modulepair.second, [](
const auto&
s){return s.HitAWMapS_cut;});
1460 auto HitHMapS_cut =
Monitored::Collection(
"HitHMapS_cut", iphi_modulepair.second, [](
const auto&
s){return s.HitHMapS_cut;});
1463 HitWMapS_passed, HitWMapS_cut, HitAMapS_passed, HitAMapS_cut, HitAWMapS_passed, HitAWMapS_cut, HitHMapS_passed, HitHMapS_cut);
1467 for (
const auto& ibepair : chip_map_prob) {
1468 for (
const auto& iphi_modulepair : ibepair.second ) {
1469 auto chipNumber =
Monitored::Collection(
"chipNumber", iphi_modulepair.second, [](
const auto&
s){return s.chipNumber;});
1470 auto HitHWMapC_passed =
Monitored::Collection(
"HitHWMapC_passed", iphi_modulepair.second, [](
const auto&
s){return s.HitHWMapC_passed;});
1471 auto HitWMapC_passed =
Monitored::Collection(
"HitWMapC_passed", iphi_modulepair.second, [](
const auto&
s){return s.HitWMapC_passed;});
1472 auto HitAMapC_passed =
Monitored::Collection(
"HitAMapC_passed", iphi_modulepair.second, [](
const auto&
s){return s.HitAMapC_passed;});
1473 auto HitAWMapC_passed =
Monitored::Collection(
"HitAWMapC_passed", iphi_modulepair.second, [](
const auto&
s){return s.HitAWMapC_passed;});
1474 auto HitHMapC_passed =
Monitored::Collection(
"HitHMapC_passed", iphi_modulepair.second, [](
const auto&
s){return s.HitHMapC_passed;});
1475 auto HitHWMapC_cut =
Monitored::Collection(
"HitHWMapC_cut", iphi_modulepair.second, [](
const auto&
s){return s.HitHWMapC_cut;});
1476 auto HitWMapC_cut =
Monitored::Collection(
"HitWMapC_cut", iphi_modulepair.second, [](
const auto&
s){return s.HitWMapC_cut;});
1477 auto HitAMapC_cut =
Monitored::Collection(
"HitAMapC_cut", iphi_modulepair.second, [](
const auto&
s){return s.HitAMapC_cut;});
1478 auto HitAWMapC_cut =
Monitored::Collection(
"HitAWMapC_cut", iphi_modulepair.second, [](
const auto&
s){return s.HitAWMapC_cut;});
1479 auto HitHMapC_cut =
Monitored::Collection(
"HitHMapC_cut", iphi_modulepair.second, [](
const auto&
s){return s.HitHMapC_cut;});
1482 HitWMapC_passed, HitWMapC_cut, HitAMapC_passed, HitAMapC_cut, HitAWMapC_passed, HitAWMapC_cut, HitHMapC_passed, HitHMapC_cut);
1487 for (
const auto& ibepair : straw_map) {
1488 for (
const auto& iphi_modulepair : ibepair.second ) {
1490 auto HitTrMapS_y =
Monitored::Collection(
"HitTrMapS_y", iphi_modulepair.second, [](
const auto&
s){return s.HitTrMapS_y;});
1491 auto HitToTMapS_y =
Monitored::Collection(
"HitToTMapS_y", iphi_modulepair.second, [](
const auto&
s){return s.HitToTMapS_y;});
1492 auto HitToTLong_cut =
Monitored::Collection(
"HitToTLong_cut", iphi_modulepair.second, [](
const auto&
s){return s.HitToTLong_cut;});
1493 auto HitTrWMapS_y =
Monitored::Collection(
"HitTrWMapS_y", iphi_modulepair.second, [](
const auto&
s){return s.HitTrWMapS_y;});
1494 auto HitTrWMapS_cut =
Monitored::Collection(
"HitTrWMapS_cut", iphi_modulepair.second, [](
const auto&
s){return s.HitTrWMapS_cut;});
1497 HitTrMapS_y, HitToTMapS_y, HitToTLong_cut, HitTrWMapS_y, HitTrWMapS_cut);
1501 for (
const auto& ibepair : chip_map) {
1502 for (
const auto& iphi_modulepair : ibepair.second ) {
1503 auto chipNumber =
Monitored::Collection(
"chipNumber", iphi_modulepair.second, [](
const auto&
s){return s.chipNumber;});
1504 auto HitTrMapC_y =
Monitored::Collection(
"HitTrMapC_y", iphi_modulepair.second, [](
const auto&
s){return s.HitTrMapC_y;});
1505 auto HitToTMapC_y =
Monitored::Collection(
"HitToTMapC_y", iphi_modulepair.second, [](
const auto&
s){return s.HitToTMapC_y;});
1506 auto HtoBCMapC_x =
Monitored::Collection(
"HtoBCMapC_x", iphi_modulepair.second, [](
const auto&
s){return s.HtoBCMapC_x;});
1507 auto HtoBCMapB_x =
Monitored::Collection(
"HtoBCMapB_x", iphi_modulepair.second, [](
const auto&
s){return s.HtoBCMapB_x;});
1508 auto HtoBCMapB_y =
Monitored::Collection(
"HtoBCMapB_y", iphi_modulepair.second, [](
const auto&
s){return s.HtoBCMapB_y;});
1509 auto HtoBCMap_cut =
Monitored::Collection(
"HtoBCMap_cut", iphi_modulepair.second, [](
const auto&
s){return s.HtoBCMap_cut;});
1510 auto HitTrWMapC_cut =
Monitored::Collection(
"HitTrWMapC_cut", iphi_modulepair.second, [](
const auto&
s){return s.HitTrWMapC_cut;});
1513 chipNumber, HitTrMapC_y, HitToTMapC_y, HtoBCMapC_x, HtoBCMapB_x, HtoBCMapB_y, HtoBCMap_cut, HitTrWMapC_cut);
1517 OccAll = nhitsall/350848.;
1518 fill(
"RDOHistograms0", OccAll);
1521 for (
int ibe = 0; ibe < 2; ibe++) {
1524 BCIDvsOcc_x = good_bcid;
1525 BCIDvsOcc_y =
nTRTHits[ibe]/105088.0;
1526 fill(
"RDOHistograms0", BCIDvsOcc_x, BCIDvsOcc_y);
1527 }
else if (ibe == 1) {
1528 BCIDvsOcc_x = good_bcid;
1529 BCIDvsOcc_y =
nTRTHits[ibe]/245760.0;
1530 fill(
"RDOHistograms1", BCIDvsOcc_x, BCIDvsOcc_y);
1533 for (
int iside = 0; iside < 2; iside++) {
1534 for (
int i = 1;
i <= numberOfStacks_b[ibe];
i++) {
1537 int modulenum_tmp = 0;
1541 modulenum_tmp =
i - 1;
1542 }
else if (iside == 1) {
1545 if (ibe == 0) modulenum_tmp = (
i - 1) + 96;
1546 else if (ibe == 1) modulenum_tmp = (
i - 1) + 64;
1558 int LLocc_index = index_tmp - 32 * nclass;
1562 float occLL =
float(moduleHits_B[modulenum_tmp]) /
float(numberOfStrawsMod[nclass]);
1563 float occHL =
float(HLmoduleHits_B[modulenum_tmp]) /
float(numberOfStrawsMod[nclass]);
1564 AvgLLOcc_side_x =
i - (32 * nclass);
1565 AvgLLOcc_side_y = occLL;
1566 AvgHLOcc_side_x =
i - (32 * nclass);
1567 AvgHLOcc_side_y = occHL;
1568 AvgLLOccMod_side_x =
i;
1569 AvgLLOccMod_side_y = occLL;
1570 AvgHLOccMod_side_x =
i;
1571 AvgHLOccMod_side_y = occHL;
1572 }
else if (ibe == 1) {
1573 float occLL =
float(moduleHits_E[modulenum_tmp]) /
float(numberOfStrawsWheel[nclass]);
1574 float occHL =
float(HLmoduleHits_E[modulenum_tmp]) /
float(numberOfStrawsWheel[nclass]);
1576 if (LLocc_index < 64) {
1580 AvgLLOcc_side_x =
i - (32 * nclass);
1581 AvgLLOcc_side_y = occLL;
1582 AvgHLOcc_side_x =
i - (32 * nclass);
1583 AvgHLOcc_side_y = occHL;
1584 AvgLLOccMod_side_x =
i;
1585 AvgLLOccMod_side_y = occLL;
1586 AvgHLOccMod_side_x =
i;
1587 AvgHLOccMod_side_y = occHL;
1590 AvgLLOccMod_side_x, AvgLLOccMod_side_y, AvgHLOccMod_side_x, AvgHLOccMod_side_y);
1602 int lastLumiBlock = -99;
1606 float evtLumiBlock = 1.;
1607 float lumiBlockScale = (evtLumiBlock > 0) ? (1. / evtLumiBlock) : 0;
1608 const float barrelConst = 1. / 105088;
1609 const float endcapConst = 1. / 122880;
1612 NHitsperLB_x = lastLumiBlock;
1613 NHitsperLB_y = (
float)nHitsperLB_B * lumiBlockScale * barrelConst;
1614 fill(
"RDOShiftRebinnedBarrelHistograms0", NHitsperLB_x, NHitsperLB_y);
1615 NHLHitsperLB_x = lastLumiBlock;
1616 NHLHitsperLB_y = (
float)nHLHitsperLB_B * lumiBlockScale * barrelConst;
1617 fill(
"RDOShiftRebinnedBarrelHistograms0", NHLHitsperLB_x, NHLHitsperLB_y);
1619 for (
int iside = 0; iside < 2; iside++) {
1620 NHitsperLB_x = lastLumiBlock;
1621 NHitsperLB_y = (
float)nHitsperLB_E[iside] * lumiBlockScale * endcapConst;
1622 fill(
"RDOShiftRebinnedEndcapHistograms1"+
std::to_string(iside), NHitsperLB_x, NHitsperLB_y);
1623 NHLHitsperLB_x = lastLumiBlock;
1624 NHLHitsperLB_y = (
float)nHLHitsperLB_E[iside] * lumiBlockScale * endcapConst;
1625 fill(
"RDOShiftRebinnedEndcapHistograms1"+
std::to_string(iside), NHLHitsperLB_x, NHLHitsperLB_y);
1631 for (
int iside = 0; iside < 2; iside++) {
1632 nHitsperLB_E[iside] = 0;
1633 nHLHitsperLB_E[iside] = 0;
1646 const unsigned int rod_id_base[2][2] = { { 0x310000, 0x320000 }, { 0x330000, 0x340000 } };
1647 const unsigned int nChipsTotal[2][2] = { { 3328, 3328 }, { 7680, 7680 } };
1648 const unsigned int nRobsTotal[2][2] = { { 32, 32 }, { 64, 64 } };
1649 float nBSErrors[2][2] = { { 0, 0 }, { 0, 0 } };
1650 float nRobErrors[2][2] = { { 0, 0 }, { 0, 0 } };
1651 const std::set<std::pair<uint32_t, uint32_t> > *errorset1[2] = { BCIDErrorSet, L1IDErrorSet };
1653 for (
int iset = 0; iset < 2; ++iset) {
1654 for (
auto setIt = errorset1[iset]->
begin(); setIt != errorset1[iset]->end(); ++setIt) {
1655 for (
int ibe = 0; ibe < 2; ++ibe) {
1656 for (
int iside = 0; iside < 2; ++iside) {
1657 if (((setIt->first >> 8) & 0xFF0000) == rod_id_base[ibe][iside]) {
1658 nBSErrors[ibe][iside] += 1. / nChipsTotal[ibe][iside];
1665 const std::set<uint32_t> *errorset2[2] = { MissingErrorSet, SidErrorSet };
1667 for (
int iset = 0; iset < 2; ++iset) {
1668 for (
auto setIt = errorset2[iset]->
begin(); setIt != errorset2[iset]->end(); ++setIt) {
1669 for (
int ibe = 0; ibe < 2; ++ibe) {
1670 for (
int iside = 0; iside < 2; ++iside) {
1671 if (((*setIt >> 8) & 0xFF0000) == rod_id_base[ibe][iside]) {
1672 nBSErrors[ibe][iside] += 1. / nChipsTotal[ibe][iside];
1679 for (
int ibe = 0; ibe < 2; ++ibe) {
1680 for (
int iside = 0; iside < 2; ++iside) {
1682 ChipBSErrorsVsLB_y = nBSErrors[ibe][iside];
1690 for (
auto setIt = RobStatusErrorSet->begin(); setIt != RobStatusErrorSet->end(); ++setIt) {
1691 for (
int ibe = 0; ibe < 2; ++ibe) {
1692 for (
int iside = 0; iside < 2; ++iside) {
1693 if (setIt->first % rod_id_base[ibe][iside] < 0xffff) {
1694 nRobErrors[ibe][iside] += 1. / nRobsTotal[ibe][iside];
1700 for (
int ibe = 0; ibe < 2; ++ibe) {
1701 for (
int iside = 0; iside < 2; ++iside) {
1703 RobBSErrorsVsLB_y = nRobErrors[ibe][iside];
1712 return StatusCode::SUCCESS;
1752 float track_eta = 0;
1753 float track_phi = 0;
1757 for (
auto track = combTrackCollection.begin();
track != combTrackCollection.end(); ++
track) {
1763 const Trk::Perigee *perigee = (*track)->perigeeParameters();
1766 track_pt = perigee->pT();
1767 track_eta = perigee->eta();
1768 track_phi = perigee->parameters()[
Trk::phi0];
1769 track_d0 = perigee->parameters()[
Trk::d0];
1770 track_z0 = perigee->parameters()[
Trk::z0];
1772 <<
" pT = " << track_pt *
invGeV <<
" GeV" <<
"\n"
1773 <<
" eta = " << track_eta <<
"\n"
1774 <<
" phi0 = " << track_phi <<
"\n"
1775 <<
" d0 = " << track_d0 * invmm <<
"\n"
1776 <<
" z0 = " << track_z0 * invmm <<
"\n"
1777 <<
" theta = " << perigee->parameters()[
Trk::theta] <<
"\n"
1778 <<
" qOverP = " << perigee->parameters()[
Trk::qOverP]);
1787 ATH_MSG_DEBUG(
"This track has " << track_states->
size() <<
" track states on surface.");
1789 ATH_MSG_DEBUG(
"This track has null track states on surface.");
1800 p = (perigee->parameters()[
Trk::qOverP] != 0.) ? std::abs(1. / (perigee->parameters()[
Trk::qOverP])) : 1.0e+08;
1811 <<
" and nsct = " << n_sct_hits
1812 <<
" and npix = " << n_pixel_hits);
1814 if (!passed_track_preselection) {
1821 for (
auto it = track_states->
begin();
it != track_states->
end();
it++) {
1826 if (!track_parameters)
continue;
1838 const bool isArgonStraw = (
Straw_Gastype(
m_sumTool->getStatusHT(
id, Gaudi::Hive::currentContext()) ) == GasType::Ar);
1840 int ibe = abs(barrel_ec) - 1;
1841 int iside = barrel_ec > 0 ? 0 : 1;
1845 EfficiencyBarrel_locR_Ar =
locR;
1846 EfficiencyBarrel_locR_Ar_passed = 1.0;
1847 fill(
"TRTEfficiencyHistogramsBarrel", EfficiencyBarrel_locR_Ar_passed, EfficiencyBarrel_locR_Ar);
1849 EfficiencyBarrel_locR =
locR;
1850 EfficiencyBarrel_locR_passed = 1.0;
1851 fill(
"TRTEfficiencyHistogramsBarrel", EfficiencyBarrel_locR_passed, EfficiencyBarrel_locR);
1853 }
else if (ibe == 1) {
1855 EfficiencyBarrel_locR_Ar =
locR;
1856 EfficiencyBarrel_locR_Ar_passed = 1.0;
1857 fill(
"TRTEfficiencyHistogramsEndCap"+
std::to_string(iside), EfficiencyBarrel_locR_Ar_passed, EfficiencyBarrel_locR_Ar);
1859 EfficiencyEndCap_locR =
locR;
1860 EfficiencyEndCap_locR_passed = 1.0;
1861 fill(
"TRTEfficiencyHistogramsEndCap"+
std::to_string(iside), EfficiencyEndCap_locR_passed, EfficiencyEndCap_locR);
1865 if (std::abs(
locR) >= 1.3)
continue;
1867 int thisStrawNumber = 0;
1873 if (thisStrawNumber >= 0 && thisStrawNumber <
s_Straw_max[ibe])
1874 chip =
m_mat_chip_B.at(phi_module).at(thisStrawNumber);
1875 }
else if (ibe == 1) {
1878 if (thisStrawNumber >= 0 && thisStrawNumber <
s_Straw_max[ibe])
1879 chip =
m_mat_chip_E.at(phi_module).at(thisStrawNumber);
1883 EfficiencyBarrelMap = thisStrawNumber;
1884 EfficiencyBarrelMap_passed = 1.0;
1885 fill(
"TRTEfficiencyHistogramsBarrel", EfficiencyBarrelMap_passed, EfficiencyBarrelMap);
1886 }
else if (ibe == 1) {
1887 EfficiencyEndCapMap = thisStrawNumber;
1888 EfficiencyEndCapMap_passed = 1.0;
1889 fill(
"TRTEfficiencyHistogramsEndCap", EfficiencyEndCapMap_passed, EfficiencyEndCapMap);
1894 EfficiencyS = thisStrawNumber;
1895 EfficiencyS_passed = 1.0;
1898 EfficiencyC_passed = 1.0;
1900 }
else if (iside == 1) {
1901 EfficiencyS = thisStrawNumber;
1902 EfficiencyS_passed = 1.0;
1905 EfficiencyC_passed = 1.0;
1910 Efficiency_eta_passed = track_eta;
1911 Efficiency_eta = 1.0;
1912 fill(
"TRTEfficiencyHistograms", Efficiency_eta_passed, Efficiency_eta);
1913 Efficiency_phi_passed = track_phi;
1914 Efficiency_phi = 1.0;
1915 fill(
"TRTEfficiencyHistograms", Efficiency_phi_passed, Efficiency_phi);
1916 Efficiency_pt_passed = track_pt*
invGeV;
1917 Efficiency_pt = 1.0;
1918 fill(
"TRTEfficiencyHistograms", Efficiency_pt_passed, Efficiency_pt);
1919 Efficiency_z0_passed = track_z0;
1920 Efficiency_z0 = 1.0;
1921 fill(
"TRTEfficiencyHistograms", Efficiency_z0_passed, Efficiency_z0);
1938 if (!track_parameters)
continue;
1950 const bool isArgonStraw =
Straw_Gastype(
m_sumTool->getStatusHT(
id, Gaudi::Hive::currentContext()) ) == GasType::Ar;
1952 int ibe = abs(barrel_ec) - 1;
1953 int iside = barrel_ec > 0 ? 0 : 1;
1957 EfficiencyBarrel_locR_Ar =
locR;
1958 EfficiencyBarrel_locR_Ar_passed = 0.0;
1959 fill(
"TRTEfficiencyHistograms", EfficiencyBarrel_locR_Ar_passed, EfficiencyBarrel_locR_Ar);
1961 EfficiencyBarrel_locR =
locR;
1962 EfficiencyBarrel_locR_passed = 0.0;
1963 fill(
"TRTEfficiencyHistograms", EfficiencyBarrel_locR_passed, EfficiencyBarrel_locR);
1965 }
else if (ibe == 1) {
1967 EfficiencyEndCap_locR_Ar =
locR;
1968 EfficiencyEndCap_locR_Ar_passed = 0.0;
1969 fill(
"TRTEfficiencyHistogramsEndCap"+
std::to_string(iside), EfficiencyEndCap_locR_Ar_passed, EfficiencyEndCap_locR_Ar);
1971 EfficiencyEndCap_locR =
locR;
1972 EfficiencyEndCap_locR_passed = 0.0;
1973 fill(
"TRTEfficiencyHistogramsEndCap"+
std::to_string(iside), EfficiencyEndCap_locR_passed, EfficiencyEndCap_locR);
1977 if (std::abs(
locR) >= 1.3)
continue;
1979 int thisStrawNumber = 0;
1985 if (thisStrawNumber >= 0 && thisStrawNumber <
s_Straw_max[ibe]) {
1986 chip =
m_mat_chip_B.at(phi_module).at(thisStrawNumber);
1988 }
else if (ibe == 1) {
1991 if (thisStrawNumber >= 0 && thisStrawNumber <
s_Straw_max[ibe]) {
1992 chip =
m_mat_chip_E.at(phi_module).at(thisStrawNumber);
1997 EfficiencyBarrelMap = thisStrawNumber;
1998 EfficiencyBarrelMap_passed = 0.0;
1999 fill(
"TRTEfficiencyHistogramsBarrel", EfficiencyBarrelMap_passed, EfficiencyBarrelMap);
2000 }
else if (ibe == 1) {
2001 EfficiencyEndCapMap = thisStrawNumber;
2002 EfficiencyEndCapMap_passed = 0.0;
2003 fill(
"TRTEfficiencyHistogramsEndCap", EfficiencyEndCapMap_passed, EfficiencyEndCapMap);
2008 EfficiencyS = thisStrawNumber;
2009 EfficiencyS_passed = 0.0;
2012 EfficiencyC_passed = 0.0;
2014 }
else if (iside == 1) {
2015 EfficiencyS = thisStrawNumber;
2016 EfficiencyS_passed = 0.0;
2019 EfficiencyC_passed = 0.0;
2023 Efficiency_eta_passed = track_eta;
2024 Efficiency_eta = 0.0;
2025 fill(
"TRTEfficiencyHistograms", Efficiency_eta_passed, Efficiency_eta);
2026 Efficiency_phi_passed = track_phi;
2027 Efficiency_phi = 0.0;
2028 fill(
"TRTEfficiencyHistograms", Efficiency_phi_passed, Efficiency_phi);
2029 Efficiency_pt_passed = track_pt*
invGeV;
2030 Efficiency_pt = 0.0;
2031 fill(
"TRTEfficiencyHistograms", Efficiency_pt_passed, Efficiency_pt);
2032 Efficiency_z0_passed = track_z0;
2033 Efficiency_z0 = 0.0;
2034 fill(
"TRTEfficiencyHistograms", Efficiency_z0_passed, Efficiency_z0);
2043 return StatusCode::SUCCESS;
2113 auto scale_hHitWonTMap_B = std::make_unique<short int[]>(
s_Straw_max[0]);
2114 auto scale_hHitWonTMap_E = std::make_unique<short int[][s_Straw_max[1]]>(2);
2115 auto scale_hHitWonTMap_B_passed = std::make_unique<short int[]>(
s_Straw_max[0]);
2116 auto scale_hHitWonTMap_E_passed = std::make_unique<short int[][s_Straw_max[1]]>(2);
2118 std::map<int,std::vector<straw_edge_struct>> straw_edge_map;
2120 auto p_trk = trackCollection.begin();
2126 int ntrackstack[2][64];
2128 for (
int ibe = 0; ibe < 2; ibe++) {
2129 std::fill(ntrackstack[ibe], ntrackstack[ibe] + 64, 0);
2132 for (; p_trk != trackCollection.end(); ++p_trk) {
2133 const std::unique_ptr<const Trk::TrackSummary>
summary(
m_TrackSummaryTool->summary(Gaudi::Hive::currentContext(),*(*p_trk)));
2138 AllTrkPar = (*p_trk)->trackParameters();
2144 for (p_trkpariter = AllTrkPar->
begin(); p_trkpariter != AllTrkPar->
end(); ++p_trkpariter) {
2146 if ((mPer =
dynamic_cast<const Trk::Perigee *
>(*p_trkpariter)))
break;
2149 if (!mPer)
continue;
2151 float theta = mPer->parameters()[
Trk::theta];
2153 float pT = (
p *
sin(theta));
2160 if (trackStates ==
nullptr)
continue;
2171 if (!passed_track_preselection)
continue;
2173 int nTRTHitsW[2][2];
2174 int nTRTHitsW_Ar[2][2];
2175 int nTRTHitsW_Xe[2][2];
2176 int nTRTHLHitsW[2][2];
2177 int nTRTHLHitsW_Ar[2][2];
2178 int nTRTHLHitsW_Xe[2][2];
2179 int nTRTHits_side[2][2];
2180 int nTRTHitsW_perwheel[2][18];
2181 int hitontrack[2] = {0, 0};
2182 int hitontrack_E_side[2] = {0, 0};
2184 for (
int ibe = 0; ibe < 2; ibe++) {
2185 for (
int iside = 0; iside < 2; iside++) {
2186 nTRTHits_side[ibe][iside] = -1;
2187 nTRTHitsW[ibe][iside] = 0;
2188 nTRTHitsW_Ar[ibe][iside] = 0;
2189 nTRTHitsW_Xe[ibe][iside] = 0;
2190 nTRTHLHitsW[ibe][iside] = 0;
2191 nTRTHLHitsW_Ar[ibe][iside] = 0;
2192 nTRTHLHitsW_Xe[ibe][iside] = 0;
2194 std::fill(nTRTHitsW_perwheel[ibe], nTRTHitsW_perwheel[ibe] + 18, 0);
2197 bool isBarrelOnly =
true;
2198 bool ECAhit =
false;
2199 bool ECChit =
false;
2202 int layer_or_wheel = 0;
2204 int straw_layer = 0;
2206 int nearest_straw_layer[2] = {100, 100};
2207 int nearest_straw[2] = {0, 0};
2208 int testLayer[2] = {100, 100};
2209 float phi2D[2] = {-100, -100};
2211 for (TSOSItBeginTemp = TSOSItBegin0; TSOSItBeginTemp != TSOSItEnd; ++TSOSItBeginTemp) {
2212 if ((*TSOSItBeginTemp) ==
nullptr)
continue;
2217 if (!trtCircle)
continue;
2220 if (!aTrackParam)
continue;
2223 int ibe = std::abs(barrel_ec) - 1;
2229 if (layer_or_wheel >= testLayer[ibe])
continue;
2230 testLayer[ibe] = layer_or_wheel;
2232 if (straw_layer < nearest_straw_layer[ibe]) {
2233 nearest_straw_layer[ibe] = straw_layer;
2234 nearest_straw[ibe] =
straw;
2238 circleElement =
nullptr;
2242 if (phi2D[0] == -999) {
2243 ATH_MSG_DEBUG(
"Track did not go through inner layer of Barrel.");
2246 testLayer[0] <<
" m_straw_layer: " <<
2247 nearest_straw_layer[0] <<
" (in the Barrel).");
2250 if (phi2D[1] == -999) {
2251 ATH_MSG_DEBUG(
"Track did not go through any inner layer of EndCap A or C.");
2254 testLayer[1] <<
" m_straw_layer: " <<
2255 nearest_straw_layer[1] <<
" (in the EndCaps).");
2258 bool trackfound[2][64];
2260 for (
int i = 0;
i < 2;
i++) {
2261 std::fill(trackfound[
i], trackfound[
i] + 64,
false);
2264 for (TSOSItBegin = TSOSItBegin0; TSOSItBegin != TSOSItEnd; ++TSOSItBegin) {
2266 if ((*TSOSItBegin) ==
nullptr)
continue;
2272 if (!trtCircle)
continue;
2276 if (!aTrackParam)
continue;
2284 int ibe = std::abs(barrel_ec) - 1;
2285 int iside = barrel_ec > 0 ? 0 : 1;
2286 int thisStrawNumber[2] = {-1, -1};
2287 int chip[2] = {0, 0};
2292 if (thisStrawNumber[ibe] >= 0 && thisStrawNumber[ibe] <
s_Straw_max[ibe]) {
2293 chip[ibe] =
m_mat_chip_B.at(phi_module).at(thisStrawNumber[ibe]);
2295 }
else if (ibe == 1) {
2298 if (thisStrawNumber[ibe] >= 0 && thisStrawNumber[ibe] <
s_Straw_max[ibe]) {
2299 chip[ibe] =
m_mat_chip_E.at(phi_module).at(thisStrawNumber[ibe]);
2302 thisStrawNumber[ibe] = -1;
2305 if (thisStrawNumber[ibe] < 0 || thisStrawNumber[ibe] >=
s_Straw_max[ibe])
continue;
2309 }
else if (barrel_ec == 2) {
2310 isBarrelOnly =
false;
2312 }
else if (barrel_ec == -2) {
2313 isBarrelOnly =
false;
2319 const bool isArgonStraw = (
Straw_Gastype(
m_sumTool->getStatusHT(surfaceID, Gaudi::Hive::currentContext()) ) == GasType::Ar );
2322 int iphi_module = -9999;
2324 if (iside == 0) iphi_module = phi_module;
2325 else if (iside == 1) iphi_module = phi_module + 32;
2327 trackfound[ibe][iphi_module] =
true;
2339 StrawEffDetPhi_B_passed = phi_module;
2340 StrawEffDetPhi_B = 1.0;
2341 fill(
"ShiftTRTTrackHistograms"+
std::to_string(ibe), StrawEffDetPhi_B_passed, StrawEffDetPhi_B);
2343 if (
m_doStraws) scale_hHitWonTMap_B[thisStrawNumber[ibe]]++;
2346 }
else if (ibe == 1) {
2348 hitontrack_E_side[iside]++;
2351 StrawEffDetPhi_E_passed = phi_module;
2352 StrawEffDetPhi_E = 1.0;
2355 if (
m_doStraws) scale_hHitWonTMap_E[iside][thisStrawNumber[ibe]]++;
2360 EfficiencyS = thisStrawNumber[ibe];
2361 EfficiencyS_passed = 1.0;
2366 EfficiencyC = chip[ibe] - 1;
2367 EfficiencyC_passed = 1.0;
2375 StrawEffDetPhi_B_passed = phi_module;
2376 StrawEffDetPhi_B = 0.0;
2377 fill(
"ShiftTRTTrackHistograms"+
std::to_string(ibe), StrawEffDetPhi_B_passed, StrawEffDetPhi_B);
2379 if (
m_doStraws) scale_hHitWonTMap_B[thisStrawNumber[ibe]]++;
2381 }
else if (ibe == 1) {
2383 StrawEffDetPhi_E_passed = phi_module;
2384 StrawEffDetPhi_E = 0.0;
2387 if (
m_doStraws) scale_hHitWonTMap_E[iside][thisStrawNumber[ibe]]++;
2392 EfficiencyS = thisStrawNumber[ibe];
2393 EfficiencyS_passed = 0.0;
2398 EfficiencyC = chip[ibe] - 1;
2399 EfficiencyC_passed = 0.0;
2405 if (RawDriftCircle) {
2406 nTRTHits_side[ibe][iside]++;
2408 int middleHTbit = RawDriftCircle->
getWord() & 0x00020000;
2410 int hitinvaliditygate = RawDriftCircle->
getWord() & 0x000DFE80;
2412 bool is_middleHTbit_high = (middleHTbit != 0);
2413 bool is_anybininVgate_high = (hitinvaliditygate != 0);
2416 HitToTonTMapS_x = thisStrawNumber[ibe];
2422 HitToTonTMapC_x = chip[ibe] - 1;
2428 if (is_middleHTbit_high) {
2429 HitHonTMapS = thisStrawNumber[ibe];
2431 HitHWonTMapS = thisStrawNumber[ibe];
2434 HtoLonTMapS = thisStrawNumber[ibe];
2435 HtoLonTMapS_passed = 1.0;
2437 HtoLWonTMapS = thisStrawNumber[ibe];
2438 HtoLWonTMapS_passed = 1.0;
2444 if (is_middleHTbit_high) {
2445 HitHWonTMapC = chip[ibe] - 1;
2447 HitHonTMapC = chip[ibe] - 1;
2449 HtoLonTMapC = chip[ibe] - 1;
2450 HtoLonTMapC_passed = 1.0;
2452 HtoLWonTMapC = chip[ibe] - 1;
2453 HtoLWonTMapC_passed = 1.0;
2468 scale_hHitWonTMap_B_passed[thisStrawNumber[ibe]]++;
2469 }
else if (ibe == 1) {
2470 straw_edge_struct& this_struct = straw_edge_map[iside == 0 ? 2 : -2].emplace_back();
2473 scale_hHitWonTMap_E_passed[iside][thisStrawNumber[ibe]]++;
2480 HitWonTMapS = thisStrawNumber[ibe];
2485 HitWonTMapC = chip[ibe] - 1;
2497 HitTronTMapS_x = thisStrawNumber[ibe];
2498 HitTronTMapS_y = trailingEdgeScaled;
2503 HitTronTMapC_x = chip[ibe] - 1;
2504 HitTronTMapC_y = trailingEdgeScaled;
2514 HitAonTMapS = thisStrawNumber[ibe];
2517 if (!is_middleHTbit_high) {
2518 HtoLonTMapS = thisStrawNumber[ibe];
2519 HtoLonTMapS_passed = 0.0;
2525 HitAonTMapC = chip[ibe] - 1;
2527 if (!is_middleHTbit_high) {
2528 HtoLonTMapC = chip[ibe] - 1;
2529 HtoLonTMapC_passed = 0.0;
2534 nTRTHitsW[ibe][iside]++;
2536 if (isArgonStraw) nTRTHitsW_Ar[ibe][iside]++;
2537 else nTRTHitsW_Xe[ibe][iside]++;
2539 nTRTHitsW_perwheel[iside][layer_or_wheel]++;
2541 if (is_middleHTbit_high) {
2542 nTRTHLHitsW[ibe][iside]++;
2543 if (isArgonStraw) nTRTHLHitsW_Ar[ibe][iside]++;
2544 else nTRTHLHitsW_Xe[ibe][iside]++;
2548 if (is_anybininVgate_high) {
2550 HitAWonTMapS = thisStrawNumber[ibe];
2553 if (!is_middleHTbit_high) {
2554 HtoLWonTMapS = thisStrawNumber[ibe];
2555 HtoLWonTMapS_passed = 0.0;
2561 HitAWonTMapC = chip[ibe] - 1;
2564 if (!is_middleHTbit_high) {
2565 HtoLWonTMapC = chip[ibe] - 1;
2566 HtoLWonTMapC_passed = 0.0;
2575 for (
int ibe = 0; ibe < 2; ibe++) {
2576 for (
int i = 0;
i < 64;
i++)
2577 if (trackfound[ibe][
i])
2578 ntrackstack[ibe][
i]++;
2580 if (phi2D[ibe] < 0)
continue;
2586 if (nTRTHitsW[ibe][0] > 0) {
2587 if (nTRTHitsW[ibe][1] > 0) {
2588 NumSwLLWoT_B = nTRTHitsW[ibe][0] + nTRTHitsW[ibe][1];
2592 NumSwLLWoT_B = nTRTHitsW[ibe][0];
2595 }
else if (nTRTHitsW[ibe][1] > 0) {
2596 NumSwLLWoT_B = nTRTHitsW[ibe][1];
2601 if (nTRTHLHitsW[ibe][0] > 0) {
2602 if (nTRTHLHitsW[ibe][1] > 0) {
2603 HLhitOnTrack_B = nTRTHLHitsW[ibe][0] + nTRTHLHitsW[ibe][1];
2606 HLhitOnTrack_B = nTRTHLHitsW[ibe][0];
2609 }
else if (nTRTHLHitsW[ibe][1] > 0) {
2610 HLhitOnTrack_B = nTRTHLHitsW[ibe][1];
2614 if (nTRTHitsW[ibe][0] + nTRTHitsW[ibe][1] > 0) {
2615 HtoLRatioOnTrack_B = (
float)(nTRTHLHitsW[ibe][0] + nTRTHLHitsW[ibe][1]) / (nTRTHitsW[ibe][0] + nTRTHitsW[ibe][1]);
2619 if (nTRTHitsW_Ar[ibe][0] + nTRTHitsW_Ar[ibe][1] > 0) {
2620 HtoLRatioOnTrack_B_Ar = (
float)(nTRTHLHitsW_Ar[ibe][0] + nTRTHLHitsW_Ar[ibe][1]) / (nTRTHitsW_Ar[ibe][0] + nTRTHitsW_Ar[ibe][1]);
2624 if (nTRTHitsW_Xe[ibe][0] + nTRTHitsW_Xe[ibe][1] > 0) {
2625 HtoLRatioOnTrack_B_Xe = (
float)(nTRTHLHitsW_Xe[ibe][0] + nTRTHLHitsW_Xe[ibe][1]) / (nTRTHitsW_Xe[ibe][0] + nTRTHitsW_Xe[ibe][1]);
2628 }
else if (ibe == 1) {
2629 if (nTRTHitsW[ibe][0] > 0) {
2630 if (nTRTHitsW[ibe][1] > 0) {
2631 if (ECAhit && !ECChit && !Bhit) {
2632 NumSwLLWoT_E = nTRTHitsW[ibe][0];
2636 if (ECChit && !ECAhit && !Bhit) {
2637 NumSwLLWoT_E = nTRTHitsW[ibe][1];
2642 if (ECAhit && !ECChit && !Bhit) {
2643 NumSwLLWoT_E = nTRTHitsW[ibe][0];
2646 }
else if (nTRTHitsW[ibe][1] > 0) {
2647 if (ECChit && !ECAhit && !Bhit) {
2648 NumSwLLWoT_E = nTRTHitsW[ibe][1];
2653 for (
int iside = 0; iside < 2; iside++) {
2654 if (nTRTHLHitsW[ibe][iside] > 0) {
2655 HLhitOnTrack_E = nTRTHLHitsW[ibe][iside];
2659 if ((nTRTHitsW[ibe][iside]) > 0) {
2660 HtoLRatioOnTrack_E = (
float)(nTRTHLHitsW[ibe][iside]) / nTRTHitsW[ibe][iside];
2663 if ((nTRTHitsW_Ar[ibe][iside]) > 0) {
2664 HtoLRatioOnTrack_E_Ar = (
float)(nTRTHLHitsW_Ar[ibe][iside]) / nTRTHitsW_Ar[ibe][iside];
2668 if ((nTRTHitsW_Xe[ibe][iside]) > 0) {
2669 HtoLRatioOnTrack_E_Xe = (
float)(nTRTHLHitsW_Xe[ibe][iside]) / nTRTHitsW_Xe[ibe][iside];
2682 if (scale_hHitWonTMap_B[
k] - scale_hHitWonTMap_B_passed[
k] >= 0) {
2683 for (
int j = 0; j < scale_hHitWonTMap_B[
k] - scale_hHitWonTMap_B_passed[
k]; j++) {
2691 ATH_MSG_ERROR(
"Scale value " << scale_hHitWonTMap_B[
k] - scale_hHitWonTMap_B_passed[
k] <<
2692 " is less than zero in scaling for Barrel, k = " <<
k);
2694 }
catch (out_of_range &
e) {
2695 ATH_MSG_ERROR(
"Index " <<
k <<
" out of range in scaling for Barrel");
2701 for (
int iside = 0; iside < 2; iside++) {
2703 if (scale_hHitWonTMap_E[iside][
k] - scale_hHitWonTMap_E_passed[iside][
k] >= 0) {
2704 for (
int j = 0; j < scale_hHitWonTMap_E[iside][
k] - scale_hHitWonTMap_E_passed[iside][
k]; j++) {
2706 straw_edge_struct& this_struct = straw_edge_map[iside == 0 ? 2 : -2].emplace_back();
2712 ATH_MSG_ERROR(
"Scale value " << scale_hHitWonTMap_E[iside][
k] - scale_hHitWonTMap_E_passed[iside][
k] <<
2713 " is less than zero in scaling for Endcap, iside = " << iside <<
", k = " <<
k);
2715 }
catch (out_of_range &
e) {
2716 ATH_MSG_ERROR(
"Index " <<
k <<
" out of range in scaling for Endcap");
2721 for (
const auto& ibarrel_ecpair : straw_edge_map) {
2722 int ibe = abs(ibarrel_ecpair.first) - 1;
2723 int iside = ibarrel_ecpair.first > 0 ? 0 : 1;
2725 auto HitWonTMap_B_y =
Monitored::Collection(
"HitWonTMap_B_y", ibarrel_ecpair.second, [](
const auto&
s){return s.HitWonTMap_B_y;});
2726 auto HitWonTMap_E_y =
Monitored::Collection(
"HitWonTMap_E_y", ibarrel_ecpair.second, [](
const auto&
s){return s.HitWonTMap_E_y;});
2729 }
else if (ibe == 1) {
2734 return StatusCode::SUCCESS;
2740 bool passEventBurst;
2751 if (!rdoContainer.
isValid()) {
2754 return StatusCode::FAILURE;
2758 if (passEventBurst) {
2759 if (!trtBCIDCollection.
isValid()) {
2766 }
else passEventBurst =
true;
2769 if (!combTrackCollection.
isValid()) {
2772 return StatusCode::FAILURE;
2778 if (!trackCollection.
isValid()) {
2781 return StatusCode::FAILURE;
2783 if (passEventBurst) {
2788 return StatusCode::SUCCESS;