CMS 3D CMS Logo

Tau3MuMonitor.cc
Go to the documentation of this file.
11 
12 class Tau3MuMonitor : public DQMEDAnalyzer, public TriggerDQMBase {
13 public:
16 
18  ~Tau3MuMonitor() throw() override;
19  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
20 
21 protected:
22  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
23  void analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) override;
24 
25 private:
27 
30 
31  // internally store a flag to remember whether the needed tau3mu collection is present and valid
33 
34  edm::EDGetTokenT<reco::CompositeCandidateCollection> tauToken_; // tau 3 mu collection
35 
36  MonitorElement* tau1DPt_; // 1D tau pt histogram
37  MonitorElement* tau1DEta_; // 1D tau eta histogram
38  MonitorElement* tau1DPhi_; // 1D tau phi histogram
39  MonitorElement* tau1DMass_; // 1D tau mass histogram
40  MonitorElement* tau2DEtaPhi_; // 2D tau eta vs phi histogram
41 
42  MEbinning pt_binning_; // for the 1D tau pt histogram
43  MEbinning eta_binning_; // for the 1D tau eta histogram and 2D tau eta vs phi histogram
44  MEbinning phi_binning_; // for the 1D tau phi histogram and 2D tau eta vs phi histogram
45  MEbinning mass_binning_; // for the 1D tau mass histogram
46 
48 };
49 
51  : folderName_(iConfig.getParameter<std::string>("FolderName")),
52  requireValidHLTPaths_(iConfig.getParameter<bool>("requireValidHLTPaths")),
54  tauToken_(mayConsume<reco::CompositeCandidateCollection>(iConfig.getParameter<edm::InputTag>("taus"))),
56  getHistoPSet(iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("ptPSet"))),
58  iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("etaPSet"))),
60  iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("phiPSet"))),
62  iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("massPSet"))),
64  iConfig.getParameter<edm::ParameterSet>("GenericTriggerEventPSet"), consumesCollector(), *this)) {}
65 
68  genTriggerEventFlag_.reset();
69  }
70 }
71 
72 void Tau3MuMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const& iSetup) {
73  // Initialize the GenericTriggerEventFlag
75  genTriggerEventFlag_->initRun(iRun, iSetup);
76  }
77 
78  // check if every HLT path specified in numerator and denominator has a valid match in the HLT Menu
80  (genTriggerEventFlag_ && genTriggerEventFlag_->on() && genTriggerEventFlag_->allHLTPathsAreValid());
81 
82  // if valid HLT paths are required,
83  // create DQM outputs only if all paths are valid
85  return;
86  }
87 
88  std::string histname;
89 
90  std::string currentFolder = folderName_;
91  ibooker.setCurrentFolder(currentFolder);
92 
93  // tau 3 mu 1D pt
94  histname = "tau1DPt";
95  tau1DPt_ = ibooker.book1D(histname, "", pt_binning_.nbins, pt_binning_.xmin, pt_binning_.xmax);
96  tau1DPt_->setAxisTitle("3-#mu p_{T} [GeV]", 1);
97  tau1DPt_->setAxisTitle("counts", 2);
98 
99  // tau 3 mu 1D eta
100  histname = "tau1DEta";
102  tau1DEta_->setAxisTitle("3-#mu #eta", 1);
103  tau1DEta_->setAxisTitle("counts", 2);
104 
105  // tau 3 mu 1D phi
106  histname = "tau1DPhi";
108  tau1DPhi_->setAxisTitle("3-#mu #phi", 1);
109  tau1DPhi_->setAxisTitle("counts", 2);
110 
111  // tau 3 mu 1D mass
112  histname = "tau1DMass";
114  tau1DMass_->setAxisTitle("mass_{3#mu} [GeV]", 1);
115  tau1DMass_->setAxisTitle("counts", 2);
116 
117  // tau 3 mu 2D eta vs phi
118  histname = "tau2DEtaPhi";
119  tau2DEtaPhi_ = ibooker.book2D(histname,
120  "",
127  tau2DEtaPhi_->setAxisTitle("3-#mu #eta", 1);
128  tau2DEtaPhi_->setAxisTitle("3-#mu #phi", 2);
129 }
130 
132  // if valid HLT paths are required,
133  // analyze event only if all paths are valid
135  return;
136  }
137 
138  // require the trigger to be fired
139  if (genTriggerEventFlag_->on() && !genTriggerEventFlag_->accept(iEvent, iSetup))
140  return;
141 
142  // check if the previous event failed because of missing tau3mu collection.
143  // Return silently, a warning must have been issued already at this point
144  if (not validProduct_)
145  return;
146 
147  // get ahold of the tau(3mu) collection
149  iEvent.getByToken(tauToken_, tauHandle);
150 
151  // if the handle is not valid issue a warning (only for the forst occurrency)
152  if (not tauHandle.isValid()) {
153  edm::LogWarning("ProductNotValid") << "Tau3Mu trigger product not valid";
154  validProduct_ = false;
155  return;
156  }
157 
158  // loop and fill
159  for (auto const& itau : *tauHandle) {
160  tau1DPt_->Fill(itau.pt());
161  tau1DEta_->Fill(itau.eta());
162  tau1DPhi_->Fill(itau.phi());
163  tau1DMass_->Fill(itau.mass());
164  tau2DEtaPhi_->Fill(itau.eta(), itau.phi());
165  }
166 }
167 
170  desc.add<std::string>("FolderName", "HLT/BPH/");
171  desc.add<bool>("requireValidHLTPaths", true);
172 
173  desc.add<edm::InputTag>("taus", edm::InputTag("hltTauPt10MuPts511Mass1p2to2p3Iso", "Taus"));
174 
188  desc.add<edm::ParameterSetDescription>("histoPSet", histoPSet);
189 
191  genericTriggerEventPSet.add<bool>("andOr");
192  genericTriggerEventPSet.add<edm::InputTag>("dcsInputTag", edm::InputTag("scalersRawToDigi"));
193  genericTriggerEventPSet.add<std::vector<int> >("dcsPartitions", {});
194  genericTriggerEventPSet.add<bool>("andOrDcs", false);
195  genericTriggerEventPSet.add<bool>("errorReplyDcs", true);
196  genericTriggerEventPSet.add<std::string>("dbLabel", "");
197  genericTriggerEventPSet.add<bool>("andOrHlt", true);
198  genericTriggerEventPSet.add<edm::InputTag>("hltInputTag", edm::InputTag("TriggerResults::HLT"));
199  genericTriggerEventPSet.add<std::vector<std::string> >("hltPaths", {});
200  genericTriggerEventPSet.add<std::string>("hltDBKey", "");
201  genericTriggerEventPSet.add<bool>("errorReplyHlt", false);
202  genericTriggerEventPSet.add<unsigned int>("verbosityLevel", 0);
203  desc.add<edm::ParameterSetDescription>("GenericTriggerEventPSet", genericTriggerEventPSet);
204 
205  descriptions.add("tau3muMonitoring", desc);
206 }
207 
ConfigurationDescriptions.h
dqm::impl::MonitorElement
Definition: MonitorElement.h:98
V0Monitor_cfi.ptPSet
ptPSet
Definition: V0Monitor_cfi.py:25
Tau3MuMonitor::tau1DPt_
MonitorElement * tau1DPt_
Definition: Tau3MuMonitor.cc:36
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MessageLogger.h
CompositeCandidate.h
funct::false
false
Definition: Factorize.h:34
edm::Run
Definition: Run.h:45
V0Monitor_cfi.etaPSet
etaPSet
Definition: V0Monitor_cfi.py:30
Tau3MuMonitor_cff.taus
taus
Definition: Tau3MuMonitor_cff.py:7
edm
HLT enums.
Definition: AlignableModifier.h:19
Tau3MuMonitor::tauToken_
edm::EDGetTokenT< reco::CompositeCandidateCollection > tauToken_
Definition: Tau3MuMonitor.cc:34
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
SiStripSourceConfigTier0_cff.genericTriggerEventPSet
genericTriggerEventPSet
Definition: SiStripSourceConfigTier0_cff.py:96
DQMStore.h
Tau3MuMonitor::tau1DPhi_
MonitorElement * tau1DPhi_
Definition: Tau3MuMonitor.cc:38
Tau3MuMonitor::MonitorElement
dqm::reco::MonitorElement MonitorElement
Definition: Tau3MuMonitor.cc:14
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
Tau3MuMonitor::folderName_
const std::string folderName_
Definition: Tau3MuMonitor.cc:26
watchdog.const
const
Definition: watchdog.py:83
edm::Handle
Definition: AssociativeIterator.h:50
PixelVTXMonitor_cfi.FolderName
FolderName
Definition: PixelVTXMonitor_cfi.py:5
Tau3MuMonitor::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: Tau3MuMonitor.cc:168
MakerMacros.h
Tau3MuMonitor::tau1DMass_
MonitorElement * tau1DMass_
Definition: Tau3MuMonitor.cc:39
reco::CompositeCandidateCollection
std::vector< CompositeCandidate > CompositeCandidateCollection
collection of Candidate objects
Definition: CompositeCandidateFwd.h:19
Tau3MuMonitor::mass_binning_
MEbinning mass_binning_
Definition: Tau3MuMonitor.cc:45
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
dqm::legacy::DQMStore
Definition: DQMStore.h:727
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
TriggerDQMBase.h
GenericTriggerEventFlag.h
TriggerDQMBase::MEbinning::xmax
double xmax
Definition: TriggerDQMBase.h:19
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
Event
Tau3MuMonitor::genTriggerEventFlag_
std::unique_ptr< GenericTriggerEventFlag > genTriggerEventFlag_
Definition: Tau3MuMonitor.cc:47
TriggerDQMBase
Definition: TriggerDQMBase.h:8
Tau3MuMonitor::requireValidHLTPaths_
const bool requireValidHLTPaths_
Definition: Tau3MuMonitor.cc:28
Tau3MuMonitor::hltPathsAreValid_
bool hltPathsAreValid_
Definition: Tau3MuMonitor.cc:29
DQMEDAnalyzer.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
DQMEDAnalyzer
Definition: DQMEDAnalyzer.py:1
Tau3MuMonitor::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: Tau3MuMonitor.cc:72
TriggerDQMBase::fillHistoPSetDescription
static void fillHistoPSetDescription(edm::ParameterSetDescription &pset)
Definition: TriggerDQMBase.cc:108
funct::true
true
Definition: Factorize.h:173
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
Tau3MuMonitor::DQMStore
dqm::reco::DQMStore DQMStore
Definition: Tau3MuMonitor.cc:15
Tau3MuMonitor::Tau3MuMonitor
Tau3MuMonitor(const edm::ParameterSet &)
Definition: Tau3MuMonitor.cc:50
ParameterSet
Definition: Functions.h:16
GenericTriggerEventFlag
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
Definition: GenericTriggerEventFlag.h:42
V0Monitor_cff.massPSet
massPSet
Definition: V0Monitor_cff.py:8
iEvent
int iEvent
Definition: GenABIO.cc:224
LumiMonitor_cff.histoPSet
histoPSet
Definition: LumiMonitor_cff.py:12
Tau3MuMonitor::pt_binning_
MEbinning pt_binning_
Definition: Tau3MuMonitor.cc:42
edm::EventSetup
Definition: EventSetup.h:57
TriggerDQMBase::getHistoPSet
static MEbinning getHistoPSet(const edm::ParameterSet &pset)
Definition: TriggerDQMBase.cc:120
Tau3MuMonitor::eta_binning_
MEbinning eta_binning_
Definition: Tau3MuMonitor.cc:43
cms::cuda::device::unique_ptr
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
Definition: device_unique_ptr.h:33
std
Definition: JetResolutionObject.h:76
Tau3MuMonitor
Definition: Tau3MuMonitor.cc:12
Tau3MuMonitor::validProduct_
bool validProduct_
Definition: Tau3MuMonitor.cc:32
Tau3MuMonitor::tau2DEtaPhi_
MonitorElement * tau2DEtaPhi_
Definition: Tau3MuMonitor.cc:40
ConfigurationDescriptions
StringCutObjectSelector.h
Frameworkfwd.h
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
BPHMonitor_cff.phiPSet
phiPSet
Definition: BPHMonitor_cff.py:631
TriggerDQMBase::MEbinning::nbins
uint nbins
Definition: TriggerDQMBase.h:17
TriggerDQMBase::MEbinning::xmin
double xmin
Definition: TriggerDQMBase.h:18
Tau3MuMonitor::phi_binning_
MEbinning phi_binning_
Definition: Tau3MuMonitor.cc:44
Tau3MuMonitor::tau1DEta_
MonitorElement * tau1DEta_
Definition: Tau3MuMonitor.cc:37
dqm::implementation::IBooker
Definition: DQMStore.h:43
ALCARECOPromptCalibProdSiPixelAli0T_cff.throw
throw
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:9
LepHTMonitor_cff.requireValidHLTPaths
requireValidHLTPaths
Definition: LepHTMonitor_cff.py:22
EventSetup
Tau3MuMonitor::analyze
void analyze(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
Definition: Tau3MuMonitor.cc:131
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
Tau3MuMonitor::~Tau3MuMonitor
~Tau3MuMonitor() override
Definition: Tau3MuMonitor.cc:66
edm::Event
Definition: Event.h:73
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:800
edm::InputTag
Definition: InputTag.h:15
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
Run