80 Event&
event,
const string& instance,
bool reallyDoSmoothing) {
84 const string metname =
"Muon|RecoMuon|MuonTrackLoader";
111 auto_ptr<vector<Trajectory> > trajectoryCollection(
new vector<Trajectory>);
117 if ( trajectories.empty() ) {
118 event.put(recHitCollection,instance);
119 event.put(trackExtraCollection,instance);
121 event.put(trajectoryCollection,instance);
122 event.put( trajTrackMap, instance );
125 event.put(trackToTrackmap);
126 event.put(updatedAtVtxTrackCollection,instance+
"UpdatedAtVtx");
134 LogTrace(metname) <<
"Create the collection of Tracks";
144 std::map<unsigned int, unsigned int> tjTkMap;
150 for(TrajectoryContainer::const_iterator rawTrajectory = trajectories.begin();
151 rawTrajectory != trajectories.end(); ++rawTrajectory){
156 vector<Trajectory> trajectoriesSM =
theSmoother->trajectories(**rawTrajectory);
158 if(!trajectoriesSM.empty()) {
160 trajectory = trajectoriesSM.front();
164 LogInfo(metname)<<
"The trajectory has not been smoothed!"<<endl;
168 trajectoryCollection->push_back(trajectory);
176 reverse(transHits.begin(),transHits.end());
180 pair<bool,reco::Track> resultOfTrackExtrapAtPCA =
buildTrackAtPCA(trajectory, *beamSpot);
183 if(!resultOfTrackExtrapAtPCA.first) {
184 delete *rawTrajectory;
201 pair<bool,reco::Track> updateResult(
false,
reco::Track());
207 if(!updateResult.first) ++trackIndex;
211 updateResult.second.setExtra(trackExtraRef);
214 trackToTrackmap->insert(
reco::TrackRef(trackCollectionRefProd,trackIndex++),
215 reco::TrackRef(trackUpdatedCollectionRefProd,trackUpdatedIndex++));
221 for (Trajectory::RecHitContainer::const_iterator recHit = transHits.begin();
222 recHit != transHits.end(); ++recHit) {
225 if(
theUpdatingAtVtx && updateResult.first) updateResult.second.setHitPattern( *singleHit, i-1 );
226 recHitCollection->push_back( singleHit );
232 trackExtraCollection->push_back(trackExtra);
237 LogTrace(metname) <<
"Debug Track being loaded pt "<< track.
pt();
240 updatedAtVtxTrackCollection->push_back(updateResult.second);
245 delete *rawTrajectory;
253 LogTrace(metname) <<
"put the Collections in the event";
254 event.put(recHitCollection,instance);
255 event.put(trackExtraCollection,instance);
261 event.put(trackToTrackmap);
262 returnTrackHandle =
event.put(updatedAtVtxTrackCollection,instance+
"UpdatedAtVtx");
266 nonUpdatedHandle = returnTrackHandle;
272 for ( std::map<unsigned int, unsigned int>::iterator i = tjTkMap.begin();
273 i != tjTkMap.end(); i++ ) {
274 trajTrackMap->insert(
edm::Ref<std::vector<Trajectory> >( rTrajs, (*i).first ),
277 event.put( trajTrackMap, instance );
280 return returnTrackHandle;
287 const string metname =
"Muon|RecoMuon|MuonTrackLoader";
293 if ( muonCands.empty() ) {
298 event.put(recHitCollection);
299 event.put(trackExtraCollection);
300 event.put(trackCollection);
309 return event.put(trackLinksCollection);
315 for (CandidateContainer::const_iterator it = muonCands.begin(); it != muonCands.end(); it++) {
316 LogDebug(metname) <<
"Loader glbSeedRef " << (*it)->trajectory()->seedRef().isNonnull();
317 if ((*it)->trackerTrajectory() )
LogDebug(metname) <<
" " <<
"tkSeedRef " << (*it)->trackerTrajectory()->seedRef().isNonnull();
319 combinedTrajs.push_back((*it)->trajectory());
323 if ((*it)->trackerTrajectory())
delete ((*it)->trackerTrajectory());
330 trackLinksCollection->push_back(links);
336 LogTrace(metname) <<
"Build combinedTracks";
341 LogTrace(metname) <<
"Build trackerTracks: "
342 << trackerTrajs.size();
345 for (TrajectoryContainer::iterator it = trackerTrajs.begin(); it != trackerTrajs.end(); ++it) {
350 LogTrace(metname) <<
"Set the final links in the MuonTrackLinks collection";
352 reco::MuonTrackLinksCollection::iterator links = trackLinksCollection->begin();
360 links->setGlobalTrack(combinedTR);
365 LogWarning(metname)<<
"The MuonTrackLinkCollection is incomplete";
368 LogTrace(metname) <<
"put the MuonCollection in the event" <<
"\n";
370 return event.put(trackLinksCollection);
375 Event& event, std::vector<std::pair<Trajectory*,reco::TrackRef> > miniMap,
const string& instance,
bool reallyDoSmoothing) {
379 const string metname =
"Muon|RecoMuon|MuonTrackLoader|TevMuonTrackLoader";
381 LogDebug(metname)<<
"TeV LoadTracks instance: " << instance;
402 auto_ptr<vector<Trajectory> > trajectoryCollection(
new vector<Trajectory>);
408 if ( trajectories.empty() ) {
409 event.put(recHitCollection,instance);
410 event.put(trackExtraCollection,instance);
412 event.put(trajectoryCollection,instance);
413 event.put( trajTrackMap, instance );
415 event.put(trackToTrackmap, instance);
419 LogTrace(metname) <<
"Create the collection of Tracks";
432 std::map<unsigned int, unsigned int> tjTkMap;
438 for(TrajectoryContainer::const_iterator rawTrajectory = trajectories.begin();
439 rawTrajectory != trajectories.end(); ++rawTrajectory){
442 std::vector<std::pair<Trajectory*,reco::TrackRef> >::const_iterator mmit;
443 for(mmit = miniMap.begin();mmit!=miniMap.end();++mmit){
444 if(mmit->first == *rawTrajectory) glbRef = mmit->second;
450 vector<Trajectory> trajectoriesSM =
theSmoother->trajectories(**rawTrajectory);
452 if(!trajectoriesSM.empty()) {
454 trajectory = trajectoriesSM.front();
457 LogInfo(metname)<<
"The trajectory has not been smoothed!"<<endl;
461 trajectoryCollection->push_back(trajectory);
469 reverse(transHits.begin(),transHits.end());
473 pair<bool,reco::Track> resultOfTrackExtrapAtPCA =
buildTrackAtPCA(trajectory, *beamSpot);
476 if(!resultOfTrackExtrapAtPCA.first) {
478 delete *rawTrajectory;
483 reco::Track &track = resultOfTrackExtrapAtPCA.second;
495 trackToTrackmap->insert(glbRef,
499 pair<bool,reco::Track> updateResult(
false,
reco::Track());
503 for (Trajectory::RecHitContainer::const_iterator recHit = transHits.begin();
504 recHit != transHits.end(); ++recHit) {
507 if(
theUpdatingAtVtx && updateResult.first) updateResult.second.setHitPattern( *singleHit, i-1 );
508 recHitCollection->push_back( singleHit );
514 trackExtraCollection->push_back(trackExtra);
519 LogTrace(metname) <<
"Debug Track being loaded pt "<< track.
pt();
524 delete *rawTrajectory;
532 LogTrace(metname) <<
"put the Collections in the event";
533 event.put(recHitCollection,instance);
534 event.put(trackExtraCollection,instance);
541 event.put(trackToTrackmap,instance);
543 nonUpdatedHandle = returnTrackHandle;
549 for ( std::map<unsigned int, unsigned int>::iterator i = tjTkMap.begin();
550 i != tjTkMap.end(); i++ ) {
551 trajTrackMap->insert(
edm::Ref<std::vector<Trajectory> >( rTrajs, (*i).first ),
554 event.put( trajTrackMap, instance );
557 return returnTrackHandle;
563 const string metname =
"Muon|RecoMuon|MuonTrackLoader";
571 LogTrace(metname) <<
"Propagate to PCA...";
572 pair<bool,FreeTrajectoryState>
576 if(extrapolationResult.first)
577 ftsAtVtx = extrapolationResult.second;
580 LogInfo(metname) <<
"Track in the Tracker: taking the innermost state instead of the state at PCA";
585 LogInfo(metname) <<
"Propagation to PCA failed, taking the innermost state instead of the state at PCA";
588 LogInfo(metname) <<
"Stand Alone track: this track will be rejected";
589 return pair<bool,reco::Track>(
false,
reco::Track());
594 LogTrace(metname) <<
"TSOS after the extrapolation at vtx";
604 double ndof = trajectory.
ndof(bon);
613 return pair<bool,reco::Track>(
true,
track);
619 const string metname =
"Muon|RecoMuon|MuonTrackLoader";
627 LogTrace(metname) <<
"Apply the vertex constraint";
630 if(!updateResult.first){
631 return pair<bool,reco::Track>(
false,
reco::Track());
634 LogTrace(metname) <<
"FTS after the vertex constraint";
651 return pair<bool,reco::Track>(
true,updatedTrack);
657 const string metname =
"Muon|RecoMuon|MuonTrackLoader";
667 unsigned int innerId=0, outerId=0;
681 LogTrace(metname)<<
"oppositeToMomentum";
689 else LogError(metname)<<
"Wrong propagation direction!";
699 LogTrace(metname)<<
"The Global Muon outerMostMeasurementState is not compatible with the recHit detector! Setting outerMost postition to recHit position if recHit isValid: " << outerRecHit->isValid();
700 LogTrace(metname)<<
"From " << outerTSOSPos <<
" to " << hitPos;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
static bool isInside(const GlobalPoint &)
MuonTrackLoader(edm::ParameterSet ¶meterSet, const MuonServiceProxy *service=0)
Constructor for the STA reco the args must be specify!
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
const std::string metname
const CurvilinearTrajectoryError & curvilinearError() const
bool theSmoothTkTrackFlag
Global3DPoint GlobalPoint
std::vector< Track > TrackCollection
collection of Tracks
std::string theSmootherName
std::pair< bool, FreeTrajectoryState > propagate(const TrajectoryStateOnSurface &tsos, const reco::BeamSpot &beamSpot) const
Propagate the state to the 2D-PCA.
GlobalPoint globalPosition() const
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
ConstRecHitPointer recHit() const
TrackCharge charge() const
TrajectoryStateOnSurface geometricalInnermostState() const
const CurvilinearTrajectoryError & curvilinearError() const
static int position[TOTALCHAMBERS][3]
std::vector< MuonTrackLinks > MuonTrackLinksCollection
collection of MuonTrackLinks
MuonCandidate::CandidateContainer CandidateContainer
const MuonServiceProxy * theService
ConstRecHitContainer recHits(bool splitting=false) const
std::string dumpFTS(const FreeTrajectoryState &fts) const
PropagationDirection const & direction() const
edm::InputTag theBeamSpotInputTag
FreeTrajectoryState * freeState(bool withErrors=true) const
double chi2() const
chi-squared of the fit
void setTrackerTrack(reco::TrackRef tk)
set the ref to tracker's track
std::pair< bool, FreeTrajectoryState > update(const reco::TransientTrack &track, const reco::BeamSpot &beamSpot) const
Applies the vertex constraint.
double ndof() const
number of degrees of freedom of the fit
edm::Ref< TrackingRecHitCollection > TrackingRecHitRef
persistent reference to a TrackingRecHit
virtual ~MuonTrackLoader()
Destructor.
TrajectoryMeasurement const & lastMeasurement() const
double pt() const
track transverse momentum
GlobalVector momentum() const
tuple MuonUpdatorAtVertex
TrajectoryStateOnSurface updatedState() const
edm::RefToBase< TrajectorySeed > seedRef(void) const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > > TrajTrackAssociationCollection
MuonUpdatorAtVertex * theUpdatorAtVtx
GlobalVector momentum() const
MuonCandidate::TrajectoryContainer TrajectoryContainer
GlobalPoint position() const
virtual TrackingRecHit * clone() const =0
GlobalPoint position() const
int ndof(bool bon=true) const
const Bounds & bounds() const
void setHitPattern(const C &c)
set hit patterns from vector of hit references
edm::OrphanHandle< reco::TrackCollection > loadTracks(const TrajectoryContainer &, edm::Event &, const std::string &="", bool=true)
Convert the trajectories into tracks and load the tracks in the event.
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
void setExtra(const TrackExtraRef &ref)
set reference to "extra" object
TrajectoryMeasurement const & firstMeasurement() const
const GlobalTrajectoryParameters & globalParameters() const
std::string theL2SeededTkLabel
Label for L2SeededTracks.
XYZVectorD XYZVector
spatial vector with cartesian internal representation
ConstRecHitContainer RecHitContainer
XYZPointD XYZPoint
point in space with cartesian internal representation
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
reco::TrackExtra buildTrackExtra(const Trajectory &) const
void setSeedRef(const edm::RefToBase< TrajectorySeed > &seedRef)
std::pair< bool, reco::Track > buildTrackAtPCA(const Trajectory &trajectory, const reco::BeamSpot &) const
Build a track at the PCA WITHOUT any vertex constriant.
void setStandAloneTrack(reco::TrackRef sta)
set the ref to stand alone track
edm::ESHandle< TrajectorySmoother > theSmoother
const MuonServiceProxy * theService
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type
bool isNonnull() const
Checks for non-null.
std::pair< bool, reco::Track > buildTrackUpdatedAtPCA(const reco::Track &trackAtPCA, const reco::BeamSpot &) const
Takes a track at the PCA and applies the vertex constriant.
virtual const BoundPlane & surface() const
The nominal surface of the GeomDet.
double chiSquared() const