CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
trklet::PurgeDuplicate Class Reference

#include <PurgeDuplicate.h>

Inheritance diagram for trklet::PurgeDuplicate:
trklet::ProcessBase

Public Member Functions

void addInput (MemoryBase *memory, std::string input) override
 
void addOutput (MemoryBase *memory, std::string output) override
 
void execute (std::vector< Track * > &outputtracks_)
 
 PurgeDuplicate (std::string name, Settings const &settings, Globals *global, unsigned int iSector)
 
 ~PurgeDuplicate () override=default
 
- Public Member Functions inherited from trklet::ProcessBase
unsigned int getISeed (std::string name)
 
std::string const & getName () const
 
unsigned int initLayerDisk (unsigned int pos)
 
void initLayerDisk (unsigned int pos, int &layer, int &disk)
 
void initLayerDisk (unsigned int pos, int &layer, int &disk, int &layerdisk)
 
void initLayerDisksandISeed (unsigned int &layerdisk1, unsigned int &layerdisk2, unsigned int &iSeed)
 
unsigned int nbits (unsigned int power)
 
 ProcessBase (std::string name, Settings const &settings, Globals *global, unsigned int iSector)
 
virtual ~ProcessBase ()=default
 

Private Member Functions

double getPhiRes (Tracklet *curTracklet, const Stub *curStub)
 

Private Attributes

std::vector< std::vector< std::pair< int, int > > > inputstubidslists_
 
std::vector< std::vector< const Stub * > > inputstublists_
 
std::vector< TrackFitMemory * > inputtrackfits_
 
std::vector< Tracklet * > inputtracklets_
 
std::vector< Track * > inputtracks_
 
std::vector< std::vector< std::pair< int, int > > > mergedstubidslists_
 
std::vector< CleanTrackMemory * > outputtracklets_
 

Additional Inherited Members

- Protected Attributes inherited from trklet::ProcessBase
Globalsglobals_
 
unsigned int iSector_
 
std::string name_
 
double phimax_
 
double phimin_
 
Settings const & settings_
 

Detailed Description

Definition at line 20 of file PurgeDuplicate.h.

Constructor & Destructor Documentation

◆ PurgeDuplicate()

PurgeDuplicate::PurgeDuplicate ( std::string  name,
Settings const &  settings,
Globals global,
unsigned int  iSector 
)

Definition at line 25 of file PurgeDuplicate.cc.

26  : ProcessBase(name, settings, global, iSector) {}

◆ ~PurgeDuplicate()

trklet::PurgeDuplicate::~PurgeDuplicate ( )
overridedefault

Member Function Documentation

◆ addInput()

void PurgeDuplicate::addInput ( MemoryBase memory,
std::string  input 
)
overridevirtual

Implements trklet::ProcessBase.

Definition at line 54 of file PurgeDuplicate.cc.

54  {
55  if (settings_.writetrace()) {
56  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding input from " << memory->getName() << " to input "
57  << input;
58  }
59  unordered_set<string> inputs = {"trackin",
60  "trackin1",
61  "trackin2",
62  "trackin3",
63  "trackin4",
64  "trackin5",
65  "trackin6",
66  "trackin7",
67  "trackin8",
68  "trackin9",
69  "trackin10",
70  "trackin11",
71  "trackin12"};
72  if (inputs.find(input) != inputs.end()) {
73  auto* tmp = dynamic_cast<TrackFitMemory*>(memory);
74  assert(tmp != nullptr);
75  inputtrackfits_.push_back(tmp);
76  return;
77  }
78  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " could not find input: " << input;
79 }

References cms::cuda::assert(), Exception, input, PixelMapPlotter::inputs, inputtrackfits_, trklet::ProcessBase::name_, trklet::ProcessBase::settings_, createJobs::tmp, and trklet::Settings::writetrace().

◆ addOutput()

void PurgeDuplicate::addOutput ( MemoryBase memory,
std::string  output 
)
overridevirtual

Implements trklet::ProcessBase.

Definition at line 28 of file PurgeDuplicate.cc.

28  {
29  if (settings_.writetrace()) {
30  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding output to " << memory->getName() << " to output "
31  << output;
32  }
33  unordered_set<string> outputs = {"trackout",
34  "trackout1",
35  "trackout2",
36  "trackout3",
37  "trackout4",
38  "trackout5",
39  "trackout6",
40  "trackout7",
41  "trackout8",
42  "trackout9",
43  "trackout10",
44  "trackout11"};
45  if (outputs.find(output) != outputs.end()) {
46  auto* tmp = dynamic_cast<CleanTrackMemory*>(memory);
47  assert(tmp != nullptr);
48  outputtracklets_.push_back(tmp);
49  return;
50  }
51  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " could not find output: " << output;
52 }

References cms::cuda::assert(), Exception, trklet::ProcessBase::name_, convertSQLitetoXML_cfg::output, PatBasicFWLiteJetAnalyzer_Selector_cfg::outputs, outputtracklets_, trklet::ProcessBase::settings_, createJobs::tmp, and trklet::Settings::writetrace().

◆ execute()

void PurgeDuplicate::execute ( std::vector< Track * > &  outputtracks_)

Definition at line 81 of file PurgeDuplicate.cc.

81  {
82  inputtracklets_.clear();
83  inputtracks_.clear();
84 
85  inputstubidslists_.clear();
86  inputstublists_.clear();
87  mergedstubidslists_.clear();
88 
89  if (settings_.removalType() != "merge") {
90  for (auto& inputtrackfit : inputtrackfits_) {
91  if (inputtrackfit->nTracks() == 0)
92  continue;
93  for (unsigned int j = 0; j < inputtrackfit->nTracks(); j++) {
94  Track* aTrack = inputtrackfit->getTrack(j)->getTrack();
95  aTrack->setSector(iSector_);
96  inputtracks_.push_back(aTrack);
97  }
98  }
99  if (inputtracks_.empty())
100  return;
101  }
102 
103  unsigned int numTrk = inputtracks_.size();
104 
106  // Hybrid Removal //
108 #ifdef USEHYBRID
109 
110  if (settings_.removalType() == "merge") {
111  std::vector<std::pair<int, bool>> trackInfo; // Track seed & duplicate flag
112  // Vector to store the relative rank of the track candidate for merging, based on seed type
113  std::vector<int> seedRank;
114 
115  // Get vectors from TrackFit and save them
116  // inputtracklets: Tracklet objects from the FitTrack (not actually fit yet)
117  // inputstublists: L1Stubs for that track
118  // inputstubidslists: Stub stubIDs for that 3rack
119  // mergedstubidslists: the same as inputstubidslists, but will be used during duplicate removal
120  for (unsigned int i = 0; i < inputtrackfits_.size(); i++) {
121  if (inputtrackfits_[i]->nStublists() == 0)
122  continue;
123  if (inputtrackfits_[i]->nStublists() != inputtrackfits_[i]->nTracks())
124  throw "Number of stublists and tracks don't match up!";
125  for (unsigned int j = 0; j < inputtrackfits_[i]->nStublists(); j++) {
126  Tracklet* aTrack = inputtrackfits_[i]->getTrack(j);
128 
129  std::vector<const Stub*> stublist = inputtrackfits_[i]->getStublist(j);
130 
131  inputstublists_.push_back(stublist);
132 
133  std::vector<std::pair<int, int>> stubidslist = inputtrackfits_[i]->getStubidslist(j);
134  inputstubidslists_.push_back(stubidslist);
135  mergedstubidslists_.push_back(stubidslist);
136 
137  // Encoding: L1L2=0, L2L3=1, L3L4=2, L5L6=3, D1D2=4, D3D4=5, L1D1=6, L2D1=7
138  // Best Guess: L1L2 > L1D1 > L2L3 > L2D1 > D1D2 > L3L4 > L5L6 > D3D4
139  // Best Rank: L1L2 > L3L4 > D3D4 > D1D2 > L2L3 > L2D1 > L5L6 > L1D1
140  // Rank-Informed Guess: L1L2 > L3L4 > L1D1 > L2L3 > L2D1 > D1D2 > L5L6 > D3D4
141  unsigned int curSeed = aTrack->seedIndex();
142  if (curSeed == 0) {
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);
158  } else if (settings_.extended()) {
159  seedRank.push_back(9);
160  } else {
161  throw cms::Exception("LogError") << __FILE__ << " " << __LINE__ << " Seed " << curSeed
162  << " not found in list, and settings->extended() not set.";
163  }
164 
165  if (stublist.size() != stubidslist.size())
166  throw "Number of stubs and stubids don't match up!";
167 
168  trackInfo.emplace_back(i, false);
169  }
170  }
171 
172  if (inputtracklets_.empty())
173  return;
174  unsigned int numStublists = inputstublists_.size();
175 
176  // Initialize all-false 2D array of tracks being duplicates to other tracks
177  bool dupMap[numStublists][numStublists]; // Ends up symmetric
178  for (unsigned int itrk = 0; itrk < numStublists; itrk++) {
179  for (unsigned int jtrk = 0; jtrk < numStublists; jtrk++) {
180  dupMap[itrk][jtrk] = false;
181  }
182  }
183 
184  // Find duplicates; Fill dupMap by looping over all pairs of "tracks"
185  // numStublists-1 since last track has no other to compare to
186  for (unsigned int itrk = 0; itrk < numStublists - 1; itrk++) {
187  for (unsigned int jtrk = itrk + 1; jtrk < numStublists; jtrk++) {
188  // Get primary track stubids
189  const std::vector<std::pair<int, int>>& stubsTrk1 = inputstubidslists_[itrk];
190 
191  // Get and count secondary track stubids
192  const std::vector<std::pair<int, int>>& stubsTrk2 = inputstubidslists_[jtrk];
193 
194  // Count number of Unique Regions (UR) that share stubs, and the number of UR that each track hits
195  unsigned int nShareUR = 0;
196  unsigned int nURStubTrk1 = 0;
197  unsigned int nURStubTrk2 = 0;
198  if (settings_.mergeComparison() == "CompareAll") {
199  bool URArray[16];
200  for (auto& i : URArray) {
201  i = false;
202  };
203  for (const auto& st1 : stubsTrk1) {
204  for (const auto& st2 : stubsTrk2) {
205  if (st1.first == st2.first && st1.second == st2.second) {
206  // Converts region encoded in st1->first to an index in the Unique Region (UR) array
207  int i = st1.first;
208  int reg = (i > 0 && i < 10) * (i - 1) + (i > 10) * (i - 5) - (i < 0) * i;
209  if (!URArray[reg]) {
210  nShareUR++;
211  URArray[reg] = true;
212  }
213  }
214  }
215  }
216  } else if (settings_.mergeComparison() == "CompareBest") {
217  std::vector<const Stub*> fullStubslistsTrk1 = inputstublists_[itrk];
218  std::vector<const Stub*> fullStubslistsTrk2 = inputstublists_[jtrk];
219 
220  // Arrays to store the index of the best stub in each region
221  int URStubidsTrk1[16];
222  int URStubidsTrk2[16];
223  for (int i = 0; i < 16; i++) {
224  URStubidsTrk1[i] = -1;
225  URStubidsTrk2[i] = -1;
226  }
227  // For each stub on the first track, find the stub with the best residual and store its index in the URStubidsTrk1 array
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;
231  double nres = getPhiRes(inputtracklets_[itrk], fullStubslistsTrk1[stcount]);
232  double ores = 0;
233  if (URStubidsTrk1[reg] != -1)
234  ores = getPhiRes(inputtracklets_[itrk], fullStubslistsTrk1[URStubidsTrk1[reg]]);
235  if (URStubidsTrk1[reg] == -1 || nres < ores) {
236  URStubidsTrk1[reg] = stcount;
237  }
238  }
239  // For each stub on the second track, find the stub with the best residual and store its index in the URStubidsTrk1 array
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;
243  double nres = getPhiRes(inputtracklets_[jtrk], fullStubslistsTrk2[stcount]);
244  double ores;
245  if (URStubidsTrk2[reg] != -1)
246  ores = getPhiRes(inputtracklets_[jtrk], fullStubslistsTrk2[URStubidsTrk2[reg]]);
247  if (URStubidsTrk2[reg] == -1 || nres < ores) {
248  URStubidsTrk2[reg] = stcount;
249  }
250  }
251  // For all 16 regions (6 layers and 10 disks), count the number of regions who's best stub on both tracks are the same
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 &&
256  stubsTrk1[t1i].second == stubsTrk2[t2i].second)
257  nShareUR++;
258  }
259  // Calculate the number of unique regions hit by each track, so that this number can be used in calculating the number of independent
260  // stubs on a track (not enabled/used by default)
261  for (int i = 0; i < 16; i++) {
262  if (URStubidsTrk1[i] != -1)
263  nURStubTrk1++;
264  if (URStubidsTrk2[i] != -1)
265  nURStubTrk2++;
266  }
267  }
268 
269  // Fill duplicate map
270  if (nShareUR >= settings_.minIndStubs()) { // For number of shared stub merge condition
271  dupMap[itrk][jtrk] = true;
272  dupMap[jtrk][itrk] = true;
273  }
274  }
275  }
276 
277  // Merge duplicate tracks
278  for (unsigned int itrk = 0; itrk < numStublists - 1; itrk++) {
279  for (unsigned int jtrk = itrk + 1; jtrk < numStublists; jtrk++) {
280  // Merge a track with its first duplicate found.
281  if (dupMap[itrk][jtrk]) {
282  // Set preferred track based on seed rank
283  int preftrk;
284  int rejetrk;
285  if (seedRank[itrk] < seedRank[jtrk]) {
286  preftrk = itrk;
287  rejetrk = jtrk;
288  } else {
289  preftrk = jtrk;
290  rejetrk = itrk;
291  }
292 
293  // Get a merged stub list
294  std::vector<const Stub*> newStubList;
295  std::vector<const Stub*> stubsTrk1 = inputstublists_[rejetrk];
296  std::vector<const Stub*> stubsTrk2 = inputstublists_[preftrk];
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]);
301  }
302  }
303  // Overwrite stublist of preferred track with merged list
304  inputstublists_[preftrk] = newStubList;
305 
306  std::vector<std::pair<int, int>> newStubidsList;
307  std::vector<std::pair<int, int>> stubidsTrk1 = mergedstubidslists_[rejetrk];
308  std::vector<std::pair<int, int>> stubidsTrk2 = mergedstubidslists_[preftrk];
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]);
313  }
314  }
315  // Overwrite stubidslist of preferred track with merged list
316  mergedstubidslists_[preftrk] = newStubidsList;
317 
318  // Mark that rejected track has been merged into another track
319  trackInfo[rejetrk].second = true;
320  }
321  }
322  }
323 
324  // Make the final track objects, fit with KF, and send to output
325  for (unsigned int itrk = 0; itrk < numStublists; itrk++) {
326  Tracklet* tracklet = inputtracklets_[itrk];
327  std::vector<const Stub*> trackstublist = inputstublists_[itrk];
328 
329  HybridFit hybridFitter(iSector_, settings_, globals_);
330  hybridFitter.Fit(tracklet, trackstublist);
331 
332  // If the track was accepted (and thus fit), add to output
333  if (tracklet->fit()) {
334  // Add track to output if it wasn't merged into another
335  Track* outtrack = tracklet->getTrack();
336  outtrack->setSector(iSector_);
337  if (trackInfo[itrk].second == true)
338  outtrack->setDuplicate(true);
339  else
340  outputtracklets_[trackInfo[itrk].first]->addTrack(tracklet);
341 
342  // Add all tracks to standalone root file output
343  outtrack->setStubIDpremerge(inputstubidslists_[itrk]);
344  outtrack->setStubIDprefit(mergedstubidslists_[itrk]);
345  outputtracks_.push_back(outtrack);
346  }
347  }
348  }
349 #endif
350 
352  // Grid removal //
354  if (settings_.removalType() == "grid") {
355  // Sort tracks by ichisq/DoF so that removal will keep the lower ichisq/DoF track
356  std::sort(inputtracks_.begin(), inputtracks_.end(), [](const Track* lhs, const Track* rhs) {
357  return lhs->ichisq() / lhs->stubID().size() < rhs->ichisq() / rhs->stubID().size();
358  });
359  bool grid[35][40] = {{false}};
360 
361  for (unsigned int itrk = 0; itrk < numTrk; itrk++) {
362  if (inputtracks_[itrk]->duplicate())
363  edm::LogPrint("Tracklet") << "WARNING: Track already tagged as duplicate!!";
364 
365  double phiBin = (inputtracks_[itrk]->phi0(settings_) - 2 * M_PI / 27 * iSector_) / (2 * M_PI / 9 / 50) + 9;
366  phiBin = std::max(phiBin, 0.);
367  phiBin = std::min(phiBin, 34.);
368 
369  double ptBin = 1 / inputtracks_[itrk]->pt(settings_) * 40 + 20;
370  ptBin = std::max(ptBin, 0.);
371  ptBin = std::min(ptBin, 39.);
372 
373  if (grid[(int)phiBin][(int)ptBin])
374  inputtracks_[itrk]->setDuplicate(true);
375  grid[(int)phiBin][(int)ptBin] = true;
376 
377  double phiTest = inputtracks_[itrk]->phi0(settings_) - 2 * M_PI / 27 * iSector_;
378  if (phiTest < -2 * M_PI / 27)
379  edm::LogVerbatim("Tracklet") << "track phi too small!";
380  if (phiTest > 2 * 2 * M_PI / 27)
381  edm::LogVerbatim("Tracklet") << "track phi too big!";
382  }
383  } // end grid removal
384 
386  // ichi + nstub removal //
388  if (settings_.removalType() == "ichi" || settings_.removalType() == "nstub") {
389  for (unsigned int itrk = 0; itrk < numTrk - 1; itrk++) { // numTrk-1 since last track has no other to compare to
390 
391  // If primary track is a duplicate, it cannot veto any...move on
392  if (inputtracks_[itrk]->duplicate() == 1)
393  continue;
394 
395  unsigned int nStubP = 0;
396  vector<unsigned int> nStubS(numTrk);
397  vector<unsigned int> nShare(numTrk);
398  // Get and count primary stubs
399  std::map<int, int> stubsTrk1 = inputtracks_[itrk]->stubID();
400  nStubP = stubsTrk1.size();
401 
402  for (unsigned int jtrk = itrk + 1; jtrk < numTrk; jtrk++) {
403  // Skip duplicate tracks
404  if (inputtracks_[jtrk]->duplicate() == 1)
405  continue;
406 
407  // Get and count secondary stubs
408  std::map<int, int> stubsTrk2 = inputtracks_[jtrk]->stubID();
409  nStubS[jtrk] = stubsTrk2.size();
410 
411  // Count shared stubs
412  for (auto& st : stubsTrk1) {
413  if (stubsTrk2.find(st.first) != stubsTrk2.end()) {
414  if (st.second == stubsTrk2[st.first])
415  nShare[jtrk]++;
416  }
417  }
418  }
419 
420  // Tag duplicates
421  for (unsigned int jtrk = itrk + 1; jtrk < numTrk; jtrk++) {
422  // Skip duplicate tracks
423  if (inputtracks_[jtrk]->duplicate() == 1)
424  continue;
425 
426  // Chi2 duplicate removal
427  if (settings_.removalType() == "ichi") {
428  if ((nStubP - nShare[jtrk] < settings_.minIndStubs()) ||
429  (nStubS[jtrk] - nShare[jtrk] < settings_.minIndStubs())) {
430  if ((int)inputtracks_[itrk]->ichisq() / (2 * inputtracks_[itrk]->stubID().size() - 4) >
431  (int)inputtracks_[jtrk]->ichisq() / (2 * inputtracks_[itrk]->stubID().size() - 4)) {
432  inputtracks_[itrk]->setDuplicate(true);
433  } else if ((int)inputtracks_[itrk]->ichisq() / (2 * inputtracks_[itrk]->stubID().size() - 4) <=
434  (int)inputtracks_[jtrk]->ichisq() / (2 * inputtracks_[itrk]->stubID().size() - 4)) {
435  inputtracks_[jtrk]->setDuplicate(true);
436  } else {
437  edm::LogVerbatim("Tracklet") << "Error: Didn't tag either track in duplicate pair.";
438  }
439  }
440  } // end ichi removal
441 
442  // nStub duplicate removal
443  if (settings_.removalType() == "nstub") {
444  if ((nStubP - nShare[jtrk] < settings_.minIndStubs()) && (nStubP < nStubS[jtrk])) {
445  inputtracks_[itrk]->setDuplicate(true);
446  } else if ((nStubS[jtrk] - nShare[jtrk] < settings_.minIndStubs()) && (nStubS[jtrk] <= nStubP)) {
447  inputtracks_[jtrk]->setDuplicate(true);
448  } else {
449  edm::LogVerbatim("Tracklet") << "Error: Didn't tag either track in duplicate pair.";
450  }
451  } // end nstub removal
452 
453  } // end tag duplicates
454 
455  } // end loop over primary track
456 
457  } // end ichi + nstub removal
458 
459  //Add tracks to output
460  if (settings_.removalType() != "merge") {
461  for (unsigned int i = 0; i < inputtrackfits_.size(); i++) {
462  for (unsigned int j = 0; j < inputtrackfits_[i]->nTracks(); j++) {
463  if (inputtrackfits_[i]->getTrack(j)->getTrack()->duplicate() == 0) {
464  if (settings_.writeMonitorData("Seeds")) {
465  ofstream fout("seeds.txt", ofstream::app);
466  fout << __FILE__ << ":" << __LINE__ << " " << name_ << "_" << iSector_ << " "
467  << inputtrackfits_[i]->getTrack(j)->getISeed() << endl;
468  fout.close();
469  }
470  outputtracklets_[i]->addTrack(inputtrackfits_[i]->getTrack(j));
471  }
472  //For root file:
473  outputtracks_.push_back(inputtrackfits_[i]->getTrack(j)->getTrack());
474  }
475  }
476  }
477 }

References Exception, trklet::Settings::extended(), spr::find(), dqmdumpme::first, trklet::HybridFit::Fit(), trklet::Tracklet::fit(), groupFilesInBlocks::fout, getPhiRes(), getTrack(), trklet::Tracklet::getTrack(), trklet::ProcessBase::globals_, getRunAppsInfo::grid, mps_fire::i, trklet::Track::ichisq(), inputstubidslists_, inputstublists_, inputtrackfits_, inputtracklets_, inputtracks_, createfilelist::int, trklet::ProcessBase::iSector_, dqmiolumiharvest::j, M_PI, SiStripPI::max, trklet::Settings::mergeComparison(), mergedstubidslists_, min(), trklet::Settings::minIndStubs(), trklet::ProcessBase::name_, outputtracklets_, BeamMonitor_cff::phiBin, muonRecoAnalyzer_cfi::ptBin, trklet::Settings::removalType(), edm::second(), trklet::Tracklet::seedIndex(), trklet::Track::setDuplicate(), trklet::Track::setSector(), trklet::Track::setStubIDprefit(), trklet::Track::setStubIDpremerge(), trklet::ProcessBase::settings_, findQualityFiles::size, trklet::Track::stubID(), and trklet::Settings::writeMonitorData().

◆ getPhiRes()

double PurgeDuplicate::getPhiRes ( Tracklet curTracklet,
const Stub curStub 
)
private

Definition at line 479 of file PurgeDuplicate.cc.

479  {
480  double phiproj;
481  double stubphi;
482  double phires;
483  // Get phi position of stub
484  stubphi = curStub->l1tstub()->phi();
485  // Get region that the stub is in (Layer 1->6, Disk 1->5)
486  int Layer = curStub->layer().value() + 1;
487  int Disk = curStub->disk().value();
488  // Get phi projection of tracklet
489  int seedindex = curTracklet->seedIndex();
490  // If this stub is a seed stub, set projection=phi, so that res=0
491  if ((seedindex == 0 && (Layer == 1 || Layer == 2)) || (seedindex == 1 && (Layer == 2 || abs(Disk) == 0)) ||
492  (seedindex == 2 && (Layer == 3 || Layer == 4)) || (seedindex == 3 && (Layer == 5 || Layer == 6)) ||
493  (seedindex == 4 && (abs(Disk) == 1 || abs(Disk) == 2)) ||
494  (seedindex == 5 && (abs(Disk) == 3 || abs(Disk) == 4)) || (seedindex == 6 && (Layer == 1 || abs(Disk) == 1)) ||
495  (seedindex == 7 && (Layer == 2 || abs(Disk) == 1)) ||
496  (seedindex == 8 && (Layer == 2 || Layer == 3 || Layer == 4)) ||
497  (seedindex == 9 && (Layer == 4 || Layer == 5 || Layer == 6)) ||
498  (seedindex == 10 && (Layer == 2 || Layer == 3 || abs(Disk) == 1)) ||
499  (seedindex == 11 && (Layer == 2 || abs(Disk) == 1 || abs(Disk) == 2))) {
500  phiproj = stubphi;
501  // Otherwise, get projection of tracklet
502  } else if (Layer != 0) {
503  phiproj = curTracklet->phiproj(Layer);
504  } else if (Disk != 0) {
505  phiproj = curTracklet->phiprojdisk(Disk);
506  } else {
507  throw cms::Exception("LogicError") << __FILE__ << " " << __LINE__ << " Layer: " << Layer << " -- Disk: " << Disk
508  << " Stub is not layer or disk in getPhiRes";
509  }
510  // Calculate residual
511  phires = std::abs(stubphi - phiproj);
512  return phires;
513 }

References funct::abs(), trklet::Stub::disk(), Exception, trklet::Stub::l1tstub(), trklet::Stub::layer(), trklet::L1TStub::phi(), trklet::Tracklet::phiproj(), trklet::Tracklet::phiprojdisk(), trklet::Tracklet::seedIndex(), and trklet::FPGAWord::value().

Referenced by execute().

Member Data Documentation

◆ inputstubidslists_

std::vector<std::vector<std::pair<int, int> > > trklet::PurgeDuplicate::inputstubidslists_
private

Definition at line 36 of file PurgeDuplicate.h.

Referenced by execute().

◆ inputstublists_

std::vector<std::vector<const Stub*> > trklet::PurgeDuplicate::inputstublists_
private

Definition at line 35 of file PurgeDuplicate.h.

Referenced by execute().

◆ inputtrackfits_

std::vector<TrackFitMemory*> trklet::PurgeDuplicate::inputtrackfits_
private

Definition at line 38 of file PurgeDuplicate.h.

Referenced by addInput(), and execute().

◆ inputtracklets_

std::vector<Tracklet*> trklet::PurgeDuplicate::inputtracklets_
private

Definition at line 39 of file PurgeDuplicate.h.

Referenced by execute().

◆ inputtracks_

std::vector<Track*> trklet::PurgeDuplicate::inputtracks_
private

Definition at line 34 of file PurgeDuplicate.h.

Referenced by execute().

◆ mergedstubidslists_

std::vector<std::vector<std::pair<int, int> > > trklet::PurgeDuplicate::mergedstubidslists_
private

Definition at line 37 of file PurgeDuplicate.h.

Referenced by execute().

◆ outputtracklets_

std::vector<CleanTrackMemory*> trklet::PurgeDuplicate::outputtracklets_
private

Definition at line 40 of file PurgeDuplicate.h.

Referenced by addOutput(), and execute().

trklet::PurgeDuplicate::mergedstubidslists_
std::vector< std::vector< std::pair< int, int > > > mergedstubidslists_
Definition: PurgeDuplicate.h:37
trklet::PurgeDuplicate::outputtracklets_
std::vector< CleanTrackMemory * > outputtracklets_
Definition: PurgeDuplicate.h:40
mps_fire.i
i
Definition: mps_fire.py:355
trklet::Settings::writetrace
bool writetrace() const
Definition: Settings.h:147
trklet::PurgeDuplicate::inputtracks_
std::vector< Track * > inputtracks_
Definition: PurgeDuplicate.h:34
input
static const std::string input
Definition: EdmProvDump.cc:48
trklet::Tracklet::getTrack
Track * getTrack()
Definition: Tracklet.h:477
trklet::Track::stubID
const std::map< int, int > & stubID() const
Definition: Track.h:41
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
trklet::Settings::minIndStubs
unsigned int minIndStubs() const
Definition: Settings.h:196
BeamMonitor_cff.phiBin
phiBin
Definition: BeamMonitor_cff.py:75
min
T min(T a, T b)
Definition: MathUtil.h:58
PatBasicFWLiteJetAnalyzer_Selector_cfg.outputs
outputs
Definition: PatBasicFWLiteJetAnalyzer_Selector_cfg.py:48
getRunAppsInfo.grid
grid
Definition: getRunAppsInfo.py:92
cms::cuda::assert
assert(be >=bs)
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
trklet::PurgeDuplicate::inputstubidslists_
std::vector< std::vector< std::pair< int, int > > > inputstubidslists_
Definition: PurgeDuplicate.h:36
trklet::ProcessBase::settings_
Settings const & settings_
Definition: ProcessBase.h:44
trklet::Tracklet::fit
bool fit() const
Definition: Tracklet.h:482
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
muonRecoAnalyzer_cfi.ptBin
ptBin
Definition: muonRecoAnalyzer_cfi.py:45
dqmdumpme.first
first
Definition: dqmdumpme.py:55
trklet::Track::setStubIDpremerge
void setStubIDpremerge(std::vector< std::pair< int, int >> stubIDpremerge)
Definition: Track.h:34
trklet::Tracklet
Definition: Tracklet.h:28
trklet::PurgeDuplicate::getPhiRes
double getPhiRes(Tracklet *curTracklet, const Stub *curStub)
Definition: PurgeDuplicate.cc:479
LayerTriplets::Layer
SeedingLayerSetsHits::SeedingLayer Layer
Definition: LayerTriplets.h:14
trklet::Track::setSector
void setSector(int nsec)
Definition: Track.h:33
trklet::Stub::disk
const FPGAWord & disk() const
Definition: Stub.h:57
trklet::Track
Definition: Track.h:18
trklet::Tracklet::seedIndex
unsigned int seedIndex() const
Definition: Tracklet.h:507
trklet::PurgeDuplicate::inputstublists_
std::vector< std::vector< const Stub * > > inputstublists_
Definition: PurgeDuplicate.h:35
trklet::HybridFit
Definition: HybridFit.h:30
trklet::PurgeDuplicate::inputtracklets_
std::vector< Tracklet * > inputtracklets_
Definition: PurgeDuplicate.h:39
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
trklet::Settings::extended
bool extended() const
Definition: Settings.h:207
groupFilesInBlocks.fout
fout
Definition: groupFilesInBlocks.py:162
trklet::Tracklet::phiprojdisk
double phiprojdisk(int disk) const
Definition: Tracklet.h:306
createfilelist.int
int
Definition: createfilelist.py:10
trklet::Settings::mergeComparison
std::string mergeComparison() const
Definition: Settings.h:198
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
edm::LogVerbatim
Definition: MessageLogger.h:297
PixelMapPlotter.inputs
inputs
Definition: PixelMapPlotter.py:490
edm::LogPrint
Definition: MessageLogger.h:342
trklet::Track::setStubIDprefit
void setStubIDprefit(std::vector< std::pair< int, int >> stubIDprefit)
Definition: Track.h:35
trklet::FPGAWord::value
int value() const
Definition: FPGAWord.h:24
trklet::Track::ichisq
int ichisq() const
Definition: Track.h:39
getTrack
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
Definition: GhostTrackState.cc:49
trklet::Settings::writeMonitorData
bool writeMonitorData(std::string module) const
Definition: Settings.h:86
Disk
Definition: BoundDisk.h:19
trklet::Settings::removalType
std::string removalType() const
Definition: Settings.h:197
trklet::PurgeDuplicate::inputtrackfits_
std::vector< TrackFitMemory * > inputtrackfits_
Definition: PurgeDuplicate.h:38
trklet::Stub::l1tstub
L1TStub * l1tstub()
Definition: Stub.h:69
Exception
Definition: hltDiff.cc:246
trklet::Track::setDuplicate
void setDuplicate(bool flag)
Definition: Track.h:32
trklet::Tracklet::phiproj
double phiproj(int layer) const
Definition: Tracklet.h:154
trklet::ProcessBase::name_
std::string name_
Definition: ProcessBase.h:38
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
trklet::ProcessBase::iSector_
unsigned int iSector_
Definition: ProcessBase.h:39
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
trklet::Stub::layer
const FPGAWord & layer() const
Definition: Stub.h:56
trklet::ProcessBase::globals_
Globals * globals_
Definition: ProcessBase.h:45
trklet::ProcessBase::ProcessBase
ProcessBase(std::string name, Settings const &settings, Globals *global, unsigned int iSector)
Definition: ProcessBase.cc:14
trklet::L1TStub::phi
double phi() const
Definition: L1TStub.h:62
memory
Definition: vlib.h:178
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443