ATLAS Offline Software
TgcPrepDataRetriever.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "TgcPrepDataRetriever.h"
6 
7 #include "MuonFullIDHelper.h"
9 
10 namespace JiveXML {
11 
12  //--------------------------------------------------------------------------
13 
14  TgcPrepDataRetriever::TgcPrepDataRetriever(const std::string& type,const std::string& name, const IInterface* parent):
16  {
17 
18  declareInterface<IDataRetriever>(this);
19  }
20 
21  //--------------------------------------------------------------------------
22 
24 
25  ATH_MSG_DEBUG("Initializing retriever for " << dataTypeName());
26  ATH_CHECK(m_sgKey.initialize());
27  ATH_CHECK( m_idHelperSvc.retrieve() );
28 
29  return StatusCode::SUCCESS;
30  }
31 
32  //--------------------------------------------------------------------------
33 
34  StatusCode TgcPrepDataRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) {
35 
36  //be verbose
37  ATH_MSG_DEBUG("Retrieving " << dataTypeName());
38 
40 
41  int ndata = 0;
43  for (containerIt=tgcContainer->begin(); containerIt!=tgcContainer->end(); ++containerIt) {
44  ndata += (*containerIt)->size();
45  }
46  //Make the vectors to contain the information and reserve space accordingly
47  DataVect x; x.reserve(ndata);
48  DataVect y; y.reserve(ndata);
49  DataVect z; z.reserve(ndata);
50  DataVect lengthVec; lengthVec.reserve(ndata);
51  DataVect swidthVec; swidthVec.reserve(ndata);
52  DataVect lwidthVec; lwidthVec.reserve(ndata);
53  DataVect idVec; idVec.reserve(ndata);
54  DataVect identifierVec; identifierVec.reserve(ndata);
55  DataVect barcode; barcode.reserve(ndata);
56 
57  for (containerIt=tgcContainer->begin(); containerIt!=tgcContainer->end(); ++containerIt) {
58  const Muon::TgcPrepDataCollection *tgcCollection = *containerIt;
59 
61  for (collectionIt=tgcCollection->begin(); collectionIt!=tgcCollection->end(); ++collectionIt) {
62 
63  const Muon::TgcPrepData *data = *collectionIt;
64  const MuonGM::TgcReadoutElement *element = data->detectorElement();
65  Identifier id = data->identify();
66 
67  if (!element) {
68  if (msgLvl(MSG::WARNING)) ATH_MSG_WARNING("No MuonGM::TgcReadoutElement for hit " << id);
69  continue;
70  }
71 
72  Amg::Vector3D globalPos;
73  double shortWidth, longWidth, length;
74  if (m_idHelperSvc->tgcIdHelper().isStrip(id)) {
75  int gasGap = m_idHelperSvc->tgcIdHelper().gasGap(id);
76  int strip = m_idHelperSvc->tgcIdHelper().channel(id);
77  shortWidth = element->stripShortWidth(gasGap, strip);
78  longWidth = element->stripLongWidth(gasGap, strip);
79  length = element->stripLength();
80  globalPos = element->stripPos(gasGap, strip);
81  } else {
82  int gasGap = m_idHelperSvc->tgcIdHelper().gasGap(id);
83  int gang = m_idHelperSvc->tgcIdHelper().channel(id);
84  shortWidth = element->gangShortWidth(gasGap, gang);
85  longWidth = element->gangLongWidth(gasGap, gang);
86  length = element->gangRadialLength(gasGap, gang);
87  globalPos = element->wireGangPos(gasGap, gang);
88  }
89 
90  x.push_back(DataType(globalPos.x()/CLHEP::cm));
91  y.push_back(DataType(globalPos.y()/CLHEP::cm));
92  z.push_back(DataType(globalPos.z()/CLHEP::cm));
93  swidthVec.push_back(DataType(shortWidth/CLHEP::cm));
94  lwidthVec.push_back(DataType(longWidth/CLHEP::cm));
95  lengthVec.push_back(DataType(length/CLHEP::cm));
96  identifierVec.push_back(DataType(MuonFullIDHelper::getFullID(id, m_idHelperSvc->tgcIdHelper())));
97  idVec.push_back(DataType( id.get_compact() ));
98  barcode.push_back(DataType(0));
99 
100  }
101  }
102 
103  DataMap myDataMap;
104  myDataMap["x"] = x;
105  myDataMap["y"] = y;
106  myDataMap["z"] = z;
107  myDataMap["length"] = lengthVec;
108  myDataMap["swidth"] = swidthVec;
109  myDataMap["lwidth"] = lwidthVec;
110  myDataMap["identifier"] = identifierVec;
111  myDataMap["id"] = idVec;
112  myDataMap["barcode"] = barcode;
113 
114  //Be verbose
115  ATH_MSG_DEBUG(dataTypeName() << ": "<< x.size());
116 
118  //return FormatTool->AddToEvent(dataTypeName(), m_sgKey, &myDataMap);
121  std::string emptyStr="";
122  return FormatTool->AddToEvent(dataTypeName(), m_sgKey.key(), &myDataMap);
123  }
124 }
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
dumpTgcDigiDeadChambers.gasGap
list gasGap
Definition: dumpTgcDigiDeadChambers.py:33
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
TgcPrepDataRetriever.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
JiveXML::TgcPrepDataRetriever::m_sgKey
SG::ReadHandleKey< Muon::TgcPrepDataContainer > m_sgKey
The storegate key for the TGC collection.
Definition: TgcPrepDataRetriever.h:41
JiveXML::DataVect
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
Definition: DataType.h:58
DataType
OFFLINE_FRAGMENTS_NAMESPACE::PointerType DataType
Definition: RoIBResultByteStreamTool.cxx:25
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
MuonGM::TgcReadoutElement::stripLength
double stripLength() const
Returns the length of each strip which is equal to the height of the chamber.
JiveXML::TgcPrepDataRetriever::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: TgcPrepDataRetriever.h:43
JiveXML::DataMap
std::map< std::string, DataVect > DataMap
Definition: DataType.h:59
JiveXML::TgcPrepDataRetriever::retrieve
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
Definition: TgcPrepDataRetriever.cxx:34
x
#define x
MuonGM::TgcReadoutElement::wireGangPos
Amg::Vector3D wireGangPos(const Identifier &id) const
Returns the global position of a wireGang.
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
MuonGM::TgcReadoutElement::gangLongWidth
double gangLongWidth(int gasGap, int gang) const
Returns the length of the most top wire in the gang.
Definition: MuonDetDescr/MuonReadoutGeometry/src/TgcReadoutElement.cxx:86
z
#define z
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
MuonGM::TgcReadoutElement::gangShortWidth
double gangShortWidth(int gasGap, int gang) const
Returns the length of the most bottom wire in the gang.
Definition: MuonDetDescr/MuonReadoutGeometry/src/TgcReadoutElement.cxx:79
MuonGM::TgcReadoutElement
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcReadoutElement.h:42
test_pyathena.parent
parent
Definition: test_pyathena.py:15
MuonGM::TgcReadoutElement::gangRadialLength
double gangRadialLength(int gasGap, int gang) const
Returns the length of the wire gang along the radial direction [pitch x N_{wire}^{gang}].
Definition: MuonDetDescr/MuonReadoutGeometry/src/TgcReadoutElement.cxx:72
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
IdentifiableContainerMT::end
const_iterator end() const
return const_iterator for end of container
Definition: IdentifiableContainerMT.h:242
IdentifiableContainerMT::const_iterator
Definition: IdentifiableContainerMT.h:82
IdentifiableContainerMT::begin
const_iterator begin() const
return const_iterator for first entry
Definition: IdentifiableContainerMT.h:236
Muon::MuonPrepDataCollection
Template to hold collections of MuonPrepRawData objects.
Definition: MuonPrepDataCollection.h:46
JiveXML
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
Definition: BadLArRetriever.cxx:22
MuonGM::TgcReadoutElement::stripPos
Amg::Vector3D stripPos(int gasGap, int strip) const
Returns the global position of a strip.
JiveXML::TgcPrepDataRetriever::TgcPrepDataRetriever
TgcPrepDataRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Definition: TgcPrepDataRetriever.cxx:14
MuonGM::TgcReadoutElement::stripLongWidth
double stripLongWidth(int, int) const
Definition: MuonDetDescr/MuonReadoutGeometry/src/TgcReadoutElement.cxx:162
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
JiveXML::MuonFullIDHelper::getFullID
std::string getFullID(Identifier id, const MdtIdHelper &mdtHelper)
Get the identifier string for an MDT ID with the sequence: Detector/StationName/StationEta/StationPhi...
Definition: MuonFullIDHelper.cxx:26
MuonGM::TgcReadoutElement::stripShortWidth
double stripShortWidth(int, int) const
Definition: MuonDetDescr/MuonReadoutGeometry/src/TgcReadoutElement.cxx:150
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
JiveXML::TgcPrepDataRetriever::dataTypeName
virtual std::string dataTypeName() const
Return the name of the data type.
Definition: TgcPrepDataRetriever.h:32
JiveXML::TgcPrepDataRetriever::initialize
StatusCode initialize()
Default AthAlgTool methods.
Definition: TgcPrepDataRetriever.cxx:23
y
#define y
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Muon::TgcPrepData
Class to represent TGC measurements.
Definition: TgcPrepData.h:32
TgcReadoutElement.h
MuonFullIDHelper.h
AthAlgTool
Definition: AthAlgTool.h:26
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Identifier
Definition: IdentifierFieldParser.cxx:14