-
Notifications
You must be signed in to change notification settings - Fork 35
/
Source.h
55 lines (45 loc) · 1.55 KB
/
Source.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef Source_h
#define Source_h
#include <atomic>
#include <chrono>
#include <filesystem>
#include <memory>
#include <mutex>
#include <string>
#include "Framework/Event.h"
#include "DataFormats/FEDRawDataCollection.h"
#include "DataFormats/DigiClusterCount.h"
#include "DataFormats/TrackCount.h"
#include "DataFormats/VertexCount.h"
namespace edm {
class Source {
public:
explicit Source(
int maxEvents, int runForMinutes, ProductRegistry& reg, std::filesystem::path const& datadir, bool validation);
void reconfigure(int maxEvents, int runForMinutes);
void startProcessing();
int maxEvents() const { return maxEvents_; }
int processedEvents() const { return numEvents_; }
// thread safe
std::unique_ptr<Event> produce(int streamId, ProductRegistry const& reg);
private:
int maxEvents_;
// these are all for the mode where the processing length is limited by time
int runForMinutes_;
std::chrono::steady_clock::time_point startTime_;
std::mutex timeMutex_;
std::atomic<int> numEventsTimeLastCheck_ = 0;
std::atomic<bool> shouldStop_ = false;
std::atomic<int> numEvents_ = 0;
EDPutTokenT<FEDRawDataCollection> const rawToken_;
EDPutTokenT<DigiClusterCount> digiClusterToken_;
EDPutTokenT<TrackCount> trackToken_;
EDPutTokenT<VertexCount> vertexToken_;
std::vector<FEDRawDataCollection> raw_;
std::vector<DigiClusterCount> digiclusters_;
std::vector<TrackCount> tracks_;
std::vector<VertexCount> vertices_;
bool const validation_;
};
} // namespace edm
#endif