58 #include "Math/VectorUtil.h" 72 useDefaultPropagator_ =
false;
79 cachedTrajectory_.setPropagator(ivProp_);
91 if (useDefaultPropagator_ && (!defProp_ || theMagneticFieldWatcher_.check(iSetup))) {
96 prop->setMaterialMode(
false);
97 prop->applyRadX0Correction(
true);
100 setPropagator(defProp_.get());
108 preshowerDetIdAssociator_ = &iSetup.
getData(
parameters.preshowerDetIdAssociatorToken);
127 <<
"Configuration error! No subdetector was selected for the track association.";
130 info.stateAtIP = *innerState;
131 cachedTrajectory_.setStateAtIP(trackOrigin);
143 info.setCaloGeometry(theCaloGeometry_);
145 cachedTrajectory_.reset_trajectory();
150 double HOmaxR = hoDetIdAssociator_->volume().maxR();
151 double HOmaxZ = hoDetIdAssociator_->volume().maxZ();
152 double minR = ecalDetIdAssociator_->volume().minR();
153 double minZ = preshowerDetIdAssociator_->volume().minZ();
154 cachedTrajectory_.setMaxHORadius(HOmaxR);
155 cachedTrajectory_.setMaxHOLength(HOmaxZ * 2.);
156 cachedTrajectory_.setMinDetectorRadius(minR);
157 cachedTrajectory_.setMinDetectorLength(
minZ * 2.);
160 double maxR = muonDetIdAssociator_->volume().maxR();
161 double maxZ = muonDetIdAssociator_->volume().maxZ();
162 cachedTrajectory_.setMaxDetectorRadius(maxR);
163 cachedTrajectory_.setMaxDetectorLength(
maxZ * 2.);
165 cachedTrajectory_.setMaxDetectorRadius(HOmaxR);
166 cachedTrajectory_.setMaxDetectorLength(HOmaxZ * 2.);
172 LogTrace(
"TrackAssociator") <<
"Using outerState as trackOrigin at Rho=" << outerState->
position().
perp()
173 <<
" Z=" << outerState->
position().
z() <<
"\n";
175 }
else if (innerState) {
176 LogTrace(
"TrackAssociator") <<
"Using innerState as trackOrigin at Rho=" << innerState->
position().
perp()
177 <<
" Z=" << innerState->
position().
z() <<
"\n";
187 if (!cachedTrajectory_.propagateAll(trackOrigin))
191 cachedTrajectory_.findEcalTrajectory(ecalDetIdAssociator_->volume());
192 cachedTrajectory_.findHcalTrajectory(hcalDetIdAssociator_->volume());
193 cachedTrajectory_.findHOTrajectory(hoDetIdAssociator_->volume());
194 cachedTrajectory_.findPreshowerTrajectory(preshowerDetIdAssociator_->volume());
196 info.trkGlobPosAtEcal = getPoint(cachedTrajectory_.getStateAtEcal().position());
197 info.trkGlobPosAtHcal = getPoint(cachedTrajectory_.getStateAtHcal().position());
198 info.trkGlobPosAtHO = getPoint(cachedTrajectory_.getStateAtHO().position());
200 info.trkMomAtEcal = cachedTrajectory_.getStateAtEcal().momentum();
201 info.trkMomAtHcal = cachedTrajectory_.getStateAtHcal().momentum();
202 info.trkMomAtHO = cachedTrajectory_.getStateAtHO().momentum();
225 const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getEcalTrajectory();
227 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
228 itr != trajectoryStates.end();
230 LogTrace(
"TrackAssociator") <<
"ECAL trajectory point (rho, z, phi): " << itr->position().perp() <<
", " 231 << itr->position().z() <<
", " << itr->position().phi();
233 std::vector<GlobalPoint> coreTrajectory;
234 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
235 itr != trajectoryStates.end();
237 coreTrajectory.push_back(itr->position());
239 if (coreTrajectory.empty()) {
240 LogTrace(
"TrackAssociator") <<
"ECAL track trajectory is empty; moving on\n";
241 info.isGoodEcal =
false;
244 info.isGoodEcal =
true;
250 throw cms::Exception(
"FatalError") <<
"Unable to find EBRecHitCollection in the event!\n";
255 throw cms::Exception(
"FatalError") <<
"Unable to find EERecHitCollection in event!\n";
257 std::set<DetId> ecalIdsInRegion;
258 if (
parameters.accountForTrajectoryChangeCalo) {
262 ecalIdsInRegion = ecalDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0], mapRange);
264 ecalIdsInRegion = ecalDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0],
parameters.dREcalPreselection);
265 LogTrace(
"TrackAssociator") <<
"ECAL hits in the region: " << ecalIdsInRegion.size();
267 ecalIdsInRegion = ecalDetIdAssociator_->getDetIdsInACone(ecalIdsInRegion, coreTrajectory,
parameters.dREcal);
268 LogTrace(
"TrackAssociator") <<
"ECAL hits in the cone: " << ecalIdsInRegion.size();
269 info.crossedEcalIds = ecalDetIdAssociator_->getCrossedDetIds(ecalIdsInRegion, coreTrajectory);
270 const std::vector<DetId>& crossedEcalIds =
info.crossedEcalIds;
271 LogTrace(
"TrackAssociator") <<
"ECAL crossed hits " << crossedEcalIds.size();
274 for (std::vector<DetId>::const_iterator itr = crossedEcalIds.begin(); itr != crossedEcalIds.end(); itr++) {
275 std::vector<EcalRecHit>::const_iterator ebHit = (*EBRecHits).find(*itr);
276 std::vector<EcalRecHit>::const_iterator eeHit = (*EERecHits).find(*itr);
277 if (ebHit != (*EBRecHits).end())
278 info.crossedEcalRecHits.push_back(&*ebHit);
279 else if (eeHit != (*EERecHits).end())
280 info.crossedEcalRecHits.push_back(&*eeHit);
282 LogTrace(
"TrackAssociator") <<
"Crossed EcalRecHit is not found for DetId: " << itr->rawId();
284 for (std::set<DetId>::const_iterator itr = ecalIdsInRegion.begin(); itr != ecalIdsInRegion.end(); itr++) {
285 std::vector<EcalRecHit>::const_iterator ebHit = (*EBRecHits).find(*itr);
286 std::vector<EcalRecHit>::const_iterator eeHit = (*EERecHits).find(*itr);
287 if (ebHit != (*EBRecHits).end())
288 info.ecalRecHits.push_back(&*ebHit);
289 else if (eeHit != (*EERecHits).end())
290 info.ecalRecHits.push_back(&*eeHit);
292 LogTrace(
"TrackAssociator") <<
"EcalRecHit from the cone is not found for DetId: " << itr->rawId();
300 std::vector<GlobalPoint> trajectory;
301 const std::vector<SteppingHelixStateInfo>& ecalTrajectoryStates = cachedTrajectory_.getEcalTrajectory();
302 const std::vector<SteppingHelixStateInfo>& hcalTrajectoryStates = cachedTrajectory_.getHcalTrajectory();
303 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = ecalTrajectoryStates.begin();
304 itr != ecalTrajectoryStates.end();
306 trajectory.push_back(itr->position());
307 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = hcalTrajectoryStates.begin();
308 itr != hcalTrajectoryStates.end();
310 trajectory.push_back(itr->position());
312 if (trajectory.empty()) {
313 LogTrace(
"TrackAssociator") <<
"HCAL trajectory is empty; moving on\n";
314 info.isGoodCalo =
false;
317 info.isGoodCalo =
true;
323 throw cms::Exception(
"FatalError") <<
"Unable to find CaloTowers in event!\n";
325 std::set<DetId> caloTowerIdsInRegion;
326 if (
parameters.accountForTrajectoryChangeCalo) {
330 caloTowerIdsInRegion = caloDetIdAssociator_->getDetIdsCloseToAPoint(trajectory[0], mapRange);
332 caloTowerIdsInRegion = caloDetIdAssociator_->getDetIdsCloseToAPoint(trajectory[0],
parameters.dRHcalPreselection);
334 LogTrace(
"TrackAssociator") <<
"Towers in the region: " << caloTowerIdsInRegion.size();
336 auto caloTowerIdsInAConeBegin = caloTowerIdsInRegion.begin();
337 auto caloTowerIdsInAConeEnd = caloTowerIdsInRegion.end();
338 std::set<DetId> caloTowerIdsInAConeTmp;
339 if (!caloDetIdAssociator_->selectAllInACone(
parameters.dRHcal)) {
340 caloTowerIdsInAConeTmp =
341 caloDetIdAssociator_->getDetIdsInACone(caloTowerIdsInRegion, trajectory,
parameters.dRHcal);
342 caloTowerIdsInAConeBegin = caloTowerIdsInAConeTmp.begin();
343 caloTowerIdsInAConeEnd = caloTowerIdsInAConeTmp.end();
345 LogTrace(
"TrackAssociator") <<
"Towers in the cone: " 346 <<
std::distance(caloTowerIdsInAConeBegin, caloTowerIdsInAConeEnd);
348 info.crossedTowerIds = caloDetIdAssociator_->getCrossedDetIds(caloTowerIdsInRegion, trajectory);
349 const std::vector<DetId>& crossedCaloTowerIds =
info.crossedTowerIds;
350 LogTrace(
"TrackAssociator") <<
"Towers crossed: " << crossedCaloTowerIds.size();
353 for (std::vector<DetId>::const_iterator itr = crossedCaloTowerIds.begin(); itr != crossedCaloTowerIds.end(); itr++) {
355 if (
tower != (*caloTowers).end())
358 LogTrace(
"TrackAssociator") <<
"Crossed CaloTower is not found for DetId: " << (*itr).rawId();
361 for (std::set<DetId>::const_iterator itr = caloTowerIdsInAConeBegin; itr != caloTowerIdsInAConeEnd; itr++) {
363 if (
tower != (*caloTowers).end())
366 LogTrace(
"TrackAssociator") <<
"CaloTower from the cone is not found for DetId: " << (*itr).rawId();
373 std::vector<GlobalPoint> trajectory;
374 const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getPreshowerTrajectory();
375 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
376 itr != trajectoryStates.end();
378 trajectory.push_back(itr->position());
380 if (trajectory.empty()) {
381 LogTrace(
"TrackAssociator") <<
"Preshower trajectory is empty; moving on\n";
385 std::set<DetId> idsInRegion =
386 preshowerDetIdAssociator_->getDetIdsCloseToAPoint(trajectory[0],
parameters.dRPreshowerPreselection);
388 LogTrace(
"TrackAssociator") <<
"Number of Preshower Ids in the region: " << idsInRegion.size();
389 info.crossedPreshowerIds = preshowerDetIdAssociator_->getCrossedDetIds(idsInRegion, trajectory);
390 LogTrace(
"TrackAssociator") <<
"Number of Preshower Ids in crossed: " <<
info.crossedPreshowerIds.size();
396 const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getHcalTrajectory();
398 std::vector<GlobalPoint> coreTrajectory;
399 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
400 itr != trajectoryStates.end();
402 coreTrajectory.push_back(itr->position());
404 if (coreTrajectory.empty()) {
405 LogTrace(
"TrackAssociator") <<
"HCAL trajectory is empty; moving on\n";
406 info.isGoodHcal =
false;
409 info.isGoodHcal =
true;
415 throw cms::Exception(
"FatalError") <<
"Unable to find HBHERecHits in event!\n";
417 std::set<DetId> idsInRegion;
418 if (
parameters.accountForTrajectoryChangeCalo) {
422 idsInRegion = hcalDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0], mapRange);
424 idsInRegion = hcalDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0],
parameters.dRHcalPreselection);
426 LogTrace(
"TrackAssociator") <<
"HCAL hits in the region: " << idsInRegion.size() <<
"\n" 429 auto idsInAConeBegin = idsInRegion.begin();
430 auto idsInAConeEnd = idsInRegion.end();
431 std::set<DetId> idsInAConeTmp;
432 if (!hcalDetIdAssociator_->selectAllInACone(
parameters.dRHcal)) {
433 idsInAConeTmp = hcalDetIdAssociator_->getDetIdsInACone(idsInRegion, coreTrajectory,
parameters.dRHcal);
434 idsInAConeBegin = idsInAConeTmp.begin();
435 idsInAConeEnd = idsInAConeTmp.end();
437 LogTrace(
"TrackAssociator") <<
"HCAL hits in the cone: " <<
std::distance(idsInAConeBegin, idsInAConeEnd) <<
"\n" 438 <<
DetIdInfo::info(std::set<DetId>(idsInAConeBegin, idsInAConeEnd),
nullptr);
439 info.crossedHcalIds = hcalDetIdAssociator_->getCrossedDetIds(idsInRegion, coreTrajectory);
440 const std::vector<DetId>& crossedIds =
info.crossedHcalIds;
441 LogTrace(
"TrackAssociator") <<
"HCAL hits crossed: " << crossedIds.size() <<
"\n" 445 for (std::vector<DetId>::const_iterator itr = crossedIds.begin(); itr != crossedIds.end(); itr++) {
447 if (
hit != (*collection).end())
448 info.crossedHcalRecHits.push_back(&*
hit);
450 LogTrace(
"TrackAssociator") <<
"Crossed HBHERecHit is not found for DetId: " << itr->rawId();
452 for (std::set<DetId>::const_iterator itr = idsInAConeBegin; itr != idsInAConeEnd; itr++) {
454 if (
hit != (*collection).end())
455 info.hcalRecHits.push_back(&*
hit);
457 LogTrace(
"TrackAssociator") <<
"HBHERecHit from the cone is not found for DetId: " << itr->rawId();
464 const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getHOTrajectory();
466 std::vector<GlobalPoint> coreTrajectory;
467 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
468 itr != trajectoryStates.end();
470 coreTrajectory.push_back(itr->position());
472 if (coreTrajectory.empty()) {
473 LogTrace(
"TrackAssociator") <<
"HO trajectory is empty; moving on\n";
474 info.isGoodHO =
false;
477 info.isGoodHO =
true;
483 throw cms::Exception(
"FatalError") <<
"Unable to find HORecHits in event!\n";
485 std::set<DetId> idsInRegion;
486 if (
parameters.accountForTrajectoryChangeCalo) {
490 idsInRegion = hoDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0], mapRange);
492 idsInRegion = hoDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0],
parameters.dRHcalPreselection);
494 LogTrace(
"TrackAssociator") <<
"idsInRegion.size(): " << idsInRegion.size();
496 auto idsInAConeBegin = idsInRegion.begin();
497 auto idsInAConeEnd = idsInRegion.end();
498 std::set<DetId> idsInAConeTmp;
499 if (!hoDetIdAssociator_->selectAllInACone(
parameters.dRHcal)) {
500 idsInAConeTmp = hoDetIdAssociator_->getDetIdsInACone(idsInRegion, coreTrajectory,
parameters.dRHcal);
501 idsInAConeBegin = idsInAConeTmp.begin();
502 idsInAConeEnd = idsInAConeTmp.end();
504 LogTrace(
"TrackAssociator") <<
"idsInACone.size(): " <<
std::distance(idsInAConeBegin, idsInAConeEnd);
505 info.crossedHOIds = hoDetIdAssociator_->getCrossedDetIds(idsInRegion, coreTrajectory);
506 const std::vector<DetId>& crossedIds =
info.crossedHOIds;
509 for (std::vector<DetId>::const_iterator itr = crossedIds.begin(); itr != crossedIds.end(); itr++) {
511 if (
hit != (*collection).end())
512 info.crossedHORecHits.push_back(&*
hit);
514 LogTrace(
"TrackAssociator") <<
"Crossed HORecHit is not found for DetId: " << itr->rawId();
517 for (std::set<DetId>::const_iterator itr = idsInAConeBegin; itr != idsInAConeEnd; itr++) {
519 if (
hit != (*collection).end())
520 info.hoRecHits.push_back(&*
hit);
522 LogTrace(
"TrackAssociator") <<
"HORecHit from the cone is not found for DetId: " << itr->rawId();
546 ROOT::Math::SMatrixIdentity
id;
565 ROOT::Math::SMatrixIdentity
id;
583 if (
delta.second > 0)
587 LogTrace(
"TrackAssociator") <<
"Selection range: (dThetaPlus, dThetaMinus, dPhiPlus, dPhiMinus, dRPreselection): " 605 if (!trajectoryPoint.
isValid())
606 trajectoryPoint = cachedTrajectory_.getOuterState();
607 if (!trajectoryPoint.
isValid()) {
609 <<
"trajectory position at HCAL is not valid. Assume the track cannot reach muon detectors and skip it";
614 LogTrace(
"TrackAssociator") <<
"muon direction: " << direction
615 <<
"\n\t and corresponding point: " << trajectoryPoint.
position() <<
"\n";
622 std::set<DetId> muonIdsInRegion = muonDetIdAssociator_->getDetIdsCloseToAPoint(trajectoryPoint.
position(), mapRange);
623 LogTrace(
"TrackAssociator") <<
"Number of chambers to check: " << muonIdsInRegion.size();
624 for (std::set<DetId>::const_iterator detId = muonIdsInRegion.begin(); detId != muonIdsInRegion.end(); detId++) {
625 const GeomDet* geomDet = muonDetIdAssociator_->getGeomDet(*detId);
627 if (!stateOnSurface.
isValid()) {
628 LogTrace(
"TrackAssociator") <<
"Failed to propagate the track; moving on\n\t" 629 <<
"Element is not crosssed: " <<
DetIdInfo::info(*detId,
nullptr) <<
"\n";
634 float distanceX = 0.f;
635 float distanceY = 0.f;
636 if (
const CSCChamber* cscChamber = dynamic_cast<const CSCChamber*>(geomDet)) {
639 LogTrace(
"TrackAssociator") <<
"Failed to get CSCChamberSpecs from CSCChamber; moving on\n";
643 if (!layerGeometry) {
644 LogTrace(
"TrackAssociator") <<
"Failed to get CSCLayerGeometry from CSCChamberSpecs; moving on\n";
649 LogTrace(
"TrackAssociator") <<
"Failed to get CSCWireTopology from CSCLayerGeometry; moving on\n";
659 float yCOWPOffset = yOfFirstWire + 0.5f * length;
662 float tangent = (wideWidth - narrowWidth) / (2.
f * length);
664 float yPrime = localPoint.
y() +
std::abs(yOfFirstWire);
666 float halfWidthAtYPrime = 0.5f * narrowWidth + yPrime * tangent;
667 distanceX =
std::abs(localPoint.
x()) - halfWidthAtYPrime;
668 distanceY =
std::abs(localPoint.
y() - yCOWPOffset) - 0.5
f * length;
669 }
else if (dynamic_cast<const GEMChamber*>(geomDet) ||
dynamic_cast<const GEMSuperChamber*
>(geomDet)) {
673 float narrowWidth = 2.f *
bounds->widthAtHalfLength() - wideWidth;
674 float length =
bounds->length();
675 float tangent = (wideWidth - narrowWidth) / (2.
f * length);
676 float halfWidthAtY = tangent * localPoint.
y() + 0.25f * (narrowWidth + wideWidth);
678 distanceX =
std::abs(localPoint.
x()) - halfWidthAtY;
679 distanceY =
std::abs(localPoint.
y()) - 0.5
f * length;
685 (distanceX * distanceX <
687 distanceY * distanceY <
691 match.tState = stateOnSurface;
692 match.localDistanceX = distanceX;
693 match.localDistanceY = distanceY;
698 <<
"\n\tdistanceX: " << distanceX <<
"\t distanceY: " << distanceY
699 <<
"\t sigmaX: " << distanceX /
sqrt(localError.
xx())
700 <<
"\t sigmaY: " << distanceY /
sqrt(localError.
yy()) <<
"\n";
712 throw cms::Exception(
"FatalError") <<
"Unable to find DTRecSegment4DCollection in event!\n";
717 throw cms::Exception(
"FatalError") <<
"Unable to find CSCSegmentCollection in event!\n";
737 std::vector<TAMuonChamberMatch> matchedChambers;
738 LogTrace(
"TrackAssociator") <<
"Trying to Get ChamberMatches" << std::endl;
739 getTAMuonChamberMatches(matchedChambers,
parameters);
740 LogTrace(
"TrackAssociator") <<
"Chambers matched: " << matchedChambers.size() <<
"\n";
744 for (std::vector<TAMuonChamberMatch>::iterator matchedChamber = matchedChambers.begin();
745 matchedChamber != matchedChambers.end();
747 const GeomDet* geomDet = muonDetIdAssociator_->getGeomDet((*matchedChamber).id);
754 if (addTAMuonSegmentMatch(*matchedChamber, &(*segment),
parameters)) {
755 matchedChamber->segments.back().dtSegmentRef =
DTRecSegment4DRef(dtSegments, segment - dtSegments->begin());
765 if (addTAMuonSegmentMatch(*matchedChamber, &(*segment),
parameters)) {
777 if (addTAMuonSegmentMatch(*matchedChamber, &(*segment),
parameters)) {
778 matchedChamber->segments.back().gemSegmentRef =
791 if (addTAMuonSegmentMatch(*matchedChamber, &(*segment),
parameters)) {
792 matchedChamber->segments.back().me0SegmentRef =
799 info.chambers.push_back(*matchedChamber);
809 const GeomDet*
chamber = muonDetIdAssociator_->getGeomDet(matchedChamber.
id);
813 LogTrace(
"TrackAssociator") <<
"Segment global position: " << segmentGlobalPosition
814 <<
" \t (R_xy,eta,phi): " << segmentGlobalPosition.
perp() <<
"," 815 << segmentGlobalPosition.
eta() <<
"," << segmentGlobalPosition.
phi() <<
"\n";
817 LogTrace(
"TrackAssociator") <<
"\teta hit: " << segmentGlobalPosition.
eta()
819 <<
"\tphi hit: " << segmentGlobalPosition.
phi()
824 bool isDTWithoutY =
false;
826 if (dtseg && (!dtseg->
hasZed()))
858 muonSegment.
hasZed =
true;
859 muonSegment.
hasPhi =
true;
862 muonSegment.
t0 = 0.f;
864 if ((dtseg->
hasPhi()) && (!isDTWithoutY)) {
873 LogTrace(
"TrackAssociator") <<
" Phi t0: " << dtseg->
phiSegment()->
t0() <<
" hits: " << phiHits;
887 muonSegment.
hasZed =
false;
889 muonSegment.
hasPhi =
false;
892 matchedChamber.
segments.push_back(muonSegment);
908 throw cms::Exception(
"FatalError") <<
"No simulated tracks found\n";
913 throw cms::Exception(
"FatalError") <<
"No simulated vertices found\n";
919 throw cms::Exception(
"FatalError") <<
"No simulated ECAL EB hits found\n";
924 throw cms::Exception(
"FatalError") <<
"No simulated ECAL EE hits found\n";
929 throw cms::Exception(
"FatalError") <<
"No simulated HCAL hits found\n";
940 info.simTrack = &(*simTrack);
941 float ecalTrueEnergy(0);
942 float hcalTrueEnergy(0);
945 for (PCaloHitContainer::const_iterator
hit = simEcalHitsEB->begin();
hit != simEcalHitsEB->end(); ++
hit)
946 if (
hit->geantTrackId() ==
info.simTrack->genpartIndex())
947 ecalTrueEnergy +=
hit->energy();
949 for (PCaloHitContainer::const_iterator
hit = simEcalHitsEE->begin();
hit != simEcalHitsEE->end(); ++
hit)
950 if (
hit->geantTrackId() ==
info.simTrack->genpartIndex())
951 ecalTrueEnergy +=
hit->energy();
953 for (PCaloHitContainer::const_iterator
hit = simHcalHits->begin();
hit != simHcalHits->end(); ++
hit)
954 if (
hit->geantTrackId() ==
info.simTrack->genpartIndex())
955 hcalTrueEnergy +=
hit->energy();
957 info.ecalTrueEnergy = ecalTrueEnergy;
958 info.hcalTrueEnergy = hcalTrueEnergy;
959 info.hcalTrueEnergyCorrected = hcalTrueEnergy;
961 info.hcalTrueEnergyCorrected = hcalTrueEnergy * 113.2f;
963 info.hcalTrueEnergyCorrected = hcalTrueEnergy * 167.2f;
972 double currentStepSize = cachedTrajectory_.getPropagationStep();
976 if (
track.extra().isNull()) {
977 if (direction != InsideOut)
978 throw cms::Exception(
"FatalError") <<
"No TrackExtra information is available and association is done with " 979 "something else than InsideOut track.\n" 980 <<
"Either change the parameter or provide needed data!\n";
981 LogTrace(
"TrackAssociator") <<
"Track Extras not found\n";
986 LogTrace(
"TrackAssociator") <<
"Track Extras found\n";
991 LogTrace(
"TrackAssociator") <<
"inner track state (rho, z, phi):" <<
track.innerPosition().Rho() <<
", " 992 <<
track.innerPosition().z() <<
", " <<
track.innerPosition().phi() <<
"\n";
993 LogTrace(
"TrackAssociator") <<
"innerFreeState (rho, z, phi):" << innerState.
position().
perp() <<
", " 996 LogTrace(
"TrackAssociator") <<
"outer track state (rho, z, phi):" <<
track.outerPosition().Rho() <<
", " 997 <<
track.outerPosition().z() <<
", " <<
track.outerPosition().phi() <<
"\n";
998 LogTrace(
"TrackAssociator") <<
"outerFreeState (rho, z, phi):" << outerState.
position().
perp() <<
", " 1002 if (crossedIP(
track)) {
1003 switch (direction) {
1006 return associate(
iEvent, iSetup,
parameters, &referenceState, &outerState);
1009 cachedTrajectory_.setPropagationStep(-
std::abs(currentStepSize));
1011 cachedTrajectory_.setPropagationStep(currentStepSize);
1017 switch (direction) {
1022 cachedTrajectory_.setPropagationStep(-
std::abs(currentStepSize));
1024 cachedTrajectory_.setPropagationStep(currentStepSize);
1030 if (
track.innerPosition().Dot(
track.innerMomentum()) < 0 &&
1031 track.outerPosition().Dot(
track.outerMomentum()) < 0) {
1032 cachedTrajectory_.setPropagationStep(-
std::abs(currentStepSize));
1034 if (
track.innerPosition().Mag2() <
track.outerPosition().Mag2())
1038 cachedTrajectory_.setPropagationStep(currentStepSize);
1069 bool crossed =
true;
1070 crossed &= (
track.innerPosition().rho() > 3);
1071 crossed &= (
track.outerPosition().rho() > 3);
1073 ((
track.innerPosition().x() *
track.innerMomentum().x() +
track.innerPosition().y() *
track.innerMomentum().y() <
1075 (
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 &)
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)
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