32 _analysisname(analysisname),
36 _hltProcessName(
pset.getParameter<
std::
string>(
"hltProcessName")),
37 _histDirectory(
pset.getParameter<
std::
string>(
"histDirectory")),
41 pset.getUntrackedParameter<
std::
string>(
"recoHtJetLabel",
"ak4PFJetsCHS"))),
42 _parametersEta(
pset.getParameter<
std::
vector<double>>(
"parametersEta")),
43 _parametersPhi(
pset.getParameter<
std::
vector<double>>(
"parametersPhi")),
44 _parametersPu(
pset.getParameter<
std::
vector<double>>(
"parametersPu")),
46 _parametersTurnOn(
pset.getParameter<
std::
vector<double>>(
"parametersTurnOn")),
48 _genJetSelector(nullptr),
49 _recMuonSelector(nullptr),
50 _recElecSelector(nullptr),
51 _recCaloMETSelector(nullptr),
52 _recPFMETSelector(nullptr),
53 _recPFTauSelector(nullptr),
54 _recPhotonSelector(nullptr),
55 _recPFJetSelector(nullptr),
56 _recTrackSelector(nullptr),
58 _useNminOneCuts(
false) {
63 if (anpset.
exists(
"parametersTurnOn")) {
69 for (std::map<unsigned int, std::string>::const_iterator it =
_recLabels.begin(); it !=
_recLabels.end(); ++it) {
73 _cutMinPt[it->first] =
pset.getParameter<
double>(objStr +
"_cutMinPt");
74 _cutMaxEta[it->first] =
pset.getParameter<
double>(objStr +
"_cutMaxEta");
77 for (std::map<unsigned int, std::string>::const_iterator it =
_recLabels.begin(); it !=
_recLabels.end(); ++it) {
85 if (anpset.
existsAs<
double>(objStr +
"_cutMinPt",
false)) {
88 if (anpset.
existsAs<
double>(objStr +
"_cutMaxEta",
false)) {
95 std::vector<double> default_parametersHt;
96 default_parametersHt.push_back(100);
97 default_parametersHt.push_back(0);
98 default_parametersHt.push_back(1000);
99 _parametersHt =
pset.getUntrackedParameter<std::vector<double>>(
"parametersHt", default_parametersHt);
109 if (
pset.exists(
"pileUpInfoLabel")) {
113 if (anpset.
existsAs<std::vector<double>>(
"NminOneCuts",
false)) {
116 edm::LogError(
"HiggsValidation") <<
"In HLTHiggsSubAnalysis::HLTHiggsSubAnalysis, " 117 <<
"Incoherence found in the python configuration file!!\nThe SubAnalysis '" 119 <<
_NminOneCuts.size() <<
", while it needs to be at least of size " 124 edm::LogError(
"HiggsValidation") <<
"In HLTHiggsSubAnalysis::HLTHiggsSubAnalysis, " 125 <<
"Incoherence found in the python configuration file!!\nThe SubAnalysis '" 127 <<
"' has a vector NminOneCuts with a dEtaqq of mqq cut on the least b-tagged " 128 "jets of the first 4 jets while only requiring " 133 edm::LogError(
"HiggsValidation") <<
"In HLTHiggsSubAnalysis::HLTHiggsSubAnalysis, " 134 <<
"Incoherence found in the python configuration file!!\nThe SubAnalysis '" 136 <<
"' has a vector NminOneCuts with a CSV3 cut while only requiring " 141 edm::LogError(
"HiggsValidation") <<
"In HLTHiggsSubAnalysis::HLTHiggsSubAnalysis, " 142 <<
"Incoherence found in the python configuration file!!\nThe SubAnalysis '" 144 <<
"' has a vector NminOneCuts with a dPhibb or CSV2 cut using the second most " 145 "b-tagged jet while only requiring " 165 it->second =
nullptr;
193 edm::LogError(
"HiggsValidations") <<
"HLTHiggsSubAnalysis::beginRun: " 194 <<
"Initializtion of HLTConfigProvider failed!!";
205 if (TString(thetriggername).Contains(
pattern)) {
219 for (std::set<std::string>::iterator iPath =
_hltPaths.begin(); iPath !=
_hltPaths.end(); ++iPath) {
224 if (
path.rfind(
"_v") <
path.length()) {
225 shortpath =
path.substr(0,
path.rfind(
"_v"));
230 const std::vector<unsigned int> objsNeedHLT = this->
getObjectsType(shortpath);
233 std::vector<unsigned int> userInstantiate;
234 for (std::map<unsigned int, std::string>::iterator it =
_recLabels.begin(); it !=
_recLabels.end(); ++it) {
235 userInstantiate.push_back(it->first);
237 for (std::vector<unsigned int>::const_iterator it = objsNeedHLT.begin(); it != objsNeedHLT.end(); ++it) {
238 if (
std::find(userInstantiate.begin(), userInstantiate.end(), *it) == userInstantiate.end()) {
239 edm::LogError(
"HiggsValidation") <<
"In HLTHiggsSubAnalysis::beginRun, " 240 <<
"Incoherence found in the python configuration file!!\nThe SubAnalysis '" 241 <<
_analysisname <<
"' has been asked to evaluate the trigger path '" 242 << shortpath <<
"' (found it in 'hltPathsToCheck') BUT this path" 244 <<
"' which has not been instantiate ('recVariableLabels'" 249 LogTrace(
"HiggsValidation") <<
" --- " << shortpath;
262 std::vector<std::string>
sources(2);
266 for (std::map<unsigned int, std::string>::const_iterator it =
_recLabels.begin(); it !=
_recLabels.end(); ++it) {
307 for (std::vector<HLTHiggsPlotter>::iterator it =
_analyzers.begin(); it !=
_analyzers.end(); ++it) {
317 std::string nameGlobalEfficiencyPassing = nameGlobalEfficiency +
"_passingHLT";
318 _elements[nameGlobalEfficiencyPassing] = ibooker.
book1D(nameGlobalEfficiencyPassing.c_str(),
319 nameGlobalEfficiencyPassing.c_str(),
324 std::string titlePu =
"nb of interations in the event";
327 int nBinsPu = (
int)paramsPu[0];
328 double minPu = paramsPu[1];
329 double maxPu = paramsPu[2];
331 std::string titleHt =
"sum of jet pT in the event";
334 int nBinsHt = (
int)paramsHt[0];
335 double minHt = paramsHt[1];
336 double maxHt = paramsHt[2];
341 _elements[nameHtPlot] = ibooker.
book1D(nameHtPlot.c_str(), titleHt.c_str(), nBinsHt,
minHt, maxHt);
346 if (
path.rfind(
"_v") <
path.length()) {
347 shortpath =
path.substr(0,
path.rfind(
"_v"));
349 std::string titlePassingPu =
"nb of interations in the event passing path " + shortpath;
351 _elements[nameVtxPlot +
"_" + shortpath] =
352 ibooker.
book1D(nameVtxPlot +
"_" + shortpath, titlePassingPu.c_str(), nBinsPu,
minPu,
maxPu);
354 std::string titlePassingHt =
"sum of jet pT in the event passing path " + shortpath;
356 _elements[nameHtPlot +
"_" + shortpath] =
357 ibooker.
book1D(nameHtPlot +
"_" + shortpath, titlePassingHt.c_str(), nBinsHt,
minHt, maxHt);
360 _elements[nameGlobalEfficiency]->setBinLabel(
j + 1, shortpath);
361 _elements[nameGlobalEfficiencyPassing]->setBinLabel(
j + 1, shortpath);
370 std::map<unsigned int, std::string> u2str;
374 std::map<unsigned int, double> Htmap;
382 std::vector<PileupSummaryInfo>::const_iterator PVI;
383 for (PVI = puInfo->begin(); PVI != puInfo->end(); ++PVI) {
384 if (PVI->getBunchCrossing() == 0) {
385 nbMCvtx = PVI->getPU_NumInteractions();
395 std::vector<MatchStruct>*
matches =
new std::vector<MatchStruct>;
397 for (std::map<unsigned int, std::string>::iterator it =
_recLabels.begin(); it !=
_recLabels.end(); ++it) {
406 for (
size_t i = 0;
i < cols->
genJets->size(); ++
i) {
440 std::map<unsigned int, std::vector<MatchStruct>> sourceMatchMap;
449 std::map<std::string, bool> nMinOne;
450 std::map<std::string, bool> jetCutResult;
457 bool passAllCuts =
false;
470 this->
passJetCuts(matches, jetCutResult, dEtaqq, mqq, dPhibb, CSV1, CSV2, CSV3);
474 for (std::map<unsigned int, std::string>::iterator it =
_recLabels.begin(); it !=
_recLabels.end(); ++it) {
490 for (std::map<std::string, bool>::const_iterator it = jetCutResult.begin(); it != jetCutResult.end(); ++it) {
491 nMinOne[it->first] =
true;
492 for (std::map<std::string, bool>::const_iterator it2 = jetCutResult.begin(); it2 != jetCutResult.end(); ++it2) {
494 if (it->first ==
"CSV1" && it2->first ==
"CSV3")
496 if (it->first ==
"CSV1" && it2->first ==
"CSV2")
500 if (it->first ==
"CSV2" && it2->first ==
"CSV3")
503 if (it->first != it2->first && !(it2->second)) {
504 nMinOne[it->first] =
false;
510 for (std::map<std::string, bool>::const_iterator it = nMinOne.begin(); it != nMinOne.end(); ++it) {
511 if (
temp && it->second) {
532 for (reco::PFJetCollection::const_iterator iJet = recoJet->begin(); iJet != recoJet->end(); iJet++) {
533 double pt = iJet->pt();
534 double eta = iJet->eta();
544 for (reco::GenJetCollection::const_iterator iJet = genJet->begin(); iJet != genJet->end(); iJet++) {
545 double pt = iJet->pt();
546 double eta = iJet->eta();
556 for (
std::map<
unsigned int, std::vector<MatchStruct>>::iterator it = sourceMatchMap.begin();
557 it != sourceMatchMap.end();
567 std::map<unsigned int, int>* countobjects =
new std::map<unsigned int, int>;
571 countobjects->insert(std::pair<unsigned int, int>(
co->first, 0));
574 const int totalobjectssize2 =
NptPlots * countobjects->size();
575 for (
size_t j = 0;
j < it->second.size(); ++
j) {
576 const unsigned int objType = it->second[
j].objType;
579 float pt = (it->second)[
j].
pt;
580 float eta = (it->second)[
j].
eta;
581 float phi = (it->second)[
j].
phi;
593 if (nMinOne[
maxPt.Data()]) {
613 this->
fillHist(u2str[it->first], objTypeStr,
"Eta",
eta);
614 this->
fillHist(u2str[it->first], objTypeStr,
"Phi",
phi);
617 this->
fillHist(u2str[it->first], objTypeStr,
"Eta",
eta);
618 this->
fillHist(u2str[it->first], objTypeStr,
"Phi",
phi);
622 if (counttotal == totalobjectssize2) {
641 nameCSVplot =
"maxCSV";
642 if (nMinOne[nameCSVplot])
661 _elements[nameHtPlot]->Fill(Htmap[it->first]);
666 for (std::vector<HLTHiggsPlotter>::iterator an =
_analyzers.begin(); an !=
_analyzers.end(); ++an) {
668 const std::string fillShortPath = an->gethltpath();
672 an->analyze(ispassTrigger,
source, it->second, nMinOne, dEtaqq, mqq, dPhibb, CSV1, CSV2, CSV3, passAllCuts);
677 int refOfThePath = -1;
683 _elements[SummaryName]->Fill(refOfThePath);
685 _elements[SummaryName +
"_passingHLT"]->Fill(refOfThePath, 1);
687 _elements[nameVtxPlot +
"_" + fillShortPath]->Fill(nbMCvtx);
689 _elements[nameHtPlot +
"_" + fillShortPath]->Fill(Htmap[it->first]);
691 _elements[SummaryName +
"_passingHLT"]->Fill(refOfThePath, 0);
699 static const unsigned int objSize = 7;
709 std::set<unsigned int> objsType;
711 for (
unsigned int i = 0;
i < objSize; ++
i) {
714 if (!TString(
hltPath).Contains(objTypeStr)) {
716 TString(
hltPath).Contains(
"WHbbBoost")) ||
720 objsType.insert(objtriggernames[
i]);
725 (TString(
hltPath).Contains(
"PFMET") || TString(
hltPath).Contains(
"MHT"))) ||
727 !TString(
hltPath).Contains(TRegexp(
"Jet[^I]"))) ||
733 objsType.insert(objtriggernames[
i]);
736 return std::vector<unsigned int>(objsType.begin(), objsType.end());
741 if (anpset.
exists(
"recMuonLabel")) {
746 if (anpset.
exists(
"recElecLabel")) {
751 if (anpset.
exists(
"recPhotonLabel")) {
756 if (anpset.
exists(
"recCaloMETLabel")) {
761 if (anpset.
exists(
"recPFMETLabel")) {
766 if (anpset.
exists(
"recPFTauLabel")) {
771 if (anpset.
exists(
"recJetLabel")) {
774 if (anpset.
exists(
"jetTagLabel"))
785 edm::LogError(
"HiggsValidation") <<
"HLTHiggsSubAnalysis::bookobjects, " 786 <<
"Not included any object (recMuonLabel, recElecLabel, ...) " 798 if (!
col->isCommonInit()) {
814 for (std::map<unsigned int, std::string>::iterator it =
_recLabels.begin(); it !=
_recLabels.end(); ++it) {
851 edm::LogError(
"HiggsValidation") <<
"HLTHiggsSubAnalysis::initobjects " 852 <<
" NOT IMPLEMENTED (yet) ERROR: '" << it->second <<
"'";
863 sourceUpper[0] = std::toupper(sourceUpper[0]);
867 if (
variable.find(
"MaxPt") != std::string::npos) {
872 desc =
"Next-to-Leading";
877 size_t nBins = nBinsStandard;
878 float*
edges =
new float[nBinsStandard + 1];
879 for (
size_t i = 0;
i < nBinsStandard + 1;
i++) {
885 const size_t nBinsJets = 25;
888 edges =
new float[nBinsJets + 1];
889 for (
size_t i = 0;
i < nBinsJets + 1;
i++) {
894 const size_t nBinsJets = 30;
897 edges =
new float[nBinsJets + 1];
898 for (
size_t i = 0;
i < nBinsJets + 1;
i++) {
964 const float&
value) {
966 sourceUpper[0] = toupper(sourceUpper[0]);
1001 std::vector<MatchStruct>*
matches) {
1011 for (reco::PFJetCollection::const_iterator it = PFJetHandle->begin(); it != PFJetHandle->end(); ++it) {
1017 float bTag = (*(JetTagHandle.
product()))[jetBaseRef];
1027 std::vector<MatchStruct>*
matches,
1028 std::map<std::string, bool>& jetCutResult,
1043 jetCutResult[
maxPt.Data()] =
true;
1045 jetCutResult[
maxPt.Data()] =
false;
1055 jetCutResult[
"dEtaqq"] =
false;
1059 jetCutResult[
"dEtaqq"] =
true;
1064 jetCutResult[
"mqq"] =
false;
1066 mqq = ((*matches)[2].lorentzVector + (*matches)[3].lorentzVector).M();
1068 jetCutResult[
"mqq"] =
true;
1073 jetCutResult[
"dPhibb"] =
false;
1077 jetCutResult[
"dPhibb"] =
true;
1083 jetCutResult[nameCSV2plot] =
false;
1085 CSV2 = (*matches)[1].bTag;
1087 jetCutResult[nameCSV2plot] =
true;
1093 jetCutResult[nameCSV3plot] =
false;
1095 CSV3 = (*matches)[2].bTag;
1097 jetCutResult[nameCSV3plot] =
true;
1102 CSV1 = (*matches)[0].bTag;
1105 nameCSVplot =
"maxCSV";
1108 jetCutResult[nameCSVplot] =
true;
1110 jetCutResult[nameCSVplot] =
false;
1115 CSV1 = (*matches)[0].bTag;
1119 for (
unsigned int i = 1;
i < (
unsigned int)
Njets; ++
i) {
1128 std::map<std::string, bool>& jetCutResult) {
1130 jetCutResult[
"PFMET"] =
false;
1131 for (std::vector<MatchStruct>::const_iterator it =
matches.begin(); it !=
matches.end(); ++it) {
1134 jetCutResult[
"PFMET"] =
true;
1143 std::vector<MatchStruct>*
matches) {
1145 for (
size_t i = 0;
i < cols->
muons->size();
i++) {
1157 for (
size_t i = 0;
i < cols->
photons->size();
i++) {
1163 for (
size_t i = 0;
i < cols->
caloMETs->size();
i++) {
1169 for (
size_t i = 0;
i < cols->
pfMETs->size();
i++) {
1175 for (
size_t i = 0;
i < cols->
pfTaus->size();
i++) {
const std::vector< reco::Muon > * muons
std::vector< double > _parametersTurnOn
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
bool accept() const
Has at least one path accepted the event?
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
void InitSelector(const unsigned int &objtype)
T getParameter(std::string const &) const
std::map< std::string, std::string > _shortpath2long
Relation between the short version of a path.
StringCutObjectSelector< reco::CaloMET > * _recCaloMETSelector
std::vector< PFTau > PFTauCollection
collection of PFTau objects
edm::EDGetTokenT< reco::PFMETCollection > _recLabelsPFMET
edm::EDGetTokenT< reco::PFJetCollection > _recLabelsPFJet
edm::EDGetTokenT< reco::GenParticleCollection > _genParticleLabel
void passJetCuts(std::vector< MatchStruct > *matches, std::map< std::string, bool > &jetCutResult, float &dEtaqq, float &mqq, float &dPhibb, float &CSV1, float &CSV2, float &CSV3)
void initobjects(const edm::Event &iEvent, EVTColContainer *col)
edm::EDGetTokenT< reco::PFJetCollection > _recoHtJetLabel
virtual void setCurrentFolder(std::string const &fullpath)
const std::vector< reco::CaloMET > * caloMETs
edm::EDGetTokenT< reco::PFTauCollection > _recLabelsPFTau
unsigned int _minCandidates
The minimum number of reco/gen candidates needed by the analysis.
std::map< std::string, MonitorElement * > _elements
std::vector< double > _NminOneCuts
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< GenJet > GenJetCollection
collection of GenJet objects
T const * product() const
std::set< std::string > _hltPaths
the hlt paths found in the hltConfig
const reco::GenParticleCollection * genParticles
container with all the objects needed
StringCutObjectSelector< reco::PFMET > * _recPFMETSelector
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
Log< level::Error, false > LogError
edm::EDGetTokenT< reco::GenJetCollection > _genJetLabel
std::map< unsigned int, StringCutObjectSelector< reco::GenParticle > * > _genSelectorMap
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
HLTConfigProvider _hltConfig
__host__ __device__ VT * co
edm::EDGetTokenT< reco::JetTagCollection > _recTagPFJet
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
const std::vector< reco::PFTau > * pfTaus
std::vector< Muon > MuonCollection
collection of Muon objects
void bookHistograms(DQMStore::IBooker &)
std::map< unsigned int, std::string > _recCut
std::vector< double > _parametersPu
edm::EDGetTokenT< reco::PhotonCollection > _recLabelsPhoton
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::CaloMETCollection > _recLabelsCaloMET
StringCutObjectSelector< reco::Track > * _recTrackSelector
void passOtherCuts(const std::vector< MatchStruct > &matches, std::map< std::string, bool > &jetCutResult)
void set(const reco::MuonCollection *v)
Setter: multiple overloaded function.
const reco::GenJetCollection * genJets
std::string _hltProcessName
StringCutObjectSelector< reco::GenJet > * _genJetSelector
std::map< unsigned int, std::string > _genCut
gen/rec objects cuts
void initAndInsertJets(const edm::Event &iEvent, EVTColContainer *cols, std::vector< MatchStruct > *matches)
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > _puSummaryInfo
void addParameter(std::string const &name, T const &value)
std::vector< HLTHiggsPlotter > _analyzers
std::map< unsigned int, double > _cutMaxEta
const std::vector< reco::Photon > * photons
void analyze(const edm::Event &iEvent, const edm::EventSetup &iEventSetup, EVTColContainer *cols)
StringCutObjectSelector< reco::PFTau > * _recPFTauSelector
std::map< unsigned int, double > _cutMinPt
void beginRun(const edm::Run &iRun, const edm::EventSetup &iEventSetup)
edm::EDGetTokenT< edm::TriggerResults > _trigResultsTag
static const char *const trigNames[]
void bookHist(const std::string &source, const std::string &objType, const std::string &variable, DQMStore::IBooker &)
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
std::vector< double > _parametersHt
edm::EDGetTokenT< reco::GsfElectronCollection > _recLabelsElec
HLTHiggsSubAnalysis(const edm::ParameterSet &pset, const std::string &analysisname, edm::ConsumesCollector &&iC)
StringCutObjectSelector< reco::Muon > * _recMuonSelector
std::string _histDirectory
void fillHist(const std::string &source, const std::string &objType, const std::string &variable, const float &value)
std::vector< Photon > PhotonCollection
collectin of Photon objects
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
const std::vector< reco::GsfElectron > * electrons
const std::vector< std::string > & triggerNames() const
names of trigger paths
Helper structure to order MatchStruct.
void insertcandidates(const unsigned int &objtype, const EVTColContainer *col, std::vector< MatchStruct > *matches)
std::vector< PFJet > PFJetCollection
collection of PFJet objects
edm::EDGetTokenT< reco::MuonCollection > _recLabelsMuon
std::vector< double > _parametersPhi
std::string _analysisname
std::vector< std::string > _hltPathsToCheck
the hlt paths with regular expressions
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
std::vector< double > _parametersEta
Some kinematical parameters.
void bookobjects(const edm::ParameterSet &anpset, edm::ConsumesCollector &iC)
StringCutObjectSelector< reco::Photon > * _recPhotonSelector
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
std::map< unsigned int, std::string > _recLabels
const std::vector< reco::PFMET > * pfMETs
StringCutObjectSelector< reco::PFJet > * _recPFJetSelector
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
const std::vector< unsigned int > getObjectsType(const std::string &hltpath) const
Extract what objects need this analysis.
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
const edm::TriggerResults * triggerResults
static std::string const source
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector