EventLoaderTimepix3.h 2.08 KB
Newer Older
1
2
3
#ifndef TIMEPIX3EVENTLOADER_H
#define TIMEPIX3EVENTLOADER_H 1

4
5
6
#include <TCanvas.h>
#include <TH1F.h>
#include <TH2F.h>
Simon Spannagel's avatar
Simon Spannagel committed
7
#include <stdio.h>
8
#include "core/module/Module.hpp"
Simon Spannagel's avatar
Simon Spannagel committed
9
#include "objects/Pixel.hpp"
10
#include "objects/SpidrSignal.hpp"
11

12
namespace corryvreckan {
13
    /** @ingroup Modules
Simon Spannagel's avatar
Simon Spannagel committed
14
     */
15
    class EventLoaderTimepix3 : public Module {
Simon Spannagel's avatar
Simon Spannagel committed
16
17
18

    public:
        // Constructors and destructors
19
        EventLoaderTimepix3(Configuration config, std::shared_ptr<Detector> detector);
20
        ~EventLoaderTimepix3() {}
Simon Spannagel's avatar
Simon Spannagel committed
21
22

        // Standard algorithm functions
23
        void initialise();
24
        StatusCode run(std::shared_ptr<Clipboard> clipboard);
25
26
27

    private:
        std::shared_ptr<Detector> m_detector;
Simon Spannagel's avatar
Simon Spannagel committed
28

29
30
31
        // ROOT graphs
        TH1F* pixelToT_beforecalibration;
        TH1F* pixelToT_aftercalibration;
32
33
34
35
36
37
38
        TH2F* pixelTOTParameterA;
        TH2F* pixelTOTParameterB;
        TH2F* pixelTOTParameterC;
        TH2F* pixelTOTParameterT;
        TH2F* pixelTOAParameterC;
        TH2F* pixelTOAParameterD;
        TH2F* pixelTOAParameterT;
39
        TH1F* timeshiftPlot;
40

41
        bool loadData(std::shared_ptr<Clipboard> clipboard, Pixels*, SpidrSignals*);
42
        void loadCalibration(std::string path, char delim, std::vector<std::vector<float>>& dat);
43
        void maskPixels(std::string);
44

45
        // configuration paramaters:
46
        std::string m_inputDirectory;
47

48
        bool temporalSplit;
49
        size_t m_numberPixelHits;
50

51
52
53
54
55
56
57
        bool applyCalibration;
        std::string calibrationPath;
        std::string threshold;

        std::vector<std::vector<float>> vtot;
        std::vector<std::vector<float>> vtoa;

58
        // Member variables
59
60
        std::vector<std::unique_ptr<std::ifstream>> m_files;
        std::vector<std::unique_ptr<std::ifstream>>::iterator m_file_iterator;
61

62
63
64
65
        unsigned long long int m_syncTime;
        bool m_clearedHeader;
        long long int m_syncTimeTDC;
        int m_TDCoverflowCounter;
66

67
        long long int m_currentEvent;
68

69
        unsigned long long int m_prevTime;
Simon Spannagel's avatar
Simon Spannagel committed
70
71
        bool m_shutterOpen;
    };
72
} // namespace corryvreckan
73
#endif // TIMEPIX3EVENTLOADER_H