Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
#include <MuonTruthSegmentCreationAlg.h>
|
virtual StatusCode | initialize () override |
|
virtual StatusCode | execute (const EventContext &ctx) const override |
|
virtual StatusCode | sysInitialize () override |
| Override sysInitialize. More...
|
|
virtual bool | isClonable () const override |
| Specify if the algorithm is clonable. More...
|
|
virtual unsigned int | cardinality () const override |
| Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant. More...
|
|
virtual StatusCode | sysExecute (const EventContext &ctx) override |
| Execute an algorithm. More...
|
|
virtual const DataObjIDColl & | extraOutputDeps () const override |
| Return the list of extra output dependencies. More...
|
|
virtual bool | filterPassed (const EventContext &ctx) const |
|
virtual void | setFilterPassed (bool state, const EventContext &ctx) const |
|
ServiceHandle< StoreGateSvc > & | evtStore () |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
|
StatusCode | fillChamberIdMap (const EventContext &ctx, const xAOD::TruthParticle &truthParticle, ChamberIdMap &ids) const |
| This function uses the 6 vectors, contained in. More...
|
|
StatusCode | createSegments (const EventContext &ctx, const ElementLink< xAOD::TruthParticleContainer > &truthLink, const ChamberIdMap &ids, xAOD::MuonSegmentContainer &segmentContainer) const |
| This function performs, for each truth muon, the actual segment creation and stores segments into a new container
More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKey> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &) |
| specialization for handling Gaudi::Property<SG::VarHandleBase> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &) |
| specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
|
|
|
SG::ReadHandleKey< xAOD::TruthParticleContainer > | m_muonTruth {this, "muonTruth", "MuonTruthParticles"} |
| Key for the truth muon container and muon origin decoration. More...
|
|
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > | m_truthOriginKey {this, "truthOriginKey", m_muonTruth, "truthOrigin"} |
|
SG::ReadDecorHandleKeyArray< xAOD::TruthParticleContainer, std::vector< unsigned long long > > | m_truthHitsKeyArray {this, "truthHitsKeyArray", { }} |
| Keys of the truth muon decorations that we need to read to (re-)fill the chamberIdMap. More...
|
|
SG::WriteHandleKey< xAOD::MuonSegmentContainer > | m_muonTruthSegmentContainerName {this, "MuonTruthSegmentName", "MuonTruthSegments"} |
| Key for segment container that will be populated with segments. More...
|
|
SG::ReadHandleKeyArray< MuonSimDataCollection > | m_SDO_TruthNames |
| Keys for all çontainers of muon hit simulation data, classified by detector technology. More...
|
|
SG::ReadHandleKey< CscSimDataCollection > | m_CSC_SDO_TruthNames {this, "CSCSDOs", "CSC_SDO"} |
|
ServiceHandle< Muon::IMuonIdHelperSvc > | m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"} |
| Handle for the muonIdHelper service. More...
|
|
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > | m_detMgrKey |
| MuonDetectorManager from the conditions store. More...
|
|
DataObjIDColl | m_extendedExtraObjects |
| Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks. More...
|
|
StoreGateSvc_t | m_evtStore |
| Pointer to StoreGate (event store by default) More...
|
|
StoreGateSvc_t | m_detStore |
| Pointer to StoreGate (detector store by default) More...
|
|
std::vector< SG::VarHandleKeyArray * > | m_vhka |
|
bool | m_varHandleArraysDeclared |
|
◆ ChamberIdMap
This map contains all the hits corresponding to truth muons classified by chamber layer that recorded them.
ChIndex is the chamber layer index (e.g. BMS, BOL,...), while Identifier is the hit ID, which represents the channel where the hit has been recorded.
Definition at line 52 of file MuonTruthSegmentCreationAlg.h.
◆ StoreGateSvc_t
◆ cardinality()
Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.
Override this to return 0 for reentrant algorithms.
Override this to return 0 for reentrant algorithms.
Definition at line 75 of file AthCommonReentrantAlgorithm.cxx.
◆ createSegments()
This function performs, for each truth muon, the actual segment creation and stores segments into a new container
- Parameters
-
segmentContainer. | Firstly, we retrieve simulation data from m_SDO_TruthNames and copy it into a new vector, keeping only the data corresponding to the correct detector technologies. Then, we loop over chamber layers and over the corresponding hit IDs, both provided by |
ids,and | we store: *- gas-gap for hits with a phi measurement -> phiLayers *- gas-gap for hits recorded by MM or CSC -> precLayers *- 10*multi-layer + tube_layer for hits recorded by MDT -> precLayers *- gas-gap for hits recorded by trigger chambers without phi measurement -> etaLayers Then, in the same loop over hit IDs, we retrieve simulation data for that hit, specifically the global position, needed to retrieve for each chamber layer the pair of hits with the largest distance. If a pair of hits is found and at least three precision measurements are available, we proceed with the truth segment creation. We create a segment obj and we fill it with number and type (see above) of hits available, the |
truthLink | link to the corresponding truth muon, and the position and direction of the truth segment, calculated with hit pair global positions. Finally, we append the sector, chamber layer, station eta, and technology of the chamber where the segment was recorded. |
ctx | tells us in which event we are |
truthLink | link to the corresponding truth muons |
ids | chamberIdMap storing truth hit IDs classified by chamber layer |
segmentContainer | segment container |
Definition at line 126 of file MuonTruthSegmentCreationAlg.cxx.
133 std::vector<SG::ReadHandle<MuonSimDataCollection> > sdoCollections(6);
143 if (
index >= (
int)sdoCollections.size()) {
146 sdoCollections[
index] = std::move(
col);
155 for (
const auto& lay :
ids) {
158 bool firstPosSet{
false}, secondPosSet{
false};
161 uint8_t nprecLayers{0}, nphiLayers{0}, ntrigEtaLayers{0};
162 std::set<int> phiLayers, etaLayers, precLayers;
165 for (
const auto&
id : lay.second) {
181 precLayers.insert(iid);
196 if (
index < (
int)sdoCollections.size() && !sdoCollections[
index]->empty()) {
197 auto pos = sdoCollections[
index]->find(
id);
199 gpos =
pos->second.globalPosition();
200 if (gpos.perp() > 0.1) ok =
true;
209 return std::abs(
p1.z()) < std::abs(
p2.z());
211 return p1.perp() <
p2.perp();
216 }
else if (!secondPosSet) {
219 if (isSmaller(secondPos, firstPos))
std::swap(firstPos, secondPos);
222 if (isSmaller(gpos, firstPos))
224 else if (isSmaller(secondPos, gpos))
230 auto pos = cscCollection->find(
id);
231 if (
pos == cscCollection->end()) {
235 ATH_MSG_DEBUG(
"found csc sdo with " <<
pos->second.getdeposits().size() <<
" deposits");
236 Amg::Vector3D locpos(0,
pos->second.getdeposits()[0].second.ypos(),
pos->second.getdeposits()[0].second.zpos());
242 }
else if (!secondPosSet) {
245 if (secondPos.perp() < firstPos.perp())
std::swap(firstPos, secondPos);
247 if (gpos.perp() < firstPos.perp())
249 else if (secondPos.perp() < gpos.perp())
254 if (precLayers.size() > 2) {
255 if (!phiLayers.empty()) nphiLayers = phiLayers.size();
256 ntrigEtaLayers = etaLayers.size();
257 nprecLayers = precLayers.size();
258 ATH_MSG_DEBUG(
" total counts: precision " <<
static_cast<int>(nprecLayers) <<
" phi layers " <<
static_cast<int>(nphiLayers)
259 <<
" eta trig layers " <<
static_cast<int>(ntrigEtaLayers)
261 <<
" truthLink " << truthLink);
264 segment->setNHits(nprecLayers, nphiLayers, ntrigEtaLayers);
266 truthParticleLinkAcc(
"truthParticleLink");
267 truthParticleLinkAcc(*
segment) = truthLink;
273 segment->setIdentifier(sector, chIndex, eta, technology);
275 if (firstPosSet && secondPosSet) {
278 ATH_MSG_DEBUG(
" got position : r " << gpos.perp() <<
" z " << gpos.z() <<
" and direction: theta " << gdir.theta()
279 <<
" phi " << gdir.phi());
280 segment->setPosition(gpos.x(), gpos.y(), gpos.z());
281 segment->setDirection(gdir.x(), gdir.y(), gdir.z());
285 return StatusCode::SUCCESS;
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ detStore()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ execute()
StatusCode Muon::MuonTruthSegmentCreationAlg::execute |
( |
const EventContext & |
ctx | ) |
const |
|
overridevirtual |
Definition at line 60 of file MuonTruthSegmentCreationAlg.cxx.
63 ATH_CHECK(muonTruthContainer.isPresent());
71 segmentContainer.record(std::make_unique<xAOD::MuonSegmentContainer>(), std::make_unique<xAOD::MuonSegmentAuxContainer>()));
72 ATH_MSG_DEBUG(
"Recorded MuonSegmentContainer with key: " << segmentContainer.name());
78 bool goodMuon = bad_origins.find(iOrigin) == bad_origins.end();
83 truthLink.toPersistent();
92 ATH_MSG_DEBUG(
"Registered " << segmentContainer->size() <<
" truth muon segments ");
94 return StatusCode::SUCCESS;
◆ extraDeps_update_handler()
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()
Return the list of extra output dependencies.
This list is extended to include symlinks implied by inheritance relations.
Definition at line 94 of file AthCommonReentrantAlgorithm.cxx.
◆ fillChamberIdMap()
This function uses the 6 vectors, contained in.
- Parameters
-
hitsCollection,carrying | truth muon hit IDs categorized by detector technology (MDT, TGC, RPC, sTGC, CSC, MM) to (re-)fill the |
ids | ChamberIdMap, which contains all truth muon hit IDs classified by chamber layer. This function retrieves the chamber layer from the hit ID by means of the muonIdHelper tool. |
hitsCollection | hit collection |
ids | empty chamberIdMap |
Definition at line 97 of file MuonTruthSegmentCreationAlg.cxx.
104 for (
const unsigned long long& hit_compID : hitCollection(truthParticle)){
119 ids[chIndex].push_back(
id);
123 return StatusCode::SUCCESS;
◆ filterPassed()
◆ initialize()
StatusCode Muon::MuonTruthSegmentCreationAlg::initialize |
( |
| ) |
|
|
overridevirtual |
◆ inputHandles()
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.
◆ isClonable()
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ outputHandles()
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()
◆ renounceArray()
◆ setFilterPassed()
◆ sysExecute()
Execute an algorithm.
We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.
Definition at line 85 of file AthCommonReentrantAlgorithm.cxx.
◆ sysInitialize()
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< Gaudi::Algorithm > >.
Reimplemented in InputMakerBase, and HypoBase.
Definition at line 61 of file AthCommonReentrantAlgorithm.cxx.
110 if (
sc.isFailure()) {
118 if ( cs.retrieve().isFailure() ) {
120 return StatusCode::SUCCESS;
122 if (cs->regHandle(
this,*
h).isFailure()) {
123 sc = StatusCode::FAILURE;
124 ATH_MSG_ERROR(
"unable to register WriteCondHandle " <<
h->fullKey()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
◆ m_CSC_SDO_TruthNames
◆ m_detMgrKey
Initial value:{this, "DetectorManagerKey", "MuonDetectorManager",
"Key of input MuonDetectorManager condition data"}
MuonDetectorManager from the conditions store.
Definition at line 109 of file MuonTruthSegmentCreationAlg.h.
◆ m_detStore
◆ m_evtStore
◆ m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
Empty if no symlinks were found.
Definition at line 114 of file AthCommonReentrantAlgorithm.h.
◆ m_idHelperSvc
◆ m_muonTruth
◆ m_muonTruthSegmentContainerName
◆ m_SDO_TruthNames
Initial value:{
this, "SDOs", {"RPC_SDO", "TGC_SDO", "MDT_SDO" }, "remove NSW by default for now, can always be changed in the configuration"}
Keys for all çontainers of muon hit simulation data, classified by detector technology.
Definition at line 101 of file MuonTruthSegmentCreationAlg.h.
◆ m_truthHitsKeyArray
Keys of the truth muon decorations that we need to read to (re-)fill the chamberIdMap.
Each key corresponds to the decorator containing hit IDs for each muon for a specific detector technology.
Definition at line 95 of file MuonTruthSegmentCreationAlg.h.
◆ m_truthOriginKey
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
static const std::string & chName(ChIndex index)
convert ChIndex into a string
SG::ReadDecorHandleKeyArray< xAOD::TruthParticleContainer, std::vector< unsigned long long > > m_truthHitsKeyArray
Keys of the truth muon decorations that we need to read to (re-)fill the chamberIdMap.
SG::ReadHandleKey< CscSimDataCollection > m_CSC_SDO_TruthNames
Helper class to provide type-safe access to aux data.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
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)
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
Class describing a MuonSegment.
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_truthOriginKey
#define ATH_MSG_VERBOSE(x)
bool empty() const
Test if the key is blank.
bool is_valid() const
Check if id is in a valid state.
PhiIndex
enum to classify the different phi layers in the muon spectrometer
virtual void setOwner(IDataHandleHolder *o)=0
int truthOrigin(const U &p)
virtual const DataObjIDColl & extraOutputDeps() const override
Return the list of extra output dependencies.
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_detMgrKey
MuonDetectorManager from the conditions store.
Handle class for reading a decoration on an object.
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
::StatusCode StatusCode
StatusCode definition for legacy code.
Class describing a truth particle in the MC record.
virtual StatusCode sysExecute(const EventContext &ctx) override
Execute an algorithm.
StatusCode createSegments(const EventContext &ctx, const ElementLink< xAOD::TruthParticleContainer > &truthLink, const ChamberIdMap &ids, xAOD::MuonSegmentContainer &segmentContainer) const
This function performs, for each truth muon, the actual segment creation and stores segments into a n...
SG::WriteHandleKey< xAOD::MuonSegmentContainer > m_muonTruthSegmentContainerName
Key for segment container that will be populated with segments.
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_muonTruth
Key for the truth muon container and muon origin decoration.
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
SG::ReadHandleKeyArray< MuonSimDataCollection > m_SDO_TruthNames
Keys for all çontainers of muon hit simulation data, classified by detector technology.
virtual void renounce()=0
StatusCode fillChamberIdMap(const EventContext &ctx, const xAOD::TruthParticle &truthParticle, ChamberIdMap &ids) const
This function uses the 6 vectors, contained in.
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
ElementLink implementation for ROOT usage.
Amg::Vector3D localToGlobalCoords(const Amg::Vector3D &x, const Identifier &id) const
localToGlobalCoords and Transf connect the Gas Gap Frame (defined as a Sensitive Detector) to the Glo...
value_type push_back(value_type pElem)
Add an element to the end of the collection.
StatusCode initialize(bool used=true)
Eigen::Matrix< double, 3, 1 > Vector3D
std::map< Muon::MuonStationIndex::ChIndex, std::vector< Identifier > > ChamberIdMap
This map contains all the hits corresponding to truth muons classified by chamber layer that recorded...
#define ATH_MSG_WARNING(x)
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
ChIndex
enum to classify the different chamber layers in the muon spectrometer
virtual StatusCode sysInitialize() override
Override sysInitialize.
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
TechnologyIndex
enum to classify the different layers in the muon spectrometer
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Handle for the muonIdHelper service.
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)