00001 #ifndef HLTJetMETDQMSource_H
00002 #define HLTJetMETDQMSource_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <memory>
00015 #include <unistd.h>
00016
00017
00018
00019 #include "FWCore/Framework/interface/Frameworkfwd.h"
00020 #include "FWCore/Framework/interface/EDAnalyzer.h"
00021
00022 #include "FWCore/Framework/interface/Event.h"
00023 #include "FWCore/Framework/interface/MakerMacros.h"
00024 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00025 #include "DataFormats/Common/interface/TriggerResults.h"
00026 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
00027
00028 #include "DQMServices/Core/interface/DQMStore.h"
00029 #include "DQMServices/Core/interface/MonitorElement.h"
00030 #include "FWCore/ServiceRegistry/interface/Service.h"
00031 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00032 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00033
00034 #include <iostream>
00035 #include <fstream>
00036 #include <vector>
00037
00038 class HLTJetMETDQMSource : public edm::EDAnalyzer {
00039 public:
00040 explicit HLTJetMETDQMSource(const edm::ParameterSet&);
00041 ~HLTJetMETDQMSource();
00042
00043
00044 private:
00045 virtual void beginJob() ;
00046 virtual void analyze(const edm::Event&, const edm::EventSetup&);
00047 virtual void endJob() ;
00048
00049
00050 void beginRun(const edm::Run& run, const edm::EventSetup& c);
00051
00052 void histobooking( const edm::EventSetup& c);
00053
00054
00055 void endRun(const edm::Run& run, const edm::EventSetup& c);
00056
00057
00058 void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
00059 const edm::EventSetup& c) ;
00060
00062 void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
00063 const edm::EventSetup& c);
00064
00065
00066
00067 int nev_;
00068 DQMStore * dbe_;
00069
00070 MonitorElement* total_;
00071
00072 bool plotAll_;
00073 bool plotEff_;
00074 bool plotwrtMu_;
00075 bool resetMe_;
00076 int currentRun_;
00077 int nhltcfg;
00078 bool hltconfigchanged;
00079 unsigned int nBins_;
00080 double ptMin_ ;
00081 double ptMax_ ;
00082
00083
00084 double muonEtaMax_;
00085 double muonEtMin_;
00086 double muonDRMatch_;
00087
00088 double jetEtaMax_;
00089 double jetEtMin_;
00090 double jetDRMatch_;
00091
00092 double metMin_;
00093 double htMin_;
00094 double sumEtMin_;
00095
00096 std::string custompathnamemu_;
00097 std::vector<std::pair<std::string, std::string> > custompathnamepairs_;
00098 std::vector<int> prescUsed_;
00099
00100
00101 std::string dirname_;
00102 std::string processname_;
00103 bool verbose_;
00104 bool monitorDaemon_;
00105 int theHLTOutputType;
00106
00107 edm::InputTag triggerSummaryLabel_;
00108 edm::InputTag triggerResultsLabel_;
00109 HLTConfigProvider hltConfig_;
00110
00111 MonitorElement* scalersSelect;
00112
00113
00114 class PathInfo {
00115 PathInfo():
00116 pathIndex_(-1), prescaleUsed_(-1),denomPathName_("unset"), pathName_("unset"), l1pathName_("unset"), filterName_("unset"), DenomfilterName_("unset"), processName_("unset"), objectType_(-1)
00117 {};
00118 public:
00119 void setHistos(
00120 MonitorElement* const N,
00121 MonitorElement* const Et,
00122 MonitorElement* const EtaPhi,
00123 MonitorElement* const Eta,
00124 MonitorElement* const Phi,
00125 MonitorElement* const NL1,
00126 MonitorElement* const l1Et,
00127 MonitorElement* const l1EtaPhi,
00128 MonitorElement* const l1Eta,
00129 MonitorElement* const l1Phi)
00130
00131 {
00132 N_ = N;
00133 Et_ = Et;
00134 EtaPhi_ = EtaPhi;
00135 Eta_ = Eta;
00136 Phi_ = Phi;
00137 NL1_ = NL1;
00138 l1Et_ = l1Et;
00139 l1EtaPhi_ = l1EtaPhi;
00140 l1Eta_ = l1Eta;
00141 l1Phi_ = l1Phi;
00142
00143 }
00144 void setHistosEff(
00145 MonitorElement* const NEff,
00146 MonitorElement* const EtEff,
00147 MonitorElement* const EtaEff,
00148 MonitorElement* const PhiEff,
00149 MonitorElement* const NNum,
00150 MonitorElement* const EtNum,
00151 MonitorElement* const EtaNum,
00152 MonitorElement* const PhiNum,
00153 MonitorElement* const NDenom,
00154 MonitorElement* const EtDenom,
00155 MonitorElement* const EtaDenom,
00156 MonitorElement* const PhiDenom)
00157
00158 {
00159 NEff_ = NEff;
00160 EtEff_ = EtEff;
00161 EtaEff_ = EtaEff;
00162 PhiEff_ = PhiEff;
00163 NNum_ = NNum;
00164 EtNum_ = EtNum;
00165 EtaNum_ = EtaNum;
00166 PhiNum_ = PhiNum;
00167 NDenom_ = NDenom;
00168 EtDenom_ = EtDenom;
00169 EtaDenom_ = EtaDenom;
00170 PhiDenom_ = PhiDenom;
00171 }
00172 void setHistoswrtMu(
00173 MonitorElement* const NwrtMu,
00174 MonitorElement* const EtwrtMu,
00175 MonitorElement* const EtaPhiwrtMu,
00176 MonitorElement* const PhiwrtMu)
00177
00178
00179 {
00180 NwrtMu_ = NwrtMu;
00181 EtwrtMu_ = EtwrtMu;
00182 EtaPhiwrtMu_ = EtaPhiwrtMu;
00183 PhiwrtMu_ = PhiwrtMu;
00184 }
00185 MonitorElement * getNHisto() {
00186 return N_;
00187 }
00188 MonitorElement * getEtHisto() {
00189 return Et_;
00190 }
00191 MonitorElement * getEtaPhiHisto() {
00192 return EtaPhi_;
00193 }
00194 MonitorElement * getEtaHisto() {
00195 return Eta_;
00196 }
00197 MonitorElement * getPhiHisto() {
00198 return Phi_;
00199 }
00200 MonitorElement * getNL1Histo() {
00201 return NL1_;
00202 }
00203 MonitorElement * getL1EtHisto() {
00204 return l1Et_;
00205 }
00206 MonitorElement * getL1EtaHisto() {
00207 return l1Eta_;
00208 }
00209 MonitorElement * getL1EtaPhiHisto() {
00210 return l1EtaPhi_;
00211 }
00212 MonitorElement * getL1PhiHisto() {
00213 return l1Phi_;
00214 }
00215 MonitorElement * getNwrtMuHisto() {
00216 return NwrtMu_;
00217 }
00218 MonitorElement * getEtwrtMuHisto() {
00219 return EtwrtMu_;
00220 }
00221 MonitorElement * getEtaPhiwrtMuHisto() {
00222 return EtaPhiwrtMu_;
00223 }
00224 MonitorElement * getPhiwrtMuHisto() {
00225 return PhiwrtMu_;
00226 }
00227 MonitorElement * getNEffHisto() {
00228 return NEff_;
00229 }
00230 MonitorElement * getEtEffHisto() {
00231 return EtEff_;
00232 }
00233 MonitorElement * getEtaEffHisto() {
00234 return EtaEff_;
00235 }
00236 MonitorElement * getPhiEffHisto() {
00237 return PhiEff_;
00238 }
00239 MonitorElement * getNNumHisto() {
00240 return NNum_;
00241 }
00242 MonitorElement * getEtNumHisto() {
00243 return EtNum_;
00244 }
00245 MonitorElement * getEtaNumHisto() {
00246 return EtaNum_;
00247 }
00248 MonitorElement * getPhiNumHisto() {
00249 return PhiNum_;
00250 }
00251 MonitorElement * getNDenomHisto() {
00252 return NDenom_;
00253 }
00254 MonitorElement * getEtDenomHisto() {
00255 return EtDenom_;
00256 }
00257 MonitorElement * getEtaDenomHisto() {
00258 return EtaDenom_;
00259 }
00260 MonitorElement * getPhiDenomHisto() {
00261 return PhiDenom_;
00262 }
00263 const std::string getLabel(void ) const {
00264 return filterName_;
00265 }
00266 const std::string getDenomLabel(void ) const {
00267 return DenomfilterName_;
00268 }
00269
00270 void setLabel(std::string labelName){
00271 filterName_ = labelName;
00272 return;
00273 }
00274 void setDenomLabel(std::string labelName){
00275 DenomfilterName_ = labelName;
00276 return;
00277 }
00278 const std::string getPath(void ) const {
00279 return pathName_;
00280 }
00281 const std::string getl1Path(void ) const {
00282 return l1pathName_;
00283 }
00284 const std::string getDenomPath(void ) const {
00285 return denomPathName_;
00286 }
00287 const int getprescaleUsed(void) const {
00288 return prescaleUsed_;
00289 }
00290 const std::string getProcess(void ) const {
00291 return processName_;
00292 }
00293 const int getObjectType(void ) const {
00294 return objectType_;
00295 }
00296
00297 const edm::InputTag getTag(void) const{
00298 edm::InputTag tagName(filterName_,"",processName_);
00299 return tagName;
00300 }
00301 const edm::InputTag getDenomTag(void) const{
00302 edm::InputTag tagName(DenomfilterName_,"",processName_);
00303 return tagName;
00304 }
00305 ~PathInfo() {};
00306 PathInfo(int prescaleUsed, std::string denomPathName, std::string pathName, std::string l1pathName, std::string filterName, std::string DenomfilterName, std::string processName, size_t type, float ptmin,
00307 float ptmax):
00308 prescaleUsed_(prescaleUsed),denomPathName_(denomPathName), pathName_(pathName), l1pathName_(l1pathName), filterName_(filterName), DenomfilterName_(DenomfilterName), processName_(processName), objectType_(type),
00309 N_(0), Et_(0), EtaPhi_(0),Eta_(0),
00310 NL1_(0), l1Et_(0), l1EtaPhi_(0),l1Eta_(0),l1Phi_(0),
00311 NwrtMu_(0), EtwrtMu_(0), EtaPhiwrtMu_(0),PhiwrtMu_(0),
00312 NEff_(0), EtEff_(0), EtaEff_(0),PhiEff_(0),
00313 NNum_(0), EtNum_(0), EtaNum_(0),PhiNum_(0),
00314 NDenom_(0), EtDenom_(0), EtaDenom_(0),PhiDenom_(0),
00315 ptmin_(ptmin), ptmax_(ptmax)
00316 {
00317 };
00318 PathInfo(int prescaleUsed, std::string denomPathName, std::string pathName, std::string l1pathName, std::string filterName, std::string DenomfilterName, std::string processName, size_t type,
00319 MonitorElement *N,
00320 MonitorElement *Et,
00321 MonitorElement *EtaPhi,
00322 MonitorElement *Eta,
00323 MonitorElement *Phi,
00324 MonitorElement *NL1,
00325 MonitorElement *l1Et,
00326 MonitorElement *l1EtaPhi,
00327 MonitorElement *l1Eta,
00328 MonitorElement *l1Phi,
00329 MonitorElement *NwrtMu,
00330 MonitorElement *EtwrtMu,
00331 MonitorElement *EtaPhiwrtMu,
00332 MonitorElement *PhiwrtMu,
00333 MonitorElement *NEff,
00334 MonitorElement *EtEff,
00335 MonitorElement *EtaEff,
00336 MonitorElement *PhiEff,
00337 MonitorElement *NNum,
00338 MonitorElement *EtNum,
00339 MonitorElement *EtaNum,
00340 MonitorElement *PhiNum,
00341 MonitorElement *NDenom,
00342 MonitorElement *EtDenom,
00343 MonitorElement *EtaDenom,
00344 MonitorElement *PhiDenom,
00345 float ptmin, float ptmax
00346 ):
00347 prescaleUsed_(prescaleUsed), denomPathName_(denomPathName), pathName_(pathName), l1pathName_(l1pathName), filterName_(filterName), DenomfilterName_(DenomfilterName), processName_(processName), objectType_(type),
00348 N_(N), Et_(Et), EtaPhi_(EtaPhi),Eta_(Eta), Phi_(Phi),
00349 NL1_(NL1), l1Et_(l1Et), l1EtaPhi_(l1EtaPhi),l1Eta_(l1Eta),l1Phi_(l1Phi),
00350 NwrtMu_(NwrtMu), EtwrtMu_(EtwrtMu), EtaPhiwrtMu_(EtaPhiwrtMu),PhiwrtMu_(PhiwrtMu),
00351 NEff_(NEff), EtEff_(EtEff), EtaEff_(EtaEff), PhiEff_(PhiEff),
00352 NNum_(NNum), EtNum_(EtNum), EtaNum_(EtaNum), PhiNum_(PhiNum),
00353 NDenom_(NDenom), EtDenom_(EtDenom), EtaDenom_(EtaDenom),PhiDenom_(PhiDenom),
00354 ptmin_(ptmin), ptmax_(ptmax)
00355 {};
00356 bool operator==(const std::string v)
00357 {
00358 return v==filterName_;
00359 }
00360 private:
00361 int pathIndex_;
00362 int prescaleUsed_;
00363 std::string denomPathName_;
00364 std::string pathName_;
00365 std::string l1pathName_;
00366 std::string filterName_;
00367 std::string DenomfilterName_;
00368 std::string processName_;
00369 int objectType_;
00370
00371
00372 MonitorElement *N_, *Et_, *EtaPhi_, *Eta_, *Phi_;
00373 MonitorElement *NL1_, *l1Et_, *l1EtaPhi_ ,*l1Eta_ , *l1Phi_;
00374 MonitorElement *NwrtMu_, *EtwrtMu_, *EtaPhiwrtMu_, *PhiwrtMu_;
00375 MonitorElement *NEff_, *EtEff_, *EtaEff_, *PhiEff_;
00376 MonitorElement *NNum_, *EtNum_, *EtaNum_, *PhiNum_;
00377 MonitorElement *NDenom_, *EtDenom_, *EtaDenom_, *PhiDenom_;
00378
00379 float ptmin_, ptmax_;
00380
00381 const int index() {
00382 return pathIndex_;
00383 }
00384 const int type() {
00385 return objectType_;
00386 }
00387 public:
00388 float getPtMin() const { return ptmin_; }
00389 float getPtMax() const { return ptmax_; }
00390 };
00391
00392
00393 class PathInfoCollection: public std::vector<PathInfo> {
00394 public:
00395 PathInfoCollection(): std::vector<PathInfo>()
00396 {};
00397 std::vector<PathInfo>::iterator find(std::string pathName) {
00398 return std::find(begin(), end(), pathName);
00399 }
00400 };
00401 PathInfoCollection hltPathsAll_;
00402 PathInfoCollection hltPathsEff_;
00403 PathInfoCollection hltPathswrtMu_;
00404 MonitorElement* rate_All;
00405 MonitorElement* rate_All_L1;
00406 MonitorElement* rate_Eff;
00407 MonitorElement* rate_Denom;
00408 MonitorElement* rate_Num;
00409 MonitorElement* rate_wrtMu;
00410
00411
00412 };
00413 #endif