9 #include "GaudiKernel/ThreadLocalContext.h"
30 for (
int ibc=0; ibc <
NBC_HIT+1; ibc++) {
32 std::ostringstream location;
42 for (
int ibc=0; ibc <
NBC_TRIG; ibc++) {
44 std::ostringstream location;
62 ATH_MSG_INFO(
"MuonTGC_CablingSvc not yet retrieved; postpone TGCcabling initialization at first event.");
68 for (
int ibc=0; ibc <
NBC_HIT+1; ibc++) {
70 std::ostringstream location;
83 for (
int ibc=0; ibc <
NBC_TRIG; ibc++) {
85 std::ostringstream location;
100 return StatusCode::SUCCESS;
108 "Hit: " << m_nHitRDOs <<
"->" << m_nHitPRDs <<
", " <<
109 "Tracklet: " << m_nTrackletRDOs <<
"->" << m_nTrackletPRDs <<
", " <<
110 "TrackletEIFI: " << m_nTrackletEIFIRDOs <<
"->" << m_nTrackletEIFIPRDs <<
", " <<
111 "HiPt: " << m_nHiPtRDOs <<
"->" << m_nHiPtPRDs <<
", " <<
112 "SL: " << m_nSLRDOs <<
"->" << m_nSLPRDs <<
"]");
120 return StatusCode::FAILURE;
122 template<
class ContType,
class CollType>
124 std::vector<std::unique_ptr<CollType>>&& coll)
const {
125 for (std::unique_ptr<CollType>& toMove : coll) {
126 if (!toMove)
continue;
127 const IdentifierHash
hash = toMove->identifyHash();
128 auto lock = container.getWriteHandle(
hash);
129 if(!
lock.alreadyPresent()) {
133 return StatusCode::SUCCESS;
137 if (!m_xAODKey.empty()){
139 ATH_CHECK(handle.record(std::make_unique<xAOD::TgcStripContainer>(),
140 std::make_unique<xAOD::TgcStripAuxContainer>()));
143 return setupState(ctx, state);
148 const unsigned hashMax = m_idHelperSvc->tgcIdHelper().module_hash_max();
150 for(
unsigned int ibc=0; ibc < NBC_HIT+1; ibc++) {
154 const bool externalCachePRD = m_prdContainerCacheKeys.size()>ibc &&
155 !m_prdContainerCacheKeys[ibc].key().empty();
156 if (!externalCachePRD) {
158 ATH_CHECK(handle.
record(std::make_unique<TgcPrepDataContainer>(hashMax)));
159 ATH_MSG_DEBUG(
"TGC PrepData Container recorded in StoreGate with key " << m_outputprepdataKeys[ibc].
key());
168 ATH_CHECK(handle.
record(std::make_unique<Muon::TgcPrepDataContainer>(update.ptr())));
171 ATH_MSG_DEBUG(
"Created container using cache for " << m_prdContainerCacheKeys[ibc].
key());
177 for (
unsigned int ibc=0; ibc < NBC_TRIG; ibc++) {
181 const bool externalCacheCoin = m_coinContainerCacheKeys.size()>ibc &&
182 !m_coinContainerCacheKeys[ibc].key().empty();
183 if(!externalCacheCoin) {
185 ATH_CHECK(handle.
record(std::make_unique<TgcCoinDataContainer>(hashMax)));
190 ATH_CHECK(handle.
record(std::make_unique<TgcCoinDataContainer>(update.ptr())));
191 ATH_MSG_DEBUG(
"Created container using cache for " << m_coinContainerCacheKeys[ibc].
key());
204 return StatusCode::SUCCESS;
207 const std::vector<IdentifierHash>& requestedIdHashVect)
const {
213 if (!m_xAODKey.empty()) {
215 ATH_CHECK(xAODHandle.record(std::make_unique<xAOD::TgcStripContainer>(),
216 std::make_unique<xAOD::TgcStripAuxContainer>()));
219 int sizeVectorRequested = requestedIdHashVect.size();
220 ATH_MSG_DEBUG(
"decode for " << sizeVectorRequested <<
" offline collections called");
224 return StatusCode::FAILURE;
226 const TgcIdHelper& idHelper{m_idHelperSvc->tgcIdHelper()};
228 std::set<const TgcRdo*> decodedRdoCollVec{}, rdoCollVec{};
229 std::vector<bool> decodedOnlineId (cinfo->
m_MAX_N_ROD,
false);
233 ATH_MSG_DEBUG(
"Stored empty container. Decoding TGC RDO into TGC PrepRawData is switched off");
234 return StatusCode::SUCCESS;
240 ATH_MSG_DEBUG(
"Retrieving TGC RDO container from the store");
244 if(rdoContainer->empty()) {
246 ATH_MSG_DEBUG(
"Empty rdo container - no tgc rdo in this event");
247 return StatusCode::SUCCESS;
250 ATH_MSG_DEBUG(
"Not empty rdo container in this event, the container size is " << rdoContainer->size());
253 if(sizeVectorRequested!=0) {
254 unsigned int nRdo = 0;
255 for (IdentifierHash offlineCollHash : requestedIdHashVect) {
258 if(decodedOnlineId.at(onlineId)) {
259 ATH_MSG_DEBUG(
"The ROB with onlineId " << onlineId <<
" which contains hash "
260 <<
static_cast<unsigned int>(offlineCollHash)
261 <<
" is already decoded and skipped");
265 decodedOnlineId.at(onlineId) =
true;
267 for(
const TgcRdo* rdoColl : *rdoContainer) {
268 if(rdoColl->identify()==onlineId) {
269 if(!decodedRdoCollVec.count(rdoColl)) {
270 rdoCollVec.insert(rdoColl);
281 if(sizeVectorRequested!=0) {
285 for (
const TgcRdo* rdo : rdoCollVec) {
290 if(!cinfo->
m_tgcCabling->getElementIDfromReadoutID(offlineId, rd->subDetectorId(),
291 rd->rodId(), rd->sswId(), rd->slbId(),
295 const IdentifierHash tgcHashId = m_idHelperSvc->moduleHash(offlineId);
296 if (
std::find(requestedIdHashVect.begin(), requestedIdHashVect.end(), tgcHashId) == requestedIdHashVect.end()){
299 selectDecoder(state,*rd, rdo);
301 decodedRdoCollVec.insert(rdo);
305 for(
const TgcRdo* rdoColl : *rdoContainer) {
306 if (rdoColl->empty() || decodedRdoCollVec.count(rdoColl) || rdoCollVec.count(rdoColl)) {
309 ATH_MSG_DEBUG(
" Number of RawData in this rdo " << rdoColl->size());
311 selectDecoder(state,*rd, rdoColl);
313 decodedRdoCollVec.insert(rdoColl);
317 std::set<IdentifierHash> hashesInAnyBC;
318 for(
unsigned int ibc = 0; ibc < NBC_HIT; ++ibc) {
325 for (std::unique_ptr<TgcPrepDataCollection>& bcColl : state.tgcPrepDataCollections[ibc]) {
326 if (!bcColl)
continue;
327 std::unique_ptr<TgcPrepDataCollection>& allBcColl = state.tgcPrepDataCollections[NBC_HIT][bcColl->identifyHash()];
329 allBcColl = std::make_unique<TgcPrepDataCollection>(bcColl->identifyHash());
332 hashesInAnyBC.insert(bcColl->identifyHash());
334 auto search_itr = std::find_if(allBcColl->
begin(), allBcColl->
end(),
336 return prd->identify() == prdToUpdate->identify();
338 if (search_itr == allBcColl->
end()) {
339 auto allBcPrd = std::make_unique<TgcPrepData>(*prdToUpdate);
341 allBcPrd->setBcBitMap(bcBitMap);
342 allBcColl->
push_back(std::move(allBcPrd));
347 <<
" adding " << bcBitMap <<
" to get " << (bcBitMap_current | bcBitMap));
348 allBcPrd->
setBcBitMap((bcBitMap_current | bcBitMap));
354 if (!m_xAODKey.empty()) {
355 for (std::unique_ptr<TgcPrepDataCollection>& allBcColl : state.tgcPrepDataCollections[NBC_HIT]) {
356 if (!allBcColl)
continue;
358 xAOD::TgcStrip* tgcStrip = xAODHandle->push_back(std::make_unique<xAOD::TgcStrip>());
360 tgcStrip->
setGasGap(idHelper.gasGap(allBcPrd->identify()));
366 const double locPos = (tgcStrip->
measuresPhi() ? -1. : 1.) * allBcPrd->localPosition().x();
367 tgcStrip->
setMeasurement(m_idHelperSvc->moduleHash(allBcPrd->identify()),
374 for (
unsigned int k = 0 ;
k < state.tgcPrepDataContainer.size(); ++
k){
375 ATH_CHECK(transferData(*state.tgcPrepDataContainer[
k], std::move(state.tgcPrepDataCollections[
k])));
377 for (
unsigned int k = 0 ;
k < state.tgcCoinDataContainer.size(); ++
k) {
378 ATH_CHECK(transferData(*state.tgcCoinDataContainer[
k], std::move(state.tgcCoinDataCollections[
k])));
380 ATH_MSG_DEBUG(
"Found " << hashesInAnyBC.size() <<
" hashes that must be added to AllBC container");
382 return StatusCode::SUCCESS;
387 const TgcRdo* rdoColl)
const {
395 if(!decodeHits(state, rd).isSuccess()) {
403 status = decodeTracklet(state, rd);
406 status = decodeTrackletEIFI(state, rd);
411 status = decodeHiPt(state, rd);
417 status = decodeInner(state, rd);
419 status = decodeSL(state, rd, rdoColl);
432 bool isConverted{
false}, isDuplicated{
false}, isInvalid{
false};
435 <<
" rod=" << rd.
rodId() <<
" ssw=" << rd.
sswId()
436 <<
" slb=" << rd.
slbId() <<
" bitpos=" << rd.
bitpos());
440 const TgcIdHelper& idHelper{m_idHelperSvc->tgcIdHelper()};
447 for(
int iOr=0; iOr<2; iOr++) {
454 if(o_found) orFlag =
true;
460 bool e_found = cinfo->
m_tgcCabling->getElementIDfromReadoutID(elementId,
466 bool show_warning_level =
true;
479 show_warning_level = m_show_warning_level_invalid_A09_SSW6_hit;
482 if (msgLvl(show_warning_level ? MSG::WARNING :
MSG::DEBUG)){
483 msg(show_warning_level ? MSG::WARNING :
MSG::DEBUG) <<
"ElementID not found for "
485 <<
" slb=" << rd.
slbId() <<
" bitpos=" << rd.
bitpos() <<
" orFlag=" << orFlag <<
endmsg;
490 const IdentifierHash tgcHashId = m_idHelperSvc->moduleHash(elementId);
501 <<
" ssw=" << rd.
sswId()<<
" slb=" << rd.
slbId()
502 <<
" bitpos=" << rd.
bitpos()<<
" orFlag=" << orFlag);
510 collection = std::make_unique<TgcPrepDataCollection>(tgcHashId);
513 const bool duplicate = std::find_if(collection->
begin(), collection->
end(),
515 return prd->identify() == channelId;
516 }) != collection->
end();
523 if(!isOfflineIdOKForTgcReadoutElement(descriptor,
channelId)) {
529 std::vector<Identifier> identifierList{
channelId};
536 ATH_MSG_WARNING(
"Muon::TgcRdoToPrepDataToolMT::decodeHits Amg::Vector2D* hitPos is null.");
546 if(
width<s_cutDropPrdsWithZeroWidth && m_dropPrdsWithZeroWidth) {
547 ATH_MSG_WARNING(
"decodeHits: width= " <<
width <<
" is smaller than s_cutDropPrdsWithZeroWidth= "
548 << s_cutDropPrdsWithZeroWidth<<
" "<<m_idHelperSvc->toString(
channelId));
551 double errPos =
width/std::sqrt(12.);
555 mat *= errPos*errPos;
570 if(isConverted) m_nHitPRDs++;
571 else if(isDuplicated || isInvalid) m_nHitRDOs--;
573 return StatusCode::SUCCESS;
591 return StatusCode::SUCCESS;
596 int tmp_slbId{0}, tmp_subMatrix{0}, tmp_position{0};
597 found = getTrackletInfo(rd, tmp_slbId, tmp_subMatrix, tmp_position);
599 return StatusCode::SUCCESS;
604 rd.
sswId(), tmp_slbId,
605 tmp_subMatrix, tmp_position,
true);
608 return StatusCode::SUCCESS;
612 const IdentifierHash tgcHashId = m_idHelperSvc->moduleHash(channelIdOut);
617 std::unique_ptr<Muon::TgcCoinDataCollection>& coincollection = state.
tgcCoinDataCollections[locId][tgcHashId];
618 if (!coincollection) {
619 coincollection = std::make_unique<Muon::TgcCoinDataCollection>(tgcHashId);
620 coincollection->
setIdentifier(m_idHelperSvc->chamberId(channelIdOut));
623 int subMatrix =
static_cast<int>(rd.
subMatrix());
624 int trackletId =
static_cast<int>(2*rd.
slbId()+subMatrix);
625 int delta =
static_cast<int>(rd.
delta());
628 for (
const TgcCoinData* tgcCoinData : *coincollection) {
630 channelIdOut==tgcCoinData->identify() &&
631 channelIdIn==tgcCoinData->channelIdIn() &&
632 trackletId==tgcCoinData->trackletId() &&
633 delta==tgcCoinData->delta() &&
634 subMatrix==tgcCoinData->sub()) {
636 ATH_MSG_DEBUG(
"Duplicated TgcCoinData (Tracklet) = "<< m_idHelperSvc->toString(channelIdIn));
637 return StatusCode::SUCCESS;
641 ATH_MSG_DEBUG(
"TGC RDO->Coindata for LowPT: " << m_idHelperSvc->toString(channelIdOut));
645 if(!isOfflineIdOKForTgcReadoutElement(descriptor_o, channelIdOut)) {
646 return StatusCode::SUCCESS;
649 const TgcIdHelper& idHelper{m_idHelperSvc->tgcIdHelper()};
650 int gasGap_o = idHelper.
gasGap(channelIdOut);
651 int channel_o = idHelper.channel(channelIdOut);
652 double width_o = !idHelper.isStrip(channelIdOut) ? descriptor_o->
gangRadialLength(gasGap_o, channel_o)
653 : descriptor_o->
stripWidth(gasGap_o, channel_o);
655 if(width_o<s_cutDropPrdsWithZeroWidth && m_dropPrdsWithZeroWidth) {
656 return StatusCode::SUCCESS;
661 bool onSurface_o = descriptor_o->
surface(channelIdOut).
globalToLocal(position_o,position_o,hitPos_o);
664 ATH_MSG_WARNING(
"Muon::TgcRdoToPrepDataToolMT::decodeTracklet Amg::Vector2D* hitPos_o is null.");
665 return StatusCode::SUCCESS;
671 if(!isOfflineIdOKForTgcReadoutElement(descriptor_i, channelIdIn)) {
672 return StatusCode::SUCCESS;
675 int gasGap_i = idHelper.gasGap(channelIdIn);
676 int channel_i = idHelper.channel(channelIdIn);
677 double width_i = !idHelper.isStrip(channelIdIn) ? descriptor_i->
gangRadialLength(gasGap_i, channel_i)
678 : descriptor_i->
stripWidth(gasGap_i, channel_i);
680 if(width_i<s_cutDropPrdsWithZeroWidth && m_dropPrdsWithZeroWidth) {
681 return StatusCode::SUCCESS;
686 bool onSurface_i = descriptor_i->
surface(channelIdIn).
globalToLocal(position_i,position_i,hitPos_i);
689 ATH_MSG_WARNING(
"Muon::TgcRdoToPrepDataToolMT::decodeTracklet Amg::Vector2D* hitPos_i is null.");
690 return StatusCode::SUCCESS;
703 idHelper.stationPhi(channelIdOut),
706 idHelper.isStrip(channelIdOut),
715 newCoinData->
setHashAndIndex(coincollection->identifyHash(), coincollection->size());
716 coincollection->push_back(newCoinData);
722 return StatusCode::SUCCESS;
727 m_nTrackletEIFIRDOs++;
731 const TgcIdHelper& idHelper{m_idHelperSvc->tgcIdHelper()};
738 bool isForward = (rd.
slbId()%2==0);
747 int slot = ((rd.
slbId()/2) + (rd.
rodId()-2)*2 + 23)%24 + 1;
749 bool isBackward =
false;
753 isBackward = !isAside;
754 }
else if(slot==16) {
755 isBackward = isAside;
759 if(isAside) isBackward = (slot%3==2);
760 else isBackward = (slot%3!=2);
763 isBackward = isAside;
773 int tmpsubMatrix =
static_cast<int>(rd.
subMatrix());
775 if(tmpsubMatrix==3) {
776 if(slot== 1 || slot== 3 || slot== 4 || slot== 5 || slot== 6 || slot== 7 || slot== 8 ||
777 slot==10 || slot==11 || slot==13 || slot==18 || slot==19 || slot==20) {
781 }
else if(tmpsubMatrix==2) {
782 if(slot== 2 || slot==12 || slot==14 || slot==15 || slot==16 || slot==22 || slot==23 || slot==24) {
789 bitpos = BIT_POS_D_INPUT_ORIGIN - BIT_POS_INPUT_SIZE + 1 + BIT_POS_ASD_SIZE/4*(tmpsubMatrix*2+1);
793 bitpos = BIT_POS_B_INPUT_ORIGIN - BIT_POS_INPUT_SIZE + (isAside ? 1 : 0) + BIT_POS_ASD_SIZE/4*(rd.
subMatrix()*2+1);
796 bitpos = BIT_POS_A_INPUT_ORIGIN - BIT_POS_INPUT_SIZE + (isAside ? 0 : 1) + BIT_POS_ASD_SIZE/4*(rd.
subMatrix()*2+1);
802 bool o_found = cinfo->
m_tgcCabling->getOfflineIDfromReadoutID(channelIdIn,
807 ATH_MSG_WARNING(
"Muon::TgcRdoToPrepDataToolMT::decodeTrackletEIFI OfflineID not found for "
809 <<
" sswId=" << rd.
sswId()<<
" slbId=" << rd.
slbId() <<
" slbType=" << rd.
slbType()
810 <<
" subMatrix=" << rd.
subMatrix() <<
" bitpos=" << bitpos <<
" isStrip=" <<
isStrip
811 <<
" isAside=" << isAside<<
" isForward=" << isForward<<
" slot=" << slot
812 <<
" isBackward=" << isBackward);
813 return StatusCode::SUCCESS;
818 const IdentifierHash tgcHashId = m_idHelperSvc->moduleHash(channelIdIn);
822 std::unique_ptr<Muon::TgcCoinDataCollection>& coincollection = state.
tgcCoinDataCollections[locId][tgcHashId];
823 if (!coincollection) {
824 coincollection = std::make_unique<Muon::TgcCoinDataCollection>(tgcHashId);
825 coincollection->
setIdentifier(m_idHelperSvc->chamberId(channelIdIn));
829 for (
const TgcCoinData* tgcCoinData : *coincollection) {
831 channelIdIn==tgcCoinData->channelIdIn() &&
832 static_cast<int>(rd.
subMatrix())==tgcCoinData->sub()) {
833 ATH_MSG_DEBUG(
"Duplicated TgcCoinData (TrackletEIFI) = "<< m_idHelperSvc->toString(channelIdIn));
834 return StatusCode::SUCCESS;
839 if(!isOfflineIdOKForTgcReadoutElement(descriptor, channelIdIn)) {
840 ATH_MSG_WARNING(
"Muon::TgcRdoToPrepDataToolMT::decodeTrackletEIFI descriptor doesn't contain "
841 << m_idHelperSvc->toString(channelIdIn));
842 return StatusCode::SUCCESS;
851 ATH_MSG_WARNING(
"Muon::TgcRdoToPrepDataToolMT::decodeTrackletEIFI Amg::Vector2D* hitPos is null.");
852 return StatusCode::SUCCESS;
856 int gasGap = idHelper.gasGap(channelIdIn);
857 int channel = idHelper.channel(channelIdIn);
860 double localZ = (descriptor->
transform(channelIdIn).inverse()*descriptor->
channelPos(channelIdIn)).
z();
863 width = std::abs(stripMaxX - stripMinX);
865 int positiveOffset = +4;
866 if(isForward && (slot%3==2) &&
channel==28) positiveOffset = +2;
869 width = std::abs(gangMaxZ - gangMinZ);
879 m_idHelperSvc->tgcIdHelper().stationPhi(channelIdIn),
885 newCoinData->
setHashAndIndex(coincollection->identifyHash(), coincollection->size());
886 coincollection->push_back(newCoinData);
889 m_nTrackletEIFIPRDs++;
890 return StatusCode::SUCCESS;
900 convertToRun2(rd0,tmprodId,tmpsector);
909 ATH_MSG_DEBUG(
"TgcRdoToPrepDataToolMT::decodeHiPt::Unknown subDetectorId!!");
910 return StatusCode::SUCCESS;
915 ATH_MSG_DEBUG(
"Invalid hitId_rdo_hipt, hitId == 0!! skip to convert this RDO to PRD");
916 return StatusCode::SUCCESS;
918 int slbsubMatrix = 0;
919 bool isBackward = isBackwardBW(rd);
920 int deltaBeforeConvert = getDeltaBeforeConvert(rd);
925 std::array<Identifier, 2> channelIdOut{};
926 std::array<int, 2> bitpos_o{}, slbchannel_o{};
927 int sswId_o{0}, sbLoc_o{0}, slbId_o{0};
930 std::array<Identifier, 4> channelIdIn{};
931 std::array<int, 4> bitpos_i{}, slbchannel_i{};
932 int sswId_i{0}, sbLoc_i{0};
934 std::array<int, 4> slbId_in {}, sbLoc_in{};
936 std::array<int, 4> gasGap_i{}, channel_i{};
937 double width_i{0.},hit_position_i{0};
940 std::array<int, 2> gasGap_o{}, channel_o{};
941 double width_o{0.}, hit_position_o{0.};
949 found = getHiPtIds(rd, sswId_o, sbLoc_o, slbId_o);
951 return StatusCode::SUCCESS;
956 getBitPosOutWire(rd, slbsubMatrix, bitpos_o);
958 getBitPosOutStrip(rd, slbsubMatrix, bitpos_o);
960 for(
int i=0;
i<2;
i++) {
962 sswId_o, sbLoc_o, bitpos_o[
i]);
964 ATH_MSG_DEBUG(
"Failed to get OfflineID from ReadoutID for Pivot " << (rd.
isStrip() ?
"Strip" :
"Wire") <<
".");
965 return StatusCode::SUCCESS;
975 getBitPosInWire(rd, deltaBeforeConvert, bitpos_i, slbchannel_i, slbId_in, sbLoc_in, sswId_i, bitpos_o,
976 slbchannel_o, slbId_o);
978 getBitPosInStrip(rd, deltaBeforeConvert, bitpos_i, slbchannel_i, sbLoc_i, sswId_i, bitpos_o, slbchannel_o);
980 for(
int i=0;
i<4;
i++) {
982 rd.
isStrip() ? sbLoc_i : sbLoc_in[
i],
985 ATH_MSG_DEBUG(
"Failed to get OfflineID from ReadoutID for Pivot "
986 << (rd.
isStrip() ?
"Strip" :
"Wire") <<
".");
987 return StatusCode::SUCCESS;
993 ATH_MSG_DEBUG(
"TGC RDO->Coindata for HIPT: " << m_idHelperSvc->toString(channelIdOut[1]));
995 const IdentifierHash tgcHashId = m_idHelperSvc->moduleHash(channelIdOut[1]);
999 std::unique_ptr<Muon::TgcCoinDataCollection>& coincollection = state.
tgcCoinDataCollections[locId][tgcHashId];
1000 if (!coincollection) {
1001 coincollection = std::make_unique<Muon::TgcCoinDataCollection>(tgcHashId);
1002 coincollection->
setIdentifier(m_idHelperSvc->chamberId(channelIdOut[1]));
1009 for(
int i=0;
i<2;
i++) {
1010 if(!isOfflineIdOKForTgcReadoutElement(descriptor_o[
i], channelIdOut[
i])) {
1011 return StatusCode::SUCCESS;
1015 const TgcIdHelper& idHelper{m_idHelperSvc->tgcIdHelper()};
1016 for(
int i=0;
i<2;
i++) {
1017 gasGap_o[
i] = idHelper.
gasGap(channelIdOut[
i]);
1018 channel_o[
i] = idHelper.channel(channelIdOut[
i]);
1022 found = getPosAndIdWireOut(descriptor_o, channelIdOut,
1023 gasGap_o, channel_o,
1024 width_o, hit_position_o, tmp_hitPos_o,
1027 found = getPosAndIdStripOut(descriptor_o, channelIdOut,
1028 gasGap_o, channel_o,
1029 width_o, hit_position_o, tmp_hitPos_o,
1034 return StatusCode::SUCCESS;
1036 if(width_o<s_cutDropPrdsWithZeroWidth && m_dropPrdsWithZeroWidth) {
1037 return StatusCode::SUCCESS;
1041 if(!isOfflineIdOKForTgcReadoutElement(descriptor_oo, channelIdOut_tmp)) {
1042 return StatusCode::SUCCESS;
1053 for(
int i=0;
i<4;
i++) {
1054 if(!isOfflineIdOKForTgcReadoutElement(descriptor_i[
i], channelIdIn[
i])) {
1055 return StatusCode::SUCCESS;
1058 for(
int i=0;
i<4;
i++) {
1059 gasGap_i[
i] = idHelper.gasGap(channelIdIn[
i]);
1060 channel_i[
i] = idHelper.channel(channelIdIn[
i]);
1064 found = getPosAndIdWireIn(descriptor_i, channelIdIn,
1065 gasGap_i, channel_i,
1066 width_i, hit_position_i, tmp_hitPos_i,
1069 found = getPosAndIdStripIn(descriptor_i, channelIdIn,
1070 gasGap_i, channel_i,
1071 width_i, hit_position_i, tmp_hitPos_i,
1076 return StatusCode::SUCCESS;
1078 if(width_i<s_cutDropPrdsWithZeroWidth && m_dropPrdsWithZeroWidth) {
1079 return StatusCode::SUCCESS;
1083 if(!isOfflineIdOKForTgcReadoutElement(descriptor_ii, channelIdIn_tmp)) {
1084 return StatusCode::SUCCESS;
1089 int trackletId = 2*sbLoc_o + slbsubMatrix;
1090 int delta =
static_cast<int>(rd.
delta());
1091 int hsub =
static_cast<int>(rd.
hsub());
1092 int inner =
static_cast<int>(rd.
inner());
1095 for (
const TgcCoinData* tgcCoinData : *coincollection) {
1097 (channelIdOut_tmp==tgcCoinData->identify()) &&
1098 (channelIdIn_tmp==tgcCoinData->channelIdIn()) &&
1099 (trackletId==tgcCoinData->trackletId()) &&
1100 (delta==tgcCoinData->delta()) &&
1101 (hsub==tgcCoinData->sub()) &&
1102 (inner==tgcCoinData->inner())) {
1103 if(38<=trackletId && trackletId<=41) {
1107 ATH_MSG_DEBUG(
"Duplicated TgcCoinData (HiPt) = "<< m_idHelperSvc->toString(channelIdOut_tmp));
1108 return StatusCode::SUCCESS;
1112 auto hitPos_o = std::make_unique<Amg::Vector2D>(tmp_hitPos_o);
1113 auto hitPos_i = std::make_unique<Amg::Vector2D>(tmp_hitPos_i);
1122 idHelper.stationPhi(channelIdOut_tmp),
1135 newCoinData->
setHashAndIndex(coincollection->identifyHash(), coincollection->size());
1136 coincollection->push_back(newCoinData);
1142 return StatusCode::SUCCESS;
1150 return StatusCode::FAILURE;
1155 if(subDetectorId!=
ASIDE && subDetectorId!=
CSIDE) {
1156 ATH_MSG_DEBUG(
"TgcRdoToPrepDataToolMT::decodeHiPt::Unknown subDetectorId!!");
1157 return StatusCode::SUCCESS;
1160 bool isInner = ((rd.
sector() & 4) != 0 );
1166 int sbLoc_o = rd.
sector() & 3;
1167 int inner = rd.
inner();
1170 int phi = 0;
bool isAside =
false;
bool isEndcap =
false;
1171 if(rd.
rodId() < 13){
1172 cinfo->
m_tgcCabling->getSLIDfromReadoutID(
phi, isAside, isEndcap, subDetectorId,
1173 rd.
rodId(), sswId_o, sbLoc_o);
1179 isInner =
true;
isStrip =
false;
1189 isInner =
true;
isStrip =
true;
1197 isInner =
false;
isStrip =
false;
1202 isInner =
false;
isStrip =
true;
1217 int stationEta = isAside ? 1 : -1;
1218 int stationPhi =
phi;
1221 const IdentifierHash tgcHashId = m_idHelperSvc->moduleHash(elementId);
1223 std::unique_ptr<Muon::TgcCoinDataCollection>& coincollection = state.
tgcCoinDataCollections[locId][tgcHashId];
1224 if (!coincollection) {
1225 coincollection = std::make_unique<Muon::TgcCoinDataCollection>(tgcHashId);
1229 ATH_MSG_DEBUG(
"Inner Data Word, phi: " <<
phi <<
" isAside: " << isAside <<
" isEndcap: " << isEndcap
1230 <<
" subDetectorId: " << subDetectorId <<
" isStrip: " << rd.
isStrip()
1231 <<
" rodId: " << rd.
rodId() <<
" slbId: " << sbLoc_o <<
" inner:"<< rd.
inner());
1256 ATH_MSG_DEBUG(
"coincollection->push_back done (for Inner)");
1260 return StatusCode::SUCCESS;
1268 convertToRun2(rd0,tmprodId,tmpsector);
1275 ATH_MSG_DEBUG(
"TgcRdoToPrepDataToolMT::decodeSL::Unknown subDetectorId!!");
1276 return StatusCode::SUCCESS;
1281 std::array<Identifier, 3> channelId_wire{};
1282 int index_w{0}, chip_w{0}, hitId_w{0}, sub_w{0}, sswId_w{0}, sbLoc_w{0}, subMatrix_w{0};
1283 std::array<int, 3> bitpos_w{};
1286 found = getSLIds(
false, rd, channelId_wire, index_w, chip_w, hitId_w, sub_w, sswId_w, sbLoc_w,
1287 subMatrix_w, bitpos_w);
1289 return StatusCode::SUCCESS;
1292 std::array<Identifier, 3> channelId_strip{};
1293 int index_s{0}, chip_s{0}, hitId_s{0}, sub_s{0}, sswId_s{0}, sbLoc_s{0}, subMatrix_s{0};
1294 std::array<int, 3> bitpos_s{};
1297 found = getSLIds(
true, rd, channelId_strip, index_s, chip_s, hitId_s, sub_s, sswId_s, sbLoc_s, subMatrix_s,
1298 bitpos_s, isIncludedInChamberBoundary(rd), rdoColl, index_w, chip_w, hitId_w, sub_w);
1300 return StatusCode::SUCCESS;
1303 ATH_MSG_DEBUG(
"TGC RDO->TgcCoindata(SL): " << m_idHelperSvc->toString(channelId_wire[1]));
1305 const IdentifierHash tgcHashId= m_idHelperSvc->moduleHash(channelId_wire[1]);
1310 std::unique_ptr<Muon::TgcCoinDataCollection>& coincollection = state.
tgcCoinDataCollections[locId][tgcHashId];
1311 if (!coincollection) {
1312 coincollection = std::make_unique<Muon::TgcCoinDataCollection>(tgcHashId);
1313 coincollection->
setIdentifier(m_idHelperSvc->chamberId(channelId_wire[1]));
1317 int trackletId = 2*sbLoc_w + subMatrix_w;
1318 int trackletIdStrip = 2*sbLoc_s + subMatrix_s;
1319 int roi =
static_cast<int>(rd.
roi());
1322 pt += (
static_cast<int>( rd.
coinflag() ) << 4 );
1326 bool isPositiveDeltaR = rd.
isMuplus();
1329 for (
const TgcCoinData* tgcCoinData : *coincollection) {
1331 trackletId==tgcCoinData->trackletId() && trackletIdStrip==tgcCoinData->trackletIdStrip() &&
1332 roi==tgcCoinData->roi() &&
pt==tgcCoinData->pt() &&
veto==tgcCoinData->veto() &&
1333 isPositiveDeltaR==tgcCoinData->isPositiveDeltaR()) {
1335 << m_idHelperSvc->toString(channelId_wire[2]));
1336 return StatusCode::SUCCESS;
1341 double width_w{0.}, tmp_r{0.}, tmp_wire_z{0.};
1342 found = getSLWireGeometry(channelId_wire, width_w, tmp_r, tmp_wire_z);
1344 return StatusCode::SUCCESS;
1346 if(width_w<s_cutDropPrdsWithZeroWidth && m_dropPrdsWithZeroWidth) {
1347 return StatusCode::SUCCESS;
1350 double tmp_eta = 0.;
1351 bool isGoodEta = getEtafromRZ(tmp_r, tmp_wire_z, tmp_eta);
1353 ATH_MSG_WARNING(
"Conversion from r and z to eta by Muon::TgcRdoToPrepDataToolMT::getEtafromRZ failed.");
1354 return StatusCode::SUCCESS;
1356 if(tmp_wire_z<0.) tmp_eta *= -1.;
1360 double width_s{0.}, tmp_phi{0.};
1363 return StatusCode::SUCCESS;
1365 if(width_s<s_cutDropPrdsWithZeroWidth && m_dropPrdsWithZeroWidth) {
1366 return StatusCode::SUCCESS;
1370 if(!isOfflineIdOKForTgcReadoutElement(descriptor_w2, channelId_wire[2])) {
1371 return StatusCode::SUCCESS;
1376 bool onSurface = descriptor_w2->
surface(channelId_wire[2]).
globalToLocal(tmp_gp,tmp_gp,tmp_hitPos);
1381 getSLLocalPosition(descriptor_w2, channelId_wire[2], tmp_eta, tmp_phi);
1397 m_idHelperSvc->tgcIdHelper().stationPhi(channelId_wire[2]),
1409 newCoinData->
setHashAndIndex(coincollection->identifyHash(), coincollection->size());
1410 coincollection->push_back(newCoinData);
1414 return StatusCode::SUCCESS;
1419 int bitpos = -BIT_POS_INPUT_SIZE +1;
1421 if(channel<0 || channel>=WT_MAP_SIZE)
return -1;
1423 if(
channel%3==0) bitpos += BIT_POS_C_INPUT_ORIGIN;
1424 else if(
channel%3==1) bitpos += BIT_POS_B_INPUT_ORIGIN;
1425 else bitpos += BIT_POS_A_INPUT_ORIGIN;
1429 if(channel<0 || channel>=ST_MAP_SIZE)
return -1;
1431 if(
channel%2==0) bitpos += BIT_POS_B_INPUT_ORIGIN;
1432 else bitpos += BIT_POS_A_INPUT_ORIGIN;
1435 if(channel<0 || channel>=WD_MAP_SIZE)
return -1;
1437 if(
channel%2==0) bitpos += BIT_POS_B_INPUT_ORIGIN;
1438 else bitpos += BIT_POS_A_INPUT_ORIGIN;
1448 if( (bitpos<=BIT_POS_A_INPUT_ORIGIN) && (bitpos>BIT_POS_A_INPUT_ORIGIN-BIT_POS_INPUT_SIZE)) input = 2;
1449 else if((bitpos<=BIT_POS_B_INPUT_ORIGIN) && (bitpos>BIT_POS_B_INPUT_ORIGIN-BIT_POS_INPUT_SIZE)) input = 1;
1450 else if((bitpos<=BIT_POS_C_INPUT_ORIGIN) && (bitpos>BIT_POS_C_INPUT_ORIGIN-BIT_POS_INPUT_SIZE)) input = 0;
1455 int channel = 1-BIT_POS_INPUT_SIZE;
1457 if( input==2)
channel += BIT_POS_A_INPUT_ORIGIN;
1458 else if(input==1)
channel += BIT_POS_B_INPUT_ORIGIN;
1459 else channel += BIT_POS_C_INPUT_ORIGIN;
1465 if(input==2)
channel += BIT_POS_A_INPUT_ORIGIN;
1466 else channel += BIT_POS_B_INPUT_ORIGIN;
1486 double r_tmp = std::abs(
r);
1487 double z_tmp = std::abs(
z);
1491 eta = std::abs(atan2(r_tmp,z_tmp));
1508 int& tmp_subMatrix,
int& tmp_position)
const {
1510 if(tmp_subMatrix!=0 && tmp_subMatrix!=1) {
1511 ATH_MSG_DEBUG(
"getTrackletInfo: subMatrix " << tmp_subMatrix <<
" is invalid.");
1515 int tmp_sswId = rd.
sswId();
1516 tmp_slbId = rd.
slbId();
1519 int tmp_position_delta = tmp_position + rd.
delta();
1520 int tmp_slbType = rd.
slbType();
1522 if(tmp_position_delta>=BIT_POS_INPUT_SIZE) {
1523 tmp_position = tmp_position_delta-BIT_POS_INPUT_SIZE;
1524 if(tmp_subMatrix==1) {
1526 tmp_position = BIT_POS_INPUT_SIZE-1;
1527 ATH_MSG_DEBUG(
"Expected TGC2 Strip position (" << tmp_position_delta <<
1528 ") does not exist and is changed to the edge position " << tmp_position);
1531 ATH_MSG_DEBUG(
"sbLoc " << tmp_slbId+1 <<
" doesn't exist for FWD!! (upper edge SLB of FWD:sbLoc3,11)");
1535 ATH_MSG_DEBUG(
"sbLoc " << tmp_slbId+1 <<
" doesn't exist for EWD!! (upper edge SLB of EWD:sbLoc9)");
1545 }
else if(tmp_position_delta<0) {
1546 tmp_position = tmp_position_delta+BIT_POS_INPUT_SIZE;
1547 if(tmp_subMatrix==0) {
1550 ATH_MSG_DEBUG(
"Expected TGC2 Strip position (" << tmp_position_delta <<
1551 ") does not exist and is changed to the edge position " << tmp_position);
1554 if(tmp_position_delta==-1) {
1557 ATH_MSG_DEBUG(
"sbLoc " << tmp_slbId-1 <<
" doesn't exist for FWD!! (bottom edge SLB of FWD:sbLoc0,8)");
1562 if(tmp_position_delta==-1) {
1565 ATH_MSG_DEBUG(
"sbLoc " << tmp_slbId-1 <<
" doesn't exist for EWD!! (bottom edge SLB of EWD:sbLoc0)");
1577 tmp_position = tmp_position_delta;
1585 int RoiRow =
static_cast<int>(rd.
roi()/4);
1591 int RoiRow = getRoiRow(rd);
1594 (RoiRow== 3 || RoiRow== 4 ||
1595 RoiRow== 7 || RoiRow== 8 ||
1596 RoiRow==11 || RoiRow==12 ||
1597 RoiRow==23 || RoiRow==24
1605 std::array<int, 2>& bitpos_o) {
1607 if((rd.
hitId()%2)==1) {
1609 if((rd.
hsub())==0) {
1610 bitpos_o[0] = BIT_POS_B_INPUT_LARGE_R_CH15;
1611 bitpos_o[1] = BIT_POS_A_INPUT_LARGE_R_CH08;
1612 }
else if((rd.
hsub())==1) {
1613 bitpos_o[0] = BIT_POS_B_INPUT_LARGE_R_CH07;
1614 bitpos_o[1] = BIT_POS_A_INPUT_LARGE_R_CH00;
1618 if((rd.
hsub())==0) {
1619 bitpos_o[0] = BIT_POS_B_INPUT_SMALL_R_CH15;
1620 bitpos_o[1] = BIT_POS_A_INPUT_SMALL_R_CH08;
1621 }
else if((rd.
hsub())==1) {
1622 bitpos_o[0] = BIT_POS_B_INPUT_SMALL_R_CH07;
1623 bitpos_o[1] = BIT_POS_A_INPUT_SMALL_R_CH00;
1637 bitpos_o[0] = BIT_POS_B_INPUT_SMALL_R_CH05;
1638 bitpos_o[1] = BIT_POS_A_INPUT_SMALL_R_CH00;
1639 }
else if((rd.
chip()==3) && (rd.
hitId()==6) && (rd.
hsub()==1)) {
1640 bitpos_o[0] = BIT_POS_B_INPUT_SMALL_R_CH07;
1641 bitpos_o[1] = BIT_POS_A_INPUT_SMALL_R_CH04;
1645 bitpos_o[0] = BIT_POS_B_INPUT_LARGE_R_CH12;
1646 bitpos_o[1] = BIT_POS_A_INPUT_LARGE_R_CH08;
1647 }
else if((rd.
chip()==1) && (rd.
hitId()==2) && (rd.
hsub()==1)) {
1648 bitpos_o[0] = BIT_POS_B_INPUT_SMALL_R_CH07;
1649 bitpos_o[1] = BIT_POS_A_INPUT_SMALL_R_CH03;
1656 const int deltaBeforeConvert,
1657 std::array<int,4>& bitpos_i,
1658 std::array<int,4>& slbchannel_i,
1659 std::array<int,4>& slbId_in,
1660 std::array<int,4>& sbLoc_in,
1662 const std::array<int, 2>& bitpos_o,
1663 std::array<int, 2>& slbchannel_o,
const int slbId_o)
const {
1665 const int NUM_SLBID_SBLOC_OFFSET_WT = 8;
1669 int rdochIn_max = 0;
1670 int rdochIn_min = 0;
1682 int tmp_rdochannel_i = 0;
1683 int tmp_rdochannel_i2 = 0;
1684 for(
int i=0;
i<2;
i++) {
1686 tmp_rdochannel_i = WD_MAP_SIZE*slbId_o + slbchannel_o[
i] + deltaBeforeConvert + offset_dt;
1687 if(tmp_rdochannel_i>rdochIn_max) {
1688 tmp_rdochannel_i = rdochIn_max;
1689 }
else if(tmp_rdochannel_i<rdochIn_min) {
1690 tmp_rdochannel_i = rdochIn_min;
1706 tmp_rdochannel_i2 = (tmp_rdochannel_i/3)*3 + 2;
1708 tmp_rdochannel_i2 = ((tmp_rdochannel_i + 1)/3)*3 - 1;
1711 if(tmp_rdochannel_i2>rdochIn_max) {
1712 tmp_rdochannel_i2 = rdochIn_max;
1713 }
else if(tmp_rdochannel_i2<rdochIn_min) {
1714 tmp_rdochannel_i2 = rdochIn_min + 2;
1717 slbId_in[
i] = tmp_rdochannel_i /WT_MAP_SIZE;
1718 slbId_in[
i+2] = tmp_rdochannel_i2/WT_MAP_SIZE;
1720 sbLoc_in[
i] = slbId_in[
i];
1721 sbLoc_in[
i+2] = slbId_in[
i+2];
1725 sbLoc_in[
i] += NUM_SLBID_SBLOC_OFFSET_WT;
1726 sbLoc_in[
i+2] += NUM_SLBID_SBLOC_OFFSET_WT;
1729 slbchannel_i[
i] = tmp_rdochannel_i %WT_MAP_SIZE;
1730 slbchannel_i[
i+2] = tmp_rdochannel_i2%WT_MAP_SIZE;
1737 sswId_i =
static_cast<int>(rd.
sector()/2);
1745 std::array<int,2 >& bitpos_o) {
1747 if((rd.
hitId()%2)==1) {
1749 if((rd.
hsub())==0) {
1750 bitpos_o[0] = BIT_POS_B_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH15;
1751 bitpos_o[1] = BIT_POS_A_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH08;
1752 }
else if((rd.
hsub())==1) {
1753 bitpos_o[0] = BIT_POS_B_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH07;
1754 bitpos_o[1] = BIT_POS_A_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH00;
1758 if((rd.
hsub())==0) {
1759 bitpos_o[0] = BIT_POS_B_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH15;
1760 bitpos_o[1] = BIT_POS_A_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH08;
1761 }
else if((rd.
hsub())==1) {
1762 bitpos_o[0] = BIT_POS_B_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH07;
1763 bitpos_o[1] = BIT_POS_A_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH00;
1769 const int deltaBeforeConvert,
1770 std::array<int, 4>& bitpos_i,
1771 std::array<int, 4>& slbchannel_i,
1774 const std::array<int,2>& bitpos_o,
1775 std::array<int,2>& slbchannel_o)
const {
1779 int rdochIn_max = ST_MAP_SIZE-1;
1780 int rdochIn_min = 0;
1785 }
else if(rd.
chip()==1) {
1791 }
else if(rd.
chip()==1) {
1796 for(
int i=0;
i<2;
i++) {
1798 slbchannel_i[
i] = slbchannel_o[
i] + deltaBeforeConvert;
1799 if(slbchannel_i[
i]>rdochIn_max) {
1800 slbchannel_i[
i] = rdochIn_max;
1801 }
else if(slbchannel_i[
i]<rdochIn_min) {
1802 slbchannel_i[
i] = rdochIn_min;
1806 slbchannel_i[
i+2] = slbchannel_i[
i] + 1;
1808 slbchannel_i[
i+2] = slbchannel_i[
i] - 1;
1811 if(slbchannel_i[
i+2] > rdochIn_max) {
1812 slbchannel_i[
i+2] = rdochIn_max;
1813 }
else if(slbchannel_i[
i+2] < rdochIn_min) {
1814 slbchannel_i[
i+2] = rdochIn_min;
1822 sswId_i =
static_cast<int>(rd.
sector()/2);
1832 std::array<int, 3>& bitpos_w)
const
1842 int RoiRow = getRoiRow(rd);
1845 if(RoiRow==0 && !isForward) {
1847 bitpos_w[0] = BIT_POS_B_INPUT_SMALL_R_CH05;
1848 bitpos_w[1] = BIT_POS_A_INPUT_SMALL_R_CH04;
1849 bitpos_w[2] = BIT_POS_A_INPUT_SMALL_R_CH00;
1850 }
else if(RoiRow==36 && !isForward) {
1852 bitpos_w[0] = BIT_POS_B_INPUT_SMALL_R_CH07;
1853 bitpos_w[1] = BIT_POS_A_INPUT_SMALL_R_CH04;
1854 bitpos_w[2] = BIT_POS_A_INPUT_SMALL_R_CH04;
1855 }
else if(RoiRow==0 && isForward) {
1857 bitpos_w[0] = BIT_POS_B_INPUT_LARGE_R_CH12;
1858 bitpos_w[1] = BIT_POS_A_INPUT_LARGE_R_CH12;
1859 bitpos_w[2] = BIT_POS_A_INPUT_LARGE_R_CH08;
1860 }
else if(RoiRow==15 && isForward) {
1862 bitpos_w[0] = BIT_POS_B_INPUT_SMALL_R_CH07;
1863 bitpos_w[1] = BIT_POS_A_INPUT_SMALL_R_CH04;
1864 bitpos_w[2] = BIT_POS_A_INPUT_SMALL_R_CH03;
1866 if((hitId_w%2)==0) {
1869 bitpos_w[0] = BIT_POS_B_INPUT_LARGE_R_CH15;
1870 bitpos_w[1] = BIT_POS_A_INPUT_LARGE_R_CH12;
1871 bitpos_w[2] = BIT_POS_A_INPUT_LARGE_R_CH08;
1872 }
else if(sub_w==1) {
1873 bitpos_w[0] = BIT_POS_B_INPUT_LARGE_R_CH07;
1874 bitpos_w[1] = BIT_POS_A_INPUT_LARGE_R_CH04;
1875 bitpos_w[2] = BIT_POS_A_INPUT_LARGE_R_CH00;
1880 bitpos_w[0] = BIT_POS_B_INPUT_SMALL_R_CH15;
1881 bitpos_w[1] = BIT_POS_A_INPUT_SMALL_R_CH12;
1882 bitpos_w[2] = BIT_POS_A_INPUT_SMALL_R_CH08;
1883 }
else if(sub_w==1) {
1884 bitpos_w[0] = BIT_POS_B_INPUT_SMALL_R_CH07;
1885 bitpos_w[1] = BIT_POS_A_INPUT_SMALL_R_CH04;
1886 bitpos_w[2] = BIT_POS_A_INPUT_SMALL_R_CH00;
1895 std::array<int, 3>& bitpos_s)
1902 if((hitId_s%2)==0) {
1905 bitpos_s[0] = BIT_POS_B_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH15;
1906 bitpos_s[1] = BIT_POS_A_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH12;
1907 bitpos_s[2] = BIT_POS_A_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH08;
1908 }
else if(sub_s==1) {
1909 bitpos_s[0] = BIT_POS_B_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH07;
1910 bitpos_s[1] = BIT_POS_A_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH04;
1911 bitpos_s[2] = BIT_POS_A_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH00;
1913 }
else if((hitId_s%2)==1) {
1916 bitpos_s[0] = BIT_POS_B_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH15;
1917 bitpos_s[1] = BIT_POS_A_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH12;
1918 bitpos_s[2] = BIT_POS_A_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH08;
1919 }
else if(sub_s==1) {
1920 bitpos_s[0] = BIT_POS_B_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH07;
1921 bitpos_s[1] = BIT_POS_A_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH04;
1922 bitpos_s[2] = BIT_POS_A_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH00;
1929 int deltaBeforeConvert = 0;
1932 switch(rd.
delta()) {
1933 case 5: deltaBeforeConvert = 6;
break;
1934 case 6: deltaBeforeConvert = 8;
break;
1935 case 7: deltaBeforeConvert = 10;
break;
1936 case -4: deltaBeforeConvert = -5;
break;
1937 case -5: deltaBeforeConvert = -7;
break;
1938 case -6: deltaBeforeConvert = -9;
break;
1939 case -7: deltaBeforeConvert = -12;
break;
1940 default: deltaBeforeConvert = rd.
delta();
break;
1943 switch (rd.
delta()) {
1944 case 11: deltaBeforeConvert = 12;
break;
1945 case 12: deltaBeforeConvert = 14;
break;
1946 case 13: deltaBeforeConvert = 16;
break;
1947 case 14: deltaBeforeConvert = 18;
break;
1948 case 15: deltaBeforeConvert = 20;
break;
1949 case -12: deltaBeforeConvert = -13;
break;
1950 case -13: deltaBeforeConvert = -15;
break;
1951 case -14: deltaBeforeConvert = -17;
break;
1952 case -15: deltaBeforeConvert = -19;
break;
1953 default: deltaBeforeConvert = rd.
delta();
break;
1957 return deltaBeforeConvert;
1962 bool isBackward =
false;
1985 double& width_wire,
double& r_wire,
double& z_wire)
const
1989 std::array<const MuonGM::TgcReadoutElement*, 3> descriptor_w{muDetMgr->
getTgcReadoutElement(channelId_wire[0]),
1992 for(
int i=0;
i<3;
i++) {
1993 if(!isOfflineIdOKForTgcReadoutElement(descriptor_w[
i], channelId_wire[
i])) {
2000 bool onSurface_w = descriptor_w[2]->surface(channelId_wire[2]).globalToLocal(position_w,position_w,loc_hitPos_w);
2002 ATH_MSG_WARNING(
"Muon::TgcRdoToPrepDataToolMT::getSLWireGeometry Amg::Vector2D* loc_hitPos_w is null.");
2007 std::array<int, 3> gasGap_w{}, channel_w{};
2008 for(
int i=0;
i<3;
i++) {
2009 gasGap_w[
i] = m_idHelperSvc->tgcIdHelper().gasGap(channelId_wire[
i]);
2010 channel_w[
i] = m_idHelperSvc->tgcIdHelper().channel(channelId_wire[
i]);
2013 std::array<double,3> tmp_r_w{}, tmp_phi_w{}, tmp_eta_w{};
2015 std::array<Amg::Vector3D,3> tmp_position_w{make_array<Amg::Vector3D, 3>(
Amg::Vector3D::Zero())};
2016 for(
int i=0;
i<3;
i+=2) {
2017 tmp_position_w[
i] = descriptor_w[
i]->channelPos(channelId_wire[
i]);
2018 tmp_r_w[
i] = tmp_position_w[
i].perp();
2019 tmp_phi_w[
i] = tmp_position_w[
i].phi();
2020 tmp_eta_w[
i] = tmp_position_w[
i].eta();
2022 double half_width = descriptor_w[
i]->gangRadialLength(gasGap_w[
i], channel_w[
i])/2.;
2023 if(half_width<s_cutDropPrdsWithZeroWidth/2. && m_dropPrdsWithZeroWidth) {
2028 tmp_r_w[0] += half_width;
2030 tmp_r_w[2] -= half_width;
2034 bool flag_geteta_w = getEtafromRZ(tmp_r_w[0], tmp_position_w[0].
z(), tmp_eta_w[0]);
2035 bool flag_getr_w = getRfromEtaZ(tmp_eta_w[0], tmp_position_w[2].
z(), tmp_r_w[0]);
2036 if(!flag_geteta_w || !flag_getr_w) {
2037 ATH_MSG_DEBUG(
"TgcRdoToPrepDataToolMT::getSLWireGeometry::failed to getR on L7!!");
2040 width_wire = tmp_r_w[0] - tmp_r_w[2];
2041 double gang = descriptor_w[2]->gangShortWidth(gasGap_w[2],channel_w[2]) + width_wire/2.;
2046 descriptor_w[2]->surface(channelId_wire[2]).localToGlobal(tmp_hitPos_w,tmp_wire_gp,tmp_wire_gp);
2047 z_wire = tmp_wire_gp.z();
2048 r_wire = tmp_r_w[2] + width_wire/2.;
2054 const bool isBackward,
const bool isAside,
2055 double& width_strip,
double& theta_strip)
const
2059 std::array<const MuonGM::TgcReadoutElement*, 3> descriptor_s{muDetMgr->
getTgcReadoutElement(channelId_strip[0]),
2062 for(
int i=0;
i<3;
i++) {
2063 if(!isOfflineIdOKForTgcReadoutElement(descriptor_s[
i], channelId_strip[
i])) {
2070 bool onSurface_s = descriptor_s[1]->surface(channelId_strip[1]).globalToLocal(position_s,position_s,loc_hitPos_s);
2072 ATH_MSG_WARNING(
"Muon::TgcRdoToPrepDataToolMT::getSLStripGeometry Amg::Vector2D* loc_hitPos_s is null.");
2077 std::array<int, 3> gasGap_s, channel_s{};
2078 for(
int i=0;
i<3;
i++) {
2079 gasGap_s[
i] = m_idHelperSvc->tgcIdHelper().gasGap(channelId_strip[
i]);
2080 channel_s[
i] = m_idHelperSvc->tgcIdHelper().channel(channelId_strip[
i]);
2084 for(
int i=0;
i<3;
i+=2) {
2085 localPos[
i] = descriptor_s[
i]->transform(channelId_strip[
i]).inverse()
2086 *descriptor_s[
i]->channelPos(channelId_strip[
i]);
2089 bool flag_reverse =
false;
2090 std::array<int, 2> index_strip{};
2094 index_strip[0] = 2; index_strip[1] = 0; flag_reverse =
true;
2096 index_strip[0] = 0; index_strip[1] = 2; flag_reverse =
false;
2100 index_strip[0] = 0; index_strip[1] = 2; flag_reverse =
true;
2102 index_strip[0] = 2; index_strip[1] = 0; flag_reverse =
false;
2106 double stripMaxX = descriptor_s[index_strip[0]]->stripHighEdgeLocX(gasGap_s[index_strip[0]], channel_s[index_strip[0]],
2107 localPos[index_strip[0]].
z());
2108 double stripMinX = descriptor_s[index_strip[1]]->stripLowEdgeLocX(gasGap_s[index_strip[1]], channel_s[index_strip[1]],
2109 localPos[index_strip[1]].
z());
2110 width_strip = stripMaxX - stripMinX;
2111 double strip = stripMinX + width_strip/2.;
2112 if(flag_reverse) strip *= -1.;
2117 int index_strip_gp = 0;
2118 if(!isBackward) index_strip_gp = 0;
2119 else index_strip_gp = 2;
2121 descriptor_s[index_strip_gp]->surface(channelId_strip[index_strip_gp]).localToGlobal(tmp_hitPos_s,tmp_strip_gp,tmp_strip_gp);
2122 theta_strip = atan2(tmp_strip_gp.y(), tmp_strip_gp.x());
2129 const std::array<Identifier, 2>& channelIdOut,
2130 const std::array<int, 2>& gasGap_o,
2131 const std::array<int, 2>& channel_o,
2133 double& hit_position_o,
2138 std::array<Amg::Vector3D, 2> position_o{make_array<Amg::Vector3D, 2>(
Amg::Vector3D::Zero())};
2139 std::array<double, 2> tmp_phi_o{}, tmp_eta_o{}, tmp_r_o {};
2141 for(
int i=0;
i<2;
i++) {
2142 position_o[
i] = descriptor_o[
i]->channelPos(channelIdOut[
i]);
2143 tmp_r_o[
i] = position_o[
i].perp();
2144 tmp_phi_o[
i] = position_o[
i].phi();
2145 tmp_eta_o[
i] = position_o[
i].phi();
2147 double half_width = descriptor_o[
i]->gangRadialLength(gasGap_o[
i], channel_o[
i])/2.;
2148 if(half_width<s_cutDropPrdsWithZeroWidth/2. && m_dropPrdsWithZeroWidth) {
2151 if(
i==0) tmp_r_o[0] += half_width;
2152 else tmp_r_o[1] -= half_width;
2155 bool flag_geteta_o = getEtafromRZ(tmp_r_o[0], position_o[0].
z(), tmp_eta_o[0]);
2156 bool flag_getr_o = getRfromEtaZ(tmp_eta_o[0], position_o[1].
z(), tmp_r_o[0]);
2157 if(!flag_geteta_o || !flag_getr_o) {
2158 ATH_MSG_DEBUG(
"TgcRdoToPrepDataToolMT::getPosAndIdWireOut::failed to getR on L7!!");
2162 width_o = tmp_r_o[0] - tmp_r_o[1];
2164 hit_position_o = descriptor_o[1]->gangShortWidth(gasGap_o[1], channel_o[1]) + width_o/2;
2165 tmp_hitPos_o[
Trk::locX] = (hit_position_o);
2170 bool onSurface_o = descriptor_o[1]->surface(channelIdOut[1]).globalToLocal(position_out,position_out,loc_hitPos_o);
2172 ATH_MSG_WARNING(
"Muon::TgcRdoToPrepDataToolMT::getPosAndIdWireOut Amg::Vector2D* loc_hitPos_o is null.");
2177 channelIdOut_tmp = channelIdOut[1];
2183 const std::array<Identifier, 2>& channelIdOut,
2184 const std::array<int, 2>& gasGap_o,
2185 const std::array<int, 2>& channel_o,
2187 double& hit_position_o,
2190 const bool isBackward,
const bool isAside)
const
2194 std::array<Amg::Vector3D, 2> localpos_o{make_array<Amg::Vector3D, 2>(
Amg::Vector3D::Zero())};
2195 for(
int i=0;
i<2;
i++) {
2196 localpos_o[
i] = descriptor_o[
i]->transform(channelIdOut[
i]).inverse()*descriptor_o[
i]->channelPos(channelIdOut[
i]);
2199 std::array<int, 3>
index{};
2200 bool flag_reverse =
false;
2204 index[0] = 1;
index[1] = 0; flag_reverse =
true;
2206 index[0] = 0;
index[1] = 1; flag_reverse =
false;
2211 index[0] = 0;
index[1] = 1; flag_reverse =
true;
2213 index[0] = 1;
index[1] = 0; flag_reverse =
false;
2217 double stripMax = descriptor_o[
index[0]]->stripHighEdgeLocX(gasGap_o[
index[0]], channel_o[
index[0]],
2218 localpos_o[
index[0]].
z());
2219 double stripMin = descriptor_o[
index[1]]->stripLowEdgeLocX(gasGap_o[
index[1]], channel_o[
index[1]],
2220 localpos_o[
index[1]].
z());
2221 width_o = stripMax - stripMin;
2223 hit_position_o = stripMin + width_o/2.;
2224 if(flag_reverse) hit_position_o *= -1.;
2225 tmp_hitPos_o[
Trk::locX] = hit_position_o;
2230 bool onSurface_o = descriptor_o[1]->surface(channelIdOut[1]).globalToLocal(position_out,position_out,loc_hitPos_o);
2232 ATH_MSG_WARNING(
"Muon::TgcRdoToPrepDataToolMT::getPosAndIdStripOut Amg::Vector2D* loc_hitPos_o is null.");
2237 channelIdOut_tmp = channelIdOut[
index[2]];
2243 const std::array<Identifier, 4>& channelIdIn,
2244 const std::array<int, 4>& gasGap_i,
2245 const std::array<int, 4>& channel_i,
2246 double& width_i,
double& hit_position_i,
2251 int flag_boundary_i = 0;
2252 if(descriptor_i[1]->chamberType()==descriptor_i[3]->chamberType()) {
2254 if(gasGap_i[1]==gasGap_i[3]) {
2255 flag_boundary_i = 1;
2257 flag_boundary_i = 3;
2259 }
else if(descriptor_i[0]->chamberType()==descriptor_i[2]->chamberType()) {
2261 if(gasGap_i[0]==gasGap_i[2]) {
2262 flag_boundary_i = 0;
2264 flag_boundary_i = 2;
2267 ATH_MSG_DEBUG(
"TgcRdoToPrepDataToolMT::getPosAndIdWireIn::ROI has 3 readout elements!!");
2271 channelIdIn_tmp = channelIdIn[flag_boundary_i];
2275 if(!isOfflineIdOKForTgcReadoutElement(descriptor_iw, channelIdIn_tmp)) {
2279 std::array<double, 3> tmp_r_i{}, tmp_phi_i{}, tmp_eta_i{};
2281 std::array<Amg::Vector3D, 3> position_i {descriptor_i[0]->channelPos(channelIdIn[0]),
2282 descriptor_i[1]->channelPos(channelIdIn[1]),
2285 for(
int i=0;
i<3;
i++) {
2286 tmp_r_i[
i] =position_i[
i].perp();
2287 tmp_phi_i[
i] = position_i[
i].phi();
2288 tmp_eta_i[
i] = position_i[
i].eta();
2292 double half_width = descriptor_i[
i]->gangRadialLength(gasGap_i[
i], channel_i[
i])/2.;
2293 if(half_width<s_cutDropPrdsWithZeroWidth/2. && m_dropPrdsWithZeroWidth) {
2296 if(
i==0) tmp_r_i[0] += half_width;
2297 else tmp_r_i[1] -= half_width;
2299 bool flag_geteta_i = getEtafromRZ(tmp_r_i[
i], position_i[
i].
z(), tmp_eta_i[
i]);
2300 bool flag_getr_i = getRfromEtaZ(tmp_eta_i[
i], position_i[2].
z(), tmp_r_i[
i]);
2302 if(!flag_geteta_i || !flag_getr_i) {
2303 ATH_MSG_DEBUG(
"TgcRdoToPrepDataToolMT::getPosAndIdWireIn::failed to getRIn" <<
i <<
" on L3!!");
2309 width_i = tmp_r_i[0] - tmp_r_i[1];
2311 ATH_MSG_DEBUG(
"TgcRdoToPrepDataToolMT::getPosAndIdWireIn::minus value width_i = " << width_i);
2315 int gasGap_tmp = m_idHelperSvc->tgcIdHelper().gasGap(channelIdIn_tmp);
2316 int channel_tmp = m_idHelperSvc->tgcIdHelper().channel(channelIdIn_tmp);
2317 double half_width = descriptor_iw->
gangRadialLength(gasGap_tmp, channel_tmp)/2.;
2318 if(half_width<s_cutDropPrdsWithZeroWidth/2. && m_dropPrdsWithZeroWidth) {
2321 if((flag_boundary_i%2)==1) {
2322 tmp_r_i[2] -= half_width;
2323 hit_position_i = descriptor_iw->
gangShortWidth(gasGap_tmp, channel_tmp)
2324 - (tmp_r_i[2] - tmp_r_i[1]) + width_i/2.;
2326 tmp_r_i[2] += half_width;
2327 hit_position_i = descriptor_iw->
gangLongWidth(gasGap_tmp, channel_tmp)
2328 + (tmp_r_i[0] - tmp_r_i[2]) - width_i/2.;
2332 tmp_hitPos_i[
Trk::locX] = hit_position_i;
2333 Amg::Vector3D position_in = descriptor_i[1]->channelPos(channelIdIn[1]);
2336 bool onSurface_i = descriptor_i[1]->surface(channelIdIn[1]).globalToLocal(position_in,position_in,loc_hitPos_i);
2338 ATH_MSG_WARNING(
"Muon::TgcRdoToPrepDataToolMT::getPosAndIdWireIn Amg::Vector2D* loc_hitPos_i is null.");
2348 const std::array<Identifier, 4>& channelIdIn,
2349 const std::array<int, 4>& gasGap_i,
2350 const std::array<int, 4>& channel_i,
2352 double& hit_position_i,
2355 const bool isBackward,
const bool isAside)
const
2360 for(
int i=0;
i<4;
i++) {
2361 if(gasGap_i[
i]==3) {
2366 if(flag_isL3<0 || flag_isL3>=4) {
2367 ATH_MSG_DEBUG(
"getPosAndIdStripIn: Any bitpos is not at Layer3!");
2371 channelIdIn_tmp = channelIdIn[flag_isL3];
2375 if(!isOfflineIdOKForTgcReadoutElement(descriptor_is, channelIdIn_tmp)) {
2379 std::array<double, 3> tmp_r_i{}, tmp_phi_i{}, tmp_eta_i{};
2380 std::array<Amg::Vector3D, 3> position_is{make_array<Amg::Vector3D, 3>(
Amg::Vector3D::Zero())};
2381 for(
int i=0;
i<3;
i++) {
2383 position_is[
i] = descriptor_i[
i]->channelPos(channelIdIn[
i]);
2385 position_is[
i] = descriptor_is->
channelPos(channelIdIn_tmp);
2387 tmp_r_i[
i] = position_is[
i].perp();
2388 tmp_phi_i[
i] = position_is[
i].phi();
2389 tmp_eta_i[
i] = position_is[
i].eta();
2392 std::array<int, 2>
index{};
2393 bool flag_reverse =
false;
2396 index[0] = 1;
index[1] = 0; flag_reverse =
true;
2398 index[0] = 0;
index[1] = 1; flag_reverse =
false;
2402 index[0] = 0;
index[1] = 1; flag_reverse =
true;
2404 index[0] = 1;
index[1] = 0; flag_reverse =
false;
2408 std::array<Amg::Vector3D,2 > localpos_i{make_array<Amg::Vector3D, 2>(
Amg::Vector3D::Zero())};
2409 for(
int i=0;
i<2;
i++) {
2410 localpos_i[
i] = descriptor_i[
i]->transform(channelIdIn[
i]).inverse()*descriptor_i[
i]->channelPos(channelIdIn[
i]);
2412 double stripMaxX = descriptor_i[
index[0]]->stripHighEdgeLocX(gasGap_i[
index[0]], channel_i[
index[0]],
2413 localpos_i[
index[0]].
z());
2414 double stripMinX = descriptor_i[
index[1]]->stripLowEdgeLocX(gasGap_i[
index[1]], channel_i[
index[1]],
2415 localpos_i[
index[1]].
z());
2416 width_i = stripMaxX - stripMinX;
2418 hit_position_i = stripMinX + width_i/2.;
2419 if(flag_reverse) hit_position_i *= -1.;
2420 tmp_hitPos_i[
Trk::locX] = hit_position_i;
2425 bool onSurface_i = descriptor_i[1]->surface(channelIdIn[1]).globalToLocal(position_in,position_in,loc_hitPos_i);
2427 ATH_MSG_WARNING(
"Muon::TgcRdoToPrepDataToolMT::getPosAndIdStripIn Amg::Vector2D* loc_hitPos_i is null.");
2444 int chip =
static_cast<int>(rd.
chip());
2445 int hitId =
static_cast<int>(rd.
hitId());
2450 ATH_MSG_DEBUG(
"Failed to get SimHighPtID from RDOHighPtID for Pivot "
2451 << (rd.
isStrip() ?
"Strip" :
"Wire"));
2457 convertToRun2(rd,tmprodId,tmpsector);
2464 chip, hitId, rd.
hsub());
2469 chip, hitId, rd.
hsub());
2473 ATH_MSG_DEBUG(
"Failed to get offlineID from HighPtID for Pivot "
2474 << (rd.
isStrip() ?
"Strip" :
"Wire"));
2478 std::array<int, 3> dummy_i{};
2479 found = cinfo->
m_tgcCabling->getReadoutIDfromOfflineID(dummyId, dummy_i[0], dummy_i[1], sswId_o, sbLoc_o, dummy_i[2]);
2481 ATH_MSG_DEBUG(
"Failed to get ReadoutID from OfflineID for Pivot "
2482 << (rd.
isStrip() ?
"Strip" :
"Wire"));
2486 std::array<int, 2> i_o{};
2487 std::array<bool, 2> b_o{
false,
false};
2489 found = cinfo->
m_tgcCabling->getSLBIDfromReadoutID(i_o[0], b_o[0], b_o[1], i_o[1], slbId_o,
2492 found = cinfo->
m_tgcCabling->getSLBIDfromReadoutID(i_o[0], b_o[0], b_o[1], i_o[1], slbId_o,
2496 ATH_MSG_DEBUG(
"Failed to get SLBID from ReadoutID for Pivot "
2497 << (rd.
isStrip() ?
"Strip" :
"Wire"));
2506 int&
index,
int& chip,
int& hitId,
int& sub,
int& sswId,
int& sbLoc,
2508 std::array<int, 3>& bitpos,
2509 const bool isBoundary,
const TgcRdo* rdoColl,
2510 const int index_w,
const int chip_w,
const int hitId_w,
const int sub_w)
const
2527 << (!
isStrip ?
"Wire" :
"Strip"));
2537 ATH_MSG_DEBUG(
"Failed to get SimHighPtID from RDOHighPtID for "
2538 << (!
isStrip ?
"Wire" :
"Strip"));
2555 << (!
isStrip ?
"Wire" :
"Strip"));
2561 std::array<int, 3> dummy_i{};
2570 << (!
isStrip ?
"Wire" :
"Strip"));
2577 bool exist_hipt_s = getSbLocOfEndcapStripBoundaryFromHiPt(rd, sbLoc, rdoColl, index_w, chip_w, hitId_w, sub_w);
2580 bool exist_tracklet_s = getSbLocOfEndcapStripBoundaryFromTracklet(rd, sbLoc, rdoColl, index_w, chip_w, hitId_w, sub_w);
2581 if(!exist_tracklet_s) {
2582 ATH_MSG_DEBUG(
"Failed to find correspond Tracklet_strip for SL!!");
2589 getBitPosWire(rd, hitId, sub, subMatrix, bitpos);
2591 getBitPosStrip(hitId, sub, subMatrix, bitpos);
2594 for(
int i=0;
i<3;
i++) {
2595 if(
i==1 && (!
isStrip || !isBoundary))
continue;
2605 << (!
isStrip ?
"Wire" :
"Strip"));
2608 <<
", rodId = " << rd.
rodId()
2609 <<
", sswId = " << sswId
2610 <<
", slbId = " << sbLoc
2611 <<
", bitpos_" << (!
isStrip ?
"w" :
"s")
2612 <<
"[" <<
i <<
"] = " << bitpos[
i]);
2624 const int index_w,
const int chip_w,
const int hitId_w,
const int sub_w)
const
2631 bool exist_hipt_s =
false;
2634 int trackletIdStripFirst{-1}, trackletIdStripSecond{-1}, trackletIdStripThird{-1};
2635 getEndcapStripCandidateTrackletIds(
static_cast<int>(rd.
roi()), trackletIdStripFirst,
2636 trackletIdStripSecond, trackletIdStripThird);
2643 convertToRun2(rdH0,tmprodId,tmpsector);
2644 const TgcRawData rdH(rdH0->bcTag(), rdH0->subDetectorId(), tmprodId,
2645 rdH0->l1Id(), rdH0->bcId(), rdH0->isStrip(),
2646 rdH0->isForward(), tmpsector, rdH0->chip(),
2647 rdH0->index(),rdH0->isHipt(), rdH0->hitId(),
2648 rdH0->hsub(), rdH0->delta(), rdH0->inner());
2661 int sswId_o{0}, sbLoc_o{0}, slbId_o{0};
2662 bool found = getHiPtIds(rdH, sswId_o, sbLoc_o, slbId_o);
2668 int slbsubMatrix = 0;
2669 std::array<int, 2> bitpos_o{};
2670 getBitPosOutStrip(rdH, slbsubMatrix, bitpos_o);
2673 int trackletIdStrip = 2*sbLoc_o + slbsubMatrix;
2676 if(trackletIdStrip!=trackletIdStripFirst && trackletIdStrip!=trackletIdStripSecond &&
2677 trackletIdStrip!=trackletIdStripThird)
continue;
2680 if(exist_hipt_s && trackletIdStrip==trackletIdStripThird)
continue;
2683 int index_w_tmp = index_w;
2684 int chip_w_tmp = chip_w;
2685 int hitId_w_tmp = hitId_w;
2693 ATH_MSG_DEBUG(
"Failed to get RDOHighPtID from SimHighPtID for Wire");
2698 int chip_s =
static_cast<int>(rdH.
chip());
2699 int hitId_s =
static_cast<int>(rdH.
hitId());
2700 int hsub_s =
static_cast<int>(rdH.
hsub());
2713 ATH_MSG_DEBUG(
"Failed to get ROINumber from HighPtID for Strip");
2719 exist_hipt_s =
true;
2720 if(trackletIdStrip==trackletIdStripFirst)
break;
2725 return exist_hipt_s;
2730 const int index_w,
const int chip_w,
2731 const int hitId_w,
const int sub_w)
const
2735 bool exist_tracklet_s =
false;
2738 int trackletIdStripFirst{-1}, trackletIdStripSecond{-1}, trackletIdStripThird{-1};
2739 getEndcapStripCandidateTrackletIds(
static_cast<int>(rd.
roi()), trackletIdStripFirst,
2740 trackletIdStripSecond, trackletIdStripThird);
2746 uint16_t tmprodId{0}, tmpsector{0};
2747 convertToRun2(rdS0,tmprodId,tmpsector);
2748 const TgcRawData rdS(rdS0->bcTag(), rdS0->subDetectorId(), tmprodId,
2749 rdS0->sswId(), rdS0->slbId(), rdS0->l1Id(),
2750 rdS0->bcId(), rdS0->slbType(), rdS0->delta(),
2751 rdS0->segment(), rdS0->subMatrix(), rdS0->position());
2753 bool isForward_s = (rdS.
sswId()==7);
2754 if(isForward_s)
continue;
2765 int trackletIdStrip =
static_cast<int>(2*rdS.
slbId()+rdS.
subMatrix());
2766 if(trackletIdStrip!=trackletIdStripFirst &&
2767 trackletIdStrip!=trackletIdStripSecond &&
2768 trackletIdStrip!=trackletIdStripThird)
continue;
2771 if(exist_tracklet_s && trackletIdStrip==trackletIdStripThird)
continue;
2778 ATH_MSG_DEBUG(
"Failed to get OfflineID from LowPtCoincidenceID for Strip");
2782 std::array<int, 7>
i{};
2783 std::array<bool, 2>
b{};
2789 ATH_MSG_DEBUG(
"Failed to get HighPtID from OfflineID for Strip");
2794 int index_w_tmp = index_w;
2795 int chip_w_tmp = chip_w;
2796 int hitId_w_tmp = hitId_w;
2803 ATH_MSG_DEBUG(
"Failed to get RDOHighPtID from SimHighPtID for Wire");
2813 ATH_MSG_DEBUG(
"Failed to get RDOHighPtID from SimHighPtID for Strip");
2828 ATH_MSG_DEBUG(
"Failed to get ROINumber from HighPtID for Strip");
2833 sbLoc = rdS.
slbId();
2834 exist_tracklet_s =
true;
2835 if(trackletIdStrip==trackletIdStripFirst)
break;
2840 return exist_tracklet_s;
2844 int &trackletIdStripSecond,
2845 int &trackletIdStripThird) {
2846 constexpr
int T9SscMax = 2;
2847 constexpr
int T8SscMax = 4;
2848 constexpr
int T7SscMax = 6;
2849 constexpr
int T6SscMax = 12;
2850 constexpr
int T5SscMax = 18;
2852 constexpr
int T9Offset = 32 + 0;
2853 constexpr
int T8Offset = 32 + 2;
2854 constexpr
int T7Offset = 32 + 4;
2855 constexpr
int T6Offset = 32 + 6;
2856 constexpr
int T5Offset = 32 + 8;
2861 int ssc = (roi+4)/8;
2862 int halfSsc = (roi%4)/2;
2864 if( ssc< T9SscMax) {
2865 trackletIdStripFirst = T9Offset + halfSsc;
2866 trackletIdStripSecond = -1;
2867 trackletIdStripThird = -1;
2868 }
else if(ssc==T9SscMax) {
2869 trackletIdStripFirst = T8Offset + halfSsc;
2870 trackletIdStripSecond = T9Offset + halfSsc;
2871 trackletIdStripThird = -1;
2872 }
else if(ssc< T8SscMax) {
2873 trackletIdStripFirst = T8Offset + halfSsc;
2874 trackletIdStripSecond = -1;
2875 trackletIdStripThird = -1;
2876 }
else if(ssc==T8SscMax) {
2877 trackletIdStripFirst = T7Offset + halfSsc;
2878 trackletIdStripSecond = T8Offset + halfSsc;
2879 trackletIdStripThird = -1;
2880 }
else if(ssc< T7SscMax) {
2881 trackletIdStripFirst = T7Offset + halfSsc;
2882 trackletIdStripSecond = -1;
2883 trackletIdStripThird = -1;
2884 }
else if(ssc==T7SscMax) {
2885 trackletIdStripFirst = T6Offset + halfSsc;
2886 trackletIdStripSecond = T7Offset + halfSsc;
2887 trackletIdStripThird = T5Offset + halfSsc;
2888 }
else if(ssc< T6SscMax) {
2889 trackletIdStripFirst = T6Offset + halfSsc;
2890 trackletIdStripSecond = T5Offset + halfSsc;
2891 trackletIdStripThird = -1;
2892 }
else if(ssc==T6SscMax) {
2893 trackletIdStripFirst = T6Offset + halfSsc;
2894 trackletIdStripSecond = T5Offset + halfSsc;
2895 trackletIdStripThird = -1;
2896 }
else if(ssc<=T5SscMax) {
2897 trackletIdStripFirst = T5Offset + halfSsc;
2898 trackletIdStripSecond = T6Offset + halfSsc;
2899 trackletIdStripThird = -1;
2901 trackletIdStripFirst = -1;
2902 trackletIdStripSecond = -1;
2903 trackletIdStripThird = -1;
2910 if (m_cablingInfo.isValid()) {
2911 return m_cablingInfo.ptr();
2924 unsigned int hashId_max = m_idHelperSvc->tgcIdHelper().module_hash_max();
2926 IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context();
2928 int subDetectorId = 0;
2931 for(
unsigned int hashId=0; hashId<hashId_max; hashId++) {
2932 IdentifierHash
hash(hashId);
2933 m_idHelperSvc->tgcIdHelper().get_id(
hash, elementId, &tgcContext);
2934 cinfo.
m_tgcCabling->getReadoutIDfromElementID(elementId, subDetectorId, rodId);
2943 m_cablingInfo.set (std::move (cinfo));
2944 return m_cablingInfo.ptr();
2951 if(!readout)
return nullptr;
2954 constexpr
double length = 100.;
2955 constexpr
unsigned int nRep = 10;
2956 constexpr
double dRAccuracy = 1.0E-20;
2957 constexpr
double maxLocR = 10000.;
2961 for(
unsigned int iRep=0; iRep<nRep; iRep++) {
2967 double glob_eta_c = glob_hitPos_c.eta();
2968 double glob_phi_c = glob_hitPos_c.phi();
2972 double dR = std::hypot(vector[0], vector[1]);
2987 matrix(0,0) = glob_hitPos_w.eta() - glob_eta_c;
2989 matrix(0,1) = glob_hitPos_s.eta() - glob_eta_c;
2992 bool invertible =
matrix.determinant();