11 virtual void endJob()
override ;
36 selectorPath_(pset.getUntrackedParameter<std::
string> (
"SelectorPath",
"")),
37 pdfWeightTags_(pset.getUntrackedParameter<std::vector<edm::InputTag> > (
"PdfWeightTags")) {
47 edm::LogVerbatim(
"PDFAnalysis") <<
"PDF uncertainties will be determined for the following sets: ";
66 edm::LogVerbatim(
"PDFAnalysis") <<
"\n>>>> Begin of PDF weight systematics summary >>>>";
69 edm::LogVerbatim(
"PDFAnalysis") <<
"Total number of selected data: " <<
selectedEvents_ <<
" [events], corresponding to acceptance: [" << originalAcceptance*100 <<
" +- " << 100*
sqrt( originalAcceptance*(1.-originalAcceptance)/
originalEvents_) <<
"] %";
71 edm::LogVerbatim(
"PDFAnalysis") <<
"\n>>>>> PDF UNCERTAINTIES ON RATE >>>>>>";
76 unsigned int npairs = (nmembers-1)/2;
80 edm::LogVerbatim(
"PDFAnalysis") <<
"\tEstimate for central PDF member: " << int(events_central) <<
" [events]";
84 <<
"] % relative variation with respect to original PDF";
87 edm::LogVerbatim(
"PDFAnalysis") <<
"\tNumber of eigenvectors for uncertainty estimation: " << npairs;
90 unsigned int nplus = 0;
91 unsigned int nminus = 0;
92 for (
unsigned int j=0;
j<npairs; ++
j) {
124 if (wplus>0) wplus =
sqrt(wplus);
125 if (wminus>0) wminus =
sqrt(wminus);
127 if (nplus>0) wplus /=
sqrt(nplus);
128 if (nminus>0) wminus /=
sqrt(nminus);
130 edm::LogVerbatim(
"PDFAnalysis") <<
"\tRelative uncertainty with respect to central member: +" << std::setprecision(4) << 100.*wplus <<
" / -" << std::setprecision(4) << 100.*wminus <<
" [%]";
132 edm::LogVerbatim(
"PDFAnalysis") <<
"\tNO eigenvectors for uncertainty estimation";
136 edm::LogVerbatim(
"PDFAnalysis") <<
"\n>>>>> PDF UNCERTAINTIES ON ACCEPTANCE >>>>>>";
141 unsigned int npairs = (nmembers-1)/2;
144 double acc_central = 0.;
145 double acc2_central = 0.;
151 edm::LogVerbatim(
"PDFAnalysis") <<
"\tEstimate for central PDF member acceptance: [" << acc_central*100 <<
" +- " <<
154 double xi = acc_central-originalAcceptance;
155 double deltaxi = (acc2_central-(originalAcceptance+2*xi+xi*xi))/
originalEvents_;
156 if (deltaxi>0) deltaxi =
sqrt(deltaxi);
157 edm::LogVerbatim(
"PDFAnalysis") <<
"\ti.e. [" << std::setprecision(4) << 100*xi/originalAcceptance <<
" +- " << std::setprecision(4) << 100*deltaxi/originalAcceptance <<
"] % relative variation with respect to the original PDF";
160 edm::LogVerbatim(
"PDFAnalysis") <<
"\tNumber of eigenvectors for uncertainty estimation: " << npairs;
163 unsigned int nplus = 0;
164 unsigned int nminus = 0;
165 for (
unsigned int j=0;
j<npairs; ++
j) {
199 if (wplus>0) wplus =
sqrt(wplus);
200 if (wminus>0) wminus =
sqrt(wminus);
202 if (nplus>0) wplus /=
sqrt(nplus);
203 if (nminus>0) wminus /=
sqrt(nminus);
205 edm::LogVerbatim(
"PDFAnalysis") <<
"\tRelative uncertainty with respect to central member: +" << std::setprecision(4) << 100.*wplus <<
" / -" << std::setprecision(4) << 100.*wminus <<
" [%]";
207 edm::LogVerbatim(
"PDFAnalysis") <<
"\tNO eigenvectors for uncertainty estimation";
210 edm::LogVerbatim(
"PDFAnalysis") <<
">>>> End of PDF weight systematics summary >>>>";
221 edm::LogError(
"PDFAnalysis") <<
">>> WARNING: some weights not found!";
222 edm::LogError(
"PDFAnalysis") <<
">>> But maybe OK, if you are prefiltering!";
223 edm::LogError(
"PDFAnalysis") <<
">>> If things are OK, this warning should disappear after a while!";
231 bool selectedEvent =
false;
234 edm::LogError(
"PDFAnalysis") <<
">>> TRIGGER collection does not exist !!!";
241 bool pathFound = (pathIndex<trigNames.
size());
243 if (triggerResults->accept(pathIndex)) selectedEvent =
true;
251 std::vector<double>
weights = (*weightHandle);
252 unsigned int nmembers = weights.size();
256 for (
unsigned int j=0;
j<nmembers; ++
j) {
263 for (
unsigned int j=0;
j<nmembers; ++
j) {
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
std::vector< edm::InputTag > pdfWeightTags_
std::string selectorPath_
#define DEFINE_FWK_MODULE(type)
PdfSystematicsAnalyzer(const edm::ParameterSet &pset)
std::vector< double > weightedSelectedEvents_
Strings::size_type size() const
std::vector< double > weightedEvents_
unsigned int selectedEvents_
virtual bool filter(edm::Event &, const edm::EventSetup &) override
virtual void endJob() override
virtual void beginJob() override
unsigned int triggerIndex(std::string const &name) const
virtual ~PdfSystematicsAnalyzer()
std::vector< double > weighted2SelectedEvents_
static std::string const triggerResults
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
static const char *const trigNames[]
std::vector< int > pdfStart_
unsigned int originalEvents_