CMS 3D CMS Logo

SUSY_HLT_MuonFakes.cc
Go to the documentation of this file.
7 
9  edm::LogInfo("SUSY_HLT_MuonFakes") << "Constructor SUSY_HLT_MuonFakes::SUSY_HLT_MuonFakes " << std::endl;
10  // Get parameters from configuration file
11  theTrigSummary_ = consumes<trigger::TriggerEvent>(ps.getParameter<edm::InputTag>("trigSummary"));
12  triggerResults_ = consumes<edm::TriggerResults>(ps.getParameter<edm::InputTag>("TriggerResults"));
13  HLTProcess_ = ps.getParameter<std::string>("HLTProcess");
14  triggerPath_ = ps.getParameter<std::string>("TriggerPath");
15  triggerFilter_ = ps.getParameter<edm::InputTag>("TriggerFilter");
16 }
17 
19  edm::LogInfo("SUSY_HLT_MuonFakes") << "Destructor SUSY_HLT_MuonFakes::~SUSY_HLT_MuonFakes " << std::endl;
20 }
21 
23  bool changed;
24 
25  if (!fHltConfig.init(run, e, HLTProcess_, changed)) {
26  edm::LogError("SUSY_HLT_MuonFakes") << "Initialization of HLTConfigProvider failed!!";
27  return;
28  }
29 
30  bool pathFound = false;
31  const std::vector<std::string> allTrigNames = fHltConfig.triggerNames();
32  for (size_t j = 0; j < allTrigNames.size(); ++j) {
33  if (allTrigNames[j].find(triggerPath_) != std::string::npos) {
34  pathFound = true;
35  }
36  }
37 
38  if (!pathFound) {
39  edm::LogInfo("SUSY_HLT_MuonFakes") << "Path not found"
40  << "\n";
41  return;
42  }
43  edm::LogInfo("SUSY_HLT_MuonFakes") << "SUSY_HLT_MuonFakes::beginRun" << std::endl;
44 }
45 
47  edm::LogInfo("SUSY_HLT_MuonFakes") << "SUSY_HLT_MuonFakes::bookHistograms" << std::endl;
48  // book at beginRun
49  bookHistos(ibooker_);
50 }
51 
53  edm::LogInfo("SUSY_HLT_MuonFakes") << "SUSY_HLT_MuonFakes::analyze" << std::endl;
54 
55  //-------------------------------
56  //--- Trigger
57  //-------------------------------
59  e.getByToken(triggerResults_, hltresults);
60  if (!hltresults.isValid()) {
61  edm::LogError("SUSY_HLT_MuonFakes") << "invalid collection: TriggerResults"
62  << "\n";
63  return;
64  }
66  e.getByToken(theTrigSummary_, triggerSummary);
67  if (!triggerSummary.isValid()) {
68  edm::LogError("SUSY_HLT_MuonFakes") << "invalid collection: TriggerSummary"
69  << "\n";
70  return;
71  }
72 
73  // get online objects
74  std::vector<float> ptMuon, etaMuon, phiMuon;
75  size_t filterIndex = triggerSummary->filterIndex(triggerFilter_);
77  if (!(filterIndex >= triggerSummary->sizeFilters())) {
78  const trigger::Keys &keys = triggerSummary->filterKeys(filterIndex);
79  for (size_t j = 0; j < keys.size(); ++j) {
81  if (foundObject.id() == 13) { // Muons check number
82  h_triggerMuPt->Fill(foundObject.pt());
83  h_triggerMuEta->Fill(foundObject.eta());
84  h_triggerMuPhi->Fill(foundObject.phi());
85  ptMuon.push_back(foundObject.pt());
86  etaMuon.push_back(foundObject.eta());
87  phiMuon.push_back(foundObject.phi());
88  }
89  }
90  }
91 
92  // bool hasFired = false;
93  // const edm::TriggerNames& trigNames = e.triggerNames(*hltresults);
94  // unsigned int numTriggers = trigNames.size();
95  // for( unsigned int hltIndex=0; hltIndex<numTriggers; ++hltIndex ){
96  // if (trigNames.triggerName(hltIndex)==triggerPath_ &&
97  // hltresults->wasrun(hltIndex) && hltresults->accept(hltIndex)) hasFired =
98  // true;
99  // }
100 }
101 
103  ibooker_.cd();
104  ibooker_.setCurrentFolder("HLT/SUSYBSM/" + triggerPath_);
105 
106  // online quantities
107  h_triggerMuPt = ibooker_.book1D("triggerMuPt", "Trigger Mu Pt; GeV", 40, 0.0, 80.0);
108  h_triggerMuEta = ibooker_.book1D("triggerMuEta", "Trigger Mu Eta", 20, -2.5, 2.5);
109  h_triggerMuPhi = ibooker_.book1D("triggerMuPhi", "Trigger Mu Phi", 20, -3.5, 3.5);
110 
111  // num and den hists to be divided in harvesting step to make turn on curves
112  ibooker_.cd();
113 }
114 
115 // define this as a plug-in
trigger::TriggerObject::phi
float phi() const
Definition: TriggerObject.h:54
SUSY_HLT_MuonFakes::h_triggerMuEta
MonitorElement * h_triggerMuEta
Definition: SUSY_HLT_MuonFakes.h:59
SUSY_HLT_MuonFakes.h
MessageLogger.h
triggerMatchMonitor_cfi.triggerObjects
triggerObjects
Definition: triggerMatchMonitor_cfi.py:15
HLTBitAnalyser_cfi.hltresults
hltresults
Definition: HLTBitAnalyser_cfi.py:13
SUSY_HLT_MuonFakes::h_triggerMuPhi
MonitorElement * h_triggerMuPhi
Definition: SUSY_HLT_MuonFakes.h:60
edm::Run
Definition: Run.h:45
SUSY_HLT_MuonFakes
Definition: SUSY_HLT_MuonFakes.h:33
edm::LogInfo
Definition: MessageLogger.h:254
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
HLTMuonOfflineAnalyzer_cfi.triggerSummary
triggerSummary
Definition: HLTMuonOfflineAnalyzer_cfi.py:86
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::Handle< edm::TriggerResults >
SUSY_HLT_MuonFakes::~SUSY_HLT_MuonFakes
~SUSY_HLT_MuonFakes() override
Definition: SUSY_HLT_MuonFakes.cc:18
SUSY_HLT_MuonFakes::SUSY_HLT_MuonFakes
SUSY_HLT_MuonFakes(const edm::ParameterSet &ps)
Definition: SUSY_HLT_MuonFakes.cc:8
MakerMacros.h
trigger::TriggerObject::pt
float pt() const
Definition: TriggerObject.h:52
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
SUSY_HLT_MuonFakes::dqmBeginRun
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
Definition: SUSY_HLT_MuonFakes.cc:22
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
SUSY_HLT_MuonFakes::analyze
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
Definition: SUSY_HLT_MuonFakes.cc:52
SUSY_HLT_MuonFakes::bookHistos
void bookHistos(DQMStore::IBooker &)
Definition: SUSY_HLT_MuonFakes.cc:102
trigger::TriggerObject
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:21
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SUSY_HLT_MuonFakes::fHltConfig
HLTConfigProvider fHltConfig
Definition: SUSY_HLT_MuonFakes.h:51
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
trigger::TriggerObjectCollection
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
trigger::TriggerObject::id
int id() const
getters
Definition: TriggerObject.h:51
SUSY_HLT_MuonFakes::HLTProcess_
std::string HLTProcess_
Definition: SUSY_HLT_MuonFakes.h:53
TriggerNames.h
trigger::Keys
std::vector< size_type > Keys
Definition: TriggerTypeDefs.h:19
SUSY_HLT_MuonFakes::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: SUSY_HLT_MuonFakes.cc:46
trigger::TriggerObject::eta
float eta() const
Definition: TriggerObject.h:53
edm::EventSetup
Definition: EventSetup.h:57
TriggerObject.h
SUSY_HLT_MuonFakes::theTrigSummary_
edm::EDGetTokenT< trigger::TriggerEvent > theTrigSummary_
Definition: SUSY_HLT_MuonFakes.h:49
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
writedatasetfile.run
run
Definition: writedatasetfile.py:27
HLTConfigProvider::init
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
Definition: HLTConfigProvider.cc:36
Frameworkfwd.h
SUSY_HLT_MuonFakes::triggerPath_
std::string triggerPath_
Definition: SUSY_HLT_MuonFakes.h:54
dqm::implementation::IBooker
Definition: DQMStore.h:43
SUSY_HLT_MuonFakes::triggerResults_
edm::EDGetTokenT< edm::TriggerResults > triggerResults_
Definition: SUSY_HLT_MuonFakes.h:48
HLTConfigProvider::triggerNames
const std::vector< std::string > & triggerNames() const
names of trigger paths
Definition: HLTConfigProvider.h:68
SUSY_HLT_MuonFakes::triggerFilter_
edm::InputTag triggerFilter_
Definition: SUSY_HLT_MuonFakes.h:55
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
SUSY_HLT_MuonFakes::h_triggerMuPt
MonitorElement * h_triggerMuPt
Definition: SUSY_HLT_MuonFakes.h:58
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37