File indexing completed on 2024-04-06 12:18:52
0001 #ifndef HLTriggerOffline_Exotica_HLTExoticaSubAnalysis_H
0002 #define HLTriggerOffline_Exotica_HLTExoticaSubAnalysis_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "FWCore/Framework/interface/ConsumesCollector.h"
0017 #include "FWCore/Framework/interface/Event.h"
0018 #include "FWCore/Framework/interface/Frameworkfwd.h"
0019 #include "FWCore/Framework/interface/MakerMacros.h"
0020 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0021 #include "FWCore/Utilities/interface/InputTag.h"
0022
0023 #include "CommonTools/Utils/interface/StringCutObjectSelector.h"
0024 #include "DQMServices/Core/interface/DQMStore.h"
0025 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
0026 #include "DataFormats/Candidate/interface/LeafCandidate.h"
0027 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0028 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
0029 #include "DataFormats/EgammaCandidates/interface/Photon.h"
0030 #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
0031 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
0032 #include "DataFormats/JetReco/interface/CaloJet.h"
0033 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
0034 #include "DataFormats/JetReco/interface/PFJet.h"
0035 #include "DataFormats/JetReco/interface/PFJetCollection.h"
0036 #include "DataFormats/METReco/interface/CaloMET.h"
0037 #include "DataFormats/METReco/interface/CaloMETCollection.h"
0038 #include "DataFormats/METReco/interface/GenMET.h"
0039 #include "DataFormats/METReco/interface/GenMETCollection.h"
0040 #include "DataFormats/METReco/interface/PFMET.h"
0041 #include "DataFormats/METReco/interface/PFMETCollection.h"
0042 #include "DataFormats/MuonReco/interface/Muon.h"
0043 #include "DataFormats/MuonReco/interface/MuonFwd.h"
0044 #include "DataFormats/TauReco/interface/PFTau.h"
0045 #include "DataFormats/TauReco/interface/PFTauFwd.h"
0046 #include "DataFormats/TrackReco/interface/Track.h"
0047 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0048 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
0049
0050 #include "HLTriggerOffline/Exotica/interface/HLTExoticaPlotter.h"
0051
0052 #include <cstring>
0053 #include <map>
0054 #include <set>
0055 #include <vector>
0056
0057
0058 struct EVTColContainer;
0059
0060
0061
0062
0063 class HLTExoticaSubAnalysis {
0064 public:
0065 typedef dqm::legacy::DQMStore DQMStore;
0066 typedef dqm::legacy::MonitorElement MonitorElement;
0067
0068 enum class Level { GEN = 98, RECO = 99 };
0069
0070 HLTExoticaSubAnalysis(const edm::ParameterSet &pset,
0071 const std::string &analysisname,
0072 edm::ConsumesCollector &&consCollector);
0073 ~HLTExoticaSubAnalysis();
0074 void beginJob();
0075 void beginRun(const edm::Run &iRun, const edm::EventSetup &iEventSetup);
0076 void endRun();
0077
0078
0079
0080
0081 void subAnalysisBookHistos(DQMStore::IBooker &iBooker, const edm::Run &iRun, const edm::EventSetup &iSetup);
0082
0083
0084
0085
0086 void analyze(const edm::Event &iEvent, const edm::EventSetup &iEventSetup, EVTColContainer *cols);
0087
0088 private:
0089
0090
0091
0092
0093
0094 const std::vector<unsigned int> getObjectsType(const std::string &hltpath) const;
0095
0096
0097 void getNamesOfObjects(const edm::ParameterSet &anpset);
0098
0099 void registerConsumes(edm::ConsumesCollector &consCollector);
0100
0101 void getHandlesToObjects(const edm::Event &iEvent, EVTColContainer *col);
0102
0103 void initSelector(const unsigned int &objtype);
0104
0105
0106 void insertCandidates(const unsigned int &objtype,
0107 const EVTColContainer *col,
0108 std::vector<reco::LeafCandidate> *matches,
0109 std::map<int, double> &theSumEt,
0110 std::map<int, std::vector<const reco::Track *>> &trkObjs);
0111
0112
0113 void bookHist(DQMStore::IBooker &iBooker,
0114 const std::string &source,
0115 const std::string &objType,
0116 const std::string &variable);
0117 void fillHist(const std::string &source, const std::string &objType, const std::string &variable, const float &value);
0118
0119
0120 edm::ParameterSet _pset;
0121
0122
0123 std::string _analysisname;
0124
0125
0126 unsigned int _minCandidates;
0127
0128
0129 std::vector<std::string> _hltPathsToCheck;
0130
0131 std::set<std::string> _hltPaths;
0132
0133 std::map<std::string, std::string> _shortpath2long;
0134
0135
0136 std::string _hltProcessName;
0137 edm::InputTag _genParticleLabel;
0138 edm::InputTag _trigResultsLabel;
0139 edm::InputTag _beamSpotLabel;
0140 std::map<unsigned int, edm::InputTag> _recLabels;
0141
0142 edm::EDGetTokenT<reco::GenParticleCollection> _genParticleToken;
0143 edm::EDGetTokenT<edm::TriggerResults> _trigResultsToken;
0144 edm::EDGetTokenT<reco::BeamSpot> _bsToken;
0145 std::map<unsigned int, edm::EDGetToken> _tokens;
0146
0147
0148 std::vector<double> _parametersEta;
0149 std::vector<double> _parametersPhi;
0150 std::vector<double> _parametersTurnOn;
0151 std::vector<double> _parametersTurnOnSumEt;
0152 std::vector<double> _parametersDxy;
0153
0154
0155 bool _drop_pt2;
0156 bool _drop_pt3;
0157
0158
0159 std::map<unsigned int, std::string> _genCut;
0160 std::map<unsigned int, std::string> _recCut;
0161
0162 std::map<unsigned int, std::string> _genCut_leading;
0163 std::map<unsigned int, std::string> _recCut_leading;
0164
0165
0166
0167 std::map<unsigned int, StringCutObjectSelector<reco::GenParticle> *> _genSelectorMap;
0168 StringCutObjectSelector<reco::Muon> *_recMuonSelector;
0169 StringCutObjectSelector<reco::Track> *_recMuonTrkSelector;
0170 StringCutObjectSelector<reco::Track> *_recTrackSelector;
0171 StringCutObjectSelector<reco::GsfElectron> *_recElecSelector;
0172 StringCutObjectSelector<reco::MET> *_recMETSelector;
0173 StringCutObjectSelector<reco::PFMET> *_recPFMETSelector;
0174 StringCutObjectSelector<reco::PFMET> *_recPFMHTSelector;
0175 StringCutObjectSelector<reco::GenMET> *_genMETSelector;
0176 StringCutObjectSelector<reco::CaloMET> *_recCaloMETSelector;
0177 StringCutObjectSelector<reco::CaloMET> *_recCaloMHTSelector;
0178 StringCutObjectSelector<reco::PFTau> *_recPFTauSelector;
0179 StringCutObjectSelector<reco::Photon> *_recPhotonSelector;
0180 StringCutObjectSelector<reco::PFJet> *_recPFJetSelector;
0181 StringCutObjectSelector<reco::CaloJet> *_recCaloJetSelector;
0182
0183
0184 std::vector<HLTExoticaPlotter> _plotters;
0185
0186
0187 std::map<std::string, int> _triggerCounter;
0188
0189
0190 HLTConfigProvider _hltConfig;
0191
0192
0193 std::map<std::string, MonitorElement *> _elements;
0194 };
0195
0196 #endif