CMS 3D CMS Logo

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