![]() |
![]() |
#include <DynamicTruncation.h>
Class: DynamicTruncation
Description: class for the dynamical stop of the KF according to the compatibility degree between the extrapolated track state and the reconstructed segment in the muon chambers
Authors : D. Pagano & G. Bruno - UCL Louvain
Definition at line 47 of file DynamicTruncation.h.
Definition at line 52 of file DynamicTruncation.h.
Definition at line 51 of file DynamicTruncation.h.
DynamicTruncation::DynamicTruncation | ( | const edm::Event & | event, |
const MuonServiceProxy & | theService | ||
) |
Definition at line 49 of file DynamicTruncation.cc.
References cscGeom, event(), magfield, navigation, navMuon, propagator, propagatorCompatibleDet, theEvent, theG, theMuonRecHitBuilder, theSetup, and updatorHandle.
: DTThr(0), CSCThr(0), useAPE(false) { theEvent = &event; theSetup = &theService.eventSetup(); propagator = theService.propagator("SmartPropagator"); propagatorCompatibleDet = theService.propagator("SteppingHelixPropagatorAny"); theG = theService.trackingGeometry(); theService.eventSetup().get<TransientRecHitRecord>().get("MuonRecHitBuilder",theMuonRecHitBuilder); theService.eventSetup().get<TrackingComponentsRecord>().get("KFUpdator",updatorHandle); theService.eventSetup().get<MuonGeometryRecord>().get(cscGeom); theService.eventSetup().get<MuonRecoGeometryRecord>().get(navMuon); theService.eventSetup().get<IdealMagneticFieldRecord>().get(magfield); navigation = new DirectMuonNavigation(theService.detLayerGeometry()); }
DynamicTruncation::~DynamicTruncation | ( | ) |
Definition at line 67 of file DynamicTruncation.cc.
References navigation.
{ if (navigation) delete navigation; }
void DynamicTruncation::compatibleDets | ( | TrajectoryStateOnSurface & | , |
std::map< int, std::vector< DetId > > & | |||
) | [private] |
Referenced by filter().
TransientTrackingRecHit::ConstRecHitContainer DynamicTruncation::filter | ( | const Trajectory & | traj | ) |
Definition at line 73 of file DynamicTruncation.cc.
References compatibleDets(), cscApeMap, currentState, DetId::det(), dtApeMap, error, filteringAlgo(), TrajectoryMeasurement::forwardPredictedState(), TrackingRecHit::geographicalId(), edm::EventSetup::get(), TrajectoryStateOnSurface::globalPosition(), PV3DBase< T, PVType, FrameType >::mag(), Trajectory::measurements(), TrajectoryMeasurement::recHit(), result, theSetup, align::Tracker, and update().
Referenced by GlobalMuonRefitter::refit().
{ result.clear(); // Fill the map with the APE chamber by chamber (DT) // IT ALSO WORKS IF APE IS 0 edm::ESHandle<AlignmentErrors> dtAlignmentErrors; theSetup->get<DTAlignmentErrorRcd>().get( dtAlignmentErrors ); for ( std::vector<AlignTransformError>::const_iterator it = dtAlignmentErrors->m_alignError.begin(); it != dtAlignmentErrors->m_alignError.end(); it++ ) { CLHEP::HepSymMatrix error = (*it).matrix(); GlobalError glbErr(error[0][0], error[1][0], error[1][1], error[2][0], error[2][1], error[2][2]); DTChamberId DTid((*it).rawId()); dtApeMap.insert( pair<DTChamberId, GlobalError> (DTid, glbErr) ); } // Fill the map with the APE chamber by chamber (CSC) // IT ALSO WORKS IF APE IS 0 edm::ESHandle<AlignmentErrors> cscAlignmentErrors; theSetup->get<CSCAlignmentErrorRcd>().get( cscAlignmentErrors ); for ( std::vector<AlignTransformError>::const_iterator it = cscAlignmentErrors->m_alignError.begin(); it != cscAlignmentErrors->m_alignError.end(); it++ ) { CLHEP::HepSymMatrix error = (*it).matrix(); GlobalError glbErr(error[0][0], error[1][0], error[1][1], error[2][0], error[2][1], error[2][2]); CSCDetId CSCid((*it).rawId()); cscApeMap.insert( pair<CSCDetId, GlobalError> (CSCid, glbErr) ); } // Put the tracker hits in the final vector and get the last tracker valid measure std::vector<TrajectoryMeasurement> muonMeasurements = traj.measurements(); TrajectoryMeasurement lastTKm = muonMeasurements.front(); for (std::vector<TrajectoryMeasurement>::const_iterator imT = muonMeasurements.begin(); imT != muonMeasurements.end(); imT++ ) { if ( !(*imT).recHit()->isValid() ) continue; const TransientTrackingRecHit* hit = &(*(*imT).recHit()); if (hit->geographicalId().det() == DetId::Tracker) { result.push_back((*imT).recHit()); if (!(*imT).forwardPredictedState().isValid()) continue; if ((*imT).forwardPredictedState().globalPosition().mag() > lastTKm.forwardPredictedState().globalPosition().mag()) lastTKm = *imT; } } // get the last (forward) predicted state for the tracker currentState = lastTKm.forwardPredictedState(); // update the state with the last tracker measure update(currentState, lastTKm.recHit()); // use the navigation to get the list of compatible dets map<int, std::vector<DetId> > detMap; compatibleDets(currentState, detMap); // selects the muon hits for the final refit filteringAlgo(detMap); return result; }
void DynamicTruncation::filteringAlgo | ( | std::map< int, std::vector< DetId > > & | ) | [private] |
Definition at line 207 of file DynamicTruncation.cc.
References CSC(), CSCThr, currentState, GeomDetEnumerators::DT, DTThr, estimators, getBest(), ChamberSegmentUtility::getCSClist(), ChamberSegmentUtility::getCSCRHmap(), ChamberSegmentUtility::getDTlist(), ChamberSegmentUtility::getDTRHmap(), TrajectoryStateOnSurface::isValid(), j, MAX_THR, DetId::Muon, propagator, result, DTChamberId::station(), CSCDetId::station(), DetId::subdetId(), groupFilesInBlocks::temp, theEvent, theG, theMuonRecHitBuilder, theSetup, and updatorHandle.
Referenced by filter().
{ ChamberSegmentUtility getSegs(*theEvent, *theSetup); for (unsigned int iDet = 0; iDet < detMap.size(); ++iDet) { double bestLayerValue = MAX_THR; bool isDTorCSC = false; ConstRecHitContainer layerRH, layerSEG; std::vector<DetId> chamber = detMap[iDet]; for (unsigned int j = 0; j < chamber.size(); ++j) { DetId id = chamber[j]; if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::DT) { isDTorCSC = true; DTChamberId DTid(id); std::vector<DTRecSegment4D> allDTsegs; std::map<int, std::vector<DTRecSegment4D> >::const_iterator dtIter = getSegs.getDTlist().find(DTid.station()); if (dtIter != getSegs.getDTlist().end()){ allDTsegs = dtIter->second; } std::vector<DTRecSegment4D>::size_type sz = allDTsegs.size(); for (unsigned int iSeg=0; iSeg<sz; ++iSeg) { // Propagate the state to the current chamber TrajectoryStateOnSurface tsosdt = propagator->propagate(currentState, theG->idToDet(allDTsegs[iSeg].chamberId())->surface()); if (!tsosdt.isValid()) continue; std::vector<DTRecSegment4D> DTsegs; DTsegs.push_back(allDTsegs[iSeg]); DTRecSegment4D bestDTSeg; double bestChamberValue = getBest(DTsegs, tsosdt, bestDTSeg); if (bestChamberValue < bestLayerValue) bestLayerValue = bestChamberValue; // Check if the best estimator value is below the THR and then get the RH componing the segment if (bestChamberValue >= DTThr || bestChamberValue > bestLayerValue) continue; layerRH.clear(); layerSEG.clear(); layerSEG.push_back(theMuonRecHitBuilder->build(&bestDTSeg)); std::vector<DTRecHit1D> DTrh = getSegs.getDTRHmap(bestDTSeg); for (std::vector<DTRecHit1D>::iterator it = DTrh.begin(); it != DTrh.end(); it++) { layerRH.push_back(theMuonRecHitBuilder->build(&*it)); } } } if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::CSC) { isDTorCSC = true; CSCDetId CSCid(id); std::vector<CSCSegment> allCSCsegs; std::map<int, std::vector<CSCSegment> >::const_iterator cscIter = getSegs.getCSClist().find(CSCid.station()); if (cscIter != getSegs.getCSClist().end()){ allCSCsegs = cscIter->second; } std::vector<CSCSegment>::size_type sz = allCSCsegs.size(); for (unsigned int iSeg=0; iSeg<sz; ++iSeg) { // Propagate the state to the current chamber TrajectoryStateOnSurface tsoscsc = propagator->propagate(currentState, theG->idToDet(allCSCsegs[iSeg].cscDetId())->surface()); if (!tsoscsc.isValid()) continue; std::vector<CSCSegment> CSCsegs; CSCsegs.push_back(allCSCsegs[iSeg]); CSCSegment bestCSCSeg; double bestChamberValue = getBest(CSCsegs, tsoscsc, bestCSCSeg); if (bestChamberValue < bestLayerValue) bestLayerValue = bestChamberValue; // Check if the best estimator value is below the THR and then get the RH componing the segment if (bestChamberValue >= CSCThr || bestChamberValue > bestLayerValue) continue; layerRH.clear(); layerSEG.clear(); layerSEG.push_back(theMuonRecHitBuilder->build(&bestCSCSeg)); std::vector<CSCRecHit2D> CSCrh = getSegs.getCSCRHmap(bestCSCSeg); for (std::vector<CSCRecHit2D>::iterator it = CSCrh.begin(); it != CSCrh.end(); ++it) { layerRH.push_back(theMuonRecHitBuilder->build(&*it)); } } } } if (isDTorCSC) { if (bestLayerValue < MAX_THR) estimators.push_back(bestLayerValue); else estimators.push_back(-1); } // For segment based fits if (layerSEG.size() > 0) { result.push_back(layerSEG.front()); DetId id_ = layerSEG.front()->geographicalId(); if (id_.subdetId() == MuonSubdetId::DT) { DTChamberId MuonChId(id_); TrajectoryStateOnSurface temp = propagator->propagate(currentState, theG->idToDet(MuonChId)->surface()); if (temp.isValid()) currentState = updatorHandle->update(temp, *layerSEG.front()); } if (id_.subdetId() == MuonSubdetId::CSC) { CSCDetId MuonChId(id_); TrajectoryStateOnSurface temp = propagator->propagate(currentState, theG->idToDet(MuonChId)->surface()); if (temp.isValid()) currentState = updatorHandle->update(temp, *layerSEG.front()); } } /* // For hit based fits if (layerRH.size() > 0) { for (ConstRecHitContainer::iterator it = layerRH.begin(); it != layerRH.end(); ++it) result.push_back((*it)); // sort the vector layerRH = sort(layerRH); // update the currentState using all rh DetId id = layerRH.front()->geographicalId(); if (id.subdetId() == MuonSubdetId::DT) updateWithDThits(layerRH); else updateWithCSChits(layerRH); } */ layerSEG.clear(); layerRH.clear(); } }
double DynamicTruncation::getBest | ( | std::vector< CSCSegment > & | segs, |
TrajectoryStateOnSurface & | tsos, | ||
CSCSegment & | bestCSCSeg | ||
) | [private] |
Definition at line 143 of file DynamicTruncation.cc.
References cscApeMap, i, MAX_THR, edm::second(), theG, tmp, ErrorFrameTransformer::transform(), useAPE, and StateSegmentMatcher::value().
Referenced by filteringAlgo().
{ unsigned int i = 0; double val = MAX_THR; std::vector<CSCSegment>::size_type sz = segs.size(); for (i=0; i<sz; i++) { LocalError apeLoc; //default constructor is all zeroes, OK if (useAPE) apeLoc = ErrorFrameTransformer().transform(cscApeMap.find(segs[i].cscDetId())->second, theG->idToDet(segs[i].cscDetId())->surface()); StateSegmentMatcher estim(&tsos, &segs[i], &apeLoc); double tmp = estim.value(); if (tmp < val) { bestCSCSeg = segs[i]; val = tmp; } } return val; }
double DynamicTruncation::getBest | ( | std::vector< DTRecSegment4D > & | segs, |
TrajectoryStateOnSurface & | tsos, | ||
DTRecSegment4D & | bestDTSeg | ||
) | [private] |
Definition at line 162 of file DynamicTruncation.cc.
References dtApeMap, i, MAX_THR, edm::second(), theG, tmp, ErrorFrameTransformer::transform(), useAPE, and StateSegmentMatcher::value().
{ unsigned int i = 0; double val = MAX_THR; std::vector<DTRecSegment4D>::size_type sz = segs.size(); for (i=0; i<sz; i++) { LocalError apeLoc; //default constructor is all zeroes, OK if (useAPE) apeLoc = ErrorFrameTransformer().transform(dtApeMap.find(segs[i].chamberId())->second, theG->idToDet(segs[i].chamberId())->surface()); StateSegmentMatcher estim(&tsos, &segs[i], &apeLoc); double tmp = estim.value(); if (tmp < val) { bestDTSeg = segs[i]; val = tmp; } } return val; }
std::vector<double> DynamicTruncation::getEstimators | ( | ) | [inline] |
void DynamicTruncation::setThr | ( | int | bThr, |
int | eThr, | ||
int | useAPE_ | ||
) |
Definition at line 132 of file DynamicTruncation.cc.
References CSCThr, DTThr, MAX_THR, and useAPE.
Referenced by GlobalMuonRefitter::refit().
TransientTrackingRecHit::ConstRecHitContainer DynamicTruncation::sort | ( | ConstRecHitContainer & | recHits | ) | [private] |
Definition at line 365 of file DynamicTruncation.cc.
void DynamicTruncation::update | ( | TrajectoryStateOnSurface & | tsos, |
ConstRecHitPointer | rechit | ||
) | [private] |
Definition at line 337 of file DynamicTruncation.cc.
References currentState, TrajectoryStateOnSurface::isValid(), groupFilesInBlocks::temp, and updatorHandle.
Referenced by filter().
{ TrajectoryStateOnSurface temp = updatorHandle->update(tsos, *rechit); if (temp.isValid()) currentState = updatorHandle->update(tsos, *rechit); }
void DynamicTruncation::updateWithCSChits | ( | ConstRecHitContainer & | recHits | ) | [private] |
Definition at line 354 of file DynamicTruncation.cc.
References cscGeom, currentState, GeomDet::geographicalId(), TrajectoryStateOnSurface::isValid(), propagator, groupFilesInBlocks::temp, theG, and updatorHandle.
{ for (ConstRecHitContainer::const_iterator it = recHits.begin(); it != recHits.end(); ++it) { const CSCLayer* cscChamber = cscGeom->layer((*it)->det()->geographicalId()); CSCDetId layid = cscChamber->geographicalId(); TrajectoryStateOnSurface temp = propagator->propagate(currentState, theG->idToDet(layid)->surface()); if (temp.isValid()) currentState = updatorHandle->update(temp, **it); } }
void DynamicTruncation::updateWithDThits | ( | ConstRecHitContainer & | recHits | ) | [private] |
Definition at line 344 of file DynamicTruncation.cc.
References currentState, propagator, groupFilesInBlocks::temp, theG, and updatorHandle.
{ for (ConstRecHitContainer::const_iterator it = recHits.begin(); it != recHits.end(); ++it) { DTLayerId layid((*it)->det()->geographicalId()); TrajectoryStateOnSurface temp = propagator->propagate(currentState, theG->idToDet(layid)->surface()); if (temp.isValid()) currentState = updatorHandle->update(temp, **it); } }
std::map<CSCDetId, GlobalError> DynamicTruncation::cscApeMap [private] |
Definition at line 99 of file DynamicTruncation.h.
edm::ESHandle<CSCGeometry> DynamicTruncation::cscGeom [private] |
Definition at line 87 of file DynamicTruncation.h.
Referenced by DynamicTruncation(), and updateWithCSChits().
int DynamicTruncation::CSCThr [private] |
Definition at line 81 of file DynamicTruncation.h.
Referenced by filteringAlgo(), and setThr().
Definition at line 96 of file DynamicTruncation.h.
Referenced by GeometricSearchDet::compatibleDets(), filter(), filteringAlgo(), update(), updateWithCSChits(), and updateWithDThits().
std::map<DTChamberId, GlobalError> DynamicTruncation::dtApeMap [private] |
Definition at line 98 of file DynamicTruncation.h.
int DynamicTruncation::DTThr [private] |
Definition at line 80 of file DynamicTruncation.h.
Referenced by filteringAlgo(), and setThr().
std::vector<double> DynamicTruncation::estimators [private] |
Definition at line 95 of file DynamicTruncation.h.
Referenced by filteringAlgo(), and getEstimators().
Definition at line 92 of file DynamicTruncation.h.
Referenced by DynamicTruncation().
Definition at line 91 of file DynamicTruncation.h.
Referenced by GeometricSearchDet::compatibleDets(), DynamicTruncation(), and ~DynamicTruncation().
Definition at line 90 of file DynamicTruncation.h.
Referenced by DynamicTruncation().
edm::ESHandle<Propagator> DynamicTruncation::propagator [private] |
Definition at line 84 of file DynamicTruncation.h.
Referenced by DynamicTruncation(), filteringAlgo(), updateWithCSChits(), and updateWithDThits().
Definition at line 85 of file DynamicTruncation.h.
Referenced by GeometricSearchDet::compatibleDets(), and DynamicTruncation().
Definition at line 78 of file DynamicTruncation.h.
Referenced by filter(), and filteringAlgo().
const edm::Event* DynamicTruncation::theEvent [private] |
Definition at line 93 of file DynamicTruncation.h.
Referenced by DynamicTruncation(), and filteringAlgo().
Definition at line 86 of file DynamicTruncation.h.
Referenced by DynamicTruncation(), filteringAlgo(), getBest(), updateWithCSChits(), and updateWithDThits().
Definition at line 88 of file DynamicTruncation.h.
Referenced by DynamicTruncation(), and filteringAlgo().
const edm::EventSetup* DynamicTruncation::theSetup [private] |
Definition at line 94 of file DynamicTruncation.h.
Referenced by DynamicTruncation(), filter(), and filteringAlgo().
Definition at line 89 of file DynamicTruncation.h.
Referenced by DynamicTruncation(), filteringAlgo(), update(), updateWithCSChits(), and updateWithDThits().
bool DynamicTruncation::useAPE [private] |
Definition at line 82 of file DynamicTruncation.h.