test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DQWorkerTask.h
Go to the documentation of this file.
1 #ifndef DQWorkerTask_H
2 #define DQWorkerTask_H
3 
5 
7 
8 #include "Collections.h"
9 
10 #include <bitset>
11 
12 namespace edm
13 {
15  class ConsumesCollector;
16 }
17 
18 namespace ecaldqm
19 {
20 
21  struct Dependency {
23  std::set<Collections> requisite;
24 
26  Dependency(Collections _d, int _r1 = -1, int _r2 = -1, int _r3 = -1, int _r4 = -1) :
27  dependant(_d),
28  requisite()
29  {
30  if(_r1 >= 0) append(Collections(_r1));
31  if(_r2 >= 0) append(Collections(_r2));
32  if(_r3 >= 0) append(Collections(_r3));
33  if(_r4 >= 0) append(Collections(_r4));
34  }
36  {
37  if(_r != int(dependant)) requisite.insert(_r);
38  }
39  void append(std::set<Collections> const& _s)
40  {
41  for(std::set<Collections>::const_iterator sItr(_s.begin()); sItr != _s.end(); ++sItr)
42  append(*sItr);
43  }
44  };
45 
46  struct DependencySet {
48  set_()
49  {}
50  void push_back(Dependency const& _d)
51  {
52  std::vector<Dependency>::iterator dItr(set_.begin());
53  std::vector<Dependency>::iterator dEnd(set_.end());
54  for(; dItr != dEnd; ++dItr)
55  if(dItr->dependant == _d.dependant) dItr->append(_d.requisite);
56  if(dItr == dEnd) set_.push_back(_d);
57  }
58  std::vector<Collections> formSequence() const
59  {
60  std::vector<Collections> sequence;
61  for(unsigned iD(0); iD < set_.size(); iD++){
62  if(std::find(sequence.begin(), sequence.end(), set_[iD].dependant) != sequence.end()) continue;
63  formSequenceFragment_(set_[iD], sequence, sequence.end());
64  }
65  return sequence;
66  }
67 
68  private:
69  std::vector<Dependency> set_;
70 
71  void formSequenceFragment_(Dependency const&, std::vector<Collections>&, std::vector<Collections>::iterator) const;
72  };
73 
74  class DQWorkerTask : public DQWorker {
75  public:
77 
78  DQWorkerTask();
79  virtual ~DQWorkerTask() {}
80 
82 
83  virtual void beginEvent(edm::Event const&, edm::EventSetup const&) {}
84  virtual void endEvent(edm::Event const&, edm::EventSetup const&) {}
85 
86  virtual bool filterRunType(short const*) { return true; };
87  virtual bool filterTrigger(edm::TriggerResultsByName const&) { return true; };
88  virtual void addDependencies(DependencySet&) {}
89 
90  // mechanisms to register EDGetTokens for any additional objects used internally
92 
93  // "Dry-run" mode when passed a null pointer
94  // Returns true if the module runs on the collection
95  virtual bool analyze(void const*, Collections) { return false; }
96 
97  void softReset();
98  void recoverStats();
99 
100  protected:
101  void setME(edm::ParameterSet const&) final;
102 
103  std::set<std::string> resettable_;
104  };
105 }
106 #endif
Collections dependant
Definition: DQWorkerTask.h:22
static void fillDescriptions(edm::ParameterSetDescription &)
Definition: DQWorkerTask.cc:17
void append(Collections _r)
Definition: DQWorkerTask.h:35
virtual bool analyze(void const *, Collections)
Definition: DQWorkerTask.h:95
void formSequenceFragment_(Dependency const &, std::vector< Collections > &, std::vector< Collections >::iterator) const
Definition: DQWorkerTask.cc:57
Dependency(Collections _d, int _r1=-1, int _r2=-1, int _r3=-1, int _r4=-1)
Definition: DQWorkerTask.h:26
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
virtual void beginEvent(edm::Event const &, edm::EventSetup const &)
Definition: DQWorkerTask.h:83
virtual void addDependencies(DependencySet &)
Definition: DQWorkerTask.h:88
virtual bool filterRunType(short const *)
Definition: DQWorkerTask.h:86
virtual void endEvent(edm::Event const &, edm::EventSetup const &)
Definition: DQWorkerTask.h:84
EcalDCCHeaderBlock::EcalDCCEventSettings EventSettings
Definition: DQWorkerTask.h:76
std::vector< Collections > formSequence() const
Definition: DQWorkerTask.h:58
virtual bool filterTrigger(edm::TriggerResultsByName const &)
Definition: DQWorkerTask.h:87
void setME(edm::ParameterSet const &) final
Definition: DQWorkerTask.cc:23
std::vector< Dependency > set_
Definition: DQWorkerTask.h:69
std::set< Collections > requisite
Definition: DQWorkerTask.h:23
std::set< std::string > resettable_
Definition: DQWorkerTask.h:103
void append(std::set< Collections > const &_s)
Definition: DQWorkerTask.h:39
virtual void setTokens(edm::ConsumesCollector &)
Definition: DQWorkerTask.h:91
void push_back(Dependency const &_d)
Definition: DQWorkerTask.h:50