test
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
ConversionPostprocessing Class Reference

#include <ConversionPostprocessing.h>

Inheritance diagram for ConversionPostprocessing:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
 ConversionPostprocessing (const edm::ParameterSet &pset)
 
virtual void endJob ()
 
virtual void endLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
 
virtual void endRun (const edm::Run &, const edm::EventSetup &)
 
virtual ~ConversionPostprocessing ()
 
- 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 dividePlots (MonitorElement *dividend, MonitorElement *numerator, MonitorElement *denominator, std::string type)
 
void dividePlots (MonitorElement *dividend, MonitorElement *numerator, double denominator)
 
virtual void runPostprocessing ()
 

Private Attributes

bool batch_
 
MonitorElementconvEffEtaTwoTracks_
 
MonitorElementconvEffEtaTwoTracksAndVtxProbGT0005_
 
MonitorElementconvEffEtaTwoTracksAndVtxProbGT0_
 
MonitorElementconvEffEtTwoTracks_
 
MonitorElementconvEffPhiTwoTracks_
 
MonitorElementconvEffRTwoTracks_
 
MonitorElementconvEffRTwoTracksAndVtxProbGT0005_
 
MonitorElementconvEffRTwoTracksAndVtxProbGT0_
 
MonitorElementconvEffZTwoTracks_
 
MonitorElementconvFakeRateEtaTwoTracks_
 
MonitorElementconvFakeRateEtTwoTracks_
 
MonitorElementconvFakeRatePhiTwoTracks_
 
MonitorElementconvFakeRateRTwoTracks_
 
MonitorElementconvFakeRateZTwoTracks_
 
std::stringstream currentFolder_
 
DQMStoredbe_
 
int etaBin
 
int etaBin2
 
double etaMax
 
double etaMin
 
int etBin
 
double etMax
 
double etMin
 
std::string inputFileName_
 
std::string outputFileName_
 
edm::ParameterSet parameters_
 
int phiBin
 
double phiMax
 
double phiMin
 
int rBin
 
double rMax
 
double rMin
 
bool standAlone_
 
int verbosity_
 
int zBin
 
double zMax
 
double zMin
 

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

$Id: ConversionPostprocessing author: Nancy Marinelli, U. of Notre Dame, US

$Id: ConversionPostprocessing authors: Nancy Marinelli, U. of Notre Dame, US

Definition at line 52 of file ConversionPostprocessing.h.

Constructor & Destructor Documentation

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

Definition at line 23 of file ConversionPostprocessing.cc.

References dbe_, edm::ParameterSet::getParameter(), cppFunctionSkipper::operator, DQMStore::setVerbose(), and AlCaHLTBitMon_QueryRunRegistry::string.

24 {
25 
26  dbe_ = 0;
28  dbe_->setVerbose(0);
29  parameters_ = pset;
30 
31 
32  standAlone_ = pset.getParameter<bool>("standAlone");
33  batch_ = pset.getParameter<bool>("batch");
34  outputFileName_ = pset.getParameter<string>("OutputFileName");
35  inputFileName_ = pset.getParameter<std::string>("InputFileName");
36 
37 
38  etMin = parameters_.getParameter<double>("etMin");
39  etMax = parameters_.getParameter<double>("etMax");
40  etBin = parameters_.getParameter<int>("etBin");
41 
42  etaMin = parameters_.getParameter<double>("etaMin");
43  etaMax = parameters_.getParameter<double>("etaMax");
44  etaBin = parameters_.getParameter<int>("etaBin");
45  etaBin2 = parameters_.getParameter<int>("etaBin2");
46 
47  phiMin = parameters_.getParameter<double>("phiMin");
48  phiMax = parameters_.getParameter<double>("phiMax");
49  phiBin = parameters_.getParameter<int>("phiBin");
50 
51  rMin = parameters_.getParameter<double>("rMin");
52  rMax = parameters_.getParameter<double>("rMax");
53  rBin = parameters_.getParameter<int>("rBin");
54 
55  zMin = parameters_.getParameter<double>("zMin");
56  zMax = parameters_.getParameter<double>("zMax");
57  zBin = parameters_.getParameter<int>("zBin");
58 
59 
60 
61 }
T getParameter(std::string const &) const
void setVerbose(unsigned level)
Definition: DQMStore.cc:631
ConversionPostprocessing::~ConversionPostprocessing ( )
virtual

Definition at line 65 of file ConversionPostprocessing.cc.

66 {}

Member Function Documentation

void ConversionPostprocessing::analyze ( const edm::Event e,
const edm::EventSetup esup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 73 of file ConversionPostprocessing.cc.

74 {}
void ConversionPostprocessing::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 68 of file ConversionPostprocessing.cc.

69 {
70 
71 }
void ConversionPostprocessing::dividePlots ( MonitorElement dividend,
MonitorElement numerator,
MonitorElement denominator,
std::string  type 
)
private

Definition at line 175 of file ConversionPostprocessing.cc.

References MonitorElement::getBinContent(), MonitorElement::getNbinsX(), j, MonitorElement::setBinContent(), MonitorElement::setBinError(), mathSSE::sqrt(), and relativeConstraints::value.

175  {
176  double value,err;
177 
178  //quick fix to avoid seg. faults due to null pointers.
179  if (dividend==0 || numerator==0 || denominator==0)return;
180 
181  for (int j=1; j<=numerator->getNbinsX(); j++){
182 
183  if (denominator->getBinContent(j)!=0){
184  if (type=="effic")
185  value = ((double) numerator->getBinContent(j))/((double) denominator->getBinContent(j));
186  else if (type=="fakerate")
187  value = 1-((double) numerator->getBinContent(j))/((double) denominator->getBinContent(j));
188  else return;
189  err = sqrt( value*(1-value) / ((double) denominator->getBinContent(j)) );
190  dividend->setBinContent(j, value);
191  if ( err !=0 ) dividend->setBinError(j,err);
192  }
193  else {
194  dividend->setBinContent(j, 0);
195  dividend->setBinError(j,0);
196  }
197 
198  }
199 
200 
201 }
type
Definition: HCALResponse.h:21
void setBinContent(int binx, double content)
set content of bin (1-D)
T sqrt(T t)
Definition: SSEVec.h:48
int j
Definition: DBlmapReader.cc:9
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
double getBinContent(int binx) const
get content of bin (1-D)
int getNbinsX(void) const
get # of bins in X-axis
void ConversionPostprocessing::dividePlots ( MonitorElement dividend,
MonitorElement numerator,
double  denominator 
)
private

Definition at line 204 of file ConversionPostprocessing.cc.

References MonitorElement::getBinContent(), MonitorElement::getNbinsX(), j, MonitorElement::setBinContent(), MonitorElement::setBinError(), mathSSE::sqrt(), and relativeConstraints::value.

204  {
205  double value,err;
206 
207  //quick fix to avoid seg. faults due to null pointers.
208  if (dividend==0 || numerator==0 )return;
209 
210  for (int j=1; j<=numerator->getNbinsX(); j++){
211  if (denominator!=0){
212  value = ((double) numerator->getBinContent(j))/denominator;
213  err = sqrt( value*(1-value) / denominator);
214  dividend->setBinContent(j, value);
215  dividend->setBinError(j,err);
216  }
217  else {
218  dividend->setBinContent(j, 0);
219  }
220  }
221 
222 }
void setBinContent(int binx, double content)
set content of bin (1-D)
list denominator
Definition: cuy.py:484
T sqrt(T t)
Definition: SSEVec.h:48
int j
Definition: DBlmapReader.cc:9
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
double getBinContent(int binx) const
get content of bin (1-D)
int getNbinsX(void) const
get # of bins in X-axis
void ConversionPostprocessing::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 77 of file ConversionPostprocessing.cc.

void ConversionPostprocessing::endLuminosityBlock ( const edm::LuminosityBlock lumi,
const edm::EventSetup setup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 167 of file ConversionPostprocessing.cc.

168 {
169 
170 
171 }
void ConversionPostprocessing::endRun ( const edm::Run run,
const edm::EventSetup setup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 83 of file ConversionPostprocessing.cc.

83  {
84 
86 
87 }
void ConversionPostprocessing::runPostprocessing ( )
privatevirtual

Definition at line 91 of file ConversionPostprocessing.cc.

References DQMStore::book1D(), dbe_, DQMStore::get(), DQMStore::open(), DQMStore::save(), DQMStore::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

92 {
93 
94 
95 
96  std::string simInfoPathName = "EgammaV/ConversionValidator/SimulationInfo/";
97  std::string convPathName = "EgammaV/ConversionValidator/ConversionInfo/";
98  std::string effPathName = "EgammaV/ConversionValidator/EfficienciesAndFakeRate/";
99 
100 
102 
103  dbe_->setCurrentFolder(effPathName);
104  // Conversion reconstruction efficiency
105  std::string histname = "convEffVsEtaTwoTracks";
106  convEffEtaTwoTracks_ = dbe_->book1D(histname,histname,etaBin2,etaMin, etaMax);
107 
108  histname = "convEffVsPhiTwoTracks";
109  convEffPhiTwoTracks_ = dbe_->book1D(histname,histname,phiBin,phiMin,phiMax);
110 
111  histname = "convEffVsRTwoTracks";
112  convEffRTwoTracks_ = dbe_->book1D(histname,histname,rBin,rMin, rMax);
113 
114  histname = "convEffVsZTwoTracks";
115  convEffZTwoTracks_ = dbe_->book1D(histname,histname,zBin,zMin,zMax);
116 
117  histname = "convEffVsEtTwoTracks";
118  convEffEtTwoTracks_ = dbe_->book1D(histname,histname,etBin,etMin, etMax);
119  //
120  histname = "convEffVsEtaTwoTracksAndVtxProbGT0";
122  histname = "convEffVsEtaTwoTracksAndVtxProbGT0005";
124  histname = "convEffVsRTwoTracksAndVtxProbGT0";
126  histname = "convEffVsRTwoTracksAndVtxProbGT0005";
128  //
129  // Fake rate
130  histname = "convFakeRateVsEtaTwoTracks";
131  convFakeRateEtaTwoTracks_ = dbe_->book1D(histname,histname,etaBin2,etaMin, etaMax);
132  histname = "convFakeRateVsPhiTwoTracks";
134  histname = "convFakeRateVsRTwoTracks";
135  convFakeRateRTwoTracks_ = dbe_->book1D(histname,histname,rBin,rMin, rMax);
136  histname = "convFakeRateVsZTwoTracks";
137  convFakeRateZTwoTracks_ = dbe_->book1D(histname,histname,zBin,zMin,zMax);
138  histname = "convFakeRateVsEtTwoTracks";
139  convFakeRateEtTwoTracks_ = dbe_->book1D(histname,histname,etBin,etMin, etMax);
140 
141  // efficiencies
142  dividePlots(dbe_->get(effPathName+"convEffVsEtaTwoTracks"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksEta"),dbe_->get(simInfoPathName+"h_VisSimConvEta"),"effic");
143  dividePlots(dbe_->get(effPathName+"convEffVsPhiTwoTracks"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksPhi"),dbe_->get(simInfoPathName+"h_VisSimConvPhi"),"effic");
144  dividePlots(dbe_->get(effPathName+"convEffVsRTwoTracks"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksR"),dbe_->get(simInfoPathName+"h_VisSimConvR"),"effic");
145  dividePlots(dbe_->get(effPathName+"convEffVsZTwoTracks"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksZ"),dbe_->get(simInfoPathName+"h_VisSimConvZ"),"effic");
146  dividePlots(dbe_->get(effPathName+"convEffVsEtTwoTracks"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksEt"),dbe_->get(simInfoPathName+"h_VisSimConvEt"),"effic");
147  dividePlots(dbe_->get(effPathName+"convEffVsEtaTwoTracksAndVtxProbGT0"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksEtaAndVtxPGT0"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksEta"),"effic");
148  dividePlots(dbe_->get(effPathName+"convEffVsEtaTwoTracksAndVtxProbGT0005"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksEtaAndVtxPGT0005"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksEta"),"effic");
149  dividePlots(dbe_->get(effPathName+"convEffVsRTwoTracksAndVtxProbGT0"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksRAndVtxPGT0"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksR"),"effic");
150  dividePlots(dbe_->get(effPathName+"convEffVsRTwoTracksAndVtxProbGT0005"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksRAndVtxPGT0005"),dbe_->get(simInfoPathName+"h_SimConvTwoMTracksR"),"effic");
151 
152 
153  // fake rate
154  dividePlots(dbe_->get(effPathName+"convFakeRateVsEtaTwoTracks"),dbe_->get(convPathName+"convEtaAss2"),dbe_->get(convPathName+"convEta2"),"fakerate");
155  dividePlots(dbe_->get(effPathName+"convFakeRateVsPhiTwoTracks"),dbe_->get(convPathName+"convPhiAss"),dbe_->get(convPathName+"convPhi"),"fakerate");
156  dividePlots(dbe_->get(effPathName+"convFakeRateVsRTwoTracks"),dbe_->get(convPathName+"convRAss"),dbe_->get(convPathName+"convR"),"fakerate");
157  dividePlots(dbe_->get(effPathName+"convFakeRateVsZTwoTracks"),dbe_->get(convPathName+"convZAss"),dbe_->get(convPathName+"convZ"),"fakerate");
158  dividePlots(dbe_->get(effPathName+"convFakeRateVsEtTwoTracks"),dbe_->get(convPathName+"convPtAss"),dbe_->get(convPathName+"convPt"),"fakerate");
159 
160 
161 
163  else if(batch_) dbe_->save(inputFileName_);
164 }
MonitorElement * convFakeRateEtaTwoTracks_
MonitorElement * convEffRTwoTracksAndVtxProbGT0005_
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
void dividePlots(MonitorElement *dividend, MonitorElement *numerator, MonitorElement *denominator, std::string type)
MonitorElement * convEffRTwoTracksAndVtxProbGT0_
MonitorElement * convEffEtaTwoTracksAndVtxProbGT0005_
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1708
MonitorElement * convFakeRatePhiTwoTracks_
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2540
bool open(const std::string &filename, bool overwrite=false, const std::string &path="", const std::string &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
Definition: DQMStore.cc:2895
MonitorElement * convEffEtaTwoTracksAndVtxProbGT0_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667

Member Data Documentation

bool ConversionPostprocessing::batch_
private

Definition at line 83 of file ConversionPostprocessing.h.

MonitorElement* ConversionPostprocessing::convEffEtaTwoTracks_
private

Definition at line 109 of file ConversionPostprocessing.h.

MonitorElement* ConversionPostprocessing::convEffEtaTwoTracksAndVtxProbGT0005_
private

Definition at line 116 of file ConversionPostprocessing.h.

MonitorElement* ConversionPostprocessing::convEffEtaTwoTracksAndVtxProbGT0_
private

Definition at line 115 of file ConversionPostprocessing.h.

MonitorElement* ConversionPostprocessing::convEffEtTwoTracks_
private

Definition at line 113 of file ConversionPostprocessing.h.

MonitorElement* ConversionPostprocessing::convEffPhiTwoTracks_
private

Definition at line 110 of file ConversionPostprocessing.h.

MonitorElement* ConversionPostprocessing::convEffRTwoTracks_
private

Definition at line 111 of file ConversionPostprocessing.h.

MonitorElement* ConversionPostprocessing::convEffRTwoTracksAndVtxProbGT0005_
private

Definition at line 118 of file ConversionPostprocessing.h.

MonitorElement* ConversionPostprocessing::convEffRTwoTracksAndVtxProbGT0_
private

Definition at line 117 of file ConversionPostprocessing.h.

MonitorElement* ConversionPostprocessing::convEffZTwoTracks_
private

Definition at line 112 of file ConversionPostprocessing.h.

MonitorElement* ConversionPostprocessing::convFakeRateEtaTwoTracks_
private

Definition at line 121 of file ConversionPostprocessing.h.

MonitorElement* ConversionPostprocessing::convFakeRateEtTwoTracks_
private

Definition at line 125 of file ConversionPostprocessing.h.

MonitorElement* ConversionPostprocessing::convFakeRatePhiTwoTracks_
private

Definition at line 122 of file ConversionPostprocessing.h.

MonitorElement* ConversionPostprocessing::convFakeRateRTwoTracks_
private

Definition at line 123 of file ConversionPostprocessing.h.

MonitorElement* ConversionPostprocessing::convFakeRateZTwoTracks_
private

Definition at line 124 of file ConversionPostprocessing.h.

std::stringstream ConversionPostprocessing::currentFolder_
private

Definition at line 87 of file ConversionPostprocessing.h.

DQMStore* ConversionPostprocessing::dbe_
private

Definition at line 77 of file ConversionPostprocessing.h.

int ConversionPostprocessing::etaBin
private

Definition at line 95 of file ConversionPostprocessing.h.

int ConversionPostprocessing::etaBin2
private

Definition at line 96 of file ConversionPostprocessing.h.

double ConversionPostprocessing::etaMax
private

Definition at line 94 of file ConversionPostprocessing.h.

double ConversionPostprocessing::etaMin
private

Definition at line 93 of file ConversionPostprocessing.h.

int ConversionPostprocessing::etBin
private

Definition at line 92 of file ConversionPostprocessing.h.

double ConversionPostprocessing::etMax
private

Definition at line 91 of file ConversionPostprocessing.h.

double ConversionPostprocessing::etMin
private

Definition at line 90 of file ConversionPostprocessing.h.

std::string ConversionPostprocessing::inputFileName_
private

Definition at line 85 of file ConversionPostprocessing.h.

std::string ConversionPostprocessing::outputFileName_
private

Definition at line 84 of file ConversionPostprocessing.h.

edm::ParameterSet ConversionPostprocessing::parameters_
private
int ConversionPostprocessing::phiBin
private

Definition at line 99 of file ConversionPostprocessing.h.

double ConversionPostprocessing::phiMax
private

Definition at line 98 of file ConversionPostprocessing.h.

double ConversionPostprocessing::phiMin
private

Definition at line 97 of file ConversionPostprocessing.h.

int ConversionPostprocessing::rBin
private

Definition at line 102 of file ConversionPostprocessing.h.

double ConversionPostprocessing::rMax
private

Definition at line 101 of file ConversionPostprocessing.h.

double ConversionPostprocessing::rMin
private

Definition at line 100 of file ConversionPostprocessing.h.

bool ConversionPostprocessing::standAlone_
private

Definition at line 82 of file ConversionPostprocessing.h.

int ConversionPostprocessing::verbosity_
private

Definition at line 78 of file ConversionPostprocessing.h.

int ConversionPostprocessing::zBin
private

Definition at line 105 of file ConversionPostprocessing.h.

double ConversionPostprocessing::zMax
private

Definition at line 104 of file ConversionPostprocessing.h.

double ConversionPostprocessing::zMin
private

Definition at line 103 of file ConversionPostprocessing.h.