CMS 3D CMS Logo

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:
95  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EBDigiCollection>(tag));
96  sch.first = &EcalDQMonitorTask::runOnCollection<EBDigiCollection>;
97  break;
98  case ecaldqm::kEEDigi:
100  case ecaldqm::kEEGpuDigi:
101  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EEDigiCollection>(tag));
102  sch.first = &EcalDQMonitorTask::runOnCollection<EEDigiCollection>;
103  break;
105  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalPnDiodeDigiCollection>(tag));
106  sch.first = &EcalDQMonitorTask::runOnCollection<EcalPnDiodeDigiCollection>;
107  break;
110  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalTrigPrimDigiCollection>(tag));
111  sch.first = &EcalDQMonitorTask::runOnCollection<EcalTrigPrimDigiCollection>;
112  break;
123  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalUncalibratedRecHitCollection>(tag));
124  sch.first = &EcalDQMonitorTask::runOnCollection<EcalUncalibratedRecHitCollection>;
125  break;
126  case ecaldqm::kEBRecHit:
128  case ecaldqm::kEERecHit:
134  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalRecHitCollection>(tag));
135  sch.first = &EcalDQMonitorTask::runOnCollection<EcalRecHitCollection>;
136  break;
140  sch.first = &EcalDQMonitorTask::runOnCollection<edm::View<reco::CaloCluster> >;
141  break;
144  collectionTokens_[*colItr] = edm::EDGetToken(consumes<reco::SuperClusterCollection>(tag));
145  sch.first = &EcalDQMonitorTask::runOnCollection<reco::SuperClusterCollection>;
146  break;
147  default:
148  throw cms::Exception("InvalidConfiguration") << "Undefined collection " << *colItr;
149  }
150 
151  sch.second = *colItr;
152 
153  schedule_.push_back(sch);
154  }
155 }
void formSchedule(std::vector< ecaldqm::Collections > const &, edm::ParameterSet const &)
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1) const
Definition: EcalDQMonitor.h:50
T const * product() const
Definition: Handle.h:70
edm::EDGetToken collectionTokens_[ecaldqm::nCollections]
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:536
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getUntrackedParameter(std::string const &, T const &) const
std::string const collectionName[nCollections]
Definition: Collections.h:59
std::string const moduleName_
Definition: EcalDQMonitor.h:45
Log< level::Info, false > LogInfo
std::vector< std::pair< Processor, ecaldqm::Collections > > schedule_
void runOnCollection(edm::Event const &, ecaldqm::Collections, std::set< ecaldqm::DQWorker *> const &)
Log< level::Warning, false > LogWarning