61 #include "Math/VectorUtil.h" 75 useDefaultPropagator_ =
false;
82 cachedTrajectory_.setPropagator(ivProp_);
94 if (useDefaultPropagator_ && (!defProp_ || theMagneticFieldWatcher_.check(iSetup))) {
99 prop->setMaterialMode(
false);
100 prop->applyRadX0Correction(
true);
103 setPropagator(defProp_.get());
111 preshowerDetIdAssociator_ = &iSetup.
getData(
parameters.preshowerDetIdAssociatorToken);
130 <<
"Configuration error! No subdetector was selected for the track association.";
133 info.stateAtIP = *innerState;
134 cachedTrajectory_.setStateAtIP(trackOrigin);
146 info.setCaloGeometry(theCaloGeometry_);
148 cachedTrajectory_.reset_trajectory();
153 double HOmaxR = hoDetIdAssociator_->volume().maxR();
154 double HOmaxZ = hoDetIdAssociator_->volume().maxZ();
155 double minR = ecalDetIdAssociator_->volume().minR();
156 double minZ = preshowerDetIdAssociator_->volume().minZ();
157 cachedTrajectory_.setMaxHORadius(HOmaxR);
158 cachedTrajectory_.setMaxHOLength(HOmaxZ * 2.);
159 cachedTrajectory_.setMinDetectorRadius(minR);
160 cachedTrajectory_.setMinDetectorLength(
minZ * 2.);
163 double maxR = muonDetIdAssociator_->volume().maxR();
164 double maxZ = muonDetIdAssociator_->volume().maxZ();
165 cachedTrajectory_.setMaxDetectorRadius(maxR);
166 cachedTrajectory_.setMaxDetectorLength(
maxZ * 2.);
168 cachedTrajectory_.setMaxDetectorRadius(HOmaxR);
169 cachedTrajectory_.setMaxDetectorLength(HOmaxZ * 2.);
175 LogTrace(
"TrackAssociator") <<
"Using outerState as trackOrigin at Rho=" << outerState->
position().
perp()
176 <<
" Z=" << outerState->
position().
z() <<
"\n";
178 }
else if (innerState) {
179 LogTrace(
"TrackAssociator") <<
"Using innerState as trackOrigin at Rho=" << innerState->
position().
perp()
180 <<
" Z=" << innerState->
position().
z() <<
"\n";
190 if (!cachedTrajectory_.propagateAll(trackOrigin))
194 cachedTrajectory_.findEcalTrajectory(ecalDetIdAssociator_->volume());
195 cachedTrajectory_.findHcalTrajectory(hcalDetIdAssociator_->volume());
196 cachedTrajectory_.findHOTrajectory(hoDetIdAssociator_->volume());
197 cachedTrajectory_.findPreshowerTrajectory(preshowerDetIdAssociator_->volume());
199 info.trkGlobPosAtEcal = getPoint(cachedTrajectory_.getStateAtEcal().position());
200 info.trkGlobPosAtHcal = getPoint(cachedTrajectory_.getStateAtHcal().position());
201 info.trkGlobPosAtHO = getPoint(cachedTrajectory_.getStateAtHO().position());
203 info.trkMomAtEcal = cachedTrajectory_.getStateAtEcal().momentum();
204 info.trkMomAtHcal = cachedTrajectory_.getStateAtHcal().momentum();
205 info.trkMomAtHO = cachedTrajectory_.getStateAtHO().momentum();
228 const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getEcalTrajectory();
230 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
231 itr != trajectoryStates.end();
233 LogTrace(
"TrackAssociator") <<
"ECAL trajectory point (rho, z, phi): " << itr->position().perp() <<
", " 234 << itr->position().z() <<
", " << itr->position().phi();
236 std::vector<GlobalPoint> coreTrajectory;
237 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
238 itr != trajectoryStates.end();
240 coreTrajectory.push_back(itr->position());
242 if (coreTrajectory.empty()) {
243 LogTrace(
"TrackAssociator") <<
"ECAL track trajectory is empty; moving on\n";
244 info.isGoodEcal =
false;
247 info.isGoodEcal =
true;
253 throw cms::Exception(
"FatalError") <<
"Unable to find EBRecHitCollection in the event!\n";
258 throw cms::Exception(
"FatalError") <<
"Unable to find EERecHitCollection in event!\n";
260 std::set<DetId> ecalIdsInRegion;
261 if (
parameters.accountForTrajectoryChangeCalo) {
265 ecalIdsInRegion = ecalDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0], mapRange);
267 ecalIdsInRegion = ecalDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0],
parameters.dREcalPreselection);
268 LogTrace(
"TrackAssociator") <<
"ECAL hits in the region: " << ecalIdsInRegion.size();
270 ecalIdsInRegion = ecalDetIdAssociator_->getDetIdsInACone(ecalIdsInRegion, coreTrajectory,
parameters.dREcal);
271 LogTrace(
"TrackAssociator") <<
"ECAL hits in the cone: " << ecalIdsInRegion.size();
272 info.crossedEcalIds = ecalDetIdAssociator_->getCrossedDetIds(ecalIdsInRegion, coreTrajectory);
273 const std::vector<DetId>& crossedEcalIds =
info.crossedEcalIds;
274 LogTrace(
"TrackAssociator") <<
"ECAL crossed hits " << crossedEcalIds.size();
277 for (std::vector<DetId>::const_iterator itr = crossedEcalIds.begin(); itr != crossedEcalIds.end(); itr++) {
278 std::vector<EcalRecHit>::const_iterator ebHit = (*EBRecHits).find(*itr);
279 std::vector<EcalRecHit>::const_iterator eeHit = (*EERecHits).find(*itr);
280 if (ebHit != (*EBRecHits).end())
281 info.crossedEcalRecHits.push_back(&*ebHit);
282 else if (eeHit != (*EERecHits).end())
283 info.crossedEcalRecHits.push_back(&*eeHit);
285 LogTrace(
"TrackAssociator") <<
"Crossed EcalRecHit is not found for DetId: " << itr->rawId();
287 for (std::set<DetId>::const_iterator itr = ecalIdsInRegion.begin(); itr != ecalIdsInRegion.end(); itr++) {
288 std::vector<EcalRecHit>::const_iterator ebHit = (*EBRecHits).find(*itr);
289 std::vector<EcalRecHit>::const_iterator eeHit = (*EERecHits).find(*itr);
290 if (ebHit != (*EBRecHits).end())
291 info.ecalRecHits.push_back(&*ebHit);
292 else if (eeHit != (*EERecHits).end())
293 info.ecalRecHits.push_back(&*eeHit);
295 LogTrace(
"TrackAssociator") <<
"EcalRecHit from the cone is not found for DetId: " << itr->rawId();
303 std::vector<GlobalPoint> trajectory;
304 const std::vector<SteppingHelixStateInfo>& ecalTrajectoryStates = cachedTrajectory_.getEcalTrajectory();
305 const std::vector<SteppingHelixStateInfo>& hcalTrajectoryStates = cachedTrajectory_.getHcalTrajectory();
306 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = ecalTrajectoryStates.begin();
307 itr != ecalTrajectoryStates.end();
309 trajectory.push_back(itr->position());
310 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = hcalTrajectoryStates.begin();
311 itr != hcalTrajectoryStates.end();
313 trajectory.push_back(itr->position());
315 if (trajectory.empty()) {
316 LogTrace(
"TrackAssociator") <<
"HCAL trajectory is empty; moving on\n";
317 info.isGoodCalo =
false;
320 info.isGoodCalo =
true;
326 throw cms::Exception(
"FatalError") <<
"Unable to find CaloTowers in event!\n";
328 std::set<DetId> caloTowerIdsInRegion;
329 if (
parameters.accountForTrajectoryChangeCalo) {
333 caloTowerIdsInRegion = caloDetIdAssociator_->getDetIdsCloseToAPoint(trajectory[0], mapRange);
335 caloTowerIdsInRegion = caloDetIdAssociator_->getDetIdsCloseToAPoint(trajectory[0],
parameters.dRHcalPreselection);
337 LogTrace(
"TrackAssociator") <<
"Towers in the region: " << caloTowerIdsInRegion.size();
339 auto caloTowerIdsInAConeBegin = caloTowerIdsInRegion.begin();
340 auto caloTowerIdsInAConeEnd = caloTowerIdsInRegion.end();
341 std::set<DetId> caloTowerIdsInAConeTmp;
342 if (!caloDetIdAssociator_->selectAllInACone(
parameters.dRHcal)) {
343 caloTowerIdsInAConeTmp =
344 caloDetIdAssociator_->getDetIdsInACone(caloTowerIdsInRegion, trajectory,
parameters.dRHcal);
345 caloTowerIdsInAConeBegin = caloTowerIdsInAConeTmp.begin();
346 caloTowerIdsInAConeEnd = caloTowerIdsInAConeTmp.end();
348 LogTrace(
"TrackAssociator") <<
"Towers in the cone: " 349 <<
std::distance(caloTowerIdsInAConeBegin, caloTowerIdsInAConeEnd);
351 info.crossedTowerIds = caloDetIdAssociator_->getCrossedDetIds(caloTowerIdsInRegion, trajectory);
352 const std::vector<DetId>& crossedCaloTowerIds =
info.crossedTowerIds;
353 LogTrace(
"TrackAssociator") <<
"Towers crossed: " << crossedCaloTowerIds.size();
356 for (std::vector<DetId>::const_iterator itr = crossedCaloTowerIds.begin(); itr != crossedCaloTowerIds.end(); itr++) {
358 if (
tower != (*caloTowers).end())
361 LogTrace(
"TrackAssociator") <<
"Crossed CaloTower is not found for DetId: " << (*itr).rawId();
364 for (std::set<DetId>::const_iterator itr = caloTowerIdsInAConeBegin; itr != caloTowerIdsInAConeEnd; itr++) {
366 if (
tower != (*caloTowers).end())
369 LogTrace(
"TrackAssociator") <<
"CaloTower from the cone is not found for DetId: " << (*itr).rawId();
376 std::vector<GlobalPoint> trajectory;
377 const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getPreshowerTrajectory();
378 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
379 itr != trajectoryStates.end();
381 trajectory.push_back(itr->position());
383 if (trajectory.empty()) {
384 LogTrace(
"TrackAssociator") <<
"Preshower trajectory is empty; moving on\n";
388 std::set<DetId> idsInRegion =
389 preshowerDetIdAssociator_->getDetIdsCloseToAPoint(trajectory[0],
parameters.dRPreshowerPreselection);
391 LogTrace(
"TrackAssociator") <<
"Number of Preshower Ids in the region: " << idsInRegion.size();
392 info.crossedPreshowerIds = preshowerDetIdAssociator_->getCrossedDetIds(idsInRegion, trajectory);
393 LogTrace(
"TrackAssociator") <<
"Number of Preshower Ids in crossed: " <<
info.crossedPreshowerIds.size();
399 const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getHcalTrajectory();
401 std::vector<GlobalPoint> coreTrajectory;
402 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
403 itr != trajectoryStates.end();
405 coreTrajectory.push_back(itr->position());
407 if (coreTrajectory.empty()) {
408 LogTrace(
"TrackAssociator") <<
"HCAL trajectory is empty; moving on\n";
409 info.isGoodHcal =
false;
412 info.isGoodHcal =
true;
418 throw cms::Exception(
"FatalError") <<
"Unable to find HBHERecHits in event!\n";
420 std::set<DetId> idsInRegion;
421 if (
parameters.accountForTrajectoryChangeCalo) {
425 idsInRegion = hcalDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0], mapRange);
427 idsInRegion = hcalDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0],
parameters.dRHcalPreselection);
429 LogTrace(
"TrackAssociator") <<
"HCAL hits in the region: " << idsInRegion.size() <<
"\n" 432 auto idsInAConeBegin = idsInRegion.begin();
433 auto idsInAConeEnd = idsInRegion.end();
434 std::set<DetId> idsInAConeTmp;
435 if (!hcalDetIdAssociator_->selectAllInACone(
parameters.dRHcal)) {
436 idsInAConeTmp = hcalDetIdAssociator_->getDetIdsInACone(idsInRegion, coreTrajectory,
parameters.dRHcal);
437 idsInAConeBegin = idsInAConeTmp.begin();
438 idsInAConeEnd = idsInAConeTmp.end();
440 LogTrace(
"TrackAssociator") <<
"HCAL hits in the cone: " <<
std::distance(idsInAConeBegin, idsInAConeEnd) <<
"\n" 441 <<
DetIdInfo::info(std::set<DetId>(idsInAConeBegin, idsInAConeEnd),
nullptr);
442 info.crossedHcalIds = hcalDetIdAssociator_->getCrossedDetIds(idsInRegion, coreTrajectory);
443 const std::vector<DetId>& crossedIds =
info.crossedHcalIds;
444 LogTrace(
"TrackAssociator") <<
"HCAL hits crossed: " << crossedIds.size() <<
"\n" 448 for (std::vector<DetId>::const_iterator itr = crossedIds.begin(); itr != crossedIds.end(); itr++) {
450 if (
hit != (*collection).end())
451 info.crossedHcalRecHits.push_back(&*
hit);
453 LogTrace(
"TrackAssociator") <<
"Crossed HBHERecHit is not found for DetId: " << itr->rawId();
455 for (std::set<DetId>::const_iterator itr = idsInAConeBegin; itr != idsInAConeEnd; itr++) {
457 if (
hit != (*collection).end())
458 info.hcalRecHits.push_back(&*
hit);
460 LogTrace(
"TrackAssociator") <<
"HBHERecHit from the cone is not found for DetId: " << itr->rawId();
467 const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getHOTrajectory();
469 std::vector<GlobalPoint> coreTrajectory;
470 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
471 itr != trajectoryStates.end();
473 coreTrajectory.push_back(itr->position());
475 if (coreTrajectory.empty()) {
476 LogTrace(
"TrackAssociator") <<
"HO trajectory is empty; moving on\n";
477 info.isGoodHO =
false;
480 info.isGoodHO =
true;
486 throw cms::Exception(
"FatalError") <<
"Unable to find HORecHits in event!\n";
488 std::set<DetId> idsInRegion;
489 if (
parameters.accountForTrajectoryChangeCalo) {
493 idsInRegion = hoDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0], mapRange);
495 idsInRegion = hoDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0],
parameters.dRHcalPreselection);
497 LogTrace(
"TrackAssociator") <<
"idsInRegion.size(): " << idsInRegion.size();
499 auto idsInAConeBegin = idsInRegion.begin();
500 auto idsInAConeEnd = idsInRegion.end();
501 std::set<DetId> idsInAConeTmp;
502 if (!hoDetIdAssociator_->selectAllInACone(
parameters.dRHcal)) {
503 idsInAConeTmp = hoDetIdAssociator_->getDetIdsInACone(idsInRegion, coreTrajectory,
parameters.dRHcal);
504 idsInAConeBegin = idsInAConeTmp.begin();
505 idsInAConeEnd = idsInAConeTmp.end();
507 LogTrace(
"TrackAssociator") <<
"idsInACone.size(): " <<
std::distance(idsInAConeBegin, idsInAConeEnd);
508 info.crossedHOIds = hoDetIdAssociator_->getCrossedDetIds(idsInRegion, coreTrajectory);
509 const std::vector<DetId>& crossedIds =
info.crossedHOIds;
512 for (std::vector<DetId>::const_iterator itr = crossedIds.begin(); itr != crossedIds.end(); itr++) {
514 if (
hit != (*collection).end())
515 info.crossedHORecHits.push_back(&*
hit);
517 LogTrace(
"TrackAssociator") <<
"Crossed HORecHit is not found for DetId: " << itr->rawId();
520 for (std::set<DetId>::const_iterator itr = idsInAConeBegin; itr != idsInAConeEnd; itr++) {
522 if (
hit != (*collection).end())
523 info.hoRecHits.push_back(&*
hit);
525 LogTrace(
"TrackAssociator") <<
"HORecHit from the cone is not found for DetId: " << itr->rawId();
549 ROOT::Math::SMatrixIdentity
id;
568 ROOT::Math::SMatrixIdentity
id;
586 if (
delta.second > 0)
590 LogTrace(
"TrackAssociator") <<
"Selection range: (dThetaPlus, dThetaMinus, dPhiPlus, dPhiMinus, dRPreselection): " 598 std::set<DetId> occupancy) {
609 if (!trajectoryPoint.
isValid())
610 trajectoryPoint = cachedTrajectory_.getOuterState();
611 if (!trajectoryPoint.
isValid()) {
613 <<
"trajectory position at HCAL is not valid. Assume the track cannot reach muon detectors and skip it";
618 LogTrace(
"TrackAssociator") <<
"muon direction: " << direction
619 <<
"\n\t and corresponding point: " << trajectoryPoint.
position() <<
"\n";
626 std::set<DetId> muonIdsInRegion = muonDetIdAssociator_->getDetIdsCloseToAPoint(trajectoryPoint.
position(), mapRange);
627 LogTrace(
"TrackAssociator") <<
"Number of chambers to check: " << muonIdsInRegion.size();
630 std::set<DetId> muonIdsInRegionOccupied;
632 muonIdsInRegion.end(),
635 std::inserter(muonIdsInRegionOccupied, muonIdsInRegionOccupied.begin()));
636 if (muonIdsInRegionOccupied.empty())
640 for (std::set<DetId>::const_iterator
detId = muonIdsInRegion.begin();
detId != muonIdsInRegion.end();
detId++) {
641 const GeomDet* geomDet = muonDetIdAssociator_->getGeomDet(*
detId);
643 if (!stateOnSurface.
isValid()) {
644 LogTrace(
"TrackAssociator") <<
"Failed to propagate the track; moving on\n\t" 650 float distanceX = 0.f;
651 float distanceY = 0.f;
652 if (
const CSCChamber* cscChamber = dynamic_cast<const CSCChamber*>(geomDet)) {
655 LogTrace(
"TrackAssociator") <<
"Failed to get CSCChamberSpecs from CSCChamber; moving on\n";
659 if (!layerGeometry) {
660 LogTrace(
"TrackAssociator") <<
"Failed to get CSCLayerGeometry from CSCChamberSpecs; moving on\n";
665 LogTrace(
"TrackAssociator") <<
"Failed to get CSCWireTopology from CSCLayerGeometry; moving on\n";
675 float yCOWPOffset = yOfFirstWire + 0.5f * length;
678 float tangent = (wideWidth - narrowWidth) / (2.
f * length);
680 float yPrime = localPoint.
y() +
std::abs(yOfFirstWire);
682 float halfWidthAtYPrime = 0.5f * narrowWidth + yPrime * tangent;
683 distanceX =
std::abs(localPoint.
x()) - halfWidthAtYPrime;
684 distanceY =
std::abs(localPoint.
y() - yCOWPOffset) - 0.5
f * length;
685 }
else if (dynamic_cast<const GEMChamber*>(geomDet) ||
dynamic_cast<const GEMSuperChamber*
>(geomDet)) {
689 float narrowWidth = 2.f *
bounds->widthAtHalfLength() - wideWidth;
690 float length =
bounds->length();
691 float tangent = (wideWidth - narrowWidth) / (2.
f * length);
692 float halfWidthAtY = tangent * localPoint.
y() + 0.25f * (narrowWidth + wideWidth);
694 distanceX =
std::abs(localPoint.
x()) - halfWidthAtY;
695 distanceY =
std::abs(localPoint.
y()) - 0.5
f * length;
701 (distanceX * distanceX <
703 distanceY * distanceY <
707 match.tState = stateOnSurface;
708 match.localDistanceX = distanceX;
709 match.localDistanceY = distanceY;
714 <<
"\n\tdistanceX: " << distanceX <<
"\t distanceY: " << distanceY
715 <<
"\t sigmaX: " << distanceX /
sqrt(localError.
xx())
716 <<
"\t sigmaY: " << distanceY /
sqrt(localError.
yy()) <<
"\n";
728 throw cms::Exception(
"FatalError") <<
"Unable to find DTRecSegment4DCollection in event!\n";
733 throw cms::Exception(
"FatalError") <<
"Unable to find CSCSegmentCollection in event!\n";
744 std::set<DetId> occupancy_set;
749 throw cms::Exception(
"FatalError") <<
"Unable to find RPCRecHitCollection in event!\n";
759 for (
const auto& dtSegment : *dtSegments) {
760 occupancy_set.insert(dtSegment.geographicalId());
763 occupancy_set.insert(
cscSegment.geographicalId());
766 occupancy_set.insert(rpcRecHit.geographicalId());
769 for (
const auto& gemSegment : *gemSegments) {
770 occupancy_set.insert(gemSegment.geographicalId());
773 occupancy_set.insert(
gemRecHit.geographicalId());
778 occupancy_set.insert(me0Segment.geographicalId());
781 occupancy_set.insert(
me0RecHit.geographicalId());
784 if (occupancy_set.empty()) {
785 LogTrace(
"TrackAssociator") <<
"No segments or hits were found in the event: aborting track extrapolation" 802 std::vector<TAMuonChamberMatch> matchedChambers;
803 LogTrace(
"TrackAssociator") <<
"Trying to Get ChamberMatches" << std::endl;
804 getTAMuonChamberMatches(matchedChambers,
parameters, occupancy_set);
805 LogTrace(
"TrackAssociator") <<
"Chambers matched: " << matchedChambers.size() <<
"\n";
809 for (std::vector<TAMuonChamberMatch>::iterator matchedChamber = matchedChambers.begin();
810 matchedChamber != matchedChambers.end();
812 const GeomDet* geomDet = muonDetIdAssociator_->getGeomDet((*matchedChamber).id);
819 if (addTAMuonSegmentMatch(*matchedChamber, &(*segment),
parameters)) {
820 matchedChamber->segments.back().dtSegmentRef =
DTRecSegment4DRef(dtSegments, segment - dtSegments->begin());
830 if (addTAMuonSegmentMatch(*matchedChamber, &(*segment),
parameters)) {
842 if (addTAMuonSegmentMatch(*matchedChamber, &(*segment),
parameters)) {
843 matchedChamber->segments.back().gemSegmentRef =
856 if (addTAMuonSegmentMatch(*matchedChamber, &(*segment),
parameters)) {
857 matchedChamber->segments.back().me0SegmentRef =
864 info.chambers.push_back(*matchedChamber);
874 const GeomDet*
chamber = muonDetIdAssociator_->getGeomDet(matchedChamber.
id);
878 LogTrace(
"TrackAssociator") <<
"Segment global position: " << segmentGlobalPosition
879 <<
" \t (R_xy,eta,phi): " << segmentGlobalPosition.
perp() <<
"," 880 << segmentGlobalPosition.
eta() <<
"," << segmentGlobalPosition.
phi() <<
"\n";
882 LogTrace(
"TrackAssociator") <<
"\teta hit: " << segmentGlobalPosition.
eta()
884 <<
"\tphi hit: " << segmentGlobalPosition.
phi()
889 bool isDTWithoutY =
false;
891 if (dtseg && (!dtseg->
hasZed()))
923 muonSegment.
hasZed =
true;
924 muonSegment.
hasPhi =
true;
927 muonSegment.
t0 = 0.f;
929 if ((dtseg->
hasPhi()) && (!isDTWithoutY)) {
938 LogTrace(
"TrackAssociator") <<
" Phi t0: " << dtseg->
phiSegment()->
t0() <<
" hits: " << phiHits;
952 muonSegment.
hasZed =
false;
954 muonSegment.
hasPhi =
false;
957 matchedChamber.
segments.push_back(muonSegment);
973 throw cms::Exception(
"FatalError") <<
"No simulated tracks found\n";
978 throw cms::Exception(
"FatalError") <<
"No simulated vertices found\n";
984 throw cms::Exception(
"FatalError") <<
"No simulated ECAL EB hits found\n";
989 throw cms::Exception(
"FatalError") <<
"No simulated ECAL EE hits found\n";
994 throw cms::Exception(
"FatalError") <<
"No simulated HCAL hits found\n";
1005 info.simTrack = &(*simTrack);
1006 float ecalTrueEnergy(0);
1007 float hcalTrueEnergy(0);
1010 for (PCaloHitContainer::const_iterator
hit = simEcalHitsEB->begin();
hit != simEcalHitsEB->end(); ++
hit)
1011 if (
hit->geantTrackId() ==
info.simTrack->genpartIndex())
1012 ecalTrueEnergy +=
hit->energy();
1014 for (PCaloHitContainer::const_iterator
hit = simEcalHitsEE->begin();
hit != simEcalHitsEE->end(); ++
hit)
1015 if (
hit->geantTrackId() ==
info.simTrack->genpartIndex())
1016 ecalTrueEnergy +=
hit->energy();
1018 for (PCaloHitContainer::const_iterator
hit = simHcalHits->begin();
hit != simHcalHits->end(); ++
hit)
1019 if (
hit->geantTrackId() ==
info.simTrack->genpartIndex())
1020 hcalTrueEnergy +=
hit->energy();
1022 info.ecalTrueEnergy = ecalTrueEnergy;
1023 info.hcalTrueEnergy = hcalTrueEnergy;
1024 info.hcalTrueEnergyCorrected = hcalTrueEnergy;
1026 info.hcalTrueEnergyCorrected = hcalTrueEnergy * 113.2f;
1028 info.hcalTrueEnergyCorrected = hcalTrueEnergy * 167.2f;
1037 double currentStepSize = cachedTrajectory_.getPropagationStep();
1041 if (
track.extra().isNull()) {
1042 if (direction != InsideOut)
1043 throw cms::Exception(
"FatalError") <<
"No TrackExtra information is available and association is done with " 1044 "something else than InsideOut track.\n" 1045 <<
"Either change the parameter or provide needed data!\n";
1046 LogTrace(
"TrackAssociator") <<
"Track Extras not found\n";
1051 LogTrace(
"TrackAssociator") <<
"Track Extras found\n";
1056 LogTrace(
"TrackAssociator") <<
"inner track state (rho, z, phi):" <<
track.innerPosition().Rho() <<
", " 1057 <<
track.innerPosition().z() <<
", " <<
track.innerPosition().phi() <<
"\n";
1058 LogTrace(
"TrackAssociator") <<
"innerFreeState (rho, z, phi):" << innerState.
position().
perp() <<
", " 1061 LogTrace(
"TrackAssociator") <<
"outer track state (rho, z, phi):" <<
track.outerPosition().Rho() <<
", " 1062 <<
track.outerPosition().z() <<
", " <<
track.outerPosition().phi() <<
"\n";
1063 LogTrace(
"TrackAssociator") <<
"outerFreeState (rho, z, phi):" << outerState.
position().
perp() <<
", " 1067 if (crossedIP(
track)) {
1068 switch (direction) {
1071 return associate(
iEvent, iSetup,
parameters, &referenceState, &outerState);
1074 cachedTrajectory_.setPropagationStep(-
std::abs(currentStepSize));
1076 cachedTrajectory_.setPropagationStep(currentStepSize);
1082 switch (direction) {
1087 cachedTrajectory_.setPropagationStep(-
std::abs(currentStepSize));
1089 cachedTrajectory_.setPropagationStep(currentStepSize);
1095 if (
track.innerPosition().Dot(
track.innerMomentum()) < 0 &&
1096 track.outerPosition().Dot(
track.outerMomentum()) < 0) {
1097 cachedTrajectory_.setPropagationStep(-
std::abs(currentStepSize));
1099 if (
track.innerPosition().Mag2() <
track.outerPosition().Mag2())
1103 cachedTrajectory_.setPropagationStep(currentStepSize);
1134 bool crossed =
true;
1135 crossed &= (
track.innerPosition().rho() > 3);
1136 crossed &= (
track.outerPosition().rho() > 3);
1138 ((
track.innerPosition().x() *
track.innerMomentum().x() +
track.innerPosition().y() *
track.innerMomentum().y() <
1140 (
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
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
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 width() const override
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 &)
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE constexpr float charge(ConstView const &tracks, int32_t i)
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
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
void getTAMuonChamberMatches(std::vector< TAMuonChamberMatch > &matches, const AssociatorParameters ¶meters, std::set< DetId > occupancy)
Abs< T >::type abs(const T &t)
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE void init(ZVertexSoAView &vertices)
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