19 #include <unordered_set> 33 unordered_set<string>
outputs = {
"trackout",
51 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" could not find output: " <<
output;
59 unordered_set<string>
inputs = {
"trackin",
78 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" could not find input: " <<
input;
91 if (inputtrackfit->nTracks() == 0)
93 for (
unsigned int j = 0;
j < inputtrackfit->nTracks();
j++) {
94 Track* aTrack = inputtrackfit->getTrack(
j)->getTrack();
111 std::vector<std::pair<int, bool>> trackInfo;
113 std::vector<int> seedRank;
124 throw "Number of stublists and tracks don't match up!";
133 std::vector<std::pair<int, int>> stubidslist =
inputtrackfits_[
i]->getStubidslist(
j);
141 unsigned int curSeed = aTrack->
seedIndex();
143 seedRank.push_back(1);
144 }
else if (curSeed == 2) {
145 seedRank.push_back(2);
146 }
else if (curSeed == 5) {
147 seedRank.push_back(3);
148 }
else if (curSeed == 4) {
149 seedRank.push_back(4);
150 }
else if (curSeed == 1) {
151 seedRank.push_back(5);
152 }
else if (curSeed == 7) {
153 seedRank.push_back(6);
154 }
else if (curSeed == 3) {
155 seedRank.push_back(7);
156 }
else if (curSeed == 6) {
157 seedRank.push_back(8);
159 seedRank.push_back(9);
161 throw cms::Exception(
"LogError") << __FILE__ <<
" " << __LINE__ <<
" Seed " << curSeed
162 <<
" not found in list, and settings->extended() not set.";
165 if (stublist.size() != stubidslist.size())
166 throw "Number of stubs and stubids don't match up!";
168 trackInfo.emplace_back(
i,
false);
177 bool dupMap[numStublists][numStublists];
178 for (
unsigned int itrk = 0; itrk < numStublists; itrk++) {
179 for (
unsigned int jtrk = 0; jtrk < numStublists; jtrk++) {
180 dupMap[itrk][jtrk] =
false;
186 for (
unsigned int itrk = 0; itrk < numStublists - 1; itrk++) {
187 for (
unsigned int jtrk = itrk + 1; jtrk < numStublists; jtrk++) {
195 unsigned int nShareUR = 0;
196 unsigned int nURStubTrk1 = 0;
197 unsigned int nURStubTrk2 = 0;
200 for (
auto&
i : URArray) {
203 for (
const auto& st1 : stubsTrk1) {
204 for (
const auto& st2 : stubsTrk2) {
205 if (st1.first == st2.first && st1.second == st2.second) {
208 int reg = (
i > 0 &&
i < 10) * (
i - 1) + (
i > 10) * (
i - 5) - (
i < 0) *
i;
221 int URStubidsTrk1[16];
222 int URStubidsTrk2[16];
223 for (
int i = 0;
i < 16;
i++) {
224 URStubidsTrk1[
i] = -1;
225 URStubidsTrk2[
i] = -1;
228 for (
unsigned int stcount = 0; stcount < stubsTrk1.size(); stcount++) {
229 int i = stubsTrk1[stcount].first;
230 int reg = (
i > 0 &&
i < 10) * (
i - 1) + (
i > 10) * (
i - 5) - (
i < 0) *
i;
233 if (URStubidsTrk1[reg] != -1)
235 if (URStubidsTrk1[reg] == -1 || nres < ores) {
236 URStubidsTrk1[reg] = stcount;
240 for (
unsigned int stcount = 0; stcount < stubsTrk2.size(); stcount++) {
241 int i = stubsTrk2[stcount].first;
242 int reg = (
i > 0 &&
i < 10) * (
i - 1) + (
i > 10) * (
i - 5) - (
i < 0) *
i;
245 if (URStubidsTrk2[reg] != -1)
247 if (URStubidsTrk2[reg] == -1 || nres < ores) {
248 URStubidsTrk2[reg] = stcount;
252 for (
int i = 0;
i < 16;
i++) {
253 int t1i = URStubidsTrk1[
i];
254 int t2i = URStubidsTrk2[
i];
255 if (t1i != -1 && t2i != -1 && stubsTrk1[t1i].
first == stubsTrk2[t2i].
first &&
261 for (
int i = 0;
i < 16;
i++) {
262 if (URStubidsTrk1[
i] != -1)
264 if (URStubidsTrk2[
i] != -1)
271 dupMap[itrk][jtrk] =
true;
272 dupMap[jtrk][itrk] =
true;
278 for (
unsigned int itrk = 0; itrk < numStublists - 1; itrk++) {
279 for (
unsigned int jtrk = itrk + 1; jtrk < numStublists; jtrk++) {
281 if (dupMap[itrk][jtrk]) {
285 if (seedRank[itrk] < seedRank[jtrk]) {
294 std::vector<const Stub*> newStubList;
297 newStubList = stubsTrk1;
298 for (
unsigned int stub2it = 0; stub2it < stubsTrk2.size(); stub2it++) {
299 if (
find(stubsTrk1.begin(), stubsTrk1.end(), stubsTrk2[stub2it]) == stubsTrk1.end()) {
300 newStubList.push_back(stubsTrk2[stub2it]);
306 std::vector<std::pair<int, int>> newStubidsList;
309 newStubidsList = stubidsTrk1;
310 for (
unsigned int stub2it = 0; stub2it < stubidsTrk2.size(); stub2it++) {
311 if (
find(stubidsTrk1.begin(), stubidsTrk1.end(), stubidsTrk2[stub2it]) == stubidsTrk1.end()) {
312 newStubidsList.push_back(stubidsTrk2[stub2it]);
319 trackInfo[rejetrk].second =
true;
325 for (
unsigned int itrk = 0; itrk < numStublists; itrk++) {
326 bool duplicateTrack = trackInfo[itrk].second;
327 if (not duplicateTrack) {
334 hybridFitter.
Fit(tracklet, trackstublist);
337 if (tracklet->
fit()) {
347 outputtracks_.push_back(*outtrack);
360 return lhs->
ichisq() / lhs->
stubID().size() < rhs->ichisq() / rhs->stubID().size();
362 bool grid[35][40] = {{
false}};
364 for (
unsigned int itrk = 0; itrk < numTrk; itrk++) {
366 edm::LogPrint(
"Tracklet") <<
"WARNING: Track already tagged as duplicate!!";
381 if (phiTest < -2 *
M_PI / 27)
383 if (phiTest > 2 * 2 *
M_PI / 27)
392 for (
unsigned int itrk = 0; itrk < numTrk - 1; itrk++) {
398 unsigned int nStubP = 0;
399 vector<unsigned int> nStubS(numTrk);
400 vector<unsigned int> nShare(numTrk);
402 std::map<int, int> stubsTrk1 =
inputtracks_[itrk]->stubID();
403 nStubP = stubsTrk1.size();
405 for (
unsigned int jtrk = itrk + 1; jtrk < numTrk; jtrk++) {
411 std::map<int, int> stubsTrk2 =
inputtracks_[jtrk]->stubID();
412 nStubS[jtrk] = stubsTrk2.size();
415 for (
auto& st : stubsTrk1) {
416 if (stubsTrk2.find(st.first) != stubsTrk2.end()) {
417 if (st.second == stubsTrk2[st.first])
424 for (
unsigned int jtrk = itrk + 1; jtrk < numTrk; jtrk++) {
440 edm::LogVerbatim(
"Tracklet") <<
"Error: Didn't tag either track in duplicate pair.";
449 }
else if ((nStubS[jtrk] - nShare[jtrk] <
settings_.
minIndStubs()) && (nStubS[jtrk] <= nStubP)) {
452 edm::LogVerbatim(
"Tracklet") <<
"Error: Didn't tag either track in duplicate pair.";
468 ofstream
fout(
"seeds.txt", ofstream::app);
469 fout << __FILE__ <<
":" << __LINE__ <<
" " <<
name_ <<
"_" << iSector <<
" " 498 int seedindex = curTracklet->
seedIndex();
500 if ((seedindex == 0 && (
Layer == 1 ||
Layer == 2)) || (seedindex == 1 && (
Layer == 2 ||
Layer == 3)) ||
501 (seedindex == 2 && (
Layer == 3 ||
Layer == 4)) || (seedindex == 3 && (
Layer == 5 ||
Layer == 6)) ||
515 phires =
std::abs(stubphi - phiproj);
Log< level::Info, true > LogVerbatim
unsigned int seedIndex() const
double getPhiRes(Tracklet *curTracklet, const Stub *curStub)
std::vector< std::vector< std::pair< int, int > > > inputstubidslists_
void execute(std::vector< Track > &outputtracks_, unsigned int iSector)
void Fit(Tracklet *tracklet, std::vector< const Stub *> &trackstublist)
Projection & proj(int layerdisk)
Settings const & settings_
std::vector< CleanTrackMemory * > outputtracklets_
unsigned int minIndStubs() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< Track * > inputtracks_
static std::string const input
SeedingLayerSetsHits::SeedingLayer Layer
U second(std::pair< T, U > const &p)
Abs< T >::type abs(const T &t)
std::string removalType() const
std::vector< TrackFitMemory * > inputtrackfits_
bool writeMonitorData(std::string module) const
unsigned int layerdisk() const
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
void addInput(MemoryBase *memory, std::string input) override
std::vector< Tracklet * > inputtracklets_
std::vector< std::vector< std::pair< int, int > > > mergedstubidslists_
std::string mergeComparison() const
void addOutput(MemoryBase *memory, std::string output) override
std::vector< std::vector< const Stub * > > inputstublists_
void setStubIDprefit(std::vector< std::pair< int, int >> stubIDprefit)
const std::map< int, int > & stubID() const
void setStubIDpremerge(std::vector< std::pair< int, int >> stubIDpremerge)