ATLAS Offline Software
CSCPRDVariables.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
8 
9 namespace MuonPRDTest {
10  CSCPRDVariables::CSCPRDVariables(MuonTesterTree& tree, const std::string& container_name, MSG::Level msglvl) :
11  PrdTesterModule(tree, "PRD_CSC", msglvl), m_key{container_name} {}
13 
14  bool CSCPRDVariables::fill(const EventContext& ctx) {
15  ATH_MSG_DEBUG("do fillCSCPRDVariables()");
16  const MuonGM::MuonDetectorManager* MuonDetMgr = getDetMgr(ctx);
17  if (!MuonDetMgr) { return false; }
19  if (!cscprdContainer.isValid()) {
20  ATH_MSG_FATAL("Failed to retrieve prd container " << m_key.fullKey());
21  return false;
22  }
23 
24  ATH_MSG_DEBUG("retrieved CSC PRD Container with size " << cscprdContainer->size());
25 
26  if (cscprdContainer->size() == 0) ATH_MSG_DEBUG(" CSC PRD Container empty ");
27  unsigned int n_PRD{0};
28  for(auto it : *cscprdContainer ) {
29  const Muon::CscPrepDataCollection*coll = it;
30  for (auto prd: *coll) {
31  Identifier Id = prd->identify();
32 
33  const MuonGM::CscReadoutElement* det = MuonDetMgr->getCscReadoutElement(Id);
34  if (!det) {
35  ATH_MSG_ERROR("The CSC hit "<<idHelperSvc()->toString(Id)<<" does not have a detector element attached. That should actually never happen");
36  return false;
37  }
38 
40  m_CSC_PRD_charge.push_back(prd->charge());
41  m_CSC_PRD_time.push_back(prd->time());
42 
43  Amg::Vector3D pos = prd->globalPosition();
44  Amg::Vector2D loc_pos(0., 0.);
45 
46  det->surface(Id).globalToLocal(pos, Amg::Vector3D(0., 0., 0.), loc_pos);
47 
49 
50  m_CSC_PRD_localPosX.push_back(loc_pos[0]);
51  m_CSC_PRD_localPosY.push_back(loc_pos[1]);
52 
53  ++n_PRD;
54  }
55  }
56  m_CSC_nPRD = n_PRD;
57  ATH_MSG_DEBUG(" finished fillCSCPRDVariables()");
58  return true;
59  }
60 }
MuonPRDTest::CSCPRDVariables::fill
bool fill(const EventContext &ctx) override final
The fill method checks if enough information is provided such that the branch is cleared from the inf...
Definition: CSCPRDVariables.cxx:14
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonPRDTest::CSCPRDVariables::m_CSC_nPRD
ScalarBranch< unsigned int > & m_CSC_nPRD
Definition: CSCPRDVariables.h:24
TRTCalib_Extractor.det
det
Definition: TRTCalib_Extractor.py:36
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
MuonVal::CscIdentifierBranch::push_back
void push_back(const Identifier &id) override final
Definition: IdentifierBranch.cxx:52
tree
TChain * tree
Definition: tile_monitor.h:30
skel.it
it
Definition: skel.GENtoEVGEN.py:396
MuonPRDTest::PrdTesterModule::getDetMgr
const MuonGM::MuonDetectorManager * getDetMgr(const EventContext &ctx) const
Definition: PrdTesterModule.cxx:16
MuonGM::CscReadoutElement
Definition: CscReadoutElement.h:56
MuonVal::MuonTesterBranch::declare_dependency
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
MuonVal::ThreeVectorBranch::push_back
void push_back(const Amg::Vector3D &vec)
interface using the Amg::Vector3D
Definition: ThreeVectorBranch.cxx:23
MuonPRDTest::CSCPRDVariables::CSCPRDVariables
CSCPRDVariables(MuonTesterTree &tree, const std::string &container_name, MSG::Level msglvl)
Definition: CSCPRDVariables.cxx:10
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
MuonVal::MuonTesterTree
Definition: MuonTesterTree.h:30
MuonPRDTest::CSCPRDVariables::m_CSC_PRD_charge
VectorBranch< int > & m_CSC_PRD_charge
Definition: CSCPRDVariables.h:29
MuonGM::MuonDetectorManager::getCscReadoutElement
const CscReadoutElement * getCscReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:225
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MuonPRDTest::CSCPRDVariables::declare_keys
bool declare_keys() override final
Definition: CSCPRDVariables.cxx:12
MuonPRDTest::PrdTesterModule
Definition: PrdTesterModule.h:15
CscReadoutElement.h
MuonPRDTest::CSCPRDVariables::m_CSC_PRD_localPosY
VectorBranch< float > & m_CSC_PRD_localPosY
Definition: CSCPRDVariables.h:26
Muon::MuonPrepDataCollection
Template to hold collections of MuonPrepRawData objects.
Definition: MuonPrepDataCollection.h:46
MuonPRDTest::CSCPRDVariables::m_CSC_PRD_id
CscIdentifierBranch m_CSC_PRD_id
Definition: CSCPRDVariables.h:30
MuonVal::VectorBranch::push_back
void push_back(const T &value)
Adds a new element at the end of the vector.
MuonPRDTest::CSCPRDVariables::m_CSC_PRD_localPosX
VectorBranch< float > & m_CSC_PRD_localPosX
Definition: CSCPRDVariables.h:25
CSCPRDVariables.h
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:50
MuonPRDTest::CSCPRDVariables::m_CSC_PRD_time
VectorBranch< int > & m_CSC_PRD_time
Definition: CSCPRDVariables.h:28
MuonPRDTest
Definition: CSCDigitVariables.h:10
MuonPRDTest::PrdTesterModule::idHelperSvc
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Definition: PrdTesterModule.cxx:15
MuonPRDTest::CSCPRDVariables::m_CSC_PRD_globalPos
ThreeVectorBranch m_CSC_PRD_globalPos
Definition: CSCPRDVariables.h:27
MuonPRDTest::CSCPRDVariables::m_key
SG::ReadHandleKey< Muon::CscPrepDataContainer > m_key
Definition: CSCPRDVariables.h:23
Identifier
Definition: IdentifierFieldParser.cxx:14