EventLoaderEUDAQ2.h 3.42 KB
Newer Older
1
2
3
/**
 * @file
 * @brief Definition of [EventLoaderEUDAQ2] module
4
 * @copyright Copyright (c) 2019 CERN and the Corryvreckan authors.
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 * This software is distributed under the terms of the MIT License, copied verbatim in the file "LICENSE.md".
 * In applying this license, CERN does not waive the privileges and immunities granted to it by virtue of its status as an
 * Intergovernmental Organization or submit itself to any jurisdiction.
 *
 * Contains minimal dummy module to use as a start for the development of your own module
 *
 * Refer to the User's Manual for more details.
 */

#include <TCanvas.h>
#include <TH1F.h>
#include <TH2F.h>
#include <iostream>
#include "core/module/Module.hpp"
19
#include "eudaq/FileReader.hh"
20
21
#include "eudaq/StandardEvent.hh"
#include "eudaq/StdEventConverter.hh"
22
23
24
25
26
27
28
29
30
31
32
33
#include "objects/Cluster.hpp"
#include "objects/Pixel.hpp"
#include "objects/Track.hpp"

namespace corryvreckan {
    /** @ingroup Modules
     * @brief Module to do function
     *
     * More detailed explanation of module
     */
    class EventLoaderEUDAQ2 : public Module {

34
35
36
37
38
39
40
41
42
        enum class EventPosition {
            UNKNOWN, // StandardEvent position unknown
            BEFORE,  // StandardEvent is before current event
            DURING,  // StandardEvent is during current event
            AFTER,   // StandardEvent is after current event
        };

        class EndOfFile : public Exception {};

43
44
45
46
47
48
    public:
        /**
         * @brief Constructor for this unique module
         * @param config Configuration object for this module as retrieved from the steering file
         * @param detector Pointer to the detector for this module instance
         */
49
        EventLoaderEUDAQ2(Configuration config, std::shared_ptr<Detector> detector);
50
51
52
53
54
55
56
57
58
59
60
61

        /**
         * @brief [Initialise this module]
         */
        void initialise();

        /**
         * @brief [Run the function of this module]
         */
        StatusCode run(std::shared_ptr<Clipboard> clipboard);

    private:
62
        /**
63
         * @brief Read and return the next event (smallest possible granularity) and return the decoded StandardEvent
64
         */
65
        std::shared_ptr<eudaq::StandardEvent> get_next_event();
66

67
        /**
68
69
70
71
         * @brief Check whether the current EUDAQ StandardEvent is within the defined Corryvreckan event
         * @param  clipboard  Shared pointer to the event clipboard
         * @param  evt        The EUDAQ StandardEvent to check
         * @return            Position of the StandardEvent with respect to the current Corryvreckan event
72
         */
73
        EventPosition is_within_event(std::shared_ptr<Clipboard> clipboard, std::shared_ptr<eudaq::StandardEvent> evt);
74
75

        /**
76
77
78
         * @brief Store pixel data from relevant detectors on the clipboard
         * @param clipboard Shared pointer to the event clipboard
         * @param evt       StandardEvent to read the pixel data from
79
         */
80
        void store_data(std::shared_ptr<Clipboard> clipboard, std::shared_ptr<eudaq::StandardEvent> evt);
81

82
83
        std::shared_ptr<Detector> m_detector;
        std::string m_filename{};
84
        double m_skip_time{};
85

86
87
88
89
90
91
        // EUDAQ file reader instance to retrieve data from
        eudaq::FileReaderUP reader_;
        // Buffer of undecoded EUDAQ events
        std::vector<eudaq::EventSPC> events_;
        // Currently processed decoded EUDAQ StandardEvent:
        std::shared_ptr<eudaq::StandardEvent> event_;
92
93
94
    };

} // namespace corryvreckan