ATLAS Offline Software
TGCTriggerBWCWReader.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
9 
11  TGCTriggerLUTReader(lutType),
12  AthMessaging("TGCTriggerBWCWReader")
13 {
14 }
15 
16 
17 
19  const CondAttrListCollection* readCdo) {
20 
23 
24  for(; itr!=itr_e; ++itr) {
25  const unsigned int channel = (*itr).first;
26  const coral::AttributeList& atr = (*itr).second;
27 
28  ATH_MSG_DEBUG("channel: " << channel);
29  std::string file = *(static_cast<const std::string*>((atr["file"]).addressOfData()));
30  std::string data = *(static_cast<const std::string*>((atr["data"]).addressOfData()));
31  std::string version = *(static_cast<const std::string*>((atr["version"]).addressOfData()));
32  std::string type = *(static_cast<const std::string*>((atr["type"]).addressOfData()));
33 
34  writeCdo->m_datamap[m_lutType][file] = data;
35  writeCdo->m_data[m_lutType].push_back(data);
36  writeCdo->m_file[m_lutType].push_back(file);
37  writeCdo->m_version[m_lutType].push_back(version);
38  writeCdo->m_type[m_lutType].push_back(type);
39 
40  ATH_MSG_INFO("file: " <<file);
41  ATH_MSG_DEBUG("data: " << data);
42 
43  }
44  return true;
45 }
46 
47 
48 
49 
50 
51 
52 
53 
55 
56  const int numberOfCoincidenceType = 4;
57 
58  const int moduleNumber[TGCTriggerLUTs::N_MODULETYPE] =
59  { 0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 8 };
60  const std::string moduleName[TGCTriggerLUTs::N_MODULETYPE]=
61  {"0a","1a","2a","2b","3a","4a","5a","5b","6a","7a","8a","8b"};
62  const std::string sideName[TGCTriggerLUTs::N_SIDE] = {"a","c"};
63  const std::string octantName[TGCTriggerLUTs::N_OCTANT] =
64  { "0", "1", "2", "3", "4", "5", "6", "7"};
65  const std::string coincidenceTypeName[numberOfCoincidenceType] = {"HH","HL","LH","LL"};
66 
67 
68  // initialize
69  bool fullCW = (writeCdo->getType(TGCTriggerLUTs::CW_BW) == "full" );
70  // loop over all files...
71  for(int iSide = 0; iSide<TGCTriggerLUTs::N_SIDE; iSide++){
72  for(int iOctant = 0; iOctant < TGCTriggerLUTs::N_OCTANT; iOctant++) {
73 
76 
77  for(int iModule=0; iModule<TGCTriggerLUTs::N_MODULETYPE; iModule+=1) {
78 
79  uint32_t phimod2 = moduleName[iModule].find('b') != std::string::npos ? 1 : 0;
80  uint32_t modaddr = ((moduleNumber[iModule] & TGCTriggerLUTs::MODULE_MASK)<<TGCTriggerLUTs::MODULE_SHIFT) +
82 
83  for(int iCoinType=0; iCoinType!=numberOfCoincidenceType; iCoinType++){
84 
85  std::string fn;
86  if (fullCW) {
87  fn = "RPhiCoincidenceMapRun3_" + sideName[iSide] + octantName[iOctant]
88  + moduleName[iModule] + coincidenceTypeName[iCoinType] + ".db";
89  } else{
90  fn = "RPhiCoincidenceMapRun3_" + moduleName[iModule] + coincidenceTypeName[iCoinType] + ".db";
91  }
92 
93  bool Forward_type1=(moduleName[iModule]=="2b"||moduleName[iModule]=="5a"||moduleName[iModule]=="8b");
94  bool Forward_type2=(moduleName[iModule]=="2a"||moduleName[iModule]=="5b"||moduleName[iModule]=="8a");
95 
96  if(iOctant%2==0 && Forward_type1){continue;}
97  if(iOctant%2==1 && Forward_type2){continue;}
98  int type = -1;
99  int lDR, hDR, lDPhi, hDPhi;
100 
101  std::string data = writeCdo->getData(TGCTriggerLUTs::CW_BW, fn);
102  std::istringstream stream(data);
103 
104  std::string buf,tag;
105  char delimiter = '\n';
106  int roi;
107 
108  while(getline(stream,buf,delimiter)){
109  std::istringstream header(buf);
110  header>>tag;
111  if(tag=="#") { // read header part.
112  header >> roi >> lDR >> hDR >> lDPhi >> hDPhi;
113  type = getType( lDR, hDR, lDPhi, hDPhi );
114  if( type<0 ) {
115  break;
116  }
117 
120 
121  for(uint8_t ir=lDR+TGCTriggerLUTs::DR_HIGH_RANGE; ir <= hDR+TGCTriggerLUTs::DR_HIGH_RANGE; ir++) { // 0...31 or 7...23
123 
124  // get window data
125  getline(stream, buf, delimiter);
126 
127  for(uint8_t iphi=lDPhi+TGCTriggerLUTs::DPHI_HIGH_RANGE; iphi <= hDPhi+TGCTriggerLUTs::DPHI_HIGH_RANGE; iphi++) {
128  uint32_t theaddr = octaddr + modaddr + cwaddr + draddr + iphi;
129  char pt = buf[iphi-lDPhi-TGCTriggerLUTs::DPHI_HIGH_RANGE];
130  if (pt == 'X') continue; // not opened
131  writeCdo->m_ptmap_bw[theaddr] = pt;
132  }
133  }
134 
135  }
136  }
137 
138  }// coincidence type
139  }// module
140  }// octant
141  }// side
142 
143  return true;
144 }
145 
146 
147 
148 
149 int TGCTriggerBWCWReader::getType(int lDR, int hDR, int lDPhi, int hDPhi ) const {
150  int type = -1;
151  if ( (lDR==-15) && (hDR==15) && (lDPhi==-7) && (hDPhi==7)) type = TGCTriggerBWCWReader::TMap_HH;
152  else if ( (lDR==-15) && (hDR==15) && (lDPhi==-3) && (hDPhi==3)) type = TGCTriggerBWCWReader::TMap_HL;
153  else if ( (lDR==-7) && (hDR==7) && (lDPhi==-7) && (hDPhi==7)) type = TGCTriggerBWCWReader::TMap_LH;
154  else if ( (lDR==-7) && (hDR==7) && (lDPhi==-3) && (hDPhi==3)) type = TGCTriggerBWCWReader::TMap_LL;
155  return type;
156 }
157 
158 int TGCTriggerBWCWReader::subSectorAdd(int ssid, int modid, int phimod2, int type) const {
159  return (ssid+(modid<<8)+(phimod2<<12) + (type<<16) );
160 }
161 
TGCTriggerBWCWReader::TMap_LL
@ TMap_LL
Definition: TGCTriggerBWCWReader.h:24
TGCTriggerLUTs::PHIMOD2_MASK
static constexpr uint8_t PHIMOD2_MASK
Mask for extracting the phi(F or B) from the GLOBALADDR.
Definition: TGCTriggerLUTs.h:36
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
CondAttrListCollection::end
const_iterator end() const
Definition: CondAttrListCollection.h:315
TGCTriggerLUTs::m_file
std::vector< std::string > m_file[LUT_NUM]
Definition: TGCTriggerLUTs.h:86
header
Definition: hcg.cxx:526
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
TGCTriggerLUTs::N_SIDE
@ N_SIDE
Definition: TGCTriggerLUTs.h:68
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TGCTriggerBWCWReader::TMap_HH
@ TMap_HH
Definition: TGCTriggerBWCWReader.h:24
TGCTriggerBWCWReader::TGCTriggerBWCWReader
TGCTriggerBWCWReader(int lutType)
Definition: TGCTriggerBWCWReader.cxx:10
TGCTriggerLUTs::N_OCTANT
@ N_OCTANT
Definition: TGCTriggerLUTs.h:69
TGCTriggerLUTReader::m_lutType
int m_lutType
Definition: TGCTriggerLUTReader.h:23
TGCTriggerLUTs::m_ptmap_bw
std::unordered_map< uint32_t, int8_t > m_ptmap_bw
Definition: TGCTriggerLUTs.h:90
test_pyathena.pt
pt
Definition: test_pyathena.py:11
TGCTriggerLUTs.h
CondAttrListCollection::begin
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
Definition: CondAttrListCollection.h:309
TGCTriggerLUTs::CW_BW
@ CW_BW
Definition: TGCTriggerLUTs.h:66
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
TGCTriggerLUTs::getData
std::string getData(int cwtype, std::string file) const
Definition: TGCTriggerLUTs.cxx:18
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number....
Definition: CondAttrListCollection.h:52
TGCTriggerLUTs::ROI_SHIFT
static constexpr uint8_t ROI_SHIFT
Bit position of the module number bits in the GLOBALADDR.
Definition: TGCTriggerLUTs.h:46
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
TGCTriggerBWCWReader::TMap_HL
@ TMap_HL
Definition: TGCTriggerBWCWReader.h:24
TGCTriggerLUTs::TYPE_SHIFT
static constexpr uint8_t TYPE_SHIFT
Bit position of the octant bits in the GLOBALADDR.
Definition: TGCTriggerLUTs.h:34
TGCTriggerLUTs::getType
std::string getType(int cwtype, int channel=0) const
Definition: TGCTriggerLUTs.cxx:41
TGCTriggerBWCWReader::TMap_LH
@ TMap_LH
Definition: TGCTriggerBWCWReader.h:24
TGCTriggerBWCWReader::subSectorAdd
int subSectorAdd(int ssid, int modid, int phimod2, int type) const
Definition: TGCTriggerBWCWReader.cxx:158
TGCTriggerBWCWReader::getType
int getType(int lDR, int hDR, int lDPhi, int hDPhi) const
Definition: TGCTriggerBWCWReader.cxx:149
TGCTriggerLUTs::DR_MASK
static constexpr uint8_t DR_MASK
Mask for extracting the deltaR from the GLOBALADDR.
Definition: TGCTriggerLUTs.h:48
TGCTriggerLUTs::N_MODULETYPE
@ N_MODULETYPE
Definition: TGCTriggerLUTs.h:70
python.AthDsoLogger.delimiter
delimiter
Definition: AthDsoLogger.py:71
TGCTriggerLUTs::DPHI_HIGH_RANGE
static constexpr uint8_t DPHI_HIGH_RANGE
Range of DPhi in the BW coincidence window for 3-station.
Definition: TGCTriggerLUTs.h:61
python.getCurrentFolderTag.fn
fn
Definition: getCurrentFolderTag.py:65
TGCTriggerLUTs
Definition: TGCTriggerLUTs.h:16
TGCTriggerLUTs::OCTANT_MASK
static constexpr uint8_t OCTANT_MASK
Mask for extracting the octant from the GLOBALADDR.
Definition: TGCTriggerLUTs.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
file
TFile * file
Definition: tile_monitor.h:29
TGCTriggerLUTs::DR_HIGH_RANGE
static constexpr uint8_t DR_HIGH_RANGE
Range of DR in the BW coincidence window for 3-station.
Definition: TGCTriggerLUTs.h:57
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
TGCTriggerBWCWReader.h
TGCTriggerLUTs::m_type
std::vector< std::string > m_type[LUT_NUM]
Definition: TGCTriggerLUTs.h:88
TGCTriggerLUTs::m_data
std::vector< std::string > m_data[LUT_NUM]
Definition: TGCTriggerLUTs.h:85
TGCTriggerLUTs::DR_SHIFT
static constexpr uint8_t DR_SHIFT
Bit position of the deltaR bits in the GLOBALADDR.
Definition: TGCTriggerLUTs.h:50
TGCTriggerLUTs::OCTANT_SHIFT
static constexpr uint8_t OCTANT_SHIFT
Bit position of the octant bits in the GLOBALADDR.
Definition: TGCTriggerLUTs.h:30
TGCTriggerLUTs::m_version
std::vector< std::string > m_version[LUT_NUM]
Definition: TGCTriggerLUTs.h:87
TGCTriggerLUTs::MODULE_MASK
static constexpr uint8_t MODULE_MASK
Mask for extracting the module number from the GLOBALADDR.
Definition: TGCTriggerLUTs.h:40
TGCTriggerLUTs::SIDE_SHIFT
static constexpr uint8_t SIDE_SHIFT
Bit position of the side bit in the GLOBALADDR.
Definition: TGCTriggerLUTs.h:26
TGCTriggerBWCWReader::loadParameters
bool loadParameters(TGCTriggerLUTs *writeCdo, const CondAttrListCollection *readKey) override
Definition: TGCTriggerBWCWReader.cxx:18
TGCTriggerLUTReader
Definition: TGCTriggerLUTReader.h:12
ir
int ir
counter of the current depth
Definition: fastadd.cxx:49
get_generator_info.version
version
Definition: get_generator_info.py:33
CondAttrListCollection::const_iterator
ChanAttrListMap::const_iterator const_iterator
Definition: CondAttrListCollection.h:63
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TGCTriggerLUTs::TYPE_MASK
static constexpr uint8_t TYPE_MASK
Mask for extracting the octant from the GLOBALADDR.
Definition: TGCTriggerLUTs.h:32
TGCTriggerLUTs::SIDE_MASK
static constexpr uint8_t SIDE_MASK
Mask for extracting the side from the GLOBALADDR.
Definition: TGCTriggerLUTs.h:24
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
makeTOC.header
header
Definition: makeTOC.py:28
TGCTriggerBWCWReader::readLUT
bool readLUT(TGCTriggerLUTs *writeCdo) override
Definition: TGCTriggerBWCWReader.cxx:54
TGCTriggerLUTs::MODULE_SHIFT
static constexpr uint8_t MODULE_SHIFT
Bit position of the module number bits in the GLOBALADDR.
Definition: TGCTriggerLUTs.h:42
TGCTriggerLUTs::m_datamap
std::map< std::string, std::string > m_datamap[LUT_NUM]
Definition: TGCTriggerLUTs.h:84
TGCTriggerLUTs::ROI_MASK
static constexpr uint8_t ROI_MASK
Mask for extracting the module number from the GLOBALADDR.
Definition: TGCTriggerLUTs.h:44
TGCTriggerLUTs::PHIMOD2_SHIFT
static constexpr uint8_t PHIMOD2_SHIFT
Bit position of the module number bits in the GLOBALADDR.
Definition: TGCTriggerLUTs.h:38