00001
00002
00003
00004
00005
00006 #include <Stiostream.h>
00007 #include <math.h>
00008
00009
00010 #include "StThreeVectorD.hh"
00011 #include "StEventTypes.h"
00012 #include "StGetConfigValue.hh"
00013
00014
00015 #include "StiHit.h"
00016 #include "StiMapUtilities.h"
00017 #include "StiCompositeTreeNode.h"
00018 #include "StiPlacement.h"
00019 #include "StiDetector.h"
00020 #include "StiTrackNode.h"
00021
00022
00023
00024
00025 bool HitMapKey::operator==(const HitMapKey& key2) const
00026 {
00027
00028 return (this->refangle==key2.refangle && this->position==key2.position);
00029 }
00030
00031
00032 bool MapKeyLessThan::operator() (const HitMapKey& key1, const HitMapKey& key2) const
00033 {
00034
00035 bool val = false;
00036 if ( fabs(key1.refangle-key2.refangle) < reftolerance) {
00037
00038
00039 if ( fabs(key1.position-key2.position) < postolerance) {
00040
00041 val = false;
00042 }
00043 else if (key1.position < key2.position) {val = true;}
00044 else {val = false;}
00045 }
00046
00047 else if (key1.refangle < key2.refangle) {val = true;}
00048 else {val = false;}
00049
00050 return val;
00051 }
00052
00053
00054 bool StiDetectorNodePositionLessThan::operator() (const StiCompositeTreeNode<StiDetector> * lhs,
00055 const StiCompositeTreeNode<StiDetector> * rhs) const {
00056 if (lhs->getData()==0 || rhs->getData()==0)
00057 cout <<"StiDetectorNodeLessThan::operator(). ERROR:\t" <<"null data. Return false"<<endl;
00058
00059 StiPlacement* lhsp = lhs->getData()->getPlacement();
00060 StiPlacement* rhsp = rhs->getData()->getPlacement();
00061
00062 return lhsp->getNormalRadius()<rhsp->getNormalRadius();
00063 }
00064
00065
00066
00067 bool NameMapKey::operator==(const NameMapKey& key2) const{
00068
00069 return( name ==key2.name );
00070 }
00071
00072 bool NameMapKey::operator<(const NameMapKey& key2) const{
00073
00074 return( name < key2.name );
00075 }
00076
00077 void SetHitUsed::operator()(StiTrackNode& node)
00078 {
00079 StiHit* hit = node.getHit();
00080 if(!hit) return;
00081 if ( !node.isValid() || node.getChi2()>1e3) {node.setHit(0);}
00082 else {hit->setTimesUsed(hit->timesUsed()+1);}
00083 }
00084
00085
00086
00087 ostream& operator<<(ostream& os, const HitMapKey& a)
00088 {
00089 return os <<a.refangle<<"\t"<<a.position;
00090 }
00091
00092 ostream& operator<<(ostream& os, const NameMapKey& a){
00093 return os << a.name;
00094 }
00095
00096