ATLAS Offline Software
Loading...
Searching...
No Matches
TGCTriggerBWCWReader Class Reference

#include <TGCTriggerBWCWReader.h>

Inheritance diagram for TGCTriggerBWCWReader:
Collaboration diagram for TGCTriggerBWCWReader:

Public Member Functions

 TGCTriggerBWCWReader (int lutType)
 ~TGCTriggerBWCWReader ()=default
bool readLUT (TGCTriggerLUTs *writeCdo) override
bool loadParameters (TGCTriggerLUTs *writeCdo, const CondAttrListCollection *readKey) override
bool msgLvl (const MSG::Level lvl) const
 Test the output level.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.
void setLevel (MSG::Level lvl)
 Change the current logging level.

Protected Attributes

int m_lutType {0}

Private Types

enum  {
  TMap_HH =0 , TMap_HL , TMap_LH , TMap_LL ,
  N_TMap
}

Private Member Functions

int getType (int lDR, int hDR, int lDPhi, int hDPhi) const
int subSectorAdd (int ssid, int modid, int phimod2, int type) const
void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels)
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging)

Detailed Description

Definition at line 14 of file TGCTriggerBWCWReader.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Constructor & Destructor Documentation

◆ TGCTriggerBWCWReader()

TGCTriggerBWCWReader::TGCTriggerBWCWReader ( int lutType)

Definition at line 10 of file TGCTriggerBWCWReader.cxx.

10 :
11 TGCTriggerLUTReader(lutType),
12 AthMessaging("TGCTriggerBWCWReader")
13{
14}
AthMessaging()
Default constructor:

◆ ~TGCTriggerBWCWReader()

TGCTriggerBWCWReader::~TGCTriggerBWCWReader ( )
default

Member Function Documentation

◆ getType()

int TGCTriggerBWCWReader::getType ( int lDR,
int hDR,
int lDPhi,
int hDPhi ) const
private

Definition at line 149 of file TGCTriggerBWCWReader.cxx.

149 {
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}

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40{
42 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ loadParameters()

bool TGCTriggerBWCWReader::loadParameters ( TGCTriggerLUTs * writeCdo,
const CondAttrListCollection * readKey )
overridevirtual

Implements TGCTriggerLUTReader.

Definition at line 18 of file TGCTriggerBWCWReader.cxx.

19 {
20
21 CondAttrListCollection::const_iterator itr = readCdo->begin();
22 CondAttrListCollection::const_iterator itr_e = readCdo->end();
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(std::move(version));
38 writeCdo->m_type[m_lutType].push_back(std::move(type));
39
40 ATH_MSG_INFO("file: " <<file);
41 ATH_MSG_DEBUG("data: " << data);
42
43 }
44 return true;
45}
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
ChanAttrListMap::const_iterator const_iterator
std::vector< std::string > m_version[LUT_NUM]
std::map< std::string, std::string > m_datamap[LUT_NUM]
std::vector< std::string > m_file[LUT_NUM]
std::vector< std::string > m_type[LUT_NUM]
std::vector< std::string > m_data[LUT_NUM]
TFile * file

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 163 of file AthMessaging.h.

164{
165 MsgStream* ms = m_msg_tls.get();
166 if (!ms) {
167 if (!m_initialized.test_and_set()) initMessaging();
168 ms = new MsgStream(m_imsg,m_nm);
169 m_msg_tls.reset( ms );
170 }
171
172 ms->setLevel (m_lvl);
173 return *ms;
174}
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
void initMessaging() const
Initialize our message level and MessageSvc.

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 178 of file AthMessaging.h.

179{ return msg() << lvl; }
MsgStream & msg() const
The standard message stream.

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152{
153 if (m_lvl <= lvl) {
154 msg() << lvl;
155 return true;
156 } else {
157 return false;
158 }
159}

◆ readLUT()

bool TGCTriggerBWCWReader::readLUT ( TGCTriggerLUTs * writeCdo)
overridevirtual

Implements TGCTriggerLUTReader.

Definition at line 54 of file TGCTriggerBWCWReader.cxx.

54 {
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, std::move(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}
int getType(int lDR, int hDR, int lDPhi, int hDPhi) const
static constexpr uint8_t SIDE_SHIFT
Bit position of the side bit in the GLOBALADDR.
static constexpr uint8_t DR_MASK
Mask for extracting the deltaR from the GLOBALADDR.
static constexpr uint8_t DPHI_HIGH_RANGE
Range of DPhi in the BW coincidence window for 3-station.
static constexpr uint8_t ROI_MASK
Mask for extracting the module number from the GLOBALADDR.
std::string getData(int cwtype, std::string file) const
static constexpr uint8_t PHIMOD2_SHIFT
Bit position of the module number bits in the GLOBALADDR.
static constexpr uint8_t TYPE_MASK
Mask for extracting the octant from the GLOBALADDR.
static constexpr uint8_t DR_SHIFT
Bit position of the deltaR bits in the GLOBALADDR.
static constexpr uint8_t SIDE_MASK
Mask for extracting the side from the GLOBALADDR.
static constexpr uint8_t OCTANT_SHIFT
Bit position of the octant bits in the GLOBALADDR.
static constexpr uint8_t DR_HIGH_RANGE
Range of DR in the BW coincidence window for 3-station.
std::string getType(int cwtype, int channel=0) const
static constexpr uint8_t MODULE_MASK
Mask for extracting the module number from the GLOBALADDR.
static constexpr uint8_t OCTANT_MASK
Mask for extracting the octant from the GLOBALADDR.
std::unordered_map< uint32_t, int8_t > m_ptmap_bw
static constexpr uint8_t TYPE_SHIFT
Bit position of the octant bits in the GLOBALADDR.
static constexpr uint8_t MODULE_SHIFT
Bit position of the module number bits in the GLOBALADDR.
static constexpr uint8_t PHIMOD2_MASK
Mask for extracting the phi(F or B) from the GLOBALADDR.
static constexpr uint8_t ROI_SHIFT
Bit position of the module number bits in the GLOBALADDR.
int ir
counter of the current depth
Definition fastadd.cxx:49
setEventNumber uint32_t

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29{
30 m_lvl = lvl;
31}

◆ subSectorAdd()

int TGCTriggerBWCWReader::subSectorAdd ( int ssid,
int modid,
int phimod2,
int type ) const
private

Definition at line 158 of file TGCTriggerBWCWReader.cxx.

158 {
159 return (ssid+(modid<<8)+(phimod2<<12) + (type<<16) );
160}

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_lutType

int TGCTriggerLUTReader::m_lutType {0}
protectedinherited

Definition at line 23 of file TGCTriggerLUTReader.h.

23{0};

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.


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