82 std::vector<bool> dummyVecBool;
83 return loadTracks(trajectories, event, dummyVecBool, instance, reallyDoSmoothing);
89 const string&
instance,
bool reallyDoSmoothing) {
93 const string metname =
"Muon|RecoMuon|MuonTrackLoader";
120 auto_ptr<vector<Trajectory> > trajectoryCollection(
new vector<Trajectory>);
126 if ( trajectories.empty() ) {
127 event.put(recHitCollection,instance);
128 event.put(trackExtraCollection,instance);
130 event.put(trajectoryCollection,instance);
131 event.put( trajTrackMap, instance );
134 event.put(trackToTrackmap);
135 event.put(updatedAtVtxTrackCollection,instance+
"UpdatedAtVtx");
137 return event.put(trackCollection,instance);
143 LogTrace(metname) <<
"Create the collection of Tracks";
153 std::map<unsigned int, unsigned int> tjTkMap;
158 unsigned int tjCnt = 0;
159 for(TrajectoryContainer::const_iterator rawTrajectory = trajectories.begin();
160 rawTrajectory != trajectories.end(); ++rawTrajectory, ++tjCnt){
165 vector<Trajectory> trajectoriesSM =
theSmoother->trajectories(**rawTrajectory);
167 if(!trajectoriesSM.empty()) {
169 trajectory = trajectoriesSM.front();
173 LogInfo(metname)<<
"The trajectory has not been smoothed!"<<endl;
177 trajectoryCollection->push_back(trajectory);
185 reverse(transHits.begin(),transHits.end());
189 pair<bool,reco::Track> resultOfTrackExtrapAtPCA =
buildTrackAtPCA(trajectory, *beamSpot);
192 if(!resultOfTrackExtrapAtPCA.first) {
193 delete *rawTrajectory;
198 reco::Track &track = resultOfTrackExtrapAtPCA.second;
210 pair<bool,reco::Track> updateResult(
false,
reco::Track());
216 if(!updateResult.first) ++trackIndex;
220 updateResult.second.setExtra(trackExtraRef);
223 trackToTrackmap->insert(
reco::TrackRef(trackCollectionRefProd,trackIndex++),
224 reco::TrackRef(trackUpdatedCollectionRefProd,trackUpdatedIndex++));
229 for (Trajectory::RecHitContainer::const_iterator recHit = transHits.begin();
230 recHit != transHits.end(); ++recHit) {
233 if(
theUpdatingAtVtx && updateResult.first) updateResult.second.appendHitPattern(*singleHit);
234 recHitCollection->push_back( singleHit );
240 trackExtraCollection->push_back(trackExtra);
243 trackCollection->push_back(track);
245 LogTrace(metname) <<
"Debug Track being loaded pt "<< track.
pt();
248 updatedAtVtxTrackCollection->push_back(updateResult.second);
253 delete *rawTrajectory;
255 if(tkBoolVec.size()>tjCnt) tkBoolVec[tjCnt] =
true;
262 LogTrace(metname) <<
"put the Collections in the event";
263 event.put(recHitCollection,instance);
264 event.put(trackExtraCollection,instance);
269 nonUpdatedHandle =
event.put(trackCollection,instance);
270 event.put(trackToTrackmap);
271 returnTrackHandle =
event.put(updatedAtVtxTrackCollection,instance+
"UpdatedAtVtx");
274 returnTrackHandle =
event.put(trackCollection,instance);
275 nonUpdatedHandle = returnTrackHandle;
281 for ( std::map<unsigned int, unsigned int>::iterator
i = tjTkMap.begin();
282 i != tjTkMap.end();
i++ ) {
283 trajTrackMap->insert(
edm::Ref<std::vector<Trajectory> >( rTrajs, (*i).first ),
286 event.put( trajTrackMap, instance );
289 return returnTrackHandle;
296 const string metname =
"Muon|RecoMuon|MuonTrackLoader";
302 if ( muonCands.empty() ) {
307 event.put(recHitCollection);
308 event.put(trackExtraCollection);
309 event.put(trackCollection);
318 return event.put(trackLinksCollection);
324 for (CandidateContainer::const_iterator it = muonCands.begin(); it != muonCands.end(); ++it) {
325 LogDebug(metname) <<
"Loader glbSeedRef " << (*it)->trajectory()->seedRef().isNonnull();
326 if ((*it)->trackerTrajectory() )
LogDebug(metname) <<
" " <<
"tkSeedRef " << (*it)->trackerTrajectory()->seedRef().isNonnull();
328 combinedTrajs.push_back((*it)->trajectory());
332 if ((*it)->trackerTrajectory())
delete ((*it)->trackerTrajectory());
345 LogTrace(metname) <<
"Build combinedTracks";
346 std::vector<bool> combTksVec(combinedTrajs.size(),
false);
350 std::vector<bool> trackerTksVec(trackerTrajs.size(),
false);
352 LogTrace(metname) <<
"Build trackerTracks: "
353 << trackerTrajs.size();
356 for (TrajectoryContainer::iterator it = trackerTrajs.begin(); it != trackerTrajs.end(); ++it) {
361 LogTrace(metname) <<
"Set the final links in the MuonTrackLinks collection";
363 unsigned int candposition(0),
position(0), tkposition(0);
367 for (CandidateContainer::const_iterator it = muonCands.begin(); it != muonCands.end(); ++it, ++candposition) {
374 if(combTksVec[candposition]) {
389 trackLinksCollection->push_back(links);
400 LogWarning(metname)<<
"The MuonTrackLinkCollection is incomplete";
403 LogTrace(metname) <<
"put the MuonCollection in the event" <<
"\n";
405 return event.put(trackLinksCollection);
410 Event& event,
const std::vector<std::pair<Trajectory*,reco::TrackRef> >& miniMap,
const string& instance,
bool reallyDoSmoothing) {
414 const string metname =
"Muon|RecoMuon|MuonTrackLoader|TevMuonTrackLoader";
437 auto_ptr<vector<Trajectory> > trajectoryCollection(
new vector<Trajectory>);
443 if ( trajectories.empty() ) {
444 event.put(recHitCollection,instance);
445 event.put(trackExtraCollection,instance);
447 event.put(trajectoryCollection,instance);
448 event.put( trajTrackMap, instance );
450 event.put(trackToTrackmap, instance);
451 return event.put(trackCollection,instance);
454 LogTrace(metname) <<
"Create the collection of Tracks";
467 std::map<unsigned int, unsigned int> tjTkMap;
473 for(TrajectoryContainer::const_iterator rawTrajectory = trajectories.begin();
474 rawTrajectory != trajectories.end(); ++rawTrajectory){
477 std::vector<std::pair<Trajectory*,reco::TrackRef> >::const_iterator mmit;
478 for(mmit = miniMap.begin();mmit!=miniMap.end();++mmit){
479 if(mmit->first == *rawTrajectory) glbRef = mmit->second;
485 vector<Trajectory> trajectoriesSM =
theSmoother->trajectories(**rawTrajectory);
487 if(!trajectoriesSM.empty()) {
489 trajectory = trajectoriesSM.front();
492 LogInfo(metname)<<
"The trajectory has not been smoothed!"<<endl;
496 trajectoryCollection->push_back(trajectory);
504 reverse(transHits.begin(),transHits.end());
508 pair<bool,reco::Track> resultOfTrackExtrapAtPCA =
buildTrackAtPCA(trajectory, *beamSpot);
511 if(!resultOfTrackExtrapAtPCA.first) {
513 delete *rawTrajectory;
518 reco::Track &track = resultOfTrackExtrapAtPCA.second;
530 trackToTrackmap->insert(glbRef,
534 pair<bool,reco::Track> updateResult(
false,
reco::Track());
537 for (Trajectory::RecHitContainer::const_iterator recHit = transHits.begin();
538 recHit != transHits.end(); ++recHit) {
541 if(
theUpdatingAtVtx && updateResult.first) updateResult.second.appendHitPattern( *singleHit);
542 recHitCollection->push_back( singleHit );
548 trackExtraCollection->push_back(trackExtra);
551 trackCollection->push_back(track);
553 LogTrace(metname) <<
"Debug Track being loaded pt "<< track.
pt();
558 delete *rawTrajectory;
566 LogTrace(metname) <<
"put the Collections in the event";
567 event.put(recHitCollection,instance);
568 event.put(trackExtraCollection,instance);
575 event.put(trackToTrackmap,instance);
576 returnTrackHandle =
event.put(trackCollection,instance);
577 nonUpdatedHandle = returnTrackHandle;
583 for ( std::map<unsigned int, unsigned int>::iterator
i = tjTkMap.begin();
584 i != tjTkMap.end();
i++ ) {
585 trajTrackMap->insert(
edm::Ref<std::vector<Trajectory> >( rTrajs, (*i).first ),
588 event.put( trajTrackMap, instance );
591 return returnTrackHandle;
597 const string metname =
"Muon|RecoMuon|MuonTrackLoader";
605 LogTrace(metname) <<
"Propagate to PCA...";
606 pair<bool,FreeTrajectoryState>
610 if(extrapolationResult.first)
611 ftsAtVtx = extrapolationResult.second;
614 LogInfo(metname) <<
"Track in the Tracker: taking the innermost state instead of the state at PCA";
619 LogInfo(metname) <<
"Propagation to PCA failed, taking the innermost state instead of the state at PCA";
622 LogInfo(metname) <<
"Stand Alone track: this track will be rejected";
623 return pair<bool,reco::Track>(
false,
reco::Track());
628 LogTrace(metname) <<
"TSOS after the extrapolation at vtx";
638 double ndof = trajectory.
ndof(bon);
647 return pair<bool,reco::Track>(
true,track);
653 const string metname =
"Muon|RecoMuon|MuonTrackLoader";
661 LogTrace(metname) <<
"Apply the vertex constraint";
664 if(!updateResult.first){
665 return pair<bool,reco::Track>(
false,
reco::Track());
668 LogTrace(metname) <<
"FTS after the vertex constraint";
685 return pair<bool,reco::Track>(
true,updatedTrack);
691 const string metname =
"Muon|RecoMuon|MuonTrackLoader";
701 unsigned int innerId=0, outerId=0;
715 LogTrace(metname)<<
"oppositeToMomentum";
723 else LogError(metname)<<
"Wrong propagation direction!";
733 LogTrace(metname)<<
"The Global Muon outerMostMeasurementState is not compatible with the recHit detector! Setting outerMost postition to recHit position if recHit isValid: " << outerRecHit->isValid();
734 LogTrace(metname)<<
"From " << outerTSOSPos <<
" to " << hitPos;
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::BeamSpot > theBeamSpotToken
T getUntrackedParameter(std::string const &, T const &) const
MuonTrackLoader(edm::ParameterSet ¶meterSet, edm::ConsumesCollector &iC, const MuonServiceProxy *service=0)
Constructor for the STA reco the args must be specify!
static bool isInside(const GlobalPoint &)
ConstRecHitPointer const & recHit() const
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
static PFTauRenderPlugin instance
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.
const Bounds & bounds() const
TrackCharge charge() const
TrajectoryStateOnSurface geometricalInnermostState() const
const Plane & surface() const
The nominal surface of the GeomDet.
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
void setGlobalTrack(reco::TrackRef glb)
set the ref to combined track
std::string dumpFTS(const FreeTrajectoryState &fts) const
PropagationDirection const & direction() const
edm::InputTag theBeamSpotInputTag
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
FreeTrajectoryState const * freeState(bool withErrors=true) const
GlobalVector momentum() const
tuple MuonUpdatorAtVertex
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
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
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
void appendHitPattern(const TrackingRecHit &hit)
const MuonServiceProxy * theService
TrajectoryStateOnSurface const & updatedState() const
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.
ParameterSet const & parameterSet(Provenance const &provenance)
double chiSquared() const