CMS 3D CMS Logo

SUSY_HLT_MuonFakes.cc
Go to the documentation of this file.
7 
8 
10 {
11  edm::LogInfo("SUSY_HLT_MuonFakes") << "Constructor SUSY_HLT_MuonFakes::SUSY_HLT_MuonFakes " << 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 }
19 
21 {
22  edm::LogInfo("SUSY_HLT_MuonFakes") << "Destructor SUSY_HLT_MuonFakes::~SUSY_HLT_MuonFakes " << std::endl;
23 }
24 
26 {
27 
28  bool changed;
29 
30  if (!fHltConfig.init(run, e, HLTProcess_, changed)) {
31  edm::LogError("SUSY_HLT_MuonFakes") << "Initialization of HLTConfigProvider failed!!";
32  return;
33  }
34 
35  bool pathFound = false;
36  const std::vector<std::string> allTrigNames = fHltConfig.triggerNames();
37  for(size_t j = 0; j <allTrigNames.size(); ++j) {
38  if(allTrigNames[j].find(triggerPath_) != std::string::npos) {
39  pathFound = true;
40  }
41  }
42 
43  if(!pathFound) {
44  edm::LogInfo ("SUSY_HLT_MuonFakes") << "Path not found" << "\n";
45  return;
46  }
47  edm::LogInfo("SUSY_HLT_MuonFakes") << "SUSY_HLT_MuonFakes::beginRun" << std::endl;
48 }
49 
51 {
52  edm::LogInfo("SUSY_HLT_MuonFakes") << "SUSY_HLT_MuonFakes::bookHistograms" << std::endl;
53  //book at beginRun
54  bookHistos(ibooker_);
55 }
56 
57 
58 
59 
61  edm::LogInfo("SUSY_HLT_MuonFakes") << "SUSY_HLT_MuonFakes::analyze" << std::endl;
62 
63 
64  //-------------------------------
65  //--- Trigger
66  //-------------------------------
68  e.getByToken(triggerResults_,hltresults);
69  if(!hltresults.isValid()){
70  edm::LogError ("SUSY_HLT_MuonFakes") << "invalid collection: TriggerResults" << "\n";
71  return;
72  }
74  e.getByToken(theTrigSummary_, triggerSummary);
75  if(!triggerSummary.isValid()) {
76  edm::LogError ("SUSY_HLT_MuonFakes") << "invalid collection: TriggerSummary" << "\n";
77  return;
78  }
79 
80 
81  //get online objects
82  std::vector<float> ptMuon, etaMuon, phiMuon;
83  size_t filterIndex = triggerSummary->filterIndex( triggerFilter_ );
85  if( !(filterIndex >= triggerSummary->sizeFilters()) ){
86  const trigger::Keys& keys = triggerSummary->filterKeys( filterIndex );
87  for( size_t j = 0; j < keys.size(); ++j ){
88  trigger::TriggerObject foundObject = triggerObjects[keys[j]];
89  if(foundObject.id() == 13){ //Muons check number
90  h_triggerMuPt->Fill(foundObject.pt());
91  h_triggerMuEta->Fill(foundObject.eta());
92  h_triggerMuPhi->Fill(foundObject.phi());
93  ptMuon.push_back(foundObject.pt());
94  etaMuon.push_back(foundObject.eta());
95  phiMuon.push_back(foundObject.phi());
96  }
97  }
98  }
99 
100 
101 // bool hasFired = false;
102 // const edm::TriggerNames& trigNames = e.triggerNames(*hltresults);
103 // unsigned int numTriggers = trigNames.size();
104 // for( unsigned int hltIndex=0; hltIndex<numTriggers; ++hltIndex ){
105 // if (trigNames.triggerName(hltIndex)==triggerPath_ && hltresults->wasrun(hltIndex) && hltresults->accept(hltIndex)) hasFired = true;
106 // }
107 
108 }
109 
110 
111 
112 
114 {
115  edm::LogInfo("SUSY_HLT_MuonFakes") << "SUSY_HLT_MuonFakes::endRun" << std::endl;
116 }
117 
119 {
120  ibooker_.cd();
121  ibooker_.setCurrentFolder("HLT/SUSYBSM/" + triggerPath_);
122 
123  //online quantities
124  h_triggerMuPt = ibooker_.book1D("triggerMuPt", "Trigger Mu Pt; GeV", 40, 0.0, 80.0);
125  h_triggerMuEta = ibooker_.book1D("triggerMuEta", "Trigger Mu Eta", 20, -2.5, 2.5);
126  h_triggerMuPhi = ibooker_.book1D("triggerMuPhi", "Trigger Mu Phi", 20, -3.5, 3.5);
127 
128 
129  //num and den hists to be divided in harvesting step to make turn on curves
130  ibooker_.cd();
131 }
132 
133  //define this as a plug-in
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
T getParameter(std::string const &) const
SUSY_HLT_MuonFakes(const edm::ParameterSet &ps)
void bookHistos(DQMStore::IBooker &)
int id() const
getters
Definition: TriggerObject.h:55
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:135
HLTConfigProvider fHltConfig
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
MonitorElement * h_triggerMuEta
float eta() const
Definition: TriggerObject.h:57
edm::EDGetTokenT< edm::TriggerResults > triggerResults_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void Fill(long long x)
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
edm::InputTag triggerFilter_
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:98
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< trigger::TriggerEvent > theTrigSummary_
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
MonitorElement * h_triggerMuPhi
MonitorElement * h_triggerMuPt
std::vector< size_type > Keys
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
void endRun(edm::Run const &run, edm::EventSetup const &eSetup) override
~SUSY_HLT_MuonFakes() override
Definition: Run.h:44