Commit 0a1fc27f authored by Håkan Wennlöf's avatar Håkan Wennlöf
Browse files

Made AbortEventException subclass of EndOfRunException, and changed handling...

Made AbortEventException subclass of EndOfRunException, and changed handling of getting entries from Event tree.
parent ada8168e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -147,14 +147,14 @@ namespace allpix {
     * This error can be raised by modules if they would like to request an interruption of the current event processing
     * because an issue was detected.
     */
    class AbortEventException : public RuntimeError {
    class AbortEventException : public EndOfRunException {
    public:
        /**
         * @brief Constructs request to abort the current event processing with a description
         * @param reason Text explaining the reason of the requested abortion of the event
         */
        // TODO [doc] the module itself is missing
        explicit AbortEventException(std::string reason) { error_message_ = std::move(reason); }
        explicit AbortEventException(std::string reason) : EndOfRunException(reason) { error_message_ = std::move(reason); }
    };

    /**
+7 −7
Original line number Diff line number Diff line
@@ -171,18 +171,18 @@ void ROOTObjectWriterModule::run(Event* event) {
                branch_name.c_str(), (std::string("std::vector<") + class_name_with_namespace + "*>").c_str(), addr);

            // Prefill new tree or new branch with empty records for all events that were missed since the start
            if(trees_["Event"]->GetEntries() > 0) {
            auto last_event = trees_["Event"]->GetEntries();
            if(last_event > 0) {
                if(new_tree) {
                    LOG(DEBUG) << "Pre-filling new tree of " << class_name << " with " << trees_["Event"]->GetEntries()
                               << " empty events";
                    for(Long64_t i = 0; i < trees_["Event"]->GetEntries(); ++i) {
                    LOG(DEBUG) << "Pre-filling new tree of " << class_name << " with " << last_event << " empty events";
                    for(Long64_t i = 0; i < last_event; ++i) {
                        trees_[class_name]->Fill();
                    }
                } else {
                    LOG(DEBUG) << "Pre-filling new branch " << branch_name << " of " << class_name << " with "
                               << trees_["Event"]->GetEntries() << " empty events";
                    LOG(DEBUG) << "Pre-filling new branch " << branch_name << " of " << class_name << " with " << last_event
                               << " empty events";
                    auto* branch = trees_[class_name]->GetBranch(branch_name.c_str());
                    for(Long64_t i = 0; i < trees_["Event"]->GetEntries(); ++i) {
                    for(Long64_t i = 0; i < last_event; ++i) {
                        branch->Fill();
                    }
                }