00001 #include "EventFilter/Utilities/interface/Exception.h"
00002 #include "EventFilter/Modules/interface/ShmOutputModuleRegistry.h"
00003 #include "EventFilter/Modules/src/FUShmOutputModule.h"
00004
00005 #include "TriggerReportHelpers.h"
00006 #include "FWCore/Framework/interface/TriggerReport.h"
00007 #include "DataFormats/Provenance/interface/ModuleDescription.h"
00008 #include "xdata/TableIterator.h"
00009
00010 #include <iostream>
00011 #include <sstream>
00012 #include <algorithm>
00013 #include <map>
00014
00015 #include "boost/tokenizer.hpp"
00016
00017 namespace evf{
00018 namespace fuep{
00019 const std::string TriggerReportHelpers::columns[5] = {"l1Pass","psPass","pAccept","pExcept","pReject"};
00020 void TriggerReportHelpers::triggerReportUpdate(edm::TriggerReport &tr, unsigned int ls, unsigned int ps, bool lumiComplete)
00021 {
00022 if(adjustLsIndex_)
00023 {
00024 lumiSectionIndex_=ls;
00025 adjustLsIndex_ = false;
00026 }
00027 else
00028 lumiSectionIndex_++;
00029 if(lumiSectionIndex_ != ls)
00030 std::cout << getpid() << " WARNING: ls index mismatch " << ls << " should be " << lumiSectionIndex_ << std::endl;
00031 prescaleIndex_ = ps;
00032 }
00033
00034 void TriggerReportHelpers::packedTriggerReportToTable()
00035 {
00036
00037 TriggerReportStatic *trs = getPackedTriggerReportAsStruct();
00038
00039 eventsProcessed_.value_ = trs->eventSummary.totalEvents;
00040 eventsAccepted_.value_ = trs->eventSummary.totalEventsPassed;
00041 for(int i=0; i<trs->trigPathsInMenu; i++) {
00042 pl1pre_[i] += (l1pre_[i] =trs->trigPathSummaries[i].timesPassedL1);
00043 triggerReportAsTable_.setValueAt(i,columns[0],l1pre_[i]);
00044 triggerReportAsTableWithNames_.setValueAt(i,columns[0],l1pre_[i]);
00045 pps_[i] += (ps_[i] = trs->trigPathSummaries[i].timesPassedPs);
00046 triggerReportAsTable_.setValueAt(i,columns[1],ps_[i]);
00047 triggerReportAsTableWithNames_.setValueAt(i,columns[1],ps_[i]);
00048 paccept_[i] += (accept_[i] = trs->trigPathSummaries[i].timesPassed);
00049 triggerReportAsTable_.setValueAt(i,columns[2], accept_[i]);
00050 triggerReportAsTableWithNames_.setValueAt(i,columns[2], accept_[i]);
00051 pexcept_[i] += (except_[i] = trs->trigPathSummaries[i].timesExcept);
00052 triggerReportAsTable_.setValueAt(i,columns[3], except_[i]);
00053 triggerReportAsTableWithNames_.setValueAt(i,columns[3], except_[i]);
00054 pfailed_[i] += (failed_[i] = trs->trigPathSummaries[i].timesFailed);
00055 triggerReportAsTable_.setValueAt(i,columns[4], failed_[i]);
00056 triggerReportAsTableWithNames_.setValueAt(i,columns[4], failed_[i]);
00057 }
00058 for(int i=0; i<trs->endPathsInMenu; i++) {
00059 int j = i+trs->trigPathsInMenu;
00060 pl1pre_[j] += (l1pre_[j] = trs->endPathSummaries[i].timesPassedL1);
00061 triggerReportAsTable_.setValueAt(j,columns[0],l1pre_[j]);
00062 triggerReportAsTableWithNames_.setValueAt(j,columns[0],l1pre_[j]);
00063 pps_[j] += (ps_[j] = trs->endPathSummaries[i].timesPassedPs);
00064 triggerReportAsTable_.setValueAt(j,columns[1],ps_[j]);
00065 triggerReportAsTableWithNames_.setValueAt(j,columns[1],ps_[j]);
00066 paccept_[j] += (accept_[j] = trs->endPathSummaries[i].timesPassed);
00067 triggerReportAsTable_.setValueAt(j,columns[2], accept_[j]);
00068 triggerReportAsTableWithNames_.setValueAt(j,columns[2], accept_[j]);
00069 pexcept_[j] += (except_[j] = trs->endPathSummaries[i].timesExcept);
00070 triggerReportAsTable_.setValueAt(j,columns[3], except_[j]);
00071 triggerReportAsTableWithNames_.setValueAt(j,columns[3], except_[j]);
00072 pfailed_[j] += (failed_[j] = trs->endPathSummaries[i].timesFailed);
00073 triggerReportAsTable_.setValueAt(j,columns[4], failed_[j]);
00074 triggerReportAsTableWithNames_.setValueAt(j,columns[4], failed_[j]);
00075 }
00076 }
00077
00078 void TriggerReportHelpers::fillPathIndexTable(std::string &pathstring)
00079 {
00080 unsigned int i = 0;
00081 if(pathstring == ""){
00082 for(; i<paths_.size(); i++) {
00083 xdata::Table::iterator it = triggerReportAsTableWithNames_.append();
00084 it->setField("pathIndex", pathIndexMap_[paths_[i]]=i);
00085 }
00086 }
00087 else{
00088 boost::char_separator<char> sep(",");
00089 boost::tokenizer<boost::char_separator<char> > tokens(pathstring, sep);
00090 for (boost::tokenizer<boost::char_separator<char> >::iterator tok_iter = tokens.begin();
00091 tok_iter != tokens.end(); ++tok_iter){
00092 unsigned int index = 0;
00093 std::string name;
00094 std::string::size_type pos = tok_iter->find("=");
00095 if(pos!=std::string::npos){
00096 name=tok_iter->substr(0,pos);
00097 index = atoi(tok_iter->substr(pos+1).c_str());
00098 pathIndexMap_[name]=index;
00099 }
00100 }
00101 for(; i<paths_.size(); i++) {
00102 if(pathIndexMap_.find(paths_[i])==pathIndexMap_.end())
00103 pathIndexMap_[paths_[i]] = i;
00104 xdata::Table::iterator it = triggerReportAsTableWithNames_.append();
00105 it->setField("pathIndex",pathIndexMap_[paths_[i]]);
00106 }
00107 }
00108 }
00109
00110 void TriggerReportHelpers::formatReportTable(edm::TriggerReport &tr,
00111 std::vector<edm::ModuleDescription const*>& descs,
00112 std::string &pathIndexTable,
00113 bool noNukeLegenda)
00114 {
00115
00116 if(tableFormatted_) return;
00117 std::ostringstream ost;
00118 trp_ = tr;
00119 lumiSectionIndex_ = 0;
00120 resetTriggerReport();
00121 TriggerReportStatic *trp = (TriggerReportStatic *)cache_->mtext;
00122
00123 tableFormatted_ = true;
00124 paths_.resize(tr.trigPathSummaries.size()+tr.endPathSummaries.size());
00125
00126 trp->trigPathsInMenu = tr.trigPathSummaries.size();
00127 trp->endPathsInMenu = tr.endPathSummaries.size();
00128 trp->datasetsInMenu = 0;
00130
00131 l1pos_.resize(tr.trigPathSummaries.size()+tr.endPathSummaries.size(),-1);
00132 pspos_.resize(tr.trigPathSummaries.size()+tr.endPathSummaries.size(),-1);
00133 outname_.resize(tr.trigPathSummaries.size()+tr.endPathSummaries.size());
00134 l1pre_.resize(tr.trigPathSummaries.size()+tr.endPathSummaries.size(),0);
00135 ps_.resize(tr.trigPathSummaries.size()+tr.endPathSummaries.size(),0);
00136 accept_.resize(tr.trigPathSummaries.size()+tr.endPathSummaries.size(),0);
00137 except_.resize(tr.trigPathSummaries.size()+tr.endPathSummaries.size(),0);
00138 failed_.resize(tr.trigPathSummaries.size()+tr.endPathSummaries.size(),0);
00139 pl1pre_.resize(tr.trigPathSummaries.size()+tr.endPathSummaries.size(),0);
00140 pps_.resize(tr.trigPathSummaries.size()+tr.endPathSummaries.size(),0);
00141 paccept_.resize(tr.trigPathSummaries.size()+tr.endPathSummaries.size(),0);
00142 pexcept_.resize(tr.trigPathSummaries.size()+tr.endPathSummaries.size(),0);
00143 pfailed_.resize(tr.trigPathSummaries.size()+tr.endPathSummaries.size(),0);
00144 triggerReportAsTable_.clear();
00145 triggerReportAsTableWithNames_.clear();
00146 triggerReportAsTable_.addColumn(columns[0],"unsigned int 32");
00147 triggerReportAsTable_.addColumn(columns[1],"unsigned int 32");
00148 triggerReportAsTable_.addColumn(columns[2],"unsigned int 32");
00149 triggerReportAsTable_.addColumn(columns[3],"unsigned int 32");
00150 triggerReportAsTable_.addColumn(columns[4],"unsigned int 32");
00151 triggerReportAsTableWithNames_ = triggerReportAsTable_;
00152 triggerReportAsTableWithNames_.addColumn("pathIndex","unsigned int 32");
00153
00154 unsigned int i=0;
00155 for(; i<tr.trigPathSummaries.size(); i++) {
00156 triggerReportAsTable_.append();
00157 paths_[i] = tr.trigPathSummaries[i].name;
00158
00159 ost << i << "=" << paths_[i] << ", ";
00160
00161
00162
00163 l1pos_[i] = -1;
00164 pspos_[i] = -1;
00165
00166 for(unsigned int j=0;j<tr.trigPathSummaries[i].moduleInPathSummaries.size();j++) {
00167 std::string label = tr.trigPathSummaries[i].moduleInPathSummaries[j].moduleLabel;
00168 for(unsigned int k = 0; k < descs.size(); k++)
00169 {
00170 if(descs[k]->moduleLabel() == label)
00171 {
00172 if(descs[k]->moduleName() == "HLTLevel1GTSeed") l1pos_[i] = j;
00173 if(descs[k]->moduleName() == "HLTPrescaler") pspos_[i] = j;
00174 }
00175 }
00176
00177 }
00178
00179 }
00180 for(; i<tr.endPathSummaries.size()+tr.trigPathSummaries.size(); i++) {
00181 triggerReportAsTable_.append();
00182 paths_[i] = tr.endPathSummaries[i-tr.trigPathSummaries.size()].name;
00183 ost << i << "=" << paths_[i] << ", ";
00184
00185
00186 l1pos_[i] = -1;
00187 pspos_[i] = -1;
00188 outname_[i] = "";
00189
00190 for(unsigned int j=0;
00191 j<tr.endPathSummaries[i-tr.trigPathSummaries.size()].moduleInPathSummaries.size();
00192 j++) {
00193 std::string label = tr.endPathSummaries[i-tr.trigPathSummaries.size()].moduleInPathSummaries[j].moduleLabel;
00194 for(unsigned int k = 0; k < descs.size(); k++)
00195 {
00196 if(descs[k]->moduleLabel() == label)
00197 {
00198 if(descs[k]->moduleName() == "TriggerResultsFilter") pspos_[i] = j;
00199
00200 if(descs[k]->moduleName() == "ShmStreamConsumer")
00201 outname_[i] = descs[k]->moduleLabel();
00202 }
00203 }
00204
00205 }
00206 }
00207 fillPathIndexTable(pathIndexTable);
00208 if(noNukeLegenda) pathLegenda_ = ost.str().c_str();
00209
00210 }
00211
00212 void TriggerReportHelpers::printReportTable()
00213 {
00214 std::cout << "report table for LS #" << lumiSectionIndex_ << std::endl;
00215 triggerReportAsTableWithNames_.writeTo(std::cout);
00216 std::cout << std::endl;
00217 }
00218 void TriggerReportHelpers::printTriggerReport(edm::TriggerReport &tr)
00219 {
00220 std::ostringstream oss;
00221
00222 oss<<"================================="<<"\n";
00223 oss<<"== BEGINNING OF TRIGGER REPORT =="<<"\n";
00224 oss<<"================================="<<"\n";
00225 oss<<"tr.eventSummary.totalEvents= "<<tr.eventSummary.totalEvents<<"\n"
00226 <<"tr.eventSummary.totalEventsPassed= "<<tr.eventSummary.totalEventsPassed<<"\n"
00227 <<"tr.eventSummary.totalEventsFailed= "<<tr.eventSummary.totalEventsFailed<<"\n";
00228
00229 oss<<"TriggerReport::trigPathSummaries"<<"\n";
00230 for(unsigned int i=0; i<tr.trigPathSummaries.size(); i++) {
00231 oss<<"tr.trigPathSummaries["<<i<<"].bitPosition = "
00232 <<tr.trigPathSummaries[i].bitPosition <<"\n"
00233 <<"tr.trigPathSummaries["<<i<<"].timesRun = "
00234 <<tr.trigPathSummaries[i].timesRun <<"\n"
00235 <<"tr.trigPathSummaries["<<i<<"].timesPassed = "
00236 <<tr.trigPathSummaries[i].timesPassed <<"\n"
00237 <<"tr.trigPathSummaries["<<i<<"].timesFailed = "
00238 <<tr.trigPathSummaries[i].timesFailed <<"\n"
00239 <<"tr.trigPathSummaries["<<i<<"].timesExcept = "
00240 <<tr.trigPathSummaries[i].timesExcept <<"\n"
00241 <<"tr.trigPathSummaries["<<i<<"].name = "
00242 <<tr.trigPathSummaries[i].name <<"\n";
00243
00244
00245 for(unsigned int j=0;j<tr.trigPathSummaries[i].moduleInPathSummaries.size();j++) {
00246 oss<<"tr.trigPathSummaries["<<i
00247 <<"].moduleInPathSummaries["<<j<<"].timesVisited = "
00248 <<tr.trigPathSummaries[i].moduleInPathSummaries[j].timesVisited<<"\n"
00249 <<"tr.trigPathSummaries["<<i
00250 <<"].moduleInPathSummaries["<<j<<"].timesPassed = "
00251 <<tr.trigPathSummaries[i].moduleInPathSummaries[j].timesPassed<<"\n"
00252 <<"tr.trigPathSummaries["<<i
00253 <<"].moduleInPathSummaries["<<j<<"].timesFailed = "
00254 <<tr.trigPathSummaries[i].moduleInPathSummaries[j].timesFailed<<"\n"
00255 <<"tr.trigPathSummaries["<<i
00256 <<"].moduleInPathSummaries["<<j<<"].timesExcept = "
00257 <<tr.trigPathSummaries[i].moduleInPathSummaries[j].timesExcept<<"\n"
00258 <<"tr.trigPathSummaries["<<i
00259 <<"].moduleInPathSummaries["<<j<<"].moduleLabel = "
00260 <<tr.trigPathSummaries[i].moduleInPathSummaries[j].moduleLabel<<"\n";
00261 }
00262 }
00263
00264
00265 for(unsigned int i=0;i<tr.endPathSummaries.size();i++) {
00266 oss<<"tr.endPathSummaries["<<i<<"].bitPosition = "
00267 <<tr.endPathSummaries[i].bitPosition <<"\n"
00268 <<"tr.endPathSummaries["<<i<<"].timesRun = "
00269 <<tr.endPathSummaries[i].timesRun <<"\n"
00270 <<"tr.endPathSummaries["<<i<<"].timesPassed = "
00271 <<tr.endPathSummaries[i].timesPassed <<"\n"
00272 <<"tr.endPathSummaries["<<i<<"].timesFailed = "
00273 <<tr.endPathSummaries[i].timesFailed <<"\n"
00274 <<"tr.endPathSummaries["<<i<<"].timesExcept = "
00275 <<tr.endPathSummaries[i].timesExcept <<"\n"
00276 <<"tr.endPathSummaries["<<i<<"].name = "
00277 <<tr.endPathSummaries[i].name <<"\n";
00278
00279
00280 for(unsigned int j=0;j<tr.endPathSummaries[i].moduleInPathSummaries.size();j++) {
00281 oss<<"tr.endPathSummaries["<<i
00282 <<"].moduleInPathSummaries["<<j<<"].timesVisited = "
00283 <<tr.endPathSummaries[i].moduleInPathSummaries[j].timesVisited <<"\n"
00284 <<"tr.endPathSummaries["<<i
00285 <<"].moduleInPathSummaries["<<j<<"].timesPassed = "
00286 <<tr.endPathSummaries[i].moduleInPathSummaries[j].timesPassed <<"\n"
00287 <<"tr.endPathSummaries["<<i
00288 <<"].moduleInPathSummaries["<<j<<"].timesFailed = "
00289 <<tr.endPathSummaries[i].moduleInPathSummaries[j].timesFailed <<"\n"
00290 <<"tr.endPathSummaries["<<i
00291 <<"].moduleInPathSummaries["<<j<<"].timesExcept = "
00292 <<tr.endPathSummaries[i].moduleInPathSummaries[j].timesExcept <<"\n"
00293 <<"tr.endPathSummaries["<<i
00294 <<"].moduleInPathSummaries["<<j<<"].moduleLabel = "
00295 <<tr.endPathSummaries[i].moduleInPathSummaries[j].moduleLabel <<"\n";
00296 }
00297 }
00298
00299
00300 for(unsigned int i=0; i<tr.workerSummaries.size(); i++) {
00301 oss<<"tr.workerSummaries["<<i<<"].timesVisited = "
00302 <<tr.workerSummaries[i].timesVisited<<"\n"
00303 <<"tr.workerSummaries["<<i<<"].timesRun = "
00304 <<tr.workerSummaries[i].timesRun<<"\n"
00305 <<"tr.workerSummaries["<<i<<"].timesPassed = "
00306 <<tr.workerSummaries[i].timesPassed <<"\n"
00307 <<"tr.workerSummaries["<<i<<"].timesFailed = "
00308 <<tr.workerSummaries[i].timesFailed <<"\n"
00309 <<"tr.workerSummaries["<<i<<"].timesExcept = "
00310 <<tr.workerSummaries[i].timesExcept <<"\n"
00311 <<"tr.workerSummaries["<<i<<"].moduleLabel = "
00312 <<tr.workerSummaries[i].moduleLabel <<"\n";
00313 }
00314
00315 oss<<"==========================="<<"\n";
00316 oss<<"== END OF TRIGGER REPORT =="<<"\n";
00317 oss<<"==========================="<<"\n";
00318 std::cout << oss.str() << std::endl;
00319
00320 }
00321
00322 void TriggerReportHelpers::packTriggerReport(edm::TriggerReport &tr,
00323 ShmOutputModuleRegistry *sor, bool countDatasets)
00324 {
00325 TriggerReportStatic *trp = (TriggerReportStatic *)cache_->mtext;
00326 trp->lumiSection = lumiSectionIndex_;
00327 trp->prescaleIndex = prescaleIndex_;
00328
00329 trp->eventSummary.totalEvents =
00330 tr.eventSummary.totalEvents - trp_.eventSummary.totalEvents;
00331 trp->eventSummary.totalEventsPassed =
00332 tr.eventSummary.totalEventsPassed - trp_.eventSummary.totalEventsPassed;
00333 trp->eventSummary.totalEventsFailed =
00334 tr.eventSummary.totalEventsFailed - trp_.eventSummary.totalEventsFailed;
00335
00336
00337 trp->trigPathsInMenu = std::min(tr.trigPathSummaries.size(),max_paths);
00338 trp->endPathsInMenu = std::min(tr.endPathSummaries.size(),max_endpaths);
00339
00340
00341
00342 for(int i = 0; i < trp->trigPathsInMenu; i++)
00343 {
00344
00345 trp->trigPathSummaries[i].timesRun =
00346 tr.trigPathSummaries[i].timesRun - trp_.trigPathSummaries[i].timesRun;
00347 trp->trigPathSummaries[i].timesPassed =
00348 tr.trigPathSummaries[i].timesPassed - trp_.trigPathSummaries[i].timesPassed;
00349 if(l1pos_[i]>=0) {
00350 trp->trigPathSummaries[i].timesPassedL1 =
00351 tr.trigPathSummaries[i].moduleInPathSummaries[l1pos_[i]].timesPassed -
00352 trp_.trigPathSummaries[i].moduleInPathSummaries[l1pos_[i]].timesPassed;
00353 }
00354 else {
00355 trp->trigPathSummaries[i].timesPassedL1 =
00356 tr.trigPathSummaries[i].timesRun - trp_.trigPathSummaries[i].timesRun;
00357 }
00358 if(pspos_[i]>=0) {
00359 trp->trigPathSummaries[i].timesPassedPs =
00360 tr.trigPathSummaries[i].moduleInPathSummaries[pspos_[i]].timesPassed -
00361 trp_.trigPathSummaries[i].moduleInPathSummaries[pspos_[i]].timesPassed;
00362 }
00363 else if(l1pos_[i]>=0) {
00364 trp->trigPathSummaries[i].timesPassedPs =
00365 tr.trigPathSummaries[i].moduleInPathSummaries[l1pos_[i]].timesPassed -
00366 trp_.trigPathSummaries[i].moduleInPathSummaries[l1pos_[i]].timesPassed;
00367 }
00368 else {
00369 trp->trigPathSummaries[i].timesPassedPs =
00370 tr.trigPathSummaries[i].timesRun - trp_.trigPathSummaries[i].timesRun;
00371 }
00372 trp->trigPathSummaries[i].timesFailed =
00373 tr.trigPathSummaries[i].timesFailed-trp_.trigPathSummaries[i].timesFailed;
00374 trp->trigPathSummaries[i].timesExcept =
00375 tr.trigPathSummaries[i].timesExcept - trp_.trigPathSummaries[i].timesExcept;
00376 }
00377 for(int i = 0; i < trp->endPathsInMenu; i++)
00378 {
00379 unsigned int j = i + trp->trigPathsInMenu;
00380 evf::OutputModule *o = sor->get(outname_[j]);
00381 if(!o) {
00382
00383 continue;
00384 }
00385 trp->endPathSummaries[i].timesRun =
00386 tr.endPathSummaries[i].timesRun - trp_.endPathSummaries[i].timesRun;
00387 trp->endPathSummaries[i].timesPassed =
00388 o->getCounts() - trp_.endPathSummaries[i].timesPassed;
00389 trp->endPathSummaries[i].timesFailed =
00390 (tr.endPathSummaries[i].timesRun - o->getCounts())
00391 - trp_.endPathSummaries[i].timesFailed;
00392 trp->endPathSummaries[i].timesExcept =
00393 tr.endPathSummaries[i].timesExcept - trp_.endPathSummaries[i].timesExcept;
00394
00395
00396 if(l1pos_[j]>=0) {
00397 trp->endPathSummaries[i].timesPassedL1 =
00398 tr.endPathSummaries[i].moduleInPathSummaries[l1pos_[j]].timesPassed -
00399 trp_.endPathSummaries[i].moduleInPathSummaries[l1pos_[j]].timesPassed;
00400 }
00401 else {
00402 trp->endPathSummaries[i].timesPassedL1 = trp->endPathSummaries[i].timesRun;
00403 }
00404 if(pspos_[j]>=0) {
00405 trp->endPathSummaries[i].timesPassedPs =
00406 tr.endPathSummaries[i].moduleInPathSummaries[pspos_[j]].timesPassed -
00407 trp_.endPathSummaries[i].moduleInPathSummaries[pspos_[j]].timesPassed;
00408 }
00409 else if(l1pos_[j]>=0) {
00410 trp->endPathSummaries[i].timesPassedPs =
00411 tr.endPathSummaries[i].moduleInPathSummaries[l1pos_[j]].timesPassed -
00412 trp_.endPathSummaries[i].moduleInPathSummaries[l1pos_[j]].timesPassed;
00413 }
00414 else {
00415 trp->endPathSummaries[i].timesPassedPs = trp->endPathSummaries[i].timesRun;
00416 }
00417 }
00418
00419 unsigned int datasetIndex = 0;
00420 if (sor && countDatasets) {
00421 std::vector<edm::FUShmOutputModule *> & shmOutputsWithDatasets_ = sor->getShmOutputModulesWithDatasets();
00422 for (unsigned int i=0;i<shmOutputsWithDatasets_.size();i++)
00423 {
00424 std::vector<unsigned int> & outputCounters = shmOutputsWithDatasets_[i]->getDatasetCounts();
00425 for (unsigned int j=0;j<outputCounters.size();j++)
00426 {
00427 if (j>=max_datasets) continue;
00428 trp->datasetSummaries[datasetIndex].timesPassed=outputCounters[j];
00429 datasetIndex++;
00430 }
00431 shmOutputsWithDatasets_[i]->clearDatasetCounts();
00432 }
00433 }
00434 trp->datasetsInMenu=datasetIndex;
00435
00436 trp_ = tr;
00437 for(int i = 0; i < trp->endPathsInMenu; i++)
00438 {
00439 evf::OutputModule *o = sor->get(outname_[i+trp->trigPathsInMenu]);
00440 if(!o) {
00441
00442 continue;
00443 }
00444 trp_.endPathSummaries[i].timesPassed = o->getCounts();
00445 trp_.endPathSummaries[i].timesFailed = tr.endPathSummaries[i].timesRun - o->getCounts();
00446 }
00447
00448 }
00449
00450
00451 void TriggerReportHelpers::sumAndPackTriggerReport(MsgBuf &buf)
00452 {
00453
00454 TriggerReportStatic *trs = (TriggerReportStatic *)cache_->mtext;
00455 TriggerReportStatic *trp = (TriggerReportStatic *)buf->mtext;
00456
00457
00458 if(trp->lumiSection != lumiSectionIndex_){
00459 std::cout << "WARNING: lumisection index mismatch from subprocess " << trp->lumiSection
00460 << " should be " << lumiSectionIndex_ << " will be skipped" << std::endl;
00461 return;
00462 }
00463
00464 if(trs->trigPathsInMenu != trp->trigPathsInMenu)
00465 {
00466 std::ostringstream ost;
00467 ost << "trig path summary inconsistency "
00468 << trs->trigPathsInMenu << " vs. " << trp->trigPathsInMenu;
00469 std::cout << ost.str() << std::endl;
00470 XCEPT_RAISE(evf::Exception,ost.str());
00471 }
00472 if(trs->endPathsInMenu != trp->endPathsInMenu)
00473 {
00474 std::ostringstream ost;
00475 ost << "trig endpath summary inconsistency "
00476 << trs->endPathsInMenu << " vs. " << trp->endPathsInMenu;
00477 std::cout << ost.str() << std::endl;
00478 XCEPT_RAISE(evf::Exception,ost.str());
00479 }
00480
00481 if (!trs->datasetsInMenu) trs->datasetsInMenu = trp->datasetsInMenu;
00482 if(trs->datasetsInMenu != trp->datasetsInMenu)
00483 {
00484 std::ostringstream ost;
00485 ost << "output module dataset summary inconsistency "
00486 << trs->datasetsInMenu << " vs. " << trp->datasetsInMenu;
00487 std::cout << ost.str() << std::endl;
00488 XCEPT_RAISE(evf::Exception,ost.str());
00489 }
00490 funcs::addToReport(trs,trp,lumiSectionIndex_);
00491
00492 }
00493
00494 void TriggerReportHelpers::resetPackedTriggerReport()
00495 {
00496
00497 TriggerReportStatic *trp = (TriggerReportStatic *)cache_->mtext;
00498
00499 funcs::reset(trp);
00500
00501 lumiSectionIndex_++;
00502 }
00503
00504 void TriggerReportHelpers::resetTriggerReport()
00505 {
00506
00507
00508 trp_.eventSummary.totalEvents = 0;
00509 trp_.eventSummary.totalEventsPassed = 0;
00510 trp_.eventSummary.totalEventsFailed = 0;
00511
00512 for(unsigned int i = 0; i < trp_.trigPathSummaries.size(); i++)
00513 {
00514
00515 trp_.trigPathSummaries[i].timesRun = 0;
00516 trp_.trigPathSummaries[i].timesPassed = 0;
00517 trp_.trigPathSummaries[i].timesFailed = 0;
00518 trp_.trigPathSummaries[i].timesExcept = 0;
00519
00520
00521 for(unsigned int j = 0; j<trp_.trigPathSummaries[i].moduleInPathSummaries.size(); j++)
00522 {
00523
00524 trp_.trigPathSummaries[i].moduleInPathSummaries[j].timesVisited = 0;
00525 trp_.trigPathSummaries[i].moduleInPathSummaries[j].timesPassed = 0;
00526 trp_.trigPathSummaries[i].moduleInPathSummaries[j].timesFailed = 0;
00527 trp_.trigPathSummaries[i].moduleInPathSummaries[j].timesExcept = 0;
00528 }
00529 }
00530 for(unsigned int i = 0; i < trp_.endPathSummaries.size(); i++)
00531 {
00532 trp_.endPathSummaries[i].timesRun = 0;
00533 trp_.endPathSummaries[i].timesPassed = 0;
00534 trp_.endPathSummaries[i].timesFailed = 0;
00535 trp_.endPathSummaries[i].timesExcept = 0;
00536 for(unsigned int j = 0; j<trp_.endPathSummaries[i].moduleInPathSummaries.size(); j++)
00537 {
00538 trp_.endPathSummaries[i].moduleInPathSummaries[j].timesVisited = 0;
00539 trp_.endPathSummaries[i].moduleInPathSummaries[j].timesPassed = 0;
00540 trp_.endPathSummaries[i].moduleInPathSummaries[j].timesFailed = 0;
00541 trp_.endPathSummaries[i].moduleInPathSummaries[j].timesExcept = 0;
00542 }
00543 }
00544
00545 }
00546 std::string TriggerReportHelpers::findLabelOfModuleTypeInEndPath(edm::TriggerReport &tr,
00547 std::vector<edm::ModuleDescription const*>& descs,
00548 unsigned int ind,
00549 std::string type)
00550 {
00551 std::string retval;
00552 for(unsigned int j=0;
00553 j<tr.endPathSummaries[ind].moduleInPathSummaries.size();
00554 j++) {
00555
00556 std::string label = tr.endPathSummaries[ind].moduleInPathSummaries[j].moduleLabel;
00557 for(unsigned int k = 0; k < descs.size(); k++)
00558 {
00559 if(descs[k]->moduleLabel() == label)
00560 {
00561 if(descs[k]->moduleName() == type) {retval = label; break;}
00562 }
00563 }
00564 }
00565 return retval;
00566 }
00567
00568 }
00569 }