57 #include "Math/VectorUtil.h" 71 useDefaultPropagator_ =
false;
78 cachedTrajectory_.setPropagator(ivProp_);
90 if (useDefaultPropagator_ && (!defProp_ || theMagneticFieldWatcher_.check(iSetup))) {
95 prop->setMaterialMode(
false);
96 prop->applyRadX0Correction(
true);
99 setPropagator(defProp_.get());
107 preshowerDetIdAssociator_ = &iSetup.
getData(
parameters.preshowerDetIdAssociatorToken);
126 <<
"Configuration error! No subdetector was selected for the track association.";
129 info.stateAtIP = *innerState;
130 cachedTrajectory_.setStateAtIP(trackOrigin);
142 info.setCaloGeometry(theCaloGeometry_);
144 cachedTrajectory_.reset_trajectory();
149 double HOmaxR = hoDetIdAssociator_->volume().maxR();
150 double HOmaxZ = hoDetIdAssociator_->volume().maxZ();
151 double minR = ecalDetIdAssociator_->volume().minR();
152 double minZ = preshowerDetIdAssociator_->volume().minZ();
153 cachedTrajectory_.setMaxHORadius(HOmaxR);
154 cachedTrajectory_.setMaxHOLength(HOmaxZ * 2.);
155 cachedTrajectory_.setMinDetectorRadius(
minR);
156 cachedTrajectory_.setMinDetectorLength(
minZ * 2.);
159 double maxR = muonDetIdAssociator_->volume().maxR();
160 double maxZ = muonDetIdAssociator_->volume().maxZ();
161 cachedTrajectory_.setMaxDetectorRadius(maxR);
162 cachedTrajectory_.setMaxDetectorLength(
maxZ * 2.);
164 cachedTrajectory_.setMaxDetectorRadius(HOmaxR);
165 cachedTrajectory_.setMaxDetectorLength(HOmaxZ * 2.);
171 LogTrace(
"TrackAssociator") <<
"Using outerState as trackOrigin at Rho=" << outerState->
position().
perp()
172 <<
" Z=" << outerState->
position().
z() <<
"\n";
174 }
else if (innerState) {
175 LogTrace(
"TrackAssociator") <<
"Using innerState as trackOrigin at Rho=" << innerState->
position().
perp()
176 <<
" Z=" << innerState->
position().
z() <<
"\n";
186 if (!cachedTrajectory_.propagateAll(trackOrigin))
190 cachedTrajectory_.findEcalTrajectory(ecalDetIdAssociator_->volume());
191 cachedTrajectory_.findHcalTrajectory(hcalDetIdAssociator_->volume());
192 cachedTrajectory_.findHOTrajectory(hoDetIdAssociator_->volume());
193 cachedTrajectory_.findPreshowerTrajectory(preshowerDetIdAssociator_->volume());
195 info.trkGlobPosAtEcal = getPoint(cachedTrajectory_.getStateAtEcal().position());
196 info.trkGlobPosAtHcal = getPoint(cachedTrajectory_.getStateAtHcal().position());
197 info.trkGlobPosAtHO = getPoint(cachedTrajectory_.getStateAtHO().position());
199 info.trkMomAtEcal = cachedTrajectory_.getStateAtEcal().momentum();
200 info.trkMomAtHcal = cachedTrajectory_.getStateAtHcal().momentum();
201 info.trkMomAtHO = cachedTrajectory_.getStateAtHO().momentum();
224 const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getEcalTrajectory();
226 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
227 itr != trajectoryStates.end();
229 LogTrace(
"TrackAssociator") <<
"ECAL trajectory point (rho, z, phi): " << itr->position().perp() <<
", " 230 << itr->position().z() <<
", " << itr->position().phi();
232 std::vector<GlobalPoint> coreTrajectory;
233 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
234 itr != trajectoryStates.end();
236 coreTrajectory.push_back(itr->position());
238 if (coreTrajectory.empty()) {
239 LogTrace(
"TrackAssociator") <<
"ECAL track trajectory is empty; moving on\n";
240 info.isGoodEcal =
false;
243 info.isGoodEcal =
true;
249 throw cms::Exception(
"FatalError") <<
"Unable to find EBRecHitCollection in the event!\n";
254 throw cms::Exception(
"FatalError") <<
"Unable to find EERecHitCollection in event!\n";
256 std::set<DetId> ecalIdsInRegion;
257 if (
parameters.accountForTrajectoryChangeCalo) {
261 ecalIdsInRegion = ecalDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0], mapRange);
263 ecalIdsInRegion = ecalDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0],
parameters.dREcalPreselection);
264 LogTrace(
"TrackAssociator") <<
"ECAL hits in the region: " << ecalIdsInRegion.size();
266 ecalIdsInRegion = ecalDetIdAssociator_->getDetIdsInACone(ecalIdsInRegion, coreTrajectory,
parameters.dREcal);
267 LogTrace(
"TrackAssociator") <<
"ECAL hits in the cone: " << ecalIdsInRegion.size();
268 info.crossedEcalIds = ecalDetIdAssociator_->getCrossedDetIds(ecalIdsInRegion, coreTrajectory);
269 const std::vector<DetId>& crossedEcalIds =
info.crossedEcalIds;
270 LogTrace(
"TrackAssociator") <<
"ECAL crossed hits " << crossedEcalIds.size();
273 for (std::vector<DetId>::const_iterator itr = crossedEcalIds.begin(); itr != crossedEcalIds.end(); itr++) {
274 std::vector<EcalRecHit>::const_iterator ebHit = (*EBRecHits).find(*itr);
275 std::vector<EcalRecHit>::const_iterator eeHit = (*EERecHits).find(*itr);
276 if (ebHit != (*EBRecHits).end())
277 info.crossedEcalRecHits.push_back(&*ebHit);
278 else if (eeHit != (*EERecHits).end())
279 info.crossedEcalRecHits.push_back(&*eeHit);
281 LogTrace(
"TrackAssociator") <<
"Crossed EcalRecHit is not found for DetId: " << itr->rawId();
283 for (std::set<DetId>::const_iterator itr = ecalIdsInRegion.begin(); itr != ecalIdsInRegion.end(); itr++) {
284 std::vector<EcalRecHit>::const_iterator ebHit = (*EBRecHits).find(*itr);
285 std::vector<EcalRecHit>::const_iterator eeHit = (*EERecHits).find(*itr);
286 if (ebHit != (*EBRecHits).end())
287 info.ecalRecHits.push_back(&*ebHit);
288 else if (eeHit != (*EERecHits).end())
289 info.ecalRecHits.push_back(&*eeHit);
291 LogTrace(
"TrackAssociator") <<
"EcalRecHit from the cone is not found for DetId: " << itr->rawId();
299 std::vector<GlobalPoint> trajectory;
300 const std::vector<SteppingHelixStateInfo>& ecalTrajectoryStates = cachedTrajectory_.getEcalTrajectory();
301 const std::vector<SteppingHelixStateInfo>& hcalTrajectoryStates = cachedTrajectory_.getHcalTrajectory();
302 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = ecalTrajectoryStates.begin();
303 itr != ecalTrajectoryStates.end();
305 trajectory.push_back(itr->position());
306 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = hcalTrajectoryStates.begin();
307 itr != hcalTrajectoryStates.end();
309 trajectory.push_back(itr->position());
311 if (trajectory.empty()) {
312 LogTrace(
"TrackAssociator") <<
"HCAL trajectory is empty; moving on\n";
313 info.isGoodCalo =
false;
316 info.isGoodCalo =
true;
322 throw cms::Exception(
"FatalError") <<
"Unable to find CaloTowers in event!\n";
324 std::set<DetId> caloTowerIdsInRegion;
325 if (
parameters.accountForTrajectoryChangeCalo) {
329 caloTowerIdsInRegion = caloDetIdAssociator_->getDetIdsCloseToAPoint(trajectory[0], mapRange);
331 caloTowerIdsInRegion = caloDetIdAssociator_->getDetIdsCloseToAPoint(trajectory[0],
parameters.dRHcalPreselection);
333 LogTrace(
"TrackAssociator") <<
"Towers in the region: " << caloTowerIdsInRegion.size();
335 auto caloTowerIdsInAConeBegin = caloTowerIdsInRegion.begin();
336 auto caloTowerIdsInAConeEnd = caloTowerIdsInRegion.end();
337 std::set<DetId> caloTowerIdsInAConeTmp;
338 if (!caloDetIdAssociator_->selectAllInACone(
parameters.dRHcal)) {
339 caloTowerIdsInAConeTmp =
340 caloDetIdAssociator_->getDetIdsInACone(caloTowerIdsInRegion, trajectory,
parameters.dRHcal);
341 caloTowerIdsInAConeBegin = caloTowerIdsInAConeTmp.begin();
342 caloTowerIdsInAConeEnd = caloTowerIdsInAConeTmp.end();
344 LogTrace(
"TrackAssociator") <<
"Towers in the cone: " 345 <<
std::distance(caloTowerIdsInAConeBegin, caloTowerIdsInAConeEnd);
347 info.crossedTowerIds = caloDetIdAssociator_->getCrossedDetIds(caloTowerIdsInRegion, trajectory);
348 const std::vector<DetId>& crossedCaloTowerIds =
info.crossedTowerIds;
349 LogTrace(
"TrackAssociator") <<
"Towers crossed: " << crossedCaloTowerIds.size();
352 for (std::vector<DetId>::const_iterator itr = crossedCaloTowerIds.begin(); itr != crossedCaloTowerIds.end(); itr++) {
354 if (
tower != (*caloTowers).end())
357 LogTrace(
"TrackAssociator") <<
"Crossed CaloTower is not found for DetId: " << (*itr).rawId();
360 for (std::set<DetId>::const_iterator itr = caloTowerIdsInAConeBegin; itr != caloTowerIdsInAConeEnd; itr++) {
362 if (
tower != (*caloTowers).end())
365 LogTrace(
"TrackAssociator") <<
"CaloTower from the cone is not found for DetId: " << (*itr).rawId();
372 std::vector<GlobalPoint> trajectory;
373 const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getPreshowerTrajectory();
374 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
375 itr != trajectoryStates.end();
377 trajectory.push_back(itr->position());
379 if (trajectory.empty()) {
380 LogTrace(
"TrackAssociator") <<
"Preshower trajectory is empty; moving on\n";
384 std::set<DetId> idsInRegion =
385 preshowerDetIdAssociator_->getDetIdsCloseToAPoint(trajectory[0],
parameters.dRPreshowerPreselection);
387 LogTrace(
"TrackAssociator") <<
"Number of Preshower Ids in the region: " << idsInRegion.size();
388 info.crossedPreshowerIds = preshowerDetIdAssociator_->getCrossedDetIds(idsInRegion, trajectory);
389 LogTrace(
"TrackAssociator") <<
"Number of Preshower Ids in crossed: " <<
info.crossedPreshowerIds.size();
395 const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getHcalTrajectory();
397 std::vector<GlobalPoint> coreTrajectory;
398 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
399 itr != trajectoryStates.end();
401 coreTrajectory.push_back(itr->position());
403 if (coreTrajectory.empty()) {
404 LogTrace(
"TrackAssociator") <<
"HCAL trajectory is empty; moving on\n";
405 info.isGoodHcal =
false;
408 info.isGoodHcal =
true;
414 throw cms::Exception(
"FatalError") <<
"Unable to find HBHERecHits in event!\n";
416 std::set<DetId> idsInRegion;
417 if (
parameters.accountForTrajectoryChangeCalo) {
421 idsInRegion = hcalDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0], mapRange);
423 idsInRegion = hcalDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0],
parameters.dRHcalPreselection);
425 LogTrace(
"TrackAssociator") <<
"HCAL hits in the region: " << idsInRegion.size() <<
"\n" 428 auto idsInAConeBegin = idsInRegion.begin();
429 auto idsInAConeEnd = idsInRegion.end();
430 std::set<DetId> idsInAConeTmp;
431 if (!hcalDetIdAssociator_->selectAllInACone(
parameters.dRHcal)) {
432 idsInAConeTmp = hcalDetIdAssociator_->getDetIdsInACone(idsInRegion, coreTrajectory,
parameters.dRHcal);
433 idsInAConeBegin = idsInAConeTmp.begin();
434 idsInAConeEnd = idsInAConeTmp.end();
436 LogTrace(
"TrackAssociator") <<
"HCAL hits in the cone: " <<
std::distance(idsInAConeBegin, idsInAConeEnd) <<
"\n" 437 <<
DetIdInfo::info(std::set<DetId>(idsInAConeBegin, idsInAConeEnd),
nullptr);
438 info.crossedHcalIds = hcalDetIdAssociator_->getCrossedDetIds(idsInRegion, coreTrajectory);
439 const std::vector<DetId>& crossedIds =
info.crossedHcalIds;
440 LogTrace(
"TrackAssociator") <<
"HCAL hits crossed: " << crossedIds.size() <<
"\n" 444 for (std::vector<DetId>::const_iterator itr = crossedIds.begin(); itr != crossedIds.end(); itr++) {
446 if (
hit != (*collection).end())
447 info.crossedHcalRecHits.push_back(&*
hit);
449 LogTrace(
"TrackAssociator") <<
"Crossed HBHERecHit is not found for DetId: " << itr->rawId();
451 for (std::set<DetId>::const_iterator itr = idsInAConeBegin; itr != idsInAConeEnd; itr++) {
453 if (
hit != (*collection).end())
454 info.hcalRecHits.push_back(&*
hit);
456 LogTrace(
"TrackAssociator") <<
"HBHERecHit from the cone is not found for DetId: " << itr->rawId();
463 const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getHOTrajectory();
465 std::vector<GlobalPoint> coreTrajectory;
466 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
467 itr != trajectoryStates.end();
469 coreTrajectory.push_back(itr->position());
471 if (coreTrajectory.empty()) {
472 LogTrace(
"TrackAssociator") <<
"HO trajectory is empty; moving on\n";
473 info.isGoodHO =
false;
476 info.isGoodHO =
true;
482 throw cms::Exception(
"FatalError") <<
"Unable to find HORecHits in event!\n";
484 std::set<DetId> idsInRegion;
485 if (
parameters.accountForTrajectoryChangeCalo) {
489 idsInRegion = hoDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0], mapRange);
491 idsInRegion = hoDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0],
parameters.dRHcalPreselection);
493 LogTrace(
"TrackAssociator") <<
"idsInRegion.size(): " << idsInRegion.size();
495 auto idsInAConeBegin = idsInRegion.begin();
496 auto idsInAConeEnd = idsInRegion.end();
497 std::set<DetId> idsInAConeTmp;
498 if (!hoDetIdAssociator_->selectAllInACone(
parameters.dRHcal)) {
499 idsInAConeTmp = hoDetIdAssociator_->getDetIdsInACone(idsInRegion, coreTrajectory,
parameters.dRHcal);
500 idsInAConeBegin = idsInAConeTmp.begin();
501 idsInAConeEnd = idsInAConeTmp.end();
503 LogTrace(
"TrackAssociator") <<
"idsInACone.size(): " <<
std::distance(idsInAConeBegin, idsInAConeEnd);
504 info.crossedHOIds = hoDetIdAssociator_->getCrossedDetIds(idsInRegion, coreTrajectory);
505 const std::vector<DetId>& crossedIds =
info.crossedHOIds;
508 for (std::vector<DetId>::const_iterator itr = crossedIds.begin(); itr != crossedIds.end(); itr++) {
510 if (
hit != (*collection).end())
511 info.crossedHORecHits.push_back(&*
hit);
513 LogTrace(
"TrackAssociator") <<
"Crossed HORecHit is not found for DetId: " << itr->rawId();
516 for (std::set<DetId>::const_iterator itr = idsInAConeBegin; itr != idsInAConeEnd; itr++) {
518 if (
hit != (*collection).end())
519 info.hoRecHits.push_back(&*
hit);
521 LogTrace(
"TrackAssociator") <<
"HORecHit from the cone is not found for DetId: " << itr->rawId();
545 ROOT::Math::SMatrixIdentity
id;
564 ROOT::Math::SMatrixIdentity
id;
582 if (
delta.second > 0)
586 LogTrace(
"TrackAssociator") <<
"Selection range: (dThetaPlus, dThetaMinus, dPhiPlus, dPhiMinus, dRPreselection): " 604 if (!trajectoryPoint.
isValid())
605 trajectoryPoint = cachedTrajectory_.getOuterState();
606 if (!trajectoryPoint.
isValid()) {
608 <<
"trajectory position at HCAL is not valid. Assume the track cannot reach muon detectors and skip it";
613 LogTrace(
"TrackAssociator") <<
"muon direction: " << direction
614 <<
"\n\t and corresponding point: " << trajectoryPoint.
position() <<
"\n";
621 std::set<DetId> muonIdsInRegion = muonDetIdAssociator_->getDetIdsCloseToAPoint(trajectoryPoint.
position(), mapRange);
622 LogTrace(
"TrackAssociator") <<
"Number of chambers to check: " << muonIdsInRegion.size();
623 for (std::set<DetId>::const_iterator detId = muonIdsInRegion.begin(); detId != muonIdsInRegion.end(); detId++) {
624 const GeomDet* geomDet = muonDetIdAssociator_->getGeomDet(*detId);
626 if (!stateOnSurface.
isValid()) {
627 LogTrace(
"TrackAssociator") <<
"Failed to propagate the track; moving on\n\t" 628 <<
"Element is not crosssed: " <<
DetIdInfo::info(*detId,
nullptr) <<
"\n";
633 float distanceX = 0.f;
634 float distanceY = 0.f;
635 if (
const CSCChamber* cscChamber = dynamic_cast<const CSCChamber*>(geomDet)) {
638 LogTrace(
"TrackAssociator") <<
"Failed to get CSCChamberSpecs from CSCChamber; moving on\n";
642 if (!layerGeometry) {
643 LogTrace(
"TrackAssociator") <<
"Failed to get CSCLayerGeometry from CSCChamberSpecs; moving on\n";
648 LogTrace(
"TrackAssociator") <<
"Failed to get CSCWireTopology from CSCLayerGeometry; moving on\n";
658 float yCOWPOffset = yOfFirstWire + 0.5f * length;
661 float tangent = (wideWidth - narrowWidth) / (2.
f * length);
663 float yPrime = localPoint.
y() +
std::abs(yOfFirstWire);
665 float halfWidthAtYPrime = 0.5f * narrowWidth + yPrime * tangent;
666 distanceX =
std::abs(localPoint.
x()) - halfWidthAtYPrime;
667 distanceY =
std::abs(localPoint.
y() - yCOWPOffset) - 0.5
f * length;
673 (distanceX * distanceX <
675 distanceY * distanceY <
679 match.tState = stateOnSurface;
680 match.localDistanceX = distanceX;
681 match.localDistanceY = distanceY;
686 <<
"\n\tdistanceX: " << distanceX <<
"\t distanceY: " << distanceY
687 <<
"\t sigmaX: " << distanceX /
sqrt(localError.
xx())
688 <<
"\t sigmaY: " << distanceY /
sqrt(localError.
yy()) <<
"\n";
700 throw cms::Exception(
"FatalError") <<
"Unable to find DTRecSegment4DCollection in event!\n";
705 throw cms::Exception(
"FatalError") <<
"Unable to find CSCSegmentCollection in event!\n";
725 std::vector<TAMuonChamberMatch> matchedChambers;
726 LogTrace(
"TrackAssociator") <<
"Trying to Get ChamberMatches" << std::endl;
727 getTAMuonChamberMatches(matchedChambers,
parameters);
728 LogTrace(
"TrackAssociator") <<
"Chambers matched: " << matchedChambers.size() <<
"\n";
732 for (std::vector<TAMuonChamberMatch>::iterator matchedChamber = matchedChambers.begin();
733 matchedChamber != matchedChambers.end();
735 const GeomDet* geomDet = muonDetIdAssociator_->getGeomDet((*matchedChamber).id);
742 if (addTAMuonSegmentMatch(*matchedChamber, &(*segment),
parameters)) {
743 matchedChamber->segments.back().dtSegmentRef =
DTRecSegment4DRef(dtSegments, segment - dtSegments->begin());
753 if (addTAMuonSegmentMatch(*matchedChamber, &(*segment),
parameters)) {
765 if (addTAMuonSegmentMatch(*matchedChamber, &(*segment),
parameters)) {
766 matchedChamber->segments.back().gemSegmentRef =
779 if (addTAMuonSegmentMatch(*matchedChamber, &(*segment),
parameters)) {
780 matchedChamber->segments.back().me0SegmentRef =
787 info.chambers.push_back(*matchedChamber);
797 const GeomDet*
chamber = muonDetIdAssociator_->getGeomDet(matchedChamber.
id);
801 LogTrace(
"TrackAssociator") <<
"Segment global position: " << segmentGlobalPosition
802 <<
" \t (R_xy,eta,phi): " << segmentGlobalPosition.
perp() <<
"," 803 << segmentGlobalPosition.
eta() <<
"," << segmentGlobalPosition.
phi() <<
"\n";
805 LogTrace(
"TrackAssociator") <<
"\teta hit: " << segmentGlobalPosition.
eta()
807 <<
"\tphi hit: " << segmentGlobalPosition.
phi()
812 bool isDTWithoutY =
false;
814 if (dtseg && (!dtseg->
hasZed()))
846 muonSegment.
hasZed =
true;
847 muonSegment.
hasPhi =
true;
850 muonSegment.
t0 = 0.f;
852 if ((dtseg->
hasPhi()) && (!isDTWithoutY)) {
861 LogTrace(
"TrackAssociator") <<
" Phi t0: " << dtseg->
phiSegment()->
t0() <<
" hits: " << phiHits;
875 muonSegment.
hasZed =
false;
877 muonSegment.
hasPhi =
false;
880 matchedChamber.
segments.push_back(muonSegment);
896 throw cms::Exception(
"FatalError") <<
"No simulated tracks found\n";
901 throw cms::Exception(
"FatalError") <<
"No simulated vertices found\n";
907 throw cms::Exception(
"FatalError") <<
"No simulated ECAL EB hits found\n";
912 throw cms::Exception(
"FatalError") <<
"No simulated ECAL EE hits found\n";
917 throw cms::Exception(
"FatalError") <<
"No simulated HCAL hits found\n";
928 info.simTrack = &(*simTrack);
929 float ecalTrueEnergy(0);
930 float hcalTrueEnergy(0);
933 for (PCaloHitContainer::const_iterator
hit = simEcalHitsEB->begin();
hit != simEcalHitsEB->end(); ++
hit)
934 if (
hit->geantTrackId() ==
info.simTrack->genpartIndex())
935 ecalTrueEnergy +=
hit->energy();
937 for (PCaloHitContainer::const_iterator
hit = simEcalHitsEE->begin();
hit != simEcalHitsEE->end(); ++
hit)
938 if (
hit->geantTrackId() ==
info.simTrack->genpartIndex())
939 ecalTrueEnergy +=
hit->energy();
941 for (PCaloHitContainer::const_iterator
hit = simHcalHits->begin();
hit != simHcalHits->end(); ++
hit)
942 if (
hit->geantTrackId() ==
info.simTrack->genpartIndex())
943 hcalTrueEnergy +=
hit->energy();
945 info.ecalTrueEnergy = ecalTrueEnergy;
946 info.hcalTrueEnergy = hcalTrueEnergy;
947 info.hcalTrueEnergyCorrected = hcalTrueEnergy;
949 info.hcalTrueEnergyCorrected = hcalTrueEnergy * 113.2f;
951 info.hcalTrueEnergyCorrected = hcalTrueEnergy * 167.2f;
960 double currentStepSize = cachedTrajectory_.getPropagationStep();
964 if (
track.extra().isNull()) {
965 if (direction != InsideOut)
966 throw cms::Exception(
"FatalError") <<
"No TrackExtra information is available and association is done with " 967 "something else than InsideOut track.\n" 968 <<
"Either change the parameter or provide needed data!\n";
969 LogTrace(
"TrackAssociator") <<
"Track Extras not found\n";
974 LogTrace(
"TrackAssociator") <<
"Track Extras found\n";
979 LogTrace(
"TrackAssociator") <<
"inner track state (rho, z, phi):" <<
track.innerPosition().Rho() <<
", " 980 <<
track.innerPosition().z() <<
", " <<
track.innerPosition().phi() <<
"\n";
981 LogTrace(
"TrackAssociator") <<
"innerFreeState (rho, z, phi):" << innerState.
position().
perp() <<
", " 984 LogTrace(
"TrackAssociator") <<
"outer track state (rho, z, phi):" <<
track.outerPosition().Rho() <<
", " 985 <<
track.outerPosition().z() <<
", " <<
track.outerPosition().phi() <<
"\n";
986 LogTrace(
"TrackAssociator") <<
"outerFreeState (rho, z, phi):" << outerState.
position().
perp() <<
", " 990 if (crossedIP(
track)) {
997 cachedTrajectory_.setPropagationStep(-
std::abs(currentStepSize));
999 cachedTrajectory_.setPropagationStep(currentStepSize);
1005 switch (direction) {
1010 cachedTrajectory_.setPropagationStep(-
std::abs(currentStepSize));
1012 cachedTrajectory_.setPropagationStep(currentStepSize);
1018 if (
track.innerPosition().Dot(
track.innerMomentum()) < 0 &&
1019 track.outerPosition().Dot(
track.outerMomentum()) < 0) {
1020 cachedTrajectory_.setPropagationStep(-
std::abs(currentStepSize));
1022 if (
track.innerPosition().Mag2() <
track.outerPosition().Mag2())
1026 cachedTrajectory_.setPropagationStep(currentStepSize);
1057 bool crossed =
true;
1058 crossed &= (
track.innerPosition().rho() > 3);
1059 crossed &= (
track.outerPosition().rho() > 3);
1061 ((
track.innerPosition().x() *
track.innerMomentum().x() +
track.innerPosition().y() *
track.innerMomentum().y() <
1063 (
track.outerPosition().x() *
track.outerMomentum().x() +
track.outerPosition().y() *
track.outerMomentum().y() <
constexpr double deltaPhi(double phi1, double phi2)
std::pair< const_iterator, const_iterator > range
iterator range
TrackDetectorAssociator()
float segmentLocalErrorXX
virtual float length() const =0
static bool crossedIP(const reco::Track &track)
double wideWidthOfPlane() const
const LocalTrajectoryError & localError() const
virtual LocalError localDirectionError() const =0
Error on the local direction.
TrajectoryStateOnSurface tState
bool hasPhi() const
Does it have the Phi projection?
float segmentLocalErrorXY
const CSCWireTopology * wireTopology() const
double t0() const
Get the segment t0 (if recomputed, 0 is returned otherwise)
math::XYZPoint segmentGlobalPosition
constexpr bool isNotFinite(T x)
float segmentLocalErrorYDyDz
edm::Ref< CSCSegmentCollection > CSCSegmentRef
Geom::Phi< T > phi() const
edm::Ref< ME0SegmentCollection > ME0SegmentRef
math::XYZPoint segmentLocalPosition
virtual LocalVector localDirection() const =0
Local direction.
void useDefaultPropagator()
use the default propagator
std::vector< CaloTower >::const_iterator const_iterator
void fillHcal(const edm::Event &, TrackDetMatchInfo &, const AssociatorParameters &)
bool addTAMuonSegmentMatch(TAMuonChamberMatch &, const RecSegment *, const AssociatorParameters &)
LocalError positionError() const
LocalPoint toLocal(const GlobalPoint &gp) const
math::XYZVector segmentLocalDirection
float segmentLocalErrorDxDz
static const double deltaEta
GlobalPoint position() const
void fillCaloTowers(const edm::Event &, TrackDetMatchInfo &, const AssociatorParameters &)
GlobalPoint position() const
void fillCaloTruth(const edm::Event &, TrackDetMatchInfo &, const AssociatorParameters &)
C::const_iterator const_iterator
constant access iterator type
void init(const edm::EventSetup &, const AssociatorParameters &)
float wireAngle() const override
float segmentLocalErrorDyDz
void setPropagator(const Propagator *)
use a user configured propagator
void getTAMuonChamberMatches(std::vector< TAMuonChamberMatch > &matches, const AssociatorParameters ¶meters)
edm::Ref< GEMSegmentCollection > GEMSegmentRef
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
std::vector< TAMuonSegmentMatch > segments
distance sign convention: negative - crossed chamber, positive - missed chamber
Abs< T >::type abs(const T &t)
bool getData(T &iHolder) const
void fillPreshower(const edm::Event &iEvent, TrackDetMatchInfo &info, const AssociatorParameters &)
float segmentLocalErrorYY
edm::Ref< DTRecSegment4DCollection > DTRecSegment4DRef
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
float yOfWire(float wire, float x=0.) const
const Plane & surface() const
The nominal surface of the GeomDet.
DetId geographicalId() const
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
const CSCLayerGeometry * oddLayerGeometry(int iendcap) const
Accessors for LayerGeometry's.
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
static std::string info(const DetId &, const TrackerTopology *tTopo)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
virtual LocalError localPositionError() const =0
~TrackDetectorAssociator()
constexpr uint32_t rawId() const
get the raw id
void fillMuon(const edm::Event &, TrackDetMatchInfo &, const AssociatorParameters &)
double lengthOfPlane() const
static FreeTrajectoryState getFreeTrajectoryState(const MagneticField *, const reco::Track &)
get FreeTrajectoryState from different track representations
DetIdAssociator::MapRange getMapRange(const std::pair< float, float > &delta, const float dR)
double narrowWidthOfPlane() const
GlobalVector momentum() const
float segmentLocalErrorXDxDz
void fillEcal(const edm::Event &, TrackDetMatchInfo &, const AssociatorParameters &)
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
FreeTrajectoryState const * freeState(bool withErrors=true) const
Vector3DBase unit() const
bool hasZed() const
Does it have the Z projection?
virtual LocalPoint localPosition() const =0
virtual float width() const =0
void fillHO(const edm::Event &, TrackDetMatchInfo &, const AssociatorParameters &)
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
const Bounds & bounds() const