CMS 3D CMS Logo

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