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 edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &event, const edm::EventSetup &eventSetup) override
 
virtual void endRun (const edm::Run &, const edm::EventSetup &) override
 
 PlotCombiner (const edm::ParameterSet &pset)
 
virtual ~PlotCombiner ()
 
- 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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)
 

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:33
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 
)
inlineoverridevirtual

Implements edm::EDAnalyzer.

Definition at line 22 of file PlotCombiner.cc.

22 {};
void PlotCombiner::endRun ( const edm::Run ,
const edm::EventSetup  
)
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 37 of file PlotCombiner.cc.

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

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, MonitorElement::getTH1(), edm::ParameterSet::getUntrackedParameter(), mergeVDriftHistosByStation::histos, i, j, tablePrinter::labels, LogDebug, myDQMrootFolder, convertSQLitetoXML_cfg::output, and indexGen::outputDir.

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
DQMStore * dqmStore
Definition: PlotCombiner.cc:26

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().