CMS 3D CMS Logo

Tau3MuMonitor.cc
Go to the documentation of this file.
2 
4  folderName_ ( iConfig.getParameter<std::string>("FolderName") ) ,
5  tauToken_ ( mayConsume<reco::CompositeCandidateCollection>(iConfig.getParameter<edm::InputTag>("taus") ) ) ,
6  pt_binning_ ( getHistoPSet (iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("ptPSet" ) ) ) ,
7  eta_binning_ ( getHistoPSet (iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("etaPSet" ) ) ) ,
8  phi_binning_ ( getHistoPSet (iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("phiPSet" ) ) ) ,
9  mass_binning_ ( getHistoPSet (iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("massPSet") ) ) ,
10  genTriggerEventFlag_( new GenericTriggerEventFlag(iConfig.getParameter<edm::ParameterSet>("GenericTriggerEventPSet"),consumesCollector(), *this) )
11 {
12  // initialise histograms to null
13  tau1DPt_ = nullptr;
14  tau1DEta_ = nullptr;
15  tau1DPhi_ = nullptr;
16  tau1DMass_ = nullptr;
17  tau2DEtaPhi_ = nullptr;
18 }
19 
21 
22 // shape the content of a "histogram PSet"
24 {
25  pset.add<unsigned int>( "nbins" );
26  pset.add<double> ( "xmin" );
27  pset.add<double> ( "xmax" );
28 }
29 
30 // read the information packed into an "histogram PSet"
32 {
33  return MEbinning{
34  pset.getParameter<unsigned int>("nbins"),
35  pset.getParameter<double > ("xmin" ),
36  pset.getParameter<double > ("xmax" ),
37  };
38 }
39 
40 // book histograms
42  edm::Run const & iRun,
43  edm::EventSetup const & iSetup)
44 {
45  std::string histname;
46 
47  std::string currentFolder = folderName_ ;
48  ibooker.setCurrentFolder(currentFolder);
49 
50  // tau 3 mu 1D pt
51  histname = "tau1DPt";
52  tau1DPt_ = ibooker.book1D(histname, "", pt_binning_.nbins, pt_binning_.xmin, pt_binning_.xmax);
53  tau1DPt_->setAxisTitle("3-#mu p_{T} [GeV]", 1);
54  tau1DPt_->setAxisTitle("counts" , 2);
55 
56  // tau 3 mu 1D eta
57  histname = "tau1DEta";
59  tau1DEta_->setAxisTitle("3-#mu #eta", 1);
60  tau1DEta_->setAxisTitle("counts" , 2);
61 
62  // tau 3 mu 1D phi
63  histname = "tau1DPhi";
65  tau1DPhi_->setAxisTitle("3-#mu #phi", 1);
66  tau1DPhi_->setAxisTitle("counts" , 2);
67 
68  // tau 3 mu 1D mass
69  histname = "tau1DMass";
71  tau1DMass_->setAxisTitle("mass_{3#mu} [GeV]", 1);
72  tau1DMass_->setAxisTitle("counts" , 2);
73 
74  // tau 3 mu 2D eta vs phi
75  histname = "tau2DEtaPhi";
78  tau2DEtaPhi_->setAxisTitle("3-#mu #eta", 1);
79  tau2DEtaPhi_->setAxisTitle("3-#mu #phi", 2);
80 
81  // Initialize the GenericTriggerEventFlag
82  if ( genTriggerEventFlag_ && genTriggerEventFlag_->on() ) genTriggerEventFlag_->initRun( iRun, iSetup );
83 
84 }
85 
87 {
88 
89  // require the trigger to be fired
90  if (genTriggerEventFlag_->on() && !genTriggerEventFlag_->accept(iEvent, iSetup) ) return;
91 
92  // check if the previous event failed because of missing tau3mu collection.
93  // Return silently, a warning must have been issued already at this point
94  if (!validProduct_) return;
95 
96  // get ahold of the tau(3mu) collection
98  iEvent.getByToken( tauToken_, tauHandle );
99 
100  // if the handle is not valid issue a warning (only for the forst occurrency)
101  if (!tauHandle.isValid()) {
102  edm::LogWarning("ProductNotValid") << "Tau3Mu trigger product not valid";
103  validProduct_ = false;
104  return;
105  }
106 
107  // loop and fill
108  for (auto const & itau : *tauHandle) {
109  tau1DPt_ ->Fill(itau.pt ());
110  tau1DEta_ ->Fill(itau.eta ());
111  tau1DPhi_ ->Fill(itau.phi ());
112  tau1DMass_ ->Fill(itau.mass());
113  tau2DEtaPhi_->Fill(itau.eta(), itau.phi());
114  }
115 
116 }
117 
119 {
121  //
122  desc.add<std::string> ( "FolderName", "HLT/BPH/" );
123  //
124  desc.add<edm::InputTag>( "taus", edm::InputTag("hltTauPt10MuPts511Mass1p2to2p3Iso", "Taus") );
125  //
131  fillHistoPSetDescription(ptPSet ); // order matters: this must come before the PSets are added
132  fillHistoPSetDescription(etaPSet );
133  fillHistoPSetDescription(phiPSet );
134  fillHistoPSetDescription(massPSet);
135  histoPSet.add<edm::ParameterSetDescription>("ptPSet" , ptPSet );
136  histoPSet.add<edm::ParameterSetDescription>("etaPSet" , etaPSet );
137  histoPSet.add<edm::ParameterSetDescription>("phiPSet" , phiPSet );
138  histoPSet.add<edm::ParameterSetDescription>("massPSet", massPSet);
139  desc.add<edm::ParameterSetDescription>("histoPSet", histoPSet);
140  //
141  edm::ParameterSetDescription genericTriggerEventPSet;
142  genericTriggerEventPSet.add<bool> ("andOr" );
143  genericTriggerEventPSet.add<edm::InputTag> ("dcsInputTag" , edm::InputTag("scalersRawToDigi") );
144  genericTriggerEventPSet.add<std::vector<int> > ("dcsPartitions" , {} );
145  genericTriggerEventPSet.add<bool> ("andOrDcs" , false );
146  genericTriggerEventPSet.add<bool> ("errorReplyDcs" , true );
147  genericTriggerEventPSet.add<std::string> ("dbLabel" , "" );
148  genericTriggerEventPSet.add<bool> ("andOrHlt" , true );
149  genericTriggerEventPSet.add<edm::InputTag> ("hltInputTag" , edm::InputTag("TriggerResults::HLT") );
150  genericTriggerEventPSet.add<std::vector<std::string> >("hltPaths" , {} );
151  genericTriggerEventPSet.add<std::string> ("hltDBKey" , "" );
152  genericTriggerEventPSet.add<bool> ("errorReplyHlt" , false );
153  genericTriggerEventPSet.add<unsigned int> ("verbosityLevel", 0 );
154  desc.add<edm::ParameterSetDescription>("GenericTriggerEventPSet", genericTriggerEventPSet);
155  //
156  descriptions.add("tau3muMonitoring", desc);
157 }
158 
159 // Define this as a plug-in
T getParameter(std::string const &) const
void analyze(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
std::string folderName_
Definition: Tau3MuMonitor.h:50
MonitorElement * tau1DEta_
Definition: Tau3MuMonitor.h:57
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::vector< CompositeCandidate > CompositeCandidateCollection
collection of Candidate objects
MonitorElement * tau1DPt_
Definition: Tau3MuMonitor.h:56
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
MEbinning pt_binning_
Definition: Tau3MuMonitor.h:62
static void fillHistoPSetDescription(edm::ParameterSetDescription &pset)
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
static MEbinning getHistoPSet(edm::ParameterSet pset)
std::unique_ptr< GenericTriggerEventFlag > genTriggerEventFlag_
Definition: Tau3MuMonitor.h:67
void Fill(long long x)
MonitorElement * tau1DMass_
Definition: Tau3MuMonitor.h:59
int iEvent
Definition: GenABIO.cc:230
double xmin
Definition: LumiMonitor.h:30
MonitorElement * tau1DPhi_
Definition: Tau3MuMonitor.h:58
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
~Tau3MuMonitor() override
MEbinning mass_binning_
Definition: Tau3MuMonitor.h:65
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isValid() const
Definition: HandleBase.h:74
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
MonitorElement * tau2DEtaPhi_
Definition: Tau3MuMonitor.h:60
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
void add(std::string const &label, ParameterSetDescription const &psetDescription)
fixed size matrix
HLT enums.
MEbinning phi_binning_
Definition: Tau3MuMonitor.h:64
MEbinning eta_binning_
Definition: Tau3MuMonitor.h:63
edm::EDGetTokenT< reco::CompositeCandidateCollection > tauToken_
Definition: Tau3MuMonitor.h:54
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Tau3MuMonitor(const edm::ParameterSet &)
Definition: Tau3MuMonitor.cc:3
Definition: Run.h:43
double xmax
Definition: LumiMonitor.h:31