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
PhotonDataCertification Class Reference

#include <PhotonDataCertification.h>

Inheritance diagram for PhotonDataCertification:
edm::EDAnalyzer

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 
virtual void endJob ()
 
virtual void endRun (const edm::Run &, const edm::EventSetup &)
 
 PhotonDataCertification (const edm::ParameterSet &pset)
 
 ~PhotonDataCertification ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

DQMStoredbe_
 
edm::ParameterSet parameters_
 
bool verbose_
 

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)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 49 of file PhotonDataCertification.h.

Constructor & Destructor Documentation

PhotonDataCertification::PhotonDataCertification ( const edm::ParameterSet pset)
explicit

Definition at line 19 of file PhotonDataCertification.cc.

References gather_cfg::cout, dbe_, edm::ParameterSet::getParameter(), cppFunctionSkipper::operator, and DQMStore::setVerbose().

21 {
22 
23  dbe_ = 0;
25  dbe_->setVerbose(0);
26  parameters_ = pset;
27  verbose_ = parameters_.getParameter<bool>("verbose");
28 
29  if(verbose_) cout << ">>> Constructor (PhotonDataCertification) <<<" << endl;
30 
31 }
T getParameter(std::string const &) const
void setVerbose(unsigned level)
Definition: DQMStore.cc:393
tuple cout
Definition: gather_cfg.py:121
PhotonDataCertification::~PhotonDataCertification ( )

Definition at line 34 of file PhotonDataCertification.cc.

35 {
36 }

Member Function Documentation

void PhotonDataCertification::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 45 of file PhotonDataCertification.cc.

References gather_cfg::cout.

46 {
47  using namespace edm;
48 
49  if(verbose_) std::cout << ">>> Analyze (PhotonDataCertification) <<<" << std::endl;
50 
51 }
tuple cout
Definition: gather_cfg.py:121
void PhotonDataCertification::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 55 of file PhotonDataCertification.cc.

56 {
57 }
void PhotonDataCertification::beginRun ( const edm::Run run,
const edm::EventSetup c 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 67 of file PhotonDataCertification.cc.

References gather_cfg::cout, and edm::RunBase::id().

68 {
69 
70  if(verbose_) std::cout << ">>> BeginRun (PhotonDataCertification) <<<" << std::endl;
71  if(verbose_) std::cout << ">>> "<< run.id() << std::endl;
72 
73 }
RunID const & id() const
Definition: RunBase.h:41
tuple cout
Definition: gather_cfg.py:121
void PhotonDataCertification::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 61 of file PhotonDataCertification.cc.

62 {
63 }
void PhotonDataCertification::endRun ( const edm::Run run,
const edm::EventSetup c 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 77 of file PhotonDataCertification.cc.

References DQMStore::book2D(), DQMStore::bookFloat(), gather_cfg::cout, dbe_, MonitorElement::Fill(), DQMStore::get(), MonitorElement::getFloatValue(), MonitorElement::getName(), MonitorElement::getQReports(), MonitorElement::getTH2F(), i, and DQMStore::setCurrentFolder().

78 {
79  if(verbose_) std::cout << ">>> EndRun (PhotonDataCertification) <<<" << std::endl;
80 
81  std::vector<string> histoNameVector;
82 
83 
84  //booking histograms according to naming conventions
85 
86  if(!dbe_) return;
87 
88  dbe_->setCurrentFolder("Egamma/EventInfo/");
89 
90  MonitorElement* reportSummary = dbe_->bookFloat("reportSummary");
91  MonitorElement* CertificationSummary = dbe_->bookFloat("CertificationSummary");
92 
93  //for now these will hold values from eta/phi tests for spikes/holes
94  MonitorElement* reportSummaryMap = dbe_->book2D("reportSummaryMap","reportSummaryMap",2,0,2,2,0,2);
95  MonitorElement* CertificationSummaryMap = dbe_->book2D("CertificationSummaryMap","CertificationSummaryMap",2,0,2,2,0,2);
96 
97  TH2 * reportSummaryMapTH2 = reportSummaryMap->getTH2F();
98 
99  reportSummaryMapTH2->GetXaxis()->SetBinLabel(1,"Eta");
100  reportSummaryMapTH2->GetXaxis()->SetBinLabel(2,"Phi");
101  reportSummaryMapTH2->GetYaxis()->SetBinLabel(1,"SpikeTest");
102  reportSummaryMapTH2->GetYaxis()->SetBinLabel(2,"HoleTest");
103 
104  TH2 * CertificationSummaryMapTH2 = CertificationSummaryMap->getTH2F();
105 
106  CertificationSummaryMapTH2->GetXaxis()->SetBinLabel(1,"Eta");
107  CertificationSummaryMapTH2->GetXaxis()->SetBinLabel(2,"Phi");
108  CertificationSummaryMapTH2->GetYaxis()->SetBinLabel(1,"SpikeTest");
109  CertificationSummaryMapTH2->GetYaxis()->SetBinLabel(2,"HoleTest");
110 
111 
112 
113  //histograms to be tested and results put into Egamma/EventInfo/reportSummaryContents
114  histoNameVector.push_back("nPhoAllEcal");
115  histoNameVector.push_back("r9AllEcal");
116  histoNameVector.push_back("phoEta");
117  histoNameVector.push_back("phoPhi");
118 
119 
120 // histoNameVector.push_back("phoEtAllEcal");
121 // histoNameVector.push_back("EfficiencyVsEtHLT");
122 // histoNameVector.push_back("EfficiencyVsEtaHLT");
123 // histoNameVector.push_back("EfficiencyVsEtLoose");
124 // histoNameVector.push_back("EfficiencyVsEtaLoose");
125 
126 
127  // to do: what do we want in certification contents?
128  // dbe_->setCurrentFolder("Egamma/EventInfo/CertificationContents/");
129 
130 
131  //looping over histograms to be tested
132  if(verbose_) std::cout << "\n>>> looping over histograms to be tested <<<\n\n";
133  for(std::vector<string>::iterator it=histoNameVector.begin();it!=histoNameVector.end();++it){
134 
135  string HistoName = (*it);
136  if(verbose_) std::cout << ">>> " << HistoName;
137 
138  MonitorElement * TestHist=0;
139 
140  if(HistoName.find("Efficiency")!=std::string::npos){
141  TestHist = dbe_->get("Egamma/PhotonAnalyzer/Efficiencies/"+HistoName);
142  }
143  else{
144  TestHist = dbe_->get("Egamma/PhotonAnalyzer/GoodCandidatePhotons/Et above 0 GeV/"+HistoName);
145  }
146  bool validMe = TestHist!=0;
147  if(verbose_) std::cout << " is valid? " << validMe << "\n";
148  if(!validMe) continue;
149 
150  if(verbose_) std::cout << ">>> TestHist Name: " << TestHist->getName() << "\n\n";
151 
152 
153 
154  //get QReports associated to each ME
155  std::vector<QReport *> myQReports = TestHist->getQReports();
156  if(verbose_) cout << TestHist->getName() <<": myQReports.size() = " << myQReports.size() << "\n\n";
157  for(uint i=0;i!=myQReports.size();++i) {
158 
159  std::string qtname = myQReports[i]->getQRName() ; // get QT name
160  float qtresult = myQReports[i]->getQTresult(); // get QT result value
161  int qtstatus = myQReports[i]->getStatus() ; // get QT status value
162 
163  if(verbose_) std::cout << "\tTest " << i << ": qtname: " << qtname << "\n";
164  if(verbose_) std::cout << "\tTest " << i << ": qtresult: " << qtresult << std::endl;
165  if(verbose_) std::cout << "\tTest " << i << ": qtstatus: " << qtstatus << "\n\n";
166 
167 
168  //book and fill float for each test done
169  dbe_->setCurrentFolder("Egamma/EventInfo/reportSummaryContents/");
170  MonitorElement * Float = dbe_->bookFloat(HistoName+"_"+qtname);
171  Float->Fill(qtresult);
172 
173  }
174  }
175 
176 
177 
178  //filling summaries based on geometric spikes/holes
179 
180  float etaSpikeTestResult=0;
181  float phiSpikeTestResult=0;
182  float etaHoleTestResult=0;
183  float phiHoleTestResult=0;
184 
185  if(dbe_->get("Egamma/EventInfo/reportSummaryContents/phoEta_SpikeTest")!=0)
186  etaSpikeTestResult = dbe_->get("Egamma/EventInfo/reportSummaryContents/phoEta_SpikeTest")->getFloatValue();
187  else etaSpikeTestResult = -1;
188 
189  if(dbe_->get("Egamma/EventInfo/reportSummaryContents/phoPhi_SpikeTest")!=0)
190  phiSpikeTestResult = dbe_->get("Egamma/EventInfo/reportSummaryContents/phoPhi_SpikeTest")->getFloatValue();
191  else phiSpikeTestResult = -1;
192 
193  if(dbe_->get("Egamma/EventInfo/reportSummaryContents/phoEta_HoleTest")!=0)
194  etaHoleTestResult = dbe_->get("Egamma/EventInfo/reportSummaryContents/phoEta_HoleTest")->getFloatValue();
195  else etaHoleTestResult = -1;
196 
197  if(dbe_->get("Egamma/EventInfo/reportSummaryContents/phoPhi_HoleTest")!=0)
198  phiHoleTestResult = dbe_->get("Egamma/EventInfo/reportSummaryContents/phoPhi_HoleTest")->getFloatValue();
199  else phiHoleTestResult = -1;
200 
201 
202 
203  if(verbose_) std::cout << ">>> Results of tests to be put into Summary Maps <<<\n\n";
204  if(verbose_) std::cout << "\tetaSpikeTestResult= " << etaSpikeTestResult << "\n";
205  if(verbose_) std::cout << "\tphiSpikeTestResult= " << phiSpikeTestResult << "\n";
206  if(verbose_) std::cout << "\tetaHoleTestResult= " << etaHoleTestResult << "\n";
207  if(verbose_) std::cout << "\tphiHoleTestResult= " << phiHoleTestResult << "\n\n";
208 
209 
210  //fill reportSummary & CertificationSummary with average of hole/spike tests
211  float reportSummaryFloat = (etaSpikeTestResult+etaHoleTestResult+phiSpikeTestResult+phiHoleTestResult)/4.;
212  if(reportSummaryFloat<0) reportSummaryFloat = -1;
213  reportSummary->Fill(reportSummaryFloat);
214  CertificationSummary->Fill(reportSummaryFloat);
215 
216  reportSummaryMap->Fill(0,0,etaSpikeTestResult);
217  reportSummaryMap->Fill(0,1,etaHoleTestResult);
218  reportSummaryMap->Fill(1,0,phiSpikeTestResult);
219  reportSummaryMap->Fill(1,1,phiHoleTestResult);
220 
221  CertificationSummaryMap->Fill(0,0,etaSpikeTestResult);
222  CertificationSummaryMap->Fill(0,1,etaHoleTestResult);
223  CertificationSummaryMap->Fill(1,0,phiSpikeTestResult);
224  CertificationSummaryMap->Fill(1,1,phiHoleTestResult);
225 
226 
227 
228 
229 }
const std::string & getName(void) const
get name of ME
int i
Definition: DBlmapReader.cc:9
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:654
void Fill(long long x)
double getFloatValue(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:1468
std::vector< QReport * > getQReports(void) const
get map of QReports
std::string HistoName
tuple cout
Definition: gather_cfg.py:121
TH2F * getTH2F(void) const
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:845
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429

Member Data Documentation

DQMStore* PhotonDataCertification::dbe_
private

Definition at line 66 of file PhotonDataCertification.h.

edm::ParameterSet PhotonDataCertification::parameters_
private
bool PhotonDataCertification::verbose_
private

Definition at line 69 of file PhotonDataCertification.h.