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

#include <AFP_LinkNumTranslator.h>

Inheritance diagram for AFP_LinkNumTranslator:
Collaboration diagram for AFP_LinkNumTranslator:

Public Types

enum  LinkNums : unsigned int {
  kNS0 =0 , kNS1 =1 , kNS2 =2 , kNS3 =3 ,
  kFS0 =8 , kFS1 =9 , kFS2 =10 , kFS3 =11 ,
  kFS5 =12 , kFS4 =13 , kUnknown =99
}

Public Member Functions

 AFP_LinkNumTranslator (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~AFP_LinkNumTranslator () override
virtual StatusCode initialize () override
virtual StatusCode finalize () override
unsigned int translate (unsigned int origlink) const override

Private Attributes

Gaudi::Property< bool > m_useDB {this, "UseDB", false, "whether to use COOL DB (true) or hard-coded values (false) to obtain link numbers"}
Gaudi::Property< int > m_forceRunConfig {this, "ForceRunConfig", 0, "force run configuration for link translation regardless of actual run number; set to 2 for Run-2, set to 3 for Run-3; set 0 to disable"}

Detailed Description

Definition at line 23 of file AFP_LinkNumTranslator.h.

Member Enumeration Documentation

◆ LinkNums

Constructor & Destructor Documentation

◆ AFP_LinkNumTranslator()

AFP_LinkNumTranslator::AFP_LinkNumTranslator ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 7 of file AFP_LinkNumTranslator.cxx.

7 :
8 base_class(type, name, parent)
9{
10}

◆ ~AFP_LinkNumTranslator()

AFP_LinkNumTranslator::~AFP_LinkNumTranslator ( )
overridevirtual

Definition at line 12 of file AFP_LinkNumTranslator.cxx.

13{
14}

Member Function Documentation

◆ finalize()

StatusCode AFP_LinkNumTranslator::finalize ( )
overridevirtual

Definition at line 40 of file AFP_LinkNumTranslator.cxx.

41{
42 return StatusCode::SUCCESS;
43}

◆ initialize()

StatusCode AFP_LinkNumTranslator::initialize ( )
overridevirtual

Definition at line 16 of file AFP_LinkNumTranslator.cxx.

17{
18 if(m_useDB)
19 {
20 ATH_MSG_ERROR("Using DB is not implemented yet");
21 return StatusCode::FAILURE;
22/*
23 ATH_CHECK( m_readDBKey_AF.initialize() );
24 ATH_MSG_INFO( "Using DB with key " << m_readDBKey_AF.fullKey() );
25 ATH_CHECK( m_readDBKey_AN.initialize() );
26 ATH_MSG_INFO( "Using DB with key " << m_readDBKey_AN.fullKey() );
27 ATH_CHECK( m_readDBKey_CF.initialize() );
28 ATH_MSG_INFO( "Using DB with key " << m_readDBKey_CF.fullKey() );
29 ATH_CHECK( m_readDBKey_CN.initialize() );
30 ATH_MSG_INFO( "Using DB with key " << m_readDBKey_CN.fullKey() );
31*/
32 }
33 else
34 {
35 ATH_MSG_INFO("Using hard-coded values");
36 }
37 return StatusCode::SUCCESS;
38}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
Gaudi::Property< bool > m_useDB

◆ translate()

unsigned int AFP_LinkNumTranslator::translate ( unsigned int origlink) const
override

Definition at line 45 of file AFP_LinkNumTranslator.cxx.

46{
47
48 const EventContext& ctx = Gaudi::Hive::currentContext();
49 // EventIDBase t( ctx.eventID() );
50
51 if(m_useDB)
52 {
53 ATH_MSG_ERROR("Using DB is not implemented yet, will return kUnknown = "<<kUnknown);
54 return kUnknown;
55
56 // TODO: distinguish between A and C?
57 // TODO: change based on reality
58 /*
59 SG::ReadCondHandle<CondAttrListCollection> readHandle_AF( m_readDBKey_AF, ctx );
60 const CondAttrListCollection* attrLocList_AF { *readHandle_AF };
61 if ( attrLocList_AF == nullptr )
62 {
63 ATH_MSG_ERROR("data for key " << m_readDBKey_AF.fullKey() << " not found");
64 return 0;
65 }
66 CondAttrListCollection::const_iterator chanIt=attrLocList_AF->begin();
67 CondAttrListCollection::const_iterator chanIt_e=attrLocList_AF->end();
68 for(;chanIt!=chanIt_e;++chanIt) {
69 const unsigned channel=chanIt->first;
70 const coral::AttributeList& attr=chanIt->second;
71 int linkNr = (attr)["linkNr"].data<int>(); // TODO: get link number from the blob
72 ATH_MSG_INFO("execute: run "<<ctx.eventID().run_number()<<", lb "<<ctx.eventID().lumi_block()<<", evnt "<<ctx.eventID().event_number()<<", channel "<<channel<<", linkNr "<<linkNr);
73
74 if((unsigned int)linkNr==origlink)
75 {
76 switch(channel)
77 {
78 case 0: return kNS0;
79 case 1: return kNS1;
80 case 2: return kNS2;
81 case 3: return kNS3;
82 }
83 }
84 }
85
86 // not found in far, try near
87 SG::ReadCondHandle<CondAttrListCollection> readHandle_AN( m_readDBKey_AN, ctx );
88 const CondAttrListCollection* attrLocList_AN { *readHandle_AN };
89 if ( attrLocList_AN == nullptr )
90 {
91 ATH_MSG_ERROR("data for key " << m_readDBKey_AN.fullKey() << " not found");
92 return 0;
93 }
94 chanIt=attrLocList_AN->begin();
95 chanIt_e=attrLocList_AN->end();
96 for(;chanIt!=chanIt_e;++chanIt) {
97 const unsigned channel=chanIt->first;
98 const coral::AttributeList& attr=chanIt->second;
99 int linkNr = (attr)["linkNr"].data<int>(); // TODO: get link number from the blob
100 ATH_MSG_INFO("execute: run "<<ctx.eventID().run_number()<<", lb "<<ctx.eventID().lumi_block()<<", evnt "<<ctx.eventID().event_number()<<", channel "<<channel<<", linkNr "<<linkNr);
101
102 if((unsigned int)linkNr==origlink)
103 {
104 switch(channel)
105 {
106 case 0: return kFS0;
107 case 1: return kFS1;
108 case 2: return kFS2;
109 case 3: return kFS3;
110 case 4: return kFS4;
111 case 5: return kFS5;
112 }
113 }
114 }
115
116 ATH_MSG_ERROR("did not find the corresponding entry in DB; requested translation of link number " << origlink << " for run " << ctx.eventID().run_number());
117 return 0;
118 */
119 }
120 else
121 {
122 // don't use DB
123
124 int run_nr = ctx.eventID().run_number();
125 int Run = (run_nr > 370000 ? 3 : 2);
127
128 if(Run==2)
129 {
130 ATH_MSG_DEBUG("asked for link "<<origlink<<", from run "<<run_nr<<", Run "<<Run);
131 return origlink;
132 }
133 else if(Run==3)
134 {
135 unsigned int kReturn=999;
136 switch(origlink)
137 {
138 case 0: kReturn=kNS0; break;
139 case 2: kReturn=kNS1; break;
140 case 4: kReturn=kNS2; break;
141 case 6: kReturn=kNS3; break;
142 case 8: kReturn=kFS0; break;
143 case 10: kReturn=kFS1; break;
144 case 12: kReturn=kFS2; break;
145 case 14: kReturn=kFS3; break;
146 case 9: kReturn=kFS4; break;
147 case 11: kReturn=kFS5; break;
148 default:
149 ATH_MSG_ERROR("requested translation of unknown link number " << origlink << " for run " << run_nr);
150 kReturn=kUnknown;
151 }
152 ATH_MSG_DEBUG("asked for link "<<origlink<<", from run "<<run_nr<<", Run "<<Run<<", will return "<<kReturn);
153
154 return kReturn;
155 }
156 else
157 {
158 ATH_MSG_ERROR("requested link " << origlink << " for unknown Run " << Run );
159 return kUnknown;
160 }
161 }
162
163}
#define ATH_MSG_DEBUG(x)
Gaudi::Property< int > m_forceRunConfig

Member Data Documentation

◆ m_forceRunConfig

Gaudi::Property<int> AFP_LinkNumTranslator::m_forceRunConfig {this, "ForceRunConfig", 0, "force run configuration for link translation regardless of actual run number; set to 2 for Run-2, set to 3 for Run-3; set 0 to disable"}
private

Definition at line 38 of file AFP_LinkNumTranslator.h.

38{this, "ForceRunConfig", 0, "force run configuration for link translation regardless of actual run number; set to 2 for Run-2, set to 3 for Run-3; set 0 to disable"};

◆ m_useDB

Gaudi::Property<bool> AFP_LinkNumTranslator::m_useDB {this, "UseDB", false, "whether to use COOL DB (true) or hard-coded values (false) to obtain link numbers"}
private

Definition at line 37 of file AFP_LinkNumTranslator.h.

37{this, "UseDB", false, "whether to use COOL DB (true) or hard-coded values (false) to obtain link numbers"};

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