20 |
|
for (auto i=benCscResult.begin(); i!=benCscResult.end();i++) fract *= norm(BENCSC,i->second); |
21 |
|
for (auto i=benDtResult.begin(); i!=benDtResult.end();i++) fract *= norm(BENDT, i->second); |
22 |
|
unsigned int nTot = nMatchedPosRpc+nMatchedPosCsc+nMatchedPosDt+nMatchedBenCsc+nMatchedBenDt; |
23 |
< |
theValue = ( nTot > 2) ? pow(fract, 1./((double) nTot)) : 0.; |
23 |
> |
theValue = ( nTot > 4) ? pow(fract, 1./((double) nTot)) : 0.; |
24 |
|
if (posRpcResult.size() != nMatchedPosRpc) theValue = 0.; |
25 |
|
if (posCscResult.size() != nMatchedPosCsc) theValue = 0.; |
26 |
|
if (posDtResult.size() != nMatchedPosDt) theValue = 0.; |
58 |
|
} |
59 |
|
|
60 |
|
GoldenPattern::Result::operator bool() const { |
61 |
< |
return (value() > 0.1); |
61 |
> |
return (value() > 0.1); // && hasStation1 && hasStation2); |
62 |
|
} |
63 |
|
|
64 |
|
double GoldenPattern::Result::value() const { |
71 |
|
return nMatchedPosRpc+nMatchedPosCsc+nMatchedBenCsc+nMatchedPosDt+nMatchedBenDt; |
72 |
|
} |
73 |
|
|
74 |
+ |
|
75 |
|
std::ostream & operator << (std::ostream &out, const GoldenPattern::Result& o) |
76 |
|
{ |
77 |
|
o.run(); |
131 |
|
GoldenPattern::Result GoldenPattern::compare(const Pattern &p) const |
132 |
|
{ |
133 |
|
Result result; |
134 |
+ |
|
135 |
|
const Pattern::DataType & detdigi = p; |
136 |
|
for (Pattern::DataType::const_iterator is = detdigi.begin(); is != detdigi.end(); ++is) { |
137 |
|
uint32_t rawId = is->first; |
141 |
|
RPCDigiSpec digi(rawId, is->second); |
142 |
|
DetFreq::const_iterator idm = posRpc.find(rawId); |
143 |
|
if (idm != posRpc.end() ) { |
144 |
< |
double f = whereInDistribution(digi.halfStrip(), idm->second); |
145 |
< |
result.posRpcResult.push_back( std::make_pair(rawId, f) ); |
144 |
> |
double f = whereInDistribution(digi.halfStrip(), idm->second); |
145 |
> |
result.posRpcResult.push_back( std::make_pair(rawId, f) ); |
146 |
> |
RPCDetId rpc(rawId); |
147 |
> |
if(rpc.station()==1) result.hasStation1 = true; |
148 |
> |
if(rpc.station()==2) result.hasStation2 = true; |
149 |
|
} |
150 |
|
} else if (detId.subdetId() == MuonSubdetId::DT) { |
151 |
|
DTphDigiSpec digi(rawId, is->second); |
153 |
|
if (idm != posDt.end() ) { |
154 |
|
double f = whereInDistribution(digi.phi(), idm->second); |
155 |
|
result.posDtResult.push_back( std::make_pair(rawId, f) ); |
156 |
+ |
DTChamberId dt(rawId); |
157 |
+ |
if(dt.station()==1) result.hasStation1 = true; |
158 |
+ |
if(dt.station()==2) result.hasStation2 = true; |
159 |
|
} |
160 |
|
idm = bendingDt.find(rawId); |
161 |
|
if (idm != bendingDt.end() ) { |
168 |
|
if (idm != posCsc.end() ) { |
169 |
|
double f = whereInDistribution(digi.strip(), idm->second); |
170 |
|
result.posCscResult.push_back( std::make_pair(rawId, f) ); |
171 |
+ |
CSCDetId csc(rawId); |
172 |
+ |
if (csc.station()==1) result.hasStation1 = true; |
173 |
+ |
if (csc.station()==2) result.hasStation1 = true; |
174 |
|
} |
175 |
|
idm = bendingCsc.find(rawId); |
176 |
|
if (idm != bendingCsc.end() ) { |
198 |
|
|
199 |
|
void GoldenPattern::purge() |
200 |
|
{ |
201 |
+ |
|
202 |
|
for (DetFreq::iterator idf=posRpc.begin(); idf != posRpc.end(); idf++) { |
203 |
|
MFreq & mfreq = idf->second; |
204 |
|
MFreq::iterator imf = mfreq.begin(); |
213 |
|
if (mfreq[pos]==1 && bef1==0 && aft1==0) remove = true; |
214 |
|
if (mfreq[pos]==1 && aft1==1 && aft2==0 && aft3==0 && bef1==0 && bef2==0) remove = true; |
215 |
|
if (mfreq[pos]==2 && aft1==0 && aft2==0 && bef1==0 && bef2==0) remove = true; |
216 |
+ |
//if(remove) std::cout<<"Cleaning pattern: "<<*this<<std::endl; |
217 |
|
if (remove) { mfreq.erase(imf++); } else { ++imf; } |
218 |
|
} |
219 |
|
} |
220 |
|
DetFreq::iterator idf=posRpc.begin(); |
221 |
|
while (idf != posRpc.end()) if (idf->second.size()==0) posRpc.erase(idf++); else ++idf; |
222 |
|
|
223 |
< |
} |
223 |
> |
} |
224 |
|
|
225 |
|
std::ostream & operator << (std::ostream &out, const GoldenPattern & o) { |
226 |
|
out <<"GoldenPattern"<< o.theKey <<std::endl; |
227 |
|
// RPC |
228 |
|
for (GoldenPattern::DetFreq::const_iterator im = o.posRpc.begin(); im != o.posRpc.end(); im++) { |
229 |
< |
out <<"RPC Det:"<< im->first<<" Pos: "; |
229 |
> |
out <<"POSRPC Det: "<< im->first<<" Value: "; |
230 |
|
for (GoldenPattern::MFreq::const_iterator it = im->second.begin(); it != im->second.end(); it++) { out << it->first<<":"<<it->second<<", "; } |
231 |
|
out << std::endl; |
232 |
|
} |
233 |
< |
// DT pos |
234 |
< |
for (GoldenPattern::DetFreq::const_iterator im = o.posDt.begin(); im != o.posDt.end(); im++) { |
235 |
< |
out <<"DT Det:"<< im->first<<" Pos: "; |
233 |
> |
// Csc pos |
234 |
> |
for (GoldenPattern::DetFreq::const_iterator im = o.posCsc.begin(); im != o.posCsc.end(); im++) { |
235 |
> |
out <<"POSCSC Det: "<< im->first<<" Value: "; |
236 |
|
for (GoldenPattern::MFreq::const_iterator it = im->second.begin(); it != im->second.end(); it++) { out << it->first<<":"<<it->second<<", "; } |
237 |
|
out << std::endl; |
238 |
|
} |
239 |
< |
// DT bending |
240 |
< |
for (GoldenPattern::DetFreq::const_iterator im = o.bendingDt.begin(); im != o.bendingDt.end(); im++) { |
241 |
< |
out <<"DT Det:"<< im->first<<" Ben: "; |
239 |
> |
// Csc bending |
240 |
> |
for (GoldenPattern::DetFreq::const_iterator im = o.bendingCsc.begin(); im != o.bendingCsc.end(); im++) { |
241 |
> |
out <<"BENCSC Det: "<< im->first<<" Value: "; |
242 |
|
for (GoldenPattern::MFreq::const_iterator it = im->second.begin(); it != im->second.end(); it++) { out << it->first<<":"<<it->second<<", "; } |
243 |
|
out << std::endl; |
244 |
|
} |
245 |
< |
|
246 |
< |
// Csc pos |
247 |
< |
for (GoldenPattern::DetFreq::const_iterator im = o.posCsc.begin(); im != o.posCsc.end(); im++) { |
235 |
< |
out <<"Csc Det:"<< im->first<<" Pos: "; |
245 |
> |
// DT pos |
246 |
> |
for (GoldenPattern::DetFreq::const_iterator im = o.posDt.begin(); im != o.posDt.end(); im++) { |
247 |
> |
out <<"POSDT Det: "<< im->first<<" Value: "; |
248 |
|
for (GoldenPattern::MFreq::const_iterator it = im->second.begin(); it != im->second.end(); it++) { out << it->first<<":"<<it->second<<", "; } |
249 |
|
out << std::endl; |
250 |
|
} |
251 |
< |
// Csc bending |
252 |
< |
for (GoldenPattern::DetFreq::const_iterator im = o.bendingCsc.begin(); im != o.bendingCsc.end(); im++) { |
253 |
< |
out <<"Csc Det:"<< im->first<<" Ben: "; |
251 |
> |
// DT bending |
252 |
> |
for (GoldenPattern::DetFreq::const_iterator im = o.bendingDt.begin(); im != o.bendingDt.end(); im++) { |
253 |
> |
out <<"BENDT Det: "<< im->first<<" Value: "; |
254 |
|
for (GoldenPattern::MFreq::const_iterator it = im->second.begin(); it != im->second.end(); it++) { out << it->first<<":"<<it->second<<", "; } |
255 |
|
out << std::endl; |
256 |
|
} |