26 LogTrace(
"MuonIdentification") <<
"No tracks found";
34 throw cms::Exception(
"FatalError") <<
"Unable to find GlobalTrackingGeometryRecord in event!\n";
36 float bestMatchChi2 = 9999;
38 const unsigned int offset = 0;
40 for (edm::SimTrackContainer::const_iterator simTrk =
simTracks->begin(); simTrk !=
simTracks->end(); simTrk++) {
42 if (
chi2 > bestMatchChi2)
51 int numberOfTruthMatchedChambers = 0;
54 for (std::vector<reco::MuonChamberMatch>::iterator chamberMatch =
matches.begin(); chamberMatch !=
matches.end();
57 edm::LogWarning(
"MuonIdentification") <<
"Detector id of a muon chamber corresponds to not a muon detector";
73 LogTrace(
"MuonIdentification") <<
"No DT simulated hits are found";
77 CSCDetId detId(chamberMatch->id.rawId());
86 LogTrace(
"MuonIdentification") <<
"No CSC simulated hits are found";
89 chamberMatch->truthMatches.push_back(bestSegmentMatch);
90 numberOfTruthMatchedChambers++;
91 LogTrace(
"MuonIdentification") <<
"Best truth matched hit:"
92 <<
"\tDetId: " << chamberMatch->id.rawId() <<
"\n"
93 <<
"\tprojection: ( " << bestSegmentMatch.
x <<
", " << bestSegmentMatch.
y
97 LogTrace(
"MuonIdentification") <<
"Truth matching summary:\n\tnumber of chambers: " <<
matches.size()
98 <<
"\n\tnumber of truth matched chambers: " << numberOfTruthMatchedChambers <<
"\n";
104 const DetId& chamberId,
106 printf(
"DONT FORGET TO CALL REGISTERCONSUMES()\n");
116 if (chamberGeometry && simUnitGeometry) {
120 if (fabs(direction.
z()) > 0.001) {
121 LocalPoint projection = entryPoint - direction * (entryPoint.z() / direction.
z());
122 if (fabs(projection.
z()) > 0.001)
123 edm::LogWarning(
"MuonIdentification") <<
"z coordinate of the hit projection must be zero and it's not!\n";
125 double new_distance = 99999;
126 if (entryPoint.z() * exitPoint.
z() < -1)
129 if (fabs(entryPoint.z()) < fabs(exitPoint.
z()))
130 new_distance = fabs(entryPoint.z());
132 new_distance = fabs(exitPoint.
z());
137 segmentMatch.
x = projection.
x();
138 segmentMatch.
y = projection.
y();
139 segmentMatch.
xErr = 0;
140 segmentMatch.
yErr = 0;
141 segmentMatch.
dXdZ = direction.
x() / direction.
z();
142 segmentMatch.
dYdZ = direction.
y() / direction.
z();
146 LogTrace(
"MuonIdentificationVerbose")
147 <<
"Better truth matched segment found:\n"
148 <<
"\tDetId: " << chamberId.
rawId() <<
"\n"
149 <<
"\tentry point: ( " << entryPoint.x() <<
", " << entryPoint.y() <<
", " << entryPoint.z() <<
" )\n"
150 <<
"\texit point: ( " << exitPoint.
x() <<
", " << exitPoint.
y() <<
", " << exitPoint.
z() <<
" )\n"
151 <<
"\tprojection: ( " << projection.
x() <<
", " << projection.
y() <<
", " << projection.
z() <<
" )\n";
155 if (!chamberGeometry)
156 edm::LogWarning(
"MuonIdentification") <<
"Cannot get chamber geomtry for DetId: " << chamberId.
rawId();
157 if (!simUnitGeometry)
158 edm::LogWarning(
"MuonIdentification") <<
"Cannot get detector unit geomtry for DetId: " <<
hit.detUnitId();