28 m_borderCut(
config.getUntrackedParameter<double>(
"borderCut")),
29 m_dxCut(
config.getUntrackedParameter<double>(
"dx_cut")),
30 m_detailedAnalysis(
config.getUntrackedParameter<
bool>(
"detailedAnalysis")),
31 m_primaryVerticesToken(
33 m_triggerResultsToken(
38 m_dxyCut(
config.getUntrackedParameter<double>(
"probeDxyCut")),
39 m_dzCut(
config.getUntrackedParameter<double>(
"probeDzCut")),
41 m_lowPairMassCut(
config.getUntrackedParameter<double>(
"lowPairMassCut")),
42 m_highPairMassCut(
config.getUntrackedParameter<double>(
"highPairMassCut")) {
43 LogTrace(
"DQMOffline|MuonDPG|BaseTnPEfficiencyTask") <<
"[BaseTnPEfficiencyTask]: Constructor" << std::endl;
47 LogTrace(
"DQMOffline|MuonDPG|BaseTnPEfficiencyTask")
48 <<
"[BaseTnPEfficiencyTask]: analyzed " <<
m_nEvents <<
" events" << std::endl;
55 bool enableWildCard =
true;
58 TRegexp tNamePattern = TRegexp(
tName, enableWildCard);
62 if (
pathName.Contains(tNamePattern)) {
71 LogTrace(
"DQMOffline|MuonDPG|BaseTnPEfficiencyTask") <<
"[BaseTnPEfficiencyTask]: bookHistograms" << std::endl;
77 LogTrace(
"DQMOffline|MuonDPG|BaseTnPEfficiencyTask")
78 <<
"[BaseTnPEfficiencyTask]: booking histos in " <<
baseDir << std::endl;
80 m_histos[
"probePt"] = iBooker.
book1D(
"probePt",
"probePt;probe p_{T} [GeV];Events", 125, 0., 250.);
81 m_histos[
"probeEta"] = iBooker.
book1D(
"probeEta",
"probeEta;probe #eta;Events", 24, -2.4, 2.4);
84 "probeNumberOfMatchedStations",
"probeNumberOfMatchedStations;Number of matched stations;Events", 5, 0., 5);
85 m_histos[
"pairMass"] = iBooker.
book1D(
"pairMass",
"pairMass", 25, 70., 120.);
110 std::vector<unsigned> preSel_tag_indices;
111 std::vector<unsigned> tag_indices;
112 std::vector<unsigned> preSel_probe_indices;
113 std::vector<unsigned> probe_indices;
117 for (
auto [
muon, muonColl_index] =
std::tuple{std::vector<reco::Muon>::const_iterator{(*muons).begin()}, 0};
118 muon != (*muons).end();
119 ++
muon, ++muonColl_index) {
120 bool trigMatch =
false;
131 preSel_probe_indices.push_back(muonColl_index);
135 preSel_tag_indices.push_back(muonColl_index);
142 for (
const auto i_tag : preSel_tag_indices) {
146 bool pair_found =
false;
148 for (
const auto i_probe : preSel_probe_indices) {
150 if (i_probe == i_tag)
153 reco::Muon preSel_probe = (*muons).at(i_probe);
155 int pair_charge_product =
tag.charge() * preSel_probe.
charge();
158 if (pair_charge_product > 0)
161 float pair_mass = (
tag.polarP4() + preSel_probe.
polarP4()).M();
162 m_histos.find(
"pairMass")->second->Fill(pair_mass);
167 float pair_pt = (
tag.polarP4() + preSel_probe.
polarP4()).Pt();
171 max_pt_idx = i_probe;
175 probe_indices.push_back(max_pt_idx);
176 tag_indices.push_back(i_tag);
188 float dR2match = 999.;
189 for (
int trigIdx : trigIndices) {
192 const unsigned trigModuleIndex =
193 std::find(trigModuleLabels.begin(), trigModuleLabels.end(),
"hltBoolEnd") - trigModuleLabels.begin() - 1;
194 const unsigned hltFilterIndex =
trigEvent->filterIndex(
edm::InputTag(trigModuleLabels[trigModuleIndex],
"",
"HLT"));
195 if (hltFilterIndex < trigEvent->sizeFilters()) {
198 const unsigned nTriggers = vids.size();
200 for (
unsigned iTrig = 0; iTrig < nTriggers; ++iTrig) {
209 return dR2match < 0.01;
const std::string & triggerName(unsigned int triggerIndex) const
const std::string m_trigName
virtual std::string topFolder() const =0
Return the top folder.
~BaseTnPEfficiencyTask() override
Destructor.
bool hasTrigger(std::vector< int > &trigIndices, const trigger::TriggerObjectCollection &trigObjs, edm::Handle< trigger::TriggerEvent > &trigEvent, const reco::Muon &muon)
virtual void setCurrentFolder(std::string const &fullpath)
std::vector< std::vector< unsigned > > m_tagIndices
const edm::EDGetTokenT< edm::TriggerResults > m_triggerResultsToken
const edm::EDGetTokenT< reco::MuonCollection > m_muToken
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const edm::EDGetTokenT< trigger::TriggerEvent > m_triggerEventToken
std::vector< Muon > MuonCollection
collection of Muon objects
const edm::EDGetTokenT< std::vector< reco::Vertex > > m_primaryVerticesToken
Single trigger physics object (e.g., an isolated muon)
std::vector< std::vector< unsigned > > m_probeIndices
const bool m_detailedAnalysis
const StringCutObjectSelector< reco::Candidate, true > m_probeSelector
std::vector< int > m_trigIndices
unsigned int size() const
number of trigger paths in trigger table
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
const PolarLorentzVector & polarP4() const final
four-momentum Lorentz vector
Abs< T >::type abs(const T &t)
std::map< std::string, MonitorElement * > m_histos
static std::string const triggerResults
void analyze(const edm::Event &event, const edm::EventSetup &context) override
Analyze.
const StringCutObjectSelector< reco::Muon, true > m_tagSelector
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
void bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &run, edm::EventSetup const &context) override
std::vector< size_type > Keys
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
void dqmBeginRun(const edm::Run &run, const edm::EventSetup &context) override
BeginRun.
HLTConfigProvider m_hltConfig
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
BaseTnPEfficiencyTask(const edm::ParameterSet &config)
Constructor.
int charge() const final
electric charge
const double m_highPairMassCut