void DetectorModule::build() { check(); if (!decorated().builtok()) { decorated().store(propertyTree()); decorated().build(); } if (numSensors() > 0) { for (int i = 0; i < numSensors(); i++) { Sensor* s = GeometryFactory::make<Sensor>(); s->parent(this); s->myid(i+1); s->store(propertyTree()); if (sensorNode.count(i+1) > 0) s->store(sensorNode.at(i+1)); s->build(); sensors_.push_back(s); materialObject_.sensorChannels[i+1]=s->numChannels(); } } else { Sensor* s = GeometryFactory::make<Sensor>(); // fake sensor to avoid defensive programming when iterating over the sensors and the module is empty s->parent(this); s->myid(1); s->build(); sensors_.push_back(s); } materialObject_.store(propertyTree()); materialObject_.build(); }