8 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/DTphDigiSpec.h" |
9 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/CSCDigiSpec.h" |
10 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/RPCDigiSpec.h" |
11 |
+ |
#include "DataFormats/MuonDetId/interface/MuonSubdetId.h" |
12 |
|
|
13 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/Pattern.h" |
14 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/GoldenPattern.h" |
37 |
|
PatternManager::~PatternManager() |
38 |
|
{ |
39 |
|
std::cout <<" Events checked for pattenrs: " << theEvForPatCounter << std::endl; |
40 |
< |
std::cout <<" Events used for pattenrs: " << theEvForPatCounter << std::endl; |
40 |
> |
std::cout <<" Events used for pattenrs: " << theEvUsePatCounter << std::endl; |
41 |
|
std::cout <<" Size of GoldenPatterns: " << theGPs.size() << std::endl; |
42 |
|
if (theConfig.getUntrackedParameter<bool>("dump",false)) { |
43 |
|
for (std::map< GoldenPattern::Key, GoldenPattern>::const_iterator |
86 |
|
{ |
87 |
|
L1Obj candidate; |
88 |
|
if (!hitSpec) return candidate; |
88 |
– |
/* |
89 |
|
if (hitSpec->rawId() == 0 ) return candidate; |
90 |
|
double phiref = hitSpec->position().phi(); |
91 |
|
double ptref = simu->pt(); |
92 |
|
int chargeref = simu->charge(); |
93 |
|
unsigned int detref = hitSpec->rawId(); |
94 |
+ |
/* |
95 |
|
if (detref != 637602109 && detref != 637634877 && |
96 |
|
detref != 637599914 && detref != 637632682 ) return candidate; |
97 |
|
|
99 |
|
if (!precisePos) return candidate; |
100 |
|
if ( simu->pt() < 26. || simu->pt() > 27. ) return candidate; |
101 |
|
|
101 |
– |
std::cout <<" ------------------ EVENT: " << std::endl; |
102 |
|
*/ |
103 |
< |
Pattern pattern; |
103 |
> |
// std::cout <<" ------------------ EVENT: "<<*ev <<" number of digis: "<<vDigi.size()<< std::endl; |
104 |
> |
std::vector<Pattern> vpattern(1); |
105 |
|
theEvForPatCounter++; |
106 |
+ |
static bool skipRpcData = theConfig.getUntrackedParameter<bool>("skipRpcData", false); |
107 |
+ |
static bool skipDtCscData = theConfig.getUntrackedParameter<bool>("skipDtCscData",false); |
108 |
|
for (VDigiSpec::const_iterator is= vDigi.begin(); is!=vDigi.end(); is++) { |
109 |
< |
bool isOK = pattern.add(*is); |
110 |
< |
if (!isOK) { return candidate; } |
109 |
> |
DetId detId( is->first); |
110 |
> |
if (skipRpcData && detId.subdetId()==MuonSubdetId::RPC) continue; |
111 |
> |
if (skipDtCscData && (detId.subdetId()==MuonSubdetId::DT || detId.subdetId()==MuonSubdetId::CSC) ) continue; |
112 |
> |
// std::cout << "adding------- "<< is-vDigi.begin()+1 <<" digi det: "<<is->first<<"(rpc:"<<(detId.subdetId()==MuonSubdetId::RPC)<<") data: "<<is->second<< std::endl; |
113 |
> |
Pattern::add(vpattern,*is); |
114 |
> |
// std::cout <<" after vpattern has size: "<<vpattern.size() << std::endl; |
115 |
> |
if (vpattern.size() > 100) break; |
116 |
|
} |
117 |
< |
if (pattern.size() == 0) return candidate; |
118 |
< |
// std::cout <<" ------------------ END EVENT, COMPARE" << std::endl; |
117 |
> |
if (vpattern[0].size() == 0) return candidate; |
118 |
> |
// std::cout <<" ------------------ END EVENT, NOW COMPARE, has #patterns: "<<vpattern.size()<<" vpattern[0].size="<<vpattern[0].size() << std::endl; |
119 |
|
|
120 |
< |
// GoldenPattern::Key thisKey(detref, ptref, chargeref, phiref ); |
120 |
> |
GoldenPattern::Key thisKey(detref, ptref, chargeref, phiref ); |
121 |
|
// std::cout << thisKey << std::endl; |
122 |
|
|
123 |
|
GoldenPattern::Result bestMatching; |
124 |
|
GoldenPattern::Key bestKey; |
125 |
+ |
for (auto ip=vpattern.begin(); ip!= vpattern.end();++ip) { |
126 |
+ |
const Pattern & pattern = *ip; |
127 |
+ |
// std::cout << " HAS PATTERN "<<pattern << std::endl; |
128 |
|
for (std::map< GoldenPattern::Key, GoldenPattern>::iterator igps = theGPs.begin(); igps != theGPs.end(); igps++) { |
129 |
|
// if (!(thisKey==igps->first)) continue; |
119 |
– |
// std::cout << " HAS PATTERN "<<pattern << std::endl; |
130 |
|
GoldenPattern & gp = igps->second; |
131 |
|
GoldenPattern::Result result = gp.compare(pattern); |
132 |
|
// if (!result.hasRpcDet(637602109) && !result.hasRpcDet(637634877) && !result.hasRpcDet(637599914) && !result.hasRpcDet(637632682)) continue; |
133 |
< |
if (!result.hasRpcDet(igps->first.theDet)) continue; |
134 |
< |
if (result > bestMatching) { |
133 |
> |
// if (!result.hasRpcDet(igps->first.theDet)) continue; |
134 |
> |
// if (result.nMatchedTot() < 5 )continue; |
135 |
> |
// if (!result) continue; |
136 |
> |
// std::cout <<"PATT KEY: "<<igps->first<<" "<<result ; //<<std::endl; |
137 |
> |
if (bestMatching < result) { |
138 |
|
bestMatching = result; |
139 |
|
bestKey = igps->first; |
140 |
< |
} |
141 |
< |
// std::cout <<result << std::endl; |
140 |
> |
// std::cout <<" ----"<<" pt: "<< bestKey.ptValue()<<std::endl; |
141 |
> |
} |
142 |
> |
//else std::cout <<std::endl; |
143 |
|
} |
144 |
+ |
} |
145 |
+ |
|
146 |
|
// std::cout <<" ------------------ END COMPARE: " << std::endl; |
147 |
< |
// std::cout <<"BEST: "<< bestMatching<<" pt: "<<bestKey.ptValue()<<std::endl; |
147 |
> |
// std::cout <<"BEST KEY: "<<bestKey<<" "<< bestMatching<<std::cout <<" ######"<<" pt: "<< bestKey.ptValue()<<std::endl; |
148 |
> |
// abort(); |
149 |
|
if (bestMatching) { |
150 |
|
candidate.pt = bestKey.ptValue(); |
151 |
|
candidate.eta = 1.; |