12 #ifdef Use_GraphicsHarvester
13 #include "RecoVertex/VertexSimpleVis/interface/PrimitivesHarvester.h"
14 #include "Utilities/UI/interface/SimpleConfigurable.h"
43 inline unsigned int sum(
unsigned int nr) {
52 return (
nr * (
nr + 1)) / 2;
55 #ifdef Use_GraphicsHarvester
57 void graphicsDebug(
const std::vector<PointAndDistance>&
input) {
58 bool sve = SimpleConfigurable<bool>(
false,
"CrossingPointStudy:Harvest").value();
59 std::string fname = SimpleConfigurable<string>(
"crossingpoints.txt",
"CrossingPointStudy:FileName").value();
61 for (std::vector<PointAndDistance>::const_iterator
i =
input.begin();
i !=
input.end(); ++
i) {
62 std::map<std::string, MultiType> attrs;
63 attrs[
"name"] =
"GlobalPoint";
64 attrs[
"color"] =
"yellow";
66 attrs[
"comment"] =
"Input for CrossingPtBasedLinearizationPointFinder";
67 PrimitivesHarvester(
fname).save(
i->first, attrs);
69 std::map<std::string, MultiType> attrs;
70 attrs[
"name"] =
"The Mode(*theAlgo)";
71 attrs[
"color"] =
"green";
72 attrs[
"comment"] =
"Output from CrossingPtBasedLinearizationPointFinder";
73 PrimitivesHarvester(
fname).save(
ret, attrs);
75 attrs[
"name"] =
"The Mode(SubsetHSM)";
76 attrs[
"color"] =
"red";
77 PrimitivesHarvester(
fname).save(subsethsm, attrs);
79 attrs[
"name"] =
"The Mode(HSM)";
80 attrs[
"color"] =
"blue";
81 PrimitivesHarvester(
fname).save(hsm, attrs);
83 attrs[
"name"] =
"The Mode(LMS)";
84 attrs[
"color"] =
"gold";
85 PrimitivesHarvester(
fname).save(lms, attrs);
92 const signed int n_pairs)
93 : useMatrix(
false), theNPairs(n_pairs), theMatrix(nullptr), theAlgo(
algo.
clone()) {}
97 const signed int n_pairs)
98 : useMatrix(
m->hasCrossingPoints()), theNPairs(n_pairs), theMatrix(
m), theAlgo(
algo.
clone()) {}
102 : useMatrix(
o.useMatrix),
103 theNPairs(
o.theNPairs),
104 theMatrix(
o.theMatrix ),
105 theAlgo(
o.theAlgo->
clone()) {}
110 const std::vector<reco::TransientTrack>&
tracks)
const {
113 std::vector<reco::TransientTrack> newtracks =
tracks;
114 partial_sort(newtracks.begin(), newtracks.begin() + n_tracks, newtracks.end(),
CompareTwoTracks());
115 newtracks.erase(newtracks.begin() + n_tracks, newtracks.end());
132 const std::vector<reco::TransientTrack>&
tracks)
const {
133 std::vector<PointAndDistance> vgp;
137 std::vector<reco::TransientTrack>::const_iterator
end =
tracks.end();
138 std::vector<reco::TransientTrack>::const_iterator endm1 = (
end - 1);
139 for (std::vector<reco::TransientTrack>::const_iterator
x =
tracks.begin();
x != endm1; ++
x) {
140 for (std::vector<reco::TransientTrack>::const_iterator
y =
x + 1;
y !=
end; ++
y) {
141 status = ttmd.
calculate((*x).impactPointState(), (*y).impactPointState());
143 std::pair<GlobalPoint, GlobalPoint>
pts = ttmd.
points();
144 std::pair<GlobalPoint, float>
v((
pts.second +
pts.first) / 2., (
pts.second -
pts.first).mag());
156 const std::vector<reco::TransientTrack>&
tracks)
const {
157 std::vector<PointAndDistance> vgp;
158 vgp.reserve((
int)(
tracks.size() * (
tracks.size() - 1) / 2. - 1));
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();
x != endm1; ++
x) {
162 for (std::vector<reco::TransientTrack>::const_iterator
y =
x + 1;
y !=
end; ++
y) {
174 const std::vector<FreeTrajectoryState>&
tracks)
const {
183 #ifdef Use_GraphicsHarvester
185 graphicsDebug(
input);
192 const std::vector<reco::TransientTrack>&
tracks)
const {
194 throw LinPtException(
"CrossingPtBasedLinPtFinder: too few tracks given.");
195 std::vector<PointAndDistance> vgp;
217 if (goodtracks.size() < 2)
218 throw LinPtException(
"CrossingPtBasedLinPtFinder: less than two tracks given");
220 unsigned int t_first = 0;
221 unsigned int t_interval = goodtracks.size() / 2;
222 unsigned int lim = goodtracks.size() - 1;
246 std::pair<GlobalPoint, GlobalPoint>
pts = ttmd.
points();
251 if ((t_first + t_interval) < lim) {
256 if (t_interval == 0) {
264 if (t_interval == goodtracks.size()) {
269 t_interval = goodtracks.size() / 2 - 1;