76 #include "Math/VectorUtil.h" 103 using namespace reco;
109 useDefaultPropagator_ =
false;
114 if (defProp_)
delete defProp_;
120 cachedTrajectory_.setPropagator(ivProp_);
125 useDefaultPropagator_ =
true;
133 if (!theCaloGeometry_.isValid())
134 throw cms::Exception(
"FatalError") <<
"Unable to find CaloGeometryRecord in event!\n";
138 if (!theTrackingGeometry_.isValid())
139 throw cms::Exception(
"FatalError") <<
"Unable to find GlobalTrackingGeometryRecord in event!\n";
141 if (useDefaultPropagator_ && (! defProp_ || theMagneticFeildWatcher_.check(iSetup) ) ) {
151 setPropagator(defProp_);
167 return associate(iEvent,iSetup,parameters,&fts);
180 "Configuration error! No subdetector was selected for the track association.";
184 cachedTrajectory_.setStateAtIP(trackOrigin);
198 cachedTrajectory_.reset_trajectory();
203 double HOmaxR = hoDetIdAssociator_->volume().maxR();
204 double HOmaxZ = hoDetIdAssociator_->volume().maxZ();
205 double minR = ecalDetIdAssociator_->volume().minR();
206 double minZ = preshowerDetIdAssociator_->volume().minZ();
207 cachedTrajectory_.setMaxHORadius(HOmaxR);
208 cachedTrajectory_.setMaxHOLength(HOmaxZ*2.);
209 cachedTrajectory_.setMinDetectorRadius(minR);
210 cachedTrajectory_.setMinDetectorLength(minZ*2.);
213 double maxR = muonDetIdAssociator_->volume().maxR();
214 double maxZ = muonDetIdAssociator_->volume().maxZ();
215 cachedTrajectory_.setMaxDetectorRadius(maxR);
216 cachedTrajectory_.setMaxDetectorLength(maxZ*2.);
219 cachedTrajectory_.setMaxDetectorRadius(HOmaxR);
220 cachedTrajectory_.setMaxDetectorLength(HOmaxZ*2.);
226 LogTrace(
"TrackAssociator") <<
"Using outerState as trackOrigin at Rho=" << outerState->
position().
perp()
227 <<
" Z=" << outerState->
position().
z() <<
"\n";
230 else if(innerState) {
231 LogTrace(
"TrackAssociator") <<
"Using innerState as trackOrigin at Rho=" << innerState->
position().
perp()
232 <<
" Z=" << innerState->
position().
z() <<
"\n";
237 if ( trackOrigin.
momentum().
mag() == 0 )
return info;
239 if ( ! cachedTrajectory_.propagateAll(trackOrigin) )
return info;
242 cachedTrajectory_.findEcalTrajectory( ecalDetIdAssociator_->volume() );
243 cachedTrajectory_.findHcalTrajectory( hcalDetIdAssociator_->volume() );
244 cachedTrajectory_.findHOTrajectory( hoDetIdAssociator_->volume() );
245 cachedTrajectory_.findPreshowerTrajectory( preshowerDetIdAssociator_->volume() );
247 info.
trkGlobPosAtEcal = getPoint( cachedTrajectory_.getStateAtEcal().position() );
248 info.
trkGlobPosAtHcal = getPoint( cachedTrajectory_.getStateAtHcal().position() );
249 info.
trkGlobPosAtHO = getPoint( cachedTrajectory_.getStateAtHO().position() );
251 info.
trkMomAtEcal = cachedTrajectory_.getStateAtEcal().momentum();
252 info.
trkMomAtHcal = cachedTrajectory_.getStateAtHcal().momentum();
253 info.
trkMomAtHO = cachedTrajectory_.getStateAtHO().momentum();
255 if (parameters.
useEcal) fillEcal( iEvent, info, parameters);
257 if (parameters.
useHcal) fillHcal( iEvent, info, parameters);
258 if (parameters.
useHO) fillHO( iEvent, info, parameters);
259 if (parameters.
usePreshower) fillPreshower( iEvent, info, parameters);
260 if (parameters.
useMuon) fillMuon( iEvent, info, parameters);
261 if (parameters.
truthMatch) fillCaloTruth( iEvent, info, parameters);
270 const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getEcalTrajectory();
272 for(std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
273 itr != trajectoryStates.end(); itr++)
274 LogTrace(
"TrackAssociator") <<
"ECAL trajectory point (rho, z, phi): " << itr->position().perp() <<
275 ", " << itr->position().z() <<
", " << itr->position().phi();
277 std::vector<GlobalPoint> coreTrajectory;
278 for(std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
279 itr != trajectoryStates.end(); itr++) coreTrajectory.push_back(itr->position());
281 if(coreTrajectory.empty()) {
282 LogTrace(
"TrackAssociator") <<
"ECAL track trajectory is empty; moving on\n";
291 if (!EBRecHits.
isValid())
throw cms::Exception(
"FatalError") <<
"Unable to find EBRecHitCollection in the event!\n";
295 if (!EERecHits.
isValid())
throw cms::Exception(
"FatalError") <<
"Unable to find EERecHitCollection in event!\n";
297 std::set<DetId> ecalIdsInRegion;
302 ecalIdsInRegion = ecalDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0],mapRange);
303 }
else ecalIdsInRegion = ecalDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0], parameters.
dREcalPreselection);
304 LogTrace(
"TrackAssociator") <<
"ECAL hits in the region: " << ecalIdsInRegion.size();
306 ecalIdsInRegion = ecalDetIdAssociator_->getDetIdsInACone(ecalIdsInRegion, coreTrajectory, parameters.
dREcal);
307 LogTrace(
"TrackAssociator") <<
"ECAL hits in the cone: " << ecalIdsInRegion.size();
308 info.
crossedEcalIds = ecalDetIdAssociator_->getCrossedDetIds(ecalIdsInRegion, coreTrajectory);
310 LogTrace(
"TrackAssociator") <<
"ECAL crossed hits " << crossedEcalIds.size();
314 for(std::vector<DetId>::const_iterator itr=crossedEcalIds.begin(); itr!=crossedEcalIds.end();itr++)
316 std::vector<EcalRecHit>::const_iterator ebHit = (*EBRecHits).find(*itr);
317 std::vector<EcalRecHit>::const_iterator eeHit = (*EERecHits).find(*itr);
318 if(ebHit != (*EBRecHits).end())
320 else if(eeHit != (*EERecHits).end())
323 LogTrace(
"TrackAssociator") <<
"Crossed EcalRecHit is not found for DetId: " << itr->rawId();
325 for(std::set<DetId>::const_iterator itr=ecalIdsInRegion.begin(); itr!=ecalIdsInRegion.end();itr++)
327 std::vector<EcalRecHit>::const_iterator ebHit = (*EBRecHits).find(*itr);
328 std::vector<EcalRecHit>::const_iterator eeHit = (*EERecHits).find(*itr);
329 if(ebHit != (*EBRecHits).end())
331 else if(eeHit != (*EERecHits).end())
334 LogTrace(
"TrackAssociator") <<
"EcalRecHit from the cone is not found for DetId: " << itr->rawId();
343 std::vector<GlobalPoint> trajectory;
344 const std::vector<SteppingHelixStateInfo>& ecalTrajectoryStates = cachedTrajectory_.getEcalTrajectory();
345 const std::vector<SteppingHelixStateInfo>& hcalTrajectoryStates = cachedTrajectory_.getHcalTrajectory();
346 for(std::vector<SteppingHelixStateInfo>::const_iterator itr = ecalTrajectoryStates.begin();
347 itr != ecalTrajectoryStates.end(); itr++) trajectory.push_back(itr->position());
348 for(std::vector<SteppingHelixStateInfo>::const_iterator itr = hcalTrajectoryStates.begin();
349 itr != hcalTrajectoryStates.end(); itr++) trajectory.push_back(itr->position());
351 if(trajectory.empty()) {
352 LogTrace(
"TrackAssociator") <<
"HCAL trajectory is empty; moving on\n";
361 if (!caloTowers.
isValid())
throw cms::Exception(
"FatalError") <<
"Unable to find CaloTowers in event!\n";
363 std::set<DetId> caloTowerIdsInRegion;
368 caloTowerIdsInRegion = caloDetIdAssociator_->getDetIdsCloseToAPoint(trajectory[0],mapRange);
369 }
else caloTowerIdsInRegion = caloDetIdAssociator_->getDetIdsCloseToAPoint(trajectory[0], parameters.
dRHcalPreselection);
371 LogTrace(
"TrackAssociator") <<
"Towers in the region: " << caloTowerIdsInRegion.size();
373 auto caloTowerIdsInAConeBegin = caloTowerIdsInRegion.begin();
374 auto caloTowerIdsInAConeEnd = caloTowerIdsInRegion.end();
375 std::set<DetId> caloTowerIdsInAConeTmp;
376 if (!caloDetIdAssociator_->selectAllInACone(parameters.
dRHcal)){
377 caloTowerIdsInAConeTmp = caloDetIdAssociator_->getDetIdsInACone(caloTowerIdsInRegion, trajectory, parameters.
dRHcal);
378 caloTowerIdsInAConeBegin = caloTowerIdsInAConeTmp.begin();
379 caloTowerIdsInAConeEnd = caloTowerIdsInAConeTmp.end();
381 LogTrace(
"TrackAssociator") <<
"Towers in the cone: " <<
std::distance(caloTowerIdsInAConeBegin, caloTowerIdsInAConeEnd);
383 info.
crossedTowerIds = caloDetIdAssociator_->getCrossedDetIds(caloTowerIdsInRegion, trajectory);
385 LogTrace(
"TrackAssociator") <<
"Towers crossed: " << crossedCaloTowerIds.size();
388 for(std::vector<DetId>::const_iterator itr=crossedCaloTowerIds.begin(); itr!=crossedCaloTowerIds.end();itr++)
391 if(tower != (*caloTowers).end())
394 LogTrace(
"TrackAssociator") <<
"Crossed CaloTower is not found for DetId: " << (*itr).rawId();
397 for(std::set<DetId>::const_iterator itr=caloTowerIdsInAConeBegin; itr!=caloTowerIdsInAConeEnd;itr++)
400 if(tower != (*caloTowers).end())
401 info.
towers.push_back(&*tower);
403 LogTrace(
"TrackAssociator") <<
"CaloTower from the cone is not found for DetId: " << (*itr).rawId();
412 std::vector<GlobalPoint> trajectory;
413 const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getPreshowerTrajectory();
414 for(std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
415 itr != trajectoryStates.end(); itr++) trajectory.push_back(itr->position());
417 if(trajectory.empty()) {
418 LogTrace(
"TrackAssociator") <<
"Preshower trajectory is empty; moving on\n";
422 std::set<DetId> idsInRegion =
423 preshowerDetIdAssociator_->getDetIdsCloseToAPoint(trajectory[0],
426 LogTrace(
"TrackAssociator") <<
"Number of Preshower Ids in the region: " << idsInRegion.size();
427 info.
crossedPreshowerIds = preshowerDetIdAssociator_->getCrossedDetIds(idsInRegion, trajectory);
436 const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getHcalTrajectory();
438 std::vector<GlobalPoint> coreTrajectory;
439 for(std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
440 itr != trajectoryStates.end(); itr++) coreTrajectory.push_back(itr->position());
442 if(coreTrajectory.empty()) {
443 LogTrace(
"TrackAssociator") <<
"HCAL trajectory is empty; moving on\n";
452 if ( ! collection.
isValid() )
throw cms::Exception(
"FatalError") <<
"Unable to find HBHERecHits in event!\n";
454 std::set<DetId> idsInRegion;
459 idsInRegion = hcalDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0], mapRange);
460 }
else idsInRegion = hcalDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0], parameters.
dRHcalPreselection);
462 LogTrace(
"TrackAssociator") <<
"HCAL hits in the region: " << idsInRegion.size() <<
"\n" <<
DetIdInfo::info(idsInRegion,
nullptr);
464 auto idsInAConeBegin = idsInRegion.begin();
465 auto idsInAConeEnd = idsInRegion.end();
466 std::set<DetId> idsInAConeTmp;
467 if (! hcalDetIdAssociator_->selectAllInACone(parameters.
dRHcal)){
468 idsInAConeTmp = hcalDetIdAssociator_->getDetIdsInACone(idsInRegion, coreTrajectory, parameters.
dRHcal);
469 idsInAConeBegin = idsInAConeTmp.begin();
470 idsInAConeEnd = idsInAConeTmp.end();
472 LogTrace(
"TrackAssociator") <<
"HCAL hits in the cone: " <<
std::distance(idsInAConeBegin, idsInAConeEnd) <<
"\n" 473 <<
DetIdInfo::info(std::set<DetId>(idsInAConeBegin, idsInAConeEnd),
nullptr);
474 info.
crossedHcalIds = hcalDetIdAssociator_->getCrossedDetIds(idsInRegion, coreTrajectory);
476 LogTrace(
"TrackAssociator") <<
"HCAL hits crossed: " << crossedIds.size() <<
"\n" <<
DetIdInfo::info(crossedIds,
nullptr);
479 for(std::vector<DetId>::const_iterator itr=crossedIds.begin(); itr!=crossedIds.end();itr++)
482 if( hit != (*collection).end() )
485 LogTrace(
"TrackAssociator") <<
"Crossed HBHERecHit is not found for DetId: " << itr->rawId();
487 for(std::set<DetId>::const_iterator itr=idsInAConeBegin; itr!=idsInAConeEnd;itr++)
490 if( hit != (*collection).end() )
493 LogTrace(
"TrackAssociator") <<
"HBHERecHit from the cone is not found for DetId: " << itr->rawId();
501 const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getHOTrajectory();
503 std::vector<GlobalPoint> coreTrajectory;
504 for(std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
505 itr != trajectoryStates.end(); itr++) coreTrajectory.push_back(itr->position());
507 if(coreTrajectory.empty()) {
508 LogTrace(
"TrackAssociator") <<
"HO trajectory is empty; moving on\n";
517 if ( ! collection.
isValid() )
throw cms::Exception(
"FatalError") <<
"Unable to find HORecHits in event!\n";
519 std::set<DetId> idsInRegion;
524 idsInRegion = hoDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0], mapRange);
525 }
else idsInRegion = hoDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0], parameters.
dRHcalPreselection);
527 LogTrace(
"TrackAssociator") <<
"idsInRegion.size(): " << idsInRegion.size();
529 auto idsInAConeBegin = idsInRegion.begin();
530 auto idsInAConeEnd = idsInRegion.end();
531 std::set<DetId> idsInAConeTmp;
532 if (! hoDetIdAssociator_->selectAllInACone(parameters.
dRHcal)){
533 idsInAConeTmp = hoDetIdAssociator_->getDetIdsInACone(idsInRegion, coreTrajectory, parameters.
dRHcal);
534 idsInAConeBegin = idsInAConeTmp.begin();
535 idsInAConeEnd = idsInAConeTmp.end();
537 LogTrace(
"TrackAssociator") <<
"idsInACone.size(): " <<
std::distance(idsInAConeBegin, idsInAConeEnd);
538 info.
crossedHOIds = hoDetIdAssociator_->getCrossedDetIds(idsInRegion, coreTrajectory);
539 const std::vector<DetId>& crossedIds = info.
crossedHOIds;
542 for(std::vector<DetId>::const_iterator itr=crossedIds.begin(); itr!=crossedIds.end();itr++)
545 if( hit != (*collection).end() )
548 LogTrace(
"TrackAssociator") <<
"Crossed HORecHit is not found for DetId: " << itr->rawId();
551 for(std::set<DetId>::const_iterator itr=idsInAConeBegin; itr!=idsInAConeEnd;itr++)
554 if( hit != (*collection).end() )
557 LogTrace(
"TrackAssociator") <<
"HORecHit from the cone is not found for DetId: " << itr->rawId();
569 if (
abs(track.
type( )) == 211 ||
572 charge = track.
type( )< 0 ? -1 : 1;
573 return getFreeTrajectoryState(iSetup, vector,
point, charge);
586 ROOT::Math::SMatrixIdentity
id;
609 ROOT::Math::SMatrixIdentity
id;
624 if ( delta.first > 0 )
628 if ( delta.second > 0 )
631 mapRange.
dPhiMinus += fabs(delta.second);
632 LogTrace(
"TrackAssociator") <<
"Selection range: (dThetaPlus, dThetaMinus, dPhiPlus, dPhiMinus, dRPreselection): " <<
651 if(! trajectoryPoint.
isValid() ) trajectoryPoint = cachedTrajectory_.getOuterState();
652 if(! trajectoryPoint.
isValid() ) {
654 "trajectory position at HCAL is not valid. Assume the track cannot reach muon detectors and skip it";
659 LogTrace(
"TrackAssociator") <<
"muon direction: " << direction <<
"\n\t and corresponding point: " <<
667 std::set<DetId> muonIdsInRegion =
668 muonDetIdAssociator_->getDetIdsCloseToAPoint(trajectoryPoint.
position(), mapRange);
669 LogTrace(
"TrackAssociator") <<
"Number of chambers to check: " << muonIdsInRegion.size();
670 for(std::set<DetId>::const_iterator detId = muonIdsInRegion.begin(); detId != muonIdsInRegion.end(); detId++)
672 const GeomDet* geomDet = muonDetIdAssociator_->getGeomDet(*detId);
674 if (! stateOnSurface.
isValid()) {
675 LogTrace(
"TrackAssociator") <<
"Failed to propagate the track; moving on\n\t"<<
676 "Element is not crosssed: " <<
DetIdInfo::info(*detId,
nullptr) <<
"\n";
685 if(
const CSCChamber* cscChamber = dynamic_cast<const CSCChamber*>(geomDet) ) {
688 LogTrace(
"TrackAssociator") <<
"Failed to get CSCChamberSpecs from CSCChamber; moving on\n";
692 if(! layerGeometry) {
693 LogTrace(
"TrackAssociator") <<
"Failed to get CSCLayerGeometry from CSCChamberSpecs; moving on\n";
698 LogTrace(
"TrackAssociator") <<
"Failed to get CSCWireTopology from CSCLayerGeometry; moving on\n";
706 float yOfFirstWire = fabs(wireTopology->
wireAngle())>1.E-06 ? -0.5*length : wireTopology->
yOfWire(1);
708 float yCOWPOffset = yOfFirstWire+0.5*length;
711 float tangent = (wideWidth-narrowWidth)/(2.*length);
713 float yPrime = localPoint.
y()+fabs(yOfFirstWire);
715 float halfWidthAtYPrime = 0.5*narrowWidth+yPrime*tangent;
716 distanceX = fabs(localPoint.
x()) - halfWidthAtYPrime;
717 distanceY = fabs(localPoint.
y()-yCOWPOffset) - 0.5*length;
718 sigmaX = distanceX/
sqrt(localError.
xx());
719 sigmaY = distanceY/
sqrt(localError.
yy());
723 sigmaX = distanceX/
sqrt(localError.
xx());
724 sigmaY = distanceY/
sqrt(localError.
yy());
730 match.
tState = stateOnSurface;
734 matches.push_back(match);
736 LogTrace(
"TrackAssociator") <<
"chamber is too far: " <<
737 DetIdInfo::info(*detId,
nullptr) <<
"\n\tdistanceX: " << distanceX <<
"\t distanceY: " << distanceY <<
738 "\t sigmaX: " << sigmaX <<
"\t sigmaY: " << sigmaY <<
"\n";
752 throw cms::Exception(
"FatalError") <<
"Unable to find DTRecSegment4DCollection in event!\n";
757 throw cms::Exception(
"FatalError") <<
"Unable to find CSCSegmentCollection in event!\n";
775 std::vector<TAMuonChamberMatch> matchedChambers;
776 LogTrace(
"TrackAssociator") <<
"Trying to Get ChamberMatches" << std::endl;
777 getTAMuonChamberMatches(matchedChambers, parameters);
778 LogTrace(
"TrackAssociator") <<
"Chambers matched: " << matchedChambers.size() <<
"\n";
782 for(std::vector<TAMuonChamberMatch>::iterator matchedChamber = matchedChambers.begin();
783 matchedChamber != matchedChambers.end(); matchedChamber++)
785 const GeomDet* geomDet = muonDetIdAssociator_->getGeomDet((*matchedChamber).id);
792 if (addTAMuonSegmentMatch(*matchedChamber, &(*segment), parameters)) {
793 matchedChamber->segments.back().dtSegmentRef =
DTRecSegment4DRef(dtSegments, segment - dtSegments->begin());
803 if (addTAMuonSegmentMatch(*matchedChamber, &(*segment), parameters)) {
804 matchedChamber->segments.back().cscSegmentRef =
CSCSegmentRef(cscSegments, segment - cscSegments->begin());
816 if (addTAMuonSegmentMatch(*matchedChamber, &(*segment), parameters)) {
817 matchedChamber->segments.back().gemSegmentRef =
GEMSegmentRef(gemSegments, segment - gemSegments->begin());
829 if (addTAMuonSegmentMatch(*matchedChamber, &(*segment), parameters)) {
830 matchedChamber->segments.back().me0SegmentRef =
ME0SegmentRef(me0Segments, segment - me0Segments->begin());
836 info.
chambers.push_back(*matchedChamber);
846 <<
"Segment local position: " << segment->
localPosition() <<
"\n" 849 const GeomDet*
chamber = muonDetIdAssociator_->getGeomDet(matchedChamber.
id);
854 <<
"Segment global position: " << segmentGlobalPosition <<
" \t (R_xy,eta,phi): " 855 << segmentGlobalPosition.
perp() <<
"," << segmentGlobalPosition.
eta() <<
"," << segmentGlobalPosition.
phi() <<
"\n";
858 <<
"\teta hit: " << segmentGlobalPosition.
eta() <<
" \tpropagator: " << trajectoryStateOnSurface.
freeState()->
position().
eta() <<
"\n" 859 <<
"\tphi hit: " << segmentGlobalPosition.
phi() <<
" \tpropagator: " << trajectoryStateOnSurface.
freeState()->
position().
phi() << std::endl;
862 bool isDTWithoutY =
false;
864 if ( dtseg && (! dtseg->
hasZed()) )
868 if(deltaPhi>
M_PI) deltaPhi = fabs(deltaPhi-
M_PI*2.);
872 isGood = deltaPhi < parameters.
dRMuon;
876 deltaPhi*deltaPhi) < parameters.
dRMuon;
895 muonSegment.
hasZed =
true;
896 muonSegment.
hasPhi =
true;
901 if ( (dtseg->
hasPhi()) && (! isDTWithoutY) ) {
910 LogTrace(
"TrackAssociator") <<
" Phi t0: " << dtseg->
phiSegment()->
t0() <<
" hits: " << phiHits;
918 if (hits) muonSegment.
t0 = t0/
hits;
922 if (isDTWithoutY) muonSegment.
hasZed =
false;
926 matchedChamber.
segments.push_back(muonSegment);
951 if (! simEcalHitsEB.
isValid() )
throw cms::Exception(
"FatalError") <<
"No simulated ECAL EB hits found\n";
955 if (! simEcalHitsEE.
isValid() )
throw cms::Exception(
"FatalError") <<
"No simulated ECAL EE hits found\n";
959 if (! simHcalHits.
isValid() )
throw cms::Exception(
"FatalError") <<
"No simulated HCAL hits found\n";
962 SimTrackContainer::const_iterator
simTrack = simTracks->begin();
963 for( ; simTrack != simTracks->end(); ++
simTrack){
964 math::XYZVector simP3( simTrack->momentum().x(), simTrack->momentum().y(), simTrack->momentum().z() );
968 if ( simTrack != simTracks->end() ) {
970 double ecalTrueEnergy(0);
971 double hcalTrueEnergy(0);
974 for( PCaloHitContainer::const_iterator
hit = simEcalHitsEB->begin();
hit != simEcalHitsEB->end(); ++
hit )
977 for( PCaloHitContainer::const_iterator
hit = simEcalHitsEE->begin();
hit != simEcalHitsEE->end(); ++
hit )
980 for( PCaloHitContainer::const_iterator
hit = simHcalHits->begin();
hit != simHcalHits->end(); ++
hit )
1000 double currentStepSize = cachedTrajectory_.getPropagationStep();
1006 if ( direction != InsideOut )
1008 "No TrackExtra information is available and association is done with something else than InsideOut track.\n" <<
1009 "Either change the parameter or provide needed data!\n";
1010 LogTrace(
"TrackAssociator") <<
"Track Extras not found\n";
1012 return associate(iEvent, iSetup, parameters, &initialState);
1015 LogTrace(
"TrackAssociator") <<
"Track Extras found\n";
1020 LogTrace(
"TrackAssociator") <<
"inner track state (rho, z, phi):" <<
1023 LogTrace(
"TrackAssociator") <<
"innerFreeState (rho, z, phi):" <<
1027 LogTrace(
"TrackAssociator") <<
"outer track state (rho, z, phi):" <<
1030 LogTrace(
"TrackAssociator") <<
"outerFreeState (rho, z, phi):" <<
1035 if ( crossedIP( track ) ) {
1036 switch ( direction ) {
1039 return associate(iEvent, iSetup, parameters, &referenceState, &outerState);
1043 cachedTrajectory_.setPropagationStep( -fabs(currentStepSize) );
1045 cachedTrajectory_.setPropagationStep( currentStepSize );
1051 switch ( direction ) {
1053 return associate(iEvent, iSetup, parameters, &innerState, &outerState);
1057 cachedTrajectory_.setPropagationStep( -fabs(currentStepSize) );
1059 cachedTrajectory_.setPropagationStep( currentStepSize );
1069 cachedTrajectory_.setPropagationStep( -fabs(currentStepSize) );
1072 result = associate(iEvent, iSetup, parameters, &innerState, &outerState);
1074 result = associate(iEvent, iSetup, parameters, &outerState, &innerState);
1075 cachedTrajectory_.setPropagationStep( currentStepSize );
1083 return associate(iEvent, iSetup, parameters, &innerState, &outerState);
1092 return associate(iEvent, iSetup, getFreeTrajectoryState(iSetup, track, vertex), parameters);
1102 return associate(iEvent, iSetup, getFreeTrajectoryState(iSetup, momentum, vertex, charge), parameters);
1107 bool crossed =
true;
edm::EDGetTokenT< CaloTowerCollection > caloTowersToken
std::vector< DetId > crossedPreshowerIds
math::XYZPoint trkGlobPosAtHO
virtual float length() const =0
virtual LocalError localDirectionError() const =0
Error on the local direction.
std::pair< const_iterator, const_iterator > range
iterator range
TrackDetectorAssociator()
float segmentLocalErrorXX
const CSCWireTopology * wireTopology() const
static bool crossedIP(const reco::Track &track)
std::vector< const CaloTower * > crossedTowers
std::vector< const CaloTower * > towers
TrajectoryStateOnSurface tState
const TrackExtraRef & extra() const
reference to "extra" object
std::vector< const HBHERecHit * > crossedHcalRecHits
std::vector< DetId > crossedTowerIds
double dREcalPreselection
float segmentLocalErrorXY
bool getByToken(EDGetToken token, Handle< PROD > &result) const
math::XYZPoint segmentGlobalPosition
float segmentLocalErrorYDyDz
static FreeTrajectoryState getFreeTrajectoryState(const edm::EventSetup &, const reco::Track &)
get FreeTrajectoryState from different track representations
edm::Ref< CSCSegmentCollection > CSCSegmentRef
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
std::vector< const EcalRecHit * > ecalRecHits
hits in the cone
std::vector< DetId > crossedEcalIds
edm::Ref< ME0SegmentCollection > ME0SegmentRef
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
math::XYZPoint segmentLocalPosition
void setCaloGeometry(edm::ESHandle< CaloGeometry > geometry)
edm::EDGetTokenT< GEMSegmentCollection > gemSegmentsToken
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
void useDefaultPropagator()
use the default propagator
Geom::Phi< T > phi() const
std::vector< CaloTower >::const_iterator const_iterator
void fillHcal(const edm::Event &, TrackDetMatchInfo &, const AssociatorParameters &)
double dRMuonPreselection
const Bounds & bounds() const
bool addTAMuonSegmentMatch(TAMuonChamberMatch &, const RecSegment *, const AssociatorParameters &)
double muonMaxDistanceSigmaY
const Vector & momentum() const
track momentum vector
const math::XYZPoint & outerPosition() const
position of the outermost hit
std::vector< DetId > crossedHcalIds
GlobalVector momentum() const
std::vector< const EcalRecHit * > crossedEcalRecHits
hits in detector elements crossed by a track
const Plane & surface() const
The nominal surface of the GeomDet.
math::XYZVector segmentLocalDirection
LocalError positionError() const
edm::EDGetTokenT< EBRecHitCollection > EBRecHitsToken
float segmentLocalErrorDxDz
math::XYZPoint trkGlobPosAtHcal
FreeTrajectoryState stateAtIP
track info
void fillCaloTowers(const edm::Event &, TrackDetMatchInfo &, const AssociatorParameters &)
const math::XYZPoint & innerPosition() const
position of the innermost hit
uint32_t rawId() const
get the raw id
void fillCaloTruth(const edm::Event &, TrackDetMatchInfo &, const AssociatorParameters &)
virtual LocalVector localDirection() const =0
Local direction.
virtual float width() const =0
edm::EDGetTokenT< edm::PCaloHitContainer > simEcalHitsEBToken
edm::EDGetTokenT< HORecHitCollection > HOcollToken
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
float segmentLocalErrorDyDz
void setPropagator(const Propagator *)
use a user configured propagator
void getTAMuonChamberMatches(std::vector< TAMuonChamberMatch > &matches, const AssociatorParameters ¶meters)
void applyRadX0Correction(bool applyRadX0Correction)
simTrack
per collection params
GlobalPoint position() const
LocalPoint toLocal(const GlobalPoint &gp) const
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
FreeTrajectoryState const * freeState(bool withErrors=true) const
std::vector< TAMuonSegmentMatch > segments
distance sign convention: negative - crossed chamber, positive - missed chamber
int genpartIndex() const
index of the corresponding Generator particle in the Event container (-1 if no Genpart) ...
edm::EDGetTokenT< ME0SegmentCollection > me0SegmentsToken
std::vector< TAMuonChamberMatch > chambers
std::vector< const HBHERecHit * > hcalRecHits
edm::EDGetTokenT< DTRecSegment4DCollection > dtSegmentsToken
std::vector< DetId > crossedHOIds
double dRPreshowerPreselection
Abs< T >::type abs(const T &t)
const math::XYZTLorentzVectorD & position() const
bool hasPhi() const
Does it have the Phi projection?
double lengthOfPlane() const
const LocalTrajectoryError & localError() const
edm::EDGetTokenT< edm::SimTrackContainer > simTracksToken
float yOfWire(float wire, float x=0.) const
virtual LocalPoint localPosition() const =0
edm::EDGetTokenT< EERecHitCollection > EERecHitsToken
edm::EDGetTokenT< HBHERecHitCollection > HBHEcollToken
void fillPreshower(const edm::Event &iEvent, TrackDetMatchInfo &info, const AssociatorParameters &)
bool isNull() const
Checks for null.
GlobalVector momentum() const
float segmentLocalErrorYY
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
double narrowWidthOfPlane() const
double dRHcalPreselection
edm::Ref< DTRecSegment4DCollection > DTRecSegment4DRef
double muonMaxDistanceSigmaX
double deltaPhi(double phi1, double phi2)
Vector3DBase unit() const
bool hasZed() const
Does it have the Z projection?
GlobalPoint position() const
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
double wideWidthOfPlane() const
double hcalTrueEnergyCorrected
GlobalVector trkMomAtEcal
edm::EDGetTokenT< edm::SimVertexContainer > simVerticesToken
static std::string info(const DetId &, const TrackerTopology *tTopo)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
~TrackDetectorAssociator()
void fillMuon(const edm::Event &, TrackDetMatchInfo &, const AssociatorParameters &)
const CSCLayerGeometry * oddLayerGeometry(int iendcap) const
Accessors for LayerGeometry's.
void init(const edm::EventSetup &)
DetIdAssociator::MapRange getMapRange(const std::pair< float, float > &delta, const float dR)
GlobalVector trkMomAtHcal
int type() const
particle type (HEP PDT convension)
float segmentLocalErrorXDxDz
void fillEcal(const edm::Event &, TrackDetMatchInfo &, const AssociatorParameters &)
const math::XYZTLorentzVectorD & momentum() const
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
std::vector< const HORecHit * > crossedHORecHits
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
math::XYZPoint trkGlobPosAtEcal
Track position at different parts of the calorimeter.
edm::EDGetTokenT< edm::PCaloHitContainer > simHcalHitsToken
int charge() const
track electric charge
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
DetId geographicalId() const
float wireAngle() const override
virtual LocalError localPositionError() const =0
double t0() const
Get the segment t0 (if recomputed, 0 is returned otherwise)
std::vector< const HORecHit * > hoRecHits
const SimTrack * simTrack
MC truth info.
edm::EDGetTokenT< CSCSegmentCollection > cscSegmentsToken
void fillHO(const edm::Event &, TrackDetMatchInfo &, const AssociatorParameters &)
void setMaterialMode(bool noMaterial)
Switch for material effects mode: no material effects if true.
Power< A, B >::type pow(const A &a, const B &b)
*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
bool accountForTrajectoryChangeCalo
edm::EDGetTokenT< edm::PCaloHitContainer > simEcalHitsEEToken