81 std::vector<bool> dummyVecBool;
82 return loadTracks(trajectories, event, dummyVecBool, instance, reallyDoSmoothing);
88 const string&
instance,
bool reallyDoSmoothing) {
92 const string metname =
"Muon|RecoMuon|MuonTrackLoader";
119 auto_ptr<vector<Trajectory> > trajectoryCollection(
new vector<Trajectory>);
125 if ( trajectories.empty() ) {
126 event.put(recHitCollection,instance);
127 event.put(trackExtraCollection,instance);
129 event.put(trajectoryCollection,instance);
130 event.put( trajTrackMap, instance );
133 event.put(trackToTrackmap);
134 event.put(updatedAtVtxTrackCollection,instance+
"UpdatedAtVtx");
136 return event.put(trackCollection,instance);
142 LogTrace(metname) <<
"Create the collection of Tracks";
152 std::map<unsigned int, unsigned int> tjTkMap;
157 unsigned int tjCnt = 0;
158 for(TrajectoryContainer::const_iterator rawTrajectory = trajectories.begin();
159 rawTrajectory != trajectories.end(); ++rawTrajectory, ++tjCnt){
164 vector<Trajectory> trajectoriesSM =
theSmoother->trajectories(**rawTrajectory);
166 if(!trajectoriesSM.empty()) {
168 trajectory = trajectoriesSM.front();
172 LogInfo(metname)<<
"The trajectory has not been smoothed!"<<endl;
176 trajectoryCollection->push_back(trajectory);
184 reverse(transHits.begin(),transHits.end());
188 pair<bool,reco::Track> resultOfTrackExtrapAtPCA =
buildTrackAtPCA(trajectory, *beamSpot);
191 if(!resultOfTrackExtrapAtPCA.first) {
192 delete *rawTrajectory;
197 reco::Track &track = resultOfTrackExtrapAtPCA.second;
209 pair<bool,reco::Track> updateResult(
false,
reco::Track());
215 if(!updateResult.first) ++trackIndex;
219 updateResult.second.setExtra(trackExtraRef);
222 trackToTrackmap->insert(
reco::TrackRef(trackCollectionRefProd,trackIndex++),
223 reco::TrackRef(trackUpdatedCollectionRefProd,trackUpdatedIndex++));
228 for (Trajectory::RecHitContainer::const_iterator recHit = transHits.begin();
229 recHit != transHits.end(); ++recHit) {
232 if(
theUpdatingAtVtx && updateResult.first) updateResult.second.appendHitPattern(*singleHit);
233 recHitCollection->push_back( singleHit );
239 trackExtraCollection->push_back(trackExtra);
242 trackCollection->push_back(track);
244 LogTrace(metname) <<
"Debug Track being loaded pt "<< track.
pt();
247 updatedAtVtxTrackCollection->push_back(updateResult.second);
252 delete *rawTrajectory;
254 if(tkBoolVec.size()>tjCnt) tkBoolVec[tjCnt] =
true;
261 LogTrace(metname) <<
"put the Collections in the event";
262 event.put(recHitCollection,instance);
263 event.put(trackExtraCollection,instance);
268 nonUpdatedHandle =
event.put(trackCollection,instance);
269 event.put(trackToTrackmap);
270 returnTrackHandle =
event.put(updatedAtVtxTrackCollection,instance+
"UpdatedAtVtx");
273 returnTrackHandle =
event.put(trackCollection,instance);
274 nonUpdatedHandle = returnTrackHandle;
280 for ( std::map<unsigned int, unsigned int>::iterator
i = tjTkMap.begin();
281 i != tjTkMap.end();
i++ ) {
282 trajTrackMap->insert(
edm::Ref<std::vector<Trajectory> >( rTrajs, (*i).first ),
285 event.put( trajTrackMap, instance );
288 return returnTrackHandle;
295 const string metname =
"Muon|RecoMuon|MuonTrackLoader";
301 if ( muonCands.empty() ) {
306 event.put(recHitCollection);
307 event.put(trackExtraCollection);
308 event.put(trackCollection);
317 return event.put(trackLinksCollection);
323 for (CandidateContainer::const_iterator it = muonCands.begin(); it != muonCands.end(); ++it) {
324 LogDebug(metname) <<
"Loader glbSeedRef " << (*it)->trajectory()->seedRef().isNonnull();
325 if ((*it)->trackerTrajectory() )
LogDebug(metname) <<
" " <<
"tkSeedRef " << (*it)->trackerTrajectory()->seedRef().isNonnull();
327 combinedTrajs.push_back((*it)->trajectory());
331 if ((*it)->trackerTrajectory())
delete ((*it)->trackerTrajectory());
344 LogTrace(metname) <<
"Build combinedTracks";
345 std::vector<bool> combTksVec(combinedTrajs.size(),
false);
349 std::vector<bool> trackerTksVec(trackerTrajs.size(),
false);
351 LogTrace(metname) <<
"Build trackerTracks: "
352 << trackerTrajs.size();
355 for (TrajectoryContainer::iterator it = trackerTrajs.begin(); it != trackerTrajs.end(); ++it) {
360 LogTrace(metname) <<
"Set the final links in the MuonTrackLinks collection";
362 unsigned int candposition(0),
position(0), tkposition(0);
366 for (CandidateContainer::const_iterator it = muonCands.begin(); it != muonCands.end(); ++it, ++candposition) {
373 if(combTksVec[candposition]) {
388 trackLinksCollection->push_back(links);
399 LogWarning(metname)<<
"The MuonTrackLinkCollection is incomplete";
402 LogTrace(metname) <<
"put the MuonCollection in the event" <<
"\n";
404 return event.put(trackLinksCollection);
409 Event& event, std::vector<std::pair<Trajectory*,reco::TrackRef> > miniMap,
const string& instance,
bool reallyDoSmoothing) {
413 const string metname =
"Muon|RecoMuon|MuonTrackLoader|TevMuonTrackLoader";
436 auto_ptr<vector<Trajectory> > trajectoryCollection(
new vector<Trajectory>);
442 if ( trajectories.empty() ) {
443 event.put(recHitCollection,instance);
444 event.put(trackExtraCollection,instance);
446 event.put(trajectoryCollection,instance);
447 event.put( trajTrackMap, instance );
449 event.put(trackToTrackmap, instance);
450 return event.put(trackCollection,instance);
453 LogTrace(metname) <<
"Create the collection of Tracks";
466 std::map<unsigned int, unsigned int> tjTkMap;
472 for(TrajectoryContainer::const_iterator rawTrajectory = trajectories.begin();
473 rawTrajectory != trajectories.end(); ++rawTrajectory){
476 std::vector<std::pair<Trajectory*,reco::TrackRef> >::const_iterator mmit;
477 for(mmit = miniMap.begin();mmit!=miniMap.end();++mmit){
478 if(mmit->first == *rawTrajectory) glbRef = mmit->second;
484 vector<Trajectory> trajectoriesSM =
theSmoother->trajectories(**rawTrajectory);
486 if(!trajectoriesSM.empty()) {
488 trajectory = trajectoriesSM.front();
491 LogInfo(metname)<<
"The trajectory has not been smoothed!"<<endl;
495 trajectoryCollection->push_back(trajectory);
503 reverse(transHits.begin(),transHits.end());
507 pair<bool,reco::Track> resultOfTrackExtrapAtPCA =
buildTrackAtPCA(trajectory, *beamSpot);
510 if(!resultOfTrackExtrapAtPCA.first) {
512 delete *rawTrajectory;
517 reco::Track &track = resultOfTrackExtrapAtPCA.second;
529 trackToTrackmap->insert(glbRef,
533 pair<bool,reco::Track> updateResult(
false,
reco::Track());
536 for (Trajectory::RecHitContainer::const_iterator recHit = transHits.begin();
537 recHit != transHits.end(); ++recHit) {
540 if(
theUpdatingAtVtx && updateResult.first) updateResult.second.appendHitPattern( *singleHit);
541 recHitCollection->push_back( singleHit );
547 trackExtraCollection->push_back(trackExtra);
550 trackCollection->push_back(track);
552 LogTrace(metname) <<
"Debug Track being loaded pt "<< track.
pt();
557 delete *rawTrajectory;
565 LogTrace(metname) <<
"put the Collections in the event";
566 event.put(recHitCollection,instance);
567 event.put(trackExtraCollection,instance);
574 event.put(trackToTrackmap,instance);
575 returnTrackHandle =
event.put(trackCollection,instance);
576 nonUpdatedHandle = returnTrackHandle;
582 for ( std::map<unsigned int, unsigned int>::iterator
i = tjTkMap.begin();
583 i != tjTkMap.end();
i++ ) {
584 trajTrackMap->insert(
edm::Ref<std::vector<Trajectory> >( rTrajs, (*i).first ),
587 event.put( trajTrackMap, instance );
590 return returnTrackHandle;
596 const string metname =
"Muon|RecoMuon|MuonTrackLoader";
604 LogTrace(metname) <<
"Propagate to PCA...";
605 pair<bool,FreeTrajectoryState>
609 if(extrapolationResult.first)
610 ftsAtVtx = extrapolationResult.second;
613 LogInfo(metname) <<
"Track in the Tracker: taking the innermost state instead of the state at PCA";
618 LogInfo(metname) <<
"Propagation to PCA failed, taking the innermost state instead of the state at PCA";
621 LogInfo(metname) <<
"Stand Alone track: this track will be rejected";
622 return pair<bool,reco::Track>(
false,
reco::Track());
627 LogTrace(metname) <<
"TSOS after the extrapolation at vtx";
637 double ndof = trajectory.
ndof(bon);
646 return pair<bool,reco::Track>(
true,track);
652 const string metname =
"Muon|RecoMuon|MuonTrackLoader";
660 LogTrace(metname) <<
"Apply the vertex constraint";
663 if(!updateResult.first){
664 return pair<bool,reco::Track>(
false,
reco::Track());
667 LogTrace(metname) <<
"FTS after the vertex constraint";
684 return pair<bool,reco::Track>(
true,updatedTrack);
690 const string metname =
"Muon|RecoMuon|MuonTrackLoader";
700 unsigned int innerId=0, outerId=0;
714 LogTrace(metname)<<
"oppositeToMomentum";
722 else LogError(metname)<<
"Wrong propagation direction!";
732 LogTrace(metname)<<
"The Global Muon outerMostMeasurementState is not compatible with the recHit detector! Setting outerMost postition to recHit position if recHit isValid: " << outerRecHit->isValid();
733 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.
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.
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
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
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
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.
const BoundPlane & surface() const
The nominal surface of the GeomDet.
void setStandAloneTrack(reco::TrackRef sta)
set the ref to stand alone track
edm::ESHandle< TrajectorySmoother > theSmoother
void appendHitPattern(const TrackingRecHit &hit)
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.
double chiSquared() const