CMS 3D CMS Logo

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