12 #ifdef Use_GraphicsHarvester 13 #include "RecoVertex/VertexSimpleVis/interface/PrimitivesHarvester.h" 14 #include "Utilities/UI/interface/SimpleConfigurable.h" 49 inline unsigned int sum (
unsigned int nr )
59 return ( nr * ( nr + 1 ) ) / 2;
62 #ifdef Use_GraphicsHarvester 64 void graphicsDebug (
const std::vector < PointAndDistance > &
input )
66 bool sve = SimpleConfigurable<bool> (
false,
67 "CrossingPointStudy:Harvest").
value();
69 "CrossingPointStudy:FileName").
value();
72 for ( std::vector< PointAndDistance >::const_iterator
i=input.begin();
73 i!=input.end() ; ++
i )
75 std::map < std::string, MultiType > attrs;
76 attrs[
"name"]=
"GlobalPoint";
77 attrs[
"color"]=
"yellow";
79 attrs[
"comment"]=
"Input for CrossingPtBasedLinearizationPointFinder";
80 PrimitivesHarvester( fname )
81 .save (
i->first, attrs );
83 std::map < std::string, MultiType > attrs;
84 attrs[
"name"]=
"The Mode(*theAlgo)";
85 attrs[
"color"]=
"green";
86 attrs[
"comment"]=
"Output from CrossingPtBasedLinearizationPointFinder";
87 PrimitivesHarvester( fname )
90 attrs[
"name"]=
"The Mode(SubsetHSM)";
92 PrimitivesHarvester( fname ).save ( subsethsm, attrs );
94 attrs[
"name"]=
"The Mode(HSM)";
95 attrs[
"color"]=
"blue";
96 PrimitivesHarvester( fname ).save ( hsm, attrs );
98 attrs[
"name"]=
"The Mode(LMS)";
99 attrs[
"color"]=
"gold";
100 PrimitivesHarvester( fname ).save ( lms, attrs );
108 useMatrix (
false ) , theNPairs ( n_pairs ), theMatrix ( 0 ),
109 theAlgo ( algo.
clone() )
114 const signed int n_pairs ) :
132 const std::vector<reco::TransientTrack> &
tracks )
const 134 unsigned int n_tracks = (2*(
unsigned int) (
theNPairs)) < tracks.size() ? 2*
theNPairs : tracks.size();
136 std::vector <reco::TransientTrack> newtracks =
tracks;
137 partial_sort ( newtracks.begin(), newtracks.begin()+n_tracks, newtracks.end(),
CompareTwoTracks() );
138 newtracks.erase ( newtracks.begin()+n_tracks, newtracks.end() );
155 const std::vector<reco::TransientTrack> &
tracks )
const 157 std::vector< PointAndDistance > vgp;
161 std::vector<reco::TransientTrack>::const_iterator
end=tracks.end();
162 std::vector<reco::TransientTrack>::const_iterator endm1=(end-1);
163 for ( std::vector<reco::TransientTrack>::const_iterator
x=tracks.begin();
166 for ( std::vector<reco::TransientTrack>::const_iterator
y=
x+1;
169 status = ttmd.
calculate( (*x).impactPointState(), (*y).impactPointState() );
171 std::pair < GlobalPoint, GlobalPoint >
pts = ttmd.
points();
172 std::pair < GlobalPoint , float >
v ( ( pts.second + pts.first ) / 2. ,
173 ( pts.second - pts.first ).mag() );
186 const std::vector<reco::TransientTrack> &
tracks )
const 188 std::vector< PointAndDistance > vgp;
189 vgp.reserve ( (
int) ( tracks.size() * ( tracks.size() -1 ) / 2. - 1 ) );
190 std::vector<reco::TransientTrack>::const_iterator
end=tracks.end();
191 std::vector<reco::TransientTrack>::const_iterator endm1=(end-1);
192 for ( std::vector<reco::TransientTrack>::const_iterator
x=tracks.begin();
195 for ( std::vector<reco::TransientTrack>::const_iterator
y=
x+1;
211 const std::vector<FreeTrajectoryState> &
tracks )
const 217 const std::vector < PointAndDistance > & input )
const 223 #ifdef Use_GraphicsHarvester 225 graphicsDebug ( input );
232 const std::vector<reco::TransientTrack> &
tracks )
const 234 if ( tracks.size() < 2 )
236 (
"CrossingPtBasedLinPtFinder: too few tracks given.");
237 std::vector < PointAndDistance > vgp;
250 if ( sum ( tracks.size() - 1 ) < ((
unsigned int) (
theNPairs)) )
261 std::vector <reco::TransientTrack> goodtracks =
getBestTracks ( tracks );
264 if ( goodtracks.size() < 2 )
266 "CrossingPtBasedLinPtFinder: less than two tracks given");
268 unsigned int t_first = 0;
269 unsigned int t_interval = goodtracks.size() / 2;
270 unsigned int lim = goodtracks.size() - 1;
299 std::pair < GlobalPoint, GlobalPoint >
pts = ttmd.
points();
300 PointAndDistance
v ( ( pts.second + pts.first ) / 2. ,
301 ( pts.second - pts.first ).mag() );
305 if ( ( t_first + t_interval ) < lim )
313 if ( t_interval == 0 )
324 if ( t_interval == goodtracks.size() )
330 t_interval = goodtracks.size() / 2 - 1;
GlobalPoint useAllTracks(const std::vector< reco::TransientTrack > &) const
virtual bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb)
const RecTracksDistanceMatrix * theMatrix
GlobalPoint find(const std::vector< std::pair< GlobalPoint, float > > &) const
std::pair< GlobalPoint, float > PointAndDistance
~CrossingPtBasedLinearizationPointFinder()
virtual CrossingPtBasedLinearizationPointFinder * clone() const
MatrixMeschach operator+(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
virtual double distance(const reco::TransientTrack, const reco::TransientTrack) const =0
MatrixMeschach operator-(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
Global3DPoint GlobalPoint
std::vector< reco::TransientTrack > getBestTracks(const std::vector< reco::TransientTrack > &) const
virtual GlobalPoint getLinearizationPoint(const std::vector< reco::TransientTrack > &) const
Basic3DVector< long double > operator/(const Basic3DVector< long double > &v, S s)
static std::string const input
static const double pts[33]
CrossingPtBasedLinearizationPointFinder(const ModeFinder3d &algo, const signed int n_pairs=5)
virtual ModeFinder3d * clone() const =0
virtual GlobalPoint getLinearizationPoint(const std::vector< reco::TransientTrack > &) const =0
virtual GlobalPoint crossingPoint(const reco::TransientTrack, const reco::TransientTrack) const =0
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
TrajectoryStateOnSurface impactPointState() const
MatrixMeschach operator*(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
GlobalPoint useFullMatrix(const std::vector< reco::TransientTrack > &) const
virtual GlobalPoint getLinearizationPoint(const std::vector< reco::TransientTrack > &) const
virtual std::pair< GlobalPoint, GlobalPoint > points() const