30 _analysisname(analysisname),
32 _hltProcessName(pset.getParameter<std::
string>(
"hltProcessName")),
33 _genParticleLabel(pset.getParameter<std::
string>(
"genParticleLabel")),
34 _trigResultsLabel(
"TriggerResults",
"", _hltProcessName),
35 _parametersEta(pset.getParameter<std::vector<double> >(
"parametersEta")),
36 _parametersPhi(pset.getParameter<std::vector<double> >(
"parametersPhi")),
37 _parametersTurnOn(pset.getParameter<std::vector<double> >(
"parametersTurnOn")),
42 _recPhotonSelector(0),
46 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::constructor()";
55 if (anpset.
exists(
"parametersTurnOn")) {
59 if (anpset.
exists(
"parametersEta")) {
63 if (anpset.
exists(
"parametersPhi")) {
77 for (std::map<unsigned int, edm::InputTag>::const_iterator it =
_recLabels.begin();
85 for (std::map<unsigned int, edm::InputTag>::const_iterator it =
_recLabels.begin();
144 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::subAnalysisBookHistos()";
151 for (std::map<unsigned int, edm::InputTag>::const_iterator it =
_recLabels.begin();
154 std::vector<std::string> sources(2);
158 for (
size_t i = 0;
i < sources.size();
i++) {
160 bookHist(iBooker, source, objStr,
"Eta");
161 bookHist(iBooker, source, objStr,
"Phi");
162 bookHist(iBooker, source, objStr,
"MaxPt1");
163 bookHist(iBooker, source, objStr,
"MaxPt2");
164 bookHist(iBooker, source, objStr,
"SumEt");
170 for (std::vector<HLTExoticaPlotter>::iterator it =
_plotters.begin();
172 it->plotterBookHistos(iBooker, iRun, iSetup);
179 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::beginRun()";
185 bool changedConfig(
true);
187 edm::LogError(
"ExoticaValidation") <<
"HLTExoticaSubAnalysis::constructor(): "
188 <<
"Initialization of HLTConfigProvider failed!";
201 if (TString(thetriggername).Contains(pattern)) {
209 edm::LogWarning(
"ExoticaValidation") <<
"HLTExoticaSubAnalysis::constructor(): In "
218 <<
"\nHLT Trigger Paths found >>>";
219 for (std::set<std::string>::const_iterator
iter =
_hltPaths.begin();
221 LogTrace(
"ExoticaValidation") << (*iter) <<
"\n";
226 for (std::set<std::string>::iterator iPath =
_hltPaths.begin();
231 if (path.rfind(
"_v") < path.length()) {
232 shortpath = path.substr(0, path.rfind(
"_v"));
240 std::vector<unsigned int> objsNeedHLT;
241 for (std::map<unsigned int, edm::InputTag>::iterator it =
_recLabels.begin() ;
243 objsNeedHLT.push_back(it->first);
268 LogTrace(
"ExoticaValidation") <<
" --- " << shortpath;
281 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::analyze()";
305 std::vector<reco::LeafCandidate> matchesGen; matchesGen.clear();
307 std::vector<reco::LeafCandidate> matchesReco; matchesReco.clear();
319 for (std::map<unsigned int, edm::InputTag>::iterator it =
_recLabels.begin();
342 matchesGen.push_back(
v);
360 for (std::map<unsigned int, edm::InputTag>::iterator it =
_recLabels.begin();
410 std::map<unsigned int, int> * countobjects =
new std::map<unsigned int, int>;
411 for (std::map<unsigned int, edm::InputTag>::iterator co =
_recLabels.begin();
413 countobjects->insert(std::pair<unsigned int, int>(co->first, 0));
417 int totalobjectssize2 = 2 * countobjects->
size();
419 for (
size_t j = 0;
j != matchesGen.size(); ++
j) {
420 const unsigned int objType = matchesGen[
j].pdgId();
424 float pt = matchesGen[
j].pt();
425 float eta = matchesGen[
j].eta();
426 float phi = matchesGen[
j].phi();
429 this->
fillHist(
"gen", objTypeStr,
"Eta", eta);
430 this->
fillHist(
"gen", objTypeStr,
"Phi", phi);
431 this->
fillHist(
"gen", objTypeStr,
"SumEt", sumEt);
433 if ((*countobjects)[objType] == 0) {
434 this->
fillHist(
"gen", objTypeStr,
"MaxPt1", pt);
436 ++((*countobjects)[objType]);
438 }
else if ((*countobjects)[objType] == 1) {
439 this->
fillHist(
"gen", objTypeStr,
"MaxPt2", pt);
441 ++((*countobjects)[objType]);
445 if (counttotal == totalobjectssize2) {
451 LogDebug(
"ExoticaValidation") <<
" deleting countobjects";
456 for (std::vector<HLTExoticaPlotter>::iterator an =
_plotters.begin(); an !=
_plotters.end(); ++an) {
459 LogDebug(
"ExoticaValidation") <<
" preparing to call the plotters analysis";
460 an->analyze(ispassTrigger,
"gen", matchesGen);
461 LogDebug(
"ExoticaValidation") <<
" called the plotter";
482 std::map<unsigned int, int> * countobjects =
new std::map<unsigned int, int>;
483 for (std::map<unsigned int, edm::InputTag>::iterator co =
_recLabels.begin();
485 countobjects->insert(std::pair<unsigned int, int>(co->first, 0));
489 int totalobjectssize2 = 2 * countobjects->size();
494 for (
size_t j = 0;
j != matchesReco.size(); ++
j) {
495 const unsigned int objType = matchesReco[
j].pdgId();
499 float pt = matchesReco[
j].pt();
500 float eta = matchesReco[
j].eta();
501 float phi = matchesReco[
j].phi();
504 this->
fillHist(
"rec", objTypeStr,
"Eta", eta);
505 this->
fillHist(
"rec", objTypeStr,
"Phi", phi);
506 this->
fillHist(
"rec", objTypeStr,
"SumEt", sumEt);
508 if ((*countobjects)[objType] == 0) {
509 this->
fillHist(
"rec", objTypeStr,
"MaxPt1", pt);
511 ++((*countobjects)[objType]);
513 }
else if ((*countobjects)[objType] == 1) {
514 this->
fillHist(
"rec", objTypeStr,
"MaxPt2", pt);
516 ++((*countobjects)[objType]);
520 if (counttotal == totalobjectssize2) {
526 LogDebug(
"ExoticaValidation") <<
" deleting countobjects";
531 for (std::vector<HLTExoticaPlotter>::iterator an =
_plotters.begin(); an !=
_plotters.end(); ++an) {
534 LogDebug(
"ExoticaValidation") <<
" preparing to call the plotters analysis";
535 an->analyze(ispassTrigger,
"rec", matchesReco);
536 LogDebug(
"ExoticaValidation") <<
" called the plotter";
546 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::getObjectsType()";
548 static const unsigned int objSize = 6;
549 static const unsigned int objtriggernames[] = {
558 std::set<unsigned int> objsType;
560 for (
unsigned int i = 0;
i < objSize; ++
i) {
564 if (! TString(hltPath).Contains(objTypeStr)) {
568 objsType.insert(objtriggernames[i]);
571 return std::vector<unsigned int>(objsType.begin(), objsType.end());
577 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::getNamesOfObjects()";
579 if (anpset.
exists(
"recMuonLabel")) {
583 if (anpset.
exists(
"recElecLabel")) {
587 if (anpset.
exists(
"recPhotonLabel")) {
591 if (anpset.
exists(
"recPFMETLabel")) {
595 if (anpset.
exists(
"recPFTauLabel")) {
599 if (anpset.
exists(
"recJetLabel")) {
605 edm::LogError(
"ExoticaValidation") <<
"HLTExoticaSubAnalysis::getNamesOfObjects, "
606 <<
"Not included any object (recMuonLabel, recElecLabel, ...) "
626 for (std::map<unsigned int, edm::InputTag>::iterator it =
_recLabels.begin();
659 edm::LogError(
"ExoticaValidation") <<
"HLTExoticaSubAnalysis::registerConsumes"
660 <<
" NOT IMPLEMENTED (yet) ERROR: '" << it->second.label() <<
"'";
669 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::getHandlesToObjects()";
677 LogDebug(
"ExoticaValidation") <<
"Added handle to triggerResults";
685 LogDebug(
"ExoticaValidation") <<
"Added handle to genParticles";
690 LogDebug(
"ExoticaValidation") <<
"We have got " <<
_tokens.size() <<
"tokens";
691 for (std::map<unsigned int, edm::EDGetToken>::iterator it =
_tokens.begin();
724 edm::LogError(
"ExoticaValidation") <<
"HLTExoticaSubAnalysis::getHandlesToObjects "
725 <<
" NOT IMPLEMENTED (yet) ERROR: '" << it->first <<
"'";
736 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::bookHist()";
738 sourceUpper[0] = std::toupper(sourceUpper[0]);
742 if (variable.find(
"SumEt") != std::string::npos) {
745 float *
edges =
new float[nBins + 1];
746 for (
size_t i = 0;
i < nBins + 1;
i++) {
749 h =
new TH1F(name.c_str(), title.c_str(), nBins,
edges);
752 else if (variable.find(
"MaxPt") != std::string::npos) {
753 std::string desc = (variable ==
"MaxPt1") ?
"Leading" :
"Next-to-Leading";
756 float *
edges =
new float[nBins + 1];
757 for (
size_t i = 0;
i < nBins + 1;
i++) {
760 h =
new TH1F(name.c_str(), title.c_str(), nBins,
edges);
763 std::string symbol = (variable ==
"Eta") ?
"#eta" :
"#phi";
766 int nBins = (int)params[0];
767 double min = params[1];
768 double max = params[2];
769 h =
new TH1F(name.c_str(), title.c_str(), nBins,
min,
max);
787 sourceUpper[0] = toupper(sourceUpper[0]);
790 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::fillHist() " << name <<
" " <<
value;
792 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::fillHist() " << name <<
" worked";
799 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::initSelector()";
824 LogDebug(
"ExoticaValidation") <<
"In HLTExoticaSubAnalysis::insertCandidates()";
827 for (
size_t i = 0;
i < cols->
muons->size();
i++) {
828 LogDebug(
"ExoticaValidation") <<
"Inserting muon " <<
i ;
831 matches->push_back(
m);
836 LogDebug(
"ExoticaValidation") <<
"Inserting electron " <<
i ;
839 matches->push_back(
m);
843 for (
size_t i = 0;
i < cols->
photons->size();
i++) {
844 LogDebug(
"ExoticaValidation") <<
"Inserting photon " <<
i ;
847 matches->push_back(
m);
854 for (
size_t i = 0;
i < cols->
pfMETs->size();
i++) {
855 LogDebug(
"ExoticaValidation") <<
"Inserting PFMET " <<
i ;
858 matches->push_back(
m);
862 for (
size_t i = 0;
i < cols->
pfTaus->size();
i++) {
863 LogDebug(
"ExoticaValidation") <<
"Inserting PFtau " <<
i ;
866 matches->push_back(
m);
870 for (
size_t i = 0;
i < cols->
jets->size();
i++) {
871 LogDebug(
"ExoticaValidation") <<
"Inserting jet " <<
i ;
874 matches->push_back(
m);
const std::vector< reco::Muon > * muons
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
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::PFJet > * jets
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< 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
std::vector< double > _parametersPhi
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, edm::InputTag > _recLabels
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector
void set(const reco::MuonCollection *v)
Setter: multiple overloaded function.
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.
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[]
void setCurrentFolder(const std::string &fullpath)
void registerConsumes(edm::ConsumesCollector &consCollector)
Registers consumption of objects.
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
T const * product() const
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
StringCutObjectSelector< reco::PFJet > * _recJetSelector
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::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