12 virtual void endJob()
override ;
53 edm::LogVerbatim(
"PDFAnalysis") <<
"PDF uncertainties will be determined for the following sets: ";
72 edm::LogVerbatim(
"PDFAnalysis") <<
"\n>>>> Begin of PDF weight systematics summary >>>>";
75 edm::LogVerbatim(
"PDFAnalysis") <<
"Total number of selected data: " <<
selectedEvents_ <<
" [events], corresponding to acceptance: [" << originalAcceptance*100 <<
" +- " << 100*
sqrt( originalAcceptance*(1.-originalAcceptance)/
originalEvents_) <<
"] %";
77 edm::LogVerbatim(
"PDFAnalysis") <<
"\n>>>>> PDF UNCERTAINTIES ON RATE >>>>>>";
82 unsigned int npairs = (nmembers-1)/2;
86 edm::LogVerbatim(
"PDFAnalysis") <<
"\tEstimate for central PDF member: " <<
int(events_central) <<
" [events]";
90 <<
"] % relative variation with respect to original PDF";
93 edm::LogVerbatim(
"PDFAnalysis") <<
"\tNumber of eigenvectors for uncertainty estimation: " << npairs;
96 unsigned int nplus = 0;
97 unsigned int nminus = 0;
98 for (
unsigned int j=0; j<npairs; ++j) {
130 if (wplus>0) wplus =
sqrt(wplus);
131 if (wminus>0) wminus =
sqrt(wminus);
133 if (nplus>0) wplus /=
sqrt(nplus);
134 if (nminus>0) wminus /=
sqrt(nminus);
136 edm::LogVerbatim(
"PDFAnalysis") <<
"\tRelative uncertainty with respect to central member: +" << std::setprecision(4) << 100.*wplus <<
" / -" << std::setprecision(4) << 100.*wminus <<
" [%]";
138 edm::LogVerbatim(
"PDFAnalysis") <<
"\tNO eigenvectors for uncertainty estimation";
142 edm::LogVerbatim(
"PDFAnalysis") <<
"\n>>>>> PDF UNCERTAINTIES ON ACCEPTANCE >>>>>>";
147 unsigned int npairs = (nmembers-1)/2;
150 double acc_central = 0.;
151 double acc2_central = 0.;
157 edm::LogVerbatim(
"PDFAnalysis") <<
"\tEstimate for central PDF member acceptance: [" << acc_central*100 <<
" +- " <<
160 double xi = acc_central-originalAcceptance;
162 if (deltaxi>0) deltaxi =
sqrt(deltaxi);
163 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";
166 edm::LogVerbatim(
"PDFAnalysis") <<
"\tNumber of eigenvectors for uncertainty estimation: " << npairs;
169 unsigned int nplus = 0;
170 unsigned int nminus = 0;
171 for (
unsigned int j=0; j<npairs; ++j) {
205 if (wplus>0) wplus =
sqrt(wplus);
206 if (wminus>0) wminus =
sqrt(wminus);
208 if (nplus>0) wplus /=
sqrt(nplus);
209 if (nminus>0) wminus /=
sqrt(nminus);
211 edm::LogVerbatim(
"PDFAnalysis") <<
"\tRelative uncertainty with respect to central member: +" << std::setprecision(4) << 100.*wplus <<
" / -" << std::setprecision(4) << 100.*wminus <<
" [%]";
213 edm::LogVerbatim(
"PDFAnalysis") <<
"\tNO eigenvectors for uncertainty estimation";
216 edm::LogVerbatim(
"PDFAnalysis") <<
">>>> End of PDF weight systematics summary >>>>";
227 edm::LogError(
"PDFAnalysis") <<
">>> WARNING: some weights not found!";
228 edm::LogError(
"PDFAnalysis") <<
">>> But maybe OK, if you are prefiltering!";
229 edm::LogError(
"PDFAnalysis") <<
">>> If things are OK, this warning should disappear after a while!";
237 bool selectedEvent =
false;
240 edm::LogError(
"PDFAnalysis") <<
">>> TRIGGER collection does not exist !!!";
247 bool pathFound = (pathIndex<trigNames.
size());
249 if (triggerResults->
accept(pathIndex)) selectedEvent =
true;
257 std::vector<double>
weights = (*weightHandle);
258 unsigned int nmembers = weights.size();
262 for (
unsigned int j=0; j<nmembers; ++j) {
269 for (
unsigned int j=0; j<nmembers; ++j) {
std::vector< edm::EDGetTokenT< std::vector< double > > > pdfWeightTokens_
std::vector< edm::InputTag > pdfWeightTags_
std::string selectorPath_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
bool accept() const
Has at least one path accepted the event?
PdfSystematicsAnalyzer(const edm::ParameterSet &pset)
std::vector< double > weightedSelectedEvents_
Strings::size_type size() const
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
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()
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
std::vector< double > weighted2SelectedEvents_
static std::string const triggerResults
static const char *const trigNames[]
std::vector< int > pdfStart_
unsigned int originalEvents_
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override