CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
HLTTauDQMPathPlotter Class Reference

#include <HLTTauDQMPathPlotter.h>

Inheritance diagram for HLTTauDQMPathPlotter:
HLTTauDQMPlotter

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &, const std::map< int, LVColl > &)
 
 HLTTauDQMPathPlotter (const edm::ParameterSet &, bool, std::string)
 
const std::string name ()
 
 ~HLTTauDQMPathPlotter ()
 
- Public Member Functions inherited from HLTTauDQMPlotter
 HLTTauDQMPlotter ()
 
bool isValid () const
 
virtual ~HLTTauDQMPlotter ()
 

Private Member Functions

void endJob ()
 
LVColl getFilterCollection (size_t, int, const trigger::TriggerEventWithRefs &)
 

Private Attributes

MonitorElementaccepted_events
 
MonitorElementaccepted_events_matched
 
bool doRefAnalysis_
 
std::vector
< HLTTauDQMPlotter::FilterObject
filterObjs_
 
std::vector< edm::ParameterSetfilters_
 
edm::ParameterSet reference_
 
double refLeptonPt_
 
unsigned int refNTriggeredLeptons_
 
unsigned int refNTriggeredTaus_
 
double refTauPt_
 
edm::InputTag triggerEventObject_
 

Additional Inherited Members

- Protected Member Functions inherited from HLTTauDQMPlotter
std::pair< bool, LVmatch (const LV &, const LVColl &, double)
 
std::string triggerTag ()
 
- Protected Attributes inherited from HLTTauDQMPlotter
std::string dqmBaseFolder_
 
std::string name_
 
DQMStorestore_
 
std::string triggerTag_
 
std::string triggerTagAlias_
 
bool validity_
 

Detailed Description

Definition at line 25 of file HLTTauDQMPathPlotter.h.

Constructor & Destructor Documentation

HLTTauDQMPathPlotter::HLTTauDQMPathPlotter ( const edm::ParameterSet ps,
bool  ref,
std::string  dqmBaseFolder 
)

Definition at line 3 of file HLTTauDQMPathPlotter.cc.

References accepted_events, accepted_events_matched, DQMStore::book1D(), doRefAnalysis_, HLTTauDQMPlotter::dqmBaseFolder_, alignCSCRings::e, filterObjs_, filters_, edm::ParameterSet::getUntrackedParameter(), HLTTauDQMPlotter::FilterObject::isValid(), gen::k, HLTTauDQMPlotter::name_, reference_, refLeptonPt_, refNTriggeredLeptons_, refNTriggeredTaus_, refTauPt_, DQMStore::removeContents(), MonitorElement::setBinLabel(), DQMStore::setCurrentFolder(), HLTTauDQMPlotter::store_, AlCaHLTBitMon_QueryRunRegistry::string, tmp, triggerEventObject_, HLTTauDQMPlotter::triggerTag(), HLTTauDQMPlotter::triggerTag_, HLTTauDQMPlotter::triggerTagAlias_, HLTTauDQMPlotter::validity_, and cms::Exception::what().

3  {
4  //Initialize Plotter
5  name_ = "HLTTauDQMPathPlotter";
6 
7  //Process PSet
8  try {
9  triggerEventObject_ = ps.getUntrackedParameter<edm::InputTag>("TriggerEventObject");
12  filters_ = ps.getUntrackedParameter<std::vector<edm::ParameterSet> >("Filters");
14  refNTriggeredTaus_ = reference_.getUntrackedParameter<unsigned int>("NTriggeredTaus");
15  refNTriggeredLeptons_ = reference_.getUntrackedParameter<unsigned int>("NTriggeredLeptons");
16  refTauPt_ = reference_.getUntrackedParameter<double>("refTauPt",20);
17  refLeptonPt_ = reference_.getUntrackedParameter<double>("refLeptonPt",15);
18  dqmBaseFolder_ = dqmBaseFolder;
19  doRefAnalysis_ = ref;
20  validity_ = true;
21  } catch ( cms::Exception &e ) {
22  edm::LogInfo("HLTTauDQMPathPlotter::HLTTauDQMPathPlotter") << e.what() << std::endl;
23  validity_ = false;
24  return;
25  }
26 
27  for ( std::vector<edm::ParameterSet>::const_iterator iter = filters_.begin(); iter != filters_.end(); ++iter ) {
29  if (tmp.isValid()) filterObjs_.push_back(tmp);
30  }
31 
32  if (store_) {
33  //Create the histograms
36 
37  accepted_events = store_->book1D("TriggerBits","Accepted Events per Path;;entries",filterObjs_.size(),0,filterObjs_.size());
38  for ( size_t k = 0; k < filterObjs_.size(); ++k ) {
39  accepted_events->setBinLabel(k+1,filterObjs_[k].getAlias(),1);
40  }
41  if (doRefAnalysis_) {
42  accepted_events_matched = store_->book1D("MatchedTriggerBits","Accepted+Matched Events per Path;;entries",filterObjs_.size()+1,0,filterObjs_.size()+1);
43  accepted_events_matched->setBinLabel(1,"RefEvents",1);
44  for ( size_t k = 0; k < filterObjs_.size(); ++k ) {
46  }
47  }
48  }
49 }
virtual char const * what() const
Definition: Exception.cc:141
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
std::vector< HLTTauDQMPlotter::FilterObject > filterObjs_
void removeContents(void)
erase all monitoring elements in current directory (not including subfolders);
Definition: DQMStore.cc:2569
MonitorElement * accepted_events
unsigned int refNTriggeredLeptons_
std::string triggerTagAlias_
edm::ParameterSet reference_
std::vector< edm::ParameterSet > filters_
int k[5][pyjets_maxn]
MonitorElement * accepted_events_matched
std::string triggerTag()
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
edm::InputTag triggerEventObject_
std::string triggerTag_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
std::string dqmBaseFolder_
HLTTauDQMPathPlotter::~HLTTauDQMPathPlotter ( )

Definition at line 51 of file HLTTauDQMPathPlotter.cc.

51  {
52 }

Member Function Documentation

void HLTTauDQMPathPlotter::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const std::map< int, LVColl > &  refC 
)

Definition at line 58 of file HLTTauDQMPathPlotter.cc.

References accepted_events, accepted_events_matched, doRefAnalysis_, MonitorElement::Fill(), filterObjs_, edm::Event::getByLabel(), getFilterCollection(), i, j, EgammaValidation_Wenu_cff::leptons, HLTTauDQMPlotter::match(), L1Trigger_dataformats::reco, refLeptonPt_, refNTriggeredLeptons_, refNTriggeredTaus_, refTauPt_, and triggerEventObject_.

58  {
59  using namespace std;
60  using namespace edm;
61  using namespace reco;
62  using namespace l1extra;
63  using namespace trigger;
64 
65  bool isGoodReferenceEvent = false;
66  LVColl refTaus, refLeptons;
67 
68  if (doRefAnalysis_) {
69  unsigned int highPtTaus = 0;
70  unsigned int highPtElectrons = 0;
71  unsigned int highPtMuons = 0;
72 
73  bool tau_ok = true;
74  bool leptons_ok = true;
75 
76  std::map<int,LVColl>::const_iterator iref;
77 
78  //Tau reference
79  iref = refC.find(15);
80  if ( iref != refC.end() ) {
81  for ( LVColl::const_iterator lvi = iref->second.begin(); lvi != iref->second.end(); ++lvi ) {
82  if ( lvi->Et() > refTauPt_ ) {
83  highPtTaus++;
84  }
85  refTaus.push_back(*lvi);
86  }
87  }
88  if ( highPtTaus < refNTriggeredTaus_ ) tau_ok = false;
89 
90  //Electron reference
91  iref = refC.find(11);
92  if ( iref != refC.end() ) {
93  for ( LVColl::const_iterator lvi = iref->second.begin(); lvi != iref->second.end(); ++lvi ) {
94  if ( lvi->Et() > refLeptonPt_ ) {
95  highPtElectrons++;
96  }
97  refLeptons.push_back(*lvi);
98  }
99  }
100  if ( filterObjs_.size() > 0 && filterObjs_.back().leptonId() == 11 && highPtElectrons < refNTriggeredLeptons_ ) leptons_ok = false;
101 
102  //Muon reference
103  iref = refC.find(13);
104  if ( iref != refC.end() ) {
105  for ( LVColl::const_iterator lvi = iref->second.begin(); lvi != iref->second.end(); ++lvi ) {
106  if ( lvi->Et() > refLeptonPt_ ) {
107  highPtMuons++;
108  }
109  refLeptons.push_back(*lvi);
110  }
111  }
112  if ( filterObjs_.size() > 0 && filterObjs_.back().leptonId() == 13 && highPtMuons < refNTriggeredLeptons_ ) leptons_ok = false;
113 
114  if ( tau_ok && leptons_ok ) {
116  isGoodReferenceEvent = true;
117  }
118  }
119 
121  bool gotTEV = iEvent.getByLabel(triggerEventObject_,trigEv) && trigEv.isValid();
122 
123  if (gotTEV) {
124  //Loop through the filters
125  for ( size_t i = 0; i < filterObjs_.size(); ++i ) {
126  size_t ID = trigEv->filterIndex(filterObjs_[i].getFilterName());
127 
128  if ( ID != trigEv->size() ) {
129  LVColl leptons = getFilterCollection(ID,filterObjs_[i].getLeptonType(),*trigEv);
130  LVColl taus = getFilterCollection(ID,filterObjs_[i].getTauType(),*trigEv);
131  //Fired
132  if ( leptons.size() >= filterObjs_[i].getNTriggeredLeptons() && taus.size() >= filterObjs_[i].getNTriggeredTaus() ) {
133  accepted_events->Fill(i+0.5);
134  //Now do the matching only though if we have a good reference event
135  if ( doRefAnalysis_ && isGoodReferenceEvent ) {
136  size_t nT = 0;
137  for ( size_t j = 0; j < taus.size(); ++j ) {
138  if( match(taus[j],refTaus,filterObjs_[i].getMatchDeltaR()).first ) nT++;
139  }
140 
141  size_t nL = 0;
142  for ( size_t j = 0; j < leptons.size(); ++j ) {
143  if ( match(leptons[j],refLeptons,filterObjs_[i].getMatchDeltaR()).first ) nL++;
144  }
145 
146  if ( nT >= filterObjs_[i].getNTriggeredTaus() && nL >= filterObjs_[i].getNTriggeredLeptons() ) {
148  }
149  }
150  }
151  }
152  }
153  }
154 }
int i
Definition: DBlmapReader.cc:9
uint32_t ID
Definition: Definitions.h:26
std::vector< HLTTauDQMPlotter::FilterObject > filterObjs_
void Fill(long long x)
LVColl getFilterCollection(size_t, int, const trigger::TriggerEventWithRefs &)
MonitorElement * accepted_events
unsigned int refNTriggeredLeptons_
std::vector< LV > LVColl
int j
Definition: DBlmapReader.cc:9
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
MonitorElement * accepted_events_matched
edm::InputTag triggerEventObject_
std::pair< bool, LV > match(const LV &, const LVColl &, double)
void HLTTauDQMPathPlotter::endJob ( )
private
LVColl HLTTauDQMPathPlotter::getFilterCollection ( size_t  filterID,
int  id,
const trigger::TriggerEventWithRefs trigEv 
)
private

Definition at line 156 of file HLTTauDQMPathPlotter.cc.

References trigger::TriggerEventWithRefs::getObjects(), i, getGTfromDQMFile::obj, dbtoconf::out, p4, trigger::TriggerElectron, trigger::TriggerL1CenJet, trigger::TriggerL1IsoEG, trigger::TriggerL1Mu, trigger::TriggerL1NoIsoEG, trigger::TriggerL1TauJet, trigger::TriggerMuon, and trigger::TriggerTau.

Referenced by analyze().

156  {
157  using namespace trigger;
158  LVColl out;
159 
160  if ( id == trigger::TriggerL1IsoEG || id == trigger::TriggerL1NoIsoEG ) {
161  VRl1em obj;
162  trigEv.getObjects(filterID,id,obj);
163  for (size_t i=0;i<obj.size();++i)
164  if (obj.at(i).isAvailable())
165  out.push_back(obj[i]->p4());
166  }
167 
168  if ( id == trigger::TriggerL1Mu ) {
169  VRl1muon obj;
170  trigEv.getObjects(filterID,id,obj);
171  for (size_t i=0;i<obj.size();++i)
172  if (obj.at(i).isAvailable())
173  out.push_back(obj[i]->p4());
174  }
175 
176  if ( id == trigger::TriggerMuon ) {
177  VRmuon obj;
178  trigEv.getObjects(filterID,id,obj);
179  for (size_t i=0;i<obj.size();++i)
180  if (obj.at(i).isAvailable())
181  out.push_back(obj[i]->p4());
182  }
183 
184  if ( id == trigger::TriggerElectron ) {
185  VRelectron obj;
186  trigEv.getObjects(filterID,id,obj);
187  for (size_t i=0;i<obj.size();++i)
188  if (obj.at(i).isAvailable())
189  out.push_back(obj[i]->p4());
190  }
191 
192  if ( id == trigger::TriggerL1TauJet ) {
193  VRl1jet obj;
194  trigEv.getObjects(filterID,id,obj);
195  for (size_t i=0;i<obj.size();++i)
196  if (obj.at(i).isAvailable())
197  out.push_back(obj[i]->p4());
198  trigEv.getObjects(filterID,trigger::TriggerL1CenJet,obj);
199  for (size_t i=0;i<obj.size();++i)
200  if (obj.at(i).isAvailable())
201  out.push_back(obj[i]->p4());
202 
203  }
204 
205  if ( id == trigger::TriggerTau ) {
206  VRjet obj;
207  trigEv.getObjects(filterID,id,obj);
208  for (size_t i = 0; i < obj.size(); ++i) {
209  if (obj.at(i).isAvailable()) {
210  out.push_back(obj[i]->p4());
211  }
212  }
213  VRpfjet pfjetobj;
214  trigEv.getObjects(filterID,id,pfjetobj);
215  for (size_t i = 0; i < pfjetobj.size(); ++i) {
216  if (pfjetobj.at(i).isAvailable()) {
217  out.push_back(pfjetobj[i]->p4());
218  }
219  }
220  VRpftau pftauobj;
221  trigEv.getObjects(filterID,id,pftauobj);
222  for (size_t i = 0; i < pftauobj.size(); ++i) {
223  if (pftauobj.at(i).isAvailable()) {
224  out.push_back(pftauobj[i]->p4());
225  }
226  }
227  }
228 
229  return out;
230 }
int i
Definition: DBlmapReader.cc:9
enum start value shifted to 81 so as to avoid clashes with PDG codes
std::vector< l1extra::L1MuonParticleRef > VRl1muon
std::vector< LV > LVColl
double p4[4]
Definition: TauolaWrapper.h:92
std::vector< l1extra::L1EmParticleRef > VRl1em
tuple out
Definition: dbtoconf.py:99
std::vector< reco::CaloJetRef > VRjet
std::vector< reco::PFJetRef > VRpfjet
void getObjects(size_type filter, Vids &ids, VRphoton &photons) const
extract Ref&lt;C&gt;s for a specific filter and of specific physics type
std::vector< reco::RecoChargedCandidateRef > VRmuon
std::vector< reco::ElectronRef > VRelectron
std::vector< l1extra::L1JetParticleRef > VRl1jet
std::vector< reco::PFTauRef > VRpftau
const std::string HLTTauDQMPathPlotter::name ( void  )
inlinevirtual

Member Data Documentation

MonitorElement* HLTTauDQMPathPlotter::accepted_events
private

Definition at line 52 of file HLTTauDQMPathPlotter.h.

Referenced by analyze(), and HLTTauDQMPathPlotter().

MonitorElement* HLTTauDQMPathPlotter::accepted_events_matched
private

Definition at line 53 of file HLTTauDQMPathPlotter.h.

Referenced by analyze(), and HLTTauDQMPathPlotter().

bool HLTTauDQMPathPlotter::doRefAnalysis_
private

Definition at line 45 of file HLTTauDQMPathPlotter.h.

Referenced by analyze(), and HLTTauDQMPathPlotter().

std::vector<HLTTauDQMPlotter::FilterObject> HLTTauDQMPathPlotter::filterObjs_
private

Definition at line 41 of file HLTTauDQMPathPlotter.h.

Referenced by analyze(), and HLTTauDQMPathPlotter().

std::vector<edm::ParameterSet> HLTTauDQMPathPlotter::filters_
private
edm::ParameterSet HLTTauDQMPathPlotter::reference_
private

Definition at line 44 of file HLTTauDQMPathPlotter.h.

Referenced by HLTTauDQMPathPlotter().

double HLTTauDQMPathPlotter::refLeptonPt_
private

Definition at line 49 of file HLTTauDQMPathPlotter.h.

Referenced by analyze(), and HLTTauDQMPathPlotter().

unsigned int HLTTauDQMPathPlotter::refNTriggeredLeptons_
private

Definition at line 47 of file HLTTauDQMPathPlotter.h.

Referenced by analyze(), and HLTTauDQMPathPlotter().

unsigned int HLTTauDQMPathPlotter::refNTriggeredTaus_
private

Definition at line 46 of file HLTTauDQMPathPlotter.h.

Referenced by analyze(), and HLTTauDQMPathPlotter().

double HLTTauDQMPathPlotter::refTauPt_
private

Definition at line 48 of file HLTTauDQMPathPlotter.h.

Referenced by analyze(), and HLTTauDQMPathPlotter().

edm::InputTag HLTTauDQMPathPlotter::triggerEventObject_
private

Definition at line 37 of file HLTTauDQMPathPlotter.h.

Referenced by analyze(), and HLTTauDQMPathPlotter().