CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
EcalDQMonitorTask Class Reference

#include <EcalDQMonitorTask.h>

Inheritance diagram for EcalDQMonitorTask:
EcalDQMonitor edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 EcalDQMonitorTask (edm::ParameterSet const &)
 
 ~EcalDQMonitorTask ()
 
- Public Member Functions inherited from EcalDQMonitor
 EcalDQMonitor (const edm::ParameterSet &)
 
virtual ~EcalDQMonitor ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Private Types

typedef void(EcalDQMonitorTask::* Processor )(edm::Event const &, ecaldqm::Collections)
 

Private Member Functions

void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
void beginRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
void endRun (edm::Run const &, edm::EventSetup const &)
 
void formSchedule_ (std::vector< ecaldqm::Collections > const &, std::multimap< ecaldqm::Collections, ecaldqm::Collections > const &)
 
void registerCollection (ecaldqm::Collections, edm::InputTag const &)
 
template<class C >
void runOnCollection (edm::Event const &, ecaldqm::Collections)
 
template<>
void runOnCollection (edm::Event const &_evt, ecaldqm::Collections _collection)
 

Private Attributes

bool allowMissingCollections_
 
edm::EDGetToken collectionTokens_ [ecaldqm::nCollections]
 
std::map
< ecaldqm::DQWorkerTask
*, bool > 
enabled_
 
bool evaluateTime_
 
int ievt_
 
std::vector< std::pair
< Processor,
ecaldqm::Collections > > 
schedule_
 
std::vector
< ecaldqm::DQWorkerTask * > 
taskLists_ [ecaldqm::nCollections]
 
std::map
< ecaldqm::DQWorkerTask
*, double > 
taskTimes_
 
std::vector
< ecaldqm::DQWorkerTask * > 
workers_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
- Protected Attributes inherited from EcalDQMonitor
bool initialized_
 
const bool mergeRuns_
 
std::string moduleName_
 
const int verbosity_
 

Detailed Description

Definition at line 24 of file EcalDQMonitorTask.h.

Member Typedef Documentation

typedef void(EcalDQMonitorTask::* EcalDQMonitorTask::Processor)(edm::Event const &, ecaldqm::Collections)
private

Definition at line 40 of file EcalDQMonitorTask.h.

Constructor & Destructor Documentation

EcalDQMonitorTask::EcalDQMonitorTask ( edm::ParameterSet const &  _ps)

Definition at line 27 of file EcalDQMonitorTask.cc.

References ecaldqm::collectionName, collectionTokens_, gather_cfg::cout, ecaldqm::SetWorker::findFactory(), formSchedule_(), ecaldqm::DQWorkerTask::getDependencies(), ecaldqm::DQWorker::getName(), edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), ecaldqm::kEcalRawData, EcalDQMonitor::moduleName_, ecaldqm::nCollections, registerCollection(), schedule_, edm::second(), ecaldqm::DQWorker::setVerbosity(), taskLists_, EcalDQMonitor::verbosity_, and workers_.

27  :
28  EcalDQMonitor(_ps),
29  ievt_(0),
30  workers_(0),
31  schedule_(),
32  enabled_(),
33  taskTimes_(),
34  evaluateTime_(_ps.getUntrackedParameter<bool>("evaluateTime")),
35  allowMissingCollections_(_ps.getUntrackedParameter<bool>("allowMissingCollections"))
36 {
37  std::vector<std::string> taskNames(_ps.getUntrackedParameter<std::vector<std::string> >("tasks"));
38  edm::ParameterSet const& taskParams(_ps.getUntrackedParameterSet("taskParameters"));
39  edm::ParameterSet const& mePaths(_ps.getUntrackedParameterSet("mePaths"));
40 
41  ecaldqm::WorkerFactory factory(0);
42  std::multimap<ecaldqm::Collections, ecaldqm::Collections> dependencies;
43 
44  for(std::vector<std::string>::iterator tItr(taskNames.begin()); tItr != taskNames.end(); ++tItr){
45  if(!(factory = ecaldqm::SetWorker::findFactory(*tItr))) continue;
46 
47  if(verbosity_ > 0) std::cout << moduleName_ << ": Setting up " << *tItr << std::endl;
48 
49  ecaldqm::DQWorker* worker(factory(taskParams, mePaths.getUntrackedParameterSet(*tItr)));
50  if(worker->getName() != *tItr){
51  delete worker;
52 
53  if(verbosity_ > 0) std::cout << moduleName_ << ": " << *tItr << " could not be configured" << std::endl;
54  continue;
55  }
56  ecaldqm::DQWorkerTask* task(static_cast<ecaldqm::DQWorkerTask*>(worker));
57  task->setVerbosity(verbosity_);
58 
59  workers_.push_back(task);
60 
61  std::vector<std::pair<ecaldqm::Collections, ecaldqm::Collections> > const& dep(task->getDependencies());
62  for(std::vector<std::pair<ecaldqm::Collections, ecaldqm::Collections> >::const_iterator depItr(dep.begin()); depItr != dep.end(); ++depItr)
63  dependencies.insert(*depItr);
64  }
65 
66  edm::ParameterSet const& collectionTags(_ps.getUntrackedParameterSet("collectionTags"));
67 
68  std::vector<ecaldqm::Collections> usedCollections;
69 
70  for(unsigned iCol(0); iCol < ecaldqm::nCollections; iCol++){
71 
73  taskLists_[iCol] = std::vector<ecaldqm::DQWorkerTask*>();
74 
75  bool use(iCol == ecaldqm::kEcalRawData);
76 
77  for(std::vector<ecaldqm::DQWorkerTask*>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr){
78  if((*wItr)->runsOn(iCol)){
79  taskLists_[iCol].push_back(*wItr);
80  use = true;
81  }
82  }
83  if(use){
84  registerCollection(ecaldqm::Collections(iCol), collectionTags.getUntrackedParameter<edm::InputTag>(ecaldqm::collectionName[iCol]));
85  usedCollections.push_back(ecaldqm::Collections(iCol));
86  }
87 
88  }
89 
90  formSchedule_(usedCollections, dependencies);
91 
92  if(verbosity_ > 0){
93  std::cout << moduleName_ << ": Using collections" << std::endl;
94  for(unsigned iCol(0); iCol < schedule_.size(); iCol++)
95  std::cout << ecaldqm::collectionName[schedule_[iCol].second] << std::endl;
96  std::cout << std::endl;
97  }
98 }
std::vector< ecaldqm::DQWorkerTask * > workers_
std::map< ecaldqm::DQWorkerTask *, bool > enabled_
void formSchedule_(std::vector< ecaldqm::Collections > const &, std::multimap< ecaldqm::Collections, ecaldqm::Collections > const &)
std::string moduleName_
Definition: EcalDQMonitor.h:22
edm::EDGetToken collectionTokens_[ecaldqm::nCollections]
EcalDQMonitor(const edm::ParameterSet &)
U second(std::pair< T, U > const &p)
std::map< ecaldqm::DQWorkerTask *, double > taskTimes_
std::string const collectionName[nCollections]
Definition: Collections.h:39
void registerCollection(ecaldqm::Collections, edm::InputTag const &)
DQWorker *(* WorkerFactory)(const edm::ParameterSet &, const edm::ParameterSet &)
Definition: DQWorker.h:64
static WorkerFactory findFactory(const std::string &)
Definition: DQWorker.cc:131
std::vector< std::pair< Processor, ecaldqm::Collections > > schedule_
std::vector< ecaldqm::DQWorkerTask * > taskLists_[ecaldqm::nCollections]
tuple cout
Definition: gather_cfg.py:121
const int verbosity_
Definition: EcalDQMonitor.h:24
EcalDQMonitorTask::~EcalDQMonitorTask ( )

Definition at line 100 of file EcalDQMonitorTask.cc.

References workers_.

101 {
102  for(std::vector<ecaldqm::DQWorkerTask *>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr)
103  delete *wItr;
104 }
std::vector< ecaldqm::DQWorkerTask * > workers_

Member Function Documentation

void EcalDQMonitorTask::analyze ( edm::Event const &  _evt,
edm::EventSetup const &  _es 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 182 of file EcalDQMonitorTask.cc.

References ecaldqm::DQWorkerTask::beginEvent(), ecaldqm::DQWorker::bookMEs(), collectionTokens_, gather_cfg::cout, enabled_, ecaldqm::DQWorkerTask::endEvent(), ecaldqm::DQWorkerTask::filterRunType(), first, edm::Event::getByToken(), ecaldqm::DQWorker::getName(), ievt_, ecaldqm::DQWorker::isInitialized(), ecaldqm::kEcalRawData, EcalDQMonitor::moduleName_, environment_file_cff::runType, schedule_, edm::second(), ecaldqm::DQWorker::setInitialized(), EcalDQMonitor::verbosity_, and workers_.

183 {
184  ievt_++;
185 
187  if(!_evt.getByToken(collectionTokens_[ecaldqm::kEcalRawData], dcchsHndl))
188  throw cms::Exception("ObjectNotFound") << "EcalRawDataCollection does not exist";
189 
190  // determine event type (called run type in DCCHeader for some reason) for each FED
191  std::vector<short> runType(54, -1);
192  for(EcalRawDataCollection::const_iterator dcchItr = dcchsHndl->begin(); dcchItr != dcchsHndl->end(); ++dcchItr){
193  runType[dcchItr->id() - 1] = dcchItr->getRunType();
194  }
195 
196  bool atLeastOne(false);
197 
198  ecaldqm::DQWorkerTask* task(0);
199 
200  // set up task modules
201  for(std::vector<ecaldqm::DQWorkerTask*>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr){
202  task = *wItr;
203 
204  if(task->filterRunType(runType)){
205  enabled_[task] = true;
206 
207  if(!task->isInitialized()){
208  if(verbosity_ > 1) std::cout << moduleName_ << ": Booking MEs for " << task->getName() << std::endl;
209  task->bookMEs();
210  task->setInitialized(true);
211  }
212 
213  task->beginEvent(_evt, _es);
214  atLeastOne = true;
215  }else{
216  enabled_[task] = false;
217  }
218  }
219 
220  if(!atLeastOne) return;
221 
222  // run on collections
223  for(unsigned iSch(0); iSch < schedule_.size(); iSch++){
224  Processor processor(schedule_[iSch].first);
225  (this->*processor)(_evt, schedule_[iSch].second);
226  }
227 
228  // close event
229  for(std::vector<ecaldqm::DQWorkerTask *>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr){
230  task = *wItr;
231  if(enabled_[task]) task->endEvent(_evt, _es);
232  }
233 
234 }
void(EcalDQMonitorTask::* Processor)(edm::Event const &, ecaldqm::Collections)
std::vector< ecaldqm::DQWorkerTask * > workers_
std::map< ecaldqm::DQWorkerTask *, bool > enabled_
std::string moduleName_
Definition: EcalDQMonitor.h:22
std::vector< EcalDCCHeaderBlock >::const_iterator const_iterator
edm::EDGetToken collectionTokens_[ecaldqm::nCollections]
U second(std::pair< T, U > const &p)
bool first
Definition: L1TdeRCT.cc:79
std::vector< std::pair< Processor, ecaldqm::Collections > > schedule_
tuple cout
Definition: gather_cfg.py:121
const int verbosity_
Definition: EcalDQMonitor.h:24
void EcalDQMonitorTask::beginLuminosityBlock ( edm::LuminosityBlock const &  _lumi,
edm::EventSetup const &  _es 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 164 of file EcalDQMonitorTask.cc.

References ecaldqm::DQWorker::beginLuminosityBlock(), ecaldqm::DQWorker::isInitialized(), ecaldqm::kLumiSection, ecaldqm::DQWorkerTask::runsOn(), and workers_.

165 {
166  for(std::vector<ecaldqm::DQWorkerTask*>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr){
167  ecaldqm::DQWorkerTask* task(*wItr);
168  if(task->isInitialized() && task->runsOn(ecaldqm::kLumiSection)) task->beginLuminosityBlock(_lumi, _es);
169  }
170 }
std::vector< ecaldqm::DQWorkerTask * > workers_
void EcalDQMonitorTask::beginRun ( edm::Run const &  _run,
edm::EventSetup const &  _es 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 116 of file EcalDQMonitorTask.cc.

References ecaldqm::DQWorker::beginRun(), gather_cfg::cout, edm::EventSetup::get(), ievt_, ecaldqm::kRun, EcalDQMonitor::moduleName_, edm::ESHandle< class >::product(), ecaldqm::DQWorker::reset(), edm::RunBase::run(), ecaldqm::DQWorkerTask::runsOn(), ecaldqm::setElectronicsMap(), ecaldqm::setTrigTowerMap(), taskTimes_, EcalDQMonitor::verbosity_, and workers_.

117 {
118  // set up ecaldqm::electronicsMap in EcalDQMCommonUtils
120  _es.get<EcalMappingRcd>().get(elecMapHandle);
121  ecaldqm::setElectronicsMap(elecMapHandle.product());
122 
123  // set up ecaldqm::electronicsMap in EcalDQMCommonUtils
125  _es.get<IdealGeometryRecord>().get(ttMapHandle);
126  ecaldqm::setTrigTowerMap(ttMapHandle.product());
127 
128  for(std::vector<ecaldqm::DQWorkerTask*>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr){
129  ecaldqm::DQWorkerTask* task(*wItr);
130  task->reset();
131  if(task->runsOn(ecaldqm::kRun)) task->beginRun(_run, _es);
132  }
133 
134  if(verbosity_ > 0)
135  std::cout << moduleName_ << ": Starting run " << _run.run() << std::endl;
136 
137  ievt_ = 0;
138  taskTimes_.clear();
139 }
std::vector< ecaldqm::DQWorkerTask * > workers_
void setTrigTowerMap(const EcalTrigTowerConstituentsMap *)
std::string moduleName_
Definition: EcalDQMonitor.h:22
void setElectronicsMap(const EcalElectronicsMapping *)
std::map< ecaldqm::DQWorkerTask *, double > taskTimes_
T const * product() const
Definition: ESHandle.h:62
tuple cout
Definition: gather_cfg.py:121
const int verbosity_
Definition: EcalDQMonitor.h:24
void EcalDQMonitorTask::endLuminosityBlock ( edm::LuminosityBlock const &  _lumi,
edm::EventSetup const &  _es 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 173 of file EcalDQMonitorTask.cc.

References ecaldqm::DQWorker::endLuminosityBlock(), ecaldqm::DQWorker::isInitialized(), ecaldqm::kLumiSection, ecaldqm::DQWorkerTask::runsOn(), and workers_.

174 {
175  for(std::vector<ecaldqm::DQWorkerTask*>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr){
176  ecaldqm::DQWorkerTask* task(*wItr);
177  if(task->isInitialized() && task->runsOn(ecaldqm::kLumiSection)) task->endLuminosityBlock(_lumi, _es);
178  }
179 }
std::vector< ecaldqm::DQWorkerTask * > workers_
void EcalDQMonitorTask::endRun ( edm::Run const &  _run,
edm::EventSetup const &  _es 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 142 of file EcalDQMonitorTask.cc.

References ecaldqm::DQWorker::endRun(), evaluateTime_, ecaldqm::DQWorker::getName(), ievt_, ecaldqm::kRun, EcalDQMonitor::moduleName_, ecaldqm::DQWorkerTask::runsOn(), taskTimes_, and workers_.

143 {
144  for(std::vector<ecaldqm::DQWorkerTask*>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr){
145  ecaldqm::DQWorkerTask* task(*wItr);
146  if(task->runsOn(ecaldqm::kRun)) task->endRun(_run, _es);
147  }
148 
149  if(evaluateTime_){
150  std::stringstream ss;
151 
152  ss << "************** " << moduleName_ << " **************" << std::endl;
153  ss << " Mean time consumption of the modules" << std::endl;
154  ss << "____________________________________" << std::endl;
155  for(std::vector<ecaldqm::DQWorkerTask*>::iterator wItr(workers_.begin()); wItr != workers_.end(); ++wItr){
156  ecaldqm::DQWorkerTask* task(*wItr);
157  ss << std::setw(20) << std::setfill(' ') << task->getName() << "| " << (taskTimes_[task] / ievt_) << std::endl;
158  }
159  edm::LogInfo("EcalDQM") << ss.str();
160  }
161 }
std::vector< ecaldqm::DQWorkerTask * > workers_
std::string moduleName_
Definition: EcalDQMonitor.h:22
std::map< ecaldqm::DQWorkerTask *, double > taskTimes_
void EcalDQMonitorTask::fillDescriptions ( edm::ConfigurationDescriptions _descs)
static
void EcalDQMonitorTask::formSchedule_ ( std::vector< ecaldqm::Collections > const &  _usedCollections,
std::multimap< ecaldqm::Collections, ecaldqm::Collections > const &  _dependencies 
)
private

Definition at line 152 of file EcalDQMonitorTask2.cc.

References edm::hlt::Exception, spr::find(), ecaldqm::kBlockSizeErrors, ecaldqm::kChIdErrors, ecaldqm::kEBBasicCluster, ecaldqm::kEBDigi, ecaldqm::kEBRecHit, ecaldqm::kEBSrFlag, ecaldqm::kEBSuperCluster, ecaldqm::kEBUncalibRecHit, ecaldqm::kEcalRawData, ecaldqm::kEEBasicCluster, ecaldqm::kEEDigi, ecaldqm::kEERecHit, ecaldqm::kEESrFlag, ecaldqm::kEESuperCluster, ecaldqm::kEEUncalibRecHit, ecaldqm::kGainErrors, ecaldqm::kGainSwitchErrors, ecaldqm::kMEMBlockSizeErrors, ecaldqm::kMEMChIdErrors, ecaldqm::kMEMGainErrors, ecaldqm::kMEMTowerIdErrors, ecaldqm::kPnDiodeDigi, ecaldqm::kSource, ecaldqm::kTowerIdErrors, ecaldqm::kTrigPrimDigi, ecaldqm::kTrigPrimEmulDigi, and schedule_.

Referenced by EcalDQMonitorTask().

153 {
154  typedef std::multimap<ecaldqm::Collections, ecaldqm::Collections>::const_iterator mmiter;
155 
156  std::vector<ecaldqm::Collections> preSchedule;
157  std::vector<ecaldqm::Collections>::iterator insertPoint, findPoint;
158 
159  for(std::vector<ecaldqm::Collections>::const_iterator colItr(_usedCollections.begin()); colItr != _usedCollections.end(); ++colItr){
160 
161  bool inserted(true);
162  if((insertPoint = find(preSchedule.begin(), preSchedule.end(), *colItr)) == preSchedule.end()) inserted = false;
163 
164  std::pair<mmiter, mmiter> range(_dependencies.equal_range(*colItr));
165 
166  for(mmiter depItr(range.first); depItr != range.second; ++depItr){
167 
168  if(depItr->second == depItr->first)
169  throw cms::Exception("Fatal") << "Collection " << depItr->second << " depends on itself";
170  if(find(_usedCollections.begin(), _usedCollections.end(), depItr->second) == _usedCollections.end())
171  throw cms::Exception("Fatal") << "Collection " << depItr->first << " depends on Collection " << depItr->second;
172 
173  if((findPoint = find(preSchedule.begin(), preSchedule.end(), depItr->second)) == preSchedule.end())
174  preSchedule.insert(insertPoint, depItr->second);
175  else if(findPoint > insertPoint)
176  throw cms::Exception("InvalidConfiguration") << "Circular dependencies in Collections";
177 
178  }
179 
180  if(!inserted) preSchedule.push_back(*colItr);
181 
182  }
183 
184  for(std::vector<ecaldqm::Collections>::const_iterator colItr(preSchedule.begin()); colItr != preSchedule.end(); ++colItr){
185  std::pair<Processor, ecaldqm::Collections> sch;
186 
187  switch(*colItr){
188  case ecaldqm::kSource:
189  sch.first = &EcalDQMonitorTask::runOnCollection<FEDRawDataCollection>; break;
191  sch.first = &EcalDQMonitorTask::runOnCollection<EcalRawDataCollection>; break;
193  sch.first = &EcalDQMonitorTask::runOnCollection<DetIdCollection>; break;
195  sch.first = &EcalDQMonitorTask::runOnCollection<DetIdCollection>; break;
197  sch.first = &EcalDQMonitorTask::runOnCollection<DetIdCollection>; break;
199  sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>; break;
201  sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>; break;
203  sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>; break;
205  sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>; break;
207  sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>; break;
209  sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>; break;
210  case ecaldqm::kEBSrFlag:
211  sch.first = &EcalDQMonitorTask::runOnCollection<EBSrFlagCollection>; break;
212  case ecaldqm::kEESrFlag:
213  sch.first = &EcalDQMonitorTask::runOnCollection<EESrFlagCollection>; break;
214  case ecaldqm::kEBDigi:
215  sch.first = &EcalDQMonitorTask::runOnCollection<EBDigiCollection>; break;
216  case ecaldqm::kEEDigi:
217  sch.first = &EcalDQMonitorTask::runOnCollection<EEDigiCollection>; break;
219  sch.first = &EcalDQMonitorTask::runOnCollection<EcalPnDiodeDigiCollection>; break;
221  sch.first = &EcalDQMonitorTask::runOnCollection<EcalTrigPrimDigiCollection>; break;
223  sch.first = &EcalDQMonitorTask::runOnCollection<EcalTrigPrimDigiCollection>; break;
225  sch.first = &EcalDQMonitorTask::runOnCollection<EcalUncalibratedRecHitCollection>; break;
227  sch.first = &EcalDQMonitorTask::runOnCollection<EcalUncalibratedRecHitCollection>; break;
228  case ecaldqm::kEBRecHit:
229  sch.first = &EcalDQMonitorTask::runOnCollection<EcalRecHitCollection>; break;
230  case ecaldqm::kEERecHit:
231  sch.first = &EcalDQMonitorTask::runOnCollection<EcalRecHitCollection>; break;
233  sch.first = &EcalDQMonitorTask::runOnCollection<reco::BasicClusterCollection>; break;
235  sch.first = &EcalDQMonitorTask::runOnCollection<reco::BasicClusterCollection>; break;
237  sch.first = &EcalDQMonitorTask::runOnCollection<reco::SuperClusterCollection>; break;
239  sch.first = &EcalDQMonitorTask::runOnCollection<reco::SuperClusterCollection>; break;
240  default:
241  throw cms::Exception("InvalidConfiguration") << "Undefined collection " << *colItr;
242  }
243 
244  sch.second = *colItr;
245 
246  schedule_.push_back(sch);
247  }
248 
249 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< std::pair< Processor, ecaldqm::Collections > > schedule_
void EcalDQMonitorTask::registerCollection ( ecaldqm::Collections  _collection,
edm::InputTag const &  _inputTag 
)
private

Definition at line 20 of file EcalDQMonitorTask2.cc.

References collectionTokens_, edm::hlt::Exception, ecaldqm::kBlockSizeErrors, ecaldqm::kChIdErrors, ecaldqm::kEBBasicCluster, ecaldqm::kEBDigi, ecaldqm::kEBRecHit, ecaldqm::kEBSrFlag, ecaldqm::kEBSuperCluster, ecaldqm::kEBUncalibRecHit, ecaldqm::kEcalRawData, ecaldqm::kEEBasicCluster, ecaldqm::kEEDigi, ecaldqm::kEERecHit, ecaldqm::kEESrFlag, ecaldqm::kEESuperCluster, ecaldqm::kEEUncalibRecHit, ecaldqm::kGainErrors, ecaldqm::kGainSwitchErrors, ecaldqm::kMEMBlockSizeErrors, ecaldqm::kMEMChIdErrors, ecaldqm::kMEMGainErrors, ecaldqm::kMEMTowerIdErrors, ecaldqm::kPnDiodeDigi, ecaldqm::kSource, ecaldqm::kTowerIdErrors, ecaldqm::kTrigPrimDigi, and ecaldqm::kTrigPrimEmulDigi.

Referenced by EcalDQMonitorTask().

21 {
22  switch(_collection){
23  case ecaldqm::kSource:
24  collectionTokens_[_collection] = edm::EDGetToken(consumes<FEDRawDataCollection>(_inputTag)); break;
26  collectionTokens_[_collection] = edm::EDGetToken(consumes<EcalRawDataCollection>(_inputTag)); break;
28  collectionTokens_[_collection] = edm::EDGetToken(consumes<DetIdCollection>(_inputTag)); break;
30  collectionTokens_[_collection] = edm::EDGetToken(consumes<DetIdCollection>(_inputTag)); break;
32  collectionTokens_[_collection] = edm::EDGetToken(consumes<DetIdCollection>(_inputTag)); break;
34  collectionTokens_[_collection] = edm::EDGetToken(consumes<EcalElectronicsIdCollection>(_inputTag)); break;
36  collectionTokens_[_collection] = edm::EDGetToken(consumes<EcalElectronicsIdCollection>(_inputTag)); break;
38  collectionTokens_[_collection] = edm::EDGetToken(consumes<EcalElectronicsIdCollection>(_inputTag)); break;
40  collectionTokens_[_collection] = edm::EDGetToken(consumes<EcalElectronicsIdCollection>(_inputTag)); break;
42  collectionTokens_[_collection] = edm::EDGetToken(consumes<EcalElectronicsIdCollection>(_inputTag)); break;
44  collectionTokens_[_collection] = edm::EDGetToken(consumes<EcalElectronicsIdCollection>(_inputTag)); break;
45  case ecaldqm::kEBSrFlag:
46  collectionTokens_[_collection] = edm::EDGetToken(consumes<EBSrFlagCollection>(_inputTag)); break;
47  case ecaldqm::kEESrFlag:
48  collectionTokens_[_collection] = edm::EDGetToken(consumes<EESrFlagCollection>(_inputTag)); break;
49  case ecaldqm::kEBDigi:
50  collectionTokens_[_collection] = edm::EDGetToken(consumes<EBDigiCollection>(_inputTag)); break;
51  case ecaldqm::kEEDigi:
52  collectionTokens_[_collection] = edm::EDGetToken(consumes<EEDigiCollection>(_inputTag)); break;
54  collectionTokens_[_collection] = edm::EDGetToken(consumes<EcalPnDiodeDigiCollection>(_inputTag)); break;
56  collectionTokens_[_collection] = edm::EDGetToken(consumes<EcalTrigPrimDigiCollection>(_inputTag)); break;
58  collectionTokens_[_collection] = edm::EDGetToken(consumes<EcalTrigPrimDigiCollection>(_inputTag)); break;
60  collectionTokens_[_collection] = edm::EDGetToken(consumes<EcalUncalibratedRecHitCollection>(_inputTag)); break;
62  collectionTokens_[_collection] = edm::EDGetToken(consumes<EcalUncalibratedRecHitCollection>(_inputTag)); break;
63  case ecaldqm::kEBRecHit:
64  collectionTokens_[_collection] = edm::EDGetToken(consumes<EcalRecHitCollection>(_inputTag)); break;
65  case ecaldqm::kEERecHit:
66  collectionTokens_[_collection] = edm::EDGetToken(consumes<EcalRecHitCollection>(_inputTag)); break;
68  collectionTokens_[_collection] = edm::EDGetToken(consumes<reco::BasicClusterCollection>(_inputTag)); break;
70  collectionTokens_[_collection] = edm::EDGetToken(consumes<reco::BasicClusterCollection>(_inputTag)); break;
72  collectionTokens_[_collection] = edm::EDGetToken(consumes<reco::SuperClusterCollection>(_inputTag)); break;
74  collectionTokens_[_collection] = edm::EDGetToken(consumes<reco::SuperClusterCollection>(_inputTag)); break;
75  default:
76  throw cms::Exception("InvalidConfiguration") << "Undefined collection " << _collection;
77  }
78 }
edm::EDGetToken collectionTokens_[ecaldqm::nCollections]
template<class C >
void EcalDQMonitorTask::runOnCollection ( edm::Event const &  _evt,
ecaldqm::Collections  _collection 
)
private

Definition at line 82 of file EcalDQMonitorTask2.cc.

References allowMissingCollections_, ecaldqm::DQWorkerTask::analyze(), begin, ecaldqm::collectionName, collectionTokens_, enabled_, evaluateTime_, edm::hlt::Exception, edm::Event::getByToken(), edm::Handle< T >::product(), taskLists_, and taskTimes_.

83 {
84  edm::Handle<C> hndl;
85  if(_evt.getByToken(collectionTokens_[_collection], hndl)){
86 
87  TStopwatch* sw(0);
88  if(evaluateTime_){
89  sw = new TStopwatch;
90  sw->Stop();
91  }
92 
93  ecaldqm::DQWorkerTask* task(0);
94 
95  for(std::vector<ecaldqm::DQWorkerTask *>::iterator wItr(taskLists_[_collection].begin()); wItr != taskLists_[_collection].end(); ++wItr){
96  task = *wItr;
97  if(evaluateTime_) sw->Start();
98  if(enabled_[task]) task->analyze(hndl.product(), _collection);
99  if(evaluateTime_){
100  sw->Stop();
101  taskTimes_[task] += sw->RealTime();
102  }
103  }
104 
105  delete sw;
106  }
107  else if(!allowMissingCollections_)
108  throw cms::Exception("ObjectNotFound") << ecaldqm::collectionName[_collection] << " does not exist";
109 }
std::map< ecaldqm::DQWorkerTask *, bool > enabled_
edm::EDGetToken collectionTokens_[ecaldqm::nCollections]
std::map< ecaldqm::DQWorkerTask *, double > taskTimes_
std::string const collectionName[nCollections]
Definition: Collections.h:39
std::vector< ecaldqm::DQWorkerTask * > taskLists_[ecaldqm::nCollections]
T const * product() const
Definition: Handle.h:81
#define begin
Definition: vmac.h:30
template<>
void EcalDQMonitorTask::runOnCollection ( edm::Event const &  _evt,
ecaldqm::Collections  _collection 
)
private

Definition at line 113 of file EcalDQMonitorTask2.cc.

References ecaldqm::DQWorkerTask::analyze(), begin, ecaldqm::collectionName, edm::hlt::Exception, and edm::EDCollection< T >::push_back().

114 {
117  if(_evt.getByToken(collectionTokens_[_collection], ebHndl) && _evt.getByToken(collectionTokens_[_collection], eeHndl)){
118  unsigned nEB(ebHndl->size());
119  unsigned nEE(eeHndl->size());
120 
121  if(nEB == 0 && nEE == 0) return;
122 
123  DetIdCollection ids;
124  for(unsigned iId(0); iId < nEB; iId++) ids.push_back(DetId(ebHndl->at(iId)));
125  for(unsigned iId(0); iId < nEE; iId++) ids.push_back(DetId(eeHndl->at(iId)));
126 
127  TStopwatch* sw(0);
128  if(evaluateTime_){
129  sw = new TStopwatch;
130  sw->Stop();
131  }
132 
133  ecaldqm::DQWorkerTask* task(0);
134 
135  for(std::vector<ecaldqm::DQWorkerTask *>::iterator wItr(taskLists_[_collection].begin()); wItr != taskLists_[_collection].end(); ++wItr){
136  task = *wItr;
137  if(evaluateTime_) sw->Start();
138  if(enabled_[task]) task->analyze(const_cast<const DetIdCollection*>(&ids), _collection);
139  if(evaluateTime_){
140  sw->Stop();
141  taskTimes_[task] += sw->RealTime();
142  }
143  }
144 
145  delete sw;
146  }
147  else if(!allowMissingCollections_)
148  throw cms::Exception("ObjectNotFound") << ecaldqm::collectionName[_collection] << " does not exist";
149 }
std::map< ecaldqm::DQWorkerTask *, bool > enabled_
edm::EDGetToken collectionTokens_[ecaldqm::nCollections]
void push_back(T const &t)
Definition: EDCollection.h:67
std::map< ecaldqm::DQWorkerTask *, double > taskTimes_
std::string const collectionName[nCollections]
Definition: Collections.h:39
Definition: DetId.h:18
std::vector< ecaldqm::DQWorkerTask * > taskLists_[ecaldqm::nCollections]
#define begin
Definition: vmac.h:30

Member Data Documentation

bool EcalDQMonitorTask::allowMissingCollections_
private

Definition at line 62 of file EcalDQMonitorTask.h.

Referenced by runOnCollection().

edm::EDGetToken EcalDQMonitorTask::collectionTokens_[ecaldqm::nCollections]
private
std::map<ecaldqm::DQWorkerTask*, bool> EcalDQMonitorTask::enabled_
private

Definition at line 57 of file EcalDQMonitorTask.h.

Referenced by analyze(), and runOnCollection().

bool EcalDQMonitorTask::evaluateTime_
private

Definition at line 60 of file EcalDQMonitorTask.h.

Referenced by endRun(), and runOnCollection().

int EcalDQMonitorTask::ievt_
private

Definition at line 47 of file EcalDQMonitorTask.h.

Referenced by analyze(), beginRun(), and endRun().

std::vector<std::pair<Processor, ecaldqm::Collections> > EcalDQMonitorTask::schedule_
private
std::vector<ecaldqm::DQWorkerTask*> EcalDQMonitorTask::taskLists_[ecaldqm::nCollections]
private

Definition at line 55 of file EcalDQMonitorTask.h.

Referenced by EcalDQMonitorTask(), and runOnCollection().

std::map<ecaldqm::DQWorkerTask*, double> EcalDQMonitorTask::taskTimes_
private

Definition at line 59 of file EcalDQMonitorTask.h.

Referenced by beginRun(), endRun(), and runOnCollection().

std::vector<ecaldqm::DQWorkerTask*> EcalDQMonitorTask::workers_
private