CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

PlotCombiner Class Reference

Inheritance diagram for PlotCombiner:
edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
virtual void endRun (const edm::Run &, const edm::EventSetup &)
 PlotCombiner (const edm::ParameterSet &pset)
virtual ~PlotCombiner ()

Private Member Functions

void makePlot (const ParameterSet &pset)

Private Attributes

DQMStoredqmStore
string myDQMrootFolder
const VParameterSet plots

Detailed Description

Definition at line 18 of file PlotCombiner.cc.


Constructor & Destructor Documentation

PlotCombiner::PlotCombiner ( const edm::ParameterSet pset)

Definition at line 31 of file PlotCombiner.cc.

                                                     :
  myDQMrootFolder( pset.getUntrackedParameter<string>("MyDQMrootFolder") ),
  plots( pset.getUntrackedParameter<VParameterSet>("Plots") )
{
}
PlotCombiner::~PlotCombiner ( ) [virtual]

Definition at line 102 of file PlotCombiner.cc.

                           {
}

Member Function Documentation

virtual void PlotCombiner::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
) [inline, virtual]

Implements edm::EDAnalyzer.

Definition at line 22 of file PlotCombiner.cc.

{};
void PlotCombiner::endRun ( const edm::Run ,
const edm::EventSetup  
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 37 of file PlotCombiner.cc.

References dqmStore, makePlot(), cmsCodeRules::cppFunctionSkipper::operator, and plots.

                                                              {
  dqmStore = Service<DQMStore>().operator->();
  if( !dqmStore ){
    LogError("HLTriggerOfflineHeavyFlavor") << "Could not find DQMStore service\n";
    return;
  }
  for(VParameterSet::const_iterator pset = plots.begin(); pset!=plots.end(); pset++){
    makePlot(*pset);
  }
}
void PlotCombiner::makePlot ( const ParameterSet pset) [private]

Definition at line 48 of file PlotCombiner.cc.

References DQMStore::book2D(), dqmStore, DQMStore::get(), MonitorElement::getTH1(), edm::ParameterSet::getUntrackedParameter(), mergeVDriftHistosByStation::histos, i, j, L1TDQM_cfg::labels, LogDebug, myDQMrootFolder, convertSQLitetoXML_cfg::output, indexGen::outputDir, and DQMStore::setCurrentFolder().

Referenced by endRun().

                                                   {
//get hold of MEs
  vector<string> inputMEnames = pset.getUntrackedParameter<vector<string> >("InputMEnames");
  vector<string> inputLabels = pset.getUntrackedParameter<vector<string> >("InputLabels");
  if( inputMEnames.size() != inputLabels.size() ){
    LogDebug("HLTriggerOfflineHeavyFlavor") << "Number of labels must match the histos[0]ber of InputMEnames"<<endl;
    return;
  }
  vector<TH1*> histos;
  vector<TString> labels;
  for(size_t i=0; i<inputMEnames.size(); i++){
    string MEname = myDQMrootFolder+"/"+inputMEnames[i];
    MonitorElement *ME = dqmStore->get(MEname);
    if(ME==0){
      LogDebug("HLTriggerOfflineHeavyFlavor") << "Could not find ME: "<<MEname<<endl;
      continue;
    }
    histos.push_back( ME->getTH1() );
    labels.push_back( inputLabels[i] );
  }
  if(histos.size()==0){
    return;
  }
  //figure out the output directory name
  string outputMEname = pset.getUntrackedParameter<string>("OutputMEname");;
  string outputDir = myDQMrootFolder;
  string::size_type slashPos = outputMEname.rfind('/');
  if ( string::npos != slashPos ) {
    outputDir += "/"+outputMEname.substr(0, slashPos);
    outputMEname.erase(0, slashPos+1);
  }
  dqmStore->setCurrentFolder(outputDir);
  //create output ME
  TH2F * output;
  if(histos[0]->GetXaxis()->GetXbins()->GetSize()==0){
    output = new TH2F(outputMEname.c_str(),outputMEname.c_str(),histos[0]->GetXaxis()->GetNbins(),histos[0]->GetXaxis()->GetXmin(),histos[0]->GetXaxis()->GetXmax(),histos.size(),0,histos.size());
  }else{
    output = new TH2F(outputMEname.c_str(),outputMEname.c_str(),histos[0]->GetXaxis()->GetNbins(),histos[0]->GetXaxis()->GetXbins()->GetArray(),histos.size(),0,histos.size());
  }
  output->SetTitle(outputMEname.c_str());
  output->SetXTitle( histos[0]->GetXaxis()->GetTitle() );
  output->SetStats(kFALSE);
  output->SetOption("colztexte");
  for(size_t i=0; i<histos.size(); i++){
    for(int j=1; j<=histos[0]->GetNbinsX(); j++){
      output->SetBinContent(j,i+1,histos[i]->GetBinContent(j));
      output->SetBinError(j,i+1,histos[i]->GetBinError(j));
    }
    output->GetYaxis()->SetBinLabel(i+1,labels[i]);
  }
  dqmStore->book2D(outputMEname,output);
  delete output;
}

Member Data Documentation

Definition at line 26 of file PlotCombiner.cc.

Referenced by endRun(), and makePlot().

Definition at line 27 of file PlotCombiner.cc.

Referenced by makePlot().

Definition at line 28 of file PlotCombiner.cc.

Referenced by endRun().