ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/L1RpcTriggerAnalysis/src/GoldenPattern.cc
(Generate patch)

Comparing UserCode/L1RpcTriggerAnalysis/src/GoldenPattern.cc (file contents):
Revision 1.2 by konec, Mon May 20 23:27:11 2013 UTC vs.
Revision 1.5 by akalinow, Tue Jun 25 10:49:35 2013 UTC

# Line 20 | Line 20 | void GoldenPattern::Result::runNoCheck()
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.;
# Line 58 | Line 58 | bool GoldenPattern::Result::operator < (
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 {
# Line 71 | Line 71 | unsigned int GoldenPattern::Result::nMat
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();
# Line 130 | Line 131 | void GoldenPattern::add(const Pattern &
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;
# Line 139 | Line 141 | GoldenPattern::Result GoldenPattern::com
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);
# Line 148 | Line 153 | GoldenPattern::Result GoldenPattern::com
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() ) {
# Line 160 | Line 168 | GoldenPattern::Result GoldenPattern::com
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() ) {
# Line 187 | Line 198 | double GoldenPattern::whereInDistributio
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();
# Line 201 | Line 213 | void GoldenPattern::purge()
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     }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines