CMS 3D CMS Logo

MuonIdDQM.cc
Go to the documentation of this file.
2 
5  inputMuonCollection_ = consumes<reco::MuonCollection>(iConfig.getParameter<edm::InputTag>("inputMuonCollection"));
7  consumes<DTRecSegment4DCollection>(iConfig.getParameter<edm::InputTag>("inputDTRecSegment4DCollection"));
9  consumes<CSCSegmentCollection>(iConfig.getParameter<edm::InputTag>("inputCSCSegmentCollection"));
10  useTrackerMuons_ = iConfig.getUntrackedParameter<bool>("useTrackerMuons");
11  useGlobalMuons_ = iConfig.getUntrackedParameter<bool>("useGlobalMuons");
12  useTrackerMuonsNotGlobalMuons_ = iConfig.getUntrackedParameter<bool>("useTrackerMuonsNotGlobalMuons");
13  useGlobalMuonsNotTrackerMuons_ = iConfig.getUntrackedParameter<bool>("useGlobalMuonsNotTrackerMuons");
14  baseFolder_ = iConfig.getUntrackedParameter<std::string>("baseFolder");
15 }
16 
18 
20  edm::Run const& /*iRun*/,
21  edm::EventSetup const& /* iSetup */) {
22  char name[100], title[200];
23 
24  ibooker.cd();
26  // trackerMuon == 0; globalMuon == 1; trackerMuon && !globalMuon == 2; globalMuon && !trackerMuon == 3
27 
28  hSegmentIsAssociatedBool = ibooker.book1D("hSegmentIsAssociatedBool", "Segment Is Associated Boolean", 2, -0.5, 1.5);
29 
30  for (unsigned int i = 0; i < 4; i++) {
31  if ((i == 0 && !useTrackerMuons_) || (i == 1 && !useGlobalMuons_))
32  continue;
34  continue;
35  if (i == 0)
36  ibooker.setCurrentFolder(baseFolder_ + "/TrackerMuons");
37  if (i == 1)
38  ibooker.setCurrentFolder(baseFolder_ + "/GlobalMuons");
39  if (i == 2)
40  ibooker.setCurrentFolder(baseFolder_ + "/TrackerMuonsNotGlobalMuons");
41  if (i == 3)
42  ibooker.setCurrentFolder(baseFolder_ + "/GlobalMuonsNotTrackerMuons");
43 
44  hNumChambers[i] = ibooker.book1D("hNumChambers", "Number of Chambers", 17, -0.5, 16.5);
45  hNumMatches[i] = ibooker.book1D("hNumMatches", "Number of Matches", 11, -0.5, 10.5);
46  hNumChambersNoRPC[i] = ibooker.book1D("hNumChambersNoRPC", "Number of Chambers No RPC", 11, -0.5, 10.5);
47 
48  // by station
49  for (int station = 0; station < 4; ++station) {
50  sprintf(name, "hDT%iNumSegments", station + 1);
51  sprintf(title, "DT Station %i Number of Segments (No Arbitration)", station + 1);
52  hDTNumSegments[i][station] = ibooker.book1D(name, title, 11, -0.5, 10.5);
53 
54  sprintf(name, "hDT%iDx", station + 1);
55  sprintf(title, "DT Station %i Delta X", station + 1);
56  hDTDx[i][station] = ibooker.book1D(name, title, 100, -100., 100.);
57 
58  sprintf(name, "hDT%iPullx", station + 1);
59  sprintf(title, "DT Station %i Pull X", station + 1);
60  hDTPullx[i][station] = ibooker.book1D(name, title, 100, -20., 20.);
61 
62  sprintf(name, "hDT%iDdXdZ", station + 1);
63  sprintf(title, "DT Station %i Delta DxDz", station + 1);
64  hDTDdXdZ[i][station] = ibooker.book1D(name, title, 100, -1., 1.);
65 
66  sprintf(name, "hDT%iPulldXdZ", station + 1);
67  sprintf(title, "DT Station %i Pull DxDz", station + 1);
68  hDTPulldXdZ[i][station] = ibooker.book1D(name, title, 100, -20., 20.);
69 
70  if (station < 3) {
71  sprintf(name, "hDT%iDy", station + 1);
72  sprintf(title, "DT Station %i Delta Y", station + 1);
73  hDTDy[i][station] = ibooker.book1D(name, title, 100, -150., 150.);
74 
75  sprintf(name, "hDT%iPully", station + 1);
76  sprintf(title, "DT Station %i Pull Y", station + 1);
77  hDTPully[i][station] = ibooker.book1D(name, title, 100, -20., 20.);
78 
79  sprintf(name, "hDT%iDdYdZ", station + 1);
80  sprintf(title, "DT Station %i Delta DyDz", station + 1);
81  hDTDdYdZ[i][station] = ibooker.book1D(name, title, 100, -2., 2.);
82 
83  sprintf(name, "hDT%iPulldYdZ", station + 1);
84  sprintf(title, "DT Station %i Pull DyDz", station + 1);
85  hDTPulldYdZ[i][station] = ibooker.book1D(name, title, 100, -20., 20.);
86  }
87 
88  sprintf(name, "hCSC%iNumSegments", station + 1);
89  sprintf(title, "CSC Station %i Number of Segments (No Arbitration)", station + 1);
90  hCSCNumSegments[i][station] = ibooker.book1D(name, title, 11, -0.5, 10.5);
91 
92  sprintf(name, "hCSC%iDx", station + 1);
93  sprintf(title, "CSC Station %i Delta X", station + 1);
94  hCSCDx[i][station] = ibooker.book1D(name, title, 100, -50., 50.);
95 
96  sprintf(name, "hCSC%iPullx", station + 1);
97  sprintf(title, "CSC Station %i Pull X", station + 1);
98  hCSCPullx[i][station] = ibooker.book1D(name, title, 100, -20., 20.);
99 
100  sprintf(name, "hCSC%iDdXdZ", station + 1);
101  sprintf(title, "CSC Station %i Delta DxDz", station + 1);
102  hCSCDdXdZ[i][station] = ibooker.book1D(name, title, 100, -1., 1.);
103 
104  sprintf(name, "hCSC%iPulldXdZ", station + 1);
105  sprintf(title, "CSC Station %i Pull DxDz", station + 1);
106  hCSCPulldXdZ[i][station] = ibooker.book1D(name, title, 100, -20., 20.);
107 
108  sprintf(name, "hCSC%iDy", station + 1);
109  sprintf(title, "CSC Station %i Delta Y", station + 1);
110  hCSCDy[i][station] = ibooker.book1D(name, title, 100, -50., 50.);
111 
112  sprintf(name, "hCSC%iPully", station + 1);
113  sprintf(title, "CSC Station %i Pull Y", station + 1);
114  hCSCPully[i][station] = ibooker.book1D(name, title, 100, -20., 20.);
115 
116  sprintf(name, "hCSC%iDdYdZ", station + 1);
117  sprintf(title, "CSC Station %i Delta DyDz", station + 1);
118  hCSCDdYdZ[i][station] = ibooker.book1D(name, title, 100, -1., 1.);
119 
120  sprintf(name, "hCSC%iPulldYdZ", station + 1);
121  sprintf(title, "CSC Station %i Pull DyDz", station + 1);
122  hCSCPulldYdZ[i][station] = ibooker.book1D(name, title, 100, -20., 20.);
123  } // station
124  }
125 }
126 
128  using namespace edm;
129  using namespace reco;
130 
134 
136 
137  for (MuonCollection::const_iterator muon = muonCollectionH_->begin(); muon != muonCollectionH_->end(); ++muon) {
138  // trackerMuon == 0; globalMuon == 1; trackerMuon && !globalMuon == 2; globalMuon && !trackerMuon == 3
139  for (unsigned int i = 0; i < 4; i++) {
140  if (i == 0 && (!useTrackerMuons_ || !muon->isTrackerMuon()))
141  continue;
142  if (i == 1 && (!useGlobalMuons_ || !muon->isGlobalMuon()))
143  continue;
144  if (i == 2 && (!useTrackerMuonsNotGlobalMuons_ || (!(muon->isTrackerMuon() && !muon->isGlobalMuon()))))
145  continue;
146  if (i == 3 && (!useGlobalMuonsNotTrackerMuons_ || (!(muon->isGlobalMuon() && !muon->isTrackerMuon()))))
147  continue;
148 
149  hNumChambers[i]->Fill(muon->numberOfChambers());
150  hNumMatches[i]->Fill(muon->numberOfMatches(Muon::SegmentAndTrackArbitration));
151  hNumChambersNoRPC[i]->Fill(muon->numberOfChambersCSCorDT());
152 
153  // by station
154  for (int station = 0; station < 4; ++station) {
155  // only fill num segments if we crossed (or nearly crossed) a chamber
156  if (muon->trackX(station + 1, MuonSubdetId::DT, Muon::NoArbitration) < 900000)
157  hDTNumSegments[i][station]->Fill(muon->numberOfSegments(station + 1, MuonSubdetId::DT, Muon::NoArbitration));
158  Fill(hDTDx[i][station], muon->dX(station + 1, MuonSubdetId::DT, Muon::SegmentAndTrackArbitration));
159  Fill(hDTPullx[i][station], muon->pullX(station + 1, MuonSubdetId::DT, Muon::SegmentAndTrackArbitration, true));
160  Fill(hDTDdXdZ[i][station], muon->dDxDz(station + 1, MuonSubdetId::DT, Muon::SegmentAndTrackArbitration));
162  muon->pullDxDz(station + 1, MuonSubdetId::DT, Muon::SegmentAndTrackArbitration, true));
163 
164  if (station < 3) {
165  Fill(hDTDy[i][station], muon->dY(station + 1, MuonSubdetId::DT, Muon::SegmentAndTrackArbitration));
167  muon->pullY(station + 1, MuonSubdetId::DT, Muon::SegmentAndTrackArbitration, true));
168  Fill(hDTDdYdZ[i][station], muon->dDyDz(station + 1, MuonSubdetId::DT, Muon::SegmentAndTrackArbitration));
170  muon->pullDyDz(station + 1, MuonSubdetId::DT, Muon::SegmentAndTrackArbitration, true));
171  }
172 
173  // only fill num segments if we crossed (or nearly crossed) a chamber
174  if (muon->trackX(station + 1, MuonSubdetId::CSC, Muon::NoArbitration) < 900000)
176  muon->numberOfSegments(station + 1, MuonSubdetId::CSC, Muon::NoArbitration));
177  Fill(hCSCDx[i][station], muon->dX(station + 1, MuonSubdetId::CSC, Muon::SegmentAndTrackArbitration));
179  muon->pullX(station + 1, MuonSubdetId::CSC, Muon::SegmentAndTrackArbitration, true));
180  Fill(hCSCDdXdZ[i][station], muon->dDxDz(station + 1, MuonSubdetId::CSC, Muon::SegmentAndTrackArbitration));
182  muon->pullDxDz(station + 1, MuonSubdetId::CSC, Muon::SegmentAndTrackArbitration, true));
183  Fill(hCSCDy[i][station], muon->dY(station + 1, MuonSubdetId::CSC, Muon::SegmentAndTrackArbitration));
185  muon->pullY(station + 1, MuonSubdetId::CSC, Muon::SegmentAndTrackArbitration, true));
186  Fill(hCSCDdYdZ[i][station], muon->dDyDz(station + 1, MuonSubdetId::CSC, Muon::SegmentAndTrackArbitration));
188  muon->pullDyDz(station + 1, MuonSubdetId::CSC, Muon::SegmentAndTrackArbitration, true));
189  }
190  }
191  } // muon
192 
194  segment != dtSegmentCollectionH_->end();
195  ++segment) {
196  LocalPoint segmentLocalPosition = segment->localPosition();
197  LocalVector segmentLocalDirection = segment->localDirection();
198  LocalError segmentLocalPositionError = segment->localPositionError();
199  LocalError segmentLocalDirectionError = segment->localDirectionError();
200  bool segmentFound = false;
201 
202  for (MuonCollection::const_iterator muon = muonCollectionH_->begin(); muon != muonCollectionH_->end(); ++muon) {
203  if (!muon->isMatchesValid())
204  continue;
205 
206  for (std::vector<MuonChamberMatch>::const_iterator chamberMatch = muon->matches().begin();
207  chamberMatch != muon->matches().end();
208  ++chamberMatch) {
209  for (std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
210  segmentMatch != chamberMatch->segmentMatches.end();
211  ++segmentMatch) {
212  if (fabs(segmentMatch->x - segmentLocalPosition.x()) < 1E-6 &&
213  fabs(segmentMatch->y - segmentLocalPosition.y()) < 1E-6 &&
214  fabs(segmentMatch->dXdZ - segmentLocalDirection.x() / segmentLocalDirection.z()) < 1E-6 &&
215  fabs(segmentMatch->dYdZ - segmentLocalDirection.y() / segmentLocalDirection.z()) < 1E-6 &&
216  fabs(segmentMatch->xErr - sqrt(segmentLocalPositionError.xx())) < 1E-6 &&
217  fabs(segmentMatch->yErr - sqrt(segmentLocalPositionError.yy())) < 1E-6 &&
218  fabs(segmentMatch->dXdZErr - sqrt(segmentLocalDirectionError.xx())) < 1E-6 &&
219  fabs(segmentMatch->dYdZErr - sqrt(segmentLocalDirectionError.yy())) < 1E-6) {
220  segmentFound = true;
221  break;
222  }
223  } // segmentMatch
224  if (segmentFound)
225  break;
226  } // chamberMatch
227  if (segmentFound)
228  break;
229  } // muon
230 
231  if (segmentFound)
233  else
235  } // dt segment
236 
238  segment != cscSegmentCollectionH_->end();
239  ++segment) {
240  LocalPoint segmentLocalPosition = segment->localPosition();
241  LocalVector segmentLocalDirection = segment->localDirection();
242  LocalError segmentLocalPositionError = segment->localPositionError();
243  LocalError segmentLocalDirectionError = segment->localDirectionError();
244  bool segmentFound = false;
245 
246  for (MuonCollection::const_iterator muon = muonCollectionH_->begin(); muon != muonCollectionH_->end(); ++muon) {
247  if (!muon->isMatchesValid())
248  continue;
249 
250  for (std::vector<MuonChamberMatch>::const_iterator chamberMatch = muon->matches().begin();
251  chamberMatch != muon->matches().end();
252  ++chamberMatch) {
253  for (std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
254  segmentMatch != chamberMatch->segmentMatches.end();
255  ++segmentMatch) {
256  if (fabs(segmentMatch->x - segmentLocalPosition.x()) < 1E-6 &&
257  fabs(segmentMatch->y - segmentLocalPosition.y()) < 1E-6 &&
258  fabs(segmentMatch->dXdZ - segmentLocalDirection.x() / segmentLocalDirection.z()) < 1E-6 &&
259  fabs(segmentMatch->dYdZ - segmentLocalDirection.y() / segmentLocalDirection.z()) < 1E-6 &&
260  fabs(segmentMatch->xErr - sqrt(segmentLocalPositionError.xx())) < 1E-6 &&
261  fabs(segmentMatch->yErr - sqrt(segmentLocalPositionError.yy())) < 1E-6 &&
262  fabs(segmentMatch->dXdZErr - sqrt(segmentLocalDirectionError.xx())) < 1E-6 &&
263  fabs(segmentMatch->dYdZErr - sqrt(segmentLocalDirectionError.yy())) < 1E-6) {
264  segmentFound = true;
265  break;
266  }
267  } // segmentMatch
268  if (segmentFound)
269  break;
270  } // chamberMatch
271  if (segmentFound)
272  break;
273  } // muon
274 
275  if (segmentFound)
277  else
279  } // csc segment
280 }
281 
283  if (fabs(f) > 900000)
284  return;
285  //if (fabs(f) < 1E-8) return;
286  me->Fill(f);
287 }
288 
289 //define this as a plug-in
bool useTrackerMuons_
Definition: MuonIdDQM.h:65
MonitorElement * hCSCDx[4][4]
Definition: MuonIdDQM.h:94
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
T z() const
Definition: PV3DBase.h:61
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
MonitorElement * hCSCDdYdZ[4][4]
Definition: MuonIdDQM.h:100
MuonIdDQM(const edm::ParameterSet &)
Definition: MuonIdDQM.cc:3
MonitorElement * hCSCDdXdZ[4][4]
Definition: MuonIdDQM.h:96
MonitorElement * hCSCPulldXdZ[4][4]
Definition: MuonIdDQM.h:97
~MuonIdDQM() override
Definition: MuonIdDQM.cc:17
edm::EDGetTokenT< DTRecSegment4DCollection > inputDTRecSegment4DCollection_
Definition: MuonIdDQM.h:63
bool useGlobalMuonsNotTrackerMuons_
Definition: MuonIdDQM.h:68
bool useTrackerMuonsNotGlobalMuons_
Definition: MuonIdDQM.h:67
MonitorElement * hDTDdYdZ[4][3]
Definition: MuonIdDQM.h:91
T getUntrackedParameter(std::string const &, T const &) const
void Fill(long long x)
MonitorElement * hDTPully[4][3]
Definition: MuonIdDQM.h:90
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
float yy() const
Definition: LocalError.h:24
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
MonitorElement * hCSCDy[4][4]
Definition: MuonIdDQM.h:98
int iEvent
Definition: GenABIO.cc:224
edm::Handle< DTRecSegment4DCollection > dtSegmentCollectionH_
Definition: MuonIdDQM.h:72
MonitorElement * hCSCPully[4][4]
Definition: MuonIdDQM.h:99
MonitorElement * hSegmentIsAssociatedBool
Definition: MuonIdDQM.h:104
MonitorElement * hDTPullx[4][4]
Definition: MuonIdDQM.h:86
MonitorElement * hCSCPullx[4][4]
Definition: MuonIdDQM.h:95
T sqrt(T t)
Definition: SSEVec.h:19
bool useGlobalMuons_
Definition: MuonIdDQM.h:66
double f[11][100]
MonitorElement * hNumMatches[4]
Definition: MuonIdDQM.h:80
MonitorElement * hDTDdXdZ[4][4]
Definition: MuonIdDQM.h:87
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > trackingGeomToken_
Definition: MuonIdDQM.h:76
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
edm::Handle< reco::MuonCollection > muonCollectionH_
Definition: MuonIdDQM.h:71
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: MuonIdDQM.cc:19
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: MuonIdDQM.cc:127
edm::EDGetTokenT< reco::MuonCollection > inputMuonCollection_
Definition: MuonIdDQM.h:62
MonitorElement * hDTDx[4][4]
Definition: MuonIdDQM.h:85
MonitorElement * hDTPulldYdZ[4][3]
Definition: MuonIdDQM.h:92
MonitorElement * hDTDy[4][3]
Definition: MuonIdDQM.h:89
MonitorElement * hCSCPulldYdZ[4][4]
Definition: MuonIdDQM.h:101
virtual void Fill(MonitorElement *, float)
Definition: MuonIdDQM.cc:282
MonitorElement * hDTNumSegments[4][4]
Definition: MuonIdDQM.h:84
MonitorElement * hCSCNumSegments[4][4]
Definition: MuonIdDQM.h:93
MonitorElement * hNumChambersNoRPC[4]
Definition: MuonIdDQM.h:81
edm::ESHandle< GlobalTrackingGeometry > geometry_
Definition: MuonIdDQM.h:74
fixed size matrix
HLT enums.
edm::EDGetTokenT< CSCSegmentCollection > inputCSCSegmentCollection_
Definition: MuonIdDQM.h:64
std::string baseFolder_
Definition: MuonIdDQM.h:69
static constexpr int DT
Definition: MuonSubdetId.h:11
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
static constexpr int CSC
Definition: MuonSubdetId.h:12
MonitorElement * hDTPulldXdZ[4][4]
Definition: MuonIdDQM.h:88
float xx() const
Definition: LocalError.h:22
MonitorElement * hNumChambers[4]
Definition: MuonIdDQM.h:79
Definition: Run.h:45
edm::Handle< CSCSegmentCollection > cscSegmentCollectionH_
Definition: MuonIdDQM.h:73