23 nSharedHitsMax = pset.
getParameter<
int>(
"nSharedHitsMax");
25 nUnSharedHitsMin = pset.
getParameter<
int>(
"nUnSharedHitsMin");
27 segmCleanerMode = pset.
getParameter<
int>(
"segmCleanerMode");
29 if((segmCleanerMode!=1)&&(segmCleanerMode!=2)&&(segmCleanerMode!=3))
31 <<
"Wrong segmCleanerMode! It must be 1,2 or 3. The default is 1";
40 if (inputCands.size()<2)
return inputCands;
42 vector<DTSegmentCand*>
result = solveConflict(inputCands);
44 result = ghostBuster(result);
50 vector<DTSegmentCand*>
result;
52 vector<DTSegmentCand*> ghosts;
55 for (vector<DTSegmentCand*>::iterator cand=inputCands.begin();
56 cand!=inputCands.end(); ++cand) {
57 for (vector<DTSegmentCand*>::iterator cand2 = cand+1 ; cand2!=inputCands.end() ; ++cand2) {
61 if (confHits.size()) {
65 if((confHits.size())==((*cand)->nHits()) && (confHits.size())==((*cand2)->nHits())
66 && (fabs((*cand)->chi2()-(*cand2)->chi2())<0.1) ) {
68 if(segmCleanerMode == 2) {
71 if((*cand)->superLayer()->id().superlayer() != 2) {
75 float phi1=(atan((dir1.
x())/(dir1.
z())));
76 float phi2=(atan((dir2.
x())/(dir2.
z())));
78 badCand = (fabs(phi1) > fabs(phi2)) ? (*cand) : (*cand2);
84 GlobalVector cand1GlobDir = (*cand)->superLayer()->toGlobal((*cand)->direction());
85 GlobalPoint cand1GlobPos = (*cand)->superLayer()->toGlobal((*cand)->position());
87 float DAlpha1 = fabs(cand1GlobDir.
theta()-cand1GlobVecIP.
theta());
90 GlobalVector cand2GlobDir = (*cand2)->superLayer()->toGlobal((*cand2)->direction());
91 GlobalPoint cand2GlobPos = (*cand2)->superLayer()->toGlobal((*cand2)->position());
93 float DAlpha2 = fabs(cand2GlobDir.theta()-cand2GlobVecIP.
theta());
95 badCand = (DAlpha1 > DAlpha2) ? (*cand) : (*cand2);
99 for (DTSegmentCand::AssPointCont::const_iterator cHit=confHits.begin() ;
100 cHit!=confHits.end(); ++cHit) {
109 DTSegmentCand* badCand = (**cand) < (**cand2) ? (*cand) : (*cand2);
110 for (DTSegmentCand::AssPointCont::const_iterator cHit=confHits.begin() ;
111 cHit!=confHits.end(); ++cHit) badCand->
removeHit(*cHit);
119 vector<DTSegmentCand*>::iterator cand=inputCands.begin();
120 while ( cand < inputCands.end() ) {
121 if ((*cand)->good()) result.push_back(*cand);
123 vector<DTSegmentCand*>::iterator badCand=cand;
131 vector<DTSegmentCand*>
133 vector<DTSegmentCand*> ghosts;
134 for (vector<DTSegmentCand*>::iterator cand=inputCands.begin();
135 cand!=inputCands.end(); ++cand) {
136 for (vector<DTSegmentCand*>::iterator cand2=cand+1;
137 cand2!=inputCands.end(); ++cand2) {
138 unsigned int nSharedHits=(*cand)->nSharedHitPairs(*(*cand2));
141 if ((nSharedHits==((*cand)->nHits())) && (nSharedHits==((*cand2)->nHits()))
142 &&(fabs((*cand)->chi2()-(*cand2)->chi2())<0.1)
143 &&(segmCleanerMode==3))
149 if ((
int)nSharedHits >= nSharedHitsMax ||
150 (int)((*cand)->nHits()-nSharedHits)<=nUnSharedHitsMin ||
151 (
int)((*cand2)->nHits()-nSharedHits)<=nUnSharedHitsMin) {
153 if ((**cand)<(**cand2)) {
154 ghosts.push_back(*cand);
157 ghosts.push_back(*cand2);
165 vector<DTSegmentCand*>
result;
166 for (vector<DTSegmentCand*>::const_iterator cand=inputCands.begin();
167 cand!=inputCands.end(); ++cand) {
169 for (vector<DTSegmentCand*>::const_iterator ghost=ghosts.begin();
170 ghost!=ghosts.end(); ++ghost) {
171 if ((*cand)==(*ghost)) {
176 if (!isGhost) result.push_back(*cand);
T getParameter(std::string const &) const
Geom::Theta< T > theta() const
DTSegmentCleaner(const edm::ParameterSet &pset)
std::vector< DTSegmentCand * > solveConflict(std::vector< DTSegmentCand * > inputCands) const
solve the conflicts
std::vector< DTSegmentCand * > ghostBuster(std::vector< DTSegmentCand * > inputCands) const
ghost suppression
std::set< AssPoint, AssPointLessZ > AssPointCont
std::vector< DTSegmentCand * > clean(std::vector< DTSegmentCand * > inputCands) const
do the cleaning
virtual void removeHit(AssPoint hit)
remove hit from the candidate