35 LogTrace(
"DQMOffline|MuonDPG|DTTnPEfficiencyTask") <<
"[DTTnPEfficiencyTask]: Constructor" << std::endl;
39 LogTrace(
"DQMOffline|MuonDPG|DTTnPEfficiencyTask")
40 <<
"[DTTnPEfficiencyTask]: analyzed " <<
m_nEvents <<
" events" << std::endl;
48 LogTrace(
"DQMOffline|MuonDPG|DTTnPEfficiencyTask") <<
"[DTTnPEfficiencyTask]: bookHistograms" << std::endl;
56 MonitorElement* me_DT_pass_allCh = iBooker.
book1D(
"DT_nPassingProbe_allCh",
"DT_nPassingProbe_allCh", 20, 0.5, 20.5);
57 MonitorElement* me_DT_fail_allCh = iBooker.
book1D(
"DT_nFailingProbe_allCh",
"DT_nFailingProbe_allCh", 20, 0.5, 20.5);
79 me_DT_pass_allCh->
setAxisTitle(
"Number of passing probes", 2);
101 me_DT_fail_allCh->
setAxisTitle(
"Number of failing probes", 2);
103 m_histos[
"DT_nPassingProbe_allCh"] = me_DT_pass_allCh;
104 m_histos[
"DT_nFailingProbe_allCh"] = me_DT_fail_allCh;
114 std::vector<std::vector<int>> probe_coll_DT_wh;
115 std::vector<std::vector<int>> probe_coll_DT_sec;
116 std::vector<std::vector<int>> probe_coll_DT_sta;
117 std::vector<std::vector<float>> probe_coll_DT_dx;
118 std::vector<uint8_t> probe_coll_DT_staMatch;
120 std::vector<unsigned> probe_indices;
125 for (
const auto i : probe_indices) {
127 std::vector<int> probe_DT_wh;
128 std::vector<int> probe_DT_sec;
129 std::vector<int> probe_DT_sta;
130 std::vector<float> probe_DT_dx;
131 uint8_t DT_stationMatching = 0;
133 float dt_matched =
false;
135 for (
const auto& chambMatch : (*muons).at(
i).matches()) {
143 int wheel = chId.wheel();
144 int sector = chId.sector();
148 double smallestDx = 999.;
150 for (
auto& seg : chambMatch.segmentMatches) {
152 if (
dx < smallestDx) {
154 closest_matchedSegment = seg;
158 DT_stationMatching = DT_stationMatching | (1 << (
station - 1));
160 probe_DT_wh.push_back(
wheel);
161 probe_DT_sec.push_back(sector);
162 probe_DT_sta.push_back(
station);
163 probe_DT_dx.push_back(smallestDx);
171 m_histos.find(
"probeEta")->second->Fill((*muons).at(
i).eta());
172 m_histos.find(
"probePhi")->second->Fill((*muons).at(
i).phi());
173 m_histos.find(
"probeNumberOfMatchedStations")->second->Fill((*muons).at(
i).numberOfMatchedStations());
174 m_histos.find(
"probePt")->second->Fill((*muons).at(
i).pt());
178 probe_coll_DT_wh.push_back(probe_DT_wh);
179 probe_coll_DT_sec.push_back(probe_DT_sec);
180 probe_coll_DT_sta.push_back(probe_DT_sta);
181 probe_coll_DT_dx.push_back(probe_DT_dx);
182 probe_coll_DT_staMatch.push_back(DT_stationMatching);
186 for (
unsigned i = 0;
i < probe_indices.size(); ++
i) {
187 uint8_t DT_matchPatt = probe_coll_DT_staMatch.at(
i);
190 unsigned nDT_matches = probe_coll_DT_wh.at(
i).size();
191 for (
unsigned j = 0;
j < nDT_matches; ++
j) {
193 int DT_wheel = probe_coll_DT_wh.at(
i).at(
j);
194 int DT_station = probe_coll_DT_sta.at(
i).at(
j);
195 int DT_sector = probe_coll_DT_sec.at(
i).at(
j);
196 float DT_dx = probe_coll_DT_dx.at(
i).at(
j);
199 if ((DT_matchPatt & (1 << (DT_station - 1))) != 0 &&
200 (DT_matchPatt & (1 << (DT_station - 1))) !=
205 m_histos.find(hName)->second->Fill(DT_sector, DT_station);
206 m_histos.find(
"DT_nPassingProbe_allCh")->second->Fill((DT_station) + 4 * (DT_wheel + 2));
209 m_histos.find(hName)->second->Fill(DT_sector, DT_station);
210 m_histos.find(
"DT_nFailingProbe_allCh")->second->Fill((DT_station) + 4 * (DT_wheel + 2));
221 LogTrace(
"DQMOffline|MuonDPG|DTTnPEfficiencyTask")
222 <<
"[DTTnPEfficiencyTask]: booking histos in " <<
baseDir << std::endl;
227 MonitorElement* me_DT_pass = iBooker.
book2D(hName_DT_pass.c_str(), hName_DT_pass.c_str(), 14, 0.5, 14.5, 4, 0., 4.5);
228 MonitorElement* me_DT_fail = iBooker.
book2D(hName_DT_fail.c_str(), hName_DT_fail.c_str(), 14, 0.5, 14.5, 4, 0., 4.5);
234 for (
int i = 1;
i < 15; ++
i) {
238 me_DT_pass->
setAxisTitle(
"Number of passing probes", 3);
244 for (
int i = 1;
i < 15; ++
i) {
248 me_DT_fail->
setAxisTitle(
"Number of failing probes", 3);
250 m_histos[hName_DT_pass] = me_DT_pass;
251 m_histos[hName_DT_fail] = me_DT_fail;
~DTTnPEfficiencyTask() override
Destructor.
void bookWheelHistos(DQMStore::IBooker &iBooker, int wheel, std::string folder="")
Book wheel granularity histograms.
virtual void setCurrentFolder(std::string const &fullpath)
#define DEFINE_FWK_MODULE(type)
void bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &run, edm::EventSetup const &context) override
const edm::EDGetTokenT< reco::MuonCollection > m_muToken
std::string to_string(const V &value)
std::vector< std::vector< unsigned > > m_probeIndices
const bool m_detailedAnalysis
std::string topFolder() const override
Return the top folder.
Abs< T >::type abs(const T &t)
std::map< std::string, MonitorElement * > m_histos
void analyze(const edm::Event &event, const edm::EventSetup &context) override
Analyze.
virtual 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)
DTTnPEfficiencyTask(const edm::ParameterSet &config)
Constructor.
void bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &run, edm::EventSetup const &context) override
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
void analyze(const edm::Event &event, const edm::EventSetup &context) override
Analyze.
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)