CMS 3D CMS Logo

SUSY_HLT_ElecFakes.cc
Go to the documentation of this file.
7 #include <iostream>
8 
10  edm::LogInfo("SUSY_HLT_ElecFakes") << "Constructor SUSY_HLT_ElecFakes::SUSY_HLT_ElecFakes " << std::endl;
11  // Get parameters from configuration file
12  theTrigSummary_ = consumes<trigger::TriggerEvent>(ps.getParameter<edm::InputTag>("trigSummary"));
13  triggerResults_ = consumes<edm::TriggerResults>(ps.getParameter<edm::InputTag>("TriggerResults"));
14  HLTProcess_ = ps.getParameter<std::string>("HLTProcess");
15  triggerPath_ = ps.getParameter<std::string>("TriggerPath");
16  triggerFilter_ = ps.getParameter<edm::InputTag>("TriggerFilter");
17  triggerJetFilter_ = ps.getParameter<edm::InputTag>("TriggerJetFilter");
18 }
19 
21  edm::LogInfo("SUSY_HLT_ElecFakes") << "Destructor SUSY_HLT_ElecFakes::~SUSY_HLT_ElecFakes " << std::endl;
22 }
23 
25  bool changed;
26 
27  if (!fHltConfig.init(run, e, HLTProcess_, changed)) {
28  edm::LogError("SUSY_HLT_ElecFakes") << "Initialization of HLTConfigProvider failed!!";
29  return;
30  }
31 
32  bool pathFound = false;
33  const std::vector<std::string> allTrigNames = fHltConfig.triggerNames();
34  for (size_t j = 0; j < allTrigNames.size(); ++j) {
35  if (allTrigNames[j].find(triggerPath_) != std::string::npos) {
36  pathFound = true;
37  }
38  }
39 
40  if (!pathFound) {
41  edm::LogInfo("SUSY_HLT_ElecFakes") << "Path not found"
42  << "\n";
43  return;
44  }
45 
46  edm::LogInfo("SUSY_HLT_ElecFakes") << "SUSY_HLT_ElecFakes::beginRun" << std::endl;
47 }
48 
50  edm::LogInfo("SUSY_HLT_ElecFakes") << "SUSY_HLT_ElecFakes::bookHistograms" << std::endl;
51  // book at beginRun
52  bookHistos(ibooker_);
53 }
54 
56  edm::LogInfo("SUSY_HLT_ElecFakes") << "SUSY_HLT_ElecFakes::analyze" << std::endl;
57 
58  //-------------------------------
59  //--- Trigger
60  //-------------------------------
62  e.getByToken(triggerResults_, hltresults);
63  if (!hltresults.isValid()) {
64  edm::LogError("SUSY_HLT_ElecFakes") << "invalid collection: TriggerResults"
65  << "\n";
66  return;
67  }
69  e.getByToken(theTrigSummary_, triggerSummary);
70  if (!triggerSummary.isValid()) {
71  edm::LogError("SUSY_HLT_ElecFakes") << "invalid collection: TriggerSummary"
72  << "\n";
73  return;
74  }
75 
76  // get online objects
77  size_t filterIndex = triggerSummary->filterIndex(triggerFilter_);
79  if (!(filterIndex >= triggerSummary->sizeFilters())) {
80  const trigger::Keys &keys = triggerSummary->filterKeys(filterIndex);
81  for (size_t j = 0; j < keys.size(); ++j) {
83  // if(foundObject.id() == 11){ //Electrons check number
84  h_triggerElPt->Fill(foundObject.pt());
85  h_triggerElEta->Fill(foundObject.eta());
86  h_triggerElPhi->Fill(foundObject.phi());
87  // }
88  }
89  }
90 
91  filterIndex = triggerSummary->filterIndex(triggerJetFilter_);
92  // triggerObjects = triggerSummary->getObjects();
93  if (!(filterIndex >= triggerSummary->sizeFilters())) {
94  const trigger::Keys &keys = triggerSummary->filterKeys(filterIndex);
95  for (size_t j = 0; j < keys.size(); ++j) {
97  h_triggerJetPt->Fill(foundObject.pt());
98  h_triggerJetEta->Fill(foundObject.eta());
99  h_triggerJetPhi->Fill(foundObject.phi());
100  }
101  }
102 }
103 
105  ibooker_.cd();
106  ibooker_.setCurrentFolder("HLT/SUSYBSM/" + triggerPath_);
107 
108  // online quantities
109  h_triggerElPt = ibooker_.book1D("triggerElPt", "Trigger El Pt; GeV", 50, 0.0, 100.0);
110  h_triggerElEta = ibooker_.book1D("triggerElEta", "Trigger El Eta", 20, -2.5, 2.5);
111  h_triggerElPhi = ibooker_.book1D("triggerElPhi", "Trigger El Phi", 20, -3.5, 3.5);
112 
113  h_triggerJetPt = ibooker_.book1D("triggerJetPt", "Trigger Jet Pt; GeV", 20, 0.0, 200.0);
114  h_triggerJetEta = ibooker_.book1D("triggerJetEta", "Trigger Jet Eta", 20, -3.0, 3.0);
115  h_triggerJetPhi = ibooker_.book1D("triggerJetPhi", "Trigger Jet Phi", 20, -3.5, 3.5);
116 
117  // h_triggerElJetdPhi = ibooker_.book1D("triggerElJetdPhi", "Trigger El,Jet
118  // dPhi", 20, -3.5, 3.5);
119 
120  // num and den hists to be divided in harvesting step to make turn on curves
121  ibooker_.cd();
122 }
123 
124 // define this as a plug-in
MonitorElement * h_triggerJetPhi
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void bookHistos(DQMStore::IBooker &)
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
edm::InputTag triggerJetFilter_
edm::EDGetTokenT< trigger::TriggerEvent > theTrigSummary_
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
MonitorElement * h_triggerJetEta
void Fill(long long x)
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:21
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
SUSY_HLT_ElecFakes(const edm::ParameterSet &ps)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
MonitorElement * h_triggerElEta
MonitorElement * h_triggerElPt
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
Log< level::Info, false > LogInfo
std::vector< size_type > Keys
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
MonitorElement * h_triggerJetPt
const std::vector< std::string > & triggerNames() const
names of trigger paths
~SUSY_HLT_ElecFakes() override
MonitorElement * h_triggerElPhi
HLTConfigProvider fHltConfig
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< edm::TriggerResults > triggerResults_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
edm::InputTag triggerFilter_
Definition: Run.h:45