8#include "GaudiKernel/MsgStream.h"
21 for(
int stationName = 0; stationName < 2; stationName++){
22 for(
int stationEta =0; stationEta <2; stationEta++){
23 for(
int stationPhi = 0; stationPhi <8; stationPhi++){
24 for(
int wireLayer = 0; wireLayer <4; wireLayer++){
25 for(
int measuresPhi = 0; measuresPhi <2; measuresPhi++){
35 unsigned int onlineId;
38 log << MSG::WARNING <<
"Failed at geting online id!" <<
endmsg;
250 if(val==-1)
return StatusCode::FAILURE;
251 return StatusCode::SUCCESS;
257 if(val==-1)
return StatusCode::FAILURE;
258 return StatusCode::SUCCESS;
264 if(val==-1)
return StatusCode::FAILURE;
265 return StatusCode::SUCCESS;
271 if(val==-1)
return StatusCode::FAILURE;
272 return StatusCode::SUCCESS;
278 if(val==-1)
return StatusCode::FAILURE;
279 return StatusCode::SUCCESS;
285 if(val==-1)
return StatusCode::FAILURE;
286 return StatusCode::SUCCESS;
292 if(val==-1)
return StatusCode::FAILURE;
293 return StatusCode::SUCCESS;
300 return StatusCode::SUCCESS;
353 return StatusCode::SUCCESS;
355 if(cat ==
"ENDCAP") {
362 log << MSG::INFO <<
"Requested index " <<
index <<
" can't be converted to a string Id for the category " << cat <<
endmsg;
363 return StatusCode::RECOVERABLE;
368 unsigned int onlineId = 0;
369 std::stringstream
ss;
370 if(cat ==
"CHAMBER"){
375 log << MSG::INFO <<
"Failed converting chamber identifier to online id during stringId gen." <<
endmsg;
376 return StatusCode::RECOVERABLE;
379 else if(cat ==
"LAYER"){
380 unsigned int onlineId;
383 log << MSG::INFO <<
"Failed at getting online id from layer hash during stringId gen." <<
endmsg;
386 else if(cat ==
"CHANNEL"){
391 log << MSG::INFO <<
"Failed converting chamber identifier to online id during stringId gen." <<
endmsg;
392 return StatusCode::RECOVERABLE;
396 ss << std::hex << std::setfill(
'0') << std::setw(5) << onlineId << std::dec;
398 return StatusCode::SUCCESS;
410 return StatusCode::SUCCESS;
413 return StatusCode::SUCCESS;
426 int stationName ((idHelper->
stationName(
id) -50)&0x1 );
434 onlineId += (stationName << 16);
435 onlineId += (
phi << 13) ;
436 onlineId += (
eta <<12);
437 onlineId += (chamLay <<11);
438 onlineId += (wireLay << 9);
439 onlineId += (measuresPhi << 8);
441 return StatusCode::SUCCESS;
454 int stationName ((idHelper->
stationName(
id) -50)&0x1 );
458 int wireLay = (idHelper->
wireLayer(
id)-1) &0x3;
459 int measuresPhi = (idHelper->
measuresPhi(
id) &0x1);
471 onlineId += (stationName << 16);
472 onlineId += (
phi << 13) ;
473 onlineId += (
eta <<12);
474 onlineId += (chamLay <<11);
475 onlineId += (wireLay << 9);
476 onlineId += (measuresPhi << 8);
478 return StatusCode::SUCCESS;
486 int stationName = ((onlineId >> 16)&0x1) + 50;
487 int phi = ((onlineId >> 13)&0x7)+1;
488 int eta = ((((onlineId >> 12)&0x1) == 1) ? 1:-1);
489 int chamLay = ((onlineId>>11)&0x1) +1;
490 int wireLay = ((onlineId>>9)&0x3) +1;
491 int measuresPhi = ((onlineId >> 8)&0x1);
496 strip = 48 - ((onlineId)&0xff) ;
499 strip = ((onlineId)&0xff) +1;
509 static std::atomic<bool> conversionFailPrinted =
false;
511 if (!conversionFailPrinted) {
513 log << MSG::WARNING <<
"Failed to retrieve offline Identifier from online Identifier " << onlineId
514 <<
" (station " << stationName <<
", eta=" <<
eta <<
", phi=" <<
phi <<
"). "
515 <<
"This is likely due to the fact that the CSCCool database contains "
516 <<
"more entries than the detector layout." <<
endmsg;
517 conversionFailPrinted =
true;
519 return StatusCode::FAILURE;
522 return StatusCode::SUCCESS;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
std::vector< std::string > m_cachedDeadLayers
bool isGood(const Identifier &) const
StatusCode onlineToOfflineIds(const CscIdHelper *, const unsigned int &, Identifier &, Identifier &) const
StatusCode indexToStringId(const CscIdHelper *, const unsigned int &, const std::string &, std::string &) const
StatusCode offlineToOnlineId(const CscIdHelper *, const Identifier &, unsigned int &) const
std::map< unsigned int, float > m_cachedChannelsRMS
const bool & getChannelT0Phase(IdentifierHash) const
const std::vector< std::string > & getDeadStations() const
std::map< unsigned int, bool > m_cachedChannelsT0Phase
bool isGoodStation(const Identifier &) const
StatusCode readChannelPed(IdentifierHash, float &) const
StatusCode readChannelT0Base(IdentifierHash, float &) const
void setChannelStatus(IdentifierHash, int)
const std::vector< unsigned int > & getDeadChannelsHash() const
void setDeadLayer(std::string_view, Identifier)
void setChannelT0Phase(IdentifierHash, bool)
void setChannelRMS(IdentifierHash, float)
std::vector< unsigned int > m_onlineChannelIdsFromLayerHash
void setDeadStation(std::string_view, Identifier)
StatusCode offlineElementToOnlineId(const CscIdHelper *, const Identifier &, unsigned int &) const
std::vector< std::string > m_cachedDeadStations
bool isGoodLayer(const Identifier &) const
StatusCode readChannelT0Phase(IdentifierHash, bool &) const
const std::vector< Identifier > & getDeadLayersId() const
StatusCode readChannelRMS(IdentifierHash, float &) const
const float & getChannelPed(IdentifierHash) const
const float & getChannelPSlope(IdentifierHash) const
StatusCode readChannelStatus(IdentifierHash, int &) const
const int & getChannelStatus(IdentifierHash) const
void loadParameters(const CscIdHelper *)
std::vector< unsigned int > m_emptyHashs
std::vector< std::string > m_emptyNames
void setChannelNoise(IdentifierHash, float)
void setChannelPSlope(IdentifierHash, float)
const float & getChannelF001(IdentifierHash) const
bool isGoodChannelHash(const IdentifierHash &) const
IdContext m_channelContext
const float & getChannelRMS(IdentifierHash) const
std::map< unsigned int, float > m_cachedChannelsF001
std::vector< Identifier > m_emptyIds
std::map< unsigned int, float > m_cachedChannelsNoise
const std::vector< Identifier > & getDeadStationsId() const
void setChannelF001(IdentifierHash, float)
void setChannelT0Base(IdentifierHash, float)
StatusCode readChannelPSlope(IdentifierHash, float &) const
void setChannelPed(IdentifierHash, float)
const float & getChannelNoise(IdentifierHash) const
bool hasChannelT0Phase(IdentifierHash) const
StatusCode readChannelNoise(IdentifierHash, float &) const
std::vector< Identifier > m_cachedDeadStationsId
const float & getChannelT0Base(IdentifierHash) const
std::map< unsigned int, float > m_cachedChannelsT0Base
StatusCode layerHashToOnlineId(const unsigned int &, unsigned int &) const
bool m_onlineOfflinePhiFlip
std::vector< Identifier > m_cachedDeadLayersId
std::vector< unsigned int > m_cachedDeadChannelsHash
std::map< unsigned int, int > m_cachedChannelsStatus
IdContext m_moduleContext
StatusCode readChannelF001(IdentifierHash, float &) const
void setDeadChannelHash(IdentifierHash)
const std::vector< std::string > & getDeadLayers() const
std::map< unsigned int, float > m_cachedChannelsPSlope
std::map< unsigned int, float > m_cachedChannelsPed
Identifier channelID(int stationName, int stationEta, int stationPhi, int chamberLayer, int wireLayer, int measuresPhi, int strip) const
Identifier elementID(int stationName, int stationEta, int stationPhi) const
int wireLayer(const Identifier &id) const
int chamberLayer(const Identifier &id) const
int strip(const Identifier &id) const
bool measuresPhi(const Identifier &id) const override
This is a "hash" representation of an Identifier.
int stationEta(const Identifier &id) const
virtual int get_id(const IdentifierHash &hash_id, Identifier &id, const IdContext *context=0) const override
Create compact id from hash id (return == 0 for OK)
IdContext module_context() const
id for module
int stationPhi(const Identifier &id) const
int stationName(const Identifier &id) const
IdContext channel_context() const
id for channel
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)