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 Attributes
DQMGenericTnPClient Class Reference
Inheritance diagram for DQMGenericTnPClient:
edm::EDAnalyzer

Public Member Functions

virtual void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
 
void calculateEfficiency (const ParameterSet &pset)
 
 DQMGenericTnPClient (const edm::ParameterSet &pset)
 
virtual void endRun (const edm::Run &run, const edm::EventSetup &setup)
 
virtual ~DQMGenericTnPClient ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

DQMStoredqmStore
 
const VParameterSet efficiencies
 
GaussianPlusLinearFitterGPLfitter
 
string myDQMrootFolder
 
TFile * plots
 
bool verbose
 
VoigtianPlusExponentialFitterVPEfitter
 

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 17 of file DQMGenericTnPClient.cc.

Constructor & Destructor Documentation

DQMGenericTnPClient::DQMGenericTnPClient ( const edm::ParameterSet pset)

Definition at line 34 of file DQMGenericTnPClient.cc.

References edm::ParameterSet::getUntrackedParameter(), GPLfitter, plots, and VPEfitter.

34  :
35  myDQMrootFolder( pset.getUntrackedParameter<string>("MyDQMrootFolder") ),
36  verbose( pset.getUntrackedParameter<bool>("Verbose",false) ),
37  efficiencies( pset.getUntrackedParameter<VParameterSet>("Efficiencies") )
38 {
39  TString savePlotsInRootFileName = pset.getUntrackedParameter<string>("SavePlotsInRootFileName","");
40  plots = savePlotsInRootFileName!="" ? new TFile(savePlotsInRootFileName,"recreate") : 0;
43 }
T getUntrackedParameter(std::string const &, T const &) const
GaussianPlusLinearFitter * GPLfitter
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:29
VoigtianPlusExponentialFitter * VPEfitter
const VParameterSet efficiencies
DQMGenericTnPClient::~DQMGenericTnPClient ( )
virtual

Definition at line 140 of file DQMGenericTnPClient.cc.

References GPLfitter, and plots.

140  {
141  delete GPLfitter;
142  if(plots){
143  plots->Close();
144  }
145 }
GaussianPlusLinearFitter * GPLfitter

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 21 of file DQMGenericTnPClient.cc.

21 {};
void DQMGenericTnPClient::calculateEfficiency ( const ParameterSet pset)

Definition at line 58 of file DQMGenericTnPClient.cc.

References cond::ecalcond::all, DQMStore::bookProfile(), DQMStore::bookProfile2D(), dqmStore, error, DQMStore::get(), MonitorElement::getTH1(), edm::ParameterSet::getUntrackedParameter(), GPLfitter, LogDebug, myDQMrootFolder, plots, prof2calltree::prefix, DQMStore::setCurrentFolder(), dqmTnP::AbstractFitter::setup(), dqmTnP::VoigtianPlusExponentialFitter::setup(), and VPEfitter.

Referenced by endRun().

58  {
59  //get hold of numerator and denominator histograms
60  string allMEname = myDQMrootFolder+"/"+pset.getUntrackedParameter<string>("DenominatorMEname");
61  string passMEname = myDQMrootFolder+"/"+pset.getUntrackedParameter<string>("NumeratorMEname");
62  MonitorElement *allME = dqmStore->get(allMEname);
63  MonitorElement *passME = dqmStore->get(passMEname);
64  if(allME==0 || passME==0){
65  LogDebug("DQMGenericTnPClient")<<"Could not find MEs: "<<allMEname<<" or "<<passMEname<<endl;
66  return;
67  }
68  TH1 *all = allME->getTH1();
69  TH1 *pass = passME->getTH1();
70  //setup the fitter
71  string fitFunction = pset.getUntrackedParameter<string>("FitFunction");
72  AbstractFitter *fitter = 0;
73  if(fitFunction=="GaussianPlusLinear"){
75  pset.getUntrackedParameter<double>("ExpectedMean"),
76  pset.getUntrackedParameter<double>("FitRangeLow"),
77  pset.getUntrackedParameter<double>("FitRangeHigh"),
78  pset.getUntrackedParameter<double>("ExpectedSigma")
79  );
80  fitter = GPLfitter;
81  }else if(fitFunction=="VoigtianPlusExponential"){
83  pset.getUntrackedParameter<double>("ExpectedMean"),
84  pset.getUntrackedParameter<double>("FitRangeLow"),
85  pset.getUntrackedParameter<double>("FitRangeHigh"),
86  pset.getUntrackedParameter<double>("ExpectedSigma"),
87  pset.getUntrackedParameter<double>("FixedWidth")
88  );
89  fitter = VPEfitter;
90  }else{
91  LogError("DQMGenericTnPClient")<<"Fit function: "<<fitFunction<<" does not exist"<<endl;
92  return;
93  }
94  //check dimensions
95  int dimensions = all->GetDimension();
96  int massDimension = pset.getUntrackedParameter<int>("MassDimension");
97  if(massDimension>dimensions){
98  LogError("DQMGenericTnPClient")<<"Monitoring Element "<<allMEname<<" has smaller dimension than "<<massDimension<<endl;
99  return;
100  }
101  //figure out directory and efficiency names
102  string effName = pset.getUntrackedParameter<string>("EfficiencyMEname");
103  string effDir = myDQMrootFolder;
104  string::size_type slashPos = effName.rfind('/');
105  if ( string::npos != slashPos ) {
106  effDir += "/"+effName.substr(0, slashPos);
107  effName.erase(0, slashPos+1);
108  }
109  dqmStore->setCurrentFolder(effDir);
110  TString prefix(effDir.c_str());
111  prefix.ReplaceAll('/','_');
112  //calculate and book efficiency
113  if(dimensions==2){
114  TProfile* eff = 0;
115  TProfile* effChi2 = 0;
116  TString error = fitter->calculateEfficiency((TH2*)pass, (TH2*)all, massDimension, eff, effChi2, plots?prefix+effName.c_str():"");
117  if(error!=""){
118  LogError("DQMGenericTnPClient")<<error<<endl;
119  return;
120  }
121  dqmStore->bookProfile(effName,eff);
122  dqmStore->bookProfile(effName+"Chi2",effChi2);
123  delete eff;
124  delete effChi2;
125  }else if(dimensions==3){
126  TProfile2D* eff = 0;
127  TProfile2D* effChi2 = 0;
128  TString error = fitter->calculateEfficiency((TH3*)pass, (TH3*)all, massDimension, eff, effChi2, plots?prefix+effName.c_str():"");
129  if(error!=""){
130  LogError("DQMGenericTnPClient")<<error<<endl;
131  return;
132  }
133  dqmStore->bookProfile2D(effName,eff);
134  dqmStore->bookProfile2D(effName+"Chi2",effChi2);
135  delete eff;
136  delete effChi2;
137  }
138 }
#define LogDebug(id)
T getUntrackedParameter(std::string const &, T const &) const
GaussianPlusLinearFitter * GPLfitter
void setup(double expectedMean_, double massLow, double massHigh, double expectedSigma_)
uint16_t size_type
void setup(double expectedMean_, double massLow, double massHigh, double expectedSigma_, double width_)
VoigtianPlusExponentialFitter * VPEfitter
TH1 * getTH1(void) const
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:833
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1270
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237
MonitorElement * bookProfile2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, const char *option="s")
Definition: DQMStore.cc:977
void DQMGenericTnPClient::endRun ( const edm::Run run,
const edm::EventSetup setup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 45 of file DQMGenericTnPClient.cc.

References calculateEfficiency(), dqmStore, efficiencies, myDQMrootFolder, cmsCodeRules.cppFunctionSkipper::operator, CrabTask::pset, and DQMStore::setCurrentFolder().

45  {
47  if( !dqmStore ){
48  LogError("DQMGenericTnPClient")<<"Could not find DQMStore service\n";
49  return;
50  }
52  //loop over all efficiency tasks
53  for(VParameterSet::const_iterator pset = efficiencies.begin(); pset!=efficiencies.end(); pset++){
55  }
56 }
void calculateEfficiency(const ParameterSet &pset)
tuple pset
Definition: CrabTask.py:85
const VParameterSet efficiencies
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237

Member Data Documentation

DQMStore* DQMGenericTnPClient::dqmStore
private

Definition at line 25 of file DQMGenericTnPClient.cc.

Referenced by calculateEfficiency(), and endRun().

const VParameterSet DQMGenericTnPClient::efficiencies
private

Definition at line 29 of file DQMGenericTnPClient.cc.

Referenced by endRun().

GaussianPlusLinearFitter* DQMGenericTnPClient::GPLfitter
private
string DQMGenericTnPClient::myDQMrootFolder
private

Definition at line 27 of file DQMGenericTnPClient.cc.

Referenced by calculateEfficiency(), and endRun().

TFile* DQMGenericTnPClient::plots
private
bool DQMGenericTnPClient::verbose
private
VoigtianPlusExponentialFitter* DQMGenericTnPClient::VPEfitter
private

Definition at line 31 of file DQMGenericTnPClient.cc.

Referenced by calculateEfficiency(), and DQMGenericTnPClient().