CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EcalDQMonitorTask2.cc
Go to the documentation of this file.
2 
4 
18 
19 template <typename CollectionClass>
22  std::set<ecaldqm::DQWorker*> const& _enabledTasks) {
24  if (!_evt.getByToken(collectionTokens_[_col], hndl)) {
26  throw cms::Exception("ObjectNotFound")
27  << moduleName_ << "::runOnCollection: " << ecaldqm::collectionName[_col] << " does not exist";
28  edm::LogWarning("EcalDQM") << moduleName_ << "::runOnCollection: " << ecaldqm::collectionName[_col]
29  << " does not exist";
30  return;
31  }
32 
33  CollectionClass const* collection(hndl.product());
34 
36  [collection, _col, &_enabledTasks](ecaldqm::DQWorker* worker) {
37  if (_enabledTasks.find(worker) != _enabledTasks.end())
38  static_cast<ecaldqm::DQWorkerTask*>(worker)->analyze(collection, _col);
39  },
40  "analyze");
41 
42  if (verbosity_ > 1)
43  edm::LogInfo("EcalDQM") << moduleName_ << "::runOn" << ecaldqm::collectionName[_col] << " returning";
44 }
45 
46 void EcalDQMonitorTask::formSchedule(std::vector<ecaldqm::Collections> const& _preSchedule,
47  edm::ParameterSet const& _tagPSet) {
48  for (std::vector<ecaldqm::Collections>::const_iterator colItr(_preSchedule.begin()); colItr != _preSchedule.end();
49  ++colItr) {
50  std::pair<Processor, ecaldqm::Collections> sch;
51 
53 
54  switch (*colItr) {
55  case ecaldqm::kSource:
56  collectionTokens_[*colItr] = edm::EDGetToken(consumes<FEDRawDataCollection>(tag));
57  sch.first = &EcalDQMonitorTask::runOnCollection<FEDRawDataCollection>;
58  break;
60  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalRawDataCollection>(tag));
61  sch.first = &EcalDQMonitorTask::runOnCollection<EcalRawDataCollection>;
62  break;
66  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EBDetIdCollection>(tag));
67  sch.first = &EcalDQMonitorTask::runOnCollection<EBDetIdCollection>;
68  break;
72  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EEDetIdCollection>(tag));
73  sch.first = &EcalDQMonitorTask::runOnCollection<EEDetIdCollection>;
74  break;
81  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalElectronicsIdCollection>(tag));
82  sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>;
83  break;
84  case ecaldqm::kEBSrFlag:
85  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EBSrFlagCollection>(tag));
86  sch.first = &EcalDQMonitorTask::runOnCollection<EBSrFlagCollection>;
87  break;
88  case ecaldqm::kEESrFlag:
89  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EESrFlagCollection>(tag));
90  sch.first = &EcalDQMonitorTask::runOnCollection<EESrFlagCollection>;
91  break;
92  case ecaldqm::kEBDigi:
93  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EBDigiCollection>(tag));
94  sch.first = &EcalDQMonitorTask::runOnCollection<EBDigiCollection>;
95  break;
96  case ecaldqm::kEEDigi:
97  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EEDigiCollection>(tag));
98  sch.first = &EcalDQMonitorTask::runOnCollection<EEDigiCollection>;
99  break;
101  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalPnDiodeDigiCollection>(tag));
102  sch.first = &EcalDQMonitorTask::runOnCollection<EcalPnDiodeDigiCollection>;
103  break;
106  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalTrigPrimDigiCollection>(tag));
107  sch.first = &EcalDQMonitorTask::runOnCollection<EcalTrigPrimDigiCollection>;
108  break;
115  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalUncalibratedRecHitCollection>(tag));
116  sch.first = &EcalDQMonitorTask::runOnCollection<EcalUncalibratedRecHitCollection>;
117  break;
118  case ecaldqm::kEBRecHit:
120  case ecaldqm::kEERecHit:
122  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalRecHitCollection>(tag));
123  sch.first = &EcalDQMonitorTask::runOnCollection<EcalRecHitCollection>;
124  break;
128  sch.first = &EcalDQMonitorTask::runOnCollection<edm::View<reco::CaloCluster> >;
129  break;
132  collectionTokens_[*colItr] = edm::EDGetToken(consumes<reco::SuperClusterCollection>(tag));
133  sch.first = &EcalDQMonitorTask::runOnCollection<reco::SuperClusterCollection>;
134  break;
135  default:
136  throw cms::Exception("InvalidConfiguration") << "Undefined collection " << *colItr;
137  }
138 
139  sch.second = *colItr;
140 
141  schedule_.push_back(sch);
142  }
143 }
T getUntrackedParameter(std::string const &, T const &) const
void formSchedule(std::vector< ecaldqm::Collections > const &, edm::ParameterSet const &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::EDGetToken collectionTokens_[ecaldqm::nCollections]
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1) const
Definition: EcalDQMonitor.h:50
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::string const collectionName[nCollections]
Definition: Collections.h:47
void runOnCollection(edm::Event const &, ecaldqm::Collections, std::set< ecaldqm::DQWorker * > const &)
std::string const moduleName_
Definition: EcalDQMonitor.h:45
Log< level::Info, false > LogInfo
std::vector< std::pair< Processor, ecaldqm::Collections > > schedule_
T const * product() const
Definition: Handle.h:70
Log< level::Warning, false > LogWarning