17 #include "TStopwatch.h"
19 using namespace ecaldqm;
26 if(_evt.
getByLabel(collectionTags_[_colName], hndl)){
36 for(std::vector<DQWorkerTask *>::iterator wItr(taskLists_[_colName].
begin()); wItr != taskLists_[_colName].end(); ++wItr){
38 if(evaluateTime_) sw->Start();
42 taskTimes_[task] += sw->RealTime();
48 else if(!allowMissingCollections_)
49 throw cms::Exception(
"ObjectNotFound") <<
"Collection with InputTag " << collectionTags_[_colName] <<
" does not exist";
58 if(_evt.getByLabel(collectionTags_[_colName], ebHndl) && _evt.getByLabel(collectionTags_[_colName], eeHndl)){
59 unsigned nEB(ebHndl->size());
60 unsigned nEE(eeHndl->size());
62 if(nEB == 0 && nEE == 0)
return;
65 for(
unsigned iId(0); iId < nEB; iId++) ids.
push_back(
DetId(ebHndl->at(iId)));
66 for(
unsigned iId(0); iId < nEE; iId++) ids.
push_back(
DetId(eeHndl->at(iId)));
76 for(std::vector<DQWorkerTask *>::iterator wItr(taskLists_[_colName].
begin()); wItr != taskLists_[_colName].end(); ++wItr){
78 if(evaluateTime_) sw->Start();
79 if(enabled_[task]) task->
analyze(const_cast<const DetIdCollection*>(&ids), _colName);
82 taskTimes_[task] += sw->RealTime();
88 else if(!allowMissingCollections_)
89 throw cms::Exception(
"ObjectNotFound") <<
"DetIdCollection with InputTag " << collectionTags_[_colName] <<
" does not exist";
96 typedef multimap<Collections, Collections>::const_iterator mmiter;
98 vector<Collections> preSchedule;
99 vector<Collections>::iterator insertPoint, findPoint;
101 for(vector<Collections>::const_iterator colItr(_usedCollections.begin()); colItr != _usedCollections.end(); ++colItr){
104 if((insertPoint =
find(preSchedule.begin(), preSchedule.end(), *colItr)) == preSchedule.end()) inserted =
false;
106 pair<mmiter, mmiter> range(_dependencies.equal_range(*colItr));
108 for(mmiter depItr(range.first); depItr != range.second; ++depItr){
110 if(depItr->second == depItr->first)
111 throw cms::Exception(
"Fatal") <<
"Collection " << depItr->second <<
" depends on itself";
112 if(
find(_usedCollections.begin(), _usedCollections.end(), depItr->second) == _usedCollections.end())
113 throw cms::Exception(
"Fatal") <<
"Collection " << depItr->first <<
" depends on Collection " << depItr->second;
115 if((findPoint =
find(preSchedule.begin(), preSchedule.end(), depItr->second)) == preSchedule.end())
116 preSchedule.insert(insertPoint, depItr->second);
117 else if(findPoint > insertPoint)
118 throw cms::Exception(
"InvalidConfiguration") <<
"Circular dependencies in Collections";
122 if(!inserted) preSchedule.push_back(*colItr);
126 for(vector<Collections>::const_iterator colItr(preSchedule.begin()); colItr != preSchedule.end(); ++colItr){
127 std::pair<Processor, Collections> sch;
131 sch.first = &EcalDQMonitorTask::runOnCollection<FEDRawDataCollection>;
break;
133 sch.first = &EcalDQMonitorTask::runOnCollection<EcalRawDataCollection>;
break;
135 sch.first = &EcalDQMonitorTask::runOnCollection<DetIdCollection>;
break;
137 sch.first = &EcalDQMonitorTask::runOnCollection<DetIdCollection>;
break;
139 sch.first = &EcalDQMonitorTask::runOnCollection<DetIdCollection>;
break;
141 sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>;
break;
143 sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>;
break;
145 sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>;
break;
147 sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>;
break;
149 sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>;
break;
151 sch.first = &EcalDQMonitorTask::runOnCollection<EcalElectronicsIdCollection>;
break;
153 sch.first = &EcalDQMonitorTask::runOnCollection<EBSrFlagCollection>;
break;
155 sch.first = &EcalDQMonitorTask::runOnCollection<EESrFlagCollection>;
break;
157 sch.first = &EcalDQMonitorTask::runOnCollection<EBDigiCollection>;
break;
159 sch.first = &EcalDQMonitorTask::runOnCollection<EEDigiCollection>;
break;
161 sch.first = &EcalDQMonitorTask::runOnCollection<EcalPnDiodeDigiCollection>;
break;
163 sch.first = &EcalDQMonitorTask::runOnCollection<EcalTrigPrimDigiCollection>;
break;
165 sch.first = &EcalDQMonitorTask::runOnCollection<EcalTrigPrimDigiCollection>;
break;
167 sch.first = &EcalDQMonitorTask::runOnCollection<EcalUncalibratedRecHitCollection>;
break;
169 sch.first = &EcalDQMonitorTask::runOnCollection<EcalUncalibratedRecHitCollection>;
break;
171 sch.first = &EcalDQMonitorTask::runOnCollection<EcalRecHitCollection>;
break;
173 sch.first = &EcalDQMonitorTask::runOnCollection<EcalRecHitCollection>;
break;
175 sch.first = &EcalDQMonitorTask::runOnCollection<reco::BasicClusterCollection>;
break;
177 sch.first = &EcalDQMonitorTask::runOnCollection<reco::BasicClusterCollection>;
break;
179 sch.first = &EcalDQMonitorTask::runOnCollection<reco::SuperClusterCollection>;
break;
181 sch.first = &EcalDQMonitorTask::runOnCollection<reco::SuperClusterCollection>;
break;
183 throw cms::Exception(
"InvalidConfiguration") <<
"Undefined collection " << *colItr;
186 sch.second = *colItr;
188 schedule_.push_back(sch);
void push_back(T const &t)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void formSchedule_(const std::vector< ecaldqm::Collections > &, const std::multimap< ecaldqm::Collections, ecaldqm::Collections > &)
virtual void analyze(const void *, Collections)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
T const * product() const
void runOnCollection(const edm::Event &, ecaldqm::Collections)