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),
45 _recPhotonSelector(0),
47 _recCaloJetSelector(0)
50 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::constructor()";
59 if (anpset.
exists(
"parametersTurnOn")) {
63 if (anpset.
exists(
"parametersEta")) {
67 if (anpset.
exists(
"parametersPhi")) {
81 for (std::map<unsigned int, edm::InputTag>::const_iterator it =
_recLabels.begin();
95 for (std::map<unsigned int, edm::InputTag>::const_iterator it =
_recLabels.begin();
158 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::subAnalysisBookHistos()";
165 for (std::map<unsigned int, edm::InputTag>::const_iterator it =
_recLabels.begin();
168 std::vector<std::string> sources(2);
172 for (
size_t i = 0;
i < sources.size();
i++) {
174 bookHist(iBooker, source, objStr,
"Eta");
175 bookHist(iBooker, source, objStr,
"Phi");
176 bookHist(iBooker, source, objStr,
"MaxPt1");
177 bookHist(iBooker, source, objStr,
"MaxPt2");
178 bookHist(iBooker, source, objStr,
"SumEt");
184 for (std::vector<HLTExoticaPlotter>::iterator it =
_plotters.begin();
186 it->plotterBookHistos(iBooker, iRun, iSetup);
193 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::beginRun()";
199 bool changedConfig(
true);
201 edm::LogError(
"ExoticaValidation") <<
"HLTExoticaSubAnalysis::constructor(): "
202 <<
"Initialization of HLTConfigProvider failed!";
215 if (TString(thetriggername).Contains(pattern)) {
220 std::cout <<
"--- TRIGGER PATH : " << thetriggername << std::endl;
225 edm::LogWarning(
"ExoticaValidation") <<
"HLTExoticaSubAnalysis::constructor(): In "
234 <<
"\nHLT Trigger Paths found >>>";
235 for (std::set<std::string>::const_iterator
iter =
_hltPaths.begin();
237 LogTrace(
"ExoticaValidation") << (*iter) <<
"\n";
242 for (std::set<std::string>::iterator iPath =
_hltPaths.begin();
247 if (path.rfind(
"_v") < path.length()) {
248 shortpath = path.substr(0, path.rfind(
"_v"));
256 std::vector<unsigned int> objsNeedHLT;
257 for (std::map<unsigned int, edm::InputTag>::iterator it =
_recLabels.begin() ;
259 objsNeedHLT.push_back(it->first);
284 LogTrace(
"ExoticaValidation") <<
" --- " << shortpath;
297 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::analyze()";
321 std::vector<reco::LeafCandidate> matchesGen; matchesGen.clear();
323 std::vector<reco::LeafCandidate> matchesReco; matchesReco.clear();
335 for (std::map<unsigned int, edm::InputTag>::iterator it =
_recLabels.begin();
358 matchesGen.push_back(
v);
376 for (std::map<unsigned int, edm::InputTag>::iterator it =
_recLabels.begin();
426 std::map<unsigned int, int> countobjects;
427 for (std::map<unsigned int, edm::InputTag>::iterator co =
_recLabels.begin();
429 countobjects.insert(std::pair<unsigned int, int>(co->first, 0));
433 int totalobjectssize2 = 2 * countobjects.
size();
435 for (
size_t j = 0;
j != matchesGen.size(); ++
j) {
436 const unsigned int objType = matchesGen[
j].pdgId();
440 float pt = matchesGen[
j].pt();
442 if (countobjects[objType] == 0) {
446 if ( !
select( matchesGen[
j] ) )
break;
448 this->
fillHist(
"gen", objTypeStr,
"MaxPt1", pt);
450 ++countobjects[objType];
452 }
else if (countobjects[objType] == 1) {
453 this->
fillHist(
"gen", objTypeStr,
"MaxPt2", pt);
455 ++countobjects[objType];
459 if (counttotal == totalobjectssize2) {
464 float eta = matchesGen[
j].eta();
465 float phi = matchesGen[
j].phi();
468 this->
fillHist(
"gen", objTypeStr,
"Eta", eta);
469 this->
fillHist(
"gen", objTypeStr,
"Phi", phi);
470 this->
fillHist(
"gen", objTypeStr,
"SumEt", sumEt);
476 for (std::vector<HLTExoticaPlotter>::iterator an =
_plotters.begin(); an !=
_plotters.end(); ++an) {
479 LogDebug(
"ExoticaValidation") <<
" preparing to call the plotters analysis";
480 an->analyze(ispassTrigger,
"gen", matchesGen);
481 LogDebug(
"ExoticaValidation") <<
" called the plotter";
502 std::map<unsigned int, int> countobjects;
503 for (std::map<unsigned int, edm::InputTag>::iterator co =
_recLabels.begin();
505 countobjects.insert(std::pair<unsigned int, int>(co->first, 0));
509 int totalobjectssize2 = 2 * countobjects.size();
514 for (
size_t j = 0;
j != matchesReco.size(); ++
j) {
515 const unsigned int objType = matchesReco[
j].pdgId();
519 float pt = matchesReco[
j].pt();
521 if (countobjects[objType] == 0) {
525 if ( !
select( matchesReco[
j] ) )
break;
527 this->
fillHist(
"rec", objTypeStr,
"MaxPt1", pt);
529 ++countobjects[objType];
531 }
else if (countobjects[objType] == 1) {
532 this->
fillHist(
"rec", objTypeStr,
"MaxPt2", pt);
534 ++countobjects[objType];
538 if (counttotal == totalobjectssize2) {
543 float eta = matchesReco[
j].eta();
544 float phi = matchesReco[
j].phi();
547 this->
fillHist(
"rec", objTypeStr,
"Eta", eta);
548 this->
fillHist(
"rec", objTypeStr,
"Phi", phi);
549 this->
fillHist(
"rec", objTypeStr,
"SumEt", sumEt);
554 for (std::vector<HLTExoticaPlotter>::iterator an =
_plotters.begin(); an !=
_plotters.end(); ++an) {
557 LogDebug(
"ExoticaValidation") <<
" preparing to call the plotters analysis";
558 an->analyze(ispassTrigger,
"rec", matchesReco);
559 LogDebug(
"ExoticaValidation") <<
" called the plotter";
569 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::getObjectsType()";
571 static const unsigned int objSize = 7;
572 static const unsigned int objtriggernames[] = {
583 std::set<unsigned int> objsType;
585 for (
unsigned int i = 0;
i < objSize; ++
i) {
589 if (! TString(hltPath).Contains(objTypeStr)) {
593 objsType.insert(objtriggernames[i]);
596 return std::vector<unsigned int>(objsType.begin(), objsType.end());
602 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::getNamesOfObjects()";
604 if (anpset.
exists(
"recMuonLabel")) {
608 if (anpset.
exists(
"recMuonTrkLabel")) {
612 if (anpset.
exists(
"recElecLabel")) {
616 if (anpset.
exists(
"recPhotonLabel")) {
620 if (anpset.
exists(
"recPFMETLabel")) {
624 if (anpset.
exists(
"recPFTauLabel")) {
628 if (anpset.
exists(
"recPFJetLabel")) {
632 if (anpset.
exists(
"recCaloJetLabel")) {
638 edm::LogError(
"ExoticaValidation") <<
"HLTExoticaSubAnalysis::getNamesOfObjects, "
639 <<
"Not included any object (recMuonLabel, recElecLabel, ...) "
659 for (std::map<unsigned int, edm::InputTag>::iterator it =
_recLabels.begin();
702 edm::LogError(
"ExoticaValidation") <<
"HLTExoticaSubAnalysis::registerConsumes"
703 <<
" NOT IMPLEMENTED (yet) ERROR: '" << it->second.label() <<
"'";
712 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::getHandlesToObjects()";
720 LogDebug(
"ExoticaValidation") <<
"Added handle to triggerResults";
728 LogDebug(
"ExoticaValidation") <<
"Added handle to genParticles";
733 LogDebug(
"ExoticaValidation") <<
"We have got " <<
_tokens.size() <<
"tokens";
734 for (std::map<unsigned int, edm::EDGetToken>::iterator it =
_tokens.begin();
777 edm::LogError(
"ExoticaValidation") <<
"HLTExoticaSubAnalysis::getHandlesToObjects "
778 <<
" NOT IMPLEMENTED (yet) ERROR: '" << it->first <<
"'";
789 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::bookHist()";
791 sourceUpper[0] = std::toupper(sourceUpper[0]);
795 if (variable.find(
"SumEt") != std::string::npos) {
798 float *
edges =
new float[nBins + 1];
799 for (
size_t i = 0;
i < nBins + 1;
i++) {
802 h =
new TH1F(name.c_str(), title.c_str(), nBins,
edges);
805 else if (variable.find(
"MaxPt") != std::string::npos) {
806 std::string desc = (variable ==
"MaxPt1") ?
"Leading" :
"Next-to-Leading";
809 float *
edges =
new float[nBins + 1];
810 for (
size_t i = 0;
i < nBins + 1;
i++) {
813 h =
new TH1F(name.c_str(), title.c_str(), nBins,
edges);
816 std::string symbol = (variable ==
"Eta") ?
"#eta" :
"#phi";
819 int nBins = (int)params[0];
820 double min = params[1];
821 double max = params[2];
822 h =
new TH1F(name.c_str(), title.c_str(), nBins,
min,
max);
840 sourceUpper[0] = toupper(sourceUpper[0]);
843 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::fillHist() " << name <<
" " <<
value;
845 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::fillHist() " << name <<
" worked";
852 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::initSelector()";
881 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::insertCandidates()";
884 for (
size_t i = 0;
i < cols->
muons->size();
i++) {
885 LogDebug(
"ExoticaValidation") <<
"Inserting muon " <<
i ;
888 matches->push_back(
m);
893 LogDebug(
"ExoticaValidation") <<
"Inserting muonTrack " <<
i ;
895 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>> mom4;
897 mom4.SetXYZT(mom3.x(),mom3.y(),mom3.z(),mom3.r());
899 matches->push_back(
m);
904 LogDebug(
"ExoticaValidation") <<
"Inserting electron " <<
i ;
907 matches->push_back(
m);
911 for (
size_t i = 0;
i < cols->
photons->size();
i++) {
912 LogDebug(
"ExoticaValidation") <<
"Inserting photon " <<
i ;
915 matches->push_back(
m);
922 for (
size_t i = 0;
i < cols->
pfMETs->size();
i++) {
923 LogDebug(
"ExoticaValidation") <<
"Inserting PFMET " <<
i ;
926 matches->push_back(
m);
930 for (
size_t i = 0;
i < cols->
pfTaus->size();
i++) {
931 LogDebug(
"ExoticaValidation") <<
"Inserting PFtau " <<
i ;
934 matches->push_back(
m);
938 for (
size_t i = 0;
i < cols->
pfJets->size();
i++) {
939 LogDebug(
"ExoticaValidation") <<
"Inserting jet " <<
i ;
942 matches->push_back(
m);
946 for (
size_t i = 0;
i < cols->
caloJets->size();
i++) {
947 LogDebug(
"ExoticaValidation") <<
"Inserting jet " <<
i ;
950 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.
const std::vector< reco::PFJet > * pfJets
std::vector< PFTau > PFTauCollection
collection of PFTau objects
bool getByToken(EDGetToken token, Handle< PROD > &result) const
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
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
edm::EDGetTokenT< edm::TriggerResults > _trigResultsToken
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
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
StringCutObjectSelector< reco::Muon > * _recMuonSelector
tuple path
else: Piece not in the list, fine.
edm::ParameterSet _pset
Internal, working copy of the PSet passed from above.
const T & max(const T &a, const T &b)
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
MonitorElement * book1D(Args &&...args)
HLTConfigProvider _hltConfig
Interface to the HLT information.
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[]
const std::vector< reco::Track > * muonTracks
Transform3DPJ::Vector XYZVector
void setCurrentFolder(const std::string &fullpath)
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::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)
std::vector< Photon > PhotonCollection
collectin of Photon objects
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.
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
std::set< std::string > _hltPaths
The hlt paths found in the hltConfig.
const std::vector< reco::PFMET > * pfMETs
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
void insertCandidates(const unsigned int &objtype, const EVTColContainer *col, std::vector< reco::LeafCandidate > *matches)
const edm::TriggerResults * triggerResults
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.
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector