ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::TgcRdoToPrepDataToolMT Class Reference

This is the algorithm that convert TGCRdo To TGCPrepdata as a tool. More...

#include <TgcRdoToPrepDataToolMT.h>

Inheritance diagram for Muon::TgcRdoToPrepDataToolMT:

Classes

struct  State

Public Member Functions

virtual ~TgcRdoToPrepDataToolMT ()=default
 Destructor.
virtual StatusCode initialize () override
 Standard AthAlgTool initialize method.
virtual StatusCode finalize () override
 Standard AthAlgTool finalize method.
virtual StatusCode decode (const EventContext &ctx, const std::vector< IdentifierHash > &idVect) const override
 Decode RDO to PRD A vector of IdentifierHash are passed in, and the data corresponding to this list (i.e.
virtual StatusCode provideEmptyContainer (const EventContext &ctx) const override

Private Types

enum  SUB_DETCTOR_ID { ASIDE = 103 , CSIDE = 104 }
 Sub detector IDs are 103 and 104 for TGC A side and C side, respectively. More...
enum  BIT_POS {
  BIT_POS_ASD_SIZE = 16 , BIT_POS_NUM_ASD = 2 , BIT_POS_INPUT_SIZE = BIT_POS_ASD_SIZE * BIT_POS_NUM_ASD , BIT_POS_OFFSET_LARGE_R = BIT_POS_ASD_SIZE ,
  BIT_POS_OFFSET_LARGE_PHIFOR_A_FWD_C_BWD = BIT_POS_OFFSET_LARGE_R , BIT_POS_A_INPUT_ORIGIN = 73 , BIT_POS_B_INPUT_ORIGIN = 109 , BIT_POS_C_INPUT_ORIGIN = 149 ,
  BIT_POS_D_INPUT_ORIGIN = 193 , BIT_POS_B_INPUT_LARGE_R_CH15 , BIT_POS_A_INPUT_LARGE_R_CH08 , BIT_POS_B_INPUT_LARGE_R_CH07 ,
  BIT_POS_A_INPUT_LARGE_R_CH00 , BIT_POS_B_INPUT_SMALL_R_CH15 = BIT_POS_B_INPUT_ORIGIN - 15 , BIT_POS_A_INPUT_SMALL_R_CH08 = BIT_POS_A_INPUT_ORIGIN - 8 , BIT_POS_B_INPUT_SMALL_R_CH07 = BIT_POS_B_INPUT_ORIGIN - 7 ,
  BIT_POS_A_INPUT_SMALL_R_CH00 = BIT_POS_A_INPUT_ORIGIN , BIT_POS_B_INPUT_SMALL_R_CH05 = BIT_POS_B_INPUT_ORIGIN - 5 , BIT_POS_A_INPUT_SMALL_R_CH03 = BIT_POS_A_INPUT_ORIGIN - 3 , BIT_POS_B_INPUT_LARGE_R_CH12 ,
  BIT_POS_A_INPUT_SMALL_R_CH04 = BIT_POS_A_INPUT_ORIGIN - 4 , BIT_POS_A_INPUT_LARGE_R_CH12 , BIT_POS_A_INPUT_LARGE_R_CH04 , BIT_POS_A_INPUT_SMALL_R_CH12 = BIT_POS_A_INPUT_ORIGIN - 12 ,
  BIT_POS_B_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH15 , BIT_POS_A_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH08 , BIT_POS_B_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH07 , BIT_POS_A_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH00 ,
  BIT_POS_B_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH15 , BIT_POS_A_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH08 , BIT_POS_B_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH07 , BIT_POS_A_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH00 ,
  BIT_POS_A_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH12 , BIT_POS_A_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH04 , BIT_POS_A_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH12 , BIT_POS_A_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH04
}
 SLB bit position /code Large R <--> Small R Large phi <--> Small phi for A side forward chambers and C side backward chambers Small phi <--> Large phi for A side backward chambers and C side forward chambers A-input : 40 - 75, 42 - 73 are valid. More...
enum  MAP_SIZE { WT_MAP_SIZE = 3 * BIT_POS_INPUT_SIZE , ST_MAP_SIZE = 2 * BIT_POS_INPUT_SIZE , SD_MAP_SIZE = 2 * BIT_POS_INPUT_SIZE , WD_MAP_SIZE = 2 * BIT_POS_INPUT_SIZE }
 Bit map sizes. More...

Private Member Functions

template<class ContType, class CollType>
StatusCode transferData (ContType &container, std::vector< std::unique_ptr< CollType > > &&coll) const
StatusCode setupState (const EventContext &ctx, State &state) const
void selectDecoder (State &state, const TgcRawData &rd, const TgcRdo *rdoColl) const
 Select decoder based on RDO type (Hit or Coincidence (Tracklet, HiPt and SL)).
StatusCode decodeHits (State &state, const TgcRawData &rd) const
 Decode RDO's of Hit.
StatusCode decodeTracklet (State &state, const TgcRawData &rd) const
 Decode RDO's of Tracklet.
StatusCode decodeTrackletEIFI (State &state, const TgcRawData &rd) const
 Decode RDO's of Tracklet EIFI.
StatusCode decodeHiPt (State &state, const TgcRawData &rd) const
 Decode RDO's of HiPt.
StatusCode decodeInner (State &state, const TgcRawData &rd) const
 Decode RDO's of Inner.
StatusCode decodeSL (State &state, const TgcRawData &rd, const TgcRdo *rdoColl) const
 Decode RDO's of SectorLogic.
bool isOfflineIdOKForTgcReadoutElement (const MuonGM::TgcReadoutElement *descriptor, const Identifier channelId) const
 Check offline ID is OK for TgcReadoutElement.
bool getTrackletInfo (const TgcRawData &rd, int &tmp_slbId, int &tmp_subMatrix, int &tmp_position) const
 Retrieve slbId, subMatrix and position from Tracklet RDO.
bool isIncludedInChamberBoundary (const TgcRawData &rd) const
 Check SL RDO is at the chamber boundary.
void getBitPosInWire (const TgcRawData &rd, const int DeltaBeforeConvert, std::array< int, 4 > &bitpos_i, std::array< int, 4 > &slbchannel_i, std::array< int, 4 > &slbId_in, std::array< int, 4 > &sbLoc_in, int &sswId_i, const std::array< int, 2 > &bitpos_o, std::array< int, 2 > &slbchannel_o, const int slbId_o) const
 Get bitPos etc of TGC1 wire for HiPt.
void getBitPosInStrip (const TgcRawData &rd, const int DeltaBeforeConvert, std::array< int, 4 > &bitpos_i, std::array< int, 4 > &slbchannel_i, int &sbLoc_i, int &sswId_i, const std::array< int, 2 > &bitpos_o, std::array< int, 2 > &slbchannel_o) const
 Get bitPos etc of TGC1 strip for HiPt.
void getBitPosWire (const TgcRawData &rd, const int hitId_w, const int sub_w, int &subMatrix_w, std::array< int, 3 > &bitpos_w) const
 Get bitPos etc of wire for SL.
bool getSLWireGeometry (const std::array< Identifier, 3 > &channelId_wire, double &width_wire, double &r_wire, double &z_wire) const
 Get wire geometry (width, r, z) for SL.
bool getSLStripGeometry (const std::array< Identifier, 3 > &channelId_strip, const bool isBackWard, const bool isAside, double &width_strip, double &theta_strip) const
 Get strip geometry (width, theta) for SL.
bool getPosAndIdWireOut (const std::array< const MuonGM::TgcReadoutElement *, 2 > &descriptor_o, const std::array< Identifier, 2 > &channelIdOut, const std::array< int, 2 > &gasGap_o, const std::array< int, 2 > &channel_o, double &width_o, double &hit_position_o, Amg::Vector2D &tmp_hitPos_o, Identifier &channelIdOut_tmp) const
 Get position and offline ID of TGC3 wire for HiPt.
bool getPosAndIdStripOut (const std::array< const MuonGM::TgcReadoutElement *, 2 > &descriptor_o, const std::array< Identifier, 2 > &channelIdOut, const std::array< int, 2 > &gasGap_o, const std::array< int, 2 > &channel_o, double &width_o, double &hit_position_o, Amg::Vector2D &tmp_hitPos_o, Identifier &channelIdOut_tmp, const bool isBackward, const bool isAside) const
 Get position and offline ID of TGC3 strip for HiPt.
bool getPosAndIdWireIn (const std::array< const MuonGM::TgcReadoutElement *, 4 > &descriptor_i, const std::array< Identifier, 4 > &channelIdIn, const std::array< int, 4 > &gasGap_i, const std::array< int, 4 > &channel_i, double &width_i, double &hit_position_i, Amg::Vector2D &tmp_hitPos_i, Identifier &channelIdIn_tmp) const
 Get position and offline ID of TGC1 wire for HiPt.
bool getPosAndIdStripIn (const std::array< const MuonGM::TgcReadoutElement *, 4 > &descriptor_i, const std::array< Identifier, 4 > &channelIdIn, const std::array< int, 4 > &gasGap_i, const std::array< int, 4 > &channel_i, double &width_i, double &hit_position_i, Amg::Vector2D &tmp_hitPos_i, Identifier &channelIdIn_tmp, const bool isBackward, const bool isAside) const
 Get position and offline ID of TGC1 strip for HiPt.
bool getHiPtIds (const State &state, const TgcRawData &rd, int &sswId_o, int &sbLoc_o, int &slbId_o) const
 Get ReadoutID of HiPt from RDOHighPtID.
bool getSLIds (const State &state, const bool isStrip, const TgcRawData &rd, std::array< Identifier, 3 > &channelId, int &index, int &chip, int &hitId, int &sub, int &sswId, int &sbLoc, int &subMatrix, std::array< int, 3 > &bitpos, const bool isBoundary=false, const TgcRdo *rdoColl=0, const int index_w=-1, const int chip_w=-1, const int hitId_w=-1, const int sub_w=-1) const
 Get ReadoutID of SL from RDO.
bool getSbLocOfEndcapStripBoundaryFromHiPt (const State &state, const TgcRawData &rd, int &sbLoc, const TgcRdo *rdoColl, const int index_w, const int chip_w, const int hitId_w, const int sub_w) const
 Get strip sbLoc of Endcap chamber boundary from HiPt Strip.
bool getSbLocOfEndcapStripBoundaryFromTracklet (const State &state, const TgcRawData &rd, int &sbLoc, const TgcRdo *rdoColl, const int index_w, const int chip_w, const int hitId_w, const int sub_w) const
 Get strip sbLoc of Endcap chamber boundary from Tracklet Strip.
StatusCode decode (const EventContext &ctx, const std::vector< uint32_t > &robIds) const override
 Avoid compiler warning.
void convertToRun2 (const TgcRawData *rd, uint16_t &newrodId, uint16_t &newsector) const
void convertToRun2 (const TgcRawData &rd, uint16_t &newrodId, uint16_t &newsector) const

Static Private Member Functions

static int getbitpos (int channel, TgcRawData::SlbType slbType)
 Get bitpos from channel and SlbType.
static int getchannel (int bitpos, TgcRawData::SlbType slbType)
 Get channel from bitpos and SlbType.
static bool getRfromEtaZ (const double eta, const double z, double &r)
 Get r from eta and z.
static bool getEtafromRZ (const double r, const double z, double &eta)
 Get eta from r and z.
static bool isAlreadyConverted (const std::vector< const TgcRdo * > &decodedRdoCollVec, const std::vector< const TgcRdo * > &rdoCollVec, const TgcRdo *rdoColl)
 Check the rdo is already converted or not.
static bool isRequested (const std::vector< IdentifierHash > &requestedIdHashVect, IdentifierHash tgcHashId)
 Check the IdHash is already requested or not.
static int getRoiRow (const TgcRawData &rd)
 Get ROI row from RDO.
static void getBitPosOutWire (const TgcRawData &rd, int &slbsubMatrix, std::array< int, 2 > &bitpos_o)
 Get bitPos etc of TGC3 wire for HiPt.
static void getBitPosOutStrip (const TgcRawData &rd, int &slbsubMatrix, std::array< int, 2 > &bitpos_o)
 Get bitPos etc of TGC3 strip for HiPt.
static void getBitPosStrip (const int hitId_s, const int sub_s, int &subMatrix_s, std::array< int, 3 > &bitpos_s)
 Get bitPos etc of strip for SL.
static int getDeltaBeforeConvert (const TgcRawData &rd)
 Get delta (sagitta) before converion for HiPt.
static bool isBackwardBW (const TgcRawData &rd)
 Check if a chamber in BigWheel is a backward chamber or a forward chamber.
static void getEndcapStripCandidateTrackletIds (const int roi, int &trackletIdStripFirst, int &trackletIdStripSecond, int &trackletIdStripThird)
 Get trackletIds of three Tracklet Strip candidates in the Endcap boudary.
static Amg::Vector2D getSLLocalPosition (const MuonGM::TgcReadoutElement *readout, const Identifier, const double eta, const double phi)
 Get SL local position.

Private Attributes

SG::ReadCondHandleKey< MuonGM::MuonDetectorManagerm_muDetMgrKey
SG::ReadCondHandleKey< Muon::TgcCablingMapm_cablingKey
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc
Gaudi::Property< std::string > m_outputCollectionLocation
 TgcPrepRawData container key for curfrent BC.
Gaudi::Property< std::string > m_outputCoinCollectionLocation
 TgcCoinData container key for current BC.
Gaudi::Property< int > m_tgcOffset {this, "TGCHashIdOffset", 26000}
 Identifier hash offset.
Gaudi::Property< bool > m_decodeData {this, "DecodeData", true}
 Switch for the decoding of TGC RDO into TgcPrepData.
Gaudi::Property< bool > m_fillCoinData {this, "FillCoinData", true}
 Switch for the coincince decoding.
Gaudi::Property< bool > m_show_warning_level_invalid_A09_SSW6_hit
 Switch for error message disabling on one invalid channel in sector A09 seen in 2008 data, at least run 79772 - 91800.
Gaudi::Property< bool > m_dropPrdsWithZeroWidth
 Flag for dropping PRD's with zero widths.
std::atomic< long > m_nHitRDOs {0}
 long to count the numbers of RDOs and PRDs
std::atomic< long > m_nHitPRDs {0}
std::atomic< long > m_nTrackletRDOs {0}
std::atomic< long > m_nTrackletPRDs {0}
std::atomic< long > m_nTrackletEIFIRDOs {0}
std::atomic< long > m_nTrackletEIFIPRDs {0}
std::atomic< long > m_nHiPtRDOs {0}
std::atomic< long > m_nHiPtPRDs {0}
std::atomic< long > m_nSLRDOs {0}
std::atomic< long > m_nSLPRDs {0}
SG::ReadHandleKey< TgcRdoContainerm_rdoContainerKey
SG::WriteHandleKeyArray< Muon::TgcCoinDataContainerm_outputCoinKeys
SG::WriteHandleKey< Muon::TgcPrepDataContainerm_prdWriteKey
SG::UpdateHandleKey< TgcPrepDataCollection_Cachem_prdContainerCacheKey {this, "UpdateKeyPrd", "", "Optional external cache for the sTGC PRD container"}
 Keys for the PRD cache containers, 4 needed for different BC.
TgcCoinUpdateHandles m_coinContainerCacheKeys {this, "UpdateKeysCoin", {}}
 Keys for the Coin cache containers, 3 needed for different BC.
Gaudi::Property< std::string > m_coinContainerCacheKeyStr
Gaudi::Property< bool > m_convertAllBCs {this, "convertAllBCs", true}
 Convert hits from all bunch crossings.

Static Private Attributes

static constexpr int NBC_HIT = 3
 The number of recorded Bunch Crossings (BCs) FOR HITS is 3 (Previous, Current, and Next BCs).
static constexpr int NBC_TRIG = 4
static const double s_cutDropPrdsWithZeroWidth
 Cut value for zero widths.

Detailed Description

This is the algorithm that convert TGCRdo To TGCPrepdata as a tool.

Author
Susumu Oda Susum.nosp@m.u.Od.nosp@m.a@cer.nosp@m.n.ch
Edward Moyse

This class was developed by Takashi Kubota.

Definition at line 51 of file TgcRdoToPrepDataToolMT.h.

Member Enumeration Documentation

◆ BIT_POS

SLB bit position /code Large R <--> Small R Large phi <--> Small phi for A side forward chambers and C side backward chambers Small phi <--> Large phi for A side backward chambers and C side forward chambers A-input : 40 - 75, 42 - 73 are valid.

B-input : 76 - 111, 78 - 109 are valid. C-input : 112 - 155, 118 - 149 are valid. D-input : 156 - 199, 162 - 193 are valid.

Channel in this code : Large R 15 14 13 12 11 ... 0 15 ... 3 2 1 0 Small R (it is better to be reverted to avoid confusion) ASD channel order : 15 ... ... 0 (there are shifts dependent on position) PS board channel : 0 1 2 3 4 ... 15 16 ... 28 29 30 31 A-Input : 40 41 42 43 44 45 46 ... 57 58 ... 70 71 72 73 74 75 B-Input : 76 77 78 79 80 81 82 ... 93 94 ... 106 107 108 109 110 111 C-Input : 112 113 114 115 116 117 118 119 120 121 122 ... 133 134 ... 146 147 148 149 150 151 152 153 154 155 D-Input : 156 157 158 159 160 161 162 163 164 165 166 ... 177 178 ... 190 191 192 193 194 195 196 197 198 199 /endcode

Enumerator
BIT_POS_ASD_SIZE 
BIT_POS_NUM_ASD 
BIT_POS_INPUT_SIZE 
BIT_POS_OFFSET_LARGE_R 
BIT_POS_OFFSET_LARGE_PHIFOR_A_FWD_C_BWD 
BIT_POS_A_INPUT_ORIGIN 
BIT_POS_B_INPUT_ORIGIN 
BIT_POS_C_INPUT_ORIGIN 
BIT_POS_D_INPUT_ORIGIN 
BIT_POS_B_INPUT_LARGE_R_CH15 
BIT_POS_A_INPUT_LARGE_R_CH08 
BIT_POS_B_INPUT_LARGE_R_CH07 
BIT_POS_A_INPUT_LARGE_R_CH00 
BIT_POS_B_INPUT_SMALL_R_CH15 
BIT_POS_A_INPUT_SMALL_R_CH08 
BIT_POS_B_INPUT_SMALL_R_CH07 
BIT_POS_A_INPUT_SMALL_R_CH00 
BIT_POS_B_INPUT_SMALL_R_CH05 
BIT_POS_A_INPUT_SMALL_R_CH03 
BIT_POS_B_INPUT_LARGE_R_CH12 
BIT_POS_A_INPUT_SMALL_R_CH04 
BIT_POS_A_INPUT_LARGE_R_CH12 
BIT_POS_A_INPUT_LARGE_R_CH04 
BIT_POS_A_INPUT_SMALL_R_CH12 
BIT_POS_B_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH15 
BIT_POS_A_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH08 
BIT_POS_B_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH07 
BIT_POS_A_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH00 
BIT_POS_B_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH15 
BIT_POS_A_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH08 
BIT_POS_B_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH07 
BIT_POS_A_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH00 
BIT_POS_A_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH12 
BIT_POS_A_INPUT_LARGE_PHI_FOR_A_FWD_C_BWD_CH04 
BIT_POS_A_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH12 
BIT_POS_A_INPUT_SMALL_PHI_FOR_A_FWD_C_BWD_CH04 

Definition at line 145 of file TgcRdoToPrepDataToolMT.h.

145 {
146 BIT_POS_ASD_SIZE = 16,
147 BIT_POS_NUM_ASD = 2,
155
156 /* CHannel starts from 00 at the small R side (the same as ASD). */
169
174
181
182 /* CHannel starts from 00
183 at the small phi side for A side forward chambers and C side backward
184 chambers and at the large phi side for A side backward chambers and C
185 side forward chambers (the same as ASD). */
202
211 };

◆ MAP_SIZE

◆ SUB_DETCTOR_ID

Sub detector IDs are 103 and 104 for TGC A side and C side, respectively.

Enumerator
ASIDE 
CSIDE 

Definition at line 118 of file TgcRdoToPrepDataToolMT.h.

Constructor & Destructor Documentation

◆ ~TgcRdoToPrepDataToolMT()

virtual Muon::TgcRdoToPrepDataToolMT::~TgcRdoToPrepDataToolMT ( )
virtualdefault

Destructor.

Member Function Documentation

◆ convertToRun2() [1/2]

void Muon::TgcRdoToPrepDataToolMT::convertToRun2 ( const TgcRawData & rd,
uint16_t & newrodId,
uint16_t & newsector ) const
inlineprivate

Definition at line 484 of file TgcRdoToPrepDataToolMT.h.

485 {
486 convertToRun2(&rd, newrodId, newsector);
487 }
void convertToRun2(const TgcRawData *rd, uint16_t &newrodId, uint16_t &newsector) const

◆ convertToRun2() [2/2]

void Muon::TgcRdoToPrepDataToolMT::convertToRun2 ( const TgcRawData * rd,
uint16_t & newrodId,
uint16_t & newsector ) const
inlineprivate

Definition at line 469 of file TgcRdoToPrepDataToolMT.h.

470 {
471 newrodId = rd->rodId();
472 newsector = rd->sector();
473 if (rd->rodId() >
474 12) { // Run3 rodID is 17..19 while Run2 rodId is 1..12
475 if (rd->isForward()) {
476 newrodId = rd->sector() / 2 + 1 + (rd->rodId() - 17) * 4;
477 newsector = (rd->sector() + (rd->rodId() - 17) * 8) % 2;
478 } else {
479 newrodId = rd->sector() / 4 + 1 + (rd->rodId() - 17) * 4;
480 newsector = (rd->sector() + (rd->rodId() - 17) * 16) % 4;
481 }
482 }
483 }
uint16_t rodId() const
Definition TgcRawData.h:268
uint16_t sector() const
Definition TgcRawData.h:333
bool isForward() const
Definition TgcRawData.h:289

◆ decode() [1/2]

StatusCode Muon::TgcRdoToPrepDataToolMT::decode ( const EventContext & ctx,
const std::vector< IdentifierHash > & idVect ) const
overridevirtual

Decode RDO to PRD A vector of IdentifierHash are passed in, and the data corresponding to this list (i.e.

in a Region of Interest) are converted.

Parameters
requestedIdHashVectVector of hashes to convert i.e. the hashes of ROD collections in a 'Region of Interest'
Returns
selectedIdHashVect This is the subset of requestedIdVect which were actually found to contain data (i.e. if you want you can use this vector of hashes to optimise the retrieval of data in subsequent steps.)

here the RDO container is retrieved and filled -whatever input type we start with- => check the size

Sort the all BC PRDs

Definition at line 179 of file TgcRdoToPrepDataToolMT.cxx.

181 {
182 // Object to hold the containers for this decode call
183 State state{};
184 ATH_CHECK(setupState(ctx, state));
185
186
187 int sizeVectorRequested = requestedIdHashVect.size();
188 ATH_MSG_DEBUG("decode for " << sizeVectorRequested
189 << " offline collections called");
190
191
192 std::set<const TgcRdo*> decodedRdoCollVec{}, rdoCollVec{};
193 std::array<char, 24> decodedOnlineId{};
194
195 // if TGC decoding is switched off stop here
196 if (!m_decodeData) {
198 "Stored empty container. Decoding TGC RDO into TGC PrepRawData is "
199 "switched off");
200 return StatusCode::SUCCESS;
201 }
202
203 ATH_MSG_DEBUG("Decoding TGC RDO into TGC PrepRawData");
204
205 // retrieve the collection of RDO
206 ATH_MSG_DEBUG("Retrieving TGC RDO container from the store");
207 const TgcRdoContainer* rdoContainer{};
208 ATH_CHECK(SG::get(rdoContainer, m_rdoContainerKey, ctx));
211 if (rdoContainer->empty()) {
212 // empty csm container - no tgc rdo in this event
213 ATH_MSG_DEBUG("Empty rdo container - no tgc rdo in this event");
214 return StatusCode::SUCCESS;
215 }
216
218 "Not empty rdo container in this event, the container size is "
219 << rdoContainer->size());
220
221 // select RDOs to be decoded when seeded mode is used
222 if (sizeVectorRequested != 0) {
223 unsigned int nRdo = 0;
224 const IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context(); // TGC context
225
226 for (const IdentifierHash& offlineCollHash : requestedIdHashVect) {
227 Identifier elementId;
228 int subDetectorId = 0; // 103(=0x67) for A side, 104(=0x68) for C side
229 int rodId = 0; // 1 to 12 (12-fold cabling)
230 m_idHelperSvc->tgcIdHelper().get_id(offlineCollHash, elementId, &tgcContext);
231 state.cabling->getReadoutIDfromElementID(elementId, subDetectorId, rodId);
232 // onlineId: 0 to 11 on A side and 12 to 23 on C side (12-fold cabling)
233 const uint16_t onlineId = TgcRdo::calculateOnlineId(subDetectorId, rodId);
234
235 if (decodedOnlineId.at(onlineId)) {
236 ATH_MSG_DEBUG("The ROB with onlineId "
237 << onlineId << " which contains hash "
238 << static_cast<unsigned int>(offlineCollHash)
239 << " is already decoded and skipped");
240 continue;
241 }
242
243 decodedOnlineId.at(onlineId) = true; // The ROB with this onlineId will be decoded only once
244
245 for (const TgcRdo* rdoColl : *rdoContainer) {
246 if (rdoColl->identify() == onlineId) {
247 if (!decodedRdoCollVec.count(rdoColl)) {
248 rdoCollVec.insert(rdoColl);
249 nRdo++;
250 }
251 break;
252 }
253 }
254 }
255 ATH_MSG_DEBUG("Number of RDOs to be converted is " << nRdo);
256 } // End of selection of RDOs to be decoded
257
258 // Decode Hits
259 if (sizeVectorRequested != 0) {
260 ATH_MSG_DEBUG("Start loop over rdos - seeded mode");
261 // for each RDO collection we collect up all the PRD collections and
262 // then write them once filled need a vector because we have the
263 // collections for the different bunch crosssings
264 for (const TgcRdo* rdo : rdoCollVec) {
265 for (const TgcRawData* rd : *rdo) {
266 // Since OnlineIds are not unique, need some additional
267 // filtering on offline hashId to avoid decoding RDO outside of
268 // an RoI
269 Identifier offlineId{};
270 if (!state.cabling->getElementIDfromReadoutID(
271 offlineId, rd->subDetectorId(), rd->rodId(),
272 rd->sswId(), rd->slbId(), rd->bitpos())) {
273 continue;
274 }
275 const IdentifierHash tgcHashId =
276 m_idHelperSvc->moduleHash(offlineId);
277 if (std::find(requestedIdHashVect.begin(),
278 requestedIdHashVect.end(),
279 tgcHashId) == requestedIdHashVect.end()) {
280 continue;
281 }
282 selectDecoder(state, *rd, rdo);
283 }
284 decodedRdoCollVec.insert(rdo);
285 }
286 } else {
287 ATH_MSG_DEBUG("Start loop over rdos - unseeded mode");
288 for (const TgcRdo* rdoColl : *rdoContainer) {
289 if (rdoColl->empty() || decodedRdoCollVec.count(rdoColl) ||
290 rdoCollVec.count(rdoColl)) {
291 continue;
292 }
293 ATH_MSG_DEBUG(" Number of RawData in this rdo " << rdoColl->size());
294 for (const TgcRawData* rd : *rdoColl) {
295 selectDecoder(state, *rd, rdoColl);
296 }
297 decodedRdoCollVec.insert(rdoColl);
298 }
299 }
300
302 for (std::unique_ptr<TgcPrepDataCollection>& allBcColl :
303 state.tgcPrepDataCollections) {
304 if (!allBcColl) {
305 continue;
306 }
307 std::sort(allBcColl->begin(), allBcColl->end(),
308 [](const TgcPrepData* a, const TgcPrepData* b){
309 return a->identify() < b->identify();
310 });
311 for (std::size_t i = 0; i < allBcColl->size(); ++i) {
312 allBcColl->at(i)->setHashAndIndex(allBcColl->identifyHash(), i);
313 }
314 }
315
316
317 ATH_CHECK(transferData(*state.tgcPrepDataContainer,
318 std::move(state.tgcPrepDataCollections)));
319
320 for (unsigned int k = 0; k < state.tgcCoinDataContainer.size(); ++k) {
321 ATH_CHECK(transferData(*state.tgcCoinDataContainer[k],
322 std::move(state.tgcCoinDataCollections[k])));
323 }
324 return StatusCode::SUCCESS;
325}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
static Double_t a
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Current TgcRdoContainer
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current TgcRawData
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Old TgcRdo
bool empty() const
return true if container is empty
size_t size() const
Duplicate of fullSize for backwards compatability.
StatusCode transferData(ContType &container, std::vector< std::unique_ptr< CollType > > &&coll) const
SG::ReadHandleKey< TgcRdoContainer > m_rdoContainerKey
StatusCode setupState(const EventContext &ctx, State &state) const
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Gaudi::Property< bool > m_decodeData
Switch for the decoding of TGC RDO into TgcPrepData.
void selectDecoder(State &state, const TgcRawData &rd, const TgcRdo *rdoColl) const
Select decoder based on RDO type (Hit or Coincidence (Tracklet, HiPt and SL)).
static uint16_t calculateOnlineId(uint16_t subDetectorId, uint16_t rodId)
Definition TgcRdo.cxx:60
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
setWord1 uint16_t

◆ decode() [2/2]

StatusCode Muon::TgcRdoToPrepDataToolMT::decode ( const EventContext & ctx,
const std::vector< uint32_t > & robIds ) const
overrideprivate

Avoid compiler warning.

Definition at line 97 of file TgcRdoToPrepDataToolMT.cxx.

98 {
99 ATH_MSG_FATAL("ROB based decoding is not supported....");
100 return StatusCode::FAILURE;
101}
#define ATH_MSG_FATAL(x)

◆ decodeHiPt()

StatusCode Muon::TgcRdoToPrepDataToolMT::decodeHiPt ( State & state,
const TgcRawData & rd ) const
private

Decode RDO's of HiPt.

Definition at line 918 of file TgcRdoToPrepDataToolMT.cxx.

919 {
920 m_nHiPtRDOs++; // Count the number of input HiPt RDOs.
921
922 // conversion for Run3
923 uint16_t tmprodId{}, tmpsector{};
924 convertToRun2(rd0, tmprodId, tmpsector);
925 const TgcRawData rd(rd0.bcTag(), rd0.subDetectorId(), tmprodId, rd0.l1Id(),
926 rd0.bcId(), rd0.isStrip(), rd0.isForward(), tmpsector,
927 rd0.chip(), rd0.index(), rd0.isHipt(), rd0.hitId(),
928 rd0.hsub(), rd0.delta(), rd0.inner());
929
930 // Protection against invalid subDetectorId and isForward
931 if ((rd.subDetectorId() != ASIDE && rd.subDetectorId() != CSIDE)) {
933 "TgcRdoToPrepDataToolMT::decodeHiPt::Unknown subDetectorId!!");
934 return StatusCode::SUCCESS;
935 }
936
937 // Protection against invalid hitId
938 if (rd.hitId() == 0) {
940 "Invalid hitId_rdo_hipt, hitId == 0!! skip to convert this RDO to "
941 "PRD");
942 return StatusCode::SUCCESS;
943 }
944 int slbsubMatrix = 0;
945 bool isBackward = isBackwardBW(rd); // Backward or Forward
946 int deltaBeforeConvert = getDeltaBeforeConvert(rd);
947
948 bool found = false;
949
950 Identifier channelIdOut_tmp{};
951 std::array<Identifier, 2> channelIdOut{};
952 std::array<int, 2> bitpos_o{}, slbchannel_o{};
953 int sswId_o{0}, sbLoc_o{0}, slbId_o{0};
954
955 Identifier channelIdIn_tmp{};
956 std::array<Identifier, 4> channelIdIn{};
957 std::array<int, 4> bitpos_i{}, slbchannel_i{};
958 int sswId_i{0}, sbLoc_i{0};
959
960 std::array<int, 4> slbId_in{}, sbLoc_in{}; // only used for wire
961
962 std::array<int, 4> gasGap_i{}, channel_i{};
963 double width_i{0.}, hit_position_i{0};
964 Amg::Vector2D tmp_hitPos_i{Amg::Vector2D::Zero()};
965
966 std::array<int, 2> gasGap_o{}, channel_o{};
967 double width_o{0.}, hit_position_o{0.};
968 Amg::Vector2D tmp_hitPos_o{Amg::Vector2D::Zero()};
969
970 const MuonGM::TgcReadoutElement* descriptor_ii = nullptr;
971 const MuonGM::TgcReadoutElement* descriptor_oo = nullptr;
972
973 //*** TGC3 start ***//
974 // RDOHighPtID --> (Sim)HighPtID --> OfflineID --> ReadoutID --> getSLBID
975 found = getHiPtIds(state, rd, sswId_o, sbLoc_o, slbId_o);
976 if (!found) {
977 return StatusCode::SUCCESS;
978 }
979
980 // get the OfflineID of cernter of ROI of TGC3
981 if (!rd.isStrip()) { // wire
982 getBitPosOutWire(rd, slbsubMatrix, bitpos_o);
983 } else { // strip
984 getBitPosOutStrip(rd, slbsubMatrix, bitpos_o);
985 }
986 for (int i = 0; i < 2; i++) {
987 found = state.cabling->getOfflineIDfromReadoutID(
988 channelIdOut[i], rd.subDetectorId(), rd.rodId(), sswId_o, sbLoc_o,
989 bitpos_o[i]);
990 if (!found) {
991 ATH_MSG_DEBUG("Failed to get OfflineID from ReadoutID for Pivot "
992 << (rd.isStrip() ? "Strip" : "Wire") << ".");
993 return StatusCode::SUCCESS;
994 }
995 }
996
997 //}
998 //*** TGC3 end ***//
999
1000 //*** TGC1 start ***//
1001 // get the OfflineID of cernter of ROI of TGC1
1002 if (!rd.isStrip()) { // wire
1003 getBitPosInWire(rd, deltaBeforeConvert, bitpos_i, slbchannel_i,
1004 slbId_in, sbLoc_in, sswId_i, bitpos_o, slbchannel_o,
1005 slbId_o);
1006 } else { // strip
1007 getBitPosInStrip(rd, deltaBeforeConvert, bitpos_i, slbchannel_i,
1008 sbLoc_i, sswId_i, bitpos_o, slbchannel_o);
1009 }
1010 for (int i = 0; i < 4; i++) {
1011 found = state.cabling->getOfflineIDfromReadoutID(
1012 channelIdIn[i], rd.subDetectorId(), rd.rodId(), sswId_i,
1013 rd.isStrip() ? sbLoc_i : sbLoc_in[i], bitpos_i[i]);
1014 if (!found) {
1015 ATH_MSG_DEBUG("Failed to get OfflineID from ReadoutID for Pivot "
1016 << (rd.isStrip() ? "Strip" : "Wire") << ".");
1017 return StatusCode::SUCCESS;
1018 }
1019 }
1020 //}
1021 //*** TGC1 end ***//
1022
1023 ATH_MSG_DEBUG("TGC RDO->Coindata for HIPT: "
1024 << m_idHelperSvc->toString(channelIdOut[1]));
1025
1026 const IdentifierHash tgcHashId = m_idHelperSvc->moduleHash(channelIdOut[1]);
1027
1028 int locId = (rd.bcTag() == TgcDigit::BC_CURRENT ||
1030 ? 1
1031 : rd.bcTag() - 1;
1032
1033 std::unique_ptr<TgcCoinDataCollection>& coincollection =
1034 state.tgcCoinDataCollections[locId][tgcHashId];
1035 if (!coincollection) {
1036 coincollection =
1037 std::make_unique<TgcCoinDataCollection>(tgcHashId);
1038 coincollection->setIdentifier(
1039 m_idHelperSvc->chamberId(channelIdOut[1]));
1040 }
1041
1042 //*** TGC3 start ***//
1043 // Get geometry of pivot plane
1044 std::array<const MuonGM::TgcReadoutElement*, 2> descriptor_o{
1045 state.muDetMgr->getTgcReadoutElement(channelIdOut[0]),
1046 state.muDetMgr->getTgcReadoutElement(channelIdOut[1])};
1047 for (int i = 0; i < 2; i++) {
1048 if (!isOfflineIdOKForTgcReadoutElement(descriptor_o[i],
1049 channelIdOut[i])) {
1050 return StatusCode::SUCCESS;
1051 }
1052 }
1053
1054 const TgcIdHelper& idHelper{m_idHelperSvc->tgcIdHelper()};
1055 for (int i = 0; i < 2; i++) {
1056 gasGap_o[i] = idHelper.gasGap(channelIdOut[i]);
1057 channel_o[i] = idHelper.channel(channelIdOut[i]);
1058 }
1059
1060 if (!rd.isStrip()) { // wire
1061 found = getPosAndIdWireOut(descriptor_o, channelIdOut, gasGap_o,
1062 channel_o, width_o, hit_position_o,
1063 tmp_hitPos_o, channelIdOut_tmp);
1064 } else { // strip
1065 found = getPosAndIdStripOut(descriptor_o, channelIdOut, gasGap_o,
1066 channel_o, width_o, hit_position_o,
1067 tmp_hitPos_o, channelIdOut_tmp, isBackward,
1068 rd.subDetectorId() == ASIDE);
1069 }
1070 if (!found) {
1071 return StatusCode::SUCCESS;
1072 }
1073 if (width_o < s_cutDropPrdsWithZeroWidth &&
1074 m_dropPrdsWithZeroWidth) { // Invalid PRD's whose widths are zero are
1075 // dropped.
1076 return StatusCode::SUCCESS;
1077 }
1078
1079 descriptor_oo = state.muDetMgr->getTgcReadoutElement(channelIdOut_tmp);
1080 if (!isOfflineIdOKForTgcReadoutElement(descriptor_oo, channelIdOut_tmp)) {
1081 return StatusCode::SUCCESS;
1082 }
1083 //}
1084 //*** TGC3 end ***//
1085
1086 //*** TGC1 start ***//
1087 // Get geometry of non-pivot plane
1088 std::array<const MuonGM::TgcReadoutElement*, 4> descriptor_i{
1089 state.muDetMgr->getTgcReadoutElement(channelIdIn[0]),
1090 state.muDetMgr->getTgcReadoutElement(channelIdIn[1]),
1091 state.muDetMgr->getTgcReadoutElement(channelIdIn[2]),
1092 state.muDetMgr->getTgcReadoutElement(channelIdIn[3])};
1093 for (int i = 0; i < 4; i++) {
1094 if (!isOfflineIdOKForTgcReadoutElement(descriptor_i[i],
1095 channelIdIn[i])) {
1096 return StatusCode::SUCCESS;
1097 }
1098 }
1099 for (int i = 0; i < 4; i++) {
1100 gasGap_i[i] = idHelper.gasGap(channelIdIn[i]);
1101 channel_i[i] = idHelper.channel(channelIdIn[i]);
1102 }
1103
1104 if (!rd.isStrip()) { // WIRE
1105 found = getPosAndIdWireIn(descriptor_i, channelIdIn, gasGap_i,
1106 channel_i, width_i, hit_position_i,
1107 tmp_hitPos_i, channelIdIn_tmp);
1108 } else { // STRIP
1109 found = getPosAndIdStripIn(descriptor_i, channelIdIn, gasGap_i,
1110 channel_i, width_i, hit_position_i,
1111 tmp_hitPos_i, channelIdIn_tmp, isBackward,
1112 (rd.subDetectorId() == ASIDE));
1113 }
1114 if (!found) {
1115 return StatusCode::SUCCESS;
1116 }
1117 if (width_i < s_cutDropPrdsWithZeroWidth &&
1118 m_dropPrdsWithZeroWidth) { // Invalid PRD's whose widths are zero are
1119 // dropped.
1120 return StatusCode::SUCCESS;
1121 }
1122
1123 descriptor_ii = state.muDetMgr->getTgcReadoutElement(channelIdIn_tmp);
1124 if (!isOfflineIdOKForTgcReadoutElement(descriptor_ii, channelIdIn_tmp)) {
1125 return StatusCode::SUCCESS;
1126 }
1127 //}
1128 //*** TGC1 end ***//
1129
1130 int trackletId = 2 * sbLoc_o + slbsubMatrix;
1131 int delta = static_cast<int>(rd.delta());
1132 int hsub = static_cast<int>(rd.hsub());
1133 int inner = static_cast<int>(rd.inner());
1134
1135 // check duplicate digits
1136 for (const TgcCoinData* tgcCoinData : *coincollection) {
1138 tgcCoinData->type()) && // Coincidence type
1139 (channelIdOut_tmp ==
1140 tgcCoinData->identify()) && // channelIdOut, identify returns
1141 // channelIdOut for HiPt
1142 (channelIdIn_tmp == tgcCoinData->channelIdIn()) && // channelIdIn
1143 (trackletId == tgcCoinData->trackletId()) && // trackletId
1144 (delta == tgcCoinData->delta()) && // delta
1145 (hsub == tgcCoinData->sub()) && // hsub
1146 (inner == tgcCoinData->inner())) {
1147 if (38 <= trackletId && trackletId <= 41) {
1148 // This drop is most probably due to the fix of the HiPt Endcap
1149 // Strip Board bug.
1150 m_nHiPtRDOs--; // Reduce the number of input RDOs.
1151 }
1152 ATH_MSG_DEBUG("Duplicated TgcCoinData (HiPt) = "
1153 << m_idHelperSvc->toString(channelIdOut_tmp));
1154 return StatusCode::SUCCESS;
1155 }
1156 }
1157
1158 auto hitPos_o = std::make_unique<Amg::Vector2D>(tmp_hitPos_o);
1159 auto hitPos_i = std::make_unique<Amg::Vector2D>(tmp_hitPos_i);
1160
1161 TgcCoinData* newCoinData = new TgcCoinData(
1162 channelIdIn_tmp, channelIdOut_tmp,
1163 tgcHashId, // determined from channelIdOut[1]
1164 descriptor_ii, // determined from channelIdIn_tmp
1165 descriptor_oo, // determined from channelIdOut_tmp
1166 TgcCoinData::TYPE_HIPT, // Coincidence type
1167 rd.subDetectorId() == ASIDE, // isAside
1168 idHelper.stationPhi(channelIdOut_tmp), // phi
1169 0, // isInner
1170 rd.isForward(), // isForward
1171 rd.isStrip(), // isStrip
1172 trackletId, // trackletId
1173 hitPos_i.release(), hitPos_o.release(), width_i, width_o,
1174 delta, // delta
1175 hsub, // hsub
1176 inner);
1177 // add the digit to the collection
1178 newCoinData->setHashAndIndex(coincollection->identifyHash(),
1179 coincollection->size());
1180 coincollection->push_back(newCoinData);
1181
1182 ATH_MSG_DEBUG("coincollection->push_back done (for HIPT)");
1183
1184 m_nHiPtPRDs++; // Count the number of output HiPt PRDs.
1185
1186 return StatusCode::SUCCESS;
1187}
int stationPhi(const Identifier &id) const
bool getPosAndIdWireIn(const std::array< const MuonGM::TgcReadoutElement *, 4 > &descriptor_i, const std::array< Identifier, 4 > &channelIdIn, const std::array< int, 4 > &gasGap_i, const std::array< int, 4 > &channel_i, double &width_i, double &hit_position_i, Amg::Vector2D &tmp_hitPos_i, Identifier &channelIdIn_tmp) const
Get position and offline ID of TGC1 wire for HiPt.
static int getDeltaBeforeConvert(const TgcRawData &rd)
Get delta (sagitta) before converion for HiPt.
static bool isBackwardBW(const TgcRawData &rd)
Check if a chamber in BigWheel is a backward chamber or a forward chamber.
static void getBitPosOutWire(const TgcRawData &rd, int &slbsubMatrix, std::array< int, 2 > &bitpos_o)
Get bitPos etc of TGC3 wire for HiPt.
bool getPosAndIdStripIn(const std::array< const MuonGM::TgcReadoutElement *, 4 > &descriptor_i, const std::array< Identifier, 4 > &channelIdIn, const std::array< int, 4 > &gasGap_i, const std::array< int, 4 > &channel_i, double &width_i, double &hit_position_i, Amg::Vector2D &tmp_hitPos_i, Identifier &channelIdIn_tmp, const bool isBackward, const bool isAside) const
Get position and offline ID of TGC1 strip for HiPt.
void getBitPosInStrip(const TgcRawData &rd, const int DeltaBeforeConvert, std::array< int, 4 > &bitpos_i, std::array< int, 4 > &slbchannel_i, int &sbLoc_i, int &sswId_i, const std::array< int, 2 > &bitpos_o, std::array< int, 2 > &slbchannel_o) const
Get bitPos etc of TGC1 strip for HiPt.
bool getHiPtIds(const State &state, const TgcRawData &rd, int &sswId_o, int &sbLoc_o, int &slbId_o) const
Get ReadoutID of HiPt from RDOHighPtID.
bool isOfflineIdOKForTgcReadoutElement(const MuonGM::TgcReadoutElement *descriptor, const Identifier channelId) const
Check offline ID is OK for TgcReadoutElement.
Gaudi::Property< bool > m_dropPrdsWithZeroWidth
Flag for dropping PRD's with zero widths.
void getBitPosInWire(const TgcRawData &rd, const int DeltaBeforeConvert, std::array< int, 4 > &bitpos_i, std::array< int, 4 > &slbchannel_i, std::array< int, 4 > &slbId_in, std::array< int, 4 > &sbLoc_in, int &sswId_i, const std::array< int, 2 > &bitpos_o, std::array< int, 2 > &slbchannel_o, const int slbId_o) const
Get bitPos etc of TGC1 wire for HiPt.
bool getPosAndIdWireOut(const std::array< const MuonGM::TgcReadoutElement *, 2 > &descriptor_o, const std::array< Identifier, 2 > &channelIdOut, const std::array< int, 2 > &gasGap_o, const std::array< int, 2 > &channel_o, double &width_o, double &hit_position_o, Amg::Vector2D &tmp_hitPos_o, Identifier &channelIdOut_tmp) const
Get position and offline ID of TGC3 wire for HiPt.
static const double s_cutDropPrdsWithZeroWidth
Cut value for zero widths.
static void getBitPosOutStrip(const TgcRawData &rd, int &slbsubMatrix, std::array< int, 2 > &bitpos_o)
Get bitPos etc of TGC3 strip for HiPt.
bool getPosAndIdStripOut(const std::array< const MuonGM::TgcReadoutElement *, 2 > &descriptor_o, const std::array< Identifier, 2 > &channelIdOut, const std::array< int, 2 > &gasGap_o, const std::array< int, 2 > &channel_o, double &width_o, double &hit_position_o, Amg::Vector2D &tmp_hitPos_o, Identifier &channelIdOut_tmp, const bool isBackward, const bool isAside) const
Get position and offline ID of TGC3 strip for HiPt.
@ BC_UNDEFINED
Definition TgcDigit.h:37
@ BC_CURRENT
Definition TgcDigit.h:37
int channel(const Identifier &id) const override
int gasGap(const Identifier &id) const override
get the hashes
uint16_t hsub() const
Definition TgcRawData.h:349
bool isStrip() const
Definition TgcRawData.h:353
int16_t delta() const
Definition TgcRawData.h:317
uint16_t bcTag() const
Definition TgcRawData.h:251
uint16_t subDetectorId() const
Definition TgcRawData.h:264
uint16_t hitId() const
Definition TgcRawData.h:345
uint16_t inner() const
Definition TgcRawData.h:321
Eigen::Matrix< double, 2, 1 > Vector2D

◆ decodeHits()

StatusCode Muon::TgcRdoToPrepDataToolMT::decodeHits ( State & state,
const TgcRawData & rd ) const
private

Decode RDO's of Hit.

Definition at line 366 of file TgcRdoToPrepDataToolMT.cxx.

367 {
368 // The channel hit by hardware-ROD supports only three-bunch readout. Data
369 // of TgcDigit::BC_NEXTNEXT should be skipped in this function.
370 if (rd.bcTag() == TgcDigit::BC_NEXTNEXT) {
371 return StatusCode::SUCCESS;
372 }
373
374 m_nHitRDOs++; // Count the number of input Hit RDOs.
375 bool isConverted{false}, isDuplicated{false}, isInvalid{false};
376
377 ATH_MSG_DEBUG("decodeHits() :" << __LINE__ << " sub=" << rd.subDetectorId()
378 << " rod=" << rd.rodId() << " ssw="
379 << rd.sswId() << " slb=" << rd.slbId()
380 << " bitpos=" << rd.bitpos());
381
382 const TgcIdHelper& idHelper{m_idHelperSvc->tgcIdHelper()};
383
384 // repeat two times for ORed channel
385 for (int iOr = 0; iOr < 2; iOr++) {
386 bool orFlag = false;
387 // check if this channel has ORed partner only when 2nd time
388 if (iOr != 0) {
389 bool o_found = state.cabling->isOredChannel(
390 rd.subDetectorId(), rd.rodId(), rd.sswId(), rd.slbId(),
391 rd.bitpos());
392 // set OR flag
393 if (o_found) {
394 orFlag = true;
395 } else {
396 continue;
397 }
398 }
399
400 // get element ID
401 Identifier elementId{};
402 bool e_found = state.cabling->getElementIDfromReadoutID(
403 elementId, rd.subDetectorId(), rd.rodId(), rd.sswId(), rd.slbId(),
404 rd.bitpos(), orFlag);
405 if (!e_found) {
406 if (!orFlag) {
407 bool show_warning_level = true;
408
409 /* One invalid channel in sector A09:
410 sub=103 rod=9 ssw=6 slb=20 bitpos=151 +offset=0 orFlag=0
411 was always seen in 2008 data, at least run 79772 - 91800.
412 bug #48828 */
413 /* One invalid channel in sector A11:
414 sub=103 rod=11 ssw=2 slb=8 bitpos=41 orFlag=0
415 was seen 5 times in 1,059,867 events of run 159179. */
416 /* EIFI of MC ByteStream without correction issue : bug 57051 */
417 if ((rd.subDetectorId() == 103 && rd.rodId() == 9 &&
418 rd.sswId() == 6 && rd.slbId() == 20 &&
419 rd.bitpos() == 151) ||
420 (rd.subDetectorId() == 103 && rd.rodId() == 11 &&
421 rd.sswId() == 2 && rd.slbId() == 8 && rd.bitpos() == 41) ||
422 (rd.rodId() % 3 == 2 && rd.sswId() == 8)) {
423 show_warning_level =
425 isInvalid = true;
426 }
427 if (msgLvl(show_warning_level ? MSG::WARNING : MSG::DEBUG)) {
428 msg(show_warning_level ? MSG::WARNING : MSG::DEBUG)
429 << "ElementID not found for "
430 << " sub=" << rd.subDetectorId()
431 << " rod=" << rd.rodId() << " ssw=" << rd.sswId()
432 << " slb=" << rd.slbId() << " bitpos=" << rd.bitpos()
433 << " orFlag=" << orFlag << endmsg;
434 }
435 }
436 continue;
437 }
438 const IdentifierHash tgcHashId = m_idHelperSvc->moduleHash(elementId);
439
440 Identifier channelId{};
441 bool c_found = state.cabling->getOfflineIDfromReadoutID(
442 channelId, rd.subDetectorId(), rd.rodId(), rd.sswId(), rd.slbId(),
443 rd.bitpos(), orFlag);
444 if (!c_found) {
445 if (!orFlag) {
447 "OfflineID not found for "
448 << " sub=" << rd.subDetectorId() << " rod=" << rd.rodId()
449 << " ssw=" << rd.sswId() << " slb=" << rd.slbId()
450 << " bitpos=" << rd.bitpos() << " orFlag=" << orFlag);
451 }
452 continue;
453 }
454 const std::uint16_t bcTag = translateBC(rd.bcTag());
456 continue;
457 }
458
459
460 std::unique_ptr<TgcPrepDataCollection>& collection = state.tgcPrepDataCollections[tgcHashId];
461 if (!collection) {
462 collection = std::make_unique<TgcPrepDataCollection>(tgcHashId);
463 collection->setIdentifier(elementId);
464 }
465 TgcPrepDataCollection::iterator duplicate_itr =
466 std::ranges::find_if(*collection,
467 [&channelId](const TgcPrepData* prd) {
468 return prd->identify() == channelId;
469 });
470 if (duplicate_itr != collection->end()) {
471 const int newBCTag = (**duplicate_itr).getBcBitMap() | bcTag;
472 // A converted PRD of this RDO is duplicated.
473 isDuplicated |= (newBCTag == (**duplicate_itr).getBcBitMap());
474 (**duplicate_itr).setBcBitMap(newBCTag);
475 continue;
476 }
477
478 const MuonGM::TgcReadoutElement* descriptor =
479 state.muDetMgr->getTgcReadoutElement(channelId);
480 if (!isOfflineIdOKForTgcReadoutElement(descriptor, channelId)) {
482 "decodeHits: MuonGM::TgcReadoutElement is invalid.");
483 continue;
484 }
486 "TGC RDO->PrepRawdata: " << m_idHelperSvc->toString(channelId));
487
488 std::vector<Identifier> identifierList{channelId};
489
490 Amg::Vector3D position = descriptor->channelPos(channelId);
491 Amg::Vector2D hitPos{Amg::Vector2D::Zero()};
492 bool onSurface = descriptor->surface(channelId).globalToLocal(
493 position, position, hitPos);
494 // the globalToLocal should not fail, if it does produce a WARNING
495 if (!onSurface) {
497 "TgcRdoToPrepDataToolMT::decodeHits Amg::Vector2D* "
498 "hitPos is null.");
499 continue;
500 }
501
502 int gasGap = idHelper.gasGap(channelId);
503 int channel = idHelper.channel(channelId);
504 const double width = !idHelper.isStrip(channelId)
505 ? descriptor->gangRadialLength(gasGap, channel)
506 : descriptor->stripWidth(gasGap, channel);
507
509 m_dropPrdsWithZeroWidth) { // Invalid PRD's whose widths are zero
510 // are dropped.
511 ATH_MSG_WARNING("decodeHits: width= "
512 << width
513 << " is smaller than s_cutDropPrdsWithZeroWidth= "
515 << m_idHelperSvc->toString(channelId));
516 continue;
517 }
518 double errPos = width / std::sqrt(12.);
519
520 Amg::MatrixX mat(1, 1);
521 mat.setIdentity();
522 mat *= errPos * errPos;
523
524 auto newPrepData =
525 std::make_unique<TgcPrepData>(channelId, // Readout ID -> Offline ID
526 tgcHashId, // Readout ID -> Element ID -> Hash
527 hitPos, // determined from channelId
528 identifierList, // holds channelId only
529 mat, // determined from channelId
530 descriptor,
531 translateBC(rd.bcTag())); // determined from channelId
532 newPrepData->setHashAndIndex(collection->identifyHash(),
533 collection->size());
534 collection->push_back(std::move(newPrepData));
535 isConverted = true; // This RDO is converted to at least one PRD.
536 }
537
538 if (isConverted) {
539 m_nHitPRDs++; // Count the number of output Hit PRDs.
540 } else if (isDuplicated || isInvalid) {
541 m_nHitRDOs--; // Reduce the number of input RDOs.
542 }
543
544 return StatusCode::SUCCESS;
545}
#define endmsg
#define ATH_MSG_WARNING(x)
const double width
unsigned bcTag(unsigned bcBitMap)
DataModel_detail::iterator< DataVector > iterator
Definition DataVector.h:842
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
Amg::Vector3D channelPos(const Identifier &id) const
Returns the position of the active channel (wireGang or strip).
double stripWidth(int gasGap, int strip) const
Returns the width of a given strip in the gasGap i.
double gangRadialLength(int gasGap, int gang) const
Returns the length of the wire gang along the radial direction [pitch x N_{wire}^{gang}...
Gaudi::Property< bool > m_convertAllBCs
Convert hits from all bunch crossings.
Gaudi::Property< bool > m_show_warning_level_invalid_A09_SSW6_hit
Switch for error message disabling on one invalid channel in sector A09 seen in 2008 data,...
std::atomic< long > m_nHitRDOs
long to count the numbers of RDOs and PRDs
@ BC_NEXTNEXT
Definition TgcDigit.h:37
int isStrip(const Identifier &id) const
isStrip corresponds to measuresPhi
uint16_t sswId() const
Definition TgcRawData.h:272
uint16_t bitpos() const
Definition TgcRawData.h:293
uint16_t slbId() const
Definition TgcRawData.h:276
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const override final
Specified for PlaneSurface: GlobalToLocal method without dynamic memory allocation - boolean checks i...
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, 3, 1 > Vector3D
const Amg::Vector3D & position() const
Method to retrieve the position of the Intersection.
MsgStream & msg
Definition testRead.cxx:32

◆ decodeInner()

StatusCode Muon::TgcRdoToPrepDataToolMT::decodeInner ( State & state,
const TgcRawData & rd ) const
private

Decode RDO's of Inner.

Definition at line 1189 of file TgcRdoToPrepDataToolMT.cxx.

1190 {
1191 m_nHiPtRDOs++; // Count the number of input HiPt RDOs.
1192
1193
1194 int subDetectorId = rd.subDetectorId();
1195 // Protection against invalid subDetectorId and isForward
1196 if (subDetectorId != ASIDE && subDetectorId != CSIDE) {
1198 "TgcRdoToPrepDataToolMT::decodeHiPt::Unknown subDetectorId!!");
1199 return StatusCode::SUCCESS;
1200 }
1201
1202 bool isInner = ((rd.sector() & 4) != 0); // Inner flag for EIFI and Tilecal
1203
1204 Identifier channelIdIn{};
1205 Identifier channelIdOut{};
1206 int sswId_o = 9;
1207 int sbLoc_o = rd.sector() & 3;
1208 int inner = rd.inner();
1209 bool isStrip = rd.isStrip();
1210
1211 int phi = 0;
1212 bool isAside = false;
1213 bool isEndcap = false;
1214 if (rd.rodId() < 13) { // Run2
1215 state.cabling->getSLIDfromReadoutID(phi, isAside, isEndcap,
1216 subDetectorId, rd.rodId(),
1217 sswId_o, sbLoc_o);
1218 } else { // Run3
1219 sbLoc_o = rd.sector();
1220 state.cabling->getSLIDfromSReadoutID(
1221 phi, isAside, subDetectorId, rd.rodId(), sbLoc_o, rd.isForward());
1222 isEndcap = !rd.isForward();
1223 if (rd.type() == TgcRawData::TYPE_INNER_NSW) {
1224 isInner = true;
1225 isStrip = false;
1226 inner = (rd.nsweta() << TgcCoinData::INNER_NSW_R_BITSHIFT) +
1228 (rd.nswdtheta()
1230 (rd.nswphires()
1232 (rd.nswlowres()
1241 } else if (rd.type() == TgcRawData::TYPE_INNER_BIS) {
1242 isInner = true;
1243 isStrip = true;
1244 inner =
1255 } else if (rd.type() == TgcRawData::TYPE_INNER_EIFI) {
1256 isInner = false;
1257 isStrip = false;
1258 inner = (rd.ei() << TgcCoinData::INNER_EIFI_EI_BITSHIFT) +
1261 } else if (rd.type() == TgcRawData::TYPE_INNER_TMDB) {
1262 isInner = false;
1263 isStrip = true;
1264 inner =
1265 (rd.tmdbmod()
1268 }
1269 }
1270
1271 int locId = (rd.bcTag() == TgcDigit::BC_CURRENT ||
1273 ? 1
1274 : rd.bcTag() - 1;
1275
1276 auto hitPos_o = std::make_unique<Amg::Vector2D>(Amg::Vector2D::Zero());
1277 auto hitPos_i = std::make_unique<Amg::Vector2D>(Amg::Vector2D::Zero());
1278
1279 const MuonGM::TgcReadoutElement* descriptor_ii = nullptr;
1280 const MuonGM::TgcReadoutElement* descriptor_oo = nullptr;
1281
1282 std::string stationName = "T3E";
1283 int stationEta = isAside ? 1 : -1;
1284 int stationPhi = phi;
1285 bool isValid{false};
1286 Identifier elementId = m_idHelperSvc->tgcIdHelper().elementID(
1287 stationName, stationEta, stationPhi, isValid);
1288 const IdentifierHash tgcHashId = m_idHelperSvc->moduleHash(elementId);
1289
1290 std::unique_ptr<TgcCoinDataCollection>& coincollection =
1291 state.tgcCoinDataCollections[locId][tgcHashId];
1292 if (!coincollection) {
1293 coincollection =
1294 std::make_unique<TgcCoinDataCollection>(tgcHashId);
1295 coincollection->setIdentifier(elementId);
1296 }
1297
1298 ATH_MSG_DEBUG("Inner Data Word, phi: "
1299 << phi << " isAside: " << isAside << " isEndcap: " << isEndcap
1300 << " subDetectorId: " << subDetectorId
1301 << " isStrip: " << rd.isStrip() << " rodId: " << rd.rodId()
1302 << " slbId: " << sbLoc_o << " inner:" << rd.inner());
1303
1304 TgcCoinData* newCoinData = new TgcCoinData(
1305 channelIdIn, // empty
1306 channelIdOut, // empty
1307 tgcHashId, // determined from channelIdOut[1]
1308 descriptor_ii, // determined from channelIdIn_tmp
1309 descriptor_oo, // determined from channelIdOut_tmp
1310 (rd.rodId() < 13)
1312 : (TgcCoinData::TYPE_UNKNOWN), // Coincidence type: rd.rodId()<13
1313 // for Run2, rd.rodId()>12 for Run3
1314 isAside, // isAside
1315 phi, // phi
1316 isInner, // Selection for NSW/BIS/EIFI/TMDB
1317 !isEndcap, // isForward
1318 isStrip, // Selection for NSW/BIS/EIFI/TMDB
1319 0, // trackletId
1320 hitPos_i.release(), hitPos_o.release(),
1321 0., // width_i,
1322 0., // width_o,
1323 0, // delta,
1324 0, // hsub,
1325 inner);
1326 // add the digit to the collection
1327 newCoinData->setHashAndIndex(coincollection->identifyHash(),
1328 coincollection->size());
1329 coincollection->push_back(newCoinData);
1330
1331 ATH_MSG_DEBUG("coincollection->push_back done (for Inner)");
1332
1333 m_nHiPtPRDs++; // Count the number of output HiPt PRDs.
1334
1335 return StatusCode::SUCCESS;
1336}
Scalar phi() const
phi method
static constexpr uint32_t INNER_NSW_ID_BITSHIFT
static constexpr uint32_t INNER_TILE_MODULE_BITSHIFT
Bit info in int inner for the Tile inner-coincidence.
static constexpr uint32_t INNER_NSW_PHIRES_BITSHIFT
static constexpr uint32_t INNER_EIFI_CID_BITSHIFT
static constexpr uint32_t INNER_RPC_BCID_BITSHIFT
static constexpr uint32_t INNER_RPC_ETA_BITSHIFT
Bit info in int inner for the RPC inner-coincidence.
static constexpr uint32_t INNER_EIFI_EI_BITSHIFT
Bit info in int inner for the EI/FI inner-coincidence.
static constexpr uint32_t INNER_RPC_PHI_BITSHIFT
static constexpr uint32_t INNER_RPC_DPHI_BITSHIFT
static constexpr uint32_t INNER_NSW_PHI_BITSHIFT
static constexpr uint32_t INNER_EIFI_FI_BITSHIFT
static constexpr uint32_t INNER_RPC_FLAG_BITSHIFT
static constexpr uint32_t INNER_NSW_BCID_BITSHIFT
static constexpr uint32_t INNER_RPC_DETA_BITSHIFT
static constexpr uint32_t INNER_NSW_R_BITSHIFT
Bit info in int inner for the NSW inner-coincidence.
static constexpr uint32_t INNER_TILE_BCID_BITSHIFT
static constexpr uint32_t INNER_NSW_LOWRES_BITSHIFT
static constexpr uint32_t INNER_NSW_INPUT_BITSHIFT
static constexpr uint32_t INNER_NSW_DTHETA_BITSHIFT
uint16_t nswlowres() const
Definition TgcRawData.h:413
DataType type() const
Definition TgcRawData.h:280
static constexpr uint32_t RPC_FLAG_BIT
Definition TgcRawData.h:223
uint16_t ei() const
Definition TgcRawData.h:441
static constexpr uint32_t RPC_BCID_BITSHIFT
Definition TgcRawData.h:226
uint16_t rpcdeta() const
Definition TgcRawData.h:433
uint16_t nswid() const
Definition TgcRawData.h:417
uint16_t tmdbbcid() const
Definition TgcRawData.h:457
uint16_t rpcphi() const
Definition TgcRawData.h:425
static constexpr uint32_t NSW_INPUT_BIT
Definition TgcRawData.h:218
uint16_t fi() const
Definition TgcRawData.h:445
static constexpr uint32_t RPC_BCID_BIT
Definition TgcRawData.h:227
uint16_t nsweta() const
Definition TgcRawData.h:389
uint16_t nswcand() const
Definition TgcRawData.h:401
uint16_t nswphires() const
Definition TgcRawData.h:409
static constexpr uint32_t NSW_INPUT_BITSHIFT
Definition TgcRawData.h:217
uint16_t cid() const
Definition TgcRawData.h:449
static constexpr uint32_t RPC_FLAG_BITSHIFT
Definition TgcRawData.h:222
uint16_t rpceta() const
Definition TgcRawData.h:421
uint16_t tmdbmod() const
Definition TgcRawData.h:453
uint16_t nswdtheta() const
Definition TgcRawData.h:405
static constexpr uint32_t NSW_BCID_BIT
Definition TgcRawData.h:220
@ TYPE_INNER_EIFI
Definition TgcRawData.h:50
@ TYPE_INNER_TMDB
Definition TgcRawData.h:51
static constexpr uint32_t NSW_BCID_BITSHIFT
Definition TgcRawData.h:219
uint16_t rpcflag() const
Definition TgcRawData.h:429
uint16_t rpcdphi() const
Definition TgcRawData.h:437
uint16_t nswphi() const
Definition TgcRawData.h:393

◆ decodeSL()

StatusCode Muon::TgcRdoToPrepDataToolMT::decodeSL ( State & state,
const TgcRawData & rd,
const TgcRdo * rdoColl ) const
private

Decode RDO's of SectorLogic.

Definition at line 1338 of file TgcRdoToPrepDataToolMT.cxx.

1340 {
1341 m_nSLRDOs++; // Count the number of input SL RDOs.
1342
1343 // conversion for Run3
1344 uint16_t tmprodId, tmpsector;
1345 convertToRun2(rd0, tmprodId, tmpsector);
1346 const TgcRawData rd(rd0.bcTag(), rd0.subDetectorId(), tmprodId, rd0.l1Id(),
1347 rd0.bcId(), rd0.isForward(), tmpsector, rd0.innerflag(),
1348 rd0.coinflag(), rd0.isMuplus(), rd0.threshold(),
1349 rd0.roi());
1350
1351 // Protection against invalid subDetectorId
1352 if (rd.subDetectorId() != ASIDE && rd.subDetectorId() != CSIDE) {
1354 "TgcRdoToPrepDataToolMT::decodeSL::Unknown subDetectorId!!");
1355 return StatusCode::SUCCESS;
1356 }
1357
1358 bool found = false;
1359
1360 std::array<Identifier, 3> channelId_wire{};
1361 int index_w{0}, chip_w{0}, hitId_w{0}, sub_w{0}, sswId_w{0}, sbLoc_w{0},
1362 subMatrix_w{0};
1363 std::array<int, 3> bitpos_w{};
1364
1365 //*** get OfflineID, center of ROI of R (wire) ***//
1366 found = getSLIds(state, false, rd, channelId_wire, index_w, chip_w, hitId_w, sub_w,
1367 sswId_w, sbLoc_w, subMatrix_w, bitpos_w);
1368 if (!found) {
1369 return StatusCode::SUCCESS;
1370 }
1371
1372 std::array<Identifier, 3> channelId_strip{};
1373 int index_s{0}, chip_s{0}, hitId_s{0}, sub_s{0}, sswId_s{0}, sbLoc_s{0},
1374 subMatrix_s{0};
1375 std::array<int, 3> bitpos_s{};
1376
1377 //*** get OfflineID, center of ROI of phi (strip) ***//
1378 found = getSLIds(state, true, rd, channelId_strip, index_s, chip_s, hitId_s, sub_s,
1379 sswId_s, sbLoc_s, subMatrix_s, bitpos_s,
1380 isIncludedInChamberBoundary(rd), rdoColl, index_w, chip_w,
1381 hitId_w, sub_w);
1382 if (!found) {
1383 return StatusCode::SUCCESS;
1384 }
1385
1386 ATH_MSG_DEBUG("TGC RDO->TgcCoindata(SL): "
1387 << m_idHelperSvc->toString(channelId_wire[1]));
1388
1389 const IdentifierHash tgcHashId =
1390 m_idHelperSvc->moduleHash(channelId_wire[1]);
1391
1392 int locId = (rd.bcTag() == TgcDigit::BC_CURRENT ||
1394 ? 1
1395 : rd.bcTag() - 1;
1396
1397 std::unique_ptr<TgcCoinDataCollection>& coincollection =
1398 state.tgcCoinDataCollections[locId][tgcHashId];
1399 if (!coincollection) {
1400 coincollection =
1401 std::make_unique<TgcCoinDataCollection>(tgcHashId);
1402 coincollection->setIdentifier(
1403 m_idHelperSvc->chamberId(channelId_wire[1]));
1404 }
1405
1406 int trackletId = 2 * sbLoc_w + subMatrix_w;
1407 int trackletIdStrip = 2 * sbLoc_s + subMatrix_s;
1408 int roi = static_cast<int>(rd.roi());
1409 int pt = static_cast<int>(rd.threshold());
1410 if (rd0.rodId() > 12) { // Run3: pT 4 bit, CoinFlag 3 bit, InnerFlag 4 bit
1411 pt += (static_cast<int>(rd.coinflag()) << 4);
1412 pt += (static_cast<int>(rd.innerflag()) << 7);
1413 }
1414 bool veto = rd.isVeto();
1415 bool isPositiveDeltaR =
1416 rd.isMuplus(); // Current SL sets isMuplus flag based on sign of
1417 // deltaR. Postive deltaR gives isMuplus=true.
1418 // check duplicate digits
1419 for (const TgcCoinData* tgcCoinData : *coincollection) {
1420 if (TgcCoinData::TYPE_SL == tgcCoinData->type() &&
1421 channelId_wire[2] == tgcCoinData->identify() &&
1422 trackletId == tgcCoinData->trackletId() &&
1423 trackletIdStrip == tgcCoinData->trackletIdStrip() &&
1424 roi == tgcCoinData->roi() && pt == tgcCoinData->pt() &&
1425 veto == tgcCoinData->veto() &&
1426 isPositiveDeltaR == tgcCoinData->isPositiveDeltaR()) {
1427 ATH_MSG_DEBUG("Duplicated TgcCoinData (SL) = "
1428 << m_idHelperSvc->toString(channelId_wire[2]));
1429 return StatusCode::SUCCESS;
1430 }
1431 }
1432
1433 //*** R (wire) start ***//
1434 double width_w{0.}, tmp_r{0.}, tmp_wire_z{0.};
1435 found = getSLWireGeometry(channelId_wire, width_w, tmp_r, tmp_wire_z);
1436 if (!found) {
1437 return StatusCode::SUCCESS;
1438 }
1439 if (width_w < s_cutDropPrdsWithZeroWidth &&
1440 m_dropPrdsWithZeroWidth) { // Invalid PRD's whose widths are zero are
1441 // dropped.
1442 return StatusCode::SUCCESS;
1443 }
1444
1445 double tmp_eta = 0.;
1446 bool isGoodEta = getEtafromRZ(tmp_r, tmp_wire_z, tmp_eta);
1447 if (!isGoodEta) {
1449 "Conversion from r and z to eta by "
1450 "TgcRdoToPrepDataToolMT::getEtafromRZ failed.");
1451 return StatusCode::SUCCESS;
1452 }
1453 if (tmp_wire_z < 0.) {
1454 tmp_eta *= -1.;
1455 }
1456 //*** R (wire) end ***//
1457
1458 //*** Phi (strip) start ***//
1459 double width_s{0.}, tmp_phi{0.};
1460 found = getSLStripGeometry(channelId_strip, isBackwardBW(rd),
1461 (rd.subDetectorId() == ASIDE), width_s, tmp_phi);
1462 if (!found) {
1463 return StatusCode::SUCCESS;
1464 }
1465 if (width_s < s_cutDropPrdsWithZeroWidth &&
1466 m_dropPrdsWithZeroWidth) { // Invalid PRD's whose widths are zero are
1467 // dropped.
1468 return StatusCode::SUCCESS;
1469 }
1470 //*** Phi (strip) end ***//
1471 const MuonGM::TgcReadoutElement* descriptor_w2 =
1472 state.muDetMgr->getTgcReadoutElement(channelId_wire[2]);
1473 if (!isOfflineIdOKForTgcReadoutElement(descriptor_w2, channelId_wire[2])) {
1474 return StatusCode::SUCCESS;
1475 }
1476
1477 Amg::Vector3D tmp_gp(tmp_r * std::cos(tmp_phi), tmp_r * std::sin(tmp_phi),
1478 tmp_wire_z);
1479 Amg::Vector2D tmp_hitPos{Amg::Vector2D::Zero()};
1480 bool onSurface = descriptor_w2->surface(channelId_wire[2])
1481 .globalToLocal(tmp_gp, tmp_gp, tmp_hitPos);
1482 // If TGC A-lines with rotations are used, the z-coordinate of a chamber
1483 // depends on position. In this case, the global to local conversion fails.
1484 // Obtain the local position in a different way.
1485 const Amg::Vector2D* hitPos = new Amg::Vector2D(!onSurface ? tmp_hitPos
1486 : getSLLocalPosition(descriptor_w2, channelId_wire[2],
1487 tmp_eta, tmp_phi));
1488
1489 Amg::MatrixX mat(2, 2);
1490 mat.setIdentity();
1491 mat(0, 0) = width_w;
1492 mat(1, 1) = width_s;
1493 const Amg::MatrixX* errMat = new Amg::MatrixX(std::move(mat));
1494
1495 // new TgcCoinData
1496 TgcCoinData* newCoinData = new TgcCoinData(
1497 channelId_wire[2],
1498 tgcHashId, // determined from channelId_wire[1]
1499 descriptor_w2, // determined from channelId_wire[2]
1500 TgcCoinData::TYPE_SL, // Coincidence type
1501 rd.subDetectorId() == ASIDE, // isAside
1502 m_idHelperSvc->tgcIdHelper().stationPhi(channelId_wire[2]), // phi
1503 rd.isForward(), // isForward
1504 trackletId, // trackletId
1505 trackletIdStrip, // trackletIdStrip
1506 hitPos, errMat,
1507 roi, // roi from RDO
1508 pt, // threshold from RDO
1509 veto, // veto flag from RDO
1510 isPositiveDeltaR); // isMuplus from RDO
1511
1512 // add the digit to the collection
1513 newCoinData->setHashAndIndex(coincollection->identifyHash(),
1514 coincollection->size());
1515 coincollection->push_back(newCoinData);
1516 ATH_MSG_DEBUG("coincollection->push_back done (for SL)");
1517
1518 m_nSLPRDs++; // Count the number of output SL PRDs.
1519 return StatusCode::SUCCESS;
1520}
static Amg::Vector2D getSLLocalPosition(const MuonGM::TgcReadoutElement *readout, const Identifier, const double eta, const double phi)
Get SL local position.
bool isIncludedInChamberBoundary(const TgcRawData &rd) const
Check SL RDO is at the chamber boundary.
bool getSLStripGeometry(const std::array< Identifier, 3 > &channelId_strip, const bool isBackWard, const bool isAside, double &width_strip, double &theta_strip) const
Get strip geometry (width, theta) for SL.
bool getSLWireGeometry(const std::array< Identifier, 3 > &channelId_wire, double &width_wire, double &r_wire, double &z_wire) const
Get wire geometry (width, r, z) for SL.
static bool getEtafromRZ(const double r, const double z, double &eta)
Get eta from r and z.
bool getSLIds(const State &state, const bool isStrip, const TgcRawData &rd, std::array< Identifier, 3 > &channelId, int &index, int &chip, int &hitId, int &sub, int &sswId, int &sbLoc, int &subMatrix, std::array< int, 3 > &bitpos, const bool isBoundary=false, const TgcRdo *rdoColl=0, const int index_w=-1, const int chip_w=-1, const int hitId_w=-1, const int sub_w=-1) const
Get ReadoutID of SL from RDO.
uint16_t innerflag() const
Definition TgcRawData.h:381
bool isMuplus() const
Definition TgcRawData.h:361
bool isVeto() const
Definition TgcRawData.h:373
uint16_t coinflag() const
Definition TgcRawData.h:385
uint16_t roi() const
Definition TgcRawData.h:377
uint16_t threshold() const
Definition TgcRawData.h:365
std::vector< std::string > veto
these patterns are anded
Definition listroot.cxx:191

◆ decodeTracklet()

StatusCode Muon::TgcRdoToPrepDataToolMT::decodeTracklet ( State & state,
const TgcRawData & rd ) const
private

Decode RDO's of Tracklet.

Definition at line 547 of file TgcRdoToPrepDataToolMT.cxx.

548 {
549 ++m_nTrackletRDOs; // Count the number of input Tracklet RDOs.
550
551 bool found = false;
552
553 //*** Get OfflineId of pivot plane (TGC3) start ***//
554 Identifier channelIdOut{};
555 found = state.cabling->getOfflineIDfromLowPtCoincidenceID(
556 channelIdOut, rd.subDetectorId(), rd.rodId(), rd.sswId(), rd.slbId(),
557 rd.subMatrix(), rd.position(), false);
558 if (!found) {
559 ATH_MSG_DEBUG("decodeTracklet: can't get the OfflineIdOut");
560 return StatusCode::SUCCESS;
561 }
562 //*** Get OfflineId of pivot plane (TGC3) end ***//
563
564 //*** Get OfflineId of non-pivot plane (TGC2) start ***//
565 int tmp_slbId{0}, tmp_subMatrix{0}, tmp_position{0};
566 found = getTrackletInfo(rd, tmp_slbId, tmp_subMatrix, tmp_position);
567 if (!found) {
568 return StatusCode::SUCCESS;
569 }
570 Identifier channelIdIn{};
571 found = state.cabling->getOfflineIDfromLowPtCoincidenceID(
572 channelIdIn, rd.subDetectorId(), rd.rodId(), rd.sswId(), tmp_slbId,
573 tmp_subMatrix, tmp_position, true);
574 if (!found) {
575 ATH_MSG_DEBUG("decodeTracklet: can't get the OfflineIdIn");
576 return StatusCode::SUCCESS;
577 }
578 //*** Get OfflineId of non-pivot plane (TGC2) end ***//
579
580 const IdentifierHash tgcHashId = m_idHelperSvc->moduleHash(channelIdOut);
581
582 int locId = (rd.bcTag() == TgcDigit::BC_CURRENT ||
584 ? 1
585 : rd.bcTag() - 1;
586
587 std::unique_ptr<TgcCoinDataCollection>& coincollection = state.tgcCoinDataCollections[locId][tgcHashId];
588 if (!coincollection) {
589 coincollection = std::make_unique<TgcCoinDataCollection>(tgcHashId);
590 coincollection->setIdentifier(m_idHelperSvc->chamberId(channelIdOut));
591 }
592
593 int subMatrix = static_cast<int>(rd.subMatrix());
594 int trackletId = static_cast<int>(2 * rd.slbId() + subMatrix);
595 int delta = static_cast<int>(rd.delta());
596
597 // Check duplicate digits
598 for (const TgcCoinData* tgcCoinData : *coincollection) {
600 tgcCoinData->type() && // coincidence type
601 channelIdOut ==
602 tgcCoinData->identify() && // channelIdOut, identify returns
603 // channelIdOut for Tracklet
604 channelIdIn == tgcCoinData->channelIdIn() && // channelIdIn
605 trackletId == tgcCoinData->trackletId() && // trackletId
606 delta == tgcCoinData->delta() && // delta
607 subMatrix == tgcCoinData->sub()) { // subMatrix
608
609 ATH_MSG_DEBUG("Duplicated TgcCoinData (Tracklet) = "
610 << m_idHelperSvc->toString(channelIdIn));
611 return StatusCode::SUCCESS;
612 }
613 }
614
615 ATH_MSG_DEBUG("TGC RDO->Coindata for LowPT: "
616 << m_idHelperSvc->toString(channelIdOut));
617
618 //*** Get geometry of pivot plane (TGC3) start ***//
619 const MuonGM::TgcReadoutElement* descriptor_o =
620 state.muDetMgr->getTgcReadoutElement(channelIdOut);
621 if (!isOfflineIdOKForTgcReadoutElement(descriptor_o, channelIdOut)) {
622 return StatusCode::SUCCESS;
623 }
624
625 const TgcIdHelper& idHelper{m_idHelperSvc->tgcIdHelper()};
626 int gasGap_o = idHelper.gasGap(channelIdOut);
627 int channel_o = idHelper.channel(channelIdOut);
628 double width_o = !idHelper.isStrip(channelIdOut)
629 ? descriptor_o->gangRadialLength(gasGap_o, channel_o)
630 : descriptor_o->stripWidth(gasGap_o, channel_o);
631
632 if (width_o < s_cutDropPrdsWithZeroWidth &&
633 m_dropPrdsWithZeroWidth) { // Invalid PRD's whose widths are zero are
634 // dropped.
635 return StatusCode::SUCCESS;
636 }
637
638 Amg::Vector3D position_o = descriptor_o->channelPos(channelIdOut);
639 Amg::Vector2D hitPos_o{Amg::Vector2D::Zero()};
640 bool onSurface_o = descriptor_o->surface(channelIdOut)
641 .globalToLocal(position_o, position_o, hitPos_o);
642 // the globalToLocal should not fail, if it does produce a WARNING
643 if (!onSurface_o) {
645 "TgcRdoToPrepDataToolMT::decodeTracklet Amg::Vector2D* "
646 "hitPos_o is null.");
647 return StatusCode::SUCCESS;
648 }
649 //*** Get geometry of pivot plane (TGC3) end ***//
650
651 //*** Get geometry of non-pivot plane (TGC2) start ***//
652 const MuonGM::TgcReadoutElement* descriptor_i =
653 state.muDetMgr->getTgcReadoutElement(channelIdIn);
654 if (!isOfflineIdOKForTgcReadoutElement(descriptor_i, channelIdIn)) {
655 return StatusCode::SUCCESS;
656 }
657
658 int gasGap_i = idHelper.gasGap(channelIdIn);
659 int channel_i = idHelper.channel(channelIdIn);
660 double width_i = !idHelper.isStrip(channelIdIn)
661 ? descriptor_i->gangRadialLength(gasGap_i, channel_i)
662 : descriptor_i->stripWidth(gasGap_i, channel_i);
663
664 if (width_i < s_cutDropPrdsWithZeroWidth &&
665 m_dropPrdsWithZeroWidth) { // Invalid PRD's whose widths are zero are
666 // dropped.
667 return StatusCode::SUCCESS;
668 }
669
670 Amg::Vector3D position_i = descriptor_i->channelPos(channelIdIn);
671 Amg::Vector2D hitPos_i{Amg::Vector2D::Zero()};
672 bool onSurface_i = descriptor_i->surface(channelIdIn)
673 .globalToLocal(position_i, position_i, hitPos_i);
674 // the globalToLocal should not fail, if it does produce a WARNING
675 if (!onSurface_i) {
677 "TgcRdoToPrepDataToolMT::decodeTracklet Amg::Vector2D* "
678 "hitPos_i is null.");
679 return StatusCode::SUCCESS;
680 }
681 //*** Get geometry of non-pivot plane (TGC2) end ***//
682 const Amg::Vector2D* hitPosition_o = new Amg::Vector2D(hitPos_o);
683 const Amg::Vector2D* hitPosition_i = new Amg::Vector2D(hitPos_i);
684 // Add the digit to the collection
685 TgcCoinData* newCoinData =
686 new TgcCoinData(channelIdIn, channelIdOut,
687 tgcHashId, // determined from channelIdOut
688 descriptor_i, // determined from channelIdIn
689 descriptor_o, // determined from channelIdOut
691 rd.subDetectorId() == ASIDE, // isAside
692 idHelper.stationPhi(channelIdOut), // phi
693 0, // isInner
694 rd.sswId() == 7 || rd.sswId() == 2, // isForward
695 idHelper.isStrip(channelIdOut), // isStrip
696 trackletId, // trackletId
697 hitPosition_i, // determined from channelIdIn
698 hitPosition_o, // determined from channelIdOut
699 width_i, // determined from channelIdIn
700 width_o, // determined from channelIdOut
701 delta, // delta
702 subMatrix,
703 0); // subMatrix
704 newCoinData->setHashAndIndex(coincollection->identifyHash(),
705 coincollection->size());
706 coincollection->push_back(newCoinData);
707
708 ATH_MSG_DEBUG("coincollection->push_back done (for LowPT)");
709
710 m_nTrackletPRDs++; // Count the number of output Tracklet PRDs.
711
712 return StatusCode::SUCCESS;
713}
bool getTrackletInfo(const TgcRawData &rd, int &tmp_slbId, int &tmp_subMatrix, int &tmp_position) const
Retrieve slbId, subMatrix and position from Tracklet RDO.
uint16_t position() const
Definition TgcRawData.h:313
uint16_t subMatrix() const
Definition TgcRawData.h:329

◆ decodeTrackletEIFI()

StatusCode Muon::TgcRdoToPrepDataToolMT::decodeTrackletEIFI ( State & state,
const TgcRawData & rd ) const
private

Decode RDO's of Tracklet EIFI.

Definition at line 715 of file TgcRdoToPrepDataToolMT.cxx.

716 {
717 // Count the number of input TrackletEIFI RDOs.
719
720 const TgcIdHelper& idHelper{m_idHelperSvc->tgcIdHelper()};
721
722 // Determine chamber type
724 bool isAside = rd.subDetectorId() == ASIDE;
725 // https://twiki.cern.ch/twiki/pub/Main/TgcDocument/EIFI_PSB_SSW_ConnectionTable_v20080808.pdf
726 bool isForward = (rd.slbId() % 2 == 0);
727 // Assuming RXID in the above file is equal to slbId
728 // rodId: 2 5 8 11
729 // slbId FI: 0 2 4 6 8 10 0 2 4 6 8 10 0 2 4 6 8 10 0 2 4
730 // 6 8 10
731 // EI: 1 3 5 7 9 11 1 3 5 XX 9 11 1 3 5 7 9 XX 1 3 5
732 // XX 9 11
733 // slot: 24 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
734 // 21 22 23 stationPhi
735 // FI: 24 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
736 // 21 22 23 EI: 21 1 2 3 4 5 6 7 8 XX 9 10 11 12 13 14 15 XX
737 // 16 17 18 XX 19 20
738 int slot = ((rd.slbId() / 2) + (rd.rodId() - 2) * 2 + 23) % 24 + 1;
739
740 bool isBackward = false;
741 if (!isForward) { // EI
742 // Special case of EI11
743 if (slot == 15) {
744 isBackward = !isAside;
745 } else if (slot == 16) {
746 isBackward = isAside;
747 } else {
748 // A-side phi0 F: phi1 F: phi2 B
749 // C-side phi0 B: phi1 B: phi2 F
750 if (isAside) {
751 isBackward = (slot % 3 == 2);
752 } else {
753 isBackward = (slot % 3 != 2);
754 }
755 }
756 } else { // FI
757 isBackward = isAside;
758 }
759
760 // Determine bitpos based on wire/strip and subMatrix
761 // Input is chosen so that gasGap is 1 and channel is 4,12,20,28.
762 // One subMatrix covers 8 channels (=BIT_POS_ASD_SIZE/2)
763 uint16_t bitpos = 0;
764 if (!isStrip) { // Wire
765 // For wires, D-Input is gasGap=1
766
767 int tmpsubMatrix = static_cast<int>(rd.subMatrix());
768 if (!isForward) { // If an edge channel of EI fires, subMatrix of the
769 // tracklet can be greater than one of the hit
770 // channel.
771 if (tmpsubMatrix == 3) {
772 if (slot == 1 || slot == 3 || slot == 4 || slot == 5 ||
773 slot == 6 || slot == 7 || slot == 8 || slot == 10 ||
774 slot == 11 || slot == 13 || slot == 18 || slot == 19 ||
775 slot == 20) {
776 // These slots have only 24 wire channels (=3 submatrixes)
777 tmpsubMatrix = 2;
778 }
779 } else if (tmpsubMatrix == 2) {
780 if (slot == 2 || slot == 12 || slot == 14 || slot == 15 ||
781 slot == 16 || slot == 22 || slot == 23 || slot == 24) {
782 // These slots have only 16 wire channels (=2 submatrixes)
783 tmpsubMatrix = 1;
784 }
785 }
786 }
787
789 BIT_POS_ASD_SIZE / 4 * (tmpsubMatrix * 2 + 1);
790 } else { // Strip
791 if (isBackward) {
792 // For Backward chambers, B-Input is gasGap 1
794 (isAside ? 1 : 0) +
795 BIT_POS_ASD_SIZE / 4 * (rd.subMatrix() * 2 + 1);
796 } else {
797 // For Forward chambers, A-Input is gasGap 1
799 (isAside ? 0 : 1) +
800 BIT_POS_ASD_SIZE / 4 * (rd.subMatrix() * 2 + 1);
801 }
802 }
803
804 // Retrieve OfflineID from ReadoutID
805 Identifier channelIdIn;
806 bool o_found = state.cabling->getOfflineIDfromReadoutID(
807 channelIdIn, rd.subDetectorId(), rd.rodId(), rd.sswId(), rd.slbId(),
808 bitpos, false /*orflag*/);
809 if (!o_found) {
811 "TgcRdoToPrepDataToolMT::decodeTrackletEIFI OfflineID not "
812 "found for "
813 << " subDetectorId=" << rd.subDetectorId() << " rodId="
814 << rd.rodId() << " sswId=" << rd.sswId() << " slbId=" << rd.slbId()
815 << " slbType=" << rd.slbType() << " subMatrix=" << rd.subMatrix()
816 << " bitpos=" << bitpos << " isStrip=" << isStrip
817 << " isAside=" << isAside << " isForward=" << isForward
818 << " slot=" << slot << " isBackward=" << isBackward);
819 return StatusCode::SUCCESS;
820 }
821
822 // Retrieve Hash from ElementID
823 const IdentifierHash tgcHashId = m_idHelperSvc->moduleHash(channelIdIn);
824 // Index is determined based on bcTag.
825 int locId = (rd.bcTag() == TgcDigit::BC_CURRENT ||
827 ? 1
828 : rd.bcTag() - 1;
829
830 std::unique_ptr<TgcCoinDataCollection>& coincollection =
831 state.tgcCoinDataCollections[locId][tgcHashId];
832 if (!coincollection) {
833 coincollection =
834 std::make_unique<TgcCoinDataCollection>(tgcHashId);
835 coincollection->setIdentifier(m_idHelperSvc->chamberId(channelIdIn));
836 }
837
838 // Check duplicate digits
839 for (const TgcCoinData* tgcCoinData : *coincollection) {
841 tgcCoinData->type() && // coincidence type
842 channelIdIn == tgcCoinData->channelIdIn() && // channelIdIn
843 static_cast<int>(rd.subMatrix()) == tgcCoinData->sub()) { // sub
844 ATH_MSG_DEBUG("Duplicated TgcCoinData (TrackletEIFI) = "
845 << m_idHelperSvc->toString(channelIdIn));
846 return StatusCode::SUCCESS;
847 }
848 }
849 // Get MuonGM::TgcReadoutElement from channelIdIn
850 const MuonGM::TgcReadoutElement* descriptor =
851 state.muDetMgr->getTgcReadoutElement(channelIdIn);
852 if (!isOfflineIdOKForTgcReadoutElement(descriptor, channelIdIn)) {
854 "TgcRdoToPrepDataToolMT::decodeTrackletEIFI descriptor "
855 "doesn't contain "
856 << m_idHelperSvc->toString(channelIdIn));
857 return StatusCode::SUCCESS;
858 }
859
860 // Get Amg::Vector2D from channelIdIn //here I am
861 Amg::Vector3D position = descriptor->channelPos(channelIdIn);
862 Amg::Vector2D hitPos{Amg::Vector2D::Zero()};
863 bool onSurface = descriptor->surface(channelIdIn)
864 .globalToLocal(position, position, hitPos);
865 // the globalToLocal should not fail, if it does produce a WARNING
866 if (!onSurface) {
868 "TgcRdoToPrepDataToolMT::decodeTrackletEIFI Amg::Vector2D* "
869 "hitPos is null.");
870 return StatusCode::SUCCESS;
871 }
872
873 // Get width from channelIdIn, one subMatrix covers 8 channels per gasGap
874 int gasGap = idHelper.gasGap(channelIdIn); // 1
875 int channel = idHelper.channel(channelIdIn); // 4, 12, 20, 28
876 double width{0};
877 if (isStrip) { // Strip
878 double localZ = (descriptor->transform(channelIdIn).inverse() *
879 descriptor->channelPos(channelIdIn))
880 .z();
881 double stripMaxX =
882 descriptor->stripHighEdgeLocX(gasGap, channel + 4, localZ);
883 double stripMinX =
884 descriptor->stripLowEdgeLocX(gasGap, channel - 3, localZ);
885 width = std::abs(stripMaxX - stripMinX);
886 } else { // Wire
887 int positiveOffset = +4;
888 if (isForward && (slot % 3 == 2) && channel == 28) {
889 positiveOffset = +2; // T10S has only 30 channels.
890 }
891 double gangMaxZ =
892 descriptor->gangLongWidth(gasGap, channel + positiveOffset);
893 double gangMinZ = descriptor->gangShortWidth(gasGap, channel - 3);
894 width = std::abs(gangMaxZ - gangMinZ);
895 }
896
897 const Amg::Vector2D* hitPosition = new Amg::Vector2D(hitPos);
898 // Add the digit to the collection
899 TgcCoinData* newCoinData =
900 new TgcCoinData(channelIdIn,
901 tgcHashId, // determined from channelIdIn
902 descriptor, // determined from channelIdIn
904 m_idHelperSvc->tgcIdHelper().stationPhi(channelIdIn),
905 isForward, isStrip,
906 hitPosition, // determined from channelIdIn
907 width, // determined from channelIdIn
908 static_cast<int>(rd.subMatrix())); // subMatrix
909 newCoinData->setHashAndIndex(coincollection->identifyHash(),
910 coincollection->size());
911 coincollection->push_back(newCoinData);
912
913 // Count the number of output Tracklet EIFI PRDs.
915 return StatusCode::SUCCESS;
916}
virtual const Amg::Transform3D & transform() const override
Return local to global transform.
double stripHighEdgeLocX(int gasGap, int strip, double radialPos) const
Returns the local X of the right edge of the strip at a given local radial position.
double gangShortWidth(int gasGap, int gang) const
Returns the length of the most bottom wire in the gang.
double stripLowEdgeLocX(int gasGap, int strip, double radialPos) const
Returns the local X of the left edge of the strip at a given local radial position.
double gangLongWidth(int gasGap, int gang) const
Returns the length of the most top wire in the gang.
@ SLB_TYPE_INNER_STRIP
Definition TgcRawData.h:37
SlbType slbType() const
Definition TgcRawData.h:285

◆ finalize()

StatusCode Muon::TgcRdoToPrepDataToolMT::finalize ( )
overridevirtual

Standard AthAlgTool finalize method.

Definition at line 84 of file TgcRdoToPrepDataToolMT.cxx.

84 {
85 ATH_MSG_INFO("finalize(): input RDOs->output PRDs ["
86 << "Hit: " << m_nHitRDOs << "->" << m_nHitPRDs << ", "
87 << "Tracklet: " << m_nTrackletRDOs << "->" << m_nTrackletPRDs
88 << ", " << "TrackletEIFI: " << m_nTrackletEIFIRDOs << "->"
89 << m_nTrackletEIFIPRDs << ", " << "HiPt: " << m_nHiPtRDOs
90 << "->" << m_nHiPtPRDs << ", " << "SL: " << m_nSLRDOs << "->"
91 << m_nSLPRDs << "]");
92
93 return AthAlgTool::finalize();
94}
#define ATH_MSG_INFO(x)

◆ getbitpos()

int Muon::TgcRdoToPrepDataToolMT::getbitpos ( int channel,
TgcRawData::SlbType slbType )
staticprivate

Get bitpos from channel and SlbType.

Definition at line 1522 of file TgcRdoToPrepDataToolMT.cxx.

1523 {
1524 int bitpos = -BIT_POS_INPUT_SIZE + 1;
1525 if (slbType == TgcRawData::SLB_TYPE_TRIPLET_WIRE) {
1526 if (channel < 0 || channel >= WT_MAP_SIZE) {
1527 return -1; // Invalid channel
1528 }
1529
1530 if (channel % 3 == 0) {
1531 bitpos += BIT_POS_C_INPUT_ORIGIN; // C-Input
1532 } else if (channel % 3 == 1) {
1533 bitpos += BIT_POS_B_INPUT_ORIGIN; // B-Input
1534 } else {
1535 bitpos += BIT_POS_A_INPUT_ORIGIN; // A-Input
1536 }
1537 return bitpos + channel / 3;
1538 } else if (slbType == TgcRawData::SLB_TYPE_TRIPLET_STRIP ||
1540 if (channel < 0 || channel >= ST_MAP_SIZE) {
1541 return -1; // Invalid channel, SD_MAP_SIZE is equal to ST_MAP_SIZE.
1542 }
1543
1544 if (channel % 2 == 0) {
1545 bitpos += BIT_POS_B_INPUT_ORIGIN; // B-Input
1546 } else {
1547 bitpos += BIT_POS_A_INPUT_ORIGIN; // A-Input
1548 }
1549 return bitpos + channel / 2;
1550 } else if (slbType == TgcRawData::SLB_TYPE_DOUBLET_WIRE) {
1551 if (channel < 0 || channel >= WD_MAP_SIZE) {
1552 return -1; // Invalid channel
1553 }
1554
1555 if (channel % 2 == 0) {
1556 bitpos += BIT_POS_B_INPUT_ORIGIN; // B-Input
1557 } else {
1558 bitpos += BIT_POS_A_INPUT_ORIGIN; // A-Input
1559 }
1560 return bitpos + channel / 2;
1561 } else {
1562 return -1;
1563 }
1564}
@ SLB_TYPE_TRIPLET_WIRE
Definition TgcRawData.h:34
@ SLB_TYPE_TRIPLET_STRIP
Definition TgcRawData.h:35
@ SLB_TYPE_DOUBLET_STRIP
Definition TgcRawData.h:33
@ SLB_TYPE_DOUBLET_WIRE
Definition TgcRawData.h:32

◆ getBitPosInStrip()

void Muon::TgcRdoToPrepDataToolMT::getBitPosInStrip ( const TgcRawData & rd,
const int DeltaBeforeConvert,
std::array< int, 4 > & bitpos_i,
std::array< int, 4 > & slbchannel_i,
int & sbLoc_i,
int & sswId_i,
const std::array< int, 2 > & bitpos_o,
std::array< int, 2 > & slbchannel_o ) const
private

Get bitPos etc of TGC1 strip for HiPt.

Definition at line 1953 of file TgcRdoToPrepDataToolMT.cxx.

1957 {
1958 // This method is used by decodeHiPt
1959 //*** get bitpos for TGC1 Station ***//
1960 // ST
1961 int rdochIn_max = ST_MAP_SIZE - 1;
1962 int rdochIn_min = 0;
1963
1964 if ((rd.sector() % 2) == 0) {
1965 if (rd.chip() == 0) {
1966 sbLoc_i = 16; // EST0 (phi0 and phi2) or FST0 (phi0)
1967 } else if (rd.chip() == 1) {
1968 sbLoc_i = 17; // EST1 (phi0 and phi2)
1969 }
1970 } else {
1971 if (rd.chip() == 0) {
1972 sbLoc_i = 24; // EST0 (phi1 and phi3) or FST0 (phi2)
1973 } else if (rd.chip() == 1) {
1974 sbLoc_i = 25; // EST1 (phi1 and phi3)
1975 }
1976 }
1977
1978 for (int i = 0; i < 2; i++) {
1979 slbchannel_o[i] =
1981 slbchannel_i[i] = slbchannel_o[i] + deltaBeforeConvert;
1982 if (slbchannel_i[i] > rdochIn_max) {
1983 slbchannel_i[i] = rdochIn_max;
1984 } else if (slbchannel_i[i] < rdochIn_min) {
1985 slbchannel_i[i] = rdochIn_min;
1986 }
1987
1988 if (i == 0) {
1989 slbchannel_i[i + 2] = slbchannel_i[i] + 1;
1990 } else {
1991 slbchannel_i[i + 2] = slbchannel_i[i] - 1;
1992 }
1993
1994 if (slbchannel_i[i + 2] > rdochIn_max) {
1995 slbchannel_i[i + 2] = rdochIn_max;
1996 } else if (slbchannel_i[i + 2] < rdochIn_min) {
1997 slbchannel_i[i + 2] = rdochIn_min;
1998 }
1999
2000 bitpos_i[i] =
2002 bitpos_i[i + 2] =
2003 getbitpos(slbchannel_i[i + 2], TgcRawData::SLB_TYPE_TRIPLET_STRIP);
2004 }
2005
2006 if (!rd.isForward()) { // EST
2007 sswId_i = static_cast<int>(rd.sector() / 2);
2008 } else { // FST
2009 sswId_i = 2;
2010 }
2011}
static int getbitpos(int channel, TgcRawData::SlbType slbType)
Get bitpos from channel and SlbType.
static int getchannel(int bitpos, TgcRawData::SlbType slbType)
Get channel from bitpos and SlbType.
uint16_t chip() const
Definition TgcRawData.h:337

◆ getBitPosInWire()

void Muon::TgcRdoToPrepDataToolMT::getBitPosInWire ( const TgcRawData & rd,
const int DeltaBeforeConvert,
std::array< int, 4 > & bitpos_i,
std::array< int, 4 > & slbchannel_i,
std::array< int, 4 > & slbId_in,
std::array< int, 4 > & sbLoc_in,
int & sswId_i,
const std::array< int, 2 > & bitpos_o,
std::array< int, 2 > & slbchannel_o,
const int slbId_o ) const
private

Get bitPos etc of TGC1 wire for HiPt.

Definition at line 1828 of file TgcRdoToPrepDataToolMT.cxx.

1833 {
1834 // This method is used by decodeHiPt
1835 const int NUM_SLBID_SBLOC_OFFSET_WT =
1836 8; // (see
1837 // https://twiki.cern.ch/twiki/pub/Main/TgcDocument/sbloc-070701.xls)
1838
1839 /*** get bitpos for TGC1 Station ***/
1840
1841 int rdochIn_max = 0;
1842 int rdochIn_min = 0;
1843 int offset_dt = 0;
1844 if (!rd.isForward()) { // EWT
1845 rdochIn_max = 665;
1846 rdochIn_min = 78;
1847 offset_dt = 32;
1848 } else { // FWT
1849 rdochIn_max = 312;
1850 rdochIn_min = 0;
1851 offset_dt = 0;
1852 }
1853
1854 int tmp_rdochannel_i = 0;
1855 int tmp_rdochannel_i2 = 0;
1856 for (int i = 0; i < 2; i++) {
1857 slbchannel_o[i] =
1859 tmp_rdochannel_i = WD_MAP_SIZE * slbId_o + slbchannel_o[i] +
1860 deltaBeforeConvert + offset_dt;
1861 if (tmp_rdochannel_i > rdochIn_max) {
1862 tmp_rdochannel_i = rdochIn_max;
1863 } else if (tmp_rdochannel_i < rdochIn_min) {
1864 tmp_rdochannel_i = rdochIn_min;
1865 }
1866
1867 // Large R <-----------------> Small R
1868 // tmp_rdochannel_i : 0 1 2 3 4 5 6 7 8 9 10 ...
1869 //-------------------------------------------------------------------
1870 // tmp_rdochannel_i/3 : 0 0 0 1 1 1 2 2 2 3 3 ...
1871 // (tmp_rdochannel_i/3)*3 : 0 0 0 3 3 3 6 6 6 9 9 ...
1872 // tmp_rdochannel_i2 (i==0) : 2 2 2 5 5 5 8 8 8 11 11 ...
1873 //-------------------------------------------------------------------
1874 // tmp_rdochannel_i+1 : 1 2 3 4 5 6 7 8 9 10 11 ...
1875 // (tmp_rdochannel_i+1)/3 : 0 0 1 1 1 2 2 2 3 3 3 ...
1876 // ((tmp_rdochannel_i+1)/3)*3 : 0 0 3 3 3 6 6 6 9 9 9 ...
1877 // tmp_rdochannel_i2 (i==1) : -1 -1 2 2 2 5 5 5 8 8 8 ...
1878
1879 if (i == 0) { // get the lower R channel on L3 nearest from bitpos_o[0]
1880 tmp_rdochannel_i2 = (tmp_rdochannel_i / 3) * 3 + 2;
1881 } else { // get the higher R channel on L3 nearest from bitpos_o[1]
1882 tmp_rdochannel_i2 = ((tmp_rdochannel_i + 1) / 3) * 3 - 1;
1883 }
1884
1885 if (tmp_rdochannel_i2 > rdochIn_max) {
1886 tmp_rdochannel_i2 = rdochIn_max;
1887 } else if (tmp_rdochannel_i2 < rdochIn_min) {
1888 tmp_rdochannel_i2 = rdochIn_min + 2; // 2 is added for L3
1889 }
1890
1891 slbId_in[i] = tmp_rdochannel_i / WT_MAP_SIZE;
1892 slbId_in[i + 2] = tmp_rdochannel_i2 / WT_MAP_SIZE;
1893
1894 sbLoc_in[i] = slbId_in[i];
1895 sbLoc_in[i + 2] = slbId_in[i + 2];
1896 if (rd.sector() % 2 == 1) {
1897 // phi1 and phi3 have offset (see
1898 // https://twiki.cern.ch/twiki/pub/Main/TgcDocument/sbloc-070701.xls)
1899 // Endcap sector=1, 3 are phi1 and phi3, and Forward sector=1 is
1900 // phi2.
1901 sbLoc_in[i] += NUM_SLBID_SBLOC_OFFSET_WT;
1902 sbLoc_in[i + 2] += NUM_SLBID_SBLOC_OFFSET_WT;
1903 }
1904
1905 slbchannel_i[i] = tmp_rdochannel_i % WT_MAP_SIZE;
1906 slbchannel_i[i + 2] = tmp_rdochannel_i2 % WT_MAP_SIZE;
1907
1908 bitpos_i[i] =
1910 bitpos_i[i + 2] =
1911 getbitpos(slbchannel_i[i + 2], TgcRawData::SLB_TYPE_TRIPLET_WIRE);
1912 }
1913
1914 if (!rd.isForward()) { // EWT
1915 sswId_i = static_cast<int>(rd.sector() / 2);
1916 } else { // FWT
1917 sswId_i = 2;
1918 }
1919}

◆ getBitPosOutStrip()

void Muon::TgcRdoToPrepDataToolMT::getBitPosOutStrip ( const TgcRawData & rd,
int & slbsubMatrix,
std::array< int, 2 > & bitpos_o )
staticprivate

Get bitPos etc of TGC3 strip for HiPt.

Definition at line 1921 of file TgcRdoToPrepDataToolMT.cxx.

1922 {
1923 // This method is used by decodeHiPt
1924 if ((rd.hitId() % 2) == 1) { // 1,3,5::hitId:1-6 for EC, 2-3 for Fw
1925 slbsubMatrix = 0;
1926 if ((rd.hsub()) == 0) {
1927 bitpos_o[0] =
1929 bitpos_o[1] =
1931 } else if ((rd.hsub()) == 1) {
1932 bitpos_o[0] =
1934 bitpos_o[1] =
1936 }
1937 } else { // 2,4,6
1938 slbsubMatrix = 1;
1939 if ((rd.hsub()) == 0) {
1940 bitpos_o[0] =
1942 bitpos_o[1] =
1944 } else if ((rd.hsub()) == 1) {
1945 bitpos_o[0] =
1947 bitpos_o[1] =
1949 }
1950 }
1951}

◆ getBitPosOutWire()

void Muon::TgcRdoToPrepDataToolMT::getBitPosOutWire ( const TgcRawData & rd,
int & slbsubMatrix,
std::array< int, 2 > & bitpos_o )
staticprivate

Get bitPos etc of TGC3 wire for HiPt.

Definition at line 1772 of file TgcRdoToPrepDataToolMT.cxx.

1773 {
1774 // This method is used by decodeHiPt
1775 if ((rd.hitId() % 2) == 1) { // 1,3,5
1776 slbsubMatrix = 0;
1777 if ((rd.hsub()) == 0) {
1778 bitpos_o[0] = BIT_POS_B_INPUT_LARGE_R_CH15; // 78
1779 bitpos_o[1] = BIT_POS_A_INPUT_LARGE_R_CH08; // 49
1780 } else if ((rd.hsub()) == 1) {
1781 bitpos_o[0] = BIT_POS_B_INPUT_LARGE_R_CH07; // 86
1782 bitpos_o[1] = BIT_POS_A_INPUT_LARGE_R_CH00; // 57
1783 }
1784 } else { // 2,4,6
1785 slbsubMatrix = 1;
1786 if ((rd.hsub()) == 0) {
1787 bitpos_o[0] = BIT_POS_B_INPUT_SMALL_R_CH15; // 94
1788 bitpos_o[1] = BIT_POS_A_INPUT_SMALL_R_CH08; // 65
1789 } else if ((rd.hsub()) == 1) {
1790 bitpos_o[0] = BIT_POS_B_INPUT_SMALL_R_CH07; // 102
1791 bitpos_o[1] = BIT_POS_A_INPUT_SMALL_R_CH00; // 73
1792 }
1793 }
1794
1795 // In case of WIRE, there are no bit assign.(EWD0 EWD4 FWD0
1796 // FWD1)----------------------------- EWD0 sbLoc = 0 bitpos = 102 : does
1797 // not exist and has 6 channels only (the largest R, RoiRow== 0). EWD4
1798 // sbLoc = 9 bitpos = 73 : does not exist and has 4 channels only (the
1799 // smallest R, RoiRow==36). FWD0 sbLoc = 0, 8 bitpos = 78 : does not exist
1800 // and has 5 channels only (the largest R, RoiRow== 0). FWD1 sbLoc = 3, 11
1801 // bitpos = 73 : does not exist and has 5 channels only (the smallest R,
1802 // RoiTow==15). fixed it by following description.
1803 if (!rd.isForward()) { // Endcap
1804 if ((rd.chip() == 0) && (rd.hitId() == 1) && (rd.hsub() == 1)) {
1805 // chip 0 should have these values and means EWD0's position.
1806 slbsubMatrix = 1;
1807 bitpos_o[0] = BIT_POS_B_INPUT_SMALL_R_CH05; // 104
1808 bitpos_o[1] = BIT_POS_A_INPUT_SMALL_R_CH00; // 73
1809 } else if ((rd.chip() == 3) && (rd.hitId() == 6) &&
1810 (rd.hsub() == 1)) { // EWD4's position
1811 bitpos_o[0] = BIT_POS_B_INPUT_SMALL_R_CH07; // 102
1812 bitpos_o[1] = BIT_POS_A_INPUT_SMALL_R_CH04; // 69
1813 }
1814 } else { // Forward
1815 if ((rd.chip() == 0) && (rd.hitId() == 1) &&
1816 (rd.hsub() == 0)) { // FWD0
1817 bitpos_o[0] = BIT_POS_B_INPUT_LARGE_R_CH12; // 81
1818 bitpos_o[1] = BIT_POS_A_INPUT_LARGE_R_CH08; // 49
1819 } else if ((rd.chip() == 1) && (rd.hitId() == 2) &&
1820 (rd.hsub() == 1)) { // FWD1
1821 bitpos_o[0] = BIT_POS_B_INPUT_SMALL_R_CH07; // 102
1822 bitpos_o[1] = BIT_POS_A_INPUT_SMALL_R_CH03; // 70
1823 }
1824 } // end of Forward
1825 // end of fixed------------------------------------------------
1826}

◆ getBitPosStrip()

void Muon::TgcRdoToPrepDataToolMT::getBitPosStrip ( const int hitId_s,
const int sub_s,
int & subMatrix_s,
std::array< int, 3 > & bitpos_s )
staticprivate

Get bitPos etc of strip for SL.

Definition at line 2078 of file TgcRdoToPrepDataToolMT.cxx.

2080 {
2081 // This method is used by getSLIds
2082 // 0 : Index for the largest phi (for A-side forward and C-side backward)
2083 // channel 1 : Index for the smallest phi (for A-side forward and C-side
2084 // backward) channel 2 : Index for the "center" channel
2085
2086 if ((hitId_s % 2) == 0) { // 0, 2, 4
2087 subMatrix_s = 0;
2088 if (sub_s == 0) {
2089 bitpos_s[0] =
2091 bitpos_s[1] =
2093 bitpos_s[2] =
2095 } else if (sub_s == 1) {
2096 bitpos_s[0] =
2098 bitpos_s[1] =
2100 bitpos_s[2] =
2102 }
2103 } else if ((hitId_s % 2) == 1) { // 1, 3, 5
2104 subMatrix_s = 1;
2105 if (sub_s == 0) {
2106 bitpos_s[0] =
2108 bitpos_s[1] =
2110 bitpos_s[2] =
2112 } else if (sub_s == 1) {
2113 bitpos_s[0] =
2115 bitpos_s[1] =
2117 bitpos_s[2] =
2119 }
2120 }
2121}

◆ getBitPosWire()

void Muon::TgcRdoToPrepDataToolMT::getBitPosWire ( const TgcRawData & rd,
const int hitId_w,
const int sub_w,
int & subMatrix_w,
std::array< int, 3 > & bitpos_w ) const
private

Get bitPos etc of wire for SL.

Definition at line 2013 of file TgcRdoToPrepDataToolMT.cxx.

2015 {
2016 // This method is used by getSLIds
2017 // This method assumes sub_w is 0 or 1.
2018 // Protection for other possibility is needed.
2019
2020 // 0 : Index for the largest R channel
2021 // 1 : Index for the smallest R channel
2022 // 2 : Index for the "center" channel
2023
2024 int RoiRow = getRoiRow(rd);
2025 bool isForward = rd.isForward();
2026
2027 if (RoiRow == 0 && !isForward) { // EWD0,SLB0 exception (It has 6 channels
2028 // only, the largest R)
2029 subMatrix_w = 1;
2030 bitpos_w[0] = BIT_POS_B_INPUT_SMALL_R_CH05; // 104
2031 bitpos_w[1] = BIT_POS_A_INPUT_SMALL_R_CH04; // 69
2032 bitpos_w[2] = BIT_POS_A_INPUT_SMALL_R_CH00; // 73
2033 } else if (RoiRow == 36 && !isForward) { // EWD4,SLB1 exception (It has 4
2034 // channels only, the smallest R)
2035 subMatrix_w = 1;
2036 bitpos_w[0] = BIT_POS_B_INPUT_SMALL_R_CH07; // 102
2037 bitpos_w[1] = BIT_POS_A_INPUT_SMALL_R_CH04; // 69
2038 bitpos_w[2] = BIT_POS_A_INPUT_SMALL_R_CH04; // 69
2039 } else if (RoiRow == 0 && isForward) { // FWD0,SLB0 exception (It has 5
2040 // channels only, the largest R)
2041 subMatrix_w = 0;
2042 bitpos_w[0] = BIT_POS_B_INPUT_LARGE_R_CH12; // 81
2043 bitpos_w[1] = BIT_POS_A_INPUT_LARGE_R_CH12; // 45
2044 bitpos_w[2] = BIT_POS_A_INPUT_LARGE_R_CH08; // 49
2045 } else if (RoiRow == 15 && isForward) { // FWD1,SLB1 exception (It has 5
2046 // channels only, the smallest R)
2047 subMatrix_w = 1;
2048 bitpos_w[0] = BIT_POS_B_INPUT_SMALL_R_CH07; // 102
2049 bitpos_w[1] = BIT_POS_A_INPUT_SMALL_R_CH04; // 69
2050 bitpos_w[2] = BIT_POS_A_INPUT_SMALL_R_CH03; // 70
2051 } else {
2052 if ((hitId_w % 2) == 0) { // 0, 2, 4
2053 subMatrix_w = 0;
2054 if (sub_w == 0) {
2055 bitpos_w[0] = BIT_POS_B_INPUT_LARGE_R_CH15; // 78
2056 bitpos_w[1] = BIT_POS_A_INPUT_LARGE_R_CH12; // 45
2057 bitpos_w[2] = BIT_POS_A_INPUT_LARGE_R_CH08; // 49
2058 } else if (sub_w == 1) {
2059 bitpos_w[0] = BIT_POS_B_INPUT_LARGE_R_CH07; // 86
2060 bitpos_w[1] = BIT_POS_A_INPUT_LARGE_R_CH04; // 53
2061 bitpos_w[2] = BIT_POS_A_INPUT_LARGE_R_CH00; // 57
2062 }
2063 } else { // 1, 3, 5
2064 subMatrix_w = 1;
2065 if (sub_w == 0) {
2066 bitpos_w[0] = BIT_POS_B_INPUT_SMALL_R_CH15; // 94
2067 bitpos_w[1] = BIT_POS_A_INPUT_SMALL_R_CH12; // 61
2068 bitpos_w[2] = BIT_POS_A_INPUT_SMALL_R_CH08; // 65
2069 } else if (sub_w == 1) {
2070 bitpos_w[0] = BIT_POS_B_INPUT_SMALL_R_CH07; // 102
2071 bitpos_w[1] = BIT_POS_A_INPUT_SMALL_R_CH04; // 69
2072 bitpos_w[2] = BIT_POS_A_INPUT_SMALL_R_CH00; // 73
2073 }
2074 }
2075 }
2076}
static int getRoiRow(const TgcRawData &rd)
Get ROI row from RDO.

◆ getchannel()

int Muon::TgcRdoToPrepDataToolMT::getchannel ( int bitpos,
TgcRawData::SlbType slbType )
staticprivate

Get channel from bitpos and SlbType.

Definition at line 1566 of file TgcRdoToPrepDataToolMT.cxx.

1567 {
1568 int input = -1;
1569 if ((bitpos <= BIT_POS_A_INPUT_ORIGIN) &&
1571 input = 2; // A-Input
1572 } else if ((bitpos <= BIT_POS_B_INPUT_ORIGIN) &&
1574 input = 1; // B-Input
1575 } else if ((bitpos <= BIT_POS_C_INPUT_ORIGIN) &&
1577 input = 0; // C-Input
1578 }
1579 // D-Input is not implemented yet.
1580 else {
1581 return -1; // Invalid bitpos
1582 }
1583 if (input == 0 && slbType != TgcRawData::SLB_TYPE_TRIPLET_WIRE) {
1584 return -1; // Only Wire Triplet has C-input.
1585 }
1586
1587 int channel = 1 - BIT_POS_INPUT_SIZE;
1588 if (slbType == TgcRawData::SLB_TYPE_TRIPLET_WIRE) {
1589 if (input == 2) {
1590 channel += BIT_POS_A_INPUT_ORIGIN; // A-input
1591 } else if (input == 1) {
1592 channel += BIT_POS_B_INPUT_ORIGIN; // B-input
1593 } else {
1594 channel += BIT_POS_C_INPUT_ORIGIN; // C-input
1595 }
1596 channel = 3 * (bitpos - channel) + input;
1597 return channel; // C(0)->B(1)->A(2)->C(3)->B(4)->A(5)-> ...
1598 // ->C(96-3)->B(96-2)->A(96-1)
1599 } else if (slbType == TgcRawData::SLB_TYPE_TRIPLET_STRIP ||
1602 if (input == 2) {
1603 channel += BIT_POS_A_INPUT_ORIGIN; // A-input
1604 } else {
1605 channel += BIT_POS_B_INPUT_ORIGIN; // B-input
1606 }
1607 channel = 2 * (bitpos - channel) + input - 1;
1608 return channel; // B(0)->A(1)->B(2)->A(3)-> ... ->B(64-2)->A(64-1)
1609 } else {
1610 return -1;
1611 }
1612}

◆ getDeltaBeforeConvert()

int Muon::TgcRdoToPrepDataToolMT::getDeltaBeforeConvert ( const TgcRawData & rd)
staticprivate

Get delta (sagitta) before converion for HiPt.

Definition at line 2123 of file TgcRdoToPrepDataToolMT.cxx.

2123 {
2124 int deltaBeforeConvert = 0;
2125
2126 if (rd.isStrip()) { // strip
2127 switch (rd.delta()) {
2128 case 5:
2129 deltaBeforeConvert = 6;
2130 break;
2131 case 6:
2132 deltaBeforeConvert = 8;
2133 break;
2134 case 7:
2135 deltaBeforeConvert = 10;
2136 break;
2137 case -4:
2138 deltaBeforeConvert = -5;
2139 break;
2140 case -5:
2141 deltaBeforeConvert = -7;
2142 break;
2143 case -6:
2144 deltaBeforeConvert = -9;
2145 break;
2146 case -7:
2147 deltaBeforeConvert = -12;
2148 break;
2149 default:
2150 deltaBeforeConvert = rd.delta();
2151 break;
2152 }
2153 } else { // wire
2154 switch (rd.delta()) {
2155 case 11:
2156 deltaBeforeConvert = 12;
2157 break;
2158 case 12:
2159 deltaBeforeConvert = 14;
2160 break;
2161 case 13:
2162 deltaBeforeConvert = 16;
2163 break;
2164 case 14:
2165 deltaBeforeConvert = 18;
2166 break;
2167 case 15:
2168 deltaBeforeConvert = 20;
2169 break;
2170 case -12:
2171 deltaBeforeConvert = -13;
2172 break;
2173 case -13:
2174 deltaBeforeConvert = -15;
2175 break;
2176 case -14:
2177 deltaBeforeConvert = -17;
2178 break;
2179 case -15:
2180 deltaBeforeConvert = -19;
2181 break;
2182 default:
2183 deltaBeforeConvert = rd.delta();
2184 break;
2185 }
2186 }
2187
2188 return deltaBeforeConvert;
2189}

◆ getEndcapStripCandidateTrackletIds()

void Muon::TgcRdoToPrepDataToolMT::getEndcapStripCandidateTrackletIds ( const int roi,
int & trackletIdStripFirst,
int & trackletIdStripSecond,
int & trackletIdStripThird )
staticprivate

Get trackletIds of three Tracklet Strip candidates in the Endcap boudary.

Definition at line 3207 of file TgcRdoToPrepDataToolMT.cxx.

3209 {
3210 constexpr int T9SscMax = 2; // SSC 0 to SSC 2
3211 constexpr int T8SscMax = 4; // SSC 3 to SSC 4
3212 constexpr int T7SscMax = 6; // SSC 5 to SSC 6
3213 constexpr int T6SscMax = 12; // SSC 7 to SSC12
3214 constexpr int T5SscMax = 18; // SSC13 to SSC18
3215
3216 constexpr int T9Offset = 32 + 0;
3217 constexpr int T8Offset = 32 + 2;
3218 constexpr int T7Offset = 32 + 4;
3219 constexpr int T6Offset = 32 + 6;
3220 constexpr int T5Offset = 32 + 8;
3221
3222 // ROI : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ...
3223 // SSC : 0 0 0 0 1 1 1 1 1 1 1 1 2 2 2 2 2 2 ...
3224 // Half SSC: 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 ...
3225 int ssc = (roi + 4) / 8;
3226 int halfSsc = (roi % 4) / 2;
3227
3228 if (ssc < T9SscMax) { // SSC 0 to SSC 1
3229 trackletIdStripFirst = T9Offset + halfSsc; // T9
3230 trackletIdStripSecond = -1;
3231 trackletIdStripThird = -1;
3232 } else if (ssc == T9SscMax) { // SSC 2 (boundary)
3233 trackletIdStripFirst = T8Offset + halfSsc; // T8
3234 trackletIdStripSecond = T9Offset + halfSsc; // T9
3235 trackletIdStripThird = -1;
3236 } else if (ssc < T8SscMax) { // SSC 3
3237 trackletIdStripFirst = T8Offset + halfSsc; // T8
3238 trackletIdStripSecond = -1;
3239 trackletIdStripThird = -1;
3240 } else if (ssc == T8SscMax) { // SSC 4 (boundary)
3241 trackletIdStripFirst = T7Offset + halfSsc; // T7
3242 trackletIdStripSecond = T8Offset + halfSsc; // T8
3243 trackletIdStripThird = -1;
3244 } else if (ssc < T7SscMax) { // SSC 5
3245 trackletIdStripFirst = T7Offset + halfSsc; // T7
3246 trackletIdStripSecond = -1;
3247 trackletIdStripThird = -1;
3248 } else if (ssc == T7SscMax) { // SSC 6 (boundary)
3249 trackletIdStripFirst = T6Offset + halfSsc; // T6
3250 trackletIdStripSecond = T7Offset + halfSsc; // T7
3251 trackletIdStripThird =
3252 T5Offset + halfSsc; // T5, HiPt Endcap Strip board bug
3253 } else if (ssc < T6SscMax) { // SSC 7 to SSC11
3254 trackletIdStripFirst = T6Offset + halfSsc; // T6
3255 trackletIdStripSecond =
3256 T5Offset + halfSsc; // T5, HiPt Endcap Strip board bug
3257 trackletIdStripThird = -1;
3258 } else if (ssc == T6SscMax) { // SSC12 (boundary)
3259 trackletIdStripFirst = T6Offset + halfSsc; // T6
3260 trackletIdStripSecond = T5Offset + halfSsc; // T5
3261 trackletIdStripThird = -1;
3262 } else if (ssc <= T5SscMax) { // SSC13 to SSC18
3263 trackletIdStripFirst = T5Offset + halfSsc; // T5
3264 trackletIdStripSecond =
3265 T6Offset + halfSsc; // T6, HiPt Endcap Strip board bug
3266 trackletIdStripThird = -1;
3267 } else {
3268 trackletIdStripFirst = -1;
3269 trackletIdStripSecond = -1;
3270 trackletIdStripThird = -1;
3271 }
3272}

◆ getEtafromRZ()

bool Muon::TgcRdoToPrepDataToolMT::getEtafromRZ ( const double r,
const double z,
double & eta )
staticprivate

Get eta from r and z.

Definition at line 1624 of file TgcRdoToPrepDataToolMT.cxx.

1625 {
1626 double r_tmp = std::abs(r);
1627 double z_tmp = std::abs(z);
1628
1629 if ((r_tmp < std::numeric_limits<double>::epsilon()) &&
1630 (z_tmp < std::numeric_limits<double>::epsilon())) {
1631 return false;
1632 }
1633
1634 eta = std::abs(atan2(r_tmp, z_tmp)); // theta
1635 eta = tan(eta / 2.); // tan(theta/2)
1636 eta = -log(eta); // rapidity=-log(tan(theta/2))
1637 return true;
1638}
Scalar eta() const
pseudorapidity method
#define z
int r
Definition globals.cxx:22

◆ getHiPtIds()

bool Muon::TgcRdoToPrepDataToolMT::getHiPtIds ( const State & state,
const TgcRawData & rd,
int & sswId_o,
int & sbLoc_o,
int & slbId_o ) const
private

Get ReadoutID of HiPt from RDOHighPtID.

Definition at line 2786 of file TgcRdoToPrepDataToolMT.cxx.

2788 {
2789 int index = static_cast<int>(rd.index());
2790 int chip = static_cast<int>(rd.chip());
2791 int hitId = static_cast<int>(rd.hitId());
2792
2793 // getSimHighPtIDfromRDOHighPtID changes index, chip and hitId.
2794 bool found = state.cabling->getSimHighPtIDfromRDOHighPtID(
2795 rd.isForward(), rd.isStrip(), index, chip, hitId);
2796 if (!found) {
2797 ATH_MSG_DEBUG("Failed to get SimHighPtID from RDOHighPtID for Pivot "
2798 << (rd.isStrip() ? "Strip" : "Wire"));
2799 return false;
2800 }
2801
2802 // conversion for Run3
2803 uint16_t tmprodId, tmpsector;
2804 convertToRun2(rd, tmprodId, tmpsector);
2805
2806 Identifier dummyId;
2807 if (rd.rodId() > 12) { // Run3
2808 found = state.cabling->getOfflineIDfromHighPtID(
2809 dummyId, rd.subDetectorId(), tmprodId, tmpsector, rd.isStrip(),
2810 rd.isForward(), index, chip, hitId, rd.hsub());
2811 } else {
2812 found = state.cabling->getOfflineIDfromHighPtID(
2813 dummyId, rd.subDetectorId(), rd.rodId(), rd.sector(), rd.isStrip(),
2814 rd.isForward(), index, chip, hitId, rd.hsub());
2815 }
2816
2817 if (!found) {
2818 ATH_MSG_DEBUG("Failed to get offlineID from HighPtID for Pivot "
2819 << (rd.isStrip() ? "Strip" : "Wire"));
2820 return false;
2821 }
2822
2823 std::array<int, 3> dummy_i{};
2824 found = state.cabling->getReadoutIDfromOfflineID(
2825 dummyId, dummy_i[0], dummy_i[1], sswId_o, sbLoc_o, dummy_i[2]);
2826 if (!found) {
2827 ATH_MSG_DEBUG("Failed to get ReadoutID from OfflineID for Pivot "
2828 << (rd.isStrip() ? "Strip" : "Wire"));
2829 return false;
2830 }
2831
2832 std::array<int, 2> i_o{};
2833 std::array<bool, 2> b_o{false, false};
2834 if (rd.rodId() > 12) { // Run3
2835 found = state.cabling->getSLBIDfromReadoutID(
2836 i_o[0], b_o[0], b_o[1], i_o[1], slbId_o, rd.subDetectorId(),
2837 tmprodId, sswId_o, sbLoc_o);
2838 } else {
2839 found = state.cabling->getSLBIDfromReadoutID(
2840 i_o[0], b_o[0], b_o[1], i_o[1], slbId_o, rd.subDetectorId(),
2841 rd.rodId(), sswId_o, sbLoc_o);
2842 }
2843 if (!found) {
2844 ATH_MSG_DEBUG("Failed to get SLBID from ReadoutID for Pivot "
2845 << (rd.isStrip() ? "Strip" : "Wire"));
2846 return false;
2847 }
2848
2849 return true;
2850}
uint16_t index() const
Definition TgcRawData.h:309
str index
Definition DeMoScan.py:362

◆ getPosAndIdStripIn()

bool Muon::TgcRdoToPrepDataToolMT::getPosAndIdStripIn ( const std::array< const MuonGM::TgcReadoutElement *, 4 > & descriptor_i,
const std::array< Identifier, 4 > & channelIdIn,
const std::array< int, 4 > & gasGap_i,
const std::array< int, 4 > & channel_i,
double & width_i,
double & hit_position_i,
Amg::Vector2D & tmp_hitPos_i,
Identifier & channelIdIn_tmp,
const bool isBackward,
const bool isAside ) const
private

Get position and offline ID of TGC1 strip for HiPt.

Definition at line 2679 of file TgcRdoToPrepDataToolMT.cxx.

2685 {
2686 // This method is used by decodeHiPt
2687 int flag_isL3 = -1;
2688 // which bitpos is Layer3?
2689 for (int i = 0; i < 4; i++) {
2690 if (gasGap_i[i] == 3) {
2691 flag_isL3 = i;
2692 break;
2693 }
2694 }
2695 if (flag_isL3 < 0 || flag_isL3 >= 4) {
2696 ATH_MSG_DEBUG("getPosAndIdStripIn: Any bitpos is not at Layer3!");
2697 return false;
2698 }
2699
2700 channelIdIn_tmp = channelIdIn[flag_isL3];
2701 SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{
2703 const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
2704 const MuonGM::TgcReadoutElement* descriptor_is =
2705 muDetMgr->getTgcReadoutElement(channelIdIn_tmp);
2706 if (!isOfflineIdOKForTgcReadoutElement(descriptor_is, channelIdIn_tmp)) {
2707 return true;
2708 }
2709
2710 std::array<double, 3> tmp_r_i{}, tmp_phi_i{}, tmp_eta_i{};
2711 std::array<Amg::Vector3D, 3> position_is{
2712 make_array<Amg::Vector3D, 3>(Amg::Vector3D::Zero())};
2713 for (int i = 0; i < 3; i++) {
2714 if (i < 2) {
2715 position_is[i] = descriptor_i[i]->channelPos(channelIdIn[i]);
2716 } else {
2717 position_is[i] = descriptor_is->channelPos(channelIdIn_tmp);
2718 }
2719 tmp_r_i[i] = position_is[i].perp();
2720 tmp_phi_i[i] = position_is[i].phi();
2721 tmp_eta_i[i] = position_is[i].eta();
2722 }
2723
2724 std::array<int, 2> index{};
2725 bool flag_reverse = false;
2726 if (!isBackward) { // Forward chamber
2727 if (isAside) { // Aside/Forward Chamber
2728 index[0] = 1;
2729 index[1] = 0;
2730 flag_reverse = true;
2731 } else { // Cside/Forward Chamber
2732 index[0] = 0;
2733 index[1] = 1;
2734 flag_reverse = false;
2735 }
2736 } else { // Backward chamber
2737 if (isAside) { // Aside/Backward Chamber
2738 index[0] = 0;
2739 index[1] = 1;
2740 flag_reverse = true;
2741 } else { // Cside/Backward Chamber
2742 index[0] = 1;
2743 index[1] = 0;
2744 flag_reverse = false;
2745 }
2746 }
2747
2748 std::array<Amg::Vector3D, 2> localpos_i{
2749 make_array<Amg::Vector3D, 2>(Amg::Vector3D::Zero())};
2750 for (int i = 0; i < 2; i++) {
2751 localpos_i[i] = descriptor_i[i]->transform(channelIdIn[i]).inverse() *
2752 descriptor_i[i]->channelPos(channelIdIn[i]);
2753 }
2754 double stripMaxX = descriptor_i[index[0]]->stripHighEdgeLocX(
2755 gasGap_i[index[0]], channel_i[index[0]], localpos_i[index[0]].z());
2756 double stripMinX = descriptor_i[index[1]]->stripLowEdgeLocX(
2757 gasGap_i[index[1]], channel_i[index[1]], localpos_i[index[1]].z());
2758 width_i = stripMaxX - stripMinX;
2759 // X-coordinate
2760 hit_position_i = stripMinX + width_i / 2.;
2761 if (flag_reverse) {
2762 hit_position_i *= -1.;
2763 }
2764 tmp_hitPos_i[Trk::locX] = hit_position_i;
2765 // Y-coordinate
2766 Amg::Vector3D position_in =
2767 Amg::Vector3D(descriptor_i[1]->channelPos(channelIdIn[1]));
2768 // dummy global pos
2769 Amg::Vector2D loc_hitPos_i;
2770 bool onSurface_i =
2771 descriptor_i[1]
2772 ->surface(channelIdIn[1])
2773 .globalToLocal(position_in, position_in, loc_hitPos_i);
2774 if (!onSurface_i) {
2776 "TgcRdoToPrepDataToolMT::getPosAndIdStripIn Amg::Vector2D* "
2777 "loc_hitPos_i is null.");
2778 return false;
2779 }
2780 tmp_hitPos_i[Trk::locY] = loc_hitPos_i[Trk::loc2];
2781
2782 return true;
2783}
constexpr std::array< T, N > make_array(const T &def_val)
Helper function to initialize in-place arrays with non-zero values.
Definition ArrayHelper.h:10
const TgcReadoutElement * getTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_muDetMgrKey
const_pointer_type cptr()
@ locY
local cartesian
Definition ParamDefs.h:38
@ locX
Definition ParamDefs.h:37
@ loc2
generic first and second local coordinate
Definition ParamDefs.h:35

◆ getPosAndIdStripOut()

bool Muon::TgcRdoToPrepDataToolMT::getPosAndIdStripOut ( const std::array< const MuonGM::TgcReadoutElement *, 2 > & descriptor_o,
const std::array< Identifier, 2 > & channelIdOut,
const std::array< int, 2 > & gasGap_o,
const std::array< int, 2 > & channel_o,
double & width_o,
double & hit_position_o,
Amg::Vector2D & tmp_hitPos_o,
Identifier & channelIdOut_tmp,
const bool isBackward,
const bool isAside ) const
private

Get position and offline ID of TGC3 strip for HiPt.

Definition at line 2469 of file TgcRdoToPrepDataToolMT.cxx.

2475 {
2476 // This method is used by decodeHiPt
2477 // Currently, this method always returns true.
2478 std::array<Amg::Vector3D, 2> localpos_o{
2479 make_array<Amg::Vector3D, 2>(Amg::Vector3D::Zero())};
2480 for (int i = 0; i < 2; i++) {
2481 localpos_o[i] = descriptor_o[i]->transform(channelIdOut[i]).inverse() *
2482 descriptor_o[i]->channelPos(channelIdOut[i]);
2483 }
2484
2485 std::array<int, 3> index{};
2486 bool flag_reverse = false;
2487 if (!isBackward) { // Forward chamber
2488 index[2] = 0;
2489 if (isAside) { // Aside/Forward Chamber
2490 index[0] = 1;
2491 index[1] = 0;
2492 flag_reverse = true;
2493 } else { // Cside/Forward Chamber
2494 index[0] = 0;
2495 index[1] = 1;
2496 flag_reverse = false;
2497 }
2498 } else { // Backward chamber
2499 index[2] = 1;
2500 if (isAside) { // Aside/Backward Chamber
2501 index[0] = 0;
2502 index[1] = 1;
2503 flag_reverse = true;
2504 } else { // Cside/Backward Chamber
2505 index[0] = 1;
2506 index[1] = 0;
2507 flag_reverse = false;
2508 }
2509 }
2510
2511 double stripMax = descriptor_o[index[0]]->stripHighEdgeLocX(
2512 gasGap_o[index[0]], channel_o[index[0]], localpos_o[index[0]].z());
2513 double stripMin = descriptor_o[index[1]]->stripLowEdgeLocX(
2514 gasGap_o[index[1]], channel_o[index[1]], localpos_o[index[1]].z());
2515 width_o = stripMax - stripMin;
2516 // X-coordinate
2517 hit_position_o = stripMin + width_o / 2.;
2518 if (flag_reverse) {
2519 hit_position_o *= -1.;
2520 }
2521 tmp_hitPos_o[Trk::locX] = hit_position_o;
2522 // Y-coordinate
2523 Amg::Vector3D position_out =
2524 Amg::Vector3D(descriptor_o[1]->channelPos(channelIdOut[1]));
2525 // dummy global pos
2526 Amg::Vector2D loc_hitPos_o{Amg::Vector2D::Zero()};
2527 bool onSurface_o =
2528 descriptor_o[1]
2529 ->surface(channelIdOut[1])
2530 .globalToLocal(position_out, position_out, loc_hitPos_o);
2531 if (!onSurface_o) {
2533 "TgcRdoToPrepDataToolMT::getPosAndIdStripOut Amg::Vector2D* "
2534 "loc_hitPos_o is null.");
2535 return false;
2536 }
2537 tmp_hitPos_o[Trk::locY] = loc_hitPos_o[Trk::loc2];
2538
2539 channelIdOut_tmp = channelIdOut[index[2]];
2540
2541 return true;
2542}

◆ getPosAndIdWireIn()

bool Muon::TgcRdoToPrepDataToolMT::getPosAndIdWireIn ( const std::array< const MuonGM::TgcReadoutElement *, 4 > & descriptor_i,
const std::array< Identifier, 4 > & channelIdIn,
const std::array< int, 4 > & gasGap_i,
const std::array< int, 4 > & channel_i,
double & width_i,
double & hit_position_i,
Amg::Vector2D & tmp_hitPos_i,
Identifier & channelIdIn_tmp ) const
private

Get position and offline ID of TGC1 wire for HiPt.

Definition at line 2544 of file TgcRdoToPrepDataToolMT.cxx.

2549 {
2550 // This method is used by decodeHiPt
2551 int flag_boundary_i = 0;
2552 if (descriptor_i[1]->chamberType() == descriptor_i[3]->chamberType()) {
2553 // in case lower edge is not chamber boundary
2554 if (gasGap_i[1] ==
2555 gasGap_i[3]) { // in case that edge channel is on L3; use [1]
2556 flag_boundary_i = 1;
2557 } else { // in case that edge channel is not on L3; use [3]
2558 flag_boundary_i = 3;
2559 }
2560 } else if (descriptor_i[0]->chamberType() ==
2561 descriptor_i[2]->chamberType()) {
2562 // in case higher edge is not chamber boundary
2563 if (gasGap_i[0] ==
2564 gasGap_i[2]) { // in case that edge channel is on L3; use [0]
2565 flag_boundary_i = 0;
2566 } else { // in case that edge channel is not on L3; use [2]
2567 flag_boundary_i = 2;
2568 }
2569 } else {
2571 "TgcRdoToPrepDataToolMT::getPosAndIdWireIn::ROI has 3 readout "
2572 "elements!!");
2573 return false;
2574 }
2575
2576 channelIdIn_tmp = channelIdIn[flag_boundary_i];
2577 SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{
2579 const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
2580 const MuonGM::TgcReadoutElement* descriptor_iw =
2581 muDetMgr->getTgcReadoutElement(channelIdIn_tmp);
2582 if (!isOfflineIdOKForTgcReadoutElement(descriptor_iw, channelIdIn_tmp)) {
2583 return false;
2584 }
2585
2586 std::array<double, 3> tmp_r_i{}, tmp_phi_i{}, tmp_eta_i{};
2587
2588 std::array<Amg::Vector3D, 3> position_i{
2589 descriptor_i[0]->channelPos(channelIdIn[0]),
2590 descriptor_i[1]->channelPos(channelIdIn[1]),
2591 descriptor_iw->channelPos(channelIdIn_tmp)};
2592
2593 for (int i = 0; i < 3; i++) {
2594 tmp_r_i[i] = position_i[i].perp();
2595 tmp_phi_i[i] = position_i[i].phi();
2596 tmp_eta_i[i] = position_i[i].eta();
2597
2598 if (i < 2) {
2599 // add half widths of edge channels
2600 double half_width =
2601 descriptor_i[i]->gangRadialLength(gasGap_i[i], channel_i[i]) /
2602 2.;
2603 if (half_width < s_cutDropPrdsWithZeroWidth / 2. &&
2604 m_dropPrdsWithZeroWidth) { // Invalid PRD's whose widths are
2605 // zero are dropped.
2606 return false;
2607 }
2608 if (i == 0) {
2609 tmp_r_i[0] += half_width;
2610 } else {
2611 tmp_r_i[1] -= half_width;
2612 }
2613
2614 bool flag_geteta_i =
2615 getEtafromRZ(tmp_r_i[i], position_i[i].z(), tmp_eta_i[i]);
2616 bool flag_getr_i =
2617 getRfromEtaZ(tmp_eta_i[i], position_i[2].z(), tmp_r_i[i]);
2618
2619 if (!flag_geteta_i || !flag_getr_i) {
2621 "TgcRdoToPrepDataToolMT::getPosAndIdWireIn::failed to "
2622 "getRIn"
2623 << i << " on L3!!");
2624 return false;
2625 }
2626 }
2627 }
2628
2629 width_i = tmp_r_i[0] - tmp_r_i[1];
2630 if (width_i < 0.) {
2632 "TgcRdoToPrepDataToolMT::getPosAndIdWireIn::minus value width_i = "
2633 << width_i);
2634 return false;
2635 }
2636
2637 int gasGap_tmp = m_idHelperSvc->tgcIdHelper().gasGap(channelIdIn_tmp);
2638 int channel_tmp = m_idHelperSvc->tgcIdHelper().channel(channelIdIn_tmp);
2639 double half_width =
2640 descriptor_iw->gangRadialLength(gasGap_tmp, channel_tmp) / 2.;
2641 if (half_width < s_cutDropPrdsWithZeroWidth / 2. &&
2642 m_dropPrdsWithZeroWidth) { // Invalid PRD's whose widths are zero are
2643 // dropped.
2644 return false;
2645 }
2646 if ((flag_boundary_i % 2) ==
2647 1) { // in case lower edge is not chamber boundary
2648 tmp_r_i[2] -= half_width;
2649 hit_position_i =
2650 descriptor_iw->gangShortWidth(gasGap_tmp, channel_tmp) -
2651 (tmp_r_i[2] - tmp_r_i[1]) + width_i / 2.;
2652 } else { // in case higher edge is not chamber boundary
2653 tmp_r_i[2] += half_width;
2654 hit_position_i = descriptor_iw->gangLongWidth(gasGap_tmp, channel_tmp) +
2655 (tmp_r_i[0] - tmp_r_i[2]) - width_i / 2.;
2656 }
2657
2658 // X-coordinate
2659 tmp_hitPos_i[Trk::locX] = hit_position_i;
2660 Amg::Vector3D position_in = descriptor_i[1]->channelPos(channelIdIn[1]);
2661 // dummy global pos
2662 Amg::Vector2D loc_hitPos_i{Amg::Vector2D::Zero()};
2663 bool onSurface_i =
2664 descriptor_i[1]
2665 ->surface(channelIdIn[1])
2666 .globalToLocal(position_in, position_in, loc_hitPos_i);
2667 if (!onSurface_i) {
2669 "TgcRdoToPrepDataToolMT::getPosAndIdWireIn Amg::Vector2D* "
2670 "loc_hitPos_i is null.");
2671 return false;
2672 }
2673 // Y-coordinate
2674 tmp_hitPos_i[Trk::locY] = loc_hitPos_i[Trk::loc2];
2675
2676 return true;
2677}
static bool getRfromEtaZ(const double eta, const double z, double &r)
Get r from eta and z.

◆ getPosAndIdWireOut()

bool Muon::TgcRdoToPrepDataToolMT::getPosAndIdWireOut ( const std::array< const MuonGM::TgcReadoutElement *, 2 > & descriptor_o,
const std::array< Identifier, 2 > & channelIdOut,
const std::array< int, 2 > & gasGap_o,
const std::array< int, 2 > & channel_o,
double & width_o,
double & hit_position_o,
Amg::Vector2D & tmp_hitPos_o,
Identifier & channelIdOut_tmp ) const
private

Get position and offline ID of TGC3 wire for HiPt.

Definition at line 2399 of file TgcRdoToPrepDataToolMT.cxx.

2404 {
2405 // This method is used by decodeHiPt
2406 std::array<Amg::Vector3D, 2> position_o{
2407 make_array<Amg::Vector3D, 2>(Amg::Vector3D::Zero())};
2408 std::array<double, 2> tmp_phi_o{}, tmp_eta_o{}, tmp_r_o{};
2409
2410 for (int i = 0; i < 2; i++) {
2411 position_o[i] = descriptor_o[i]->channelPos(channelIdOut[i]);
2412 tmp_r_o[i] = position_o[i].perp();
2413 tmp_phi_o[i] = position_o[i].phi();
2414 tmp_eta_o[i] = position_o[i].phi();
2415 // add half widths of edge channels
2416 double half_width =
2417 descriptor_o[i]->gangRadialLength(gasGap_o[i], channel_o[i]) / 2.;
2418 if (half_width < s_cutDropPrdsWithZeroWidth / 2. &&
2419 m_dropPrdsWithZeroWidth) { // Invalid PRD's whose widths are zero
2420 // are dropped.
2421 return false;
2422 }
2423 if (i == 0) {
2424 tmp_r_o[0] += half_width;
2425 } else {
2426 tmp_r_o[1] -= half_width;
2427 }
2428 }
2429
2430 bool flag_geteta_o =
2431 getEtafromRZ(tmp_r_o[0], position_o[0].z(), tmp_eta_o[0]);
2432 bool flag_getr_o =
2433 getRfromEtaZ(tmp_eta_o[0], position_o[1].z(), tmp_r_o[0]);
2434 if (!flag_geteta_o || !flag_getr_o) {
2436 "TgcRdoToPrepDataToolMT::getPosAndIdWireOut::failed to getR on "
2437 "L7!!");
2438 return false;
2439 }
2440
2441 width_o = tmp_r_o[0] - tmp_r_o[1];
2442 // X-coordinate
2443 hit_position_o =
2444 descriptor_o[1]->gangShortWidth(gasGap_o[1], channel_o[1]) +
2445 width_o / 2;
2446 tmp_hitPos_o[Trk::locX] = (hit_position_o);
2447 // Y-coordinate
2448 Amg::Vector3D position_out =
2449 Amg::Vector3D(descriptor_o[1]->channelPos(channelIdOut[1]));
2450 // dummy global pos
2451 Amg::Vector2D loc_hitPos_o;
2452 bool onSurface_o =
2453 descriptor_o[1]
2454 ->surface(channelIdOut[1])
2455 .globalToLocal(position_out, position_out, loc_hitPos_o);
2456 if (!onSurface_o) {
2458 "TgcRdoToPrepDataToolMT::getPosAndIdWireOut Amg::Vector2D* "
2459 "loc_hitPos_o is null.");
2460 return false;
2461 }
2462 tmp_hitPos_o[Trk::locY] = loc_hitPos_o[Trk::loc2];
2463
2464 channelIdOut_tmp = channelIdOut[1];
2465
2466 return true;
2467}

◆ getRfromEtaZ()

bool Muon::TgcRdoToPrepDataToolMT::getRfromEtaZ ( const double eta,
const double z,
double & r )
staticprivate

Get r from eta and z.

Definition at line 1614 of file TgcRdoToPrepDataToolMT.cxx.

1615 {
1616 r = exp(-eta); // tan(theta/2)
1617 r = atan(r); // theta/2
1618 r = tan(2. * r); // tan(theta)
1619 r *= std::abs(z); // r=|z|*tan(theta)
1620
1621 return r >= 0.;
1622}

◆ getRoiRow()

int Muon::TgcRdoToPrepDataToolMT::getRoiRow ( const TgcRawData & rd)
staticprivate

Get ROI row from RDO.

Definition at line 1752 of file TgcRdoToPrepDataToolMT.cxx.

1752 {
1753 int RoiRow = static_cast<int>(rd.roi() / 4);
1754 return RoiRow;
1755}

◆ getSbLocOfEndcapStripBoundaryFromHiPt()

bool Muon::TgcRdoToPrepDataToolMT::getSbLocOfEndcapStripBoundaryFromHiPt ( const State & state,
const TgcRawData & rd,
int & sbLoc,
const TgcRdo * rdoColl,
const int index_w,
const int chip_w,
const int hitId_w,
const int sub_w ) const
private

Get strip sbLoc of Endcap chamber boundary from HiPt Strip.

Definition at line 2951 of file TgcRdoToPrepDataToolMT.cxx.

2953 {
2954
2955 bool exist_hipt_s = false;
2956
2957 // Get trackletIds of three candidates
2958 int trackletIdStripFirst{-1}, trackletIdStripSecond{-1},
2959 trackletIdStripThird{-1};
2961 static_cast<int>(rd.roi()), trackletIdStripFirst, trackletIdStripSecond,
2962 trackletIdStripThird);
2963
2964 // Loop over all HiPt Strip to find an associated one
2965 for (const TgcRawData* rdH0 : *rdoColl) {
2966
2967 // conversion for Run3
2968 uint16_t tmprodId, tmpsector;
2969 convertToRun2(rdH0, tmprodId, tmpsector);
2970 const TgcRawData rdH(rdH0->bcTag(), rdH0->subDetectorId(), tmprodId,
2971 rdH0->l1Id(), rdH0->bcId(), rdH0->isStrip(),
2972 rdH0->isForward(), tmpsector, rdH0->chip(),
2973 rdH0->index(), rdH0->isHipt(), rdH0->hitId(),
2974 rdH0->hsub(), rdH0->delta(), rdH0->inner());
2975
2976 if ((rdH.type() == TgcRawData::TYPE_HIPT) && // HiPt
2977 (rdH.isHipt()) && // HiPt flag is required
2978 (rdH.isStrip()) && // Strip
2979 (!rdH.isForward()) && // Endcap
2980 (rdH.bcTag() == rd.bcTag()) && // The same timing
2981 (rdH.subDetectorId() == rd.subDetectorId()) && // The same side
2982 (rdH.rodId() == rd.rodId()) && // The same ROD
2983 (rdH.sector() == rd.sector()) // The same sector (1/48 phi)
2984 ) {
2985
2986 // Get sbLoc
2987 int sswId_o{0}, sbLoc_o{0}, slbId_o{0};
2988 bool found = getHiPtIds(state, rdH, sswId_o, sbLoc_o, slbId_o);
2989 if (!found) {
2990 continue;
2991 }
2992
2993 // Get subMatrix
2994 int slbsubMatrix = 0;
2995 std::array<int, 2> bitpos_o{};
2996 getBitPosOutStrip(rdH, slbsubMatrix, bitpos_o);
2997
2998 // Get trackletId
2999 int trackletIdStrip = 2 * sbLoc_o + slbsubMatrix;
3000
3001 // Compare trackletIds
3002 if (trackletIdStrip != trackletIdStripFirst &&
3003 trackletIdStrip != trackletIdStripSecond &&
3004 trackletIdStrip != trackletIdStripThird) {
3005 continue;
3006 }
3007
3008 // The third candidate is used only if any corresponding HiPt Strip
3009 // is found so far.
3010 if (exist_hipt_s && trackletIdStrip == trackletIdStripThird) {
3011 continue;
3012 }
3013
3014 // getRDOHighPtIDfromSimHighPtID overwrites index, chip and hitId.
3015 int index_w_tmp = index_w;
3016 int chip_w_tmp = chip_w;
3017 int hitId_w_tmp = hitId_w;
3018 // Get RDO HighPt ID from SimHighPtID for wire
3019 found = state.cabling->getRDOHighPtIDfromSimHighPtID(
3020 false, // false for endcap
3021 false, // wire
3022 index_w_tmp, chip_w_tmp, hitId_w_tmp);
3023 if (!found) {
3025 "Failed to get RDOHighPtID from SimHighPtID for Wire");
3026 continue;
3027 }
3028
3029 // RDO High Pt ID of Strip
3030 int chip_s = static_cast<int>(rdH.chip());
3031 int hitId_s = static_cast<int>(rdH.hitId());
3032 int hsub_s = static_cast<int>(rdH.hsub());
3033
3034 int roi = 0;
3035 found = state.cabling->getROINumberfromHighPtID(
3036 roi,
3037 false, // false for Endcap
3038 index_w_tmp, // hpb_wire (not used)
3039 chip_w_tmp, // chip_wire
3040 hitId_w_tmp, // hitId_wire
3041 sub_w, // sub_wire
3042 chip_s, // chip_strip (not used)
3043 hitId_s, // hitId_strip
3044 hsub_s); // sub_strip
3045 if (!found) {
3047 "Failed to get ROINumber from HighPtID for Strip");
3048 continue;
3049 }
3050
3051 if (roi == rd.roi()) {
3052 sbLoc = sbLoc_o;
3053 exist_hipt_s = true;
3054 if (trackletIdStrip == trackletIdStripFirst) {
3055 break; // If the first candidate is found, exit from this
3056 // for loop
3057 }
3058 }
3059 }
3060 }
3061
3062 return exist_hipt_s;
3063}
static void getEndcapStripCandidateTrackletIds(const int roi, int &trackletIdStripFirst, int &trackletIdStripSecond, int &trackletIdStripThird)
Get trackletIds of three Tracklet Strip candidates in the Endcap boudary.

◆ getSbLocOfEndcapStripBoundaryFromTracklet()

bool Muon::TgcRdoToPrepDataToolMT::getSbLocOfEndcapStripBoundaryFromTracklet ( const State & state,
const TgcRawData & rd,
int & sbLoc,
const TgcRdo * rdoColl,
const int index_w,
const int chip_w,
const int hitId_w,
const int sub_w ) const
private

Get strip sbLoc of Endcap chamber boundary from Tracklet Strip.

Definition at line 3065 of file TgcRdoToPrepDataToolMT.cxx.

3067 {
3068
3069 bool exist_tracklet_s = false;
3070
3071 // Get trackletIds of three candidates
3072 int trackletIdStripFirst{-1}, trackletIdStripSecond{-1},
3073 trackletIdStripThird{-1};
3075 static_cast<int>(rd.roi()), trackletIdStripFirst, trackletIdStripSecond,
3076 trackletIdStripThird);
3077
3078 // Loop over all Tracklet Strip to find an associated one
3079 for (const TgcRawData* rdS0 : *rdoColl) {
3080
3081 // conversion for Run3
3082 uint16_t tmprodId{0}, tmpsector{0};
3083 convertToRun2(rdS0, tmprodId, tmpsector);
3084 const TgcRawData rdS(rdS0->bcTag(), rdS0->subDetectorId(), tmprodId,
3085 rdS0->sswId(), rdS0->slbId(), rdS0->l1Id(),
3086 rdS0->bcId(), rdS0->slbType(), rdS0->delta(),
3087 rdS0->segment(), rdS0->subMatrix(),
3088 rdS0->position());
3089
3090 bool isForward_s = (rdS.sswId() == 7); // Doublet, Forward
3091 if (isForward_s) {
3092 continue; // Chamber boundaries exist in endcap only
3093 }
3094
3095 if ((rdS.type() == TgcRawData::TYPE_TRACKLET) &&
3096 (rdS.slbType() == TgcRawData::SLB_TYPE_DOUBLET_STRIP) &&
3097 (rdS.bcTag() == rd.bcTag()) &&
3098 (rdS.subDetectorId() == rd.subDetectorId()) &&
3099 (rdS.rodId() == rd.rodId()) &&
3100 (rdS.sswId() - 3 ==
3101 rd.sector()) // SSW3: M3-EC phi0, SSW4: M3-EC phi1, SSW5: M3-EC
3102 // phi2, SSW6: M3-EC phi3
3103 ) {
3104
3105 // Compare trackletIds
3106 int trackletIdStrip = static_cast<int>(
3107 2 * rdS.slbId() +
3108 rdS.subMatrix()); // trackletId of Tracklet Strip
3109 if (trackletIdStrip != trackletIdStripFirst &&
3110 trackletIdStrip != trackletIdStripSecond &&
3111 trackletIdStrip != trackletIdStripThird) {
3112 continue;
3113 }
3114
3115 // The third candidate is used only if any corresponding Tracklet
3116 // Strip is found so far.
3117 if (exist_tracklet_s && trackletIdStrip == trackletIdStripThird) {
3118 continue;
3119 }
3120
3121 Identifier offlineId;
3122 bool found =
3123 state.cabling->getOfflineIDfromLowPtCoincidenceID(
3124 offlineId, rdS.subDetectorId(), rdS.rodId(), rdS.sswId(),
3125 rdS.slbId(), rdS.subMatrix(), rdS.position(), false);
3126 if (!found) {
3128 "Failed to get OfflineID from LowPtCoincidenceID for "
3129 "Strip");
3130 continue;
3131 }
3132
3133 std::array<int, 7> i{};
3134 std::array<bool, 2> b{};
3135 found = state.cabling->getHighPtIDfromOfflineID(
3136 offlineId, i[0], i[1], i[2], b[0], b[1], i[3], i[4], i[5],
3137 i[6]);
3138 // i[0] subDetectorID, i[1] rodID, i[2] sectorInReadout, b[0]
3139 // isStrip, b[1] isForward, i[3] hpb, i[4] chip, i[5] hitID, i[6]
3140 // pos
3141
3142 if (!found) {
3144 "Failed to get HighPtID from OfflineID for Strip");
3145 continue;
3146 }
3147
3148 // getRDOHighPtIDfromSimHighPtID overwrites index, chip and hitId.
3149 int index_w_tmp = index_w;
3150 int chip_w_tmp = chip_w;
3151 int hitId_w_tmp = hitId_w;
3152 found = state.cabling->getRDOHighPtIDfromSimHighPtID(
3153 rd.isForward(), // false for endcap
3154 false, // wire
3155 index_w_tmp, // hpb-index
3156 chip_w_tmp, // chip-chip
3157 hitId_w_tmp); // hitID-hitId
3158 if (!found) {
3160 "Failed to get RDOHighPtID from SimHighPtID for Wire");
3161 continue;
3162 }
3163
3164 found = state.cabling->getRDOHighPtIDfromSimHighPtID(
3165 rd.isForward(), // false for endcap
3166 true, // strip
3167 i[3], // hpb-index
3168 i[4], // chip-chip
3169 i[5]); // hitID-hitId
3170 if (!found) {
3172 "Failed to get RDOHighPtID from SimHighPtID for Strip");
3173 continue;
3174 }
3175
3176 int roi = 0;
3177 found = state.cabling->getROINumberfromHighPtID(
3178 roi,
3179 rd.isForward(), // false for endcap
3180 index_w_tmp, // hpb_wire (not used)
3181 chip_w_tmp, // chip_wire
3182 hitId_w_tmp, // hitId_wire
3183 sub_w, // sub_wire
3184 i[4], // chip_strip (not used)
3185 i[5], // hitId_strip
3186 i[6]); // sub_strip
3187 if (!found) {
3189 "Failed to get ROINumber from HighPtID for Strip");
3190 continue;
3191 }
3192
3193 if (roi == rd.roi()) {
3194 sbLoc = rdS.slbId();
3195 exist_tracklet_s = true;
3196 if (trackletIdStrip == trackletIdStripFirst) {
3197 break; // If the first candidate is found, exit from this
3198 // for loop
3199 }
3200 }
3201 }
3202 }
3203
3204 return exist_tracklet_s;
3205}

◆ getSLIds()

bool Muon::TgcRdoToPrepDataToolMT::getSLIds ( const State & state,
const bool isStrip,
const TgcRawData & rd,
std::array< Identifier, 3 > & channelId,
int & index,
int & chip,
int & hitId,
int & sub,
int & sswId,
int & sbLoc,
int & subMatrix,
std::array< int, 3 > & bitpos,
const bool isBoundary = false,
const TgcRdo * rdoColl = 0,
const int index_w = -1,
const int chip_w = -1,
const int hitId_w = -1,
const int sub_w = -1 ) const
private

Get ReadoutID of SL from RDO.

Definition at line 2851 of file TgcRdoToPrepDataToolMT.cxx.

2859{
2860 bool found = state.cabling->getHighPtIDfromROINumber(
2861 rd.roi(), rd.isForward(),
2862 isStrip, // get HitID of HPT Board
2863 index, chip, hitId, sub);
2864 if (!found) {
2865 ATH_MSG_DEBUG("Failed to get HighPtID from ROINumber for "
2866 << (!isStrip ? "Wire" : "Strip"));
2867 return false;
2868 }
2869
2870 found = state.cabling->getSimHighPtIDfromRDOHighPtID(
2871 rd.isForward(), isStrip, index, chip, hitId);
2872 if (!found) {
2873 ATH_MSG_DEBUG("Failed to get SimHighPtID from RDOHighPtID for "
2874 << (!isStrip ? "Wire" : "Strip"));
2875 return false;
2876 }
2877
2878 Identifier offlineId;
2879 found = state.cabling->getOfflineIDfromHighPtID(
2880 offlineId, rd.subDetectorId(), rd.rodId(), rd.sector(), isStrip,
2881 rd.isForward(), index, chip, hitId, sub);
2882 if (!found) {
2883 ATH_MSG_DEBUG("Failed to get OfflineID from HighPtID for "
2884 << (!isStrip ? "Wire" : "Strip"));
2885 return false;
2886 }
2887
2888 if (!isStrip || !isBoundary) { // Wire or strip whose ROI not including
2889 // chamber boundary
2890 channelId[1] = offlineId;
2891 std::array<int, 3> dummy_i{};
2892 found = state.cabling->getReadoutIDfromOfflineID(
2893 channelId[1], dummy_i[0], dummy_i[1], sswId, sbLoc, dummy_i[2]);
2894 if (!found) {
2895 ATH_MSG_DEBUG("Failed to get ReadoutID from OfflineID for "
2896 << (!isStrip ? "Wire" : "Strip"));
2897 return false;
2898 }
2899 } else { // --> solving the chamber boundary of strip
2900 sswId = rd.sector() + 3; // SSW3: M3-EC phi0, SSW4: M3-EC phi1, SSW5:
2901 // M3-EC phi2, SSW6: M3-EC phi3
2902
2903 // Loop over all HiPt Strip to find an associated one to obtain sbLoc
2904 bool exist_hipt_s = getSbLocOfEndcapStripBoundaryFromHiPt(state,
2905 rd, sbLoc, rdoColl, index_w, chip_w, hitId_w, sub_w);
2906 if (!exist_hipt_s) {
2907 // Loop over all Tracklet Strip to find an associated one to obtain
2908 // sbLoc
2909 bool exist_tracklet_s = getSbLocOfEndcapStripBoundaryFromTracklet(state,
2910 rd, sbLoc, rdoColl, index_w, chip_w, hitId_w, sub_w);
2911 if (!exist_tracklet_s) {
2913 "Failed to find correspond Tracklet_strip for SL!!");
2914 return false;
2915 }
2916 }
2917 }
2918
2919 if (!isStrip) { // wire
2920 getBitPosWire(rd, hitId, sub, subMatrix, bitpos);
2921 } else { // strip
2922 getBitPosStrip(hitId, sub, subMatrix, bitpos);
2923 }
2924
2925 for (int i = 0; i < 3; i++) {
2926 if (i == 1 && (!isStrip || !isBoundary)) {
2927 continue;
2928 }
2929
2930 found = state.cabling->getOfflineIDfromReadoutID(
2931 channelId[i], rd.subDetectorId(), rd.rodId(), sswId, sbLoc,
2932 bitpos[i]);
2933 if (!found) {
2934 ATH_MSG_DEBUG("Failed to get OfflineID from ReadoutID for "
2935 << (!isStrip ? "Wire" : "Strip"));
2936 if (!isStrip || i == 1) {
2937 ATH_MSG_DEBUG("subDetectorId = "
2938 << rd.subDetectorId()
2939 << ", rodId = " << rd.rodId()
2940 << ", sswId = " << sswId << ", slbId = " << sbLoc
2941 << ", bitpos_" << (!isStrip ? "w" : "s") << "["
2942 << i << "] = " << bitpos[i]);
2943 }
2944 return false;
2945 }
2946 }
2947
2948 return true;
2949}
void getBitPosWire(const TgcRawData &rd, const int hitId_w, const int sub_w, int &subMatrix_w, std::array< int, 3 > &bitpos_w) const
Get bitPos etc of wire for SL.
bool getSbLocOfEndcapStripBoundaryFromHiPt(const State &state, const TgcRawData &rd, int &sbLoc, const TgcRdo *rdoColl, const int index_w, const int chip_w, const int hitId_w, const int sub_w) const
Get strip sbLoc of Endcap chamber boundary from HiPt Strip.
static void getBitPosStrip(const int hitId_s, const int sub_s, int &subMatrix_s, std::array< int, 3 > &bitpos_s)
Get bitPos etc of strip for SL.
bool getSbLocOfEndcapStripBoundaryFromTracklet(const State &state, const TgcRawData &rd, int &sbLoc, const TgcRdo *rdoColl, const int index_w, const int chip_w, const int hitId_w, const int sub_w) const
Get strip sbLoc of Endcap chamber boundary from Tracklet Strip.

◆ getSLLocalPosition()

Amg::Vector2D Muon::TgcRdoToPrepDataToolMT::getSLLocalPosition ( const MuonGM::TgcReadoutElement * readout,
const Identifier identify,
const double eta,
const double phi )
staticprivate

Get SL local position.

Definition at line 3276 of file TgcRdoToPrepDataToolMT.cxx.

3278 {
3279 if (!readout) {
3280 return Amg::Vector2D::Zero();
3281 }
3282
3283 // Obtain the local coordinate by the secant method
3284 constexpr double length = 100.; // 100 mm
3285 constexpr unsigned int nRep = 10; // 10 repetitions
3286 constexpr double dRAccuracy = 1.0E-20; // recuqired dR accuracy
3287 constexpr double maxLocR = 10000.; // 10 m
3288
3289 double locX = 0.;
3290 double locY = 0.;
3291 for (unsigned int iRep = 0; iRep < nRep; iRep++) {
3292 Amg::Vector2D loc_hitPos_c(locX, locY); // center or current position
3293 Amg::Vector3D tmp_glob_hitPos_c{Amg::Vector3D::Zero()};
3294 readout->surface(identify).localToGlobal(
3295 loc_hitPos_c, tmp_glob_hitPos_c, tmp_glob_hitPos_c);
3296 const Amg::Vector3D& glob_hitPos_c = tmp_glob_hitPos_c;
3297
3298 double glob_eta_c = glob_hitPos_c.eta();
3299 double glob_phi_c = glob_hitPos_c.phi();
3300
3301 Amg::Vector2D vector{eta - glob_eta_c, deltaPhi(phi, glob_phi_c)};
3302
3303 double dR = std::hypot(vector[0], vector[1]);
3304 if (dR < dRAccuracy) {
3305 break;
3306 }
3307
3308 Amg::Vector2D loc_hitPos_w(
3309 locX + length,
3310 locY); // slightly shifted position in the wire direction
3311 Amg::Vector2D loc_hitPos_s(
3312 locX,
3313 locY + length); // slightly shifted position in the strip direction
3314 Amg::Vector3D tmp_glob_hitPos_w{Amg::Vector3D::Zero()};
3315 readout->surface(identify).localToGlobal(
3316 loc_hitPos_w, tmp_glob_hitPos_w, tmp_glob_hitPos_w);
3317 const Amg::Vector3D& glob_hitPos_w = tmp_glob_hitPos_w;
3318 Amg::Vector3D tmp_glob_hitPos_s{Amg::Vector3D::Zero()};
3319 readout->surface(identify).localToGlobal(
3320 loc_hitPos_s, tmp_glob_hitPos_s, tmp_glob_hitPos_s);
3321 const Amg::Vector3D& glob_hitPos_s = tmp_glob_hitPos_s;
3322
3323 AmgSymMatrix(2) matrix{AmgSymMatrix(2)::Identity()};
3324 matrix(0, 0) = glob_hitPos_w.eta() - glob_eta_c;
3325 matrix(1, 0) = deltaPhi(glob_hitPos_w.phi(), glob_phi_c);
3326 matrix(0, 1) = glob_hitPos_s.eta() - glob_eta_c;
3327 matrix(1, 1) = deltaPhi(glob_hitPos_s.phi(), glob_phi_c);
3328
3329 bool invertible = matrix.determinant();
3330 if (invertible) {
3331 Amg::MatrixX invertedMatrix = matrix.inverse();
3332 Amg::Vector2D solution = invertedMatrix * vector;
3333 locX += length * solution(0, 0);
3334 locY += length * solution(1, 0);
3335
3336 double locR = sqrt(locX * locX + locY * locY);
3337 if (locR > maxLocR) {
3338 locX *= maxLocR / locR;
3339 locY *= maxLocR / locR;
3340 }
3341 }
3342 }
3343
3344 return Amg::Vector2D(locX, locY);
3345}
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
#define AmgSymMatrix(dim)
double length(const pvec &v)
virtual void localToGlobal(const Amg::Vector2D &locp, const Amg::Vector3D &mom, Amg::Vector3D &glob) const override final
Specified for PlaneSurface: LocalToGlobal method without dynamic memory allocation.
@ locR
Definition ParamDefs.h:44

◆ getSLStripGeometry()

bool Muon::TgcRdoToPrepDataToolMT::getSLStripGeometry ( const std::array< Identifier, 3 > & channelId_strip,
const bool isBackWard,
const bool isAside,
double & width_strip,
double & theta_strip ) const
private

Get strip geometry (width, theta) for SL.

Definition at line 2301 of file TgcRdoToPrepDataToolMT.cxx.

2303 {
2304 SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{
2306 const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
2307 std::array<const MuonGM::TgcReadoutElement*, 3> descriptor_s{
2308 muDetMgr->getTgcReadoutElement(channelId_strip[0]),
2309 muDetMgr->getTgcReadoutElement(channelId_strip[1]),
2310 muDetMgr->getTgcReadoutElement(channelId_strip[2])};
2311 for (int i = 0; i < 3; i++) {
2312 if (!isOfflineIdOKForTgcReadoutElement(descriptor_s[i],
2313 channelId_strip[i])) {
2314 return false;
2315 }
2316 }
2317
2318 Amg::Vector3D position_s =
2319 Amg::Vector3D(descriptor_s[1]->channelPos(channelId_strip[1]));
2320 Amg::Vector2D loc_hitPos_s;
2321 bool onSurface_s = descriptor_s[1]
2322 ->surface(channelId_strip[1])
2323 .globalToLocal(position_s, position_s, loc_hitPos_s);
2324 if (!onSurface_s) {
2326 "TgcRdoToPrepDataToolMT::getSLStripGeometry Amg::Vector2D* "
2327 "loc_hitPos_s is null.");
2328 return false;
2329 }
2330 Amg::Vector2D tmp_hitPos_s{Amg::Vector2D::Zero()};
2331
2332 std::array<int, 3> gasGap_s, channel_s{};
2333 for (int i = 0; i < 3; i++) {
2334 gasGap_s[i] = m_idHelperSvc->tgcIdHelper().gasGap(channelId_strip[i]);
2335 channel_s[i] = m_idHelperSvc->tgcIdHelper().channel(channelId_strip[i]);
2336 }
2337
2338 std::array<Amg::Vector3D, 3> localPos{Amg::Vector3D::Zero()};
2339 for (int i = 0; i < 3; i += 2) { // i=0 and 2
2340 localPos[i] = descriptor_s[i]->transform(channelId_strip[i]).inverse() *
2341 descriptor_s[i]->channelPos(channelId_strip[i]);
2342 }
2343
2344 bool flag_reverse = false;
2345 std::array<int, 2> index_strip{};
2346
2347 if (!isBackward) { // Forward chamber
2348 if (isAside) { // Aside/Forward Chamber
2349 index_strip[0] = 2;
2350 index_strip[1] = 0;
2351 flag_reverse = true;
2352 } else { // Cside/Forward Chamber
2353 index_strip[0] = 0;
2354 index_strip[1] = 2;
2355 flag_reverse = false;
2356 }
2357 } else { // Backward chamber
2358 if (isAside) { // Aside/Backward Chamber
2359 index_strip[0] = 0;
2360 index_strip[1] = 2;
2361 flag_reverse = true;
2362 } else { // Cside/Backward Chamber
2363 index_strip[0] = 2;
2364 index_strip[1] = 0;
2365 flag_reverse = false;
2366 }
2367 }
2368
2369 double stripMaxX = descriptor_s[index_strip[0]]->stripHighEdgeLocX(
2370 gasGap_s[index_strip[0]], channel_s[index_strip[0]],
2371 localPos[index_strip[0]].z());
2372 double stripMinX = descriptor_s[index_strip[1]]->stripLowEdgeLocX(
2373 gasGap_s[index_strip[1]], channel_s[index_strip[1]],
2374 localPos[index_strip[1]].z());
2375 width_strip = stripMaxX - stripMinX;
2376 double strip = stripMinX + width_strip / 2.;
2377 if (flag_reverse) {
2378 strip *= -1.;
2379 }
2380
2381 tmp_hitPos_s[Trk::locX] = strip;
2382 tmp_hitPos_s[Trk::locY] = loc_hitPos_s[Trk::loc2];
2383
2384 int index_strip_gp = 0;
2385 if (!isBackward) {
2386 index_strip_gp = 0;
2387 } else {
2388 index_strip_gp = 2;
2389 }
2390 Amg::Vector3D tmp_strip_gp;
2391 descriptor_s[index_strip_gp]
2392 ->surface(channelId_strip[index_strip_gp])
2393 .localToGlobal(tmp_hitPos_s, tmp_strip_gp, tmp_strip_gp);
2394 theta_strip = atan2(tmp_strip_gp.y(), tmp_strip_gp.x());
2395
2396 return true;
2397}

◆ getSLWireGeometry()

bool Muon::TgcRdoToPrepDataToolMT::getSLWireGeometry ( const std::array< Identifier, 3 > & channelId_wire,
double & width_wire,
double & r_wire,
double & z_wire ) const
private

Get wire geometry (width, r, z) for SL.

Definition at line 2214 of file TgcRdoToPrepDataToolMT.cxx.

2216 {
2217 SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{
2219 const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
2220 std::array<const MuonGM::TgcReadoutElement*, 3> descriptor_w{
2221 muDetMgr->getTgcReadoutElement(channelId_wire[0]),
2222 muDetMgr->getTgcReadoutElement(channelId_wire[1]),
2223 muDetMgr->getTgcReadoutElement(channelId_wire[2])};
2224 for (int i = 0; i < 3; i++) {
2225 if (!isOfflineIdOKForTgcReadoutElement(descriptor_w[i],
2226 channelId_wire[i])) {
2227 return false;
2228 }
2229 }
2230
2231 Amg::Vector3D position_w = descriptor_w[2]->channelPos(channelId_wire[2]);
2232 Amg::Vector2D loc_hitPos_w{Amg::Vector2D::Zero()};
2233 bool onSurface_w = descriptor_w[2]
2234 ->surface(channelId_wire[2])
2235 .globalToLocal(position_w, position_w, loc_hitPos_w);
2236 if (!onSurface_w) {
2238 "TgcRdoToPrepDataToolMT::getSLWireGeometry Amg::Vector2D* "
2239 "loc_hitPos_w is null.");
2240 return false;
2241 }
2242 Amg::Vector2D tmp_hitPos_w{Amg::Vector2D::Zero()};
2243
2244 std::array<int, 3> gasGap_w{}, channel_w{};
2245 for (int i = 0; i < 3; i++) {
2246 gasGap_w[i] = m_idHelperSvc->tgcIdHelper().gasGap(channelId_wire[i]);
2247 channel_w[i] = m_idHelperSvc->tgcIdHelper().channel(channelId_wire[i]);
2248 }
2249
2250 std::array<double, 3> tmp_r_w{}, tmp_phi_w{}, tmp_eta_w{};
2251
2252 std::array<Amg::Vector3D, 3> tmp_position_w{
2253 make_array<Amg::Vector3D, 3>(Amg::Vector3D::Zero())};
2254 for (int i = 0; i < 3; i += 2) { // i=0 and 2
2255 tmp_position_w[i] = descriptor_w[i]->channelPos(channelId_wire[i]);
2256 tmp_r_w[i] = tmp_position_w[i].perp();
2257 tmp_phi_w[i] = tmp_position_w[i].phi();
2258 tmp_eta_w[i] = tmp_position_w[i].eta();
2259
2260 double half_width =
2261 descriptor_w[i]->gangRadialLength(gasGap_w[i], channel_w[i]) / 2.;
2262 if (half_width < s_cutDropPrdsWithZeroWidth / 2. &&
2263 m_dropPrdsWithZeroWidth) { // Invalid PRD's whose widths are zero
2264 // are dropped.
2265 return false;
2266 }
2267 // add half widths of edge channels
2268 if (i == 0) {
2269 tmp_r_w[0] += half_width;
2270 } else if (i == 2) {
2271 tmp_r_w[2] -= half_width;
2272 }
2273 }
2274
2275 bool flag_geteta_w =
2276 getEtafromRZ(tmp_r_w[0], tmp_position_w[0].z(), tmp_eta_w[0]);
2277 bool flag_getr_w =
2278 getRfromEtaZ(tmp_eta_w[0], tmp_position_w[2].z(), tmp_r_w[0]);
2279 if (!flag_geteta_w || !flag_getr_w) {
2281 "TgcRdoToPrepDataToolMT::getSLWireGeometry::failed to getR on "
2282 "L7!!");
2283 return false;
2284 }
2285 width_wire = tmp_r_w[0] - tmp_r_w[2];
2286 double gang = descriptor_w[2]->gangShortWidth(gasGap_w[2], channel_w[2]) +
2287 width_wire / 2.;
2288 tmp_hitPos_w[Trk::locX] = gang;
2289 tmp_hitPos_w[Trk::locY] = ((loc_hitPos_w)[Trk::loc2]);
2290
2291 Amg::Vector3D tmp_wire_gp;
2292 descriptor_w[2]
2293 ->surface(channelId_wire[2])
2294 .localToGlobal(tmp_hitPos_w, tmp_wire_gp, tmp_wire_gp);
2295 z_wire = tmp_wire_gp.z();
2296 r_wire = tmp_r_w[2] + width_wire / 2.;
2297
2298 return true;
2299}

◆ getTrackletInfo()

bool Muon::TgcRdoToPrepDataToolMT::getTrackletInfo ( const TgcRawData & rd,
int & tmp_slbId,
int & tmp_subMatrix,
int & tmp_position ) const
private

Retrieve slbId, subMatrix and position from Tracklet RDO.

Definition at line 1651 of file TgcRdoToPrepDataToolMT.cxx.

1654 {
1655 tmp_subMatrix = rd.subMatrix();
1656 if (tmp_subMatrix != 0 && tmp_subMatrix != 1) {
1657 ATH_MSG_DEBUG("getTrackletInfo: subMatrix " << tmp_subMatrix
1658 << " is invalid.");
1659 return false;
1660 }
1661
1662 int tmp_sswId = rd.sswId();
1663 tmp_slbId = rd.slbId();
1664 tmp_position = rd.position();
1665
1666 int tmp_position_delta = tmp_position + rd.delta();
1667 int tmp_slbType = rd.slbType();
1668
1669 if (tmp_position_delta >= BIT_POS_INPUT_SIZE) {
1670 tmp_position = tmp_position_delta - BIT_POS_INPUT_SIZE;
1671 if (tmp_subMatrix == 1) {
1672 if (tmp_slbType == TgcRawData::SLB_TYPE_DOUBLET_STRIP) {
1673 tmp_position = BIT_POS_INPUT_SIZE - 1;
1675 "Expected TGC2 Strip position ("
1676 << tmp_position_delta
1677 << ") does not exist and is changed to the edge position "
1678 << tmp_position);
1679 } else if ((tmp_slbType == TgcRawData::SLB_TYPE_DOUBLET_WIRE) &&
1680 (tmp_sswId == 7) &&
1681 ((tmp_slbId == 3) || (tmp_slbId == 11))) {
1682 // upper edge SLB of FWD:sbLoc3,11
1683 ATH_MSG_DEBUG("sbLoc " << tmp_slbId + 1
1684 << " doesn't exist for FWD!! (upper "
1685 "edge SLB of FWD:sbLoc3,11)");
1686 return false;
1687 } else if ((tmp_slbType == TgcRawData::SLB_TYPE_DOUBLET_WIRE) &&
1688 (tmp_sswId != 7) && (tmp_slbId == 9)) {
1689 // upper edge SLB of EWD:sbLoc9
1690 ATH_MSG_DEBUG("sbLoc " << tmp_slbId + 1
1691 << " doesn't exist for EWD!! (upper "
1692 "edge SLB of EWD:sbLoc9)");
1693 return false;
1694 } else {
1695 // Valid sbLoc,delta,blockpos
1696 tmp_subMatrix = 0;
1697 tmp_slbId++;
1698 }
1699 } else {
1700 tmp_subMatrix = 1;
1701 }
1702 } else if (tmp_position_delta < 0) {
1703 tmp_position = tmp_position_delta + BIT_POS_INPUT_SIZE;
1704 if (tmp_subMatrix == 0) {
1705 if (tmp_slbType == TgcRawData::SLB_TYPE_DOUBLET_STRIP) {
1706 tmp_position = 0;
1708 "Expected TGC2 Strip position ("
1709 << tmp_position_delta
1710 << ") does not exist and is changed to the edge position "
1711 << tmp_position);
1712 } else if ((tmp_slbType == TgcRawData::SLB_TYPE_DOUBLET_WIRE) &&
1713 (tmp_sswId == 7) &&
1714 ((tmp_slbId == 0) || (tmp_slbId == 8))) {
1715 // bottom edge SLB of FWD:sbLoc0,8
1716 if (tmp_position_delta == -1) { // This case is valid.
1717 tmp_position = 0;
1718 } else {
1719 ATH_MSG_DEBUG("sbLoc "
1720 << tmp_slbId - 1
1721 << " doesn't exist for FWD!! (bottom edge "
1722 "SLB of FWD:sbLoc0,8)");
1723 return false;
1724 }
1725 } else if ((tmp_slbType == TgcRawData::SLB_TYPE_DOUBLET_WIRE) &&
1726 (tmp_sswId != 7) && (tmp_slbId == 0)) {
1727 // bottom edge SLB of EWD:sbLoc0
1728 if (tmp_position_delta == -1) { // This case is valid.
1729 tmp_position = 0;
1730 } else {
1731 ATH_MSG_DEBUG("sbLoc "
1732 << tmp_slbId - 1
1733 << " doesn't exist for EWD!! (bottom edge "
1734 "SLB of EWD:sbLoc0)");
1735 return false;
1736 }
1737 } else {
1738 // Valid sbLoc,delta,
1739 tmp_subMatrix = 1;
1740 tmp_slbId--;
1741 }
1742 } else {
1743 tmp_subMatrix = 0;
1744 }
1745 } else {
1746 tmp_position = tmp_position_delta;
1747 }
1748
1749 return true;
1750}

◆ initialize()

StatusCode Muon::TgcRdoToPrepDataToolMT::initialize ( )
overridevirtual

Standard AthAlgTool initialize method.

Definition at line 39 of file TgcRdoToPrepDataToolMT.cxx.

39 {
40 ATH_CHECK(m_idHelperSvc.retrieve());
41
42
43 ATH_CHECK(m_prdWriteKey.initialize());
44 ATH_CHECK(m_muDetMgrKey.initialize());
45 ATH_CHECK(m_cablingKey.initialize());
46
47 // check if initializing of DataHandle objects success
48 ATH_CHECK(m_rdoContainerKey.initialize());
49
51
52
53
55 for (int ibc = 0; ibc < NBC_TRIG; ibc++) {
56 int bcTag = ibc + 1;
57 std::ostringstream location;
58 location << m_outputCoinCollectionLocation.value()
59 << (bcTag == TgcDigit::BC_PREVIOUS ? "PriorBC" : "")
60 << (bcTag == TgcDigit::BC_NEXT ? "NextBC" : "")
61 << (bcTag == TgcDigit::BC_NEXTNEXT ? "NextNextBC" : "");
62 m_outputCoinKeys.at(ibc) = location.str();
63 }
64 if (not m_coinContainerCacheKeyStr.empty()) {
66 for (int ibc = 0; ibc < NBC_TRIG; ibc++) {
67 int bcTag = ibc + 1;
68 std::ostringstream location;
69 location << m_coinContainerCacheKeyStr.value()
70 << (bcTag == TgcDigit::BC_PREVIOUS ? "PriorBC" : "")
71 << (bcTag == TgcDigit::BC_NEXT ? "NextBC" : "")
72 << (bcTag == TgcDigit::BC_NEXTNEXT ? "NextNextBC" : "");
73 m_coinContainerCacheKeys.at(ibc) = location.str();
74 ATH_MSG_DEBUG(location.str());
75 }
76 }
78 ATH_CHECK(m_outputCoinKeys.initialize());
79 return StatusCode::SUCCESS;
80}
SG::ReadCondHandleKey< Muon::TgcCablingMap > m_cablingKey
Gaudi::Property< std::string > m_outputCoinCollectionLocation
TgcCoinData container key for current BC.
SG::WriteHandleKeyArray< Muon::TgcCoinDataContainer > m_outputCoinKeys
SG::WriteHandleKey< Muon::TgcPrepDataContainer > m_prdWriteKey
TgcCoinUpdateHandles m_coinContainerCacheKeys
Keys for the Coin cache containers, 3 needed for different BC.
Gaudi::Property< std::string > m_coinContainerCacheKeyStr
SG::UpdateHandleKey< TgcPrepDataCollection_Cache > m_prdContainerCacheKey
Keys for the PRD cache containers, 4 needed for different BC.
@ BC_NEXT
Definition TgcDigit.h:37
@ BC_PREVIOUS
Definition TgcDigit.h:37

◆ isAlreadyConverted()

bool Muon::TgcRdoToPrepDataToolMT::isAlreadyConverted ( const std::vector< const TgcRdo * > & decodedRdoCollVec,
const std::vector< const TgcRdo * > & rdoCollVec,
const TgcRdo * rdoColl )
staticprivate

Check the rdo is already converted or not.

◆ isBackwardBW()

bool Muon::TgcRdoToPrepDataToolMT::isBackwardBW ( const TgcRawData & rd)
staticprivate

Check if a chamber in BigWheel is a backward chamber or a forward chamber.

Definition at line 2191 of file TgcRdoToPrepDataToolMT.cxx.

2191 {
2192 bool isBackward = false;
2193
2194 if (!rd.isForward()) { // Endcap
2195 if (((rd.subDetectorId() == ASIDE) && (rd.sector() % 2 == 1)) ||
2196 ((rd.subDetectorId() == CSIDE) && (rd.sector() % 2 == 0))) {
2197 // Aside,phi_odd::Backward
2198 // Cside,phi_even::Backward
2199 isBackward = true;
2200 } else {
2201 // Aside,phi_even::Forward
2202 // Cside,phi_odd::Forward
2203 isBackward = false;
2204 }
2205 } else { // Forward
2206 // Aide::Backward
2207 // Cside::Forward
2208 isBackward = (rd.subDetectorId() == ASIDE);
2209 }
2210
2211 return isBackward;
2212}

◆ isIncludedInChamberBoundary()

bool Muon::TgcRdoToPrepDataToolMT::isIncludedInChamberBoundary ( const TgcRawData & rd) const
private

Check SL RDO is at the chamber boundary.

Definition at line 1757 of file TgcRdoToPrepDataToolMT.cxx.

1758 {
1759 int RoiRow = getRoiRow(rd);
1760
1761 if (!rd.isForward() &&
1762 (RoiRow == 3 || RoiRow == 4 || // SSC 2 : ROI 12-19
1763 RoiRow == 7 || RoiRow == 8 || // SSC 4 : ROI 28-35
1764 RoiRow == 11 || RoiRow == 12 || // SSC 6 : ROI 44-51
1765 RoiRow == 23 || RoiRow == 24 // SSC12 : ROI 92-99
1766 )) {
1767 return true;
1768 }
1769 return false;
1770}

◆ isOfflineIdOKForTgcReadoutElement()

bool Muon::TgcRdoToPrepDataToolMT::isOfflineIdOKForTgcReadoutElement ( const MuonGM::TgcReadoutElement * descriptor,
const Identifier channelId ) const
private

Check offline ID is OK for TgcReadoutElement.

Definition at line 1640 of file TgcRdoToPrepDataToolMT.cxx.

1642 {
1643 if (!descriptor || !descriptor->containsId(channelId)) {
1644 ATH_MSG_DEBUG("Illegal OfflineID for TgcReadoutElement"
1645 << m_idHelperSvc->toString(channelId));
1646 return false;
1647 }
1648 return true;
1649}
virtual bool containsId(const Identifier &id) const override

◆ isRequested()

bool Muon::TgcRdoToPrepDataToolMT::isRequested ( const std::vector< IdentifierHash > & requestedIdHashVect,
IdentifierHash tgcHashId )
staticprivate

Check the IdHash is already requested or not.

◆ provideEmptyContainer()

StatusCode Muon::TgcRdoToPrepDataToolMT::provideEmptyContainer ( const EventContext & ctx) const
overridevirtual

Definition at line 118 of file TgcRdoToPrepDataToolMT.cxx.

119 {
120 State state{};
121 return setupState(ctx, state);
122}

◆ selectDecoder()

void Muon::TgcRdoToPrepDataToolMT::selectDecoder ( State & state,
const TgcRawData & rd,
const TgcRdo * rdoColl ) const
private

Select decoder based on RDO type (Hit or Coincidence (Tracklet, HiPt and SL)).

Definition at line 327 of file TgcRdoToPrepDataToolMT.cxx.

329 {
330
331 if (!rd.isCoincidence()) {
332 if (!decodeHits(state, rd).isSuccess()) {
333 ATH_MSG_WARNING("Cannot decode TGC Hits");
334 }
335 } else if (rd.isCoincidence() && m_fillCoinData) { // coincidence start
336 StatusCode status = StatusCode::SUCCESS;
337 if (rd.type() == TgcRawData::TYPE_TRACKLET) {
340 status = decodeTracklet(state, rd);
341 } else if (rd.slbType() == TgcRawData::SLB_TYPE_INNER_WIRE ||
343 status = decodeTrackletEIFI(state, rd);
344 }
345 } // rd.rodId()<13 for Run2, rd.rodId()>12 for Run3
346 else if (rd.type() == TgcRawData::TYPE_HIPT &&
347 ((rd.isHipt() && rd.rodId() < 13) || rd.rodId() > 12)) {
348 status = decodeHiPt(state, rd);
349 } else if ((rd.rodId() < 13 && rd.type() == TgcRawData::TYPE_HIPT &&
350 (rd.sector() & 4) != 0) || // Run2
351 (rd.rodId() > 12 &&
352 (rd.type() == TgcRawData::TYPE_INNER_NSW || // Run3
353 rd.type() == TgcRawData::TYPE_INNER_BIS || // Run3
354 rd.type() == TgcRawData::TYPE_INNER_EIFI || // Run3
355 rd.type() == TgcRawData::TYPE_INNER_TMDB))) { // Run3
356 status = decodeInner(state, rd);
357 } else if (rd.type() == TgcRawData::TYPE_SL) {
358 status = decodeSL(state, rd, rdoColl);
359 }
360 if (!status.isSuccess()) {
361 ATH_MSG_WARNING("Cannot decode TGC Coincidences");
362 }
363 }
364}
StatusCode decodeSL(State &state, const TgcRawData &rd, const TgcRdo *rdoColl) const
Decode RDO's of SectorLogic.
StatusCode decodeInner(State &state, const TgcRawData &rd) const
Decode RDO's of Inner.
Gaudi::Property< bool > m_fillCoinData
Switch for the coincince decoding.
StatusCode decodeTrackletEIFI(State &state, const TgcRawData &rd) const
Decode RDO's of Tracklet EIFI.
StatusCode decodeHiPt(State &state, const TgcRawData &rd) const
Decode RDO's of HiPt.
StatusCode decodeHits(State &state, const TgcRawData &rd) const
Decode RDO's of Hit.
StatusCode decodeTracklet(State &state, const TgcRawData &rd) const
Decode RDO's of Tracklet.
@ SLB_TYPE_INNER_WIRE
Definition TgcRawData.h:36
bool isCoincidence() const
Definition TgcRawData.h:237
bool isHipt() const
Definition TgcRawData.h:341
::StatusCode StatusCode
StatusCode definition for legacy code.
status
Definition merge.py:16

◆ setupState()

StatusCode Muon::TgcRdoToPrepDataToolMT::setupState ( const EventContext & ctx,
State & state ) const
private

clean up containers for Hits

Definition at line 124 of file TgcRdoToPrepDataToolMT.cxx.

125 {
127 const unsigned hashMax = m_idHelperSvc->tgcIdHelper().module_hash_max();
128
129 SG::WriteHandle prdHandle{m_prdWriteKey, ctx};
130
131 if (m_prdContainerCacheKey.empty()) {
132 ATH_CHECK(prdHandle.record(std::make_unique<TgcPrepDataContainer>(hashMax)));
133 ATH_MSG_DEBUG("TGC PrepData Container recorded in StoreGate with key "
134 << m_prdWriteKey.fullKey());
135 } else {
136 SG::UpdateHandle update{m_prdContainerCacheKey, ctx};
137 ATH_CHECK(update.isValid());
138 ATH_CHECK(prdHandle.record(std::make_unique<TgcPrepDataContainer>(update.ptr())));
139 }
140
141 state.tgcPrepDataContainer = prdHandle.ptr();
142 state.tgcPrepDataCollections.resize(hashMax);
143
144 // clean up containers for Coincidence
145 for (unsigned int ibc = 0; ibc < NBC_TRIG; ibc++) {
146 // prepare write handle for this BC
147 SG::WriteHandle handle{m_outputCoinKeys[ibc], ctx};
148
149 const bool externalCacheCoin =
150 m_coinContainerCacheKeys.size() > ibc &&
151 !m_coinContainerCacheKeys[ibc].key().empty();
152 if (!externalCacheCoin) {
153 // No cache (offline case), just record container into store gate
154 ATH_CHECK(
155 handle.record(std::make_unique<TgcCoinDataContainer>(hashMax)));
156 } else {
157 // Using the cache (trigger case)
158 SG::UpdateHandle update{m_coinContainerCacheKeys[ibc], ctx};
159 ATH_CHECK(update.isValid());
160 ATH_CHECK(handle.record(
161 std::make_unique<TgcCoinDataContainer>(update.ptr())));
162 ATH_MSG_DEBUG("Created container using cache for "
163 << m_coinContainerCacheKeys[ibc].key());
164
165 } // external cache
166
167 // cache the pointer for duration of function, storegate retains
168 // ownership
169 state.tgcCoinDataContainer[ibc] = handle.ptr();
170 state.tgcCoinDataCollections[ibc].resize(hashMax);
171
172 } // loop on BC_TRIG
173
174
175 ATH_CHECK(SG::get(state.muDetMgr, m_muDetMgrKey, ctx));
176 ATH_CHECK(SG::get(state.cabling, m_cablingKey, ctx));
177 return StatusCode::SUCCESS;
178}
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
virtual void handle(const Incident &inc)
Handle end of run incidents to save the metadata at that point.

◆ transferData()

template<class ContType, class CollType>
StatusCode Muon::TgcRdoToPrepDataToolMT::transferData ( ContType & container,
std::vector< std::unique_ptr< CollType > > && coll ) const
private

Definition at line 103 of file TgcRdoToPrepDataToolMT.cxx.

104 {
105 for (std::unique_ptr<CollType>& toMove : coll) {
106 if (!toMove) {
107 continue;
108 }
109 const IdentifierHash hash = toMove->identifyHash();
110 auto lock = container.getWriteHandle(hash);
111 if (!lock.alreadyPresent()) {
112 ATH_CHECK(lock.addOrDelete(std::move(toMove)));
113 }
114 }
115 return StatusCode::SUCCESS;
116}
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
const SG::AuxVectorData * container() const
Return the container holding this element.

Member Data Documentation

◆ m_cablingKey

SG::ReadCondHandleKey<Muon::TgcCablingMap> Muon::TgcRdoToPrepDataToolMT::m_cablingKey
private
Initial value:
{
this, "CablingKey", "MuonTgc_CablingMap"}

Definition at line 387 of file TgcRdoToPrepDataToolMT.h.

387 {
388 this, "CablingKey", "MuonTgc_CablingMap"};

◆ m_coinContainerCacheKeys

TgcCoinUpdateHandles Muon::TgcRdoToPrepDataToolMT::m_coinContainerCacheKeys {this, "UpdateKeysCoin", {}}
private

Keys for the Coin cache containers, 3 needed for different BC.

Definition at line 451 of file TgcRdoToPrepDataToolMT.h.

451{this, "UpdateKeysCoin", {}};

◆ m_coinContainerCacheKeyStr

Gaudi::Property<std::string> Muon::TgcRdoToPrepDataToolMT::m_coinContainerCacheKeyStr
private
Initial value:
{
this, "CoinCacheString", "",
"Prefix for names of Coin cache collections"}

Definition at line 458 of file TgcRdoToPrepDataToolMT.h.

458 {
459 this, "CoinCacheString", "",
460 "Prefix for names of Coin cache collections"};

◆ m_convertAllBCs

Gaudi::Property<bool> Muon::TgcRdoToPrepDataToolMT::m_convertAllBCs {this, "convertAllBCs", true}
private

Convert hits from all bunch crossings.

If false only the current BC is converted

Definition at line 463 of file TgcRdoToPrepDataToolMT.h.

463{this, "convertAllBCs", true};

◆ m_decodeData

Gaudi::Property<bool> Muon::TgcRdoToPrepDataToolMT::m_decodeData {this, "DecodeData", true}
private

Switch for the decoding of TGC RDO into TgcPrepData.

Definition at line 405 of file TgcRdoToPrepDataToolMT.h.

405{this, "DecodeData", true};

◆ m_dropPrdsWithZeroWidth

Gaudi::Property<bool> Muon::TgcRdoToPrepDataToolMT::m_dropPrdsWithZeroWidth
private
Initial value:
{this, "dropPrdsWithZeroWidth",
true}

Flag for dropping PRD's with zero widths.

Definition at line 418 of file TgcRdoToPrepDataToolMT.h.

418 {this, "dropPrdsWithZeroWidth",
419 true};

◆ m_fillCoinData

Gaudi::Property<bool> Muon::TgcRdoToPrepDataToolMT::m_fillCoinData {this, "FillCoinData", true}
private

Switch for the coincince decoding.

Definition at line 407 of file TgcRdoToPrepDataToolMT.h.

407{this, "FillCoinData", true};

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> Muon::TgcRdoToPrepDataToolMT::m_idHelperSvc
private
Initial value:
{
this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}

Definition at line 390 of file TgcRdoToPrepDataToolMT.h.

390 {
391 this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_muDetMgrKey

SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> Muon::TgcRdoToPrepDataToolMT::m_muDetMgrKey
private
Initial value:
{
this, "DetectorManagerKey", "MuonDetectorManager",
"Key of input MuonDetectorManager condition data"}

Definition at line 383 of file TgcRdoToPrepDataToolMT.h.

383 {
384 this, "DetectorManagerKey", "MuonDetectorManager",
385 "Key of input MuonDetectorManager condition data"};

◆ m_nHiPtPRDs

std::atomic<long> Muon::TgcRdoToPrepDataToolMT::m_nHiPtPRDs {0}
mutableprivate

Definition at line 431 of file TgcRdoToPrepDataToolMT.h.

431{0};

◆ m_nHiPtRDOs

std::atomic<long> Muon::TgcRdoToPrepDataToolMT::m_nHiPtRDOs {0}
mutableprivate

Definition at line 430 of file TgcRdoToPrepDataToolMT.h.

430{0};

◆ m_nHitPRDs

std::atomic<long> Muon::TgcRdoToPrepDataToolMT::m_nHitPRDs {0}
mutableprivate

Definition at line 425 of file TgcRdoToPrepDataToolMT.h.

425{0};

◆ m_nHitRDOs

std::atomic<long> Muon::TgcRdoToPrepDataToolMT::m_nHitRDOs {0}
mutableprivate

long to count the numbers of RDOs and PRDs

Definition at line 424 of file TgcRdoToPrepDataToolMT.h.

424{0};

◆ m_nSLPRDs

std::atomic<long> Muon::TgcRdoToPrepDataToolMT::m_nSLPRDs {0}
mutableprivate

Definition at line 433 of file TgcRdoToPrepDataToolMT.h.

433{0};

◆ m_nSLRDOs

std::atomic<long> Muon::TgcRdoToPrepDataToolMT::m_nSLRDOs {0}
mutableprivate

Definition at line 432 of file TgcRdoToPrepDataToolMT.h.

432{0};

◆ m_nTrackletEIFIPRDs

std::atomic<long> Muon::TgcRdoToPrepDataToolMT::m_nTrackletEIFIPRDs {0}
mutableprivate

Definition at line 429 of file TgcRdoToPrepDataToolMT.h.

429{0};

◆ m_nTrackletEIFIRDOs

std::atomic<long> Muon::TgcRdoToPrepDataToolMT::m_nTrackletEIFIRDOs {0}
mutableprivate

Definition at line 428 of file TgcRdoToPrepDataToolMT.h.

428{0};

◆ m_nTrackletPRDs

std::atomic<long> Muon::TgcRdoToPrepDataToolMT::m_nTrackletPRDs {0}
mutableprivate

Definition at line 427 of file TgcRdoToPrepDataToolMT.h.

427{0};

◆ m_nTrackletRDOs

std::atomic<long> Muon::TgcRdoToPrepDataToolMT::m_nTrackletRDOs {0}
mutableprivate

Definition at line 426 of file TgcRdoToPrepDataToolMT.h.

426{0};

◆ m_outputCoinCollectionLocation

Gaudi::Property<std::string> Muon::TgcRdoToPrepDataToolMT::m_outputCoinCollectionLocation
private
Initial value:
{
this, "OutputCoinCollection", "TrigT1CoinDataCollection"}

TgcCoinData container key for current BC.

Definition at line 398 of file TgcRdoToPrepDataToolMT.h.

398 {
399 this, "OutputCoinCollection", "TrigT1CoinDataCollection"};

◆ m_outputCoinKeys

SG::WriteHandleKeyArray<Muon::TgcCoinDataContainer> Muon::TgcRdoToPrepDataToolMT::m_outputCoinKeys
private
Initial value:
{
this, "outputCoinKey", {}}

Definition at line 440 of file TgcRdoToPrepDataToolMT.h.

440 {
441 this, "outputCoinKey", {}};

◆ m_outputCollectionLocation

Gaudi::Property<std::string> Muon::TgcRdoToPrepDataToolMT::m_outputCollectionLocation
private
Initial value:
{
this, "OutputCollection", "TGC_Measurements"}

TgcPrepRawData container key for curfrent BC.

Definition at line 394 of file TgcRdoToPrepDataToolMT.h.

394 {
395 this, "OutputCollection", "TGC_Measurements"};

◆ m_prdContainerCacheKey

SG::UpdateHandleKey<TgcPrepDataCollection_Cache> Muon::TgcRdoToPrepDataToolMT::m_prdContainerCacheKey {this, "UpdateKeyPrd", "", "Optional external cache for the sTGC PRD container"}
private

Keys for the PRD cache containers, 4 needed for different BC.

Definition at line 449 of file TgcRdoToPrepDataToolMT.h.

449{this, "UpdateKeyPrd", "", "Optional external cache for the sTGC PRD container"};

◆ m_prdWriteKey

SG::WriteHandleKey<Muon::TgcPrepDataContainer> Muon::TgcRdoToPrepDataToolMT::m_prdWriteKey
private
Initial value:
{
this, "prepDataKey", "TGC_MeasurementsAllBCs"}

Definition at line 444 of file TgcRdoToPrepDataToolMT.h.

444 {
445 this, "prepDataKey", "TGC_MeasurementsAllBCs"};

◆ m_rdoContainerKey

SG::ReadHandleKey<TgcRdoContainer> Muon::TgcRdoToPrepDataToolMT::m_rdoContainerKey
private
Initial value:
{
this, "RDOContainer", "TGCRDO", "TgcRdoContainer to retrieve"}

Definition at line 435 of file TgcRdoToPrepDataToolMT.h.

435 {
436 this, "RDOContainer", "TGCRDO", "TgcRdoContainer to retrieve"};

◆ m_show_warning_level_invalid_A09_SSW6_hit

Gaudi::Property<bool> Muon::TgcRdoToPrepDataToolMT::m_show_warning_level_invalid_A09_SSW6_hit
private
Initial value:
{
this, "show_warning_level_invalid_A09_SSW6_hit", false}

Switch for error message disabling on one invalid channel in sector A09 seen in 2008 data, at least run 79772 - 91800.

bug #48828: TgcRdoToTgcDigit WARNING ElementID not found for sub=103 rod=9 ssw=6 slb=20 bitpos=151 +offset=0 orFlag=0

Definition at line 414 of file TgcRdoToPrepDataToolMT.h.

414 {
415 this, "show_warning_level_invalid_A09_SSW6_hit", false};

◆ m_tgcOffset

Gaudi::Property<int> Muon::TgcRdoToPrepDataToolMT::m_tgcOffset {this, "TGCHashIdOffset", 26000}
private

Identifier hash offset.

Definition at line 402 of file TgcRdoToPrepDataToolMT.h.

402{this, "TGCHashIdOffset", 26000};

◆ NBC_HIT

int Muon::TgcRdoToPrepDataToolMT::NBC_HIT = 3
staticconstexprprivate

The number of recorded Bunch Crossings (BCs) FOR HITS is 3 (Previous, Current, and Next BCs).

Definition at line 84 of file TgcRdoToPrepDataToolMT.h.

◆ NBC_TRIG

int Muon::TgcRdoToPrepDataToolMT::NBC_TRIG = 4
staticconstexprprivate

Definition at line 89 of file TgcRdoToPrepDataToolMT.h.

◆ s_cutDropPrdsWithZeroWidth

const double Muon::TgcRdoToPrepDataToolMT::s_cutDropPrdsWithZeroWidth
staticprivate
Initial value:
=
0.1

Cut value for zero widths.

Definition at line 421 of file TgcRdoToPrepDataToolMT.h.


The documentation for this class was generated from the following files: