24 using namespace DD4hep;
25 using namespace DD4hep::Geometry;
29 : name(c.name), key(c.key), key_min(c.key_min), key_max(c.key_max)
35 : name(n), key(k), key_min(k_min), key_max(k_max)
58 Object& ro = object<Object>();
59 return ro.
hits.size();
61 throw runtime_error(
"DD4hep: Readout::numCollections: Cannot access object data [Invalid Handle]");
68 Object& ro = object<Object>();
69 if ( !ro.
hits.empty() ) {
70 for(Object::Collections::const_iterator i=ro.
hits.begin(); i!=ro.
hits.end(); ++i)
71 colls.push_back((*i).name);
75 throw runtime_error(
"DD4hep: Readout::collectionsNames: Cannot access object data [Invalid Handle]");
80 vector<const HitCollection*> colls;
82 Object& ro = object<Object>();
83 if ( !ro.
hits.empty() ) {
84 for(Object::Collections::const_iterator i=ro.
hits.begin(); i!=ro.
hits.end(); ++i)
85 colls.push_back(&(*i));
89 throw runtime_error(
"DD4hep: Readout::collections: Cannot access object data [Invalid Handle]");
95 if (new_descriptor.isValid()) {
96 data<Object>()->
id = new_descriptor;
99 if ( seg.isValid() ) {
100 seg.setDecoder(
id.decoder());
105 throw runtime_error(
"DD4hep: Readout::setIDDescriptor: Cannot assign ID descriptor [Invalid Handle]");
110 return object<Object>().
id;
116 Object& ro = object<Object>();
118 if ( e && e != seg.
ptr() ) {
126 throw runtime_error(
"DD4hep: Readout::setSegmentation: Cannot assign segmentation [Invalid Handle]");
bool isValid() const
Check the validity of the object held by the handle.
HitCollection()
Default constructor.
std::string key
Discriminator key name from the <id> string.
size_t numCollections() const
Access number of hit collections.
Readout()=default
Default constructor.
std::vector< const Collection * > collections() const
Access hit collections if present.
T * ptr() const
Access to the held object.
Collections hits
Hit collection container (if defined)
Segmentation segmentation
Handle to the readout segmentation.
void assign(Implementation *n, const std::string &nam, const std::string &title)
Assign a new named object. Note: object references must be managed by the user.
IDDescriptor idSpec() const
Access IDDescription structure.
Handle class supporting generic Segmentation of sensitive detectors.
void setIDDescriptor(const Ref_t &spec) const
Assign IDDescription to readout structure.
Segmentation segmentation() const
Access segmentation structure.
std::vector< std::string > collectionNames() const
Access explicit names of hit collections if present.
Handle< NamedObject > Ref_t
Default Ref_t definition describing named objects.
long key_min
Range values of the key is not empty.
HitCollection & operator=(const HitCollection &c)
Assignment operator.
Definition of the HitCollection parameters used by the Readout.
Concrete object implementation of the Readout Handle.
std::string name
Hit collection name.
void setSegmentation(const Segmentation &segment) const
Assign segmentation structure to readout.
Class implementing the ID encoding of detector response.