12 #ifdef Use_GraphicsHarvester
13 #include "RecoVertex/VertexSimpleVis/interface/PrimitivesHarvester.h"
14 #include "Utilities/UI/interface/SimpleConfigurable.h"
47 inline unsigned int sum (
unsigned int nr )
57 return ( nr * ( nr + 1 ) ) / 2;
60 #ifdef Use_GraphicsHarvester
62 void graphicsDebug (
const std::vector < PointAndDistance > &
input )
64 bool sve = SimpleConfigurable<bool> (
false,
65 "CrossingPointStudy:Harvest").
value();
67 "CrossingPointStudy:FileName").
value();
70 for ( std::vector< PointAndDistance >::const_iterator
i=input.begin();
71 i!=input.end() ; ++
i )
73 std::map < std::string, MultiType > attrs;
74 attrs[
"name"]=
"GlobalPoint";
75 attrs[
"color"]=
"yellow";
77 attrs[
"comment"]=
"Input for CrossingPtBasedLinearizationPointFinder";
78 PrimitivesHarvester( fname )
79 .save (
i->first, attrs );
81 std::map < std::string, MultiType > attrs;
82 attrs[
"name"]=
"The Mode(*theAlgo)";
83 attrs[
"color"]=
"green";
84 attrs[
"comment"]=
"Output from CrossingPtBasedLinearizationPointFinder";
85 PrimitivesHarvester( fname )
88 attrs[
"name"]=
"The Mode(SubsetHSM)";
90 PrimitivesHarvester( fname ).save ( subsethsm, attrs );
92 attrs[
"name"]=
"The Mode(HSM)";
93 attrs[
"color"]=
"blue";
94 PrimitivesHarvester( fname ).save ( hsm, attrs );
96 attrs[
"name"]=
"The Mode(LMS)";
97 attrs[
"color"]=
"gold";
98 PrimitivesHarvester( fname ).save ( lms, attrs );
106 useMatrix (
false ) , theNPairs ( n_pairs ), theMatrix ( 0 ),
107 theAlgo ( algo.
clone() )
112 const signed int n_pairs ) :
113 useMatrix ( m->hasCrossingPoints() ) ,
114 theNPairs ( n_pairs ), theMatrix ( m ), theAlgo ( algo.
clone() )
130 const std::vector<reco::TransientTrack> &
tracks )
const
132 unsigned int n_tracks = (2*(
unsigned int) (
theNPairs)) < tracks.size() ? 2*
theNPairs : tracks.size();
134 std::vector <reco::TransientTrack> newtracks =
tracks;
135 partial_sort ( newtracks.begin(), newtracks.begin()+n_tracks, newtracks.end(),
CompareTwoTracks() );
136 newtracks.erase ( newtracks.begin()+n_tracks, newtracks.end() );
153 const std::vector<reco::TransientTrack> &
tracks )
const
155 std::vector< PointAndDistance > vgp;
157 TwoTrackMinimumDistance ttmd;
159 std::vector<reco::TransientTrack>::const_iterator
end=tracks.end();
160 std::vector<reco::TransientTrack>::const_iterator endm1=(end-1);
161 for ( std::vector<reco::TransientTrack>::const_iterator
x=tracks.begin();
164 for ( std::vector<reco::TransientTrack>::const_iterator
y=
x+1;
167 status = ttmd.calculate( (*x).impactPointState(), (*y).impactPointState() );
169 std::pair < GlobalPoint, GlobalPoint >
pts = ttmd.points();
170 std::pair < GlobalPoint , float >
v ( ( pts.second + pts.first ) / 2. ,
171 ( pts.second - pts.first ).mag() );
184 const std::vector<reco::TransientTrack> &
tracks )
const
186 std::vector< PointAndDistance > vgp;
187 vgp.reserve ( (
int) ( tracks.size() * ( tracks.size() -1 ) / 2. - 1 ) );
188 std::vector<reco::TransientTrack>::const_iterator
end=tracks.end();
189 std::vector<reco::TransientTrack>::const_iterator endm1=(end-1);
190 for ( std::vector<reco::TransientTrack>::const_iterator
x=tracks.begin();
193 for ( std::vector<reco::TransientTrack>::const_iterator
y=
x+1;
209 const std::vector<FreeTrajectoryState> &
tracks )
const
215 const std::vector < PointAndDistance > & input )
const
221 #ifdef Use_GraphicsHarvester
223 graphicsDebug ( input );
230 const std::vector<reco::TransientTrack> &
tracks )
const
232 if ( tracks.size() < 2 )
234 (
"CrossingPtBasedLinPtFinder: too few tracks given.");
235 std::vector < PointAndDistance > vgp;
248 if ( sum ( tracks.size() - 1 ) < ((
unsigned int) (
theNPairs)) )
259 std::vector <reco::TransientTrack> goodtracks =
getBestTracks ( tracks );
262 if ( goodtracks.size() < 2 )
264 "CrossingPtBasedLinPtFinder: less than two tracks given");
266 unsigned int t_first = 0;
267 unsigned int t_interval = goodtracks.size() / 2;
268 unsigned int lim = goodtracks.size() - 1;
281 while ( vgp.size() < ((
unsigned int) (
theNPairs)) )
294 TwoTrackMinimumDistance ttmd;
297 std::pair < GlobalPoint, GlobalPoint >
pts = ttmd.points();
298 PointAndDistance
v ( ( pts.second + pts.first ) / 2. ,
299 ( pts.second - pts.first ).mag() );
303 if ( ( t_first + t_interval ) < lim )
311 if ( t_interval == 0 )
322 if ( t_interval == goodtracks.size() )
328 t_interval = goodtracks.size() / 2 - 1;
GlobalPoint useAllTracks(const std::vector< reco::TransientTrack > &) const
const RecTracksDistanceMatrix * theMatrix
GlobalPoint find(const std::vector< std::pair< GlobalPoint, float > > &) const
std::pair< GlobalPoint, float > PointAndDistance
~CrossingPtBasedLinearizationPointFinder()
virtual double distance(const reco::TransientTrack, const reco::TransientTrack) const =0
MatrixMeschach operator+(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
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 const double pts[33]
CrossingPtBasedLinearizationPointFinder(const ModeFinder3d &algo, const signed int n_pairs=5)
virtual ModeFinder3d * clone() const =0
virtual GlobalPoint crossingPoint(const reco::TransientTrack, const reco::TransientTrack) const =0
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
virtual GlobalPoint getLinearizationPoint(const std::vector< reco::TransientTrack > &) const =0
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