13 typedef std::pair < float, const GlobalPoint * > MyPair;
14 typedef std::pair < float, float > FloatPair;
15 typedef std::pair < GlobalPoint, float > GlPtWt;
16 typedef std::pair < float, const GlPtWt * > MyPairWt;
20 bool operator() (
const MyPair & pair1,
const MyPair & pair2 )
22 return ( pair1.first < pair2.first );
25 bool operator() (
const FloatPair & pair1,
const FloatPair & pair2 )
27 return ( pair1.first < pair2.first );
30 bool operator() (
const MyPairWt & pair1,
const MyPairWt & pair2 )
32 return ( pair1.first < pair2.first );
55 for ( std::vector< MyPair >::const_iterator
i=pairs.begin();
i!=( pairs.begin() + nq ); ++
i )
56 location+=*(
i->second );
64 for ( std::vector< MyPairWt >::const_iterator
i=pairs.begin();
i!=( pairs.begin() + nq ); ++
i )
65 location+=(
i->second)->first;
80 std::cout <<
"[SMS] warning: Weighted SMS was asked for, but data are "
81 <<
"weightless!" << std::endl;
88 std::vector<MyPair>
pairs;
90 for ( std::vector< GlobalPoint >::const_iterator
i=data.begin();
i!=data.end() ; ++
i )
92 std::vector < float >
D;
94 for ( std::vector< GlobalPoint >::const_iterator
j=data.begin();
j!=data.end() ; ++
j )
95 { D.push_back ( (*
j - *
i).
mag2() ); }
97 sort( D.begin(), D.end() );
98 MyPair
tmp ( D[nq-1], &(*
i) );
99 pairs.push_back ( tmp );
103 sort( pairs.begin(), pairs.end(), Sorter() );
109 return *(pairs.begin()->second);
121 std::vector < GlobalPoint > data1;
122 std::vector<MyPair>::iterator
j;
124 for ( j=pairs.begin(); j-pairs.begin()<nq; ++
j)
125 data1.push_back(*(j->second));
136 std::vector < GlobalPoint > points;
137 for ( std::vector< GlPtWt >::const_iterator
i=wdata.begin();
138 i!=wdata.end() ; ++
i )
140 points.push_back (
i->first );
144 std::cout <<
"[SMS] Unweighted SMS was asked for; ignoring the weights."
152 std::vector< GlPtWt >::const_iterator
i,
j;
153 for ( i=wdata.begin() ; i!=wdata.end() ; ++
i)
157 std::vector <MyPairWt> pairs;
158 for ( i=wdata.begin(); i!=wdata.end() ; ++
i )
160 std::vector < FloatPair >
D;
162 for ( j=wdata.begin(); j!=wdata.end() ; ++
j )
163 D.push_back ( FloatPair( (j->first - i->first).mag2() , j->second ) ) ;
165 sort( D.begin(), D.end() );
167 std::vector< FloatPair >::const_iterator where;
168 for ( where=D.begin(); where!=D.end(); ++where )
174 MyPairWt
tmp ( where->first, &(*i) );
175 pairs.push_back (
tmp );
180 sort( pairs.begin(), pairs.end(), Sorter() );
185 std::vector < MyPairWt >::const_iterator
k;
186 for (k=pairs.begin(); k!=pairs.end(); ++
k )
188 sumw+=k->second->second;
200 return pairs.begin()->second->first;
214 std::vector<GlPtWt> wdata1;
216 for ( k=pairs.begin(); k-pairs.begin()<nq; ++
k)
217 wdata1.push_back(*(k->second));
Global3DPoint GlobalPoint
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Basic3DVector & operator/=(T t)
Scaling by a scalar value (division)
std::vector< std::vector< double > > tmp
char data[epos_bytes_allocation]
SMS(SMSType tp=(SMSType)(Interpolate|Iterate|Weighted), float q=0.5)
list pairs
sort tag files by run number
for(const auto &isodef:isoDefs)
DecomposeProduct< arg, typename Div::arg > D
GlobalPoint location(const std::vector< GlobalPoint > &) const
Basic3DVector & operator+=(const Basic3DVector< U > &p)