Hi,
I have a member funciton of a class which has two vector <TLorentzVector> as input and a map as the output. .eg.
======================================================
//Matching of objct B to A
void Analyzer::BestMatch(vector ObjectA, vector ObjectB, map<TLorentzVector ,int > *ABmap)
{
vectorBFlag;
for(int j = 0; j < ObjectB.size(); j++) { BFlag.push_back(0); }
for(int i = 0; i < ObjectA.size(); i++)
{
float DRAB = 1.0; int BNo = -1;
for(int j = 0; j<ObjectB.size(); j++){
if(BFlag[j] == 0)
{
float delr = GetDeltaR(ObjectA[i].Eta(),ObjectB[j].Eta(),ObjectA[i].Phi(),ObjectB[j].Phi());
if(delr < DRAB)
{ DRAB = delr;
BNo = j;
}
}
}
if(DRAB < 0.4)
{
(*ABmap)[ObjectA[i]] = BNo;
BFlag[BNo] = 1;
}
else {(*ABmap)[ObjectA[i]] = -1;}
}
}
I define the funciton in class as
void BestMatch(vector ,vector
map<TLorentzVector,int >* );
and included the map.h, TLorentzVector and vector.h in the header file.
But on compiling to get .so file I get the following error:
++++++++++++++++++++++
Analyzer.h: In member function void Analyzer::BestMatch(std::vector<TLorentzVector, std::allocator<TLorentzVector> >, std::vector<TLorentzVector, std::allocator<TLorentzVector> >, std::map<TLorentzVector, int, std::less<TLorentzVector>, std::allocator<std::pair<const TLorentzVector, int> > >*)': Analyzer.h:1311: warning: comparison between signed and unsigned integer expressions Analyzer.h:1313: warning: comparison between signed and unsigned integer expressions Analyzer.h:1317: warning: comparison between signed and unsigned integer expressions Analyzer.C: In member function
virtual void Analyzer::Loop()’:
Analyzer.C:430: warning: comparison between signed and unsigned integer expressions
Analyzer.C:533: warning: comparison between signed and unsigned integer expressions
Analyzer.C:583: warning: comparison between signed and unsigned integer expressions
Analyzer.C:649: warning: comparison between signed and unsigned integer expressions
Analyzer.C:691: warning: comparison between signed and unsigned integer expressions
Analyzer.C:748: warning: comparison between signed and unsigned integer expressions
Analyzer.C:819: warning: comparison between signed and unsigned integer expressions
Analyzer.C:948: warning: comparison between signed and unsigned integer expressions
Analyzer.C:46: warning: unused variable 'rPhot_r9’
Analyzer.C:48: warning: unused variable 'pPhotJet_CosTheta’
Analyzer.C:271: warning: unused variable 'idebug1’
Analyzer.C:272: warning: unused variable 'idebug2’
Analyzer.C:273: warning: unused variable 'idebug3’
Analyzer.C:274: warning: unused variable 'idebug4’
Analyzer.C:275: warning: unused variable 'idebug5’
Analyzer.C:276: warning: unused variable 'idebug6’
Analyzer.C:277: warning: unused variable 'idebug7’
Analyzer.C:278: warning: unused variable 'idebug8’
Analyzer.C:349: warning: unused variable ‘egHcalIsoEMin’
Analyzer.C:352: warning: unused variable ‘Rechits_threshold’
/usr/lib/gcc/i386-redhat-linux/3.4.6/…/…/…/…/include/c++/3.4.6/bits/stl_function.h: In member function bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = TLorentzVector]': /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/stl_tree.h:1156: instantiated from
typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::lower_bound(const _Key&) [with _Key = TLorentzVector, _Val = std::pair<const TLorentzVector, int>, _KeyOfValue = std::_Select1st<std::pair<const TLorentzVector, int> >, _Compare = std::less, _Alloc = std::allocator<std::pair<const TLorentzVector, int> >]’
/usr/lib/gcc/i386-redhat-linux/3.4.6/…/…/…/…/include/c++/3.4.6/bits/stl_map.h:540: instantiated from typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::lower_bound(const _Key&) [with _Key = TLorentzVector, _Tp = int, _Compare = std::less<TLorentzVector>, _Alloc = std::allocator<std::pair<const TLorentzVector, int> >]' /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/stl_map.h:336: instantiated from
_Tp& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with _Key = TLorentzVector, _Tp = int, _Compare = std::less, _Alloc = std::allocator<std::pair<const TLorentzVector, int> >]'
Analyzer.h:1332: instantiated from here
/usr/lib/gcc/i386-redhat-linux/3.4.6/…/…/…/…/include/c++/3.4.6/bits/stl_function.h:227: error: no match for ‘operator<’ in ‘__x < __y’
/home/sushil/ROOT_5.16/root_514/include/TDatime.h:94: note: candidates are: Bool_t operator<(const TDatime&, const TDatime&)
/home/sushil/ROOT_5.16/root_514/include/TString.h:642: note: Bool_t operator<(const char*, const TString&)
/home/sushil/ROOT_5.16/root_514/include/TString.h:624: note: Bool_t operator<(const TString&, const char*)
/home/sushil/ROOT_5.16/root_514/include/TString.h:608: note: Bool_t operator<(const TString&, const TString&)
make: *** [Analyzer.so] Error 1
+++++++++++++++++++++++++++++++==
Could somebody help to solve it.
Thanks in advance.
with best,
sushil