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

#include <TRTHWMapCondAlg.h>

Inheritance diagram for TRTHWMapCondAlg:
Collaboration diagram for TRTHWMapCondAlg:

Public Member Functions

 TRTHWMapCondAlg (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~TRTHWMapCondAlg () override
virtual StatusCode initialize () override
virtual StatusCode execute () override
virtual StatusCode finalize () override
StatusCode build_BarrelHVLinePadMaps (EventIDRange &range, TRTCond::HWMap *writeCdo) const
 Build HV-line/pad map for Barrel //.
StatusCode build_EndcapHVLinePadMaps (EventIDRange &range, TRTCond::HWMap *writeCdo) const
 Build HV-line/pad maps for Endcaps //.
int hashThisBarrelPad (int sector, int module, int padNum) const
 Hash an HV pad by sector/module/pad# //.
int hashThisEndcapCell (int sector, int wheel, int layer, int cellNum) const
 Hash an endcap HV cell by sector/wheel/layer/cell# //.
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadCondHandleKey< CondAttrListCollectionm_BarrelReadKey {this,"BarrelHWReadKey","TRT/DCS/HV/BARREL","Barrel HV in-key"}
SG::ReadCondHandleKey< CondAttrListCollectionm_EndAReadKey {this,"EndcapAHWReadKey","TRT/DCS/HV/ENDCAPA","EndcapA HV in-key"}
SG::ReadCondHandleKey< CondAttrListCollectionm_EndCReadKey {this,"EndcapCHWReadKey","TRT/DCS/HV/ENDCAPC","EndcapC HV in-key"}
SG::WriteCondHandleKey< TRTCond::HWMapm_WriteKey {this,"HWMapWriteKey","HWMap","HWMap out-key"}
DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 17 of file TRTHWMapCondAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TRTHWMapCondAlg()

TRTHWMapCondAlg::TRTHWMapCondAlg ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 9 of file TRTHWMapCondAlg.cxx.

11 : ::AthAlgorithm(name,pSvcLocator)
12{}
AthAlgorithm()
Default constructor:

◆ ~TRTHWMapCondAlg()

TRTHWMapCondAlg::~TRTHWMapCondAlg ( )
overridevirtualdefault

Member Function Documentation

◆ build_BarrelHVLinePadMaps()

StatusCode TRTHWMapCondAlg::build_BarrelHVLinePadMaps ( EventIDRange & range,
TRTCond::HWMap * writeCdo ) const

Build HV-line/pad map for Barrel //.

Definition at line 163 of file TRTHWMapCondAlg.cxx.

163 {
164 StatusCode sc(StatusCode::SUCCESS);
165
166 std::map< std::string, std::vector<int> > fuseBoxPadMapEven;
167 std::map< std::string, std::vector<int> > fuseBoxPadMapOdd;
168 std::vector<int> theVector;
169 // Even stacks (in HW numbering): Fuseboxes A & B
170 const int pads_1A1[ 9] = { 5, 7,13,21,23,30,38,39,41};
171 theVector = std::vector<int>( pads_1A1, pads_1A1+9 );
172 fuseBoxPadMapEven.insert( make_pair("1_A1", theVector) );
173 const int pads_1A2[ 6] = { 6, 8,15,16,22,24};
174 theVector = std::vector<int>( pads_1A2, pads_1A2+6 );
175 fuseBoxPadMapEven.insert( make_pair("1_A2", theVector) );
176 const int pads_1A3[ 6] = {14,29,31,32,40,42};
177 theVector = std::vector<int>( pads_1A3, pads_1A3+6 );
178 fuseBoxPadMapEven.insert( make_pair("1_A3", theVector) );
179 const int pads_1B1[ 9] = { 2, 4,11,12,19,34,35,36,37};
180 theVector = std::vector<int>( pads_1B1, pads_1B1+9 );
181 fuseBoxPadMapEven.insert( make_pair("1_B1", theVector) );
182 const int pads_1B2[ 6] = {17,25,26,27,28,33};
183 theVector = std::vector<int>( pads_1B2, pads_1B2+6 );
184 fuseBoxPadMapEven.insert( make_pair("1_B2", theVector) );
185 const int pads_1B3[ 6] = { 1, 3, 9,10,18,20};
186 theVector = std::vector<int>( pads_1B3, pads_1B3+6 );
187 fuseBoxPadMapEven.insert( make_pair("1_B3", theVector) );
188 const int pads_2A1[12] = { 6, 8,10,15,18,20,49,50,51,61,63,65};
189 theVector = std::vector<int>( pads_2A1, pads_2A1+12);
190 fuseBoxPadMapEven.insert( make_pair("2_A1", theVector) );
191 const int pads_2A2[11] = { 7, 9,16,17,19,27,52,53,60,62,64};
192 theVector = std::vector<int>( pads_2A2, pads_2A2+11);
193 fuseBoxPadMapEven.insert( make_pair("2_A2", theVector) );
194 const int pads_2A3[10] = {26,28,29,30,37,38,39,40,41,42};
195 theVector = std::vector<int>( pads_2A3, pads_2A3+10);
196 fuseBoxPadMapEven.insert( make_pair("2_A3", theVector) );
197 const int pads_2B1[10] = { 2, 4,12,13,24,46,55,57,58,59};
198 theVector = std::vector<int>( pads_2B1, pads_2B1+10);
199 fuseBoxPadMapEven.insert( make_pair("2_B1", theVector) );
200 const int pads_2B2[12] = { 1, 3, 5,11,14,21,43,44,45,47,54,56};
201 theVector = std::vector<int>( pads_2B2, pads_2B2+12);
202 fuseBoxPadMapEven.insert( make_pair("2_B2", theVector) );
203 const int pads_2B3[10] = {22,23,25,31,32,33,34,35,36,48};
204 theVector = std::vector<int>( pads_2B3, pads_2B3+10);
205 fuseBoxPadMapEven.insert( make_pair("2_B3", theVector) );
206 const int pads_3A1[10] = { 9,10,20,23,24,32,33,34,46,54};
207 theVector = std::vector<int>( pads_3A1, pads_3A1+10);
208 fuseBoxPadMapEven.insert( make_pair("3_A1", theVector) );
209 const int pads_3A2[10] = {70,72,73,82,84,86,92,93,96,99};
210 theVector = std::vector<int>( pads_3A2, pads_3A2+10);
211 fuseBoxPadMapEven.insert( make_pair("3_A2", theVector) );
212 const int pads_3A3[10] = { 8,11,12,21,22,31,35,36,43,44};
213 theVector = std::vector<int>( pads_3A3, pads_3A3+10);
214 fuseBoxPadMapEven.insert( make_pair("3_A3", theVector) );
215 const int pads_3A4[10] = {59,71,81,83,85,94,95,97,98,100};
216 theVector = std::vector<int>( pads_3A4, pads_3A4+10);
217 fuseBoxPadMapEven.insert( make_pair("3_A4", theVector) );
218 const int pads_3A5[10] = {45,47,48,55,56,57,58,60,68,69};
219 theVector = std::vector<int>( pads_3A5, pads_3A5+10);
220 fuseBoxPadMapEven.insert( make_pair("3_A5", theVector) );
221 const int pads_3B1[10] = {51,63,64,66,74,76,78,80,89,90};
222 theVector = std::vector<int>( pads_3B1, pads_3B1+10);
223 fuseBoxPadMapEven.insert( make_pair("3_B1", theVector) );
224 const int pads_3B2[10] = { 1, 4, 5, 6,14,15,18,25,27,28};
225 theVector = std::vector<int>( pads_3B2, pads_3B2+10);
226 fuseBoxPadMapEven.insert( make_pair("3_B2", theVector) );
227 const int pads_3B3[10] = {61,62,65,67,75,77,79,87,88,91};
228 theVector = std::vector<int>( pads_3B3, pads_3B3+10);
229 fuseBoxPadMapEven.insert( make_pair("3_B3", theVector) );
230 const int pads_3B4[10] = { 2, 3, 7,13,16,17,19,26,29,30};
231 theVector = std::vector<int>( pads_3B4, pads_3B4+10);
232 fuseBoxPadMapEven.insert( make_pair("3_B4", theVector) );
233 const int pads_3B5[10] = {37,38,39,40,41,42,49,50,52,53};
234 theVector = std::vector<int>( pads_3B5, pads_3B5+10);
235 fuseBoxPadMapEven.insert( make_pair("3_B5", theVector) );
236 // Odd stacks (in HW numbering): Fuseboxes C & D
237 const int* pads_1C1 = pads_1A1;
238 theVector = std::vector<int>( pads_1C1, pads_1C1+9 );
239 fuseBoxPadMapOdd.insert( make_pair("1_A1", theVector) );
240 const int* pads_1C2 = pads_1A3;
241 theVector = std::vector<int>( pads_1C2, pads_1C2+6 );
242 fuseBoxPadMapOdd.insert( make_pair("1_A2", theVector) );
243 const int* pads_1C3 = pads_1A2;
244 theVector = std::vector<int>( pads_1C3, pads_1C3+6 );
245 fuseBoxPadMapOdd.insert( make_pair("1_A3", theVector) );
246 const int* pads_1D1 = pads_1B1;
247 theVector = std::vector<int>( pads_1D1, pads_1D1+ 9);
248 fuseBoxPadMapOdd.insert( make_pair("1_B1", theVector) );
249 const int* pads_1D2 = pads_1B3;
250 theVector = std::vector<int>( pads_1D2, pads_1D2+ 6);
251 fuseBoxPadMapOdd.insert( make_pair("1_B2", theVector) );
252 const int* pads_1D3 = pads_1B2;
253 theVector = std::vector<int>( pads_1D3, pads_1D3+ 6);
254 fuseBoxPadMapOdd.insert( make_pair("1_B3", theVector) );
255 const int* pads_2C1 = pads_2A1;
256 theVector = std::vector<int>( pads_2C1, pads_2C1+12);
257 fuseBoxPadMapOdd.insert( make_pair("2_A1", theVector) );
258 const int* pads_2C2 = pads_2A2;
259 theVector = std::vector<int>( pads_2C2, pads_2C2+11);
260 fuseBoxPadMapOdd.insert( make_pair("2_A2", theVector) );
261 const int* pads_2C3 = pads_2A3;
262 theVector = std::vector<int>( pads_2C3, pads_2C3+10);
263 fuseBoxPadMapOdd.insert( make_pair("2_A3", theVector) );
264 const int* pads_2D1 = pads_2B1;
265 theVector = std::vector<int>( pads_2D1, pads_2D1+10);
266 fuseBoxPadMapOdd.insert( make_pair("2_B1", theVector) );
267 const int* pads_2D2 = pads_2B2;
268 theVector = std::vector<int>( pads_2D2, pads_2D2+12);
269 fuseBoxPadMapOdd.insert( make_pair("2_B2", theVector) );
270 const int* pads_2D3 = pads_2B3;
271 theVector = std::vector<int>( pads_2D3, pads_2D3+10);
272 fuseBoxPadMapOdd.insert( make_pair("2_B3", theVector) );
273 const int* pads_3C1 = pads_3A2;
274 theVector = std::vector<int>( pads_3C1, pads_3C1+10);
275 fuseBoxPadMapOdd.insert( make_pair("3_A1", theVector) );
276 const int* pads_3C2 = pads_3A1;
277 theVector = std::vector<int>( pads_3C2, pads_3C2+10);
278 fuseBoxPadMapOdd.insert( make_pair("3_A2", theVector) );
279 const int* pads_3C3 = pads_3A4;
280 theVector = std::vector<int>( pads_3C3, pads_3C3+10);
281 fuseBoxPadMapOdd.insert( make_pair("3_A3", theVector) );
282 const int* pads_3C4 = pads_3A3;
283 theVector = std::vector<int>( pads_3C4, pads_3C4+10);
284 fuseBoxPadMapOdd.insert( make_pair("3_A4", theVector) );
285 const int* pads_3C5 = pads_3A5;
286 theVector = std::vector<int>( pads_3C5, pads_3C5+10);
287 fuseBoxPadMapOdd.insert( make_pair("3_A5", theVector) );
288 const int* pads_3D1 = pads_3B2;
289 theVector = std::vector<int>( pads_3D1, pads_3D1+10);
290 fuseBoxPadMapOdd.insert( make_pair("3_B1", theVector) );
291 const int* pads_3D2 = pads_3B1;
292 theVector = std::vector<int>( pads_3D2, pads_3D2+10);
293 fuseBoxPadMapOdd.insert( make_pair("3_B2", theVector) );
294 const int* pads_3D3 = pads_3B4;
295 theVector = std::vector<int>( pads_3D3, pads_3D3+10);
296 fuseBoxPadMapOdd.insert( make_pair("3_B3", theVector) );
297 const int* pads_3D4 = pads_3B3;
298 theVector = std::vector<int>( pads_3D4, pads_3D4+10);
299 fuseBoxPadMapOdd.insert( make_pair("3_B4", theVector) );
300 const int* pads_3D5 = pads_3B5;
301 theVector = std::vector<int>( pads_3D5, pads_3D5+10 );
302 fuseBoxPadMapOdd.insert( make_pair("3_B5", theVector) );
303 std::string chanName;
304 chanName.reserve(40);
305 // Loop through sectors
306 for ( int sector = 0; sector < 32; ++sector ) {
307 // Odd Stacks = Side A (1) Fusebox C & D, Even = Side C (0) Fusebox A & B
308 int side = (sector+1)%2;
309 // Pick the appropriate Fusebox/Pad map
310 const auto & fuseBoxPadMap = (side == 1)? fuseBoxPadMapOdd : fuseBoxPadMapEven;
311 // Loop through all fusebox lines in this stack
312 for (const auto& [fuseBoxName, padVec] : fuseBoxPadMap){
313 int module = fuseBoxName.front() - '0' - 1;
314 // Loop through pads
315 for ( const auto & pad: padVec ) {
316 int hashedPad = hashThisBarrelPad( sector, module, pad );
317 if ( hashedPad >= (int)writeCdo->get_Barrel_HV_Names()->size() || hashedPad<0) {
318 ATH_MSG_INFO("channel request for invalid barrel HV pad.");
319 } else {
320 chanName = "HVB_S" + std::to_string(sector+1) + "_M" + fuseBoxName + "_OutputVoltage";
321 writeCdo->setBarrelName(hashedPad,chanName);
322 }
323 }
324 }
325 }
326
327
328 ATH_MSG_INFO("TRT Barrel HV-line/pad map successfully built - "
329 << writeCdo->get_Barrel_HV_Names()->size() << " channels.");
330
331 SG::ReadCondHandle<CondAttrListCollection> readBarrelHandle{m_BarrelReadKey};
332 if(!readBarrelHandle.range(range)) {
333 ATH_MSG_ERROR("Failed to retrieve validity range for " << readBarrelHandle.key());
334 return StatusCode::FAILURE;
335 }
336
337 const CondAttrListCollection* DCSCondFolder{*readBarrelHandle};
338 if ( DCSCondFolder == nullptr ) {
339 ATH_MSG_WARNING("Couldn't retrieve folder /TRT/DCS/HV/BARREL. Has it been loaded into IOVDbSvc?");
340 return StatusCode::FAILURE;
341 }
342 if ( DCSCondFolder->name_size() == 0 ) {
343 ATH_MSG_WARNING("CondAttrListCollection for folder /TRT/DCS/HV/BARREL is missing ");
344 return StatusCode::FAILURE;
345 }
346
347
348 // Loop through the channel names.
350 for ( nameItr = DCSCondFolder->name_begin(); nameItr != DCSCondFolder->name_end(); ++nameItr ) {
351 int chanNum = (*nameItr).first;
352 std::string chanName = (*nameItr).second;
353 for ( int itr = 0; itr < (int)writeCdo->get_Barrel_HV_Names()->size(); ++itr ) {
354 if ( writeCdo->get_Barrel_HV_Names()->at(itr) == chanName ) writeCdo->setBarrelNum(itr , chanNum );
355 }
356 }
357
358
359 return sc;
360}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
static Double_t sc
name_const_iterator name_begin() const
Access to Chan/Name pairs via iterators.
name_size_type name_size() const
number of Chan/Name pairs
name_const_iterator name_end() const
ChanNameMap::const_iterator name_const_iterator
bool range(EventIDRange &r)
const std::string & key() const
const std::vector< std::string > * get_Barrel_HV_Names() const
Definition HWMap.h:33
void setBarrelName(int i, const std::string &name)
Definition HWMap.h:40
void setBarrelNum(int i, const int &channel_number)
Definition HWMap.h:50
int hashThisBarrelPad(int sector, int module, int padNum) const
Hash an HV pad by sector/module/pad# //.
SG::ReadCondHandleKey< CondAttrListCollection > m_BarrelReadKey
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ build_EndcapHVLinePadMaps()

StatusCode TRTHWMapCondAlg::build_EndcapHVLinePadMaps ( EventIDRange & range,
TRTCond::HWMap * writeCdo ) const

Build HV-line/pad maps for Endcaps //.

Definition at line 365 of file TRTHWMapCondAlg.cxx.

365 {
366 StatusCode sc(StatusCode::SUCCESS);
367
368 // Loop through all possible pads
369
370 // Loop through phi-sectors
371 for ( int sector = 0; sector < 32; ++sector ) {
372 // Loop through wheels (type A and B)
373 for ( int wheel = 0; wheel < 14; ++wheel ) {
374 // Loop through 4-plane layers in each wheel
375 int nLayers = -1;
376 if ( wheel >= 0 && wheel < 6 ) nLayers = 4;
377 if ( wheel >= 6 && wheel < 14 ) nLayers = 2;
378 for ( int layer = 0; layer < nLayers; ++layer ) {
379 // Construct the HV-line logical name for this cell (COOL style)
380 std::stringstream lineName;
381 // SectorPair
382 int sectorLeft = 0;
383 int sectorRight = 0;
384 if ( sector%2 == 0 ) {
385 sectorLeft = sector+1;
386 sectorRight = sector+2;
387 } else {
388 sectorLeft = sector;
389 sectorRight = sector+1;
390 }
391 lineName << "S" << sectorLeft << "S" << sectorRight << "_";
392 if ( sectorLeft%2 == 0 ) {
393 ATH_MSG_WARNING("Mistake in sector pairing!!!");
394 break;
395 }
396 // Wheel
397 if ( wheel >= 0 && wheel < 6 ) lineName << "WA" << (wheel+1) << "_";
398 else lineName << "WB" << (wheel-5) << "_";
399 // 4-plane layer
400 if ( wheel >= 0 && wheel < 6 ) {
401 if ( layer == 0 ) lineName << "1B";
402 if ( layer == 1 ) lineName << "1T";
403 if ( layer == 2 ) lineName << "2B";
404 if ( layer == 3 ) lineName << "2T";
405 } else {
406 if ( layer == 0 ) lineName << "B";
407 if ( layer == 1 ) lineName << "T";
408 }
409 lineName << "_OutputVoltage";
410 // Final names for ECA and ECC
411 std::stringstream lineNameA;
412 std::stringstream lineNameC;
413 lineNameA << "HVA_" << lineName.str();
414 lineNameC << "HVC_" << lineName.str();
415 // Add them to the maps
416 for ( int cellNum = 0; cellNum < 3; ++cellNum ) {
417 int hashedCell = hashThisEndcapCell( sector, wheel, layer, cellNum );
418 if ( hashedCell >= (int)writeCdo->get_EndcapA_HV_Names()->size() || hashedCell<0) {
419 ATH_MSG_WARNING("channel request for invalid endcap HV pad.");
420 }else{
421 writeCdo->setEndcapAName(hashedCell,lineNameA.str());
422 writeCdo->setEndcapCName(hashedCell,lineNameC.str());
423 }
424 }
425 }
426 }
427 }
428
429 // Apply corrections to the map
430 int hashedCellToFix = hashThisEndcapCell( 5, 12, 0, 2 );
431 if ( hashedCellToFix >= (int)writeCdo->get_EndcapA_HV_Names()->size() || hashedCellToFix<0) {
432 ATH_MSG_WARNING("channel request for invalid endcap HV pad.");
433 }else{
434 writeCdo->setEndcapAName(hashedCellToFix, "HVA_S7S8_WB7_B_OutputVoltage");
435 }
436 ATH_MSG_INFO("Endcap HV-line/pad maps successfully built - ECA: "
437 << writeCdo->get_EndcapA_HV_Names()->size() << " channels; ECC: "
438 << writeCdo->get_EndcapC_HV_Names()->size() << " channels.");
439
440
441 // EndcapA
442
443 // Get the CondAttrListCollection for Endcap A
444 EventIDRange rangeA;
445 SG::ReadCondHandle<CondAttrListCollection> readEndAHandle{m_EndAReadKey};
446 if(!readEndAHandle.range(rangeA)) {
447 ATH_MSG_ERROR("Failed to retrieve validity range for " << readEndAHandle.key());
448 return StatusCode::FAILURE;
449 }
450
451 const CondAttrListCollection* DCSCondFolder{*readEndAHandle};
452 if ( DCSCondFolder == nullptr ) {
453 ATH_MSG_WARNING("Couldn't retrieve folder /TRT/DCS/HV/ENDCAPA. Has it been loaded into IOVDbSvc?");
454 return StatusCode::FAILURE;
455 }
456 if ( DCSCondFolder->name_size() == 0 ) {
457 ATH_MSG_WARNING("CondAttrListCollection for folder /TRT/DCS/HV/ENDCAPA is missing");
458 return StatusCode::FAILURE;
459 }
460
461 // Loop through the channel names.
463 for ( nameItr = DCSCondFolder->name_begin(); nameItr != DCSCondFolder->name_end(); ++nameItr ) {
464 int chanNum = (*nameItr).first;
465 std::string chanName = (*nameItr).second;
466 for ( int itr = 0; itr < (int)writeCdo->get_EndcapA_HV_Names()->size(); ++itr ) {
467 if ( writeCdo->get_EndcapA_HV_Names()->at(itr) == chanName ) writeCdo->setEndcapANum(itr , chanNum );
468 }
469 }
470
471 // EndcapC
472
473 // Get the CondAttrListCollection for Endcap C
474 EventIDRange rangeC;
475 SG::ReadCondHandle<CondAttrListCollection> readEndCHandle{m_EndCReadKey};
476 const CondAttrListCollection* DCSCondFolder1{*readEndCHandle};
477 if(!readEndCHandle.range(rangeC)) {
478 ATH_MSG_ERROR("Failed to retrieve validity range for " << readEndCHandle.key());
479 return StatusCode::FAILURE;
480 }
481 if ( DCSCondFolder1 == nullptr ) {
482 ATH_MSG_WARNING("Couldn't retrieve folder /TRT/DCS/HV/ENDCAPC. Has it been loaded into IOVDbSvc?");
483 return StatusCode::FAILURE;
484 }
485 if ( DCSCondFolder1->name_size() == 0 ) {
486 ATH_MSG_WARNING("CondAttrListCollection for folder /TRT/DCS/HV/ENDCAPC is missing");
487 return StatusCode::FAILURE;
488 }
489
490
491 // Loop through the channel names.
492 for ( nameItr = DCSCondFolder1->name_begin(); nameItr != DCSCondFolder1->name_end(); ++nameItr ) {
493 int chanNum = (*nameItr).first;
494 std::string chanName = (*nameItr).second;
495 for ( int itr = 0; itr < (int)writeCdo->get_EndcapC_HV_Names()->size(); ++itr ) {
496 if ( writeCdo->get_EndcapC_HV_Names()->at(itr) == chanName ) writeCdo->setEndcapCNum(itr , chanNum );
497 }
498 }
499
500 range=EventIDRange::intersect(rangeA,rangeC);
501 return sc;
502}
void setEndcapCNum(int i, const int &channel_number)
Definition HWMap.h:58
const std::vector< std::string > * get_EndcapA_HV_Names() const
Definition HWMap.h:34
void setEndcapANum(int i, const int &channel_number)
Definition HWMap.h:54
void setEndcapCName(int i, const std::string &name)
Definition HWMap.h:46
const std::vector< std::string > * get_EndcapC_HV_Names() const
Definition HWMap.h:35
void setEndcapAName(int i, const std::string &name)
Definition HWMap.h:43
SG::ReadCondHandleKey< CondAttrListCollection > m_EndCReadKey
int hashThisEndcapCell(int sector, int wheel, int layer, int cellNum) const
Hash an endcap HV cell by sector/wheel/layer/cell# //.
SG::ReadCondHandleKey< CondAttrListCollection > m_EndAReadKey
@ layer
Definition HitInfo.h:79

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode TRTHWMapCondAlg::execute ( )
overridevirtual

Definition at line 28 of file TRTHWMapCondAlg.cxx.

29{
30 ATH_MSG_DEBUG("execute " << name());
31
32 // ____________ Construct Write Cond Handle and check its validity ____________
33
34 SG::WriteCondHandle<TRTCond::HWMap> writeHandle{m_WriteKey};
35
36 // Do we have a valid Write Cond Handle for current time?
37 if(writeHandle.isValid()) {
38 ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid."
39 << ". In theory this should not be called, but may happen"
40 << " if multiple concurrent events are being processed out of order.");
41
42 return StatusCode::SUCCESS;
43 }
44
45
46
47 // // ____________ Construct new Write Cond Object ____________
48
49 std::unique_ptr<TRTCond::HWMap> writeCdo=std::make_unique<TRTCond::HWMap>();
50
51 // ____________ Compute the Write Cond Object (HWMap) ____________
52
53 EventIDRange rangeBarrel, rangeEndcap;
54
55 if(StatusCode::SUCCESS != build_BarrelHVLinePadMaps(rangeBarrel, writeCdo.get() ) ) {
56 ATH_MSG_ERROR ("Problem filling barrel map.");
57 return StatusCode::FAILURE;
58 }
59 if(StatusCode::SUCCESS != build_EndcapHVLinePadMaps(rangeEndcap, writeCdo.get() ) ) {
60 ATH_MSG_ERROR ("Problem filling endcap map.");
61 return StatusCode::FAILURE;
62 }
63
64 EventIDRange rangeW=EventIDRange::intersect(rangeBarrel,rangeEndcap);
65
66 // Record CDO
67 if(writeHandle.record(rangeW,std::move(writeCdo)).isFailure()) {
68 ATH_MSG_ERROR("Could not record " << writeHandle.key()
69 << " with EventRange " << rangeW
70 << " into Conditions Store");
71 return StatusCode::FAILURE;
72 }
73
74 return StatusCode::SUCCESS;
75}
#define ATH_MSG_DEBUG(x)
const std::string & key() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const
StatusCode build_BarrelHVLinePadMaps(EventIDRange &range, TRTCond::HWMap *writeCdo) const
Build HV-line/pad map for Barrel //.
SG::WriteCondHandleKey< TRTCond::HWMap > m_WriteKey
StatusCode build_EndcapHVLinePadMaps(EventIDRange &range, TRTCond::HWMap *writeCdo) const
Build HV-line/pad maps for Endcaps //.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ finalize()

StatusCode TRTHWMapCondAlg::finalize ( )
overridevirtual

Definition at line 154 of file TRTHWMapCondAlg.cxx.

155{
156 ATH_MSG_DEBUG("finalize " << name());
157 return StatusCode::SUCCESS;
158}

◆ hashThisBarrelPad()

int TRTHWMapCondAlg::hashThisBarrelPad ( int sector,
int module,
int padNum ) const

Hash an HV pad by sector/module/pad# //.

Definition at line 79 of file TRTHWMapCondAlg.cxx.

79 {
80
81 int hashedPad = -1;
82
83 /*---------------------------------
84 * Pad counting details:
85 * 32 sectors ( expect sector in range(0,31) )
86 * 3 modules ( expect module in range(0,2) )
87 * 42 pads in type1 module ( expect padNum in range(1,42) )
88 * 65 pads in type2 module ( expect padNum in range(1,65) )
89 * 100 pads in type3 module ( expect padNum in range(1,100) )
90 */
91 padNum -= 1; // shift range down to (0,n-1)
92 const int nPadsPerSector = 42+65+100;
93
94 int padOffset = -1;
95 switch( module ) {
96 case 0: padOffset = 0; break;
97 case 1: padOffset = 42; break;
98 case 2: padOffset = 42+65; break;
99 default:
100 ATH_MSG_ERROR("Couldn't hash this pad: "
101 << sector << "," << module << "," << padNum);
102 return -1;
103 }
104
105 hashedPad = 0;
106 hashedPad += sector*nPadsPerSector;
107 hashedPad += padNum + padOffset;
108
109 return hashedPad;
110}

◆ hashThisEndcapCell()

int TRTHWMapCondAlg::hashThisEndcapCell ( int sector,
int wheel,
int layer,
int cellNum ) const

Hash an endcap HV cell by sector/wheel/layer/cell# //.

Definition at line 115 of file TRTHWMapCondAlg.cxx.

115 {
116
117 int hashedCell = -1;
118
119 /*---------------------------------
120 * Cell counting details:
121 * 32 sectors ( expect sector in range(0,31) )
122 * 14 wheels ( expect wheel in range(0,13) )
123 * typeA: (0,5) wheelType = 0
124 * typeB: (6,13) wheelType = 1
125 * 4 4-plane layers in typeA ( expect layer in range(0,3) )
126 * 2 4-plane layers in typeB ( expect layer in range(0,1) )
127 * 3 cells per sector in one 4-plane wheel ( expect cell in range(0,2) )
128 */
129
130 // Trick for counting
131 int wheelType = -1;
132 if ( wheel >= 0 && wheel < 6 ) wheelType = 0; // A wheel
133 if ( wheel >= 6 && wheel < 14 ) wheelType = 1; // B wheel
134 if ( wheelType == -1 ) {
135 ATH_MSG_ERROR("Invalid wheel number.");
136 return -1;
137 }
138
139 const int nCellsPerSector = (6*4+8*2)*3; // 6 A-wheels + 8 B-wheels
140 int fourPlaneWheelNum;
141 if ( wheelType == 0 ) {
142 fourPlaneWheelNum = layer + 4*wheel; // 0-23
143 } else {
144 fourPlaneWheelNum = layer + 24 + 2*(wheel-6); // 24-39
145 }
146
147 hashedCell = cellNum + 3*fourPlaneWheelNum + sector*nCellsPerSector;
148
149 return hashedCell;
150}

◆ initialize()

StatusCode TRTHWMapCondAlg::initialize ( )
overridevirtual

Definition at line 15 of file TRTHWMapCondAlg.cxx.

16{
17 // Read key
18 ATH_CHECK( m_BarrelReadKey.initialize() );
19 ATH_CHECK( m_EndAReadKey.initialize() );
20 ATH_CHECK( m_EndCReadKey.initialize() );
21
22 // Register write handle
23 ATH_CHECK( m_WriteKey.initialize() );
24
25 return StatusCode::SUCCESS;
26}
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_BarrelReadKey

SG::ReadCondHandleKey<CondAttrListCollection> TRTHWMapCondAlg::m_BarrelReadKey {this,"BarrelHWReadKey","TRT/DCS/HV/BARREL","Barrel HV in-key"}
private

Definition at line 33 of file TRTHWMapCondAlg.h.

33{this,"BarrelHWReadKey","TRT/DCS/HV/BARREL","Barrel HV in-key"};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_EndAReadKey

SG::ReadCondHandleKey<CondAttrListCollection> TRTHWMapCondAlg::m_EndAReadKey {this,"EndcapAHWReadKey","TRT/DCS/HV/ENDCAPA","EndcapA HV in-key"}
private

Definition at line 34 of file TRTHWMapCondAlg.h.

34{this,"EndcapAHWReadKey","TRT/DCS/HV/ENDCAPA","EndcapA HV in-key"};

◆ m_EndCReadKey

SG::ReadCondHandleKey<CondAttrListCollection> TRTHWMapCondAlg::m_EndCReadKey {this,"EndcapCHWReadKey","TRT/DCS/HV/ENDCAPC","EndcapC HV in-key"}
private

Definition at line 35 of file TRTHWMapCondAlg.h.

35{this,"EndcapCHWReadKey","TRT/DCS/HV/ENDCAPC","EndcapC HV in-key"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_WriteKey

SG::WriteCondHandleKey<TRTCond::HWMap> TRTHWMapCondAlg::m_WriteKey {this,"HWMapWriteKey","HWMap","HWMap out-key"}
private

Definition at line 36 of file TRTHWMapCondAlg.h.

36{this,"HWMapWriteKey","HWMap","HWMap out-key"};

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