27 if((segmCleanerMode!=1)&&(segmCleanerMode!=2)&&(segmCleanerMode!=3))
29 <<
"Wrong segmCleanerMode! It must be 1,2 or 3. The default is 1";
38 if (inputCands.size()<2)
return inputCands;
40 vector<DTSegmentCand*>
result = solveConflict(inputCands);
43 result = ghostBuster(result);
49 vector<DTSegmentCand*>
result;
51 vector<DTSegmentCand*> ghosts;
54 for (vector<DTSegmentCand*>::const_iterator
cand=inputCands.begin();
56 for (vector<DTSegmentCand*>::const_iterator cand2 =
cand+1 ; cand2!=inputCands.end() ; ++cand2) {
60 if (confHits.size()) {
64 if((confHits.size())==((*cand)->nHits()) && (confHits.size())==((*cand2)->nHits())
65 && (fabs((*cand)->chi2()-(*cand2)->chi2())<0.1)) {
70 if((*cand)->superLayer()->id().superlayer() != 2) {
74 float phi1=(atan((dir1.
x())/(dir1.
z())));
75 float phi2=(atan((dir2.
x())/(dir2.
z())));
77 badCand = (fabs(phi1) > fabs(phi2)) ? (*
cand) : (*cand2);
83 GlobalVector cand1GlobDir = (*cand)->superLayer()->toGlobal((*cand)->direction());
84 GlobalPoint cand1GlobPos = (*cand)->superLayer()->toGlobal((*cand)->position());
86 float DAlpha1 = fabs(cand1GlobDir.
theta()-cand1GlobVecIP.
theta());
89 GlobalVector cand2GlobDir = (*cand2)->superLayer()->toGlobal((*cand2)->direction());
90 GlobalPoint cand2GlobPos = (*cand2)->superLayer()->toGlobal((*cand2)->position());
92 float DAlpha2 = fabs(cand2GlobDir.theta()-cand2GlobVecIP.
theta());
94 badCand = (DAlpha1 > DAlpha2) ? (*
cand) : (*cand2);
97 for (DTSegmentCand::AssPointCont::const_iterator cHit=confHits.begin() ;
98 cHit!=confHits.end(); ++cHit) {
110 if (((*cand)->t0()*(*cand2)->t0()!=0) || ((*cand)->t0()==(*cand2)->t0())) {
111 DTSegmentCand* badCand = (**cand) < (**cand2) ? (*cand) : (*cand2);
113 for (DTSegmentCand::AssPointCont::const_iterator cHit=confHits.begin() ;
114 cHit!=confHits.end(); ++cHit) badCand->
removeHit(*cHit);
122 vector<DTSegmentCand*>::const_iterator
cand=inputCands.begin();
123 while ( cand < inputCands.end() ) {
124 if ((*cand)->good()) result.push_back(*cand);
126 vector<DTSegmentCand*>::const_iterator badCand=cand;
134 vector<DTSegmentCand*>
136 vector<DTSegmentCand*> ghosts;
137 for (vector<DTSegmentCand*>::const_iterator
cand=inputCands.begin();
139 for (vector<DTSegmentCand*>::const_iterator cand2=
cand+1;
140 cand2!=inputCands.end(); ++cand2) {
141 unsigned int nSharedHits=(*cand)->nSharedHitPairs(*(*cand2));
144 if ((nSharedHits==((*cand)->nHits())) && (nSharedHits==((*cand2)->nHits()))
145 &&(fabs((*cand)->chi2()-(*cand2)->chi2())<0.1)
151 if (((*cand)->nHits()==3 || (*cand2)->nHits()==3)
152 &&(fabs((*cand)->chi2()-(*cand2)->chi2())<0.0001))
158 if (((*cand2)->nHits()==(*cand)->nHits()) && ((*cand)->t0()*(*cand2)->t0()==0) && ((*cand)->t0()!=(*cand2)->t0()))
168 if ((**
cand)<(**cand2)) {
169 ghosts.push_back(*
cand);
172 ghosts.push_back(*cand2);
180 vector<DTSegmentCand*>
result;
181 for (vector<DTSegmentCand*>::const_iterator
cand=inputCands.begin();
184 for (vector<DTSegmentCand*>::const_iterator ghost=ghosts.begin();
185 ghost!=ghosts.end(); ++ghost) {
186 if ((*
cand)==(*ghost)) {
191 if (!isGhost) result.push_back(*
cand);
T getParameter(std::string const &) const
std::vector< DTSegmentCand * > solveConflict(const std::vector< DTSegmentCand * > &inputCands) const
solve the conflicts
std::vector< DTSegmentCand * > clean(const std::vector< DTSegmentCand * > &inputCands) const
do the cleaning
Geom::Theta< T > theta() const
DTSegmentCleaner(const edm::ParameterSet &pset)
std::set< AssPoint, AssPointLessZ > AssPointCont
std::vector< DTSegmentCand * > ghostBuster(const std::vector< DTSegmentCand * > &inputCands) const
ghost suppression
virtual void removeHit(AssPoint hit)
remove hit from the candidate