32 LogTrace(
"DQMOffline|MuonDPG|CSCTnPEfficiencyTask") <<
"[CSCTnPEfficiencyTask]: Constructor" << std::endl;
36 LogTrace(
"DQMOffline|MuonDPG|CSCTnPEfficiencyTask")
37 <<
"[CSCTnPEfficiencyTask]: analyzed " <<
m_nEvents <<
" events" << std::endl;
45 LogTrace(
"DQMOffline|MuonDPG|CSCTnPEfficiencyTask") <<
"[CSCTnPEfficiencyTask]: bookHistograms" << std::endl;
51 iBooker.
book2D(
"CSC_nPassingProbe_allCh",
"CSC_nPassingProbe_allCh", 9, -4., 5., 4, 0., 4.5);
53 iBooker.
book2D(
"CSC_nFailingProbe_allCh",
"CSC_nFailingProbe_allCh", 9, -4., 5., 4, 0., 4.5);
56 iBooker.
book1D(
"CSC_nPassingProbe_allCh_1D",
"CSC_nPassingProbe_allCh_1D", 9, -4., 5.);
58 iBooker.
book1D(
"CSC_nFailingProbe_allCh_1D",
"CSC_nFailingProbe_allCh_1D", 9, -4., 5.);
68 for (
int i = 1;
i < 5; ++
i) {
72 me_CSC_pass_allCh->
setAxisTitle(
"Number of passing probes", 3);
82 for (
int i = 1;
i < 5; ++
i) {
86 me_CSC_fail_allCh->
setAxisTitle(
"Number of failing probes", 3);
96 me_CSC_pass_allCh_1D->
setAxisTitle(
"Number of passing probes", 2);
106 me_CSC_fail_allCh_1D->
setAxisTitle(
"Number of failing probes", 2);
108 m_histos[
"CSC_nPassingProbe_allCh"] = me_CSC_pass_allCh;
109 m_histos[
"CSC_nFailingProbe_allCh"] = me_CSC_fail_allCh;
111 m_histos[
"CSC_nPassingProbe_allCh_1D"] = me_CSC_pass_allCh_1D;
112 m_histos[
"CSC_nFailingProbe_allCh_1D"] = me_CSC_fail_allCh_1D;
122 std::vector<std::vector<int>> probe_coll_CSC_zend;
123 std::vector<std::vector<int>> probe_coll_CSC_ring;
124 std::vector<std::vector<int>> probe_coll_CSC_sta;
125 std::vector<std::vector<float>> probe_coll_CSC_dx;
126 std::vector<uint8_t> probe_coll_CSC_staMatch;
128 std::vector<unsigned> probe_indices;
133 for (
const auto i : probe_indices) {
135 std::vector<int> probe_CSC_zend;
136 std::vector<int> probe_CSC_ring;
137 std::vector<int> probe_CSC_sta;
138 std::vector<float> probe_CSC_dx;
139 uint8_t CSC_stationMatching = 0;
141 float csc_matched =
false;
143 for (
const auto& chambMatch : (*muons).at(
i).matches()) {
149 CSCDetId chId(chambMatch.id.rawId());
152 int ring = chId.ring();
156 double smallestDx = 99999.;
157 for (
auto& seg : chambMatch.segmentMatches) {
159 if (
dx < smallestDx) {
161 closest_matchedSegment = seg;
165 CSC_stationMatching = CSC_stationMatching | (1 << (
station - 1));
167 if (
station == 1 &&
ring == 4 && chambMatch.y < -31.5) {
168 probe_CSC_zend.push_back(zendcap);
169 probe_CSC_ring.push_back(
ring);
170 probe_CSC_sta.push_back(
station);
171 probe_CSC_dx.push_back(smallestDx);
172 }
else if (
station == 1 &&
ring == 1 && chambMatch.y > -31.5) {
173 probe_CSC_zend.push_back(zendcap);
174 probe_CSC_ring.push_back(
ring);
175 probe_CSC_sta.push_back(
station);
176 probe_CSC_dx.push_back(smallestDx);
178 probe_CSC_zend.push_back(zendcap);
179 probe_CSC_ring.push_back(
ring);
180 probe_CSC_sta.push_back(
station);
181 probe_CSC_dx.push_back(smallestDx);
190 m_histos.find(
"probeEta")->second->Fill((*muons).at(
i).eta());
191 m_histos.find(
"probePhi")->second->Fill((*muons).at(
i).phi());
192 m_histos.find(
"probeNumberOfMatchedStations")->second->Fill((*muons).at(
i).numberOfMatchedStations());
193 m_histos.find(
"probePt")->second->Fill((*muons).at(
i).pt());
197 probe_coll_CSC_zend.push_back(probe_CSC_zend);
198 probe_coll_CSC_ring.push_back(probe_CSC_ring);
199 probe_coll_CSC_sta.push_back(probe_CSC_sta);
200 probe_coll_CSC_dx.push_back(probe_CSC_dx);
201 probe_coll_CSC_staMatch.push_back(CSC_stationMatching);
205 for (
unsigned i = 0;
i < probe_indices.size(); ++
i) {
206 uint8_t CSC_matchPatt = probe_coll_CSC_staMatch.at(
i);
209 unsigned nCSC_matches = probe_coll_CSC_zend.at(
i).size();
210 for (
unsigned j = 0;
j < nCSC_matches; ++
j) {
211 int CSC_zendcap = probe_coll_CSC_zend.at(
i).at(
j);
212 int CSC_sta = probe_coll_CSC_sta.at(
i).at(
j);
213 int CSC_ring = probe_coll_CSC_ring.at(
i).at(
j);
214 float CSC_dx = probe_coll_CSC_dx.at(
i).at(
j);
217 if ((CSC_matchPatt & (1 << (CSC_sta - 1))) != 0 &&
218 (CSC_matchPatt & (1 << (CSC_sta - 1))) !=
222 m_histos.find(
"CSC_nPassingProbe_allCh")->second->Fill(CSC_zendcap * CSC_sta, CSC_ring);
223 m_histos.find(
"CSC_nPassingProbe_allCh_1D")->second->Fill(CSC_zendcap * CSC_sta);
225 m_histos.find(
"CSC_nFailingProbe_allCh")->second->Fill(CSC_zendcap * CSC_sta, CSC_ring);
226 m_histos.find(
"CSC_nFailingProbe_allCh_1D")->second->Fill(CSC_zendcap * CSC_sta);
short int zendcap() const
virtual void setCurrentFolder(std::string const &fullpath)
~CSCTnPEfficiencyTask() override
Destructor.
const edm::EDGetTokenT< reco::MuonCollection > m_muToken
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
static std::string to_string(const XMLCh *ch)
void bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &run, edm::EventSetup const &context) override
std::string topFolder() const override
Return the top folder.
std::vector< std::vector< unsigned > > m_probeIndices
const bool m_detailedAnalysis
void analyze(const edm::Event &event, const edm::EventSetup &context) override
Analyze.
Abs< T >::type abs(const T &t)
std::map< std::string, MonitorElement * > m_histos
#define DEFINE_FWK_MODULE(type)
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)
CSCTnPEfficiencyTask(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())
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)