ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/IPHCalignment2/TrackingTools/PatternTools/src/TSCBLBuilderWithPropagator.cc
Revision: 1.1
Committed: Fri Nov 25 16:38:25 2011 UTC (13 years, 5 months ago) by econte
Content type: text/plain
Branch: MAIN
CVS Tags: TBD2011, TBD_2011, HEAD
Log Message:
new IPHC alignment

File Contents

# User Rev Content
1 econte 1.1 #include "TrackingTools/PatternTools/interface/TSCBLBuilderWithPropagator.h"
2     #include "TrackingTools/GeomPropagators/interface/AnalyticalPropagator.h"
3     #include "TrackingTools/PatternTools/interface/TrajectoryExtrapolatorToLine.h"
4     #include "FWCore/MessageLogger/interface/MessageLogger.h"
5    
6     using namespace std;
7    
8     TSCBLBuilderWithPropagator::TSCBLBuilderWithPropagator (const MagneticField* field) :
9     thePropagator(new AnalyticalPropagator(field, anyDirection)) {}
10    
11     TSCBLBuilderWithPropagator::TSCBLBuilderWithPropagator (const Propagator& u) :
12     thePropagator(u.clone())
13     {
14     thePropagator->setPropagationDirection(anyDirection);
15     }
16    
17    
18     TrajectoryStateClosestToBeamLine
19     TSCBLBuilderWithPropagator::operator()
20     (const FreeTrajectoryState& originalFTS,
21     const reco::BeamSpot& beamSpot) const
22     {
23    
24     GlobalPoint bspos(beamSpot.position().x(), beamSpot.position().y(), beamSpot.position().z());
25     GlobalVector bsvec(beamSpot.dxdz(), beamSpot.dydz(), 1.);
26     Line bsline(bspos,bsvec);
27    
28     TrajectoryExtrapolatorToLine tetl;
29    
30     TrajectoryStateOnSurface tsosfinal = tetl.extrapolate(originalFTS,bsline,*thePropagator);
31    
32     //Compute point on beamline of closest approach
33     GlobalPoint tp = tsosfinal.globalPosition(); //position of trajectory closest approach
34     GlobalVector hyp(tp.x() - bspos.x(),tp.y() - bspos.y(),tp.z() - bspos.z()); //difference between traj and beamline reference
35     double l=bsline.direction().dot(hyp); //length along beamline away from reference point
36     GlobalPoint closepoint = bspos + l*bsvec;
37    
38     //Get the free state and return the TSCBL
39     const FreeTrajectoryState theFTS = *tsosfinal.freeState();
40     return TrajectoryStateClosestToBeamLine(theFTS, closepoint, beamSpot);
41     }