72 #include "Math/VectorUtil.h"
103 useDefaultPropagator_ =
false;
108 if (defProp_)
delete defProp_;
114 cachedTrajectory_.setPropagator(ivProp_);
119 useDefaultPropagator_ =
true;
127 if (!theCaloGeometry_.isValid())
128 throw cms::Exception(
"FatalError") <<
"Unable to find CaloGeometryRecord in event!\n";
132 if (!theTrackingGeometry_.isValid())
133 throw cms::Exception(
"FatalError") <<
"Unable to find GlobalTrackingGeometryRecord in event!\n";
135 if (useDefaultPropagator_ && (! defProp_ || theMagneticFeildWatcher_.check(iSetup) ) ) {
145 setPropagator(defProp_);
161 return associate(iEvent,iSetup,parameters,&fts);
174 "Configuration error! No subdetector was selected for the track association.";
178 cachedTrajectory_.setStateAtIP(trackOrigin);
192 cachedTrajectory_.reset_trajectory();
197 double HOmaxR = hoDetIdAssociator_->volume().maxR();
198 double HOmaxZ = hoDetIdAssociator_->volume().maxZ();
199 double minR = ecalDetIdAssociator_->volume().minR();
200 double minZ = preshowerDetIdAssociator_->volume().minZ();
201 cachedTrajectory_.setMaxHORadius(HOmaxR);
202 cachedTrajectory_.setMaxHOLength(HOmaxZ*2.);
203 cachedTrajectory_.setMinDetectorRadius(minR);
204 cachedTrajectory_.setMinDetectorLength(minZ*2.);
207 double maxR = muonDetIdAssociator_->volume().maxR();
208 double maxZ = muonDetIdAssociator_->volume().maxZ();
209 cachedTrajectory_.setMaxDetectorRadius(maxR);
210 cachedTrajectory_.setMaxDetectorLength(maxZ*2.);
213 cachedTrajectory_.setMaxDetectorRadius(HOmaxR);
214 cachedTrajectory_.setMaxDetectorLength(HOmaxZ*2.);
220 LogTrace(
"TrackAssociator") <<
"Using outerState as trackOrigin at Rho=" << outerState->
position().
perp()
221 <<
" Z=" << outerState->
position().
z() <<
"\n";
224 else if(innerState) {
225 LogTrace(
"TrackAssociator") <<
"Using innerState as trackOrigin at Rho=" << innerState->
position().
perp()
226 <<
" Z=" << innerState->
position().
z() <<
"\n";
231 if ( trackOrigin.
momentum().
mag() == 0 )
return info;
233 if ( ! cachedTrajectory_.propagateAll(trackOrigin) )
return info;
236 cachedTrajectory_.findEcalTrajectory( ecalDetIdAssociator_->volume() );
237 cachedTrajectory_.findHcalTrajectory( hcalDetIdAssociator_->volume() );
238 cachedTrajectory_.findHOTrajectory( hoDetIdAssociator_->volume() );
239 cachedTrajectory_.findPreshowerTrajectory( preshowerDetIdAssociator_->volume() );
241 info.
trkGlobPosAtEcal = getPoint( cachedTrajectory_.getStateAtEcal().position() );
242 info.
trkGlobPosAtHcal = getPoint( cachedTrajectory_.getStateAtHcal().position() );
243 info.
trkGlobPosAtHO = getPoint( cachedTrajectory_.getStateAtHO().position() );
245 info.
trkMomAtEcal = cachedTrajectory_.getStateAtEcal().momentum();
246 info.
trkMomAtHcal = cachedTrajectory_.getStateAtHcal().momentum();
247 info.
trkMomAtHO = cachedTrajectory_.getStateAtHO().momentum();
249 if (parameters.
useEcal) fillEcal( iEvent, info, parameters);
251 if (parameters.
useHcal) fillHcal( iEvent, info, parameters);
252 if (parameters.
useHO) fillHO( iEvent, info, parameters);
253 if (parameters.
usePreshower) fillPreshower( iEvent, info, parameters);
254 if (parameters.
useMuon) fillMuon( iEvent, info, parameters);
255 if (parameters.
truthMatch) fillCaloTruth( iEvent, info, parameters);
264 const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getEcalTrajectory();
266 for(std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
267 itr != trajectoryStates.end(); itr++)
268 LogTrace(
"TrackAssociator") <<
"ECAL trajectory point (rho, z, phi): " << itr->position().perp() <<
269 ", " << itr->position().z() <<
", " << itr->position().phi();
271 std::vector<GlobalPoint> coreTrajectory;
272 for(std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
273 itr != trajectoryStates.end(); itr++) coreTrajectory.push_back(itr->position());
275 if(coreTrajectory.empty()) {
276 LogTrace(
"TrackAssociator") <<
"ECAL track trajectory is empty; moving on\n";
285 if (!EBRecHits.
isValid())
throw cms::Exception(
"FatalError") <<
"Unable to find EBRecHitCollection in the event!\n";
289 if (!EERecHits.
isValid())
throw cms::Exception(
"FatalError") <<
"Unable to find EERecHitCollection in event!\n";
291 std::set<DetId> ecalIdsInRegion;
296 ecalIdsInRegion = ecalDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0],mapRange);
297 }
else ecalIdsInRegion = ecalDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0], parameters.
dREcalPreselection);
298 LogTrace(
"TrackAssociator") <<
"ECAL hits in the region: " << ecalIdsInRegion.size();
300 ecalIdsInRegion = ecalDetIdAssociator_->getDetIdsInACone(ecalIdsInRegion, coreTrajectory, parameters.
dREcal);
301 LogTrace(
"TrackAssociator") <<
"ECAL hits in the cone: " << ecalIdsInRegion.size();
302 info.
crossedEcalIds = ecalDetIdAssociator_->getCrossedDetIds(ecalIdsInRegion, coreTrajectory);
304 LogTrace(
"TrackAssociator") <<
"ECAL crossed hits " << crossedEcalIds.size();
308 for(std::vector<DetId>::const_iterator itr=crossedEcalIds.begin(); itr!=crossedEcalIds.end();itr++)
310 std::vector<EcalRecHit>::const_iterator ebHit = (*EBRecHits).find(*itr);
311 std::vector<EcalRecHit>::const_iterator eeHit = (*EERecHits).find(*itr);
312 if(ebHit != (*EBRecHits).end())
314 else if(eeHit != (*EERecHits).end())
317 LogTrace(
"TrackAssociator") <<
"Crossed EcalRecHit is not found for DetId: " << itr->rawId();
319 for(std::set<DetId>::const_iterator itr=ecalIdsInRegion.begin(); itr!=ecalIdsInRegion.end();itr++)
321 std::vector<EcalRecHit>::const_iterator ebHit = (*EBRecHits).find(*itr);
322 std::vector<EcalRecHit>::const_iterator eeHit = (*EERecHits).find(*itr);
323 if(ebHit != (*EBRecHits).end())
325 else if(eeHit != (*EERecHits).end())
328 LogTrace(
"TrackAssociator") <<
"EcalRecHit from the cone is not found for DetId: " << itr->rawId();
337 std::vector<GlobalPoint> trajectory;
338 const std::vector<SteppingHelixStateInfo>& ecalTrajectoryStates = cachedTrajectory_.getEcalTrajectory();
339 const std::vector<SteppingHelixStateInfo>& hcalTrajectoryStates = cachedTrajectory_.getHcalTrajectory();
340 for(std::vector<SteppingHelixStateInfo>::const_iterator itr = ecalTrajectoryStates.begin();
341 itr != ecalTrajectoryStates.end(); itr++) trajectory.push_back(itr->position());
342 for(std::vector<SteppingHelixStateInfo>::const_iterator itr = hcalTrajectoryStates.begin();
343 itr != hcalTrajectoryStates.end(); itr++) trajectory.push_back(itr->position());
345 if(trajectory.empty()) {
346 LogTrace(
"TrackAssociator") <<
"HCAL trajectory is empty; moving on\n";
355 if (!caloTowers.
isValid())
throw cms::Exception(
"FatalError") <<
"Unable to find CaloTowers in event!\n";
357 std::set<DetId> caloTowerIdsInRegion;
362 caloTowerIdsInRegion = caloDetIdAssociator_->getDetIdsCloseToAPoint(trajectory[0],mapRange);
363 }
else caloTowerIdsInRegion = caloDetIdAssociator_->getDetIdsCloseToAPoint(trajectory[0], parameters.
dRHcalPreselection);
365 LogTrace(
"TrackAssociator") <<
"Towers in the region: " << caloTowerIdsInRegion.size();
367 auto caloTowerIdsInAConeBegin = caloTowerIdsInRegion.begin();
368 auto caloTowerIdsInAConeEnd = caloTowerIdsInRegion.end();
369 std::set<DetId> caloTowerIdsInAConeTmp;
370 if (!caloDetIdAssociator_->selectAllInACone(parameters.
dRHcal)){
371 caloTowerIdsInAConeTmp = caloDetIdAssociator_->getDetIdsInACone(caloTowerIdsInRegion, trajectory, parameters.
dRHcal);
372 caloTowerIdsInAConeBegin = caloTowerIdsInAConeTmp.begin();
373 caloTowerIdsInAConeEnd = caloTowerIdsInAConeTmp.end();
375 LogTrace(
"TrackAssociator") <<
"Towers in the cone: " <<
std::distance(caloTowerIdsInAConeBegin, caloTowerIdsInAConeEnd);
377 info.
crossedTowerIds = caloDetIdAssociator_->getCrossedDetIds(caloTowerIdsInRegion, trajectory);
379 LogTrace(
"TrackAssociator") <<
"Towers crossed: " << crossedCaloTowerIds.size();
382 for(std::vector<DetId>::const_iterator itr=crossedCaloTowerIds.begin(); itr!=crossedCaloTowerIds.end();itr++)
385 if(tower != (*caloTowers).end())
388 LogTrace(
"TrackAssociator") <<
"Crossed CaloTower is not found for DetId: " << (*itr).rawId();
391 for(std::set<DetId>::const_iterator itr=caloTowerIdsInAConeBegin; itr!=caloTowerIdsInAConeEnd;itr++)
394 if(tower != (*caloTowers).end())
395 info.
towers.push_back(&*tower);
397 LogTrace(
"TrackAssociator") <<
"CaloTower from the cone is not found for DetId: " << (*itr).rawId();
406 std::vector<GlobalPoint> trajectory;
407 const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getPreshowerTrajectory();
408 for(std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
409 itr != trajectoryStates.end(); itr++) trajectory.push_back(itr->position());
411 if(trajectory.empty()) {
412 LogTrace(
"TrackAssociator") <<
"Preshower trajectory is empty; moving on\n";
416 std::set<DetId> idsInRegion =
417 preshowerDetIdAssociator_->getDetIdsCloseToAPoint(trajectory[0],
420 LogTrace(
"TrackAssociator") <<
"Number of Preshower Ids in the region: " << idsInRegion.size();
421 info.
crossedPreshowerIds = preshowerDetIdAssociator_->getCrossedDetIds(idsInRegion, trajectory);
430 const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getHcalTrajectory();
432 std::vector<GlobalPoint> coreTrajectory;
433 for(std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
434 itr != trajectoryStates.end(); itr++) coreTrajectory.push_back(itr->position());
436 if(coreTrajectory.empty()) {
437 LogTrace(
"TrackAssociator") <<
"HCAL trajectory is empty; moving on\n";
446 if ( ! collection.
isValid() )
throw cms::Exception(
"FatalError") <<
"Unable to find HBHERecHits in event!\n";
448 std::set<DetId> idsInRegion;
453 idsInRegion = hcalDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0], mapRange);
454 }
else idsInRegion = hcalDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0], parameters.
dRHcalPreselection);
456 LogTrace(
"TrackAssociator") <<
"HCAL hits in the region: " << idsInRegion.size() <<
"\n" <<
DetIdInfo::info(idsInRegion,0);
458 auto idsInAConeBegin = idsInRegion.begin();
459 auto idsInAConeEnd = idsInRegion.end();
460 std::set<DetId> idsInAConeTmp;
461 if (! hcalDetIdAssociator_->selectAllInACone(parameters.
dRHcal)){
462 idsInAConeTmp = hcalDetIdAssociator_->getDetIdsInACone(idsInRegion, coreTrajectory, parameters.
dRHcal);
463 idsInAConeBegin = idsInAConeTmp.begin();
464 idsInAConeEnd = idsInAConeTmp.end();
466 LogTrace(
"TrackAssociator") <<
"HCAL hits in the cone: " <<
std::distance(idsInAConeBegin, idsInAConeEnd) <<
"\n"
467 <<
DetIdInfo::info(std::set<DetId>(idsInAConeBegin, idsInAConeEnd), 0);
468 info.
crossedHcalIds = hcalDetIdAssociator_->getCrossedDetIds(idsInRegion, coreTrajectory);
470 LogTrace(
"TrackAssociator") <<
"HCAL hits crossed: " << crossedIds.size() <<
"\n" <<
DetIdInfo::info(crossedIds,0);
473 for(std::vector<DetId>::const_iterator itr=crossedIds.begin(); itr!=crossedIds.end();itr++)
476 if( hit != (*collection).end() )
479 LogTrace(
"TrackAssociator") <<
"Crossed HBHERecHit is not found for DetId: " << itr->rawId();
481 for(std::set<DetId>::const_iterator itr=idsInAConeBegin; itr!=idsInAConeEnd;itr++)
484 if( hit != (*collection).end() )
487 LogTrace(
"TrackAssociator") <<
"HBHERecHit from the cone is not found for DetId: " << itr->rawId();
495 const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getHOTrajectory();
497 std::vector<GlobalPoint> coreTrajectory;
498 for(std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
499 itr != trajectoryStates.end(); itr++) coreTrajectory.push_back(itr->position());
501 if(coreTrajectory.empty()) {
502 LogTrace(
"TrackAssociator") <<
"HO trajectory is empty; moving on\n";
511 if ( ! collection.
isValid() )
throw cms::Exception(
"FatalError") <<
"Unable to find HORecHits in event!\n";
513 std::set<DetId> idsInRegion;
518 idsInRegion = hoDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0], mapRange);
519 }
else idsInRegion = hoDetIdAssociator_->getDetIdsCloseToAPoint(coreTrajectory[0], parameters.
dRHcalPreselection);
521 LogTrace(
"TrackAssociator") <<
"idsInRegion.size(): " << idsInRegion.size();
523 auto idsInAConeBegin = idsInRegion.begin();
524 auto idsInAConeEnd = idsInRegion.end();
525 std::set<DetId> idsInAConeTmp;
526 if (! hoDetIdAssociator_->selectAllInACone(parameters.
dRHcal)){
527 idsInAConeTmp = hoDetIdAssociator_->getDetIdsInACone(idsInRegion, coreTrajectory, parameters.
dRHcal);
528 idsInAConeBegin = idsInAConeTmp.begin();
529 idsInAConeEnd = idsInAConeTmp.end();
531 LogTrace(
"TrackAssociator") <<
"idsInACone.size(): " <<
std::distance(idsInAConeBegin, idsInAConeEnd);
532 info.
crossedHOIds = hoDetIdAssociator_->getCrossedDetIds(idsInRegion, coreTrajectory);
533 const std::vector<DetId>& crossedIds = info.
crossedHOIds;
536 for(std::vector<DetId>::const_iterator itr=crossedIds.begin(); itr!=crossedIds.end();itr++)
539 if( hit != (*collection).end() )
542 LogTrace(
"TrackAssociator") <<
"Crossed HORecHit is not found for DetId: " << itr->rawId();
545 for(std::set<DetId>::const_iterator itr=idsInAConeBegin; itr!=idsInAConeEnd;itr++)
548 if( hit != (*collection).end() )
551 LogTrace(
"TrackAssociator") <<
"HORecHit from the cone is not found for DetId: " << itr->rawId();
563 if (
abs(track.
type( )) == 211 ||
566 charge = track.
type( )< 0 ? -1 : 1;
567 return getFreeTrajectoryState(iSetup, vector,
point, charge);
580 ROOT::Math::SMatrixIdentity id;
603 ROOT::Math::SMatrixIdentity id;
618 if ( delta.first > 0 )
622 if ( delta.second > 0 )
625 mapRange.
dPhiMinus += fabs(delta.second);
626 LogTrace(
"TrackAssociator") <<
"Selection range: (dThetaPlus, dThetaMinus, dPhiPlus, dPhiMinus, dRPreselection): " <<
645 if(! trajectoryPoint.
isValid() ) trajectoryPoint = cachedTrajectory_.getOuterState();
646 if(! trajectoryPoint.
isValid() ) {
648 "trajectory position at HCAL is not valid. Assume the track cannot reach muon detectors and skip it";
653 LogTrace(
"TrackAssociator") <<
"muon direction: " << direction <<
"\n\t and corresponding point: " <<
661 std::set<DetId> muonIdsInRegion =
662 muonDetIdAssociator_->getDetIdsCloseToAPoint(trajectoryPoint.
position(), mapRange);
663 LogTrace(
"TrackAssociator") <<
"Number of chambers to check: " << muonIdsInRegion.size();
664 for(std::set<DetId>::const_iterator detId = muonIdsInRegion.begin(); detId != muonIdsInRegion.end(); detId++)
666 const GeomDet* geomDet = muonDetIdAssociator_->getGeomDet(*detId);
668 if (! stateOnSurface.
isValid()) {
669 LogTrace(
"TrackAssociator") <<
"Failed to propagate the track; moving on\n\t"<<
679 if(
const CSCChamber* cscChamber = dynamic_cast<const CSCChamber*>(geomDet) ) {
682 LogTrace(
"TrackAssociator") <<
"Failed to get CSCChamberSpecs from CSCChamber; moving on\n";
686 if(! layerGeometry) {
687 LogTrace(
"TrackAssociator") <<
"Failed to get CSCLayerGeometry from CSCChamberSpecs; moving on\n";
692 LogTrace(
"TrackAssociator") <<
"Failed to get CSCWireTopology from CSCLayerGeometry; moving on\n";
700 float yOfFirstWire = fabs(wireTopology->
wireAngle())>1.E-06 ? -0.5*length : wireTopology->
yOfWire(1);
702 float yCOWPOffset = yOfFirstWire+0.5*length;
705 float tangent = (wideWidth-narrowWidth)/(2.*length);
707 float yPrime = localPoint.
y()+fabs(yOfFirstWire);
709 float halfWidthAtYPrime = 0.5*narrowWidth+yPrime*tangent;
710 distanceX = fabs(localPoint.
x()) - halfWidthAtYPrime;
711 distanceY = fabs(localPoint.
y()-yCOWPOffset) - 0.5*length;
712 sigmaX = distanceX/
sqrt(localError.
xx());
713 sigmaY = distanceY/
sqrt(localError.
yy());
717 sigmaX = distanceX/
sqrt(localError.
xx());
718 sigmaY = distanceY/
sqrt(localError.
yy());
724 match.
tState = stateOnSurface;
728 matches.push_back(match);
730 LogTrace(
"TrackAssociator") <<
"chamber is too far: " <<
731 DetIdInfo::info(*detId,0) <<
"\n\tdistanceX: " << distanceX <<
"\t distanceY: " << distanceY <<
732 "\t sigmaX: " << sigmaX <<
"\t sigmaY: " << sigmaY <<
"\n";
746 throw cms::Exception(
"FatalError") <<
"Unable to find DTRecSegment4DCollection in event!\n";
751 throw cms::Exception(
"FatalError") <<
"Unable to find CSCSegmentCollection in event!\n";
764 std::vector<TAMuonChamberMatch> matchedChambers;
765 LogTrace(
"TrackAssociator") <<
"Trying to Get ChamberMatches" << std::endl;
766 getTAMuonChamberMatches(matchedChambers, parameters);
767 LogTrace(
"TrackAssociator") <<
"Chambers matched: " << matchedChambers.size() <<
"\n";
771 for(std::vector<TAMuonChamberMatch>::iterator matchedChamber = matchedChambers.begin();
772 matchedChamber != matchedChambers.end(); matchedChamber++)
774 const GeomDet* geomDet = muonDetIdAssociator_->getGeomDet((*matchedChamber).id);
776 if(
const DTChamber* chamber = dynamic_cast<const DTChamber*>(geomDet) ) {
781 if (addTAMuonSegmentMatch(*matchedChamber, &(*segment), parameters)) {
782 matchedChamber->segments.back().dtSegmentRef =
DTRecSegment4DRef(dtSegments, segment - dtSegments->begin());
787 if(
const CSCChamber* chamber = dynamic_cast<const CSCChamber*>(geomDet) ) {
792 if (addTAMuonSegmentMatch(*matchedChamber, &(*segment), parameters)) {
793 matchedChamber->segments.back().cscSegmentRef =
CSCSegmentRef(cscSegments, segment - cscSegments->begin());
800 info.
chambers.push_back(*matchedChamber);
810 <<
"Segment local position: " << segment->
localPosition() <<
"\n"
813 const GeomDet* chamber = muonDetIdAssociator_->getGeomDet(matchedChamber.
id);
818 <<
"Segment global position: " << segmentGlobalPosition <<
" \t (R_xy,eta,phi): "
819 << segmentGlobalPosition.
perp() <<
"," << segmentGlobalPosition.
eta() <<
"," << segmentGlobalPosition.
phi() <<
"\n";
822 <<
"\teta hit: " << segmentGlobalPosition.
eta() <<
" \tpropagator: " << trajectoryStateOnSurface.
freeState()->
position().
eta() <<
"\n"
823 <<
"\tphi hit: " << segmentGlobalPosition.
phi() <<
" \tpropagator: " << trajectoryStateOnSurface.
freeState()->
position().
phi() << std::endl;
826 bool isDTWithoutY =
false;
828 if ( dtseg && (! dtseg->
hasZed()) )
832 if(deltaPhi>
M_PI) deltaPhi = fabs(deltaPhi-
M_PI*2.);
836 isGood = deltaPhi < parameters.
dRMuon;
840 deltaPhi*deltaPhi) < parameters.
dRMuon;
859 muonSegment.
hasZed =
true;
860 muonSegment.
hasPhi =
true;
865 if ( (dtseg->
hasPhi()) && (! isDTWithoutY) ) {
874 LogTrace(
"TrackAssociator") <<
" Phi t0: " << dtseg->
phiSegment()->
t0() <<
" hits: " << phiHits;
882 if (hits) muonSegment.
t0 = t0/hits;
886 if (isDTWithoutY) muonSegment.
hasZed =
false;
890 matchedChamber.
segments.push_back(muonSegment);
906 if (! simTracks.isValid() )
throw cms::Exception(
"FatalError") <<
"No simulated tracks found\n";
910 if (! simVertices.isValid() )
throw cms::Exception(
"FatalError") <<
"No simulated vertices found\n";
915 if (! simEcalHitsEB.isValid() )
throw cms::Exception(
"FatalError") <<
"No simulated ECAL EB hits found\n";
919 if (! simEcalHitsEE.isValid() )
throw cms::Exception(
"FatalError") <<
"No simulated ECAL EE hits found\n";
923 if (! simHcalHits.isValid() )
throw cms::Exception(
"FatalError") <<
"No simulated HCAL hits found\n";
926 SimTrackContainer::const_iterator simTrack = simTracks->begin();
927 for( ; simTrack != simTracks->end(); ++simTrack){
928 math::XYZVector simP3( simTrack->momentum().x(), simTrack->momentum().y(), simTrack->momentum().z() );
932 if ( simTrack != simTracks->end() ) {
934 double ecalTrueEnergy(0);
935 double hcalTrueEnergy(0);
938 for( PCaloHitContainer::const_iterator
hit = simEcalHitsEB->begin();
hit != simEcalHitsEB->end(); ++
hit )
941 for( PCaloHitContainer::const_iterator
hit = simEcalHitsEE->begin();
hit != simEcalHitsEE->end(); ++
hit )
944 for( PCaloHitContainer::const_iterator
hit = simHcalHits->begin();
hit != simHcalHits->end(); ++
hit )
964 double currentStepSize = cachedTrajectory_.getPropagationStep();
970 if ( direction != InsideOut )
972 "No TrackExtra information is available and association is done with something else than InsideOut track.\n" <<
973 "Either change the parameter or provide needed data!\n";
974 LogTrace(
"TrackAssociator") <<
"Track Extras not found\n";
976 return associate(iEvent, iSetup, parameters, &initialState);
979 LogTrace(
"TrackAssociator") <<
"Track Extras found\n";
984 LogTrace(
"TrackAssociator") <<
"inner track state (rho, z, phi):" <<
987 LogTrace(
"TrackAssociator") <<
"innerFreeState (rho, z, phi):" <<
991 LogTrace(
"TrackAssociator") <<
"outer track state (rho, z, phi):" <<
994 LogTrace(
"TrackAssociator") <<
"outerFreeState (rho, z, phi):" <<
999 if ( crossedIP( track ) ) {
1000 switch ( direction ) {
1003 return associate(iEvent, iSetup, parameters, &referenceState, &outerState);
1007 cachedTrajectory_.setPropagationStep( -fabs(currentStepSize) );
1009 cachedTrajectory_.setPropagationStep( currentStepSize );
1015 switch ( direction ) {
1017 return associate(iEvent, iSetup, parameters, &innerState, &outerState);
1021 cachedTrajectory_.setPropagationStep( -fabs(currentStepSize) );
1023 cachedTrajectory_.setPropagationStep( currentStepSize );
1033 cachedTrajectory_.setPropagationStep( -fabs(currentStepSize) );
1036 result = associate(iEvent, iSetup, parameters, &innerState, &outerState);
1038 result = associate(iEvent, iSetup, parameters, &outerState, &innerState);
1039 cachedTrajectory_.setPropagationStep( currentStepSize );
1047 return associate(iEvent, iSetup, parameters, &innerState, &outerState);
1056 return associate(iEvent, iSetup, getFreeTrajectoryState(iSetup, track, vertex), parameters);
1066 return associate(iEvent, iSetup, getFreeTrajectoryState(iSetup, momentum, vertex, charge), parameters);
1071 bool crossed =
true;
edm::EDGetTokenT< CaloTowerCollection > caloTowersToken
std::vector< DetId > crossedPreshowerIds
math::XYZPoint trkGlobPosAtHO
std::pair< const_iterator, const_iterator > range
iterator range
TrackDetectorAssociator()
float segmentLocalErrorXX
const CSCWireTopology * wireTopology() const
virtual float length() const =0
static bool crossedIP(const reco::Track &track)
std::vector< const CaloTower * > crossedTowers
virtual LocalError localDirectionError() const =0
Error on the local direction.
std::vector< const CaloTower * > towers
TrajectoryStateOnSurface tState
const TrackExtraRef & extra() const
reference to "extra" object
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
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
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)
virtual LocalVector localDirection() const =0
Local direction.
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 &)
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
tuple SteppingHelixPropagator
void setPropagator(const Propagator *)
use a user configured propagator
void getTAMuonChamberMatches(std::vector< TAMuonChamberMatch > &matches, const AssociatorParameters ¶meters)
void applyRadX0Correction(bool applyRadX0Correction)
GlobalPoint position() const
LocalPoint toLocal(const GlobalPoint &gp) const
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) ...
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
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
virtual LocalError localPositionError() const =0
~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
double t0() const
Get the segment t0 (if recomputed, 0 is returned otherwise)
std::vector< const HORecHit * > hoRecHits
virtual LocalPoint localPosition() const =0
virtual float width() const =0
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