18 #ifndef RECOMEASINDEX_H
19 #define RECOMEASINDEX_H
22 #include "controller.h"
30 template<recoDim dim,
class Ignore,
class Separate=RecoDim<0> >
39 Log<Reco> odinlog(
"RecoMeasIndex",
"init");
41 prep_coord(coord4count);
42 coord4count.
set_mode(RecoIndex::separate, dim);
45 if(!countmap)
return false;
46 init_countmap=(*countmap);
48 return create_measmap(init_countmap);
56 Log<Reco> odinlog(
"RecoMeasIndex",
"update");
58 if(!extra.size())
return true;
62 ODINLOG(odinlog,normalDebug) <<
"countmap_copy/extra.size()=" << countmap_copy.size() <<
"/" << extra.size() << STD_endl;
64 for(CoordCountMap::const_iterator it=extra.begin(); it!=extra.end(); ++it) countmap_copy[it->first]+=it->second;
66 return create_measmap(countmap_copy);
74 Log<Reco> odinlog(
"RecoMeasIndex",
"get_indices");
77 prep_coord(coord4meas);
78 coord4meas.
set_mode(RecoIndex::ignore,dim);
80 MeasMap::const_iterator it=measmap.find(coord4meas);
81 if(it==measmap.end()) {
82 ODINLOG(odinlog,normalDebug) <<
"<" << recoDimLabel[dim] <<
">: No indices for coordinate " << coord4meas.
print() << STD_endl;
85 ODINLOG(odinlog,normalDebug) <<
"coord4meas/it=" << coord4meas.
print() <<
"/" << it->first.print() << STD_endl;
86 ODINLOG(odinlog,normalDebug) <<
"result=" << result.
printbody() << STD_endl;
94 static void prep_coord(
RecoCoord& coord) {
95 Ignore::modify(RecoIndex::ignore, coord);
96 Separate::modify(RecoIndex::separate, coord);
101 Log<Reco> odinlog(
"RecoMeasIndex",
"create_measmap");
103 STD_map<RecoCoord, STD_list<int> > indexlist;
104 for(CoordCountMap::const_iterator it=countmap.begin(); it!=countmap.end(); ++it) {
106 coord4indexlist.set_mode(RecoIndex::ignore, dim);
107 indexlist[coord4indexlist].push_back(it->first.index[dim]);
110 for(STD_map<
RecoCoord, STD_list<int> >::iterator lstit=indexlist.begin(); lstit!=indexlist.end(); ++lstit) {
111 STD_list<int>& lstref=lstit->second;
117 for(MeasMap::const_iterator mapit=measmap.begin(); mapit!=measmap.end(); ++mapit) {
118 ODINLOG(odinlog,normalDebug) <<
"measmap[" << mapit->first.print() <<
"]=" << mapit->second.printbody() << STD_endl;
127 typedef STD_map<RecoCoord, ivector> MeasMap;
const CoordCountMap * create_count_map(const RecoCoord &mask) const
ivector get_indices(const RecoCoord &coord) const
bool update(const CoordCountMap &extra)
bool init(const RecoCoord &coord, const RecoController &controller)
STD_string printbody() const
STD_map< RecoCoord, UInt > CoordCountMap
STD_vector< T > list2vector(const STD_list< T > &src)
RecoCoord & set_mode(RecoIndex::indexMode m, recoDim d1=n_recoDims, recoDim d2=n_recoDims, recoDim d3=n_recoDims, recoDim d4=n_recoDims, recoDim d5=n_recoDims, recoDim d6=n_recoDims, recoDim d7=n_recoDims, recoDim d8=n_recoDims)
STD_string print(RecoIndex::printMode printmode=RecoIndex::brief) const