32 _analysisname(analysisname),
34 _hltProcessName(pset.getParameter<std::
string>(
"hltProcessName")),
35 _genParticleLabel(pset.getParameter<std::
string>(
"genParticleLabel")),
36 _trigResultsLabel(
"TriggerResults",
"", _hltProcessName),
37 _parametersEta(pset.getParameter<std::vector<double> >(
"parametersEta")),
38 _parametersPhi(pset.getParameter<std::vector<double> >(
"parametersPhi")),
39 _parametersTurnOn(pset.getParameter<std::vector<double> >(
"parametersTurnOn")),
41 _recMuonTrkSelector(0),
48 _recCaloMETSelector(0),
51 _recPhotonSelector(0),
53 _recCaloJetSelector(0)
56 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::constructor()";
65 if (anpset.
exists(
"parametersTurnOn")) {
69 if (anpset.
exists(
"parametersEta")) {
73 if (anpset.
exists(
"parametersPhi")) {
87 for (std::map<unsigned int, edm::InputTag>::const_iterator it =
_recLabels.begin();
105 for (std::map<unsigned int, edm::InputTag>::const_iterator it =
_recLabels.begin();
180 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::subAnalysisBookHistos()";
187 for (std::map<unsigned int, edm::InputTag>::const_iterator it =
_recLabels.begin();
190 std::vector<std::string> sources(2);
194 for (
size_t i = 0;
i < sources.size();
i++) {
197 if ( !( TString(objStr).Contains(
"MET") || TString(objStr).Contains(
"MHT") ) || source!=
"gen" ) {
198 bookHist(iBooker, source, objStr,
"MaxPt1");
201 if ( !( TString(objStr).Contains(
"MET") || TString(objStr).Contains(
"MHT") ) ) {
202 bookHist(iBooker, source, objStr,
"Eta");
203 bookHist(iBooker, source, objStr,
"Phi");
204 bookHist(iBooker, source, objStr,
"MaxPt2");
207 if (source ==
"gen")
continue;
208 else bookHist(iBooker, source, objStr,
"SumEt");
216 for (std::vector<HLTExoticaPlotter>::iterator it =
_plotters.begin();
218 it->plotterBookHistos(iBooker, iRun, iSetup);
225 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::beginRun()";
231 bool changedConfig(
true);
233 edm::LogError(
"ExoticaValidation") <<
"HLTExoticaSubAnalysis::constructor(): "
234 <<
"Initialization of HLTConfigProvider failed!";
247 if (TString(thetriggername).Contains(pattern)) {
252 std::cout <<
"--- TRIGGER PATH : " << thetriggername << std::endl;
257 edm::LogWarning(
"ExoticaValidation") <<
"HLTExoticaSubAnalysis::constructor(): In "
266 <<
"\nHLT Trigger Paths found >>>";
267 for (std::set<std::string>::const_iterator
iter =
_hltPaths.begin();
269 LogTrace(
"ExoticaValidation") << (*iter) <<
"\n";
274 for (std::set<std::string>::iterator iPath =
_hltPaths.begin();
279 if (path.rfind(
"_v") < path.length()) {
280 shortpath = path.substr(0, path.rfind(
"_v"));
288 std::vector<unsigned int> objsNeedHLT;
289 for (std::map<unsigned int, edm::InputTag>::iterator it =
_recLabels.begin() ;
291 objsNeedHLT.push_back(it->first);
316 LogTrace(
"ExoticaValidation") <<
" --- " << shortpath;
329 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::analyze()";
350 std::vector<reco::LeafCandidate> matchesGen; matchesGen.clear();
351 std::vector<reco::LeafCandidate> matchesReco; matchesReco.clear();
352 std::map<int , double> theSumEt;
359 for (std::map<unsigned int, edm::InputTag>::iterator it =
_recLabels.begin();
374 if ( TString(objTypeStr).Contains(
"MET") || TString(objTypeStr).Contains(
"MHT") )
continue;
388 matchesGen.push_back(
v);
404 for (std::map<unsigned int, edm::InputTag>::iterator it =
_recLabels.begin();
414 <<
" sumEt=" << theSumEt[it->first] << std::endl;
449 std::map<unsigned int, int> countobjects;
450 for (std::map<unsigned int, edm::InputTag>::iterator co =
_recLabels.begin();
453 countobjects.insert(std::pair<unsigned int, int>(co->first, 0));
458 int totalobjectssize2 = 2 * countobjects.
size();
461 bool isPassedLeadingCut =
true;
463 for (
size_t j = 0;
j != matchesGen.size(); ++
j) {
464 const unsigned int objType = matchesGen[
j].pdgId();
467 if ( !
select( matchesGen[
j] ) ) {
468 isPassedLeadingCut =
false;
474 for (
size_t j = 0; (
j != matchesGen.size() ) && isPassedLeadingCut; ++
j) {
475 const unsigned int objType = matchesGen[
j].pdgId();
479 float pt = matchesGen[
j].pt();
481 if (countobjects[objType] == 0) {
482 this->
fillHist(
"gen", objTypeStr,
"MaxPt1", pt);
483 ++(countobjects[objType]);
486 else if (countobjects[objType] == 1) {
487 this->
fillHist(
"gen", objTypeStr,
"MaxPt2", pt);
488 ++(countobjects[objType]);
493 if (counttotal == totalobjectssize2) {
494 size_t max_size = matchesGen.size();
495 for (
size_t jj =
j;
jj < max_size;
jj++ ) {
496 matchesGen.erase(matchesGen.end());
502 float eta = matchesGen[
j].eta();
503 float phi = matchesGen[
j].phi();
505 this->
fillHist(
"gen", objTypeStr,
"Eta", eta);
506 this->
fillHist(
"gen", objTypeStr,
"Phi", phi);
513 for (std::vector<HLTExoticaPlotter>::iterator an =
_plotters.begin(); an !=
_plotters.end(); ++an) {
516 LogDebug(
"ExoticaValidation") <<
" preparing to call the plotters analysis";
517 an->analyze(ispassTrigger,
"gen", matchesGen, theSumEt);
518 LogDebug(
"ExoticaValidation") <<
" called the plotter";
539 std::map<unsigned int, int> countobjects;
540 for (std::map<unsigned int, edm::InputTag>::iterator co =
_recLabels.begin();
542 countobjects.insert(std::pair<unsigned int, int>(co->first, 0));
547 int totalobjectssize2 = 2 * countobjects.size();
553 bool isPassedLeadingCut =
true;
555 for (
size_t j = 0;
j != matchesReco.size(); ++
j) {
556 const unsigned int objType = matchesReco[
j].pdgId();
559 if ( !
select( matchesReco[
j] ) ) {
560 isPassedLeadingCut =
false;
566 for (
size_t j = 0; (
j != matchesReco.size() ) && isPassedLeadingCut; ++
j) {
567 const unsigned int objType = matchesReco[
j].pdgId();
571 float pt = matchesReco[
j].pt();
574 if (countobjects[objType] == 0) {
575 this->
fillHist(
"rec", objTypeStr,
"MaxPt1", pt);
576 ++(countobjects[objType]);
579 else if (countobjects[objType] == 1) {
580 if( ! ( TString(objTypeStr).Contains(
"MET") || TString(objTypeStr).Contains(
"MHT") ) ) {
581 this->
fillHist(
"rec", objTypeStr,
"MaxPt2", pt);
583 ++(countobjects[objType]);
588 if (counttotal == totalobjectssize2) {
589 size_t max_size = matchesReco.size();
590 for (
size_t jj =
j;
jj < max_size;
jj++ ) {
591 matchesReco.erase(matchesReco.end());
597 float eta = matchesReco[
j].eta();
598 float phi = matchesReco[
j].phi();
600 if ( !( TString(objTypeStr).Contains(
"MET") || TString(objTypeStr).Contains(
"MHT") ) ) {
601 this->
fillHist(
"rec", objTypeStr,
"Eta", eta);
602 this->
fillHist(
"rec", objTypeStr,
"Phi", phi);
605 this->
fillHist(
"rec", objTypeStr,
"SumEt", theSumEt[objType]);
615 for (std::vector<HLTExoticaPlotter>::iterator an =
_plotters.begin(); an !=
_plotters.end(); ++an) {
618 LogDebug(
"ExoticaValidation") <<
" preparing to call the plotters analysis";
619 an->analyze(ispassTrigger,
"rec", matchesReco, theSumEt);
620 LogDebug(
"ExoticaValidation") <<
" called the plotter";
630 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::getObjectsType()";
632 static const unsigned int objSize = 14;
633 static const unsigned int objtriggernames[] = {
650 std::set<unsigned int> objsType;
652 for (
unsigned int i = 0;
i < objSize; ++
i) {
656 if (! TString(hltPath).Contains(objTypeStr)) {
660 objsType.insert(objtriggernames[i]);
663 return std::vector<unsigned int>(objsType.begin(), objsType.end());
669 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::getNamesOfObjects()";
671 if (anpset.
exists(
"recMuonLabel")) {
675 if (anpset.
exists(
"recMuonTrkLabel")) {
679 if (anpset.
exists(
"recTrackLabel")) {
683 if (anpset.
exists(
"recElecLabel")) {
687 if (anpset.
exists(
"recPhotonLabel")) {
691 if (anpset.
exists(
"recMETLabel")) {
695 if (anpset.
exists(
"recPFMETLabel")) {
699 if (anpset.
exists(
"recPFMHTLabel")) {
703 if (anpset.
exists(
"genMETLabel")) {
707 if (anpset.
exists(
"recCaloMETLabel")) {
711 if (anpset.
exists(
"hltMETLabel")) {
715 if (anpset.
exists(
"l1METLabel")) {
719 if (anpset.
exists(
"recPFTauLabel")) {
723 if (anpset.
exists(
"recPFJetLabel")) {
727 if (anpset.
exists(
"recCaloJetLabel")) {
733 edm::LogError(
"ExoticaValidation") <<
"HLTExoticaSubAnalysis::getNamesOfObjects, "
734 <<
"Not included any object (recMuonLabel, recElecLabel, ...) "
754 for (std::map<unsigned int, edm::InputTag>::iterator it =
_recLabels.begin();
827 edm::LogError(
"ExoticaValidation") <<
"HLTExoticaSubAnalysis::registerConsumes"
828 <<
" NOT IMPLEMENTED (yet) ERROR: '" << it->second.label() <<
"'";
837 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::getHandlesToObjects()";
845 LogDebug(
"ExoticaValidation") <<
"Added handle to triggerResults";
853 LogDebug(
"ExoticaValidation") <<
"Added handle to genParticles";
858 LogDebug(
"ExoticaValidation") <<
"We have got " <<
_tokens.size() <<
"tokens";
859 for (std::map<unsigned int, edm::EDGetToken>::iterator it =
_tokens.begin();
932 edm::LogError(
"ExoticaValidation") <<
"HLTExoticaSubAnalysis::getHandlesToObjects "
933 <<
" NOT IMPLEMENTED (yet) ERROR: '" << it->first <<
"'";
944 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::bookHist()";
946 sourceUpper[0] = std::toupper(sourceUpper[0]);
950 if (variable.find(
"SumEt") != std::string::npos) {
953 float *
edges =
new float[nBins + 1];
954 for (
size_t i = 0;
i < nBins + 1;
i++) {
957 h =
new TH1F(name.c_str(), title.c_str(), nBins,
edges);
961 else if (variable.find(
"MaxPt") != std::string::npos) {
962 std::string desc = (variable ==
"MaxPt1") ?
"Leading" :
"Next-to-Leading";
965 float *
edges =
new float[nBins + 1];
966 for (
size_t i = 0;
i < nBins + 1;
i++) {
969 h =
new TH1F(name.c_str(), title.c_str(), nBins,
edges);
974 std::string symbol = (variable ==
"Eta") ?
"#eta" :
"#phi";
977 int nBins = (int)params[0];
978 double min = params[1];
979 double max = params[2];
980 h =
new TH1F(name.c_str(), title.c_str(), nBins,
min,
max);
998 sourceUpper[0] = toupper(sourceUpper[0]);
1001 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::fillHist() " << name <<
" " <<
value;
1003 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::fillHist() " << name <<
" worked";
1010 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::initSelector()";
1051 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::insertCandidates()";
1053 theSumEt[objType] = -1;
1056 for (
size_t i = 0;
i < cols->
muons->size();
i++) {
1057 LogDebug(
"ExoticaValidation") <<
"Inserting muon " <<
i ;
1060 matches->push_back(
m);
1064 for (
size_t i = 0;
i < cols->
tracks->size();
i++) {
1065 LogDebug(
"ExoticaValidation") <<
"Inserting muonTrack " <<
i ;
1067 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>> mom4;
1069 mom4.SetXYZT(mom3.x(),mom3.y(),mom3.z(),mom3.r());
1071 matches->push_back(
m);
1075 for (
size_t i = 0;
i < cols->
tracks->size();
i++) {
1076 LogDebug(
"ExoticaValidation") <<
"Inserting Track " <<
i ;
1078 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>> mom4;
1080 mom4.SetXYZT(mom3.x(),mom3.y(),mom3.z(),mom3.r());
1082 matches->push_back(
m);
1087 LogDebug(
"ExoticaValidation") <<
"Inserting electron " <<
i ;
1090 matches->push_back(
m);
1094 for (
size_t i = 0;
i < cols->
photons->size();
i++) {
1095 LogDebug(
"ExoticaValidation") <<
"Inserting photon " <<
i ;
1098 matches->push_back(
m);
1105 for (
size_t i = 0;
i < cols->
pfMETs->size();
i++) {
1106 LogDebug(
"ExoticaValidation") <<
"Inserting PFMET " <<
i ;
1109 matches->push_back(
m);
1110 if(
i==0) theSumEt[objType] = cols->
pfMETs->at(
i).sumEt();
1114 for (
size_t i = 0;
i < cols->
pfMHTs->size();
i++) {
1115 LogDebug(
"ExoticaValidation") <<
"Inserting PFMHT " <<
i ;
1118 matches->push_back(
m);
1119 if(
i==0) theSumEt[objType] = cols->
pfMHTs->at(
i).sumEt();
1123 for (
size_t i = 0;
i < cols->
genMETs->size();
i++) {
1124 LogDebug(
"ExoticaValidation") <<
"Inserting GENMET " <<
i ;
1127 matches->push_back(
m);
1128 if(
i==0) theSumEt[objType] = cols->
genMETs->at(
i).sumEt();
1132 for (
size_t i = 0;
i < cols->
caloMETs->size();
i++) {
1133 LogDebug(
"ExoticaValidation") <<
"Inserting CALOMET " <<
i ;
1136 matches->push_back(
m);
1137 if(
i==0) theSumEt[objType] = cols->
caloMETs->at(
i).sumEt();
1141 for (
size_t i = 0;
i < cols->
l1METs->size();
i++) {
1142 LogDebug(
"ExoticaValidation") <<
"Inserting L1MET " <<
i ;
1145 matches->push_back(
m);
1146 if(
i==0) theSumEt[objType] = cols->
l1METs->at(
i).etTotal();
1150 for (
size_t i = 0;
i < cols->
pfTaus->size();
i++) {
1151 LogDebug(
"ExoticaValidation") <<
"Inserting PFtau " <<
i ;
1154 matches->push_back(
m);
1158 for (
size_t i = 0;
i < cols->
pfJets->size();
i++) {
1159 LogDebug(
"ExoticaValidation") <<
"Inserting jet " <<
i ;
1162 matches->push_back(
m);
1166 for (
size_t i = 0;
i < cols->
caloJets->size();
i++) {
1167 LogDebug(
"ExoticaValidation") <<
"Inserting jet " <<
i ;
1170 matches->push_back(
m);
const std::vector< reco::Muon > * muons
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
StringCutObjectSelector< reco::Track > * _recMuonTrkSelector
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
T getParameter(std::string const &) const
unsigned int _minCandidates
The minimum number of reco/gen candidates needed by the analysis.
Entry const & retrieve(char const *) const
T getUntrackedParameter(std::string const &, T const &) const
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
void getNamesOfObjects(const edm::ParameterSet &anpset)
Creates the maps that map which collection should come from which label.
std::vector< PFTau > PFTauCollection
collection of PFTau objects
const std::vector< reco::CaloMET > * caloMETs
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< reco::GenMET > GenMETCollection
collection of GenMET objects
std::map< unsigned int, std::string > _genCut
gen/rec objects cuts
bool accept() const
Has at least one path accepted the event?
const std::vector< std::string > & triggerNames() const
names of trigger paths
std::vector< Track > TrackCollection
collection of Tracks
std::vector< HLTExoticaPlotter > _plotters
The plotters: managers of each hlt path where the plots are done.
bool exists(std::string const ¶meterName) const
checks if a parameter exists
StringCutObjectSelector< reco::CaloJet > * _recCaloJetSelector
StringCutObjectSelector< reco::GenMET > * _genMETSelector
std::vector< double > _parametersPhi
const std::vector< reco::CaloJet > * caloJets
void insert(bool ok_to_replace, char const *, Entry const &)
void fillHist(const std::string &source, const std::string &objType, const std::string &variable, const float &value)
const reco::GenParticleCollection * genParticles
container with all the objects needed
Strings::size_type size() const
void analyze(const edm::Event &iEvent, const edm::EventSetup &iEventSetup, EVTColContainer *cols)
edm::InputTag _trigResultsLabel
StringCutObjectSelector< reco::MET > * _recMETSelector
edm::EDGetTokenT< edm::TriggerResults > _trigResultsToken
std::vector< reco::MET > METCollection
collection of MET objects
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
const std::vector< reco::PFTau > * pfTaus
std::vector< Muon > MuonCollection
collection of Muon objects
std::map< unsigned int, std::string > _genCut_leading
gen/rec pt-leading objects cuts
StringCutObjectSelector< reco::PFJet > * _recPFJetSelector
void setPFMHT(const reco::PFMETCollection *v)
std::map< unsigned int, edm::InputTag > _recLabels
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector
void set(const reco::MuonCollection *v)
Setter: multiple overloaded function.
std::map< unsigned int, std::string > _recCut_leading
const std::vector< reco::PFMET > * pfMHTs
StringCutObjectSelector< reco::Muon > * _recMuonSelector
tuple path
else: Piece not in the list, fine.
unsigned int triggerIndex(std::string const &name) const
const std::vector< reco::GenMET > * genMETs
edm::ParameterSet _pset
Internal, working copy of the PSet passed from above.
void subAnalysisBookHistos(DQMStore::IBooker &iBooker, const edm::Run &iRun, const edm::EventSetup &iSetup)
std::vector< double > _parametersEta
Some kinematical parameters.
std::map< unsigned int, std::string > _recCut
const std::vector< unsigned int > getObjectsType(const std::string &hltpath) const
closes analyze method
StringCutObjectSelector< reco::Track > * _recTrackSelector
MonitorElement * book1D(Args &&...args)
const std::vector< reco::PFJet > * pfJets
HLTConfigProvider _hltConfig
Interface to the HLT information.
const std::vector< reco::Track > * tracks
const std::vector< reco::Photon > * photons
virtual const Point & vertex() const =0
vertex position
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
~HLTExoticaSubAnalysis()
End Constructor.
std::vector< std::string > _hltPathsToCheck
The hlt paths to check for.
std::string _hltProcessName
The labels of the object collections to be used in this analysis.
static const char *const trigNames[]
Transform3DPJ::Vector XYZVector
const std::vector< l1extra::L1EtMissParticle > * l1METs
void setCurrentFolder(const std::string &fullpath)
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
void registerConsumes(edm::ConsumesCollector &consCollector)
Registers consumption of objects.
T const * product() const
void getHandlesToObjects(const edm::Event &iEvent, EVTColContainer *col)
Gets the collections themselves.
StringCutObjectSelector< reco::PFMET > * _recPFMETSelector
std::string _analysisname
The name of this sub-analysis.
StringCutObjectSelector< reco::Photon > * _recPhotonSelector
std::vector< Photon > PhotonCollection
collectin of Photon objects
std::map< unsigned int, StringCutObjectSelector< reco::GenParticle > * > _genSelectorMap
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
void beginRun(const edm::Run &iRun, const edm::EventSetup &iEventSetup)
StringCutObjectSelector< l1extra::L1EtMissParticle > * _l1METSelector
const std::vector< reco::GsfElectron > * electrons
std::vector< double > _parametersTurnOn
std::map< unsigned int, edm::EDGetToken > _tokens
std::map< std::string, MonitorElement * > _elements
Structure of the MonitorElements.
StringCutObjectSelector< reco::CaloMET > * _recCaloMETSelector
std::vector< PFJet > PFJetCollection
collection of PFJet objects
HLTExoticaSubAnalysis(const edm::ParameterSet &pset, const std::string &analysisname, edm::ConsumesCollector &&consCollector)
Constructor.
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
edm::EDGetTokenT< reco::GenParticleCollection > _genParticleToken
And also the tokens to get the object collections.
void initSelector(const unsigned int &objtype)
Initializes the selectors of the objects based on which object it is.
edm::InputTag _genParticleLabel
const std::vector< reco::PFMET > * pfMETs
std::set< std::string > _hltPaths
The hlt paths found in the hltConfig.
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
const edm::TriggerResults * triggerResults
StringCutObjectSelector< reco::PFMET > * _recPFMHTSelector
static std::string const source
StringCutObjectSelector< reco::PFTau > * _recPFTauSelector
void bookHist(DQMStore::IBooker &iBooker, const std::string &source, const std::string &objType, const std::string &variable)
The internal functions to book and fill histograms.
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
std::map< std::string, std::string > _shortpath2long
Relation between the short and long versions of the path.
void insertCandidates(const unsigned int &objtype, const EVTColContainer *col, std::vector< reco::LeafCandidate > *matches, std::map< int, double > &theSumEt)
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector