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  std::vector<ecaldqm::Collections> collectionsToSkip;
49  for (const auto& skipColName : skipCollections_) {
50  for (unsigned iCol = 0; iCol <= ecaldqm::nCollections; iCol++) {
51  if (iCol == ecaldqm::nCollections)
52  throw cms::Exception("InvalidConfiguration")
53  << moduleName_ << "::formSchedule: Collection name " << skipColName << " in skipCollections does not exist";
54  if (skipColName == ecaldqm::collectionName[iCol]) {
55  collectionsToSkip.push_back(ecaldqm::Collections(iCol));
56  break;
57  }
58  }
59  }
60 
61  for (std::vector<ecaldqm::Collections>::const_iterator colItr(_preSchedule.begin()); colItr != _preSchedule.end();
62  ++colItr) {
63  std::pair<Processor, ecaldqm::Collections> sch;
64 
66 
67  auto skipItr = std::find(collectionsToSkip.begin(), collectionsToSkip.end(), *colItr);
68  if (skipItr != collectionsToSkip.end()) {
69  if (verbosity_ > 0)
70  edm::LogInfo("EcalDQM") << moduleName_ << ": Skipping collection " << ecaldqm::collectionName[*colItr]
71  << " and removing from schedule";
72  collectionsToSkip.erase(skipItr);
73  continue;
74  }
75 
76  switch (*colItr) {
77  case ecaldqm::kSource:
78  collectionTokens_[*colItr] = edm::EDGetToken(consumes<FEDRawDataCollection>(tag));
79  sch.first = &EcalDQMonitorTask::runOnCollection<FEDRawDataCollection>;
80  break;
82  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalRawDataCollection>(tag));
83  sch.first = &EcalDQMonitorTask::runOnCollection<EcalRawDataCollection>;
84  break;
88  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EBDetIdCollection>(tag));
89  sch.first = &EcalDQMonitorTask::runOnCollection<EBDetIdCollection>;
90  break;
94  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EEDetIdCollection>(tag));
95  sch.first = &EcalDQMonitorTask::runOnCollection<EEDetIdCollection>;
96  break;
103  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalElectronicsIdCollection>(tag));
104  sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>;
105  break;
106  case ecaldqm::kEBSrFlag:
107  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EBSrFlagCollection>(tag));
108  sch.first = &EcalDQMonitorTask::runOnCollection<EBSrFlagCollection>;
109  break;
110  case ecaldqm::kEESrFlag:
111  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EESrFlagCollection>(tag));
112  sch.first = &EcalDQMonitorTask::runOnCollection<EESrFlagCollection>;
113  break;
114  case ecaldqm::kEBDigi:
115  case ecaldqm::kEBCpuDigi:
116  case ecaldqm::kEBGpuDigi:
117  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EBDigiCollection>(tag));
118  sch.first = &EcalDQMonitorTask::runOnCollection<EBDigiCollection>;
119  break;
120  case ecaldqm::kEEDigi:
121  case ecaldqm::kEECpuDigi:
122  case ecaldqm::kEEGpuDigi:
123  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EEDigiCollection>(tag));
124  sch.first = &EcalDQMonitorTask::runOnCollection<EEDigiCollection>;
125  break;
127  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalPnDiodeDigiCollection>(tag));
128  sch.first = &EcalDQMonitorTask::runOnCollection<EcalPnDiodeDigiCollection>;
129  break;
132  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalTrigPrimDigiCollection>(tag));
133  sch.first = &EcalDQMonitorTask::runOnCollection<EcalTrigPrimDigiCollection>;
134  break;
145  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalUncalibratedRecHitCollection>(tag));
146  sch.first = &EcalDQMonitorTask::runOnCollection<EcalUncalibratedRecHitCollection>;
147  break;
148  case ecaldqm::kEBRecHit:
150  case ecaldqm::kEERecHit:
156  collectionTokens_[*colItr] = edm::EDGetToken(consumes<EcalRecHitCollection>(tag));
157  sch.first = &EcalDQMonitorTask::runOnCollection<EcalRecHitCollection>;
158  break;
162  sch.first = &EcalDQMonitorTask::runOnCollection<edm::View<reco::CaloCluster> >;
163  break;
166  collectionTokens_[*colItr] = edm::EDGetToken(consumes<reco::SuperClusterCollection>(tag));
167  sch.first = &EcalDQMonitorTask::runOnCollection<reco::SuperClusterCollection>;
168  break;
169  default:
170  throw cms::Exception("InvalidConfiguration") << "Undefined collection " << *colItr;
171  }
172 
173  sch.second = *colItr;
174 
175  schedule_.push_back(sch);
176  }
177  for (const auto& colNotSkipped : collectionsToSkip)
178  edm::LogWarning("EcalDQM") << moduleName_
179  << "::formSchedule: Collection: " << ecaldqm::collectionName[colNotSkipped]
180  << " is not in the schedule but was listed to be skipped";
181 }
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:528
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
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
std::vector< std::string > skipCollections_