ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
AFP::SiLocAlignDBTool Class Reference

Tool providing local alignment of silicon detectors from the conditions database. More...

#include <SiLocAlignDBTool.h>

Inheritance diagram for AFP::SiLocAlignDBTool:
Collaboration diagram for AFP::SiLocAlignDBTool:

Public Member Functions

 SiLocAlignDBTool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual ~SiLocAlignDBTool () override
 Does nothing. More...
 
virtual StatusCode initialize () override
 Does nothing. More...
 
virtual StatusCode finalize () override
 Does nothing. More...
 
nlohmann::json alignmentData (const EventContext &ctx) const override
 Provide alignment parameters for a given plane. Returns zeros if no data available. More...
 
const SiLocAlignData alignment (const nlohmann::json &jsondata, const int stationID, const int planeID) const override
 

Private Attributes

SG::ReadCondHandleKey< CondAttrListCollectionm_rch_loc {this, "loc_align_key", "/FWD/Onl/AFP/Align/Local", "read condition handle for local alignement"}
 

Detailed Description

Tool providing local alignment of silicon detectors from the conditions database.

Definition at line 33 of file SiLocAlignDBTool.h.

Constructor & Destructor Documentation

◆ SiLocAlignDBTool()

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

Definition at line 10 of file SiLocAlignDBTool.cxx.

10  :
11  base_class(type, name, parent)
12  {
13  }

◆ ~SiLocAlignDBTool()

virtual AFP::SiLocAlignDBTool::~SiLocAlignDBTool ( )
inlineoverridevirtual

Does nothing.

Definition at line 39 of file SiLocAlignDBTool.h.

39 {}

Member Function Documentation

◆ alignment()

const SiLocAlignData AFP::SiLocAlignDBTool::alignment ( const nlohmann::json jsondata,
const int  stationID,
const int  planeID 
) const
override

Definition at line 52 of file SiLocAlignDBTool.cxx.

53  {
54  ATH_MSG_DEBUG("will get local alignment for station "<<stationID<<", layerID "<<layerID);
55  nlohmann::json channeldata=jsondata["data"];
56 
57  // first, try to guess the channel nr.
58  int guess_ch=stationID*4+layerID;
59 
60  nlohmann::json aligndata=channeldata.at(std::to_string(guess_ch)); // because using int would be too simple
61  int st=aligndata["stationID"];
62  int la=aligndata["layerID"];
63  if(stationID==st && layerID==la)
64  {
65  ATH_MSG_DEBUG("channel guessed correctly, stationID "<<st<<", layerId "<<la<<", channel guess "<<guess_ch);
66  return SiLocAlignData(st, la, aligndata["shiftX"], aligndata["shiftY"], aligndata["shiftZ"], aligndata["alpha"], aligndata["beta"], aligndata["gamma"]);
67  }
68  else
69  {
70  ATH_MSG_DEBUG("channel was not guessed correctly, stationID "<<st<<", layerId "<<la<<", channel guess "<<guess_ch);
71  }
72 
73  // if guess is not correct, loop over all channels
74  for(auto& chan : channeldata.items())
75  {
76  // channels are ordered alphabetically: 0,1,10,...,15,2,3,...,9
77  nlohmann::json aligndata=chan.value();
78 
79  int st=aligndata["stationID"];
80  int la=aligndata["layerID"];
81 
82  if(stationID==st && layerID==la)
83  {
84  ATH_MSG_DEBUG("channel found for stationID "<<st<<", layerId "<<la<<", channel nr. "<<chan.key());
85  return SiLocAlignData(st, la, aligndata["shiftX"], aligndata["shiftY"], aligndata["shiftZ"], aligndata["alpha"], aligndata["beta"], aligndata["gamma"]);
86  }
87  }
88 
89  ATH_MSG_WARNING("local alignment data stationID "<<stationID<<", layerId "<<layerID<<" not found in any channels, returning zeros");
90  return SiLocAlignData(stationID,layerID);
91  }

◆ alignmentData()

nlohmann::json AFP::SiLocAlignDBTool::alignmentData ( const EventContext &  ctx) const
override

Provide alignment parameters for a given plane. Returns zeros if no data available.

Definition at line 30 of file SiLocAlignDBTool.cxx.

31  {
32  ATH_MSG_DEBUG("will get local alignment for run "<<ctx.eventID().run_number()<<", lb "<<ctx.eventID().lumi_block()<<", event "<<ctx.eventID().event_number());
33 
35  const CondAttrListCollection* attrLocList { *ch_loc};
36  if ( attrLocList == nullptr )
37  {
38  ATH_MSG_WARNING("local alignment data for key " << m_rch_loc.fullKey() << " not found, returning empty string");
39  return nlohmann::json::parse("");
40  }
41 
42  if(attrLocList->size()>1) ATH_MSG_INFO("there should be only one real channel in "<< m_rch_loc.fullKey() <<", there are "<<attrLocList->size()<<" real channels, only the first one will be used ");
43 
44  CondAttrListCollection::const_iterator itr = attrLocList->begin();
45  const coral::AttributeList &atr = itr->second;
46  std::string data = *(static_cast<const std::string *>((atr["data"]).addressOfData()));
47 
49  }

◆ finalize()

StatusCode AFP::SiLocAlignDBTool::finalize ( )
overridevirtual

Does nothing.

Definition at line 23 of file SiLocAlignDBTool.cxx.

24  {
25  ATH_MSG_DEBUG("in the finalize of SiLocAlignDBTool, bye bye");
26  return StatusCode::SUCCESS;
27  }

◆ initialize()

StatusCode AFP::SiLocAlignDBTool::initialize ( )
overridevirtual

Does nothing.

Definition at line 16 of file SiLocAlignDBTool.cxx.

17  {
19  ATH_MSG_DEBUG( "using DB with key " << m_rch_loc.fullKey() );
20  return StatusCode::SUCCESS;
21  }

Member Data Documentation

◆ m_rch_loc

SG::ReadCondHandleKey<CondAttrListCollection> AFP::SiLocAlignDBTool::m_rch_loc {this, "loc_align_key", "/FWD/Onl/AFP/Align/Local", "read condition handle for local alignement"}
private

Definition at line 52 of file SiLocAlignDBTool.h.


The documentation for this class was generated from the following files:
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
json
nlohmann::json json
Definition: HistogramDef.cxx:9
parse
std::map< std::string, std::string > parse(const std::string &list)
Definition: egammaLayerRecalibTool.cxx:1054
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number....
Definition: CondAttrListCollection.h:52
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
Muon::nsw::STGTPSegments::moduleIDBits::stationID
constexpr uint8_t stationID
Large or Small wedge.
Definition: NSWSTGTPDecodeBitmaps.h:152
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CondAttrListCollection::const_iterator
ChanAttrListMap::const_iterator const_iterator
Definition: CondAttrListCollection.h:63
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AFP::SiLocAlignDBTool::m_rch_loc
SG::ReadCondHandleKey< CondAttrListCollection > m_rch_loc
Definition: SiLocAlignDBTool.h:52