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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
#ifndef DQWorkerTask_H
#define DQWorkerTask_H
#include "DQM/EcalCommon/interface/DQWorker.h"
#include "DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h"
#include "Collections.h"
#include <bitset>
namespace edm {
class TriggerResultsByName;
class ConsumesCollector;
} // namespace edm
namespace ecaldqm {
struct Dependency {
Collections dependant;
std::set<Collections> requisite;
Dependency() : dependant(Collections(-1)), requisite() {}
Dependency(Collections _d, int _r1 = -1, int _r2 = -1, int _r3 = -1, int _r4 = -1) : dependant(_d), requisite() {
if (_r1 >= 0)
append(Collections(_r1));
if (_r2 >= 0)
append(Collections(_r2));
if (_r3 >= 0)
append(Collections(_r3));
if (_r4 >= 0)
append(Collections(_r4));
}
void append(Collections _r) {
if (_r != int(dependant))
requisite.insert(_r);
}
void append(std::set<Collections> const& _s) {
for (std::set<Collections>::const_iterator sItr(_s.begin()); sItr != _s.end(); ++sItr)
append(*sItr);
}
};
struct DependencySet {
DependencySet() : set_() {}
void push_back(Dependency const& _d) {
std::vector<Dependency>::iterator dItr(set_.begin());
std::vector<Dependency>::iterator dEnd(set_.end());
for (; dItr != dEnd; ++dItr)
if (dItr->dependant == _d.dependant)
dItr->append(_d.requisite);
if (dItr == dEnd)
set_.push_back(_d);
}
std::vector<Collections> formSequence() const {
std::vector<Collections> sequence;
for (unsigned iD(0); iD < set_.size(); iD++) {
if (std::find(sequence.begin(), sequence.end(), set_[iD].dependant) != sequence.end())
continue;
formSequenceFragment_(set_[iD], sequence, sequence.end());
}
return sequence;
}
private:
std::vector<Dependency> set_;
void formSequenceFragment_(Dependency const&, std::vector<Collections>&, std::vector<Collections>::iterator) const;
};
class DQWorkerTask : public DQWorker {
public:
typedef EcalDCCHeaderBlock::EcalDCCEventSettings EventSettings;
DQWorkerTask();
~DQWorkerTask() override {}
static void fillDescriptions(edm::ParameterSetDescription&);
virtual void beginEvent(edm::Event const&, edm::EventSetup const&, bool const&, bool&) {}
virtual void endEvent(edm::Event const&, edm::EventSetup const&) {}
virtual bool filterRunType(short const*) { return true; };
virtual bool filterTrigger(edm::TriggerResultsByName const&) { return true; };
virtual void addDependencies(DependencySet&) {}
// mechanisms to register EDGetTokens for any additional objects used internally
virtual void setTokens(edm::ConsumesCollector&) {}
// "Dry-run" mode when passed a null pointer
// Returns true if the module runs on the collection
virtual bool analyze(void const*, Collections) { return false; }
protected:
void setME(edm::ParameterSet const&) final;
};
} // namespace ecaldqm
#endif
|