CMS 3D CMS Logo

CMSInsideOutAlgorithm.cc
Go to the documentation of this file.
2 
4 
5 using namespace std;
6 
7 void CMSInsideOutAlgorithm::run(const std::vector<fastjet::PseudoJet>& fInput,
8  std::vector<fastjet::PseudoJet>& fOutput) {
9  //make a list of input objects
10  list<fastjet::PseudoJet> input;
11  for (std::vector<fastjet::PseudoJet>::const_iterator candIter = fInput.begin(); candIter != fInput.end();
12  ++candIter) {
13  input.push_back(*candIter);
14  }
15 
16  while (!input.empty() && input.front().perp() > seedThresholdPt_) {
17  //get seed eta/phi
18  double seedEta = input.front().eta();
19  double seedPhi = input.front().phi();
20 
21  //find iterators to those objects that are in the max cone size
22  list<inputListIter> maxCone;
23  // add seed, then test elements after seed
24  inputListIter iCand = input.begin();
25  maxCone.push_back(iCand++);
26  for (; iCand != input.end(); ++iCand) {
27  const fastjet::PseudoJet& candidate = *iCand;
28  if (reco::deltaR2(seedEta, candidate.eta(), seedPhi, candidate.phi()) < maxSizeSquared_)
29  maxCone.push_back(iCand);
30  }
31  //sort objects by increasing DR about the seed directions
32  maxCone.sort(ListIteratorLesserByDeltaR(seedEta, seedPhi));
33  list<inputListIter>::const_iterator position = maxCone.begin();
34  bool limitReached = false;
35  double totalET = (**position).perp();
36  ++position;
37  while (position != maxCone.end() && !limitReached) {
38  const fastjet::PseudoJet& theCandidate = **position;
39  double candidateET = theCandidate.perp() + totalET;
40  double candDR2 = reco::deltaR2(seedEta, theCandidate.eta(), seedPhi, theCandidate.phi());
41  if (candDR2 < minSizeSquared_ || candDR2 * candidateET * candidateET < growthParameterSquared_)
42  totalET = candidateET;
43  else
44  limitReached = true;
45  ++position;
46  }
47  //turn this into a final jet
48  fastjet::PseudoJet final;
49  for (list<inputListIter>::const_iterator iNewJet = maxCone.begin(); iNewJet != position; ++iNewJet) {
50  final += **iNewJet;
51  input.erase(*iNewJet);
52  }
53  fOutput.push_back(final);
54  } // end loop over seeds
55  sort(fOutput.begin(), fOutput.end(), greaterByEtPseudoJet);
56 }
bool greaterByEtPseudoJet(fastjet::PseudoJet const &j1, fastjet::PseudoJet const &j2)
static std::string const input
Definition: EdmProvDump.cc:47
std::list< fastjet::PseudoJet >::iterator inputListIter
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
static int position[264][3]
Definition: ReadPGInfo.cc:289
void run(const std::vector< fastjet::PseudoJet > &fInput, std::vector< fastjet::PseudoJet > &fOutput)
Build from input candidate collection.