ATLAS Offline Software
TGCSSCController.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 #include <iostream>
10 
11 namespace LVL1TGCTrigger {
12 
13 //constructor
15 : m_sectorLogic(sL), m_NumberOfWireHighPtBoard(0),
16  m_region(TGCRegionType::FORWARD), m_tgcArgs(tgcargs)
17 {
18 }
19 
20 // distribute signals to appropriate r-phi coincidence matrix.
22 {
24  out->clear();
25 
26  for(int HPBid=0; HPBid < m_sectorLogic->getNumberOfWireHighPtBoard(); HPBid++){
27  if(wire[HPBid]==0) continue; // NO wire HIT
28  for(int chip=0; chip<NumberOfChip; chip+=1){
29  for(int iCandidate=1; iCandidate>=0; iCandidate-=1){
30  if(wire[HPBid]->getSel(chip,iCandidate)){
31  // If both candidates has same HitID, ignore 2nd candidate(iCandidate==1).
32  if(iCandidate==1 && (wire[HPBid]->getHitID(chip,1)) == (wire[HPBid]->getHitID(chip,0))) continue;
33  int SSCId = getSSCId(HPBid,chip,wire[HPBid]->getHitID(chip,iCandidate));
34  if(SSCId<m_sectorLogic->getNumberOfSubSectorCluster()){
35  out->setR(SSCId,wire[HPBid]->getPos(chip,iCandidate));
36  out->setDR(SSCId,wire[HPBid]->getDev(chip,iCandidate));
37  out->setPtR(SSCId,wire[HPBid]->getPt(chip,iCandidate));
38  out->setHitR(SSCId,true);
39  }else{
40  std::cerr << "internal error in TGCSSCController::distribute() bid=" << m_sectorLogic->getBid() << " ";
41  std::cerr << " SSCId="<<SSCId<<std::endl;
42  }
43  }
44  }
45  }
46  }
47 
48  if(strip==0) return out;
49 
50  for(int chip=0; chip<NumberOfChip; chip+=1){
51  for(int iCandidate=1; iCandidate>=0; iCandidate-=1){
52  if( strip->getSel(chip,iCandidate) ){
53  // If both candidates has same HitID, ignore 2nd candidate(iCandidate==1).
54  if(iCandidate==1 && (strip->getHitID(chip,1)) == (strip->getHitID(chip,0))) continue;
55  int chamberNo = getChamberNo(chip,strip->getHitID(chip,iCandidate));
56  //if((chamberNo<0)||(chamberNo >= MaxNumberOfChamberInR)) continue;
57 
58  int iPhi = convertPhi(chip,
59  strip->getHitID(chip,iCandidate),
60  strip->getPos(chip,iCandidate) );
61  int PhiPosInSSC = iPhi;
62  if ( PhiPosInSSC > 3 ) continue;
63  out->setPhi(chamberNo, PhiPosInSSC, iPhi);
64  out->setDPhi(chamberNo, PhiPosInSSC,strip->getDev(chip,iCandidate));
65  out->setPtPhi(chamberNo, PhiPosInSSC, strip->getPt(chip,iCandidate));
66  out->setHitPhi(chamberNo, PhiPosInSSC, true);
67 
68  // chamber No3 and No4 can not be distiguished because of SHPT bug
69  // input from No3 or No4 are duplicated in both chamber
70  int oredChamber=-1;
71  if (chamberNo==4) oredChamber= 3;
72  if (chamberNo==3) oredChamber= 4;
73  if (tgcArgs()->SHPT_ORED() && (oredChamber>0)) {
74  if(!out->hasHitPhi(oredChamber, PhiPosInSSC)){
75  out->setPhi(oredChamber, PhiPosInSSC, iPhi);
76  out->setDPhi(oredChamber, PhiPosInSSC,strip->getDev(chip,iCandidate));
77  out->setPtPhi(oredChamber, PhiPosInSSC, strip->getPt(chip,iCandidate));
78  out->setHitPhi(oredChamber, PhiPosInSSC, true);
79  }
80  }
81 
82  }
83  }
84  }
85  return out;
86 }
87 
88 int TGCSSCController::getSSCId(int nHPB, int chip, int block) const
89 {
91  return (block+chip*MaxNumberOfHPBData);
92  } else {
93  return (block+chip*MaxNumberOfHPBData+nHPB*MaxNumberOfHPBData*NumberOfChip-5);
94  }
95 }
96 
97 int TGCSSCController::convertPhi(int /* chip */, int block, int pos) const
98 {
99  return (pos + (block%2) * 2);
100 }
101 
102 int TGCSSCController::getChamberNo(int chip, int block) const
103 {
105  int chamber = ((block+chip*MaxNumberOfHPBData)/2);
106  if(chamber==5) return (chamber-1);
107  else if(chamber==4) return 0;
108  else return chamber;
109  }
110 
111  else return 0;
112 }
113 
114 int TGCSSCController::getPhiPosInSSC(int /* chip */, int block) const
115 {
116  return block%2;
117 }
118 
119 } //end of namespace bracket
LVL1TGCTrigger::TGCSSCController::distribute
TGCSSCControllerOut * distribute(TGCHighPtChipOut *wire[], TGCHighPtChipOut *strip)
Definition: TGCSSCController.cxx:21
LVL1TGCTrigger::TGCRegionType::ENDCAP
@ ENDCAP
LVL1TGCTrigger::TGCSectorLogic::getRegion
TGCRegionType getRegion() const
Definition: TGCSectorLogic.h:62
LVL1TGCTrigger::TGCSSCController::getPhiPosInSSC
int getPhiPosInSSC(int chip, int block) const
Definition: TGCSSCController.cxx:114
calibdata.chamber
chamber
Definition: calibdata.py:32
LVL1TGCTrigger::TGCSSCController::m_sectorLogic
const TGCSectorLogic * m_sectorLogic
Definition: TGCSSCController.h:30
TGCSSCControllerOut.h
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
LVL1TGCTrigger::TGCRegionType::FORWARD
@ FORWARD
TGCHighPtBoardOut.h
LVL1TGCTrigger::TGCSSCController::getChamberNo
int getChamberNo(int chip, int block) const
Definition: TGCSSCController.cxx:102
LVL1TGCTrigger::TGCSSCControllerOut
Definition: TGCSSCControllerOut.h:13
LVL1TGCTrigger::NumberOfChip
const int NumberOfChip
Definition: TGCHighPtBoard.h:20
LVL1TGCTrigger::TGCHighPtChipOut
Definition: TGCHighPtChipOut.h:16
FORWARD
#define FORWARD
Definition: ALFA_SvdCalc.h:34
TGCSectorLogic.h
LVL1TGCTrigger
Definition: LVL1TGCTrigger.cxx:47
LVL1TGCTrigger::MaxNumberOfHPBData
const int MaxNumberOfHPBData
Definition: TGCHighPtBoardOut.h:12
LVL1TGCTrigger::TGCSSCController::m_region
TGCRegionType m_region
Definition: TGCSSCController.h:36
LVL1TGCTrigger::TGCArguments
Definition: TGCArguments.h:12
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
Trk::iPhi
@ iPhi
Definition: ParamDefs.h:47
LVL1TGCTrigger::TGCSectorLogic
Definition: TGCSectorLogic.h:42
LVL1TGCTrigger::TGCSSCController::tgcArgs
const TGCArguments * tgcArgs() const
Definition: TGCSSCController.h:27
LVL1TGCTrigger::TGCSSCController::getSSCId
int getSSCId(int nHPB, int chip, int block) const
Definition: TGCSSCController.cxx:88
LVL1TGCTrigger::TGCSectorLogic::getBid
int getBid() const
Definition: TGCSectorLogic.h:81
TGCSSCController.h
LVL1TGCTrigger::TGCRegionType
TGCRegionType
Definition: TGCNumbering.h:49
LVL1TGCTrigger::TGCSectorLogic::getNumberOfWireHighPtBoard
int getNumberOfWireHighPtBoard() const
Definition: TGCSectorLogic.h:165
LVL1TGCTrigger::TGCSSCController::TGCSSCController
TGCSSCController(const TGCArguments *, const TGCSectorLogic *sL=0)
Definition: TGCSSCController.cxx:14
LVL1TGCTrigger::TGCSSCController::convertPhi
int convertPhi(int chip, int block, int pos) const
Definition: TGCSSCController.cxx:97