#include <GlobalMuonRefitter.h>
class to build muon trajectory
Definition at line 39 of file GlobalMuonRefitter.h.
typedef MuonTransientTrackingRecHit::ConstMuonRecHitContainer GlobalMuonRefitter::ConstMuonRecHitContainer |
Definition at line 51 of file GlobalMuonRefitter.h.
typedef MuonTransientTrackingRecHit::ConstMuonRecHitPointer GlobalMuonRefitter::ConstMuonRecHitPointer |
Definition at line 49 of file GlobalMuonRefitter.h.
Definition at line 44 of file GlobalMuonRefitter.h.
Definition at line 46 of file GlobalMuonRefitter.h.
Definition at line 50 of file GlobalMuonRefitter.h.
Definition at line 48 of file GlobalMuonRefitter.h.
Definition at line 43 of file GlobalMuonRefitter.h.
Definition at line 45 of file GlobalMuonRefitter.h.
typedef std::vector<Trajectory> GlobalMuonRefitter::TC |
Definition at line 53 of file GlobalMuonRefitter.h.
typedef TC::const_iterator GlobalMuonRefitter::TI |
Definition at line 54 of file GlobalMuonRefitter.h.
enum GlobalMuonRefitter::RefitDirection [protected] |
Definition at line 92 of file GlobalMuonRefitter.h.
GlobalMuonRefitter::GlobalMuonRefitter | ( | const edm::ParameterSet & | par, |
const MuonServiceProxy * | service | ||
) |
constructor with Parameter Set and MuonServiceProxy
Definition at line 75 of file GlobalMuonRefitter.cc.
References Exception, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), insideOut, outsideIn, theCacheId_TRH, theCategory, theCSCChi2Cut, theDTChi2Cut, theFitterName, theHitThreshold, theMuonRecHitBuilderName, thePropagatorName, theRefitDirection, theRPCChi2Cut, theRPCInTheFit, theSkipStation, theTrackerRecHitBuilderName, theTrackerSkipSection, and theTrackerSkipSystem.
: theCosmicFlag(par.getParameter<bool>("PropDirForCosmics")), theDTRecHitLabel(par.getParameter<InputTag>("DTRecSegmentLabel")), theCSCRecHitLabel(par.getParameter<InputTag>("CSCRecSegmentLabel")), theService(service) { theCategory = par.getUntrackedParameter<string>("Category", "Muon|RecoMuon|GlobalMuon|GlobalMuonRefitter"); theHitThreshold = par.getParameter<int>("HitThreshold"); theDTChi2Cut = par.getParameter<double>("Chi2CutDT"); theCSCChi2Cut = par.getParameter<double>("Chi2CutCSC"); theRPCChi2Cut = par.getParameter<double>("Chi2CutRPC"); // Refit direction string refitDirectionName = par.getParameter<string>("RefitDirection"); if (refitDirectionName == "insideOut" ) theRefitDirection = insideOut; else if (refitDirectionName == "outsideIn" ) theRefitDirection = outsideIn; else throw cms::Exception("TrackTransformer constructor") <<"Wrong refit direction chosen in TrackTransformer ParameterSet" << "\n" << "Possible choices are:" << "\n" << "RefitDirection = insideOut or RefitDirection = outsideIn"; theFitterName = par.getParameter<string>("Fitter"); thePropagatorName = par.getParameter<string>("Propagator"); theSkipStation = par.getParameter<int>("SkipStation"); theTrackerSkipSystem = par.getParameter<int>("TrackerSkipSystem"); theTrackerSkipSection = par.getParameter<int>("TrackerSkipSection");//layer, wheel, or disk depending on the system theTrackerRecHitBuilderName = par.getParameter<string>("TrackerRecHitBuilder"); theMuonRecHitBuilderName = par.getParameter<string>("MuonRecHitBuilder"); theRPCInTheFit = par.getParameter<bool>("RefitRPCHits"); theCacheId_TRH = 0; }
GlobalMuonRefitter::~GlobalMuonRefitter | ( | ) | [virtual] |
void GlobalMuonRefitter::checkMuonHits | ( | const reco::Track & | muon, |
ConstRecHitContainer & | all, | ||
std::vector< int > & | hits | ||
) | const [protected] |
check muon RecHits, calculate chamber occupancy and select hits to be used in the final fit
Definition at line 264 of file GlobalMuonRefitter.cc.
References alongMomentum, MuonSubdetId::CSC, MuonSubdetId::DT, i, LogTrace, mag(), DetId::Muon, MuonSubdetId::RPC, relativeConstraints::station, DTChamberId::station(), CSCDetId::station(), theCategory, theCSCRecHits, and theDTRecHits.
Referenced by refit().
{ LogTrace(theCategory) << " GlobalMuonRefitter::checkMuonHits " << endl; float coneSize = 20.0; int dethits[4]; for ( int i=0; i<4; i++ ) hits[i]=dethits[i]=0; // loop through all muon hits and calculate the maximum # of hits in each chamber for (ConstRecHitContainer::const_iterator imrh = all.begin(); imrh != all.end(); imrh++ ) { if ( (*imrh != 0 ) && !(*imrh)->isValid() ) continue; int station = 0; int detRecHits = 0; MuonRecHitContainer dRecHits; DetId id = (*imrh)->geographicalId(); // Skip tracker hits if (id.det()!=DetId::Muon) continue; if ( id.subdetId() == MuonSubdetId::DT ) { DTChamberId did(id.rawId()); DTLayerId lid(id.rawId()); station = did.station(); // Get the 1d DT RechHits from this layer DTRecHitCollection::range dRecHits = theDTRecHits->get(lid); for (DTRecHitCollection::const_iterator ir = dRecHits.first; ir != dRecHits.second; ir++ ) { double rhitDistance = fabs(ir->localPosition().x()-(**imrh).localPosition().x()); if ( rhitDistance < coneSize ) detRecHits++; LogTrace(theCategory) << " " << (ir)->localPosition() << " " << (**imrh).localPosition() << " Distance: " << rhitDistance << " recHits: " << detRecHits << endl; } }// end of if DT else if ( id.subdetId() == MuonSubdetId::CSC ) { CSCDetId did(id.rawId()); station = did.station(); // Get the CSC Rechits from this layer CSCRecHit2DCollection::range dRecHits = theCSCRecHits->get(did); for (CSCRecHit2DCollection::const_iterator ir = dRecHits.first; ir != dRecHits.second; ir++ ) { double rhitDistance = (ir->localPosition()-(**imrh).localPosition()).mag(); if ( rhitDistance < coneSize ) detRecHits++; LogTrace(theCategory) << ir->localPosition() << " " << (**imrh).localPosition() << " Distance: " << rhitDistance << " recHits: " << detRecHits << endl; } } else { if ( id.subdetId() != MuonSubdetId::RPC ) LogError(theCategory)<<" Wrong Hit Type "; continue; } if ( (station > 0) && (station < 5) ) { if ( detRecHits > hits[station-1] ) hits[station-1] = detRecHits; } } // end of loop over muon rechits for ( int i = 0; i < 4; i++ ) LogTrace(theCategory) <<" Station "<<i+1<<": "<<hits[i]<<" "<<dethits[i] <<endl; LogTrace(theCategory) << "CheckMuonHits: "<<all.size(); // check order of muon measurements if ( (all.size() > 1) && ( all.front()->globalPosition().mag() > all.back()->globalPosition().mag() ) ) { LogTrace(theCategory)<< "reverse order: "; stable_sort(all.begin(),all.end(),RecHitLessByDet(alongMomentum)); } }
GlobalMuonRefitter::RefitDirection GlobalMuonRefitter::checkRecHitsOrdering | ( | const ConstRecHitContainer & | recHits | ) | const [protected] |
Definition at line 496 of file GlobalMuonRefitter.cc.
References insideOut, outsideIn, theCategory, and undetermined.
Referenced by transform().
{ if (!recHits.empty()){ ConstRecHitContainer::const_iterator frontHit = recHits.begin(); ConstRecHitContainer::const_iterator backHit = recHits.end() - 1; while( !(*frontHit)->isValid() && frontHit != backHit) {frontHit++;} while( !(*backHit)->isValid() && backHit != frontHit) {backHit--;} double rFirst = (*frontHit)->globalPosition().mag(); double rLast = (*backHit) ->globalPosition().mag(); if(rFirst < rLast) return insideOut; else if(rFirst > rLast) return outsideIn; else { LogError(theCategory) << "Impossible determine the rechits order" <<endl; return undetermined; } } else { LogError(theCategory) << "Impossible determine the rechits order" <<endl; return undetermined; } }
void GlobalMuonRefitter::getFirstHits | ( | const reco::Track & | muon, |
ConstRecHitContainer & | all, | ||
ConstRecHitContainer & | first | ||
) | const [protected] |
get the RecHits in the tracker and the first muon chamber with hits
Definition at line 347 of file GlobalMuonRefitter.cc.
References MuonSubdetId::CSC, CSCDetId, MuonSubdetId::DT, DTChamberId, i, LogTrace, DetId::Muon, DetId::rawId(), MuonSubdetId::RPC, RPCDetId, relativeConstraints::station, mergeVDriftHistosByStation::stations, and theCategory.
Referenced by refit().
{ LogTrace(theCategory) << " GlobalMuonRefitter::getFirstHits\nall rechits length:" << all.size() << endl; first.clear(); int station_to_keep = 999; vector<int> stations; for (ConstRecHitContainer::const_iterator ihit = all.begin(); ihit != all.end(); ++ihit) { int station = 0; bool use_it = true; DetId id = (*ihit)->geographicalId(); unsigned raw_id = id.rawId(); if (!(*ihit)->isValid()) station = -1; else { if (id.det() == DetId::Muon) { switch (id.subdetId()) { case MuonSubdetId::DT: station = DTChamberId(raw_id).station(); break; case MuonSubdetId::CSC: station = CSCDetId(raw_id).station(); break; case MuonSubdetId::RPC: station = RPCDetId(raw_id).station(); use_it = false; break; } } } if (use_it && station > 0 && station < station_to_keep) station_to_keep = station; stations.push_back(station); LogTrace(theCategory) << "rawId: " << raw_id << " station = " << station << " station_to_keep is now " << station_to_keep; } if (station_to_keep <= 0 || station_to_keep > 4 || stations.size() != all.size()) LogInfo(theCategory) << "failed to getFirstHits (all muon hits are outliers/bad ?)! station_to_keep = " << station_to_keep << " stations.size " << stations.size() << " all.size " << all.size(); for (unsigned i = 0; i < stations.size(); ++i) if (stations[i] >= 0 && stations[i] <= station_to_keep) first.push_back(all[i]); return; }
GlobalMuonRefitter::ConstRecHitContainer GlobalMuonRefitter::getRidOfSelectStationHits | ( | ConstRecHitContainer | hits | ) | const |
Definition at line 673 of file GlobalMuonRefitter.cc.
References MuonSubdetId::CSC, PXFDetId::disk(), MuonSubdetId::DT, TIBDetId::layer(), TOBDetId::layer(), PXBDetId::layer(), DetId::Muon, PXB, PXF, python::entryComment::results, MuonSubdetId::RPC, relativeConstraints::station, RPCDetId::station(), DTChamberId::station(), CSCDetId::station(), TEC, theSkipStation, theTrackerSkipSection, theTrackerSkipSystem, TIB, TID, TOB, DetId::Tracker, TIDDetId::wheel(), DTChamberId::wheel(), and TECDetId::wheel().
Referenced by refit().
{ ConstRecHitContainer results; ConstRecHitContainer::const_iterator it = hits.begin(); for (; it!=hits.end(); it++) { DetId id = (*it)->geographicalId(); //Check that this is a Muon hit that we're toying with -- else pass on this because the hacker is a moron / not careful if (id.det() == DetId::Tracker && theTrackerSkipSystem > 0) { int layer = -999; int disk = -999; int wheel = -999; if ( id.subdetId() == theTrackerSkipSystem){ // continue; //caveat that just removes the whole system from refitting if (theTrackerSkipSystem == PXB) { PXBDetId did(id.rawId()); layer = did.layer(); } if (theTrackerSkipSystem == TIB) { TIBDetId did(id.rawId()); layer = did.layer(); } if (theTrackerSkipSystem == TOB) { TOBDetId did(id.rawId()); layer = did.layer(); } if (theTrackerSkipSystem == PXF) { PXFDetId did(id.rawId()); disk = did.disk(); } if (theTrackerSkipSystem == TID) { TIDDetId did(id.rawId()); wheel = did.wheel(); } if (theTrackerSkipSystem == TEC) { TECDetId did(id.rawId()); wheel = did.wheel(); } if (theTrackerSkipSection >= 0 && layer == theTrackerSkipSection) continue; if (theTrackerSkipSection >= 0 && disk == theTrackerSkipSection) continue; if (theTrackerSkipSection >= 0 && wheel == theTrackerSkipSection) continue; } } if (id.det() == DetId::Muon && theSkipStation) { int station = -999; int wheel = -999; if ( id.subdetId() == MuonSubdetId::DT ) { DTChamberId did(id.rawId()); station = did.station(); wheel = did.wheel(); } else if ( id.subdetId() == MuonSubdetId::CSC ) { CSCDetId did(id.rawId()); station = did.station(); } else if ( id.subdetId() == MuonSubdetId::RPC ) { RPCDetId rpcid(id.rawId()); station = rpcid.station(); } if(station == theSkipStation) continue; } results.push_back(*it); } return results; }
void GlobalMuonRefitter::printHits | ( | const ConstRecHitContainer & | hits | ) | const [protected] |
print all RecHits of a trajectory
Definition at line 469 of file GlobalMuonRefitter.cc.
References LogTrace, pos, mathSSE::sqrt(), theCategory, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by transform().
{ LogTrace(theCategory) << "Used RecHits: " << hits.size(); for (ConstRecHitContainer::const_iterator ir = hits.begin(); ir != hits.end(); ir++ ) { if ( !(*ir)->isValid() ) { LogTrace(theCategory) << "invalid RecHit"; continue; } const GlobalPoint& pos = (*ir)->globalPosition(); LogTrace(theCategory) << "r = " << sqrt(pos.x() * pos.x() + pos.y() * pos.y()) << " z = " << pos.z() << " dimension = " << (*ir)->dimension() << " det = " << (*ir)->det()->geographicalId().det() << " subdet = " << (*ir)->det()->subDetector() << " raw id = " << (*ir)->det()->geographicalId().rawId(); } }
vector< Trajectory > GlobalMuonRefitter::refit | ( | const reco::Track & | globalTrack, |
const reco::TransientTrack | track, | ||
TransientTrackingRecHit::ConstRecHitContainer | allRecHitsTemp, | ||
const int | theMuonHitsOption | ||
) | const |
build combined trajectory from subset of sta Track and tracker RecHits
Definition at line 181 of file GlobalMuonRefitter.cc.
References alongMomentum, checkMuonHits(), DynamicTruncation::filter(), getFirstHits(), getRidOfSelectStationHits(), LogTrace, reco::TrackBase::pt(), selectMuonHits(), DynamicTruncation::setThr(), theCategory, theEvent, theService, and transform().
{ // MuonHitsOption: 0 - tracker only // 1 - include all muon hits // 2 - include only first muon hit(s) // 3 - include only selected muon hits // 4 - redo pattern recognition with dynamic truncation vector<int> stationHits(4,0); ConstRecHitContainer allRecHits; // all muon rechits ConstRecHitContainer fmsRecHits; // only first muon rechits ConstRecHitContainer selectedRecHits; // selected muon rechits ConstRecHitContainer DYTRecHits; // rec hits from dynamic truncation algorithm LogTrace(theCategory) << " *** GlobalMuonRefitter *** option " << theMuonHitsOption << endl; LogTrace(theCategory) << " Track momentum before refit: " << globalTrack.pt() << endl; LogTrace(theCategory) << " Hits size before : " << allRecHitsTemp.size() << endl; allRecHits = getRidOfSelectStationHits(allRecHitsTemp); // printHits(allRecHits); LogTrace(theCategory) << " Hits size: " << allRecHits.size() << endl; vector <Trajectory> outputTraj; if ((theMuonHitsOption == 1) || (theMuonHitsOption == 3) || (theMuonHitsOption == 4) ) { // refit the full track with all muon hits vector <Trajectory> globalTraj = transform(globalTrack, track, allRecHits); if (!globalTraj.size()) { LogTrace(theCategory) << "No trajectory from the TrackTransformer!" << endl; return vector<Trajectory>(); } LogTrace(theCategory) << " Initial trajectory state: " << globalTraj.front().lastMeasurement().updatedState().freeState()->parameters() << endl; if (theMuonHitsOption == 1 ) outputTraj.push_back(globalTraj.front()); if (theMuonHitsOption == 3 ) { checkMuonHits(globalTrack, allRecHits, stationHits); selectedRecHits = selectMuonHits(globalTraj.front(),stationHits); LogTrace(theCategory) << " Selected hits size: " << selectedRecHits.size() << endl; outputTraj = transform(globalTrack, track, selectedRecHits); } if (theMuonHitsOption == 4 ) { // here we use the single thr per subdetector (better performance can be obtained using thr as function of eta) DynamicTruncation dytRefit(*theEvent,*theService); dytRefit.setThr(30,15); //dytRefit.setThr(20,20,20,20,20,15,15,15,15,15,15,15,15); DYTRecHits = dytRefit.filter(globalTraj.front()); if ((DYTRecHits.size() > 1) && (DYTRecHits.front()->globalPosition().mag() > DYTRecHits.back()->globalPosition().mag())) stable_sort(DYTRecHits.begin(),DYTRecHits.end(),RecHitLessByDet(alongMomentum)); outputTraj = transform(globalTrack, track, DYTRecHits); } } else if (theMuonHitsOption == 2 ) { getFirstHits(globalTrack, allRecHits, fmsRecHits); outputTraj = transform(globalTrack, track, fmsRecHits); } if (outputTraj.size()) { LogTrace(theCategory) << "Refitted pt: " << outputTraj.front().firstMeasurement().updatedState().globalParameters().momentum().perp() << endl; return outputTraj; } else { LogTrace(theCategory) << "No refitted Tracks... " << endl; return vector<Trajectory>(); } }
vector< Trajectory > GlobalMuonRefitter::refit | ( | const reco::Track & | globalTrack, |
const int | theMuonHitsOption | ||
) | const |
build combined trajectory from sta Track and tracker RecHits
Definition at line 154 of file GlobalMuonRefitter.cc.
References LogTrace, DetId::Muon, theCategory, theMuonRecHitBuilder, theRPCInTheFit, theService, theTrackerRecHitBuilder, and align::Tracker.
Referenced by GlobalTrajectoryBuilderBase::build(), and GlobalTrackQualityProducer::produce().
{ LogTrace(theCategory) << " *** GlobalMuonRefitter *** option " << theMuonHitsOption << endl; ConstRecHitContainer allRecHitsTemp; // all muon rechits temp reco::TransientTrack track(globalTrack,&*(theService->magneticField()),theService->trackingGeometry()); for (trackingRecHit_iterator hit = track.recHitsBegin(); hit != track.recHitsEnd(); ++hit) if ((*hit)->isValid()) { if ((*hit)->geographicalId().det() == DetId::Tracker) allRecHitsTemp.push_back(theTrackerRecHitBuilder->build(&**hit)); else if ((*hit)->geographicalId().det() == DetId::Muon) { if ((*hit)->geographicalId().subdetId() == 3 && !theRPCInTheFit) { LogTrace(theCategory) << "RPC Rec Hit discarged"; continue; } allRecHitsTemp.push_back(theMuonRecHitBuilder->build(&**hit)); } } vector<Trajectory> refitted = refit(globalTrack,track,allRecHitsTemp,theMuonHitsOption); return refitted; }
GlobalMuonRefitter::ConstRecHitContainer GlobalMuonRefitter::selectMuonHits | ( | const Trajectory & | traj, |
const std::vector< int > & | hits | ||
) | const [protected] |
select muon hits compatible with trajectory; check hits in chambers with showers
Definition at line 395 of file GlobalMuonRefitter.cc.
References keep, LogTrace, Trajectory::measurements(), DetId::Muon, relativeConstraints::station, RPCDetId::station(), DTChamberId::station(), CSCDetId::station(), theCategory, theCSCChi2Cut, theDTChi2Cut, theHitThreshold, theRPCChi2Cut, and dtT0WireCalibration_cfg::threshold.
Referenced by refit().
{ ConstRecHitContainer muonRecHits; const double globalChi2Cut = 200.0; vector<TrajectoryMeasurement> muonMeasurements = traj.measurements(); // loop through all muon hits and skip hits with bad chi2 in chambers with high occupancy for (std::vector<TrajectoryMeasurement>::const_iterator im = muonMeasurements.begin(); im != muonMeasurements.end(); im++ ) { if ( !(*im).recHit()->isValid() ) continue; if ( (*im).recHit()->det()->geographicalId().det() != DetId::Muon ) { // if ( ( chi2ndf < globalChi2Cut ) ) muonRecHits.push_back((*im).recHit()); continue; } ConstMuonRecHitPointer immrh = dynamic_cast<const MuonTransientTrackingRecHit*>((*im).recHit().get()); DetId id = immrh->geographicalId(); int station = 0; int threshold = 0; double chi2Cut = 0.0; // get station of hit if it is in DT if ( (*immrh).isDT() ) { DTChamberId did(id.rawId()); station = did.station(); threshold = theHitThreshold; chi2Cut = theDTChi2Cut; } // get station of hit if it is in CSC else if ( (*immrh).isCSC() ) { CSCDetId did(id.rawId()); station = did.station(); threshold = theHitThreshold; chi2Cut = theCSCChi2Cut; } // get station of hit if it is in RPC else if ( (*immrh).isRPC() ) { RPCDetId rpcid(id.rawId()); station = rpcid.station(); threshold = theHitThreshold; chi2Cut = theRPCChi2Cut; } else continue; double chi2ndf = (*im).estimate()/(*im).recHit()->dimension(); bool keep = true; if ( (station>0) && (station<5) ) { if (hits[station-1]>threshold) keep = false; } if ( (keep || (chi2ndf<chi2Cut)) && (chi2ndf<globalChi2Cut) ) { muonRecHits.push_back((*im).recHit()); } else { LogTrace(theCategory) << "Skip hit: " << id.det() << " " << station << ", " << chi2ndf << " (" << chi2Cut << " chi2 threshold) " << hits[station-1] << endl; } } // check order of rechits reverse(muonRecHits.begin(),muonRecHits.end()); return muonRecHits; }
const MuonServiceProxy* GlobalMuonRefitter::service | ( | ) | const [inline, protected] |
void GlobalMuonRefitter::setEvent | ( | const edm::Event & | event | ) | [virtual] |
pass the Event to the algo at each event
Definition at line 129 of file GlobalMuonRefitter.cc.
References event(), theCSCRecHitLabel, theCSCRecHits, theDTRecHitLabel, theDTRecHits, and theEvent.
Referenced by GlobalTrackQualityProducer::produce(), and GlobalTrajectoryBuilderBase::setEvent().
{ theEvent = &event; event.getByLabel(theDTRecHitLabel, theDTRecHits); event.getByLabel(theCSCRecHitLabel, theCSCRecHits); }
void GlobalMuonRefitter::setServices | ( | const edm::EventSetup & | setup | ) |
set the services needed by the TrackTransformer
Definition at line 137 of file GlobalMuonRefitter.cc.
References edm::EventSetup::get(), LogDebug, theCacheId_TRH, theCategory, theFitter, theFitterName, theMuonRecHitBuilder, theMuonRecHitBuilderName, theService, theTrackerRecHitBuilder, and theTrackerRecHitBuilderName.
Referenced by GlobalTrackQualityProducer::produce(), and GlobalTrajectoryBuilderBase::setEvent().
{ theService->eventSetup().get<TrajectoryFitter::Record>().get(theFitterName,theFitter); // Transient Rechit Builders unsigned long long newCacheId_TRH = setup.get<TransientRecHitRecord>().cacheIdentifier(); if ( newCacheId_TRH != theCacheId_TRH ) { LogDebug(theCategory) << "TransientRecHitRecord changed!"; setup.get<TransientRecHitRecord>().get(theTrackerRecHitBuilderName,theTrackerRecHitBuilder); setup.get<TransientRecHitRecord>().get(theMuonRecHitBuilderName,theMuonRecHitBuilder); } }
vector< Trajectory > GlobalMuonRefitter::transform | ( | const reco::Track & | newTrack, |
const reco::TransientTrack | track, | ||
TransientTrackingRecHit::ConstRecHitContainer | recHitsForReFit | ||
) | const |
refit the track with a new set of RecHits
Definition at line 523 of file GlobalMuonRefitter.cc.
References alongMomentum, PV3DBase< T, PVType, FrameType >::basicVector(), checkRecHitsOrdering(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), reco::Track::innerDetId(), reco::TransientTrack::innermostMeasurementState(), insideOut, LogDebug, LogTrace, PV3DBase< T, PVType, FrameType >::mag(), oppositeToMomentum, reco::Track::outerDetId(), reco::TransientTrack::outermostMeasurementState(), outsideIn, printHits(), theCategory, theCosmicFlag, theFitter, thePropagatorName, theRefitDirection, and theService.
Referenced by refit().
{ LogTrace(theCategory) << "GlobalMuonRefitter::transform: " << recHitsForReFit.size() << " hits:"; printHits(recHitsForReFit); if(recHitsForReFit.size() < 2) return vector<Trajectory>(); // Check the order of the rechits RefitDirection recHitsOrder = checkRecHitsOrdering(recHitsForReFit); LogTrace(theCategory) << "checkRecHitsOrdering() returned " << recHitsOrder << ", theRefitDirection is " << theRefitDirection << " (insideOut == " << insideOut << ", outsideIn == " << outsideIn << ")"; // Reverse the order in the case of inconsistency between the fit direction and the rechit order if(theRefitDirection != recHitsOrder) reverse(recHitsForReFit.begin(),recHitsForReFit.end()); // Even though we checked the rechits' ordering above, we may have // already flipped them elsewhere (getFirstHits() is such a // culprit). Use the global positions of the states and the desired // refit direction to find the starting TSOS. TrajectoryStateOnSurface firstTSOS, lastTSOS; unsigned int innerId, outerId; bool order_swapped = track.outermostMeasurementState().globalPosition().mag() < track.innermostMeasurementState().globalPosition().mag(); bool inner_is_first; LogTrace(theCategory) << "order swapped? " << order_swapped; // Fill the starting state, depending on the ordering above. if ((theRefitDirection == insideOut && !order_swapped) || (theRefitDirection == outsideIn && order_swapped)) { innerId = newTrack.innerDetId(); outerId = newTrack.outerDetId(); firstTSOS = track.innermostMeasurementState(); lastTSOS = track.outermostMeasurementState(); inner_is_first = true; } else { innerId = newTrack.outerDetId(); outerId = newTrack.innerDetId(); firstTSOS = track.outermostMeasurementState(); lastTSOS = track.innermostMeasurementState(); inner_is_first = false; } LogTrace(theCategory) << "firstTSOS: inner_is_first? " << inner_is_first << " globalPosition is " << firstTSOS.globalPosition() << " innerId is " << innerId; if(!firstTSOS.isValid()){ LogWarning(theCategory) << "Error wrong initial state!" << endl; return vector<Trajectory>(); } firstTSOS.rescaleError(1000.); // This is the only way to get a TrajectorySeed with settable propagation direction PTrajectoryStateOnDet garbage1; edm::OwnVector<TrackingRecHit> garbage2; PropagationDirection propDir = (firstTSOS.globalPosition().basicVector().dot(firstTSOS.globalMomentum().basicVector())>0) ? alongMomentum : oppositeToMomentum; // These lines cause the code to ignore completely what was set // above, and force propDir for tracks from collisions! // if(propDir == alongMomentum && theRefitDirection == outsideIn) propDir=oppositeToMomentum; // if(propDir == oppositeToMomentum && theRefitDirection == insideOut) propDir=alongMomentum; const TrajectoryStateOnSurface& tsosForDir = inner_is_first ? lastTSOS : firstTSOS; propDir = (tsosForDir.globalPosition().basicVector().dot(tsosForDir.globalMomentum().basicVector())>0) ? alongMomentum : oppositeToMomentum; LogTrace(theCategory) << "propDir based on firstTSOS x dot p is " << propDir << " (alongMomentum == " << alongMomentum << ", oppositeToMomentum == " << oppositeToMomentum << ")"; // Additional propagation diretcion determination logic for cosmic muons if (theCosmicFlag) { PropagationDirection propDir_first = (firstTSOS.globalPosition().basicVector().dot(firstTSOS.globalMomentum().basicVector()) > 0) ? alongMomentum : oppositeToMomentum; PropagationDirection propDir_last = (lastTSOS .globalPosition().basicVector().dot(lastTSOS .globalMomentum().basicVector()) > 0) ? alongMomentum : oppositeToMomentum; LogTrace(theCategory) << "propDir_first " << propDir_first << ", propdir_last " << propDir_last << " : they " << (propDir_first == propDir_last ? "agree" : "disagree"); int y_count = 0; for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator it = recHitsForReFit.begin(); it != recHitsForReFit.end(); ++it) { if ((*it)->globalPosition().y() > 0) ++y_count; else --y_count; } PropagationDirection propDir_ycount = alongMomentum; if (y_count > 0) { if (theRefitDirection == insideOut) propDir_ycount = oppositeToMomentum; else if (theRefitDirection == outsideIn) propDir_ycount = alongMomentum; } else { if (theRefitDirection == insideOut) propDir_ycount = alongMomentum; else if (theRefitDirection == outsideIn) propDir_ycount = oppositeToMomentum; } LogTrace(theCategory) << "y_count = " << y_count << "; based on geometrically-outermost TSOS, propDir is " << propDir << ": " << (propDir == propDir_ycount ? "agrees" : "disagrees") << " with ycount determination"; if (propDir_first != propDir_last) { LogTrace(theCategory) << "since first/last disagreed, using y_count propDir"; propDir = propDir_ycount; } } TrajectorySeed seed(garbage1,garbage2,propDir); if(recHitsForReFit.front()->geographicalId() != DetId(innerId)){ LogDebug(theCategory)<<"Propagation occured"<<endl; LogTrace(theCategory) << "propagating firstTSOS at " << firstTSOS.globalPosition() << " to first rechit with surface pos " << recHitsForReFit.front()->det()->surface().toGlobal(LocalPoint(0,0,0)); firstTSOS = theService->propagator(thePropagatorName)->propagate(firstTSOS, recHitsForReFit.front()->det()->surface()); if(!firstTSOS.isValid()){ LogDebug(theCategory)<<"Propagation error!"<<endl; return vector<Trajectory>(); } } /* cout << " GlobalMuonRefitter : theFitter " << propDir << endl; cout << " First TSOS: " << firstTSOS.globalPosition() << " p=" << firstTSOS.globalMomentum() << " = " << firstTSOS.globalMomentum().mag() << endl; cout << " Starting seed: " << " nHits= " << seed.nHits() << " tsos: " << seed.startingState().parameters().position() << " p=" << seed.startingState().parameters().momentum() << endl; cout << " RecHits: " << recHitsForReFit.size() << endl; */ vector<Trajectory> trajectories = theFitter->fit(seed,recHitsForReFit,firstTSOS); if(trajectories.empty()){ LogDebug(theCategory) << "No Track refitted!" << endl; return vector<Trajectory>(); } return trajectories; }
unsigned long long GlobalMuonRefitter::theCacheId_TRH [private] |
Definition at line 137 of file GlobalMuonRefitter.h.
Referenced by GlobalMuonRefitter(), and setServices().
std::string GlobalMuonRefitter::theCategory [protected] |
Definition at line 114 of file GlobalMuonRefitter.h.
Referenced by checkMuonHits(), checkRecHitsOrdering(), getFirstHits(), GlobalMuonRefitter(), printHits(), refit(), selectMuonHits(), setServices(), and transform().
bool GlobalMuonRefitter::theCosmicFlag [private] |
Definition at line 126 of file GlobalMuonRefitter.h.
Referenced by transform().
float GlobalMuonRefitter::theCSCChi2Cut [private] |
Definition at line 124 of file GlobalMuonRefitter.h.
Referenced by GlobalMuonRefitter(), and selectMuonHits().
Definition at line 129 of file GlobalMuonRefitter.h.
Referenced by setEvent().
Definition at line 131 of file GlobalMuonRefitter.h.
Referenced by checkMuonHits(), and setEvent().
float GlobalMuonRefitter::theDTChi2Cut [private] |
Definition at line 123 of file GlobalMuonRefitter.h.
Referenced by GlobalMuonRefitter(), and selectMuonHits().
Definition at line 128 of file GlobalMuonRefitter.h.
Referenced by setEvent().
Definition at line 130 of file GlobalMuonRefitter.h.
Referenced by checkMuonHits(), and setEvent().
const edm::Event* GlobalMuonRefitter::theEvent [private] |
Definition at line 155 of file GlobalMuonRefitter.h.
Referenced by refit(), and setEvent().
Definition at line 146 of file GlobalMuonRefitter.h.
Referenced by setServices(), and transform().
std::string GlobalMuonRefitter::theFitterName [private] |
Definition at line 145 of file GlobalMuonRefitter.h.
Referenced by GlobalMuonRefitter(), and setServices().
int GlobalMuonRefitter::theHitThreshold [private] |
Definition at line 122 of file GlobalMuonRefitter.h.
Referenced by GlobalMuonRefitter(), and selectMuonHits().
int GlobalMuonRefitter::theMuonHitsOption [private] |
Definition at line 120 of file GlobalMuonRefitter.h.
Definition at line 152 of file GlobalMuonRefitter.h.
Referenced by refit(), and setServices().
std::string GlobalMuonRefitter::theMuonRecHitBuilderName [private] |
Definition at line 151 of file GlobalMuonRefitter.h.
Referenced by GlobalMuonRefitter(), and setServices().
float GlobalMuonRefitter::theProbCut [private] |
Definition at line 121 of file GlobalMuonRefitter.h.
std::string GlobalMuonRefitter::thePropagatorName [private] |
Definition at line 139 of file GlobalMuonRefitter.h.
Referenced by GlobalMuonRefitter(), and transform().
float GlobalMuonRefitter::thePtCut [protected] |
Definition at line 116 of file GlobalMuonRefitter.h.
Definition at line 143 of file GlobalMuonRefitter.h.
Referenced by GlobalMuonRefitter(), and transform().
float GlobalMuonRefitter::theRPCChi2Cut [private] |
Definition at line 125 of file GlobalMuonRefitter.h.
Referenced by GlobalMuonRefitter(), and selectMuonHits().
bool GlobalMuonRefitter::theRPCInTheFit [private] |
Definition at line 141 of file GlobalMuonRefitter.h.
Referenced by GlobalMuonRefitter(), and refit().
const MuonServiceProxy* GlobalMuonRefitter::theService [private] |
Definition at line 154 of file GlobalMuonRefitter.h.
Referenced by refit(), service(), setServices(), and transform().
int GlobalMuonRefitter::theSkipStation [private] |
Definition at line 133 of file GlobalMuonRefitter.h.
Referenced by getRidOfSelectStationHits(), and GlobalMuonRefitter().
bool GlobalMuonRefitter::theTkTrajsAvailableFlag [protected] |
Definition at line 115 of file GlobalMuonRefitter.h.
Definition at line 149 of file GlobalMuonRefitter.h.
Referenced by refit(), and setServices().
std::string GlobalMuonRefitter::theTrackerRecHitBuilderName [private] |
Definition at line 148 of file GlobalMuonRefitter.h.
Referenced by GlobalMuonRefitter(), and setServices().
int GlobalMuonRefitter::theTrackerSkipSection [private] |
Definition at line 135 of file GlobalMuonRefitter.h.
Referenced by getRidOfSelectStationHits(), and GlobalMuonRefitter().
int GlobalMuonRefitter::theTrackerSkipSystem [private] |
Definition at line 134 of file GlobalMuonRefitter.h.
Referenced by getRidOfSelectStationHits(), and GlobalMuonRefitter().