28 LogTrace(
"MuonIdentification") <<
"No tracks found";
32 float bestMatchChi2 = 9999;
34 const unsigned int offset = 0;
36 for (edm::SimTrackContainer::const_iterator simTrk =
simTracks->begin(); simTrk !=
simTracks->end(); simTrk++) {
38 if (
chi2 > bestMatchChi2)
47 int numberOfTruthMatchedChambers = 0;
50 for (std::vector<reco::MuonChamberMatch>::iterator chamberMatch =
matches.begin(); chamberMatch !=
matches.end();
53 edm::LogWarning(
"MuonIdentification") <<
"Detector id of a muon chamber corresponds to not a muon detector";
69 LogTrace(
"MuonIdentification") <<
"No DT simulated hits are found";
73 CSCDetId detId(chamberMatch->id.rawId());
82 LogTrace(
"MuonIdentification") <<
"No CSC simulated hits are found";
85 chamberMatch->truthMatches.push_back(bestSegmentMatch);
86 numberOfTruthMatchedChambers++;
87 LogTrace(
"MuonIdentification") <<
"Best truth matched hit:" 88 <<
"\tDetId: " << chamberMatch->id.rawId() <<
"\n" 89 <<
"\tprojection: ( " << bestSegmentMatch.
x <<
", " << bestSegmentMatch.
y 93 LogTrace(
"MuonIdentification") <<
"Truth matching summary:\n\tnumber of chambers: " <<
matches.size()
94 <<
"\n\tnumber of truth matched chambers: " << numberOfTruthMatchedChambers <<
"\n";
100 const DetId& chamberId,
102 printf(
"DONT FORGET TO CALL REGISTERCONSUMES()\n");
112 if (chamberGeometry && simUnitGeometry) {
116 if (fabs(direction.
z()) > 0.001) {
118 if (fabs(projection.
z()) > 0.001)
119 edm::LogWarning(
"MuonIdentification") <<
"z coordinate of the hit projection must be zero and it's not!\n";
121 double new_distance = 99999;
128 new_distance = fabs(exitPoint.
z());
133 segmentMatch.
x = projection.
x();
134 segmentMatch.
y = projection.
y();
135 segmentMatch.
xErr = 0;
136 segmentMatch.
yErr = 0;
137 segmentMatch.
dXdZ = direction.
x() / direction.
z();
138 segmentMatch.
dYdZ = direction.
y() / direction.
z();
142 LogTrace(
"MuonIdentificationVerbose")
143 <<
"Better truth matched segment found:\n" 144 <<
"\tDetId: " << chamberId.
rawId() <<
"\n" 146 <<
"\texit point: ( " << exitPoint.
x() <<
", " << exitPoint.
y() <<
", " << exitPoint.
z() <<
" )\n" 147 <<
"\tprojection: ( " << projection.
x() <<
", " << projection.
y() <<
", " << projection.
z() <<
" )\n";
151 if (!chamberGeometry)
152 edm::LogWarning(
"MuonIdentification") <<
"Cannot get chamber geomtry for DetId: " << chamberId.
rawId();
153 if (!simUnitGeometry)
154 edm::LogWarning(
"MuonIdentification") <<
"Cannot get detector unit geomtry for DetId: " <<
hit.detUnitId();
void entryPoint(InputDataCPU const &, InputDataGPU &, OutputDataGPU &, ScratchDataGPU &, OutputDataCPU &, ConditionsProducts const &, cudaStream_t, uint32_t const, uint32_t const)
static void truthMatchMuon(const edm::Event &iEvent, const GlobalTrackingGeometry &iGeometry, reco::Muon &aMuon)
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
static void checkSimHitForBestMatch(reco::MuonSegmentMatch &segmentMatch, double &distance, const PSimHit &hit, const DetId &chamberId, const GlobalTrackingGeometry &geometry)
double p() const
momentum vector magnitude
TrackRef track() const override
reference to a Track
const math::XYZTLorentzVectorD & momentum() const
double phi() const
azimuthal angle of momentum vector
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
constexpr uint32_t rawId() const
get the raw id
def bestMatch(object, matchCollection)
void registerConsumes(edm::ConsumesCollector &iC)
std::vector< MuonChamberMatch > & matches()
get muon matching information
double theta() const
polar angle
T const * get() const
Returns C++ pointer to the item.
std::vector< PSimHit > PSimHitContainer
Log< level::Warning, false > LogWarning
std::vector< SimTrack > SimTrackContainer
Power< A, B >::type pow(const A &a, const B &b)
static double matchChi2(const reco::Track &recoTrk, const SimTrack &simTrk)