CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
PlotCombiner Class Reference
Inheritance diagram for PlotCombiner:
edm::EDAnalyzer

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 ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

void makePlot (const ParameterSet &pset)
 

Private Attributes

DQMStoredqmStore
 
string myDQMrootFolder
 
const VParameterSet plots
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

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.

31  :
32  myDQMrootFolder( pset.getUntrackedParameter<string>("MyDQMrootFolder") ),
33  plots( pset.getUntrackedParameter<VParameterSet>("Plots") )
34 {
35 }
T getUntrackedParameter(std::string const &, T const &) const
string myDQMrootFolder
Definition: PlotCombiner.cc:27
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:30
const VParameterSet plots
Definition: PlotCombiner.cc:28
PlotCombiner::~PlotCombiner ( )
virtual

Definition at line 102 of file PlotCombiner.cc.

102  {
103 }

Member Function Documentation

virtual void PlotCombiner::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
inlinevirtual

Implements edm::EDAnalyzer.

Definition at line 22 of file PlotCombiner.cc.

22 {};
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, plots, and MultipleCompare::pset.

37  {
39  if( !dqmStore ){
40  LogError("HLTriggerOfflineHeavyFlavor") << "Could not find DQMStore service\n";
41  return;
42  }
43  for(VParameterSet::const_iterator pset = plots.begin(); pset!=plots.end(); pset++){
44  makePlot(*pset);
45  }
46 }
void makePlot(const ParameterSet &pset)
Definition: PlotCombiner.cc:48
const VParameterSet plots
Definition: PlotCombiner.cc:28
DQMStore * dqmStore
Definition: PlotCombiner.cc:26
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().

48  {
49 //get hold of MEs
50  vector<string> inputMEnames = pset.getUntrackedParameter<vector<string> >("InputMEnames");
51  vector<string> inputLabels = pset.getUntrackedParameter<vector<string> >("InputLabels");
52  if( inputMEnames.size() != inputLabels.size() ){
53  LogDebug("HLTriggerOfflineHeavyFlavor") << "Number of labels must match the histos[0]ber of InputMEnames"<<endl;
54  return;
55  }
56  vector<TH1*> histos;
57  vector<TString> labels;
58  for(size_t i=0; i<inputMEnames.size(); i++){
59  string MEname = myDQMrootFolder+"/"+inputMEnames[i];
60  MonitorElement *ME = dqmStore->get(MEname);
61  if(ME==0){
62  LogDebug("HLTriggerOfflineHeavyFlavor") << "Could not find ME: "<<MEname<<endl;
63  continue;
64  }
65  histos.push_back( ME->getTH1() );
66  labels.push_back( inputLabels[i] );
67  }
68  if(histos.size()==0){
69  return;
70  }
71  //figure out the output directory name
72  string outputMEname = pset.getUntrackedParameter<string>("OutputMEname");;
73  string outputDir = myDQMrootFolder;
74  string::size_type slashPos = outputMEname.rfind('/');
75  if ( string::npos != slashPos ) {
76  outputDir += "/"+outputMEname.substr(0, slashPos);
77  outputMEname.erase(0, slashPos+1);
78  }
79  dqmStore->setCurrentFolder(outputDir);
80  //create output ME
81  TH2F * output;
82  if(histos[0]->GetXaxis()->GetXbins()->GetSize()==0){
83  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());
84  }else{
85  output = new TH2F(outputMEname.c_str(),outputMEname.c_str(),histos[0]->GetXaxis()->GetNbins(),histos[0]->GetXaxis()->GetXbins()->GetArray(),histos.size(),0,histos.size());
86  }
87  output->SetTitle(outputMEname.c_str());
88  output->SetXTitle( histos[0]->GetXaxis()->GetTitle() );
89  output->SetStats(kFALSE);
90  output->SetOption("colztexte");
91  for(size_t i=0; i<histos.size(); i++){
92  for(int j=1; j<=histos[0]->GetNbinsX(); j++){
93  output->SetBinContent(j,i+1,histos[i]->GetBinContent(j));
94  output->SetBinError(j,i+1,histos[i]->GetBinError(j));
95  }
96  output->GetYaxis()->SetBinLabel(i+1,labels[i]);
97  }
98  dqmStore->book2D(outputMEname,output);
99  delete output;
100 }
#define LogDebug(id)
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
string myDQMrootFolder
Definition: PlotCombiner.cc:27
uint16_t size_type
Definition: ME.h:11
int j
Definition: DBlmapReader.cc:9
TH1 * getTH1(void) const
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1265
tuple labels
Definition: L1TDQM_cfg.py:62
DQMStore * dqmStore
Definition: PlotCombiner.cc:26
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:642
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:232

Member Data Documentation

DQMStore* PlotCombiner::dqmStore
private

Definition at line 26 of file PlotCombiner.cc.

Referenced by endRun(), and makePlot().

string PlotCombiner::myDQMrootFolder
private

Definition at line 27 of file PlotCombiner.cc.

Referenced by makePlot().

const VParameterSet PlotCombiner::plots
private

Definition at line 28 of file PlotCombiner.cc.

Referenced by endRun().